You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Classrooms__Lists__Group...

376 lines
1.0 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[81,5,6,7],{"+NIl":function(bt,Se,Q){(function(ue){ue(Q("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(J,k){"use strict";function X(m,g){m.cmdState.push(g)}function U(m){return m.cmdState.length>0?m.cmdState[m.cmdState.length-1]:null}function P(m){var g=m.cmdState.pop();g&&g.closeBracket()}function W(m){for(var g=m.cmdState,b=g.length-1;b>=0;b--){var a=g[b];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function B(m,g,b){return function(){this.name=m,this.bracketNo=0,this.style=g,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=B("importmodule","tag",["string","builtin"]),O.documentclass=B("documentclass","tag",["","atom"]),O.usepackage=B("usepackage","tag",["atom"]),O.begin=B("begin","tag",["atom"]),O.end=B("end","tag",["atom"]),O.label=B("label","tag",["atom"]),O.ref=B("ref","tag",["atom"]),O.eqref=B("eqref","tag",["atom"]),O.cite=B("cite","tag",["atom"]),O.bibitem=B("bibitem","tag",["atom"]),O.Bibitem=B("Bibitem","tag",["atom"]),O.RBibitem=B("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(m,g){m.f=g}function d(m,g){var b;if(m.match(/^\\[a-zA-Z@]+/)){var a=m.current().slice(1);return b=O.hasOwnProperty(a)?O[a]:O.DEFAULT,b=new b,X(g,b),A(g,w),b.style}if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/\\]/))return"tag";if(m.match("\\["))return A(g,function(s,l){return p(s,l,"\\]")}),"keyword";if(m.match("\\("))return A(g,function(s,l){return p(s,l,"\\)")}),"keyword";if(m.match("$$"))return A(g,function(s,l){return p(s,l,"$$")}),"keyword";if(m.match("$"))return A(g,function(s,l){return p(s,l,"$")}),"keyword";var i=m.next();if(i=="%")return m.skipToEnd(),"comment";if(i=="}"||i=="]"){if(b=U(g),b)b.closeBracket(i),A(g,w);else return"error";return"bracket"}else return i=="{"||i=="["?(b=O.DEFAULT,b=new b,X(g,b),"bracket"):/\d/.test(i)?(m.eatWhile(/[\w.%]/),"atom"):(m.eatWhile(/[\w\-_]/),b=W(g),b.name=="begin"&&(b.argument=m.current()),b.styleIdentifier())}function p(m,g,b){if(m.eatSpace())return null;if(b&&m.match(b))return A(g,d),"keyword";if(m.match(/^\\[a-zA-Z@]+/))return"tag";if(m.match(/^[a-zA-Z]+/))return"variable-2";if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/]/))return"tag";if(m.match(/^[\^_&]/))return"tag";if(m.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(m.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var a=m.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(m.skipToEnd(),"comment"):"error"}function w(m,g){var b=m.peek(),a;return b=="{"||b=="["?(a=U(g),a.openBracket(b),m.eat(b),A(g,d),"bracket"):/[ \t\r]/.test(b)?(m.eat(b),null):(A(g,d),P(g),d(m,g))}return{startState:function(){var m=k.inMathMode?function(g,b){return p(g,b)}:d;return{cmdState:[],f:m}},copyState:function(m){return{cmdState:m.cmdState.slice(),f:m.f}},token:function(m,g){return g.f(m,g)},blankLine:function(m){m.f=d,m.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(bt,Se,Q){},"/cxE":function(bt,Se,Q){"use strict";Q.d(Se,"e",function(){return k}),Q.d(Se,"f",function(){return X}),Q.d(Se,"g",function(){return U}),Q.d(Se,"d",function(){return W}),Q.d(Se,"a",function(){return B}),Q.d(Se,"b",function(){return O}),Q.d(Se,"c",function(){return A});var ue=function(){function d(){this.listeners=[],this.unexpectedErrorHandler=function(p){setTimeout(function(){throw p.stack?new Error(p.message+`
`+p.stack):p},0)}}return d.prototype.emit=function(p){this.listeners.forEach(function(w){w(p)})},d.prototype.onUnexpectedError=function(p){this.unexpectedErrorHandler(p),this.emit(p)},d.prototype.onUnexpectedExternalError=function(p){this.unexpectedErrorHandler(p)},d}(),J=new ue;function k(d){W(d)||J.onUnexpectedError(d);return}function X(d){W(d)||J.onUnexpectedExternalError(d);return}function U(d){if(d instanceof Error){var p=d.name,w=d.message,m=d.stacktrace||d.stack;return{$isError:!0,name:p,message:w,stack:m}}return d}var P="Canceled";function W(d){return d instanceof Error&&d.name===P&&d.message===P}function B(){var d=new Error(P);return d.name=d.message,d}function O(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function A(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"19Vz":function(bt,Se,Q){(function(ue){ue(Q("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(B,O,A){var d=A&&A!=ue.Init;if(O&&!d)B.on("blur",U),B.on("change",P),B.on("swapDoc",P),ue.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){X(B)}),P(B);else if(!O&&d){B.off("blur",U),B.off("change",P),B.off("swapDoc",P),ue.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),J(B);var p=B.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}O&&!B.hasFocus()&&U(B)});function J(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function k(B){J(B);var O=B.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=B.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var A=B.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),O.appendChild(A),B.display.lineSpace.insertBefore(O,B.display.lineSpace.firstChild)}function X(B){setTimeout(function(){var O=!1,A=B.getInputField();A.nodeName=="TEXTAREA"?O=!A.value:B.lineCount()==1&&(O=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),O?k(B):J(B)},20)}function U(B){W(B)&&k(B)}function P(B){var O=B.getWrapperElement(),A=W(B);O.className=O.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?k(B):J(B)}function W(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(bt,Se,Q){(function(ue){ue(Q("VrN/"))})(function(ue){"use strict";var J={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};ue.defineMode("xml",function(X,U){var P=X.indentUnit,W={},B=U.htmlMode?J:k;for(var O in B)W[O]=B[O];for(var O in U)W[O]=U[O];var A,d;function p(u,h){function T(F){return h.tokenize=F,F(u,h)}var L=u.next();if(L=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?T(g("atom","]]>")):null:u.match("--")?T(g("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),T(b(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),h.tokenize=g("meta","?>"),"meta"):(A=u.eat("/")?"closeTag":"openTag",h.tokenize=w,"tag bracket");if(L=="&"){var I;return u.eat("#")?u.eat("x")?I=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):I=u.eatWhile(/[\d]/)&&u.eat(";"):I=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),I?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function w(u,h){var T=u.next();if(T==">"||T=="/"&&u.eat(">"))return h.tokenize=p,A=T==">"?"endTag":"selfcloseTag","tag bracket";if(T=="=")return A="equals",null;if(T=="<"){h.tokenize=p,h.state=l,h.tagName=h.tagStart=null;var L=h.tokenize(u,h);return L?L+" tag error":"tag error"}else return/[\'\"]/.test(T)?(h.tokenize=m(T),h.stringStartCol=u.column(),h.tokenize(u,h)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(u){var h=function(T,L){for(;!T.eol();)if(T.next()==u){L.tokenize=w;break}return"string"};return h.isInAttribute=!0,h}function g(u,h){return function(T,L){for(;!T.eol();){if(T.match(h)){L.tokenize=p;break}T.next()}return u}}function b(u){return function(h,T){for(var L;(L=h.next())!=null;){if(L=="<")return T.tokenize=b(u+1),T.tokenize(h,T);if(L==">")if(u==1){T.tokenize=p;break}else return T.tokenize=b(u-1),T.tokenize(h,T)}return"meta"}}function a(u,h,T){this.prev=u.context,this.tagName=h,this.indent=u.indented,this.startOfLine=T,(W.doNotIndent.hasOwnProperty(h)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function s(u,h){for(var T;;){if(!u.context)return;if(T=u.context.tagName,!W.contextGrabbers.hasOwnProperty(T)||!W.contextGrabbers[T].hasOwnProperty(h))return;i(u)}}function l(u,h,T){return u=="openTag"?(T.tagStart=h.column(),S):u=="closeTag"?v:l}function S(u,h,T){return u=="word"?(T.tagName=h.current(),d="tag",_):W.allowMissingTagName&&u=="endTag"?(d="tag bracket",_(u,h,T)):(d="error",S)}function v(u,h,T){if(u=="word"){var L=h.current();return T.context&&T.context.tagName!=L&&W.implicitlyClosed.hasOwnProperty(T.context.tagName)&&i(T),T.context&&T.context.tagName==L||W.matchClosing===!1?(d="tag",y):(d="tag error",R)}else return W.allowMissingTagName&&u=="endTag"?(d="tag bracket",y(u,h,T)):(d="error",R)}function y(u,h,T){return u!="endTag"?(d="error",y):(i(T),l)}function R(u,h,T){return d="error",y(u,h,T)}function _(u,h,T){if(u=="word")return d="attribute",C;if(u=="endTag"||u=="selfcloseTag"){var L=T.tagName,I=T.tagStart;return T.tagName=T.tagStart=null,u=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(L)?s(T,L):(s(T,L),T.context=new a(T,L,I==T.indented)),l}return d="error",_}function C(u,h,T){return u=="equals"?E:(W.allowMissing||(d="error"),_(u,h,T))}function E(u,h,T){return u=="string"?c:u=="word"&&W.allowUnquoted?(d="string",_):(d="error",_(u,h,T))}function c(u,h,T){return u=="string"?c:_(u,h,T)}return{startState:function(u){var h={tokenize:p,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(h.baseIndent=u),h},token:function(u,h){if(!h.tagName&&u.sol()&&(h.indented=u.indentation()),u.eatSpace())return null;A=null;var T=h.tokenize(u,h);return(T||A)&&T!="comment"&&(d=null,h.state=h.state(A||T,u,h),d&&(T=d=="error"?T+" error":d)),T},indent:function(u,h,T){var L=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+P;if(L&&L.noIndent)return ue.Pass;if(u.tokenize!=w&&u.tokenize!=p)return T?T.match(/^(\s*)/)[0].length:0;if(u.tagName)return W.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+P*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(h))return 0;var I=h&&/^<(\/)?([\w_:\.-]*)/.exec(h);if(I&&I[1])for(;L;)if(L.tagName==I[2]){L=L.prev;break}else if(W.implicitlyClosed.hasOwnProperty(L.tagName))L=L.prev;else break;else if(I)for(;L;){var F=W.contextGrabbers[L.tagName];if(F&&F.hasOwnProperty(I[2]))L=L.prev;else break}for(;L&&L.prev&&!L.startOfLine;)L=L.prev;return L?L.indent+P:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(u){u.state==E&&(u.state=_)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var h=[],T=u.context;T;T=T.prev)T.tagName&&h.push(T.tagName);return h.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return k});var ue=Q("JYp7"),J=function(){function X(U){this.element=U,this.next=X.Undefined,this.prev=X.Undefined}return X.Undefined=new X(void 0),X}(),k=function(){function X(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}return Object.defineProperty(X.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),X.prototype.isEmpty=function(){return this._first===J.Undefined},X.prototype.clear=function(){this._first=J.Undefined,this._last=J.Undefined,this._size=0},X.prototype.unshift=function(U){return this._insert(U,!1)},X.prototype.push=function(U){return this._insert(U,!0)},X.prototype._insert=function(U,P){var W=this,B=new J(U);if(this._first===J.Undefined)this._first=B,this._last=B;else if(P){var O=this._last;this._last=B,B.prev=O,O.next=B}else{var A=this._first;this._first=B,B.next=A,A.prev=B}this._size+=1;var d=!1;return function(){d||(d=!0,W._remove(B))}},X.prototype.shift=function(){if(this._first===J.Undefined)return;var U=this._first.element;return this._remove(this._first),U},X.prototype.pop=function(){if(this._last===J.Undefined)return;var U=this._last.element;return this._remove(this._last),U},X.prototype._remove=function(U){if(U.prev!==J.Undefined&&U.next!==J.Undefined){var P=U.prev;P.next=U.next,U.next.prev=P}else U.prev===J.Undefined&&U.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):U.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):U.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1},X.prototype.iterator=function(){var U,P=this._first;return{next:function(){return P===J.Undefined?ue.c:(U?U.value=P.element:U={done:!1,value:P.element},P=P.next,U)}}},X.prototype.toArray=function(){for(var U=[],P=this._first;P!==J.Undefined;P=P.next)U.push(P.element);return U},X}()},"500L":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return v});var ue=Q("+L6B"),J=Q("2/Rp"),k=Q("2qtc"),X=Q("kLXV"),U=Q("9og8"),P=Q("k1fw"),W=Q("miYZ"),B=Q("tsqr"),O=Q("oBTY"),A=Q("tJVT"),d=Q("DZo9"),p=Q("8z0m"),w=Q("WmNS"),m=Q.n(w),g=Q("q1tI"),b=Q.n(g),a=Q("m3rI"),i=Q("wzkS"),s=Q("y5JW"),l=Q("LtfV"),S=p.a.Dragger;function v(y){var R=[];return y&&y.length>0&&(R=y.map(function(_){return{uid:_.id,id:_.id,name:_.title+s.c+_.filesize,url:_.url,filesize:_.filesize,status:"done",response:{id:_.id}}})),R}Se.b=function(y){var R=y.value,_=y.onChange,C=y.action,E=y.className,c=y.maxSize,u=c===void 0?150:c,h=y.title,T=h===void 0?"\u4E0A\u4F20\u9644\u4EF6":h,L=y.showRemoveModal,I=L===void 0?!1:L,F=y.accept,j=F===void 0?"":F,z=y.additionalText,M=y.isDragger,N=y.number,Y=N===void 0?1e3:N,ee=y.aloneClear,le=ee===void 0?!1:ee,pe=y.restrict,Oe=pe===void 0?!0:pe,Te=Object(g.useState)(!1),Re=Object(A.a)(Te,2),Ae=Re[0],we=Re[1],ge=Object(g.useState)(R||[]),de=Object(A.a)(ge,2),re=de[0],ce=de[1];Object(g.useEffect)(function(){R&&(ce(Object(O.a)(R)),Y===(R==null?void 0:R.length)&&we(!0))},[R]);var se=function(){setTimeout(function(){re.pop(),ce(Object(O.a)(re))},500)},ke={multiple:!0,disabled:Ae,accept:j,withCredentials:!0,fileList:re,beforeUpload:function(me,_e){var Me=me.size/1024/1024;return re.concat(_e).length>Y?(re.pop(),ce(Object(O.a)(re)),B.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(Y,"\u4E2A\u6587\u4EF6")),le?Promise.reject():(se(),!1)):Me<u?!0:(B.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(u,"MB).")),le?Promise.reject():(se(),!1))},action:C||"".concat(a.a.API_SERVER,"/api/attachments.json"),onChange:function(me){var _e=Object(O.a)(me.fileList);_e.length>=Y?we(!0):we(!1),ce(Object(O.a)(_e)),_e=_e.map(function(Me){var Ue;if(Me!=null&&(Ue=Me.response)!==null&&Ue!==void 0&&Ue.id){var je;Me.url="/api/attachments/".concat(Me==null||((je=Me.response)===null||je===void 0)?void 0:je.id)}return Me.name.indexOf(s.c)===-1&&(Me.name="".concat(Me.name).concat(s.c).concat(Object(s.a)(Me.size))),Object(P.a)({},Me)}),console.log("info:",me),_(_e)},onRemove:function(){var ae=Object(U.a)(m.a.mark(function _e(Me){var Ue;return m.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Ue=function(){var Je=Object(U.a)(m.a.mark(function $e(){var Qe,Xe;return m.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(Qe=Me.response?Me.response.id:Me.id,!Qe){tt.next=8;break}return tt.next=4,Object(i.d)(Me.response?Me.response.id:Me.uid);case 4:return Xe=tt.sent,tt.abrupt("return",Xe);case 8:return tt.abrupt("return",!0);case 9:case"end":return tt.stop()}},$e)}));return function(){return Je.apply(this,arguments)}}(),!I){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(Je,$e){X.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:b.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Qe=Object(U.a)(m.a.mark(function dt(){var tt;return m.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return Ie.next=2,Ue();case 2:tt=Ie.sent,B.b.success("\u5220\u9664\u6210\u529F"),Je(!0);case 5:case"end":return Ie.stop()}},dt)}));function Xe(){return Qe.apply(this,arguments)}return Xe}(),onCancel:function(){return Je(!1)}})}));case 5:return Fe.next=7,Ue();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},_e)}));function me(_e){return ae.apply(this,arguments)}return me}()};function ie(ae){ae.preventDefault(),ae.stopPropagation()}return b.a.createElement("div",{className:"multi-upload ".concat(E||"")},M&&b.a.createElement(S,ke,b.a.createElement("p",{className:"ant-upload-drag-icon"},b.a.createElement(l.a,null)),b.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",b.a.createElement("br",null),b.a.createElement("span",{style:{display:Oe?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",u,"MB) ")),z),!M&&b.a.createElement(p.a,ke,b.a.createElement(J.a,{disabled:Ae},T),b.a.createElement("span",{onClick:ie,style:{marginLeft:10,color:"#FA6400",display:Oe?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",u,"MB) ")))}},"55Ip":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return s}),Q.d(Se,"b",function(){return _});var ue=Q("Ty5D"),J=Q("dI71"),k=Q("q1tI"),X=Q.n(k),U=Q("YS25"),P=Q("17x9"),W=Q.n(P),B=Q("wx14"),O=Q("zLVn"),A=Q("9R94"),d=function(E){Object(J.a)(c,E);function c(){for(var h,T=arguments.length,L=new Array(T),I=0;I<T;I++)L[I]=arguments[I];return h=E.call.apply(E,[this].concat(L))||this,h.history=Object(U.a)(h.props),h}var u=c.prototype;return u.render=function(){return X.a.createElement(ue.c,{history:this.history,children:this.props.children})},c}(X.a.Component),p=function(E){Object(J.a)(c,E);function c(){for(var h,T=arguments.length,L=new Array(T),I=0;I<T;I++)L[I]=arguments[I];return h=E.call.apply(E,[this].concat(L))||this,h.history=Object(U.b)(h.props),h}var u=c.prototype;return u.render=function(){return X.a.createElement(ue.c,{history:this.history,children:this.props.children})},c}(X.a.Component),w=function(c,u){return typeof c=="function"?c(u):c},m=function(c,u){return typeof c=="string"?Object(U.c)(c,null,null,u):c},g=function(c){return c},b=X.a.forwardRef;typeof b=="undefined"&&(b=g);function a(E){return!!(E.metaKey||E.altKey||E.ctrlKey||E.shiftKey)}var i=b(function(E,c){var u=E.innerRef,h=E.navigate,T=E.onClick,L=Object(O.a)(E,["innerRef","navigate","onClick"]),I=L.target,F=Object(B.a)({},L,{onClick:function(z){try{T&&T(z)}catch(M){throw z.preventDefault(),M}!z.defaultPrevented&&z.button===0&&(!I||I==="_self")&&!a(z)&&(z.preventDefault(),h())}});return g!==b?F.ref=c||u:F.ref=u,X.a.createElement("a",F)}),s=b(function(E,c){var u=E.component,h=u===void 0?i:u,T=E.replace,L=E.to,I=E.innerRef,F=Object(O.a)(E,["component","replace","to","innerRef"]);return X.a.createElement(ue.e.Consumer,null,function(j){j||Object(A.a)(!1);var z=j.history,M=m(w(L,j.location),j.location),N=M?z.createHref(M):"",Y=Object(B.a)({},F,{href:N,navigate:function(){var le=w(L,j.location),pe=T?z.replace:z.push;pe(le)}});return g!==b?Y.ref=c||I:Y.innerRef=I,X.a.createElement(h,Y)})});if(!1)var l,S;var v=function(c){return c},y=X.a.forwardRef;typeof y=="undefined"&&(y=v);function R(){for(var E=arguments.length,c=new Array(E),u=0;u<E;u++)c[u]=arguments[u];return c.filter(function(h){return h}).join(" ")}var _=y(function(E,c){var u=E["aria-current"],h=u===void 0?"page":u,T=E.activeClassName,L=T===void 0?"active":T,I=E.activeStyle,F=E.className,j=E.exact,z=E.isActive,M=E.location,N=E.sensitive,Y=E.strict,ee=E.style,le=E.to,pe=E.innerRef,Oe=Object(O.a)(E,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return X.a.createElement(ue.e.Consumer,null,function(Te){Te||Object(A.a)(!1);var Re=M||Te.location,Ae=m(w(le,Re),Re),we=Ae.pathname,ge=we&&we.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),de=ge?Object(ue.f)(Re.pathname,{path:ge,exact:j,sensitive:N,strict:Y}):null,re=!!(z?z(de,Re):de),ce=re?R(F,L):F,se=re?Object(B.a)({},ee,{},I):ee,ke=Object(B.a)({"aria-current":re&&h||null,className:ce,style:se,to:Ae},Oe);return v!==y?ke.ref=c||pe:ke.innerRef=pe,X.a.createElement(s,ke)})});if(!1)var C},"746U":function(bt,Se,Q){"use strict";Q.d(Se,"d",function(){return J}),Q.d(Se,"j",function(){return k}),Q.d(Se,"i",function(){return X}),Q.d(Se,"h",function(){return U}),Q.d(Se,"e",function(){return P}),Q.d(Se,"k",function(){return W}),Q.d(Se,"l",function(){return B}),Q.d(Se,"a",function(){return O}),Q.d(Se,"f",function(){return d}),Q.d(Se,"g",function(){return p}),Q.d(Se,"m",function(){return w}),Q.d(Se,"c",function(){return b}),Q.d(Se,"b",function(){return a}),Q.d(Se,"n",function(){return i}),Q.d(Se,"o",function(){return s});var ue={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function J(l){return Array.isArray?Array.isArray(l):!!(l&&typeof l.length===ue.number&&l.constructor===Array)}function k(l){return typeof l===ue.string||l instanceof String}function X(l){return typeof l===ue.object&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}function U(l){return(typeof l===ue.number||l instanceof Number)&&!isNaN(l)}function P(l){return l===!0||l===!1}function W(l){return typeof l===ue.undefined}function B(l){return W(l)||l===null}function O(l,S){if(!l)throw new Error(S?"Unexpected type, expected '"+S+"'":"Unexpected type")}var A=Object.prototype.hasOwnProperty;function d(l){if(!X(l))return!1;for(var S in l)if(A.call(l,S))return!1;return!0}function p(l){return typeof l===ue.function}function w(l,S){for(var v=Math.min(l.length,S.length),y=0;y<v;y++)m(l[y],S[y])}function m(l,S){if(k(S)){if(typeof l!==S)throw new Error("argument does not match constraint: typeof "+S)}else if(p(S)){try{if(l instanceof S)return}catch(v){}if(!B(l)&&l.constructor===S)return;if(S.length===1&&S.call(void 0,l)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function g(l){for(var S=[],v=Object.getPrototypeOf(l);Object.prototype!==v;)S=S.concat(Object.getOwnPropertyNames(v)),v=Object.getPrototypeOf(v);return S}function b(l){for(var S=[],v=0,y=g(l);v<y.length;v++){var R=y[v];typeof l[R]=="function"&&S.push(R)}return S}function a(l,S){for(var v=function(E){return function(){var c=Array.prototype.slice.call(arguments,0);return S(E,c)}},y={},R=0,_=l;R<_.length;R++){var C=_[R];y[C]=v(C)}return y}function i(l){return l===null?void 0:l}function s(l){return typeof l=="undefined"?null:l}},"7Cbv":function(bt,Se,Q){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function k(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(J)}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(w){return typeof w=="string"&&X.test(w)}for(var P=U,W=[],B=0;B<256;++B)W.push((B+256).toString(16).substr(1));function O(w){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,g=(W[w[m+0]]+W[w[m+1]]+W[w[m+2]]+W[w[m+3]]+"-"+W[w[m+4]]+W[w[m+5]]+"-"+W[w[m+6]]+W[w[m+7]]+"-"+W[w[m+8]]+W[w[m+9]]+"-"+W[w[m+10]]+W[w[m+11]]+W[w[m+12]]+W[w[m+13]]+W[w[m+14]]+W[w[m+15]]).toLowerCase();if(!P(g))throw TypeError("Stringified UUID is invalid");return g}var A=O;function d(w,m,g){w=w||{};var b=w.random||(w.rng||k)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,m){g=g||0;for(var a=0;a<16;++a)m[g+a]=b[a];return m}return A(b)}var p=Se.a=d},"7ahc":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return S});var ue=Q("k1fw"),J=Q("0Owb"),k=Q("+L6B"),X=Q("2/Rp"),U=Q("y8nQ"),P=Q("Vl3Y"),W=Q("tJVT"),B=Q("OaEy"),O=Q("2fM7"),A=Q("q1tI"),d=Q.n(A),p=Q("VrN/"),w=Q.n(p),m=Q("p77/"),g=Q.n(m),b=Q("c5Ni"),a=Q.n(b),i=O.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Se.b=function(v){var y=v.callback,R=v.onCancel,_=Object(A.useState)("python"),C=Object(W.a)(_,2),E=C[0],c=C[1];function u(T){c(l[T][1])}function h(T){y(T)}return d.a.createElement(P.a,Object(J.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:h}),d.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},d.a.createElement(O.a,{onChange:u},Object.keys(l).map(function(T){return d.a.createElement(i,{key:T,value:T},l[T][0])}))),d.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},d.a.createElement(S,{mode:E})),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),d.a.createElement(X.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function S(v){var y=v.value,R=v.onChange,_=v.mode,C=v.options,E=C===void 0?{}:C,c=Object(A.useRef)(),u=Object(A.useState)(),h=Object(W.a)(u,2),T=h[0],L=h[1];return Object(A.useEffect)(function(){if(T){function I(F){var j=F.getValue();R&&R(j)}return T.on("change",I),function(){T.off("change",I)}}},[T,R]),Object(A.useEffect)(function(){T&&T.setOption("mode",_)},[T,_]),Object(A.useEffect)(function(){T&&((y!==T.getValue()||y==="")&&setTimeout(function(){T.setValue(y||" ")},300))},[T,y]),Object(A.useEffect)(function(){if(c.current&&!T){var I=w.a.fromTextArea(c.current,Object(ue.a)({mode:_,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));L(I)}},[c.current,T]),d.a.createElement("div",{className:"my-codemirror-container"},d.a.createElement("textarea",{ref:c}))}},"8EBN":function(bt,Se,Q){(function(ue){ue(Q("VrN/"))})(function(ue){"use strict";ue.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 J=0;J<ue.modeInfo.length;J++){var k=ue.modeInfo[J];k.mimes&&(k.mime=k.mimes[0])}ue.findModeByMIME=function(X){X=X.toLowerCase();for(var U=0;U<ue.modeInfo.length;U++){var P=ue.modeInfo[U];if(P.mime==X)return P;if(P.mimes){for(var W=0;W<P.mimes.length;W++)if(P.mimes[W]==X)return P}}if(/\+xml$/.test(X))return ue.findModeByMIME("application/xml");if(/\+json$/.test(X))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function(X){X=X.toLowerCase();for(var U=0;U<ue.modeInfo.length;U++){var P=ue.modeInfo[U];if(P.ext){for(var W=0;W<P.ext.length;W++)if(P.ext[W]==X)return P}}},ue.findModeByFileName=function(X){for(var U=0;U<ue.modeInfo.length;U++){var P=ue.modeInfo[U];if(P.file&&P.file.test(X))return P}var W=X.lastIndexOf("."),B=W>-1&&X.substring(W+1,X.length);if(B)return ue.findModeByExtension(B)},ue.findModeByName=function(X){X=X.toLowerCase();for(var U=0;U<ue.modeInfo.length;U++){var P=ue.modeInfo[U];if(P.name.toLowerCase()==X)return P;if(P.alias){for(var W=0;W<P.alias.length;W++)if(P.alias[W].toLowerCase()==X)return P}}}})},"8HAY":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return P}),Q.d(Se,"b",function(){return W});var ue=Q("pmY6"),J=Q("MI8n"),k=function(){var B=function(O,A){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,p){d.__proto__=p}||function(d,p){for(var w in p)p.hasOwnProperty(w)&&(d[w]=p[w])},B(O,A)};return function(O,A){B(O,A);function d(){this.constructor=O}O.prototype=A===null?Object.create(A):(d.prototype=A.prototype,new d)}}(),X=function(B,O,A,d){function p(w){return w instanceof A?w:new A(function(m){m(w)})}return new(A||(A=Promise))(function(w,m){function g(i){try{a(d.next(i))}catch(s){m(s)}}function b(i){try{a(d.throw(i))}catch(s){m(s)}}function a(i){i.done?w(i.value):p(i.value).then(g,b)}a((d=d.apply(B,O||[])).next())})},U=function(B,O){var A={label:0,sent:function(){if(w[0]&1)throw w[1];return w[1]},trys:[],ops:[]},d,p,w,m;return m={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function g(a){return function(i){return b([a,i])}}function b(a){if(d)throw new TypeError("Generator is already executing.");for(;A;)try{if(d=1,p&&(w=a[0]&2?p.return:a[0]?p.throw||((w=p.return)&&w.call(p),0):p.next)&&!(w=w.call(p,a[1])).done)return w;(p=0,w)&&(a=[a[0]&2,w.value]);switch(a[0]){case 0:case 1:w=a;break;case 4:return A.label++,{value:a[1],done:!1};case 5:A.label++,p=a[1],a=[0];continue;case 7:a=A.ops.pop(),A.trys.pop();continue;default:if(!(w=A.trys,w=w.length>0&&w[w.length-1])&&(a[0]===6||a[0]===2)){A=0;continue}if(a[0]===3&&(!w||a[1]>w[0]&&a[1]<w[3])){A.label=a[1];break}if(a[0]===6&&A.label<w[1]){A.label=w[1],w=a;break}if(w&&A.label<w[2]){A.label=w[2],A.ops.push(a);break}w[2]&&A.ops.pop(),A.trys.pop();continue}a=O.call(B,A)}catch(i){a=[6,i],p=0}finally{d=w=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},P=function(B){k(O,B);function O(A,d,p,w,m){d===void 0&&(d=""),p===void 0&&(p=""),w===void 0&&(w=!0);var g=B.call(this)||this;return g._onDidChange=g._register(new J.a),g.onDidChange=g._onDidChange.event,g._enabled=!0,g._checked=!1,g._id=A,g._label=d,g._cssClass=p,g._enabled=w,g._actionCallback=m,g}return Object.defineProperty(O.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"label",{get:function(){return this._label},set:function(A){this._setLabel(A)},enumerable:!0,configurable:!0}),O.prototype._setLabel=function(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))},Object.defineProperty(O.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(A){this._setTooltip(A)},enumerable:!0,configurable:!0}),O.prototype._setTooltip=function(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))},Object.defineProperty(O.prototype,"class",{get:function(){return this._cssClass},set:function(A){this._setClass(A)},enumerable:!0,configurable:!0}),O.prototype._setClass=function(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))},Object.defineProperty(O.prototype,"enabled",{get:function(){return this._enabled},set:function(A){this._setEnabled(A)},enumerable:!0,configurable:!0}),O.prototype._setEnabled=function(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))},Object.defineProperty(O.prototype,"checked",{get:function(){return this._checked},set:function(A){this._setChecked(A)},enumerable:!0,configurable:!0}),O.prototype._setChecked=function(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))},O.prototype.run=function(A,d){return this._actionCallback?this._actionCallback(A):Promise.resolve(!0)},O}(ue.a),W=function(B){k(O,B);function O(){var A=B!==null&&B.apply(this,arguments)||this;return A._onDidBeforeRun=A._register(new J.a),A.onDidBeforeRun=A._onDidBeforeRun.event,A._onDidRun=A._register(new J.a),A.onDidRun=A._onDidRun.event,A}return O.prototype.run=function(A,d){return X(this,void 0,void 0,function(){var p,w;return U(this,function(m){switch(m.label){case 0:if(!A.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:A}),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,this.runAction(A,d)];case 2:return p=m.sent(),this._onDidRun.fire({action:A,result:p}),[3,4];case 3:return w=m.sent(),this._onDidRun.fire({action:A,error:w}),[3,4];case 4:return[2]}})})},O.prototype.runAction=function(A,d){var p=d?A.run(d):A.run();return Promise.resolve(p)},O}(ue.a)},"8hTe":function(bt,Se,Q){bt.exports={button:"button___1wy9m"}},"9Bee":function(bt,Se,Q){"use strict";var ue=Q("DYRE"),J=Q("zeV3"),k=Q("+L6B"),X=Q("2/Rp"),U=Q("k1fw"),P=Q("9og8"),W=Q("tJVT"),B=Q("WmNS"),O=Q.n(B),A=Q("q1tI"),d=Q.n(A),p=Q("vg9a"),w=Q("DlQD"),m=Q.n(w),g=Q("rUJ1");function b(K,f){var x=K.match(/^(\s+)(?:```)/);if(x===null)return f;var G=x[1];return f.split(`
`).map(function($){var V=$.match(/^\s+/);if(V===null)return $;var be=Object(W.a)(V,1),Ge=be[0];return Ge.length>=G.length?$.slice(G.length):$}).join(`
`)}var a=[],i=["<ul>"],s=new m.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){a.length=0,i=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(K,f,x,G){if(f>=K.length||K[f].level<=x)return f;var $=K[f];G.push("<li><a href='#"+$.anchor+"'>"+$.text+"</a>"),f++;var V=[];return f=y(K,f,$.level,V),V.length>0&&(G.push("<ul>"),V.forEach(function(be){G.push(be)}),G.push("</ul>")),G.push("</li>"),f=y(K,f,x,G),f}function R(){return y(a,0,0,i),i.push("</ul>"),i.join("")}var _={heading:function(f){var x=l.exec(f);if(x)return{type:"heading",raw:x[0],depth:x[1].length,text:x[2]}},fences:function(f){var x=this.rules.block.fences.exec(f);if(x){var G=x[0],$=b(G,x[3]||""),V=x[2]?x[2].trim():x[2];if(["latex","katex","math"].indexOf(V)>=0){var be=c(),Ge=$;$=be,u[be]={type:"block",expression:Ge}}return{type:"code",raw:G,lang:V,text:$}}}},C=/(?:\${2})([^\n`]+?)(?:\${2})/gi,E=0,c=function(){return"__special_katext_id_".concat(E++,"__")},u={};function h(){return u}function T(){E=0,u={}}function L(K){return K=K.replace(C,function(f,x){var G=c();return u[G]={type:"inline",expression:x},G}),K}var I=s.listitem;s.listitem=function(K){return I(L(K))};var F=s.paragraph;s.paragraph=function(K){return F(L(K))};var j=s.tablecell;s.tablecell=function(K,f){return j(L(K),f)},s.code=function(K,f,x){var G=(f||"").match(/\S*/)[0];return G?["latex","katex","math"].indexOf(G)>=0?"<p class='editormd-tex'>".concat(K,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(f,'">').concat(x?K:Object(g.escape)(K,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(x?K:Object(g.escape)(K,!0))+"</code></pre>"},s.heading=function(K,f,x){var G=this.options.headerPrefix+x.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:G,level:f,text:K}),"<h"+f+' id="'+G+'">'+K+"</h"+f+">"},m.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),m.a.use({tokenizer:_,renderer:s});var z=m.a,M=Q("SJMd"),N=Q("ulZh"),Y=Q.n(N),ee=Q("m3rI"),le=Q("Oy/b"),pe=Q("p5ED"),Oe=Q("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Te=function(K,f){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,G){x.__proto__=G}||function(x,G){for(var $ in G)Object.prototype.hasOwnProperty.call(G,$)&&(x[$]=G[$])})(K,f)};function Re(K,f){function x(){this.constructor=K}Te(K,f),K.prototype=f===null?Object.create(f):(x.prototype=f.prototype,new x)}function Ae(K,f,x,G){return new(x||(x=Promise))(function($,V){function be(Et){try{nt(G.next(Et))}catch(Ve){V(Ve)}}function Ge(Et){try{nt(G.throw(Et))}catch(Ve){V(Ve)}}function nt(Et){var Ve;Et.done?$(Et.value):(Ve=Et.value,Ve instanceof x?Ve:new x(function(kt){kt(Ve)})).then(be,Ge)}nt((G=G.apply(K,f||[])).next())})}function we(K,f){var x,G,$,V,be={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return V={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Ge(nt){return function(Et){return function(Ve){if(x)throw new TypeError("Generator is already executing.");for(;be;)try{if(x=1,G&&($=2&Ve[0]?G.return:Ve[0]?G.throw||(($=G.return)&&$.call(G),0):G.next)&&!($=$.call(G,Ve[1])).done)return $;switch(G=0,$&&(Ve=[2&Ve[0],$.value]),Ve[0]){case 0:case 1:$=Ve;break;case 4:return be.label++,{value:Ve[1],done:!1};case 5:be.label++,G=Ve[1],Ve=[0];continue;case 7:Ve=be.ops.pop(),be.trys.pop();continue;default:if(!($=be.trys,($=$.length>0&&$[$.length-1])||Ve[0]!==6&&Ve[0]!==2)){be=0;continue}if(Ve[0]===3&&(!$||Ve[1]>$[0]&&Ve[1]<$[3])){be.label=Ve[1];break}if(Ve[0]===6&&be.label<$[1]){be.label=$[1],$=Ve;break}if($&&be.label<$[2]){be.label=$[2],be.ops.push(Ve);break}$[2]&&be.ops.pop(),be.trys.pop();continue}Ve=f.call(K,be)}catch(kt){Ve=[6,kt],G=0}finally{x=$=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([nt,Et])}}}function ge(){for(var K=0,f=0,x=arguments.length;f<x;f++)K+=arguments[f].length;var G=Array(K),$=0;for(f=0;f<x;f++)for(var V=arguments[f],be=0,Ge=V.length;be<Ge;be++,$++)G[$]=V[be];return G}var de=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(f,x){for(var G=0,$=x;G<$.length;G++){var V=$[G],be=V[0],Ge=V[1];f.setAttribute(be,Ge)}},K.createRect=function(f,x,G){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",f.toString()),$.setAttribute("height",x.toString()),G&&K.setAttributes($,G),$},K.createLine=function(f,x,G,$,V){var be=document.createElementNS("http://www.w3.org/2000/svg","line");return be.setAttribute("x1",f.toString()),be.setAttribute("y1",x.toString()),be.setAttribute("x2",G.toString()),be.setAttribute("y2",$.toString()),V&&K.setAttributes(be,V),be},K.createPolygon=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",f),x&&K.setAttributes(G,x),G},K.createCircle=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(f/2).toString()),G.setAttribute("cy",(f/2).toString()),G.setAttribute("r",f.toString()),x&&K.setAttributes(G,x),G},K.createEllipse=function(f,x,G){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(f/2).toString()),$.setAttribute("cy",(x/2).toString()),$.setAttribute("rx",(f/2).toString()),$.setAttribute("ry",(x/2).toString()),G&&K.setAttributes($,G),$},K.createGroup=function(f){var x=document.createElementNS("http://www.w3.org/2000/svg","g");return f&&K.setAttributes(x,f),x},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(f,x,G,$,V,be,Ge){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(nt,[["id",f],["orient",x],["markerWidth",G.toString()],["markerHeight",$.toString()],["refX",V.toString()],["refY",be.toString()]]),nt.appendChild(Ge),nt},K.createText=function(f){var x=document.createElementNS("http://www.w3.org/2000/svg","text");return x.setAttribute("x","0"),x.setAttribute("y","0"),f&&K.setAttributes(x,f),x},K.createTSpan=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=f,x&&K.setAttributes(G,x),G},K.createImage=function(f){var x=document.createElementNS("http://www.w3.org/2000/svg","image");return f&&K.setAttributes(x,f),x},K.createPoint=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=f,G.y=x,G},K.createPath=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",f),x&&K.setAttributes(G,x),G},K}(),re=function(){function K(){}return K.addKey=function(f){K.key=f},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),ce=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(f,x,G){var $=this;return new Promise(function(V){var be=G!==void 0?G:document.createElement("canvas");f===null&&($.markersOnly=!0,$.naturalSize=!1);var Ge=document.createElementNS("http://www.w3.org/2000/svg","svg");Ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ge.setAttribute("width",x.width.baseVal.valueAsString),Ge.setAttribute("height",x.height.baseVal.valueAsString),Ge.setAttribute("viewBox","0 0 "+x.viewBox.baseVal.width.toString()+" "+x.viewBox.baseVal.height.toString()),Ge.innerHTML=x.innerHTML,$.naturalSize===!0?(Ge.width.baseVal.value=f.naturalWidth,Ge.height.baseVal.value=f.naturalHeight):$.width!==void 0&&$.height!==void 0&&(Ge.width.baseVal.value=$.width,Ge.height.baseVal.value=$.height),be.width=Ge.width.baseVal.value,be.height=Ge.height.baseVal.value;var nt=Ge.outerHTML,Et=be.getContext("2d");$.markersOnly!==!0&&Et.drawImage(f,0,0,be.width,be.height);var Ve=window.URL,kt=new Image(be.width,be.height);kt.setAttribute("crossOrigin","anonymous");var Kt=new Blob([nt],{type:"image/svg+xml"}),sr=Ve.createObjectURL(Kt);kt.onload=function(){Et.drawImage(kt,0,0),Ve.revokeObjectURL(sr);var jr=be.toDataURL($.imageType,$.imageQuality);V(jr)},kt.src=sr})},K}(),se=function(){},ke=function(){function K(f){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+f+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.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(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(f){return this.styleSheet===void 0&&this.addStyleSheet(),f.name=""+this.classNamePrefix+f.localName,this.classes.push(f),this.styleSheet.sheet.insertRule("."+f.name+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length),f},K.prototype.addRule=function(f){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(f),this.styleSheet.sheet.insertRule(f.selector+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var f;this.styleSheet=document.createElement("style"),((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).appendChild(this.styleSheet),this.addRule(new ie("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ie("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ie("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ae("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ae("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},K.prototype.removeStyleSheet=function(){var f;this.styleSheet&&(((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),ie=function(K,f){this.selector=K,this.style=f},ae=function(K,f){this.localName=K,this.style=f},me=function(){function K(f,x,G,$,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=f,this.displayMode=x,this.markerItems=G,this.uiStyleSettings=$,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return K.prototype.show=function(f){var x=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=f,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",this.uiContainer.appendChild(G),this.addActionButton(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(V){var be=document.createElement("div");be.className=""+x.toolbarButtonStyleClass.name,be.setAttribute("data-type-name",V.typeName),be.innerHTML=V.icon,be.addEventListener("click",function(){x.markerToolbarButtonClicked(be,V)}),x.buttons.push(be),x.markerButtons.push(be)}),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 $=document.createElement("div");$.className=this.toolbarBlockStyleClass.name,$.style.whiteSpace="nowrap",$.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild($),this.addActionButton($,'<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($,'<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()},K.prototype.addButtonClickListener=function(f){this.buttonClickListeners.push(f)},K.prototype.removeButtonClickListener=function(f){this.buttonClickListeners.indexOf(f)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(f),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var f=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var x=0;x<this.markerButtons.length;x++)x<f||x===f&&this.markerButtons.length-1===f?this.markerButtonBlock.appendChild(this.markerButtons[x]):(x===f&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[x]))}},K.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")},K.prototype.resetButtonStyles=function(){var f=this;this.buttons.forEach(function(x){x.className=x.className.replace(f.uiStyleSettings.toolbarButtonStyleColorsClassName?f.uiStyleSettings.toolbarButtonStyleColorsClassName:f.toolbarButtonStyleColorsClass.name,"").trim(),x.className=x.className.replace(f.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?f.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:f.toolbarActiveButtonStyleColorsClass.name,"").trim(),x.className+=" "+(f.uiStyleSettings.toolbarButtonStyleColorsClassName?f.uiStyleSettings.toolbarButtonStyleColorsClassName:f.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(f,x,G){var $=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=x,V.setAttribute("data-action",G),V.addEventListener("click",function(){$.actionToolbarButtonClicked(V,G)}),G){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}f.appendChild(V),this.buttons.push(V)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ae("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 ae("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ae("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ae("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 ae("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ae("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
padding: `+f+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ae("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ie("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ie("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},K.prototype.markerToolbarButtonClicked=function(f,x){this.setActiveButton(f),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("marker",x)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(f,x){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",x)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(f){this.resetButtonStyles(),f.className=f.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),f.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(f){var x=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===f});x&&this.setActiveButton(x)},K.prototype.setCurrentMarker=function(f){var x=this;this.currentMarker=f,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){x.currentMarker===void 0?(G.style.fillOpacity="0.4",G.style.pointerEvents="none"):(G.style.fillOpacity="1",G.style.pointerEvents="all")})},K}(),_e=function(){function K(f,x,G,$){this.panels=[],this.panelButtons=[],this.markerjsContainer=f,this.displayMode=x,this.uiStyleSettings=G,this.styles=$,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var f;this.toolboxStyleClass=this.styles.addClass(new ae("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 ae("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var x=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ae("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ae("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ae("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 ae("toolbox-panel-row_colors",`
background-color: `+((f=this.uiStyleSettings.toolboxBackgroundColor)!==null&&f!==void 0?f:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ae("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*x)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*x)+`px;
padding: `+x+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ie("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ie("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},K.prototype.show=function(f){var x;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=f,this.uiContainer.className=this.toolboxStyleClass.name+" "+((x=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&x!==void 0?x:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(f){var x,G,$=this;this.panels=f,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((x=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&x!==void 0?x:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((G=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&G!==void 0?G:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var be;V.uiStyleSettings=$.uiStyleSettings;var Ge=document.createElement("div");Ge.className=$.toolboxButtonStyleClass.name+" "+((be=$.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&be!==void 0?be:$.toolboxButtonStyleColorsClass.name),Ge.innerHTML=V.icon,Ge.title=V.title,Ge.addEventListener("click",function(){$.panelButtonClick(V)}),$.panelButtons.push(Ge),$.buttonRow.appendChild(Ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(f){var x=this,G=-1;if(f!==this.activePanel){G=this.panels.indexOf(f),this.panelRow.innerHTML="";var $=f.getUi();$.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild($),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=f}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){x.displayMode==="inline"?x.panelRow.style.display="none":x.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,be){var Ge,nt;V.className=x.toolboxButtonStyleClass.name+" "+(be===G?""+((Ge=x.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ge!==void 0?Ge:x.toolboxActiveButtonStyleColorsClass.name):""+((nt=x.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:x.toolboxButtonStyleColorsClass.name))})},K}(),Me=function(K,f){this.title=K,this.icon=f},Ue=function(K){function f(x,G,$,V){var be=K.call(this,x,V||'<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 be.colors=[],be.addTransparent=!1,be.colorBoxes=[],be.colors=G,be.currentColor=$,be.setCurrentColor=be.setCurrentColor.bind(be),be.getColorBox=be.getColorBox.bind(be),be}return Re(f,K),f.prototype.getUi=function(){var x=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.whiteSpace="nowrap",this.colors.forEach(function($){var V=x.getColorBox($);G.appendChild(V),x.colorBoxes.push(V)}),G},f.prototype.getColorBox=function(x){var G=this,$=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-$,be=document.createElement("div");be.style.display="inline-block",be.style.boxSizing="content-box",be.style.width=V-2+"px",be.style.height=V-2+"px",be.style.padding="1px",be.style.marginRight="2px",be.style.marginBottom="2px",be.style.borderWidth="2px",be.style.borderStyle="solid",be.style.borderRadius=(V+2)/2+"px",be.style.borderColor=x===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",be.addEventListener("click",function(){G.setCurrentColor(x,be)});var Ge=document.createElement("div");return Ge.style.display="inline-block",Ge.style.width=V-2+"px",Ge.style.height=V-2+"px",Ge.style.backgroundColor=x,Ge.style.borderRadius=V/2+"px",x==="transparent"&&(Ge.style.fill=this.uiStyleSettings.toolboxAccentColor,Ge.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),be.appendChild(Ge),be},f.prototype.setCurrentColor=function(x,G){var $=this;this.currentColor=x,this.colorBoxes.forEach(function(V){V.style.borderColor=V===G?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(x)},f}(Me),je=function(){function K(f,x,G){this._state="new",this._isSelected=!1,this._container=f,this._overlayContainer=x,this.globalSettings=G,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(K.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),K.prototype.ownsTarget=function(f){return!1},Object.defineProperty(K.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),K.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},K.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},K.prototype.pointerDown=function(f,x){},K.prototype.dblClick=function(f,x){},K.prototype.manipulate=function(f){},K.prototype.pointerUp=function(f){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(f){this.container.childNodes.length>0?this.container.insertBefore(f,this.container.childNodes[0]):this.container.appendChild(f)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(f){this._state=f.state,this.notes=f.notes},K.prototype.scale=function(f,x){},K.prototype.colorChanged=function(f){this.onColorChanged&&this.onColorChanged(f),this.stateChanged()},K.prototype.fillColorChanged=function(f){this.onFillColorChanged&&this.onFillColorChanged(f),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var f=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),f.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(f)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),Fe=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(f){return this.topLeft.ownsTarget(f)?this.topLeft:this.topCenter.ownsTarget(f)?this.topCenter:this.topRight.ownsTarget(f)?this.topRight:this.centerLeft.ownsTarget(f)?this.centerLeft:this.centerRight.ownsTarget(f)?this.centerRight:this.bottomLeft.ownsTarget(f)?this.bottomLeft:this.bottomCenter.ownsTarget(f)?this.bottomCenter:this.bottomRight.ownsTarget(f)?this.bottomRight:void 0},K}(),Je=function(){function K(){this.GRIP_SIZE=10,this.visual=de.createGroup(),this.visual.appendChild(de.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(de.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(f){return f===this.visual||f===this.visual.childNodes[0]||f===this.visual.childNodes[1]},K}(),$e=function(){function K(){}return K.toITransformMatrix=function(f){return{a:f.a,b:f.b,c:f.c,d:f.d,e:f.e,f:f.f}},K.toSVGMatrix=function(f,x){return f.a=x.a,f.b=x.b,f.c=x.c,f.d=x.d,f.e=x.e,f.f=x.f,f},K}(),Qe=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(de.createTransform()),V.setupControlBox(),V}return Re(f,K),Object.defineProperty(f.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"visual",{get:function(){return this._visual},set:function(x){this._visual=x;var G=de.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),f.prototype.ownsTarget=function(x){return!!K.prototype.ownsTarget.call(this,x)||!!(this.controlGrips.findGripByVisual(x)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(x))},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.state==="new"&&(this.left=x.x,this.top=x.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var $=this.unrotatePoint(x);if(this.manipulationStartX=$.x,this.manipulationStartY=$.y,this.offsetX=$.x-this.left,this.offsetY=$.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(G),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(G)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var be=this.container.transform.baseVal.getItem(0);be.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(be,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},f.prototype.pointerUp=function(x){var G=this.state;K.prototype.pointerUp.call(this,x),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(x),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},f.prototype.moveVisual=function(x){this.visual.style.transform="translate("+x.x+"px, "+x.y+"px)"},f.prototype.manipulate=function(x){var G=this.unrotatePoint(x);this.state==="creating"?this.resize(x):this.state==="move"?(this.left=this.manipulationStartLeft+(G.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(G.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(G):this.state==="rotate"&&this.rotate(x)},f.prototype.resize=function(x){var G=this.manipulationStartLeft,$=this.manipulationStartWidth,V=this.manipulationStartTop,be=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:G=this.manipulationStartLeft+x.x-this.manipulationStartX,$=this.manipulationStartWidth+this.manipulationStartLeft-G;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:$=this.manipulationStartWidth+x.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+x.y-this.manipulationStartY,be=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:be=this.manipulationStartHeight+x.y-this.manipulationStartY}$>=0?(this.left=G,this.width=$):(this.left=G+$,this.width=-$),be>=0?(this.top=V,this.height=be):(this.top=V+be,this.height=-be),this.setSize()},f.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},f.prototype.rotate=function(x){if(Math.abs(x.x-this.centerX)>.1){var G=Math.sign(x.x-this.centerX);this.rotationAngle=180*Math.atan((x.y-this.centerY)/(x.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},f.prototype.applyRotation=function(){var x=this.container.transform.baseVal.getItem(0);x.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(x,0)},f.prototype.rotatePoint=function(x){if(this.rotationAngle===0)return x;var G=this.container.getCTM(),$=de.createPoint(x.x,x.y);return{x:($=$.matrixTransform(G)).x,y:$.y}},f.prototype.unrotatePoint=function(x){if(this.rotationAngle===0)return x;var G=this.container.getCTM();G=G.inverse();var $=de.createPoint(x.x,x.y);return{x:($=$.matrixTransform(G)).x,y:$.y}},f.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},f.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},f.prototype.setupControlBox=function(){this.controlBox=de.createGroup();var x=de.createTransform();x.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(x),this.container.appendChild(this.controlBox),this.controlRect=de.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=de.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"},f.prototype.adjustControlBox=function(){var x=this.controlBox.transform.baseVal.getItem(0);x.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(x,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},f.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()},f.prototype.createGrip=function(){var x=new Je;return x.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(x.visual),x},f.prototype.positionGrips=function(){var x=this.controlGrips.topLeft.GRIP_SIZE,G=-x/2,$=G,V=(this.width+this.CB_DISTANCE)/2-x/2,be=(this.height+this.CB_DISTANCE)/2-x/2,Ge=this.height+this.CB_DISTANCE-x/2,nt=this.width+this.CB_DISTANCE-x/2;this.positionGrip(this.controlGrips.topLeft.visual,G,$),this.positionGrip(this.controlGrips.topCenter.visual,V,$),this.positionGrip(this.controlGrips.topRight.visual,nt,$),this.positionGrip(this.controlGrips.centerLeft.visual,G,be),this.positionGrip(this.controlGrips.centerRight.visual,nt,be),this.positionGrip(this.controlGrips.bottomLeft.visual,G,Ge),this.positionGrip(this.controlGrips.bottomCenter.visual,V,Ge),this.positionGrip(this.controlGrips.bottomRight.visual,nt,Ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,$-3*this.CB_DISTANCE)},f.prototype.positionGrip=function(x,G,$){var V=x.transform.baseVal.getItem(0);V.setTranslate(G,$),x.transform.baseVal.replaceItem(V,0)},f.prototype.hideControlBox=function(){this.controlBox.style.display="none"},f.prototype.showControlBox=function(){this.controlBox.style.display=""},f.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:$e.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:$e.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},f.prototype.restoreState=function(x){K.prototype.restoreState.call(this,x);var G=x;this.left=G.left,this.top=G.top,this.width=G.width,this.height=G.height,this.rotationAngle=G.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix($e.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,G.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix($e.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,G.containerTransformMatrix))},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G);var $=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:$.x*x,y:$.y*G});this.left=V.x,this.top=V.y,this.width=this.width*x,this.height=this.height*G,this.adjustControlBox()},f}(je),Xe=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return Re(f,K),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.visual)},f.prototype.createVisual=function(){this.visual=de.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)},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.state==="new"&&(this.createVisual(),this.moveVisual(x),this._state="creating")},f.prototype.manipulate=function(x){K.prototype.manipulate.call(this,x)},f.prototype.resize=function(x){K.prototype.resize.call(this,x),this.setSize()},f.prototype.setSize=function(){K.prototype.setSize.call(this),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},f.prototype.pointerUp=function(x){K.prototype.pointerUp.call(this,x),this.setSize()},f.prototype.setStrokeColor=function(x){this.strokeColor=x,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(x),this.stateChanged()},f.prototype.setFillColor=function(x){this.fillColor=x,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},f.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},f.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},f.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this))},f.prototype.restoreState=function(x){var G=x;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,x),this.setSize()},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G),this.setSize()},f.title="Rectangle marker",f}(Qe),dt=function(K){function f(x,G,$,V){var be=K.call(this,x,V||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return be.widths=[],be.widthBoxes=[],be.widths=G,be.currentWidth=$,be.setCurrentWidth=be.setCurrentWidth.bind(be),be}return Re(f,K),f.prototype.getUi=function(){var x=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.widths.forEach(function($){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=$===x.currentWidth?x.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){x.setCurrentWidth($,V)}),G.appendChild(V);var be=document.createElement("div");be.innerText=$.toString(),be.style.marginRight="5px",V.appendChild(be);var Ge=document.createElement("div");Ge.style.minHeight="20px",Ge.style.flexGrow="2",Ge.style.display="flex",Ge.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=$+"px solid "+x.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",Ge.appendChild(nt),V.appendChild(Ge),x.widthBoxes.push(V)}),G},f.prototype.setCurrentWidth=function(x,G){var $=this;this.currentWidth=x,this.widthBoxes.forEach(function(V){V.style.borderColor=V===G?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},f}(Me),tt=function(K){function f(x,G,$,V){var be=K.call(this,x,V||'<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 be.styles=[],be.styleBoxes=[],be.styles=G,be.currentStyle=$,be.setCurrentStyle=be.setCurrentStyle.bind(be),be}return Re(f,K),f.prototype.getUi=function(){var x=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.styles.forEach(function($){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/x.styles.length-5+"%",V.style.borderColor=$===x.currentStyle?x.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){x.setCurrentStyle($,V)}),G.appendChild(V);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.overflow="hidden";var Ge=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+x.uiStyleSettings.toolboxColor+'" stroke-width="3" '+($!==""?'stroke-dasharray="'+$+'"':"")+` />
</svg>`;be.innerHTML=Ge,V.appendChild(be),x.styleBoxes.push(V)}),G},f.prototype.setCurrentStyle=function(x,G){var $=this;this.currentStyle=x,this.styleBoxes.forEach(function(V){V.style.borderColor=V===G?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},f}(Me),lt=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.strokePanel=new Ue("Line color",$.defaultColorSet,$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Re(f,K),Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=K.prototype.getState.call(this);return x.typeName=f.typeName,x},f.typeName="FrameMarker",f.title="Frame marker",f.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',f}(Xe),Ie=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},et=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return Re(f,K),f.prototype.ownsTarget=function(x){return!!K.prototype.ownsTarget.call(this,x)||!(!this.grip1.ownsTarget(x)&&!this.grip2.ownsTarget(x))},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.manipulationStartX=x.x,this.manipulationStartY=x.y,this.state==="new"&&(this.x1=x.x,this.y1=x.y,this.x2=x.x,this.y2=x.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(G)?this.activeGrip=this.grip1:this.grip2.ownsTarget(G)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},f.prototype.pointerUp=function(x){var G=this.state;K.prototype.pointerUp.call(this,x),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(x),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},f.prototype.adjustVisual=function(){},f.prototype.manipulate=function(x){this.state==="creating"?this.resize(x):this.state==="move"?(this.x1=this.manipulationStartX1+x.x-this.manipulationStartX,this.y1=this.manipulationStartY1+x.y-this.manipulationStartY,this.x2=this.manipulationStartX2+x.x-this.manipulationStartX,this.y2=this.manipulationStartY2+x.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(x)},f.prototype.resize=function(x){switch(this.activeGrip){case this.grip1:this.x1=x.x,this.y1=x.y;break;case this.grip2:case void 0:this.x2=x.x,this.y2=x.y}this.adjustVisual(),this.adjustControlBox()},f.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},f.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},f.prototype.setupControlBox=function(){this.controlBox=de.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},f.prototype.adjustControlBox=function(){this.positionGrips()},f.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},f.prototype.createGrip=function(){var x=new Je;return x.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(x.visual),x},f.prototype.positionGrips=function(){var x=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-x/2,this.y1-x/2),this.positionGrip(this.grip2.visual,this.x2-x/2,this.y2-x/2)},f.prototype.positionGrip=function(x,G,$){var V=x.transform.baseVal.getItem(0);V.setTranslate(G,$),x.transform.baseVal.replaceItem(V,0)},f.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},f.prototype.restoreState=function(x){K.prototype.restoreState.call(this,x);var G=x;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G),this.x1=this.x1*x,this.y1=this.y1*G,this.x2=this.x2*x,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},f}(je),it=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.strokePanel=new Ue("Line color",$.defaultColorSet,$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Re(f,K),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.visual&&x!==this.selectorLine&&x!==this.visibleLine)},f.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorLine=de.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=de.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)},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},f.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()),de.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},f.prototype.setStrokeColor=function(x){this.strokeColor=x,this.adjustVisual(),this.colorChanged(x)},f.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.adjustVisual()},f.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.adjustVisual(),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){K.prototype.restoreState.call(this,x);var G=x;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},f.typeName="LineMarker",f.title="Line marker",f.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',f}(et),Be=function(K){function f(x,G,$,V){var be=K.call(this,x,V||'<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 be.fonts=[],be.fontBoxes=[],be.fonts=G,be.currentFont=$,be.setCurrentFont=be.setCurrentFont.bind(be),be}return Re(f,K),f.prototype.getUi=function(){var x=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.flexGrow="2",this.fonts.forEach(function($){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/x.fonts.length-5+"%",V.style.borderColor=$===x.currentFont?x.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){x.setCurrentFont($,V)}),G.appendChild(V);var be=document.createElement("div");be.style.display="flex",be.style.minHeight="20px",be.style.flexGrow="2",be.style.fontFamily=$,be.style.overflow="hidden";var Ge=document.createElement("div");Ge.style.whiteSpace="nowrap",Ge.style.overflow="hidden",Ge.style.textOverflow="ellipsis",Ge.innerHTML="The quick brown fox jumps over the lazy dog",be.appendChild(Ge),V.appendChild(be),x.fontBoxes.push(V)}),G},f.prototype.setCurrentFont=function(x,G){var $=this;this.currentFont=x,this.fontBoxes.forEach(function(V){V.style.borderColor=V===G?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},f}(Me),ze=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=$.defaultColor,V.fontFamily=$.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Ue("Color",$.defaultColorSet,$.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new Be("Font",$.defaultFontFamilies,$.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return Re(f,K),f.prototype.ownsTarget=function(x){if(K.prototype.ownsTarget.call(this,x)||x===this.visual||x===this.textElement||x===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function($){$===x&&(G=!0)}),G},f.prototype.createVisual=function(){this.visual=de.createGroup(),this.bgRectangle=de.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=de.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.isMoved=!1,this.pointerDownPoint=x,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(x),this._state="creating")},f.prototype.renderText=function(){var x=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(G){x.textElement.appendChild(de.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},f.prototype.getTextScale=function(){var x=this.textElement.getBBox(),G=1;if(x.width>0&&x.height>0){var $=(1*this.width-this.width*this.padding*2/100)/x.width,V=(1*this.height-this.height*this.padding*2/100)/x.height;G=Math.min($,V)}return G},f.prototype.getTextPosition=function(x){var G=this.textElement.getBBox(),$=0,V=0;return G.width>0&&G.height>0&&($=(this.width-G.width*x)/2,V=this.height/2-G.height*x/2),{x:$,y:V}},f.prototype.sizeText=function(){var x=this.textElement.getBBox(),G=this.getTextScale(),$=this.getTextPosition(G);$.y-=x.y*G,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+$.x+"px, "+$.y+"px) scale("+G+", "+G+")":(this.textElement.transform.baseVal.getItem(0).setTranslate($.x,$.y),this.textElement.transform.baseVal.getItem(1).setScale(G,G))},f.prototype.manipulate=function(x){K.prototype.manipulate.call(this,x),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(x.x-this.pointerDownPoint.x)>5||Math.abs(x.y-this.pointerDownPoint.y)>5)},f.prototype.resize=function(x){K.prototype.resize.call(this,x),this.isMoved=!0,this.setSize(),this.sizeText()},f.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},f.prototype.pointerUp=function(x){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,x),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},f.prototype.showTextEditor=function(){var x=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(G){G.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var G=Number.parseFloat(x.textEditor.style.fontSize);x.textEditor.clientWidth>=Number.parseInt(x.textEditor.style.maxWidth)&&G>.9;)G-=.1,x.textEditor.style.fontSize=Math.max(G,.9)+"em"}),this.textEditor.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(G){if(G.clipboardData){var $=G.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode($)),G.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){x.textEditDivClicked(x.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},f.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var x=this.getTextScale(),G=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),$=this.textElement.getBBox(),V={x:$.width*x,y:$.height*x};G.x-=V.x/2,G.y-=V.y/2,this.textEditor.style.top=G.y+"px",this.textEditor.style.left=G.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-G.x+"px",this.textEditor.style.fontSize=Math.max(16*x,12)+"px",this.textElement.style.display="none"}},f.prototype.textEditDivClicked=function(x){this.text=x.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},f.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},f.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},f.prototype.dblClick=function(x,G){K.prototype.dblClick.call(this,x,G),this.showTextEditor()},f.prototype.setColor=function(x){this.textElement&&de.setAttributes(this.textElement,[["fill",x]]),this.color=x,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(x)},f.prototype.setFont=function(x){this.textElement&&de.setAttributes(this.textElement,[["font-family",x]]),this.fontFamily=x,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},f.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},f.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){var G=x;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),K.prototype.restoreState.call(this,x),this.setSize()},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G),this.setSize(),this.sizeText(),this.positionTextEditor()},f.typeName="TextMarker",f.title="Text marker",f.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>',f}(Qe),Ce=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=$.defaultColor,V.lineWidth=$.defaultStrokeWidth,V.pixelRatio=$.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Ue("Color",$.defaultColorSet,$.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return Re(f,K),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.visual&&x!==this.drawingImage)},f.prototype.createVisual=function(){this.visual=de.createGroup(),this.drawingImage=de.createImage(),this.visual.appendChild(this.drawingImage);var x=de.createTransform();this.visual.transform.baseVal.appendItem(x),this.addMarkerVisualToContainer(this.visual)},f.prototype.pointerDown=function(x,G){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(x.x,x.y),this.drawing=!0):K.prototype.pointerDown.call(this,x,G)},f.prototype.manipulate=function(x){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(x.x,x.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,x)},f.prototype.resize=function(x){K.prototype.resize.call(this,x),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},f.prototype.pointerUp=function(x){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,x)},f.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)},f.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},f.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},f.prototype.finishCreation=function(){for(var x=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),G=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],$=G[0],V=G[1],be=G[2],Ge=G[3],nt=!1,Et=0;Et<this.canvasElement.height;Et++)for(var Ve=0;Ve<this.canvasElement.width;Ve++)x.data[Et*this.canvasElement.width*4+4*Ve+3]>0&&(nt=!0,Et<V&&(V=Et),Ve<$&&($=Ve),Et>Ge&&(Ge=Et),Ve>be&&(be=Ve));if(nt){this.left=$/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(be-$)/this.pixelRatio,this.height=(Ge-V)/this.pixelRatio;var kt=document.createElement("canvas");kt.width=be-$,kt.height=Ge-V,kt.getContext("2d").putImageData(this.canvasContext.getImageData($,V,be-$,Ge-V),0,0),this.drawingImgUrl=kt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},f.prototype.setDrawingImage=function(){de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},f.prototype.setColor=function(x){this.color=x,this.colorChanged(x)},f.prototype.setLineWidth=function(x){this.lineWidth=x},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){this.createVisual(),K.prototype.restoreState.call(this,x),this.drawingImgUrl=x.drawingImgUrl,this.setDrawingImage()},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G),this.setDrawingImage()},f.typeName="FreehandMarker",f.title="Freehand marker",f.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>',f}(Qe),ye=function(K){function f(x,G,$){var V=K.call(this,x,$||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=G,V.setCurrentType=V.setCurrentType.bind(V),V}return Re(f,K),f.prototype.getUi=function(){var x=this,G=document.createElement("div");G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2";for(var $=function(Ge){var nt="both";switch(Ge){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var Et=document.createElement("div");if(Et.style.display="flex",Et.style.flexGrow="2",Et.style.alignItems="center",Et.style.justifyContent="space-between",Et.style.padding="5px",Et.style.borderWidth="2px",Et.style.borderStyle="solid",Et.style.borderColor=nt===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",Et.addEventListener("click",function(){x.setCurrentType(nt,Et)}),G.appendChild(Et),nt==="both"||nt==="start"){var Ve=document.createElement("div");Ve.style.display="flex",Ve.style.alignItems="center",Ve.style.minHeight="20px",Ve.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ve.style.marginLeft="5px",Et.appendChild(Ve)}var kt=document.createElement("div");kt.style.display="flex",kt.style.alignItems="center",kt.style.minHeight="20px",kt.style.flexGrow="2";var Kt=document.createElement("hr");if(Kt.style.minWidth="20px",Kt.style.border="0px",Kt.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),Kt.style.flexGrow="2",kt.appendChild(Kt),Et.appendChild(kt),nt==="both"||nt==="end"){var sr=document.createElement("div");sr.style.display="flex",sr.style.alignItems="center",sr.style.minHeight="20px",sr.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,sr.style.marginRight="5px",Et.appendChild(sr)}V.typeBoxes.push(Et)},V=this,be=0;be<4;be++)$(be);return G},f.prototype.setCurrentType=function(x,G){var $=this;this.currentType=x,this.typeBoxes.forEach(function(V){V.style.borderColor=V===G?$.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},f}(Me),xe=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new ye("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return Re(f,K),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.arrow1&&x!==this.arrow2)},f.prototype.getArrowPoints=function(x,G){var $=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return x-$/2+","+(G+V/2)+" "+x+","+(G-V/2)+" "+(x+$/2)+","+(G+V/2)},f.prototype.createTips=function(){this.arrow1=de.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=de.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow2)},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.state==="creating"&&this.createTips()},f.prototype.adjustVisual=function(){if(K.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",de.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),de.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var x=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.arrow1.transform.baseVal.getItem(0);G.setRotate(x,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var $=this.arrow2.transform.baseVal.getItem(0);$.setRotate(x+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem($,0)}},f.prototype.setArrowType=function(x){this.arrowType=x,this.adjustVisual(),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){K.prototype.restoreState.call(this,x);var G=x;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},f.typeName="ArrowMarker",f.title="Arrow marker",f.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',f}(it),ne=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.fillColor=$.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Ue("Color",$.defaultColorSet,$.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return Re(f,K),Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=K.prototype.getState.call(this);return x.typeName=f.typeName,x},f.typeName="CoverMarker",f.title="Cover marker",f.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',f}(Xe),oe=function(K){function f(x,G,$,V){var be=K.call(this,x,V||'<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 be.opacities=[],be.opacityBoxes=[],be.opacities=G,be.currentOpacity=$,be.setCurrentOpacity=be.setCurrentOpacity.bind(be),be}return Re(f,K),f.prototype.getUi=function(){var x=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",G.style.justifyContent="space-between",this.opacities.forEach(function($){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=$===x.currentOpacity?x.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){x.setCurrentOpacity($,V)}),G.appendChild(V);var be=document.createElement("div");be.innerText=100*$+"%",V.appendChild(be),x.opacityBoxes.push(V)}),G},f.prototype.setCurrentOpacity=function(x,G){var $=this;this.currentOpacity=x,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===G?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},f}(Me),he=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=$.defaultHighlightColor,V.strokeWidth=0,V.opacity=$.defaultHighlightOpacity,V.fillPanel=new Ue("Color",$.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new oe("Opacity",$.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Re(f,K),f.prototype.setOpacity=function(x){this.opacity=x,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=K.prototype.getState.call(this);return x.typeName=f.typeName,x},f.typeName="HighlightMarker",f.title="Highlight marker",f.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>',f}(ne),ve='<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>',Ne=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=$.defaultStrokeColor,V.bgColor=$.defaultFillColor,V.fontFamily=$.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Ue("Text color",$.defaultColorSet,V.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>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Ue("Fill color",$.defaultColorSet,V.bgColor,ve),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new Be("Font",$.defaultFontFamilies,$.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new Je,V.tipGrip.visual.transform.baseVal.appendItem(de.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return Re(f,K),f.prototype.ownsTarget=function(x){return K.prototype.ownsTarget.call(this,x)||this.tipGrip.ownsTarget(x)||this.tip===x},f.prototype.createTip=function(){de.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=de.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},f.prototype.pointerDown=function(x,G){this.state==="new"&&K.prototype.pointerDown.call(this,x,G),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(G)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,x,G)},f.prototype.pointerUp=function(x){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,x);else{var G=this.state==="creating";K.prototype.pointerUp.call(this,x),this.setTipPoints(G),this.positionTip()}},f.prototype.manipulate=function(x){if(this.tipMoving){var G=this.unrotatePoint(x);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,x)},f.prototype.setBgColor=function(x){this.bgRectangle&&this.tip&&(de.setAttributes(this.bgRectangle,[["fill",x]]),de.setAttributes(this.tip,[["fill",x]])),this.bgColor=x,this.fillColorChanged(x)},f.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},f.prototype.setTipPoints=function(x){x===void 0&&(x=!1);var G=Math.min(this.height/2,15),$=this.height/5;x&&(this.tipPosition={x:G+$/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?($=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:0},this.tipBase2Position={x:G+$,y:0}):(this.tipBase1Position={x:0,y:G},this.tipBase2Position={x:0,y:G+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?($=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-$,y:0},this.tipBase2Position={x:this.width-G,y:0}):(this.tipBase1Position={x:this.width,y:G},this.tipBase2Position={x:this.width,y:G+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?($=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-$,y:this.height},this.tipBase2Position={x:this.width-G,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-G-$},this.tipBase2Position={x:this.width,y:this.height-G}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?($=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:this.height},this.tipBase2Position={x:G+$,y:this.height}):(this.tipBase1Position={x:0,y:this.height-G},this.tipBase2Position={x:0,y:this.height-G-$})},f.prototype.resize=function(x){K.prototype.resize.call(this,x),this.positionTip()},f.prototype.positionTip=function(){de.setAttributes(this.tip,[["points",this.getTipPoints()]]);var x=this.tipGrip.visual.transform.baseVal.getItem(0);x.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(x,0)},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),f.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},f.prototype.getState=function(){var x=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){var G=x;this.bgColor=G.bgColor,this.tipPosition=G.tipPosition,K.prototype.restoreState.call(this,x),this.createTip(),this.setTipPoints()},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G),this.tipPosition={x:this.tipPosition.x*x,y:this.tipPosition.y*G},this.positionTip()},f.typeName="CalloutMarker",f.title="Callout marker",f.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>',f}(ze),Le=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.fillColor=$.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Ue("Line color",ge($.defaultColorSet,["transparent"]),$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Ue("Fill color",ge($.defaultColorSet,["transparent"]),V.fillColor,ve),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new oe("Opacity",$.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Re(f,K),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.visual)},f.prototype.createVisual=function(){this.visual=de.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)},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.state==="new"&&(this.createVisual(),this.moveVisual(x),this._state="creating")},f.prototype.manipulate=function(x){K.prototype.manipulate.call(this,x)},f.prototype.resize=function(x){K.prototype.resize.call(this,x),this.setSize()},f.prototype.setSize=function(){K.prototype.setSize.call(this),de.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},f.prototype.pointerUp=function(x){K.prototype.pointerUp.call(this,x),this.setSize()},f.prototype.setStrokeColor=function(x){this.strokeColor=x,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(x),this.stateChanged()},f.prototype.setFillColor=function(x){this.fillColor=x,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(x),this.stateChanged()},f.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},f.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},f.prototype.setOpacity=function(x){this.opacity=x,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){var G=x;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,x),this.setSize()},f.prototype.scale=function(x,G){K.prototype.scale.call(this,x,G),this.setSize()},f.typeName="EllipseMarker",f.title="Ellipse marker",f.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>',f}(Qe),Ke=function(K){function f(x,G,$){return K.call(this,x,G,$)||this}return Re(f,K),Object.defineProperty(f.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.tip1&&x!==this.tip2)},f.prototype.createTips=function(){this.tip1=de.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(de.createTransform()),this.visual.appendChild(this.tip1),this.tip2=de.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(de.createTransform()),this.visual.appendChild(this.tip2)},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.state==="creating"&&this.createTips()},f.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(de.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()]]),de.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var x=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.tip1.transform.baseVal.getItem(0);G.setRotate(x,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var $=this.tip2.transform.baseVal.getItem(0);$.setRotate(x+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem($,0)}},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=K.prototype.getState.call(this);return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){K.prototype.restoreState.call(this,x),this.createTips(),this.adjustVisual()},f.typeName="MeasurementMarker",f.title="Measurement marker",f.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>',f}(it),at=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.strokePanel.colors=$.defaultColorSet,V.fillColor="transparent",V}return Re(f,K),Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=K.prototype.getState.call(this);return x.typeName=f.typeName,x},f.typeName="EllipseFrameMarker",f.title="Ellipse frame marker",f.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>',f}(Le),mt=function(){function K(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),K.prototype.addUndoStep=function(f){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(f)||(this.undoStack.push(f),JSON.stringify(this.lastRedoStep)!==JSON.stringify(f)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(f){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=f)},K.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},K.prototype.undo=function(){if(this.undoStack.length>1){var f=this.undoStack.pop();return f!==void 0&&this.redoStack.push(f),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},K.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},K}(),pt=function(K){function f(x,G,$){var V=K.call(this,x,G,$)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=$.defaultColor,V.strokeWidth=$.defaultStrokeWidth,V.strokeDasharray=$.defaultStrokeDasharray,V.strokePanel=new Ue("Line color",$.defaultColorSet,$.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new tt("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Re(f,K),f.prototype.ownsTarget=function(x){return!(!K.prototype.ownsTarget.call(this,x)&&x!==this.visual&&x!==this.selectorCurve&&x!==this.visibleCurve&&!this.curveGrip.ownsTarget(x))},f.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},f.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorCurve=de.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=de.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)},f.prototype.pointerDown=function(x,G){K.prototype.pointerDown.call(this,x,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=x.x,this.curveY=x.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(this.activeGrip=this.curveGrip,this._state="resize")},f.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),de.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},f.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=de.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=de.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)},f.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},f.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var x=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-x/2,this.curveY-x/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},f.prototype.manipulate=function(x){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+x.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+x.y-this.manipulationStartY),K.prototype.manipulate.call(this,x)},f.prototype.resize=function(x){this.activeGrip===this.curveGrip&&(this.curveX=x.x,this.curveY=x.y),K.prototype.resize.call(this,x),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},f.prototype.setStrokeColor=function(x){this.strokeColor=x,this.adjustVisual(),this.colorChanged(x)},f.prototype.setStrokeWidth=function(x){this.strokeWidth=x,this.adjustVisual()},f.prototype.setStrokeDasharray=function(x){this.strokeDasharray=x,this.adjustVisual()},f.prototype.scale=function(x,G){this.curveX=this.curveX*x,this.curveY=this.curveY*G,K.prototype.scale.call(this,x,G)},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var x=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return x.typeName=f.typeName,x},f.prototype.restoreState=function(x){K.prototype.restoreState.call(this,x);var G=x;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},f.typeName="CurveMarker",f.title="Curve marker",f.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>',f}(et),Mt=function(){function K(f,x){x===void 0&&(x=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=f,this.cancelable=x}return Object.defineProperty(K.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),K.prototype.preventDefault=function(){this._defaultPrevented=!0},K}(),Pt=function(K){function f(x,G,$){var V=K.call(this,x,!1)||this;return V.dataUrl=G,V.state=$,V}return Re(f,K),f}(Mt),yt=function(K){function f(x,G,$){$===void 0&&($=!1);var V=K.call(this,x,$)||this;return V.marker=G,V}return Re(f,K),f}(Mt),Ht=function(){function K(){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 K.prototype.addEventListener=function(f,x){this[f].push(x)},K.prototype.removeEventListener=function(f,x){var G=this[f].indexOf(x);G>-1&&this[f].splice(G,1)},K}(),Jt=function(){function K(f){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ie,this._isOpen=!1,this.undoRedoManager=new mt,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 Ht,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new ke(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=f,this.targetRoot=document.body,this.width=f.clientWidth,this.height=f.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(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[lt,Ce,xe,ze,at,Le,he,Ne,Ke,ne,it,pt]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[lt,Ce,xe,ze,Le,he,Ne]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[lt,Ce,xe,ze,he]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(f){var x=this;this._availableMarkerTypes.splice(0),f.forEach(function(G){if(typeof G=="string"){var $=x.ALL_MARKER_TYPES.find(function(V){return V.typeName===G});$!==void 0&&x._availableMarkerTypes.push($)}else x._availableMarkerTypes.push(G)})},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(f){this._zoomLevel=f,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(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),K.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},K.prototype.show=function(){var f=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(x){return x(new Mt(f))})},K.prototype.render=function(){return Ae(this,void 0,void 0,function(){var f;return we(this,function(x){switch(x.label){case 0:return this.setCurrentMarker(),(f=new ce).naturalSize=this.renderAtNaturalSize,f.imageType=this.renderImageType,f.imageQuality=this.renderImageQuality,f.markersOnly=this.renderMarkersOnly,f.width=this.renderWidth,f.height=this.renderHeight,[4,f.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return x.sent(),[4,f.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,x.sent()]}})})},K.prototype.close=function(f){var x=this;if(f===void 0&&(f=!1),this.isOpen){var G=!1;f||this.eventListeners.beforeclose.forEach(function($){var V=new Mt(x,!0);$(V),V.defaultPrevented&&(G=!0)}),G||(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($){return $(new Mt(x))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var f,x=[],G=0;G<arguments.length;G++)x[G]=arguments[G];(f=this._availableMarkerTypes).push.apply(f,x)},K.prototype.addRenderEventListener=function(f){this.addEventListener("render",function(x){f(x.dataUrl,x.state)})},K.prototype.removeRenderEventListener=function(f){},K.prototype.addCloseEventListener=function(f){this.addEventListener("close",function(){f()})},K.prototype.removeCloseEventListener=function(f){},K.prototype.setupResizeObserver=function(){var f=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){f.resize(f.target.clientWidth,f.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return f.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var f=1*this.target.clientWidth/this.target.clientHeight,x=this.editorCanvas.clientWidth/f>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*f:this.editorCanvas.clientWidth,G=x<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/f;this.resize(x,G)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(f,x){this._isResizing=!0;var G=f/this.imageWidth,$=x/this.imageHeight;this.imageWidth=Math.round(f),this.imageHeight=Math.round(x),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(G,$),this._isResizing=!1},K.prototype.scaleMarkers=function(f,x){var G,$=this;this._currentMarker&&this._currentMarker instanceof ze?this._currentMarker.scale(f,x):(G=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==$._currentMarker&&V.scale(f,x)}),G!==void 0&&this.setCurrentMarker(G)},K.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"},K.prototype.setTopLeft=function(){var f=this.editingTarget.getBoundingClientRect(),x=this.editorCanvas.getBoundingClientRect();this.left=f.left-x.left,this.top=f.top-x.top},K.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)},K.prototype.addDefs=function(){for(var f,x=[],G=0;G<arguments.length;G++)x[G]=arguments[G];this.defs=de.createDefs(),this.addDefsToImage(),(f=this.defs).append.apply(f,x)},K.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},K.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)},K.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},K.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},K.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)},K.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},K.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)},K.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 f=document.createElement("a");f.href="https://markerjs.com/",f.target="_blank",f.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>',f.title="Powered by marker.js",f.style.display="grid",f.style.alignItems="center",f.style.justifyItems="center",f.style.padding="3px",f.style.width="20px",f.style.height="20px",this.logoUI.appendChild(f),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},K.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")},K.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"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.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 f=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=f+"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 me(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 _e(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},K.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.removeMarker=function(f){this.markerImage.removeChild(f.container),this.markers.indexOf(f)>-1&&this.markers.splice(this.markers.indexOf(f),1),f.dispose()},K.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())},K.prototype.toolbarButtonClicked=function(f,x){if(f==="marker"&&x!==void 0)this.createNewMarker(x);else if(f==="action")switch(x){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},K.prototype.deleteSelectedMarker=function(){var f=this;if(this._currentMarker!==void 0){var x=!1;if(this.eventListeners.markerbeforedelete.forEach(function($){var V=new yt(f,f._currentMarker,!0);$(V),V.defaultPrevented&&(x=!0)}),!x){var G=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($){return $(new yt(f,G))})}}},K.prototype.clear=function(){var f=this,x=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(be){var Ge=new yt(f,void 0,!0);be(Ge),Ge.defaultPrevented&&(x=!0)}),!x)){this.setCurrentMarker();for(var G=function(be){var Ge=$.markers[be];$.setCurrentMarker($.markers[be]),$._currentMarker.dispose(),$.markerImage.removeChild($._currentMarker.container),$.markers.splice($.markers.indexOf($._currentMarker),1),$.eventListeners.markerdelete.forEach(function(nt){return nt(new yt(f,Ge))})},$=this,V=this.markers.length-1;V>=0;V--)G(V);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.prototype.showNotesEditor=function(){var f;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=(f=this._currentMarker.notes)!==null&&f!==void 0?f:"",this.overlayContainer.appendChild(this.notesArea))},K.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)},K.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},K.prototype.addUndoStep=function(){var f=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var x=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===x.width&&G.height===x.height){var $=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(x),$<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new Mt(f))})}else this.undoRedoManager.replaceLastUndoStep(x),this.eventListeners.statechange.forEach(function(V){return V(new Mt(f))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var f=this,x=this.undoRedoManager.undo();x!==void 0&&(this.restoreState(x),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Mt(f))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var f=this,x=this.undoRedoManager.redo();x!==void 0&&(this.restoreState(x),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Mt(f))}))},K.prototype.stepZoom=function(){var f=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=f<this.zoomSteps.length-1?this.zoomSteps[f+1]:this.zoomSteps[0]},K.prototype.panTo=function(f){this.contentDiv.scrollBy({left:this.prevPanPoint.x-f.x,top:this.prevPanPoint.y-f.y}),this.prevPanPoint=f},K.prototype.startRenderAndClose=function(){return Ae(this,void 0,void 0,function(){var f,x,G=this;return we(this,function($){switch($.label){case 0:return[4,this.render()];case 1:return f=$.sent(),x=this.getState(),this.eventListeners.render.forEach(function(V){return V(new Pt(G,f,x))}),this.close(!0),[2]}})})},K.prototype.getState=function(f){f===!0&&this.setCurrentMarker();var x={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(G){return x.markers.push(G.getState())}),x},K.prototype.restoreState=function(f){var x=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);f.markers.forEach(function(G){var $=x._availableMarkerTypes.find(function(be){return be.typeName===G.typeName});if($!==void 0){var V=x.addNewMarker($);V.restoreState(G),x.markers.push(V)}}),f.width&&f.height&&(f.width!==this.imageWidth||f.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/f.width,this.imageHeight/f.height),this.eventListeners.restorestate.forEach(function(G){return G(new Mt(x))})},K.prototype.addNewMarker=function(f){var x=de.createGroup();return this.markerImage.appendChild(x),new f(x,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(f){var x,G=this;(x=typeof f=="string"?this._availableMarkerTypes.find(function($){return $.typeName===f}):f)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(x),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(x.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function($){return $(new yt(G,G._currentMarker))}))},K.prototype.markerCreated=function(f){var x=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(f),this.setCurrentMarker(f),f instanceof Ce&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ce):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(G){return G(new yt(x,x._currentMarker))})},K.prototype.colorChanged=function(f){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=f,this.settings.defaultStrokeColor=f)},K.prototype.fillColorChanged=function(f){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=f)},K.prototype.markerStateChanged=function(f){var x=this;this.eventListeners.markerchange.forEach(function(G){return G(new yt(x,f))})},K.prototype.setCurrentMarker=function(f){var x=this;this._currentMarker!==f&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(G){return G(new yt(x,x._currentMarker))})),this._currentMarker=f,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(G){return G(new yt(x,x._currentMarker))}))},K.prototype.onPointerDown=function(f){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||f.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var x=this.markers.find(function(G){return G.ownsTarget(f.target)});x!==void 0?(this.setCurrentMarker(x),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(f.clientX,f.clientY),f.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:f.clientX,y:f.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(f.clientX,f.clientY))},K.prototype.onDblClick=function(f){if(this._isFocused||this.focus(),this.mode==="select"){var x=this.markers.find(function(G){return G.ownsTarget(f.target)});x!==void 0&&x!==this._currentMarker&&this.setCurrentMarker(x),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(f.clientX,f.clientY),f.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(f){this.touchPoints!==1&&f.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||f.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(f.clientX,f.clientY)):this.zoomLevel>1&&this.panTo({x:f.clientX,y:f.clientY}))},K.prototype.onPointerUp=function(f){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(f.clientX,f.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(f){this._currentMarker===void 0||this.notesArea!==void 0||f.key!=="Delete"&&f.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(f,x){var G=this.markerImage.getBoundingClientRect();return{x:(f-G.left)/this.zoomLevel,y:(x-G.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var f=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=f+"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()},K.prototype.addLicenseKey=function(f){re.addKey(f)},K.prototype.addEventListener=function(f,x){this.eventListeners.addEventListener(f,x)},K.prototype.removeEventListener=function(f,x){this.eventListeners.removeEventListener(f,x)},K.prototype.renderState=function(f){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(f),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var f=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(x){return x(new Mt(f))}))},K.prototype.blur=function(){var f=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(x){return x(new Mt(f))}))},K.instanceCounter=0,K}();/* **********************************
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 ut=function(K,f){return(ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,G){x.__proto__=G}||function(x,G){for(var $ in G)Object.prototype.hasOwnProperty.call(G,$)&&(x[$]=G[$])})(K,f)};function Zt(K,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function x(){this.constructor=K}ut(K,f),K.prototype=f===null?Object.create(f):(x.prototype=f.prototype,new x)}function Bt(K,f,x,G){return new(x||(x=Promise))(function($,V){function be(Et){try{nt(G.next(Et))}catch(Ve){V(Ve)}}function Ge(Et){try{nt(G.throw(Et))}catch(Ve){V(Ve)}}function nt(Et){var Ve;Et.done?$(Et.value):(Ve=Et.value,Ve instanceof x?Ve:new x(function(kt){kt(Ve)})).then(be,Ge)}nt((G=G.apply(K,f||[])).next())})}function _r(K,f){var x,G,$,V,be={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return V={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function Ge(nt){return function(Et){return function(Ve){if(x)throw new TypeError("Generator is already executing.");for(;be;)try{if(x=1,G&&($=2&Ve[0]?G.return:Ve[0]?G.throw||(($=G.return)&&$.call(G),0):G.next)&&!($=$.call(G,Ve[1])).done)return $;switch(G=0,$&&(Ve=[2&Ve[0],$.value]),Ve[0]){case 0:case 1:$=Ve;break;case 4:return be.label++,{value:Ve[1],done:!1};case 5:be.label++,G=Ve[1],Ve=[0];continue;case 7:Ve=be.ops.pop(),be.trys.pop();continue;default:if(!($=be.trys,($=$.length>0&&$[$.length-1])||Ve[0]!==6&&Ve[0]!==2)){be=0;continue}if(Ve[0]===3&&(!$||Ve[1]>$[0]&&Ve[1]<$[3])){be.label=Ve[1];break}if(Ve[0]===6&&be.label<$[1]){be.label=$[1],$=Ve;break}if($&&be.label<$[2]){be.label=$[2],be.ops.push(Ve);break}$[2]&&be.ops.pop(),be.trys.pop();continue}Ve=f.call(K,be)}catch(kt){Ve=[6,kt],G=0}finally{x=$=0}if(5&Ve[0])throw Ve[1];return{value:Ve[0]?Ve[1]:void 0,done:!0}}([nt,Et])}}}var Ze=function(){function K(){}return K.addKey=function(f){K.key=f},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),gt=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(f,x){for(var G=0,$=x;G<$.length;G++){var V=$[G],be=V[0],Ge=V[1];f.setAttribute(be,Ge)}},K.createRect=function(f,x,G){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",f.toString()),$.setAttribute("height",x.toString()),G&&K.setAttributes($,G),$},K.createLine=function(f,x,G,$,V){var be=document.createElementNS("http://www.w3.org/2000/svg","line");return be.setAttribute("x1",f.toString()),be.setAttribute("y1",x.toString()),be.setAttribute("x2",G.toString()),be.setAttribute("y2",$.toString()),V&&K.setAttributes(be,V),be},K.createPolygon=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",f),x&&K.setAttributes(G,x),G},K.createCircle=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(f/2).toString()),G.setAttribute("cy",(f/2).toString()),G.setAttribute("r",f.toString()),x&&K.setAttributes(G,x),G},K.createEllipse=function(f,x,G){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(f/2).toString()),$.setAttribute("cy",(x/2).toString()),$.setAttribute("rx",(f/2).toString()),$.setAttribute("ry",(x/2).toString()),G&&K.setAttributes($,G),$},K.createGroup=function(f){var x=document.createElementNS("http://www.w3.org/2000/svg","g");return f&&K.setAttributes(x,f),x},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(f,x,G,$,V,be,Ge){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(nt,[["id",f],["orient",x],["markerWidth",G.toString()],["markerHeight",$.toString()],["refX",V.toString()],["refY",be.toString()]]),nt.appendChild(Ge),nt},K.createText=function(f){var x=document.createElementNS("http://www.w3.org/2000/svg","text");return x.setAttribute("x","0"),x.setAttribute("y","0"),f&&K.setAttributes(x,f),x},K.createTSpan=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=f,x&&K.setAttributes(G,x),G},K.createImage=function(f){var x=document.createElementNS("http://www.w3.org/2000/svg","image");return f&&K.setAttributes(x,f),x},K.createPoint=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=f,G.y=x,G},K.createPath=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",f),x&&K.setAttributes(G,x),G},K.createElement=function(f,x){var G=document.createElementNS("http://www.w3.org/2000/svg",f);return x&&K.setAttributes(G,x),G},K.getHollowRectanglePath=function(f,x,G,$,V,be,Ge,nt){return"M"+f+","+x+"V"+(x+$)+"H"+(f+G)+"V"+x+"H"+V+"V"+be+"H"+(V+Ge)+"V"+(be+nt)+"H"+V+"V"+x+"Z"},K}(),Ct=function(){function K(f){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+f+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.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(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(f){return this.styleSheet===void 0&&this.addStyleSheet(),f.name=""+this.classNamePrefix+f.localName,this.classes.push(f),this.styleSheet.sheet.insertRule("."+f.name+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length),f},K.prototype.addRule=function(f){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(f),this.styleSheet.sheet.insertRule(f.selector+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var f;this.styleSheet=document.createElement("style"),((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).appendChild(this.styleSheet),this.addRule(new ht("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ht("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ht("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new At("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new At("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},K.prototype.removeStyleSheet=function(){var f;this.styleSheet&&(((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),ht=function(K,f){this.selector=K,this.style=f},At=function(K,f){this.localName=K,this.style=f},rr=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(f){f.className=this.blockClassName,f.buttonClassName=this.buttonClassName,f.buttonColorsClassName=this.buttonColorsClassName,f.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(f)},K.prototype.addElementBlock=function(f){f.className===void 0&&(f.className=this.blockClassName),this.blocks.push(f)},K.prototype.getUI=function(){var f=document.createElement("div");return f.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,f.style.display=this.display,this.blocks.forEach(function(x){return f.appendChild(x.getUI())}),f},K}(),hr=function(){function K(){}return K.prototype.getUI=function(){var f=document.createElement("div");if(f.className=this.className,this.minWidth!==void 0&&(f.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":f.style.justifyContent="flex-start";break;case"center":f.style.justifyContent="center";break;case"end":f.style.justifyContent="flex-end"}return f.style.whiteSpace="nowrap",f},K}(),cr=function(K){function f(){var x=K!==null&&K.apply(this,arguments)||this;return x.buttons=[],x}return Zt(f,K),f.prototype.addButton=function(x){x.className=this.buttonClassName,x.colorsClassName=this.buttonColorsClassName,x.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(x)},f.prototype.getUI=function(){var x=K.prototype.getUI.call(this);return this.buttons.forEach(function(G){return x.appendChild(G.getUI())}),x},f}(hr),Ut=function(){function K(f,x){this._isActive=!1,this._isHidden=!1,this._icon=f,this.title=x,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(f){this._icon=f,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(f){this._isActive=f,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var f=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 f.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},K.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,"")))},K.prototype.hide=function(){this._isHidden=!0},K}(),xt=function(K){function f(){var x=K!==null&&K.apply(this,arguments)||this;return x.elements=[],x}return Zt(f,K),f.prototype.addElement=function(x){this.elements.push(x)},f.prototype.getUI=function(){var x=K.prototype.getUI.call(this);return this.elements.forEach(function(G){return x.appendChild(G)}),x},f}(hr),Mr=function(){function K(f,x){this.horizontal=f,this.vertical=x}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(f){return f/this.ratio},K.prototype.getHorizontalLength=function(f){return f*this.ratio},K}(),rn=function(){function K(){}return K.getIcon=function(f,x){if(f>0&&x>0){var G=new Mr(f,x),$=G.ratio>=1?20:G.getHorizontalLength(20),V=G.ratio<1?20:G.getVerticalLength(20),be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(be);var Ge=gt.createDefs();be.appendChild(Ge);var nt=gt.createElement("clipPath",[["id","text-bg-clip"]]);Ge.appendChild(nt);var Et=gt.createPath(gt.getHollowRectanglePath((24-$)/2,(24-V)/2,$,V,(24-$)/2+2,(24-V)/2+2,$-4,V-4));be.appendChild(Et);var Ve=gt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ve.appendChild(gt.createTSpan(f+":"+x)),be.appendChild(Ve);var kt=Ve.getBBox();gt.setAttributes(Ve,[["x",((24-kt.width)/2).toString()],["y",((24-kt.height)/2-kt.y).toString()]]);var Kt=gt.createPath(gt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(kt.width))/2,(24-Math.ceil(kt.height))/2,Math.ceil(kt.width),Math.ceil(kt.height)));return nt.appendChild(Kt),gt.setAttributes(Et,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(be),be.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>'},K}(),Ar=function(K){function f(x,G,$){var V=K.call(this,x,G)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=$,V}return Zt(f,K),f.prototype.setupDropdown=function(){var x=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(G){G.className=x.className,G.colorsClassName=x.colorsClassName,x.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},f.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},f.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},f.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},f.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},f.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},f}(Ut),Ft=function(){function K(f,x){this.GRIP_SIZE=10,this.color=f,this.fillColor=x,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 K.prototype.ownsTarget=function(f){return f===this.visual||f===this.visual.childNodes[0]||f===this.visual.childNodes[1]},K.prototype.setCenter=function(f,x){this.visual.childNodes.forEach(function(G){return gt.setAttributes(G,[["cx",f.toString()],["cy",x.toString()]])})},K}(),Ir=function(){function K(f,x,G,$){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=f,this.canvasHeight=x,this.margin=G,this.container=$,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(K.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(f){this._aspectRatio=f,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(f){this._isGridVisible=f,this.gridContainer&&gt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(f){this._zoomFactor=f,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var f=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 x=0;x<this.numberOfGridLines;x++)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(G){return f.gridContainer.appendChild(G)}),this.verticalGridLines.forEach(function(G){return f.gridContainer.appendChild(G)}),this.cropRectElement=gt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ft(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ft(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ft(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ft(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},K.prototype.setCropRectangle=function(f){this.cropRect=f;var x=Object.assign({},this.cropRect);this.zoomFactor!==1&&(x.width=this.cropRect.width*this.zoomFactor,x.height=this.cropRect.height*this.zoomFactor,x.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-x.width/2,x.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-x.height/2),gt.setAttributes(this.cropRectElement,[["x",x.x.toString()],["y",x.y.toString()],["width",x.width.toString()],["height",x.height.toString()]]);var G=x.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,be){var Ge=x.y+G*(be+1);gt.setAttributes(V,[["x1",""+x.x],["y1",""+Ge],["x2",""+(x.x+x.width)],["y2",""+Ge]])});var $=x.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,be){var Ge=x.x+$*(be+1);gt.setAttributes(V,[["x1",""+Ge],["y1",""+x.y],["x2",""+Ge],["y2",""+(x.y+x.height)]])}),gt.setAttributes(this.cropShadeElement,[["d",gt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,x.x,x.y,x.width,x.height)]]),this.topLeftGrip.setCenter(x.x,x.y),this.topRightGrip.setCenter(x.x+x.width,x.y),this.bottomLeftGrip.setCenter(x.x,x.y+x.height),this.bottomRightGrip.setCenter(x.x+x.width,x.y+x.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},K.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)},K.prototype.clientToLocalCoordinates=function(f,x){var G=this.container.getBoundingClientRect();return{x:f-G.left+this.margin,y:x-G.top+this.margin}},K.prototype.onPointerDown=function(f){this.container.setPointerCapture(f.pointerId),this.previousPoint=this.clientToLocalCoordinates(f.clientX,f.clientY),this.cropRectElement===f.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(f.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(f.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(f.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(f.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(f){if(this.isMoving)this.move(this.clientToLocalCoordinates(f.clientX,f.clientY));else if(this.activeGrip){var x=this.clientToLocalCoordinates(f.clientX,f.clientY);this.resize(x)}f.preventDefault()},K.prototype.onPointerUp=function(f){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(f.pointerId)},K.prototype.move=function(f){var x=f.x-this.previousPoint.x,G=f.y-this.previousPoint.y;this.zoomFactor!==1&&(x=-x/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+x),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+G),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=f},K.prototype.resize=function(f){var x=Object.assign({},this.cropRect),G=f.x-this.previousPoint.x,$=f.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:x.x+G<this.margin&&(G=this.margin-x.x),x.x+=G,x.width=this.cropRect.x+this.cropRect.width-x.x;break;case this.bottomRightGrip:case this.topRightGrip:x.width+G>this.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-x.width),x.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(x.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),x.height=this.aspectRatio.getVerticalLength(x.width)):(x.y+=$,x.height=this.cropRect.y+this.cropRect.height-x.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?x.height=this.aspectRatio.getVerticalLength(x.width):x.height+=$}x.width<10&&(x.x=this.cropRect.x,x.width=10),x.height<10&&(x.y=this.cropRect.y,x.height=10),this.previousPoint=f,x.x>=this.margin&&x.y>=this.margin&&x.x-this.margin+x.width<=this.canvasWidth&&x.y-this.margin+x.height<=this.canvasHeight&&(this.cropRect=x,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},K.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var f=this.cropRect.x+this.cropRect.width/2,x=this.cropRect.y+this.cropRect.height/2,G=this.aspectRatio.getHorizontalLength(this.cropRect.height),$=this.aspectRatio.getVerticalLength(this.cropRect.width);G/this.canvasWidth<$/this.canvasHeight?this.cropRect.width=G:this.cropRect.height=$,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=f-this.cropRect.width/2,this.cropRect.y=x-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},K.prototype.getRescaledRect=function(f,x,G,$,V,be){var Ge=G/f,nt=$/x;return{x:(V.x-be)*Ge+be,y:(V.y-be)*nt+be,width:V.width*Ge,height:V.height*nt}},K.prototype.scaleCanvas=function(f,x){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,f,x,this.cropRect,this.margin);this.canvasWidth=f,this.canvasHeight=x,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},K}(),Tr=function(){function K(f){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=f,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(K.prototype,"angle",{get:function(){return this._angle},set:function(f){this._angle=f,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),K.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},K.prototype.onPointerDown=function(f){this.controlContainer.setPointerCapture(f.pointerId),this.isDragging=!0,this.previousPoint={x:f.clientX,y:f.clientY}},K.prototype.onPointerMove=function(f){this.isDragging&&(this.onAngleChange&&this.onAngleChange((f.clientX-this.previousPoint.x)/5),this.previousPoint.x=f.clientX)},K.prototype.onPointerUp=function(f){this.isDragging&&this.onAngleChange&&this.onAngleChange((f.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(f.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var f=this.angleLabelText.getBBox();gt.setAttributes(this.angleLabelElement,[["x",((this.width-f.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var f=this.scaleShape.transform.baseVal.getItem(0);f.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(f,0)}},K.prototype.getVisual=function(){var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.setAttribute("width",this.width+"px"),f.setAttribute("height",this.height+"px"),f.setAttribute("viewBox","0 0 "+this.width+" "+this.height),f.style.flexShrink="0",document.body.appendChild(f);for(var x="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,G=1;G<=this.width/5+10;G++){var $=G%5==0?this.height/3:this.height/6;x+="h4v"+-$+"h1v"+$}x+="v1H0Z",this.scaleShape=gt.createPath(x);var V=gt.createTransform();this.scaleShape.transform.baseVal.appendItem(V),f.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 be=gt.createTSpan("");return be.innerHTML="&deg;",this.angleLabelElement.appendChild(be),f.appendChild(this.angleLabelElement),document.body.removeChild(f),f},K}(),nn=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(f,x,G,$,V,be,Ge){var nt=this;return new Promise(function(Et){var Ve=document.createElement("canvas");Ve.width=f.width.baseVal.value-2*$,Ve.height=f.height.baseVal.value-2*$;var kt=1,Kt=1;nt.naturalSize===!0?(kt=x.naturalWidth/(f.width.baseVal.value-2*$)/be,Kt=x.naturalHeight/(f.height.baseVal.value-2*$)/Ge,Ve.width=x.naturalWidth/be,Ve.height=x.naturalHeight/Ge):nt.width!==void 0&&nt.height!==void 0&&(kt=nt.width/G.width,Kt=nt.height/G.height,Ve.width*=kt,Ve.height*=Kt);var sr=Ve.getContext("2d");sr.translate(Ve.width/2,Ve.height/2),sr.rotate(V*Math.PI/180),sr.scale(be,Ge),sr.translate(-Ve.width/2,-Ve.height/2),sr.drawImage(x,0,0,Ve.width,Ve.height);var jr=document.createElement("canvas");jr.width=G.width*kt,jr.height=G.height*Kt,jr.getContext("2d").putImageData(sr.getImageData((G.x-$)*kt,(G.y-$)*Kt,G.width*kt,G.height*Kt),0,0),Et(jr.toDataURL(nt.imageType,nt.imageQuality))})},K}(),He=function(){function K(f){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=K.instanceCounter++,this.styles=new Ct(this.instanceNo),this.target=f,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(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(f){this._zoomToCropEnabled=f,f?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(f){this._isGridVisible=f,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(f){this._gridLines=f,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(f){this._rotationAngle=f,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"aspectRatio",{get:function(){var f;return(f=this._aspectRatio)!==null&&f!==void 0?f:this.aspectRatios[0]},set:function(f){this._aspectRatio=f},enumerable:!1,configurable:!0}),K.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},K.prototype.show=function(){this.showUI(),this.open()},K.prototype.close=function(f){f===void 0&&(f=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),f||this.closeEventListeners.forEach(function(x){return x()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(f){this.renderEventListeners.push(f)},K.prototype.removeRenderEventListener=function(f){this.renderEventListeners.indexOf(f)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(f),1)},K.prototype.addCloseEventListener=function(f){this.closeEventListeners.push(f)},K.prototype.removeCloseEventListener=function(f){this.closeEventListeners.indexOf(f)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(f),1)},K.prototype.setupResizeObserver=function(){var f=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){f.resize(f.target.clientWidth,f.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))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var f=1*this.target.clientWidth/this.target.clientHeight,x=this.contentDiv.clientWidth/f>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*f:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=x+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/f;this.resize(x,G)}},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.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"},K.prototype.resize=function(f,x){this.imageWidth=Math.round(f),this.imageHeight=Math.round(x),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},K.prototype.setEditingTarget=function(){var f=document.createElement("canvas");f.width=this.target.naturalWidth,f.height=this.target.naturalHeight,f.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var x=f.toDataURL();gt.setAttributes(this.editingTarget,[["href",x]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var f=this.target.getBoundingClientRect(),x=this.editorCanvas.getBoundingClientRect();this.left=f.left-x.left-this.CANVAS_MARGIN,this.top=f.top-x.top-this.CANVAS_MARGIN},K.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 f=gt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(f);var x=gt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(x),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)},K.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},K.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 Ir(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()},K.prototype.zoomToCrop=function(){if(this.cropRect){var f=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,x=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=f+"px "+x+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-f+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-x+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},K.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)},K.prototype.cropRectChanged=function(f){this.cropRect=f,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},K.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},K.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"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.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 f=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,x=this.target.offsetTop>f+this.CANVAS_MARGIN?this.target.offsetTop-(f+this.CANVAS_MARGIN):0;this.coverDiv.style.top=x+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},K.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},K.prototype.addTopToolbar=function(){var f=this;this.topToolbar=new rr,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var x=new cr;x.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(x);var G=[];this.aspectRatios.forEach(function(Kt){var sr=new Ut(rn.getIcon(Kt.horizontal,Kt.vertical),Kt.horizontal===0&&Kt.vertical===0?"FREE":Kt.horizontal+":"+Kt.vertical);sr.onClick=function(){return f.ratioButtonClicked(Kt)},G.push(sr)}),this.aspectRatioButton=new Ar(rn.getIcon(0,0),"Aspect ratio",G),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,x.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var $=new Ut('<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");$.isActive=this.isGridVisible,$.onClick=function(){f.isGridVisible=!f.isGridVisible,$.isActive=f.isGridVisible},x.addButton($);var V=new Ut('<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(V.isActive=this.zoomToCropEnabled,V.onClick=function(){f.zoomToCropEnabled=!f.zoomToCropEnabled,V.isActive=f.zoomToCropEnabled},x.addButton(V),!Ze.isLicensed){var be=new xt;this.topToolbar.addElementBlock(be);var Ge=document.createElement("div");Ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var nt=document.createElement("a");nt.style.color="currentColor",nt.href="https://markerjs.com/products/cropro",nt.target="_blank",nt.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Ge.appendChild(nt),be.addElement(Ge)}var Et=new cr;Et.minWidth=3*this.toolbarHeight+"px",Et.contentAlign="end",this.topToolbar.addButtonBlock(Et);var Ve=new Ut('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ve.onClick=this.startRenderAndClose,Et.addButton(Ve),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ve.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var kt=new Ut('<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");kt.onClick=this.close,Et.addButton(kt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(kt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},K.prototype.addBottomToolbar=function(){var f=this;this.bottomToolbar=new rr,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var x=new cr;x.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(x);var G=new Ut('<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");G.onClick=this.rotateLeftButtonClicked,x.addButton(G);var $=new Ut('<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");$.onClick=this.rotateRightButtonClicked,x.addButton($);var V=new xt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new Tr("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(Et){f.rotateBy(Et),f.straightener.angle=f.rotationAngle},V.addElement(this.straightener.getUI());var be=new cr;be.minWidth=2*this.toolbarHeight+"px",be.contentAlign="end",this.bottomToolbar.addButtonBlock(be);var Ge=new Ut('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Ge.onClick=this.flipHorizontallyButtonClicked,be.addButton(Ge);var nt=new Ut('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");nt.onClick=this.flipVerticallyButtonClicked,be.addButton(nt)},K.prototype.ratioButtonClicked=function(f){this.aspectRatio=f,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},K.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=rn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},K.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Mr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},K.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},K.prototype.restoreState=function(f){if(f){var x=this.cropLayer.getRescaledRect(f.width,f.height,this.imageWidth,this.imageHeight,f.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(x),this.cropRectChanged(x),this.flippedHorizontally=f.flippedHorizontally,this.flippedVertically=f.flippedVertically,this.applyFlip(),this.rotationAngle=f.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(f,x){var G=this.cropImage.getBoundingClientRect();return{x:f-G.left,y:x-G.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var f=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=f+"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()},K.prototype.rotateLeftButtonClicked=function(){var f=this.rotationAngle-90;this.rotationAngle%90!=0&&(f+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(f)},K.prototype.rotateRightButtonClicked=function(){var f=this.rotationAngle+90;this.rotationAngle%90!=0&&(f-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(f)},K.prototype.rotateTo=function(f){f=(f=f>180?f-360:f)<=-180?f+360:f,this.rotationAngle=f,this.applyRotation()},K.prototype.rotateBy=function(f){this.rotateTo((this.rotationAngle+f)%360)},K.prototype.applyRotation=function(){var f=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var x=this.editingTargetRotationContainer.transform.baseVal.getItem(0);x.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(x,0);var G=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/G.width,this.imageHeight/G.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=f},K.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},K.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},K.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},K.prototype.startRenderAndClose=function(){return Bt(this,void 0,void 0,function(){var f,x;return _r(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return f=G.sent(),x=this.getState(),this.renderEventListeners.forEach(function($){return $(f,x)}),this.close(!0),[2]}})})},K.prototype.render=function(){return Bt(this,void 0,void 0,function(){var f;return _r(this,function(x){switch(x.label){case 0:return(f=new nn).naturalSize=this.renderAtNaturalSize,f.imageType=this.renderImageType,f.imageQuality=this.renderImageQuality,f.width=this.renderWidth,f.height=this.renderHeight,this.unzoomFromCrop(),gt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,f.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return x.sent(),[4,f.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,x.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new At("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 At("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new At("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var f=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new At("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*f)+`px;
height: `+(this.toolbarHeight-2*f)+`px;
padding: `+f+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new At("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new At("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new ht("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new ht("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new At("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 At("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new At("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 At("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*f)+`px;
padding: `+f+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new At("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},K.instanceCounter=0,K}(),ft=Q("8hTe"),Wt=Q.n(ft),qt=/<pre[^>]*>/g;function nr(K){var f=document.createElement("div");return f.innerHTML=K,f.childNodes.length===0?"":f.childNodes[0].nodeValue}var ir=Se.a=function(K){var f=K.value,x=f===void 0?"":f,G=K.edit,$=G===void 0?!1:G,V=K.className,be=K.showTextOnly,Ge=K.showLines,nt=K.replaces,Et=K.zoomImg,Ve=K.hasMask,kt=K.style,Kt=kt===void 0?{}:kt,sr=K.stylesPrev,jr=sr===void 0?{}:sr,Gr=String(x),gr=Object(A.useRef)(),zr=Object(A.useRef)(),an=Object(A.useState)(""),br=Object(W.a)(an,2),Lr=br[0],Er=br[1],gn=Object(A.useState)("office"),Kr=Object(W.a)(gn,2),cn=Kr[0],on=Kr[1],In=function(){var Tt=new He(zr.current);Tt.displayMode="popup",Tt.addRenderEventListener(function(){var wt=Object(P.a)(O.a.mark(function jt(er){var Gt;return O.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return gr.current.style.display="none",vr.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er}});case 3:Gt=vr.sent,Gt!=null&&Gt.id&&nt(zr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Gt==null?void 0:Gt.id,"?type=").concat(Gt.content_type));case 5:case"end":return vr.stop()}},jt)}));return function(jt){return wt.apply(this,arguments)}}()),Tt.show()},vn=function(){var Tt=new Jt(zr.current);Tt.settings.displayMode="popup",Tt.addEventListener("render",function(){var wt=Object(P.a)(O.a.mark(function jt(er){var Gt;return O.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:if(gr.current.style.display="none",!zr.current){vr.next=6;break}return vr.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er.dataUrl}});case 4:Gt=vr.sent,Gt!=null&&Gt.id&&nt(zr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Gt==null?void 0:Gt.id,"?type=").concat(Gt.content_type));case 6:case"end":return vr.stop()}},jt)}));return function(jt){return wt.apply(this,arguments)}}()),Tt.show(),window.markerArea=Tt},qe=Object(A.useMemo)(function(){try{var Lt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Tt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,wt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Gr=Gr.replace(Lt,"("+ee.a.API_SERVER+"/api/attachments/").replace(Tt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(wt,'"'+ee.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),Gr=Gr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(yn){}var jt=z(Gr),er=h();if(Gr.match(/\[TOC\]/)&&(jt=jt.replace("<p>[TOC]</p>",R()),S()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(yn,vr){var Vr=er[vr],Xn=Vr.type,Yn=Vr.expression;return Object(le.renderToString)(nr(Yn)||"",{displayMode:Xn==="block",throwOnError:!1,output:"html"})}),jt=jt.replace(/▁/g,"\u2581\u2581\u2581"),T(),be){var Gt=document.createElement("div");return Gt.innerHTML=jt,Gt.innerText}return setTimeout(function(){return ct()},500),jt},[Gr]),It=Object(A.useRef)();v.WebkitLineClamp=Ge,Ge&&(Kt=Object(U.a)(Object(U.a)({},Kt),v));function Vt(Lt){var Tt=Lt.target;if(Tt.tagName.toUpperCase()==="IMG"){if(Et){var wt=Tt.getAttribute("src");Er(wt),on("image")}}else if(Tt.tagName.toUpperCase()==="A"){var jt=Tt.getAttribute("href");if(jt.indexOf("office")>-1)Lt.preventDefault(),Er(jt),on("office");else if(jt.indexOf("application/pdf")>-1)Lt.preventDefault(),Er(jt),on("pdf");else if(jt.indexOf("type=text")>-1)Lt.preventDefault(),Er(jt),on("html");else if(jt.startsWith("#")){Lt.preventDefault();var er=document.getElementById(jt.replace("#",""));er&&er.scrollIntoView(!0)}}}var ct=function(){var Tt,wt=(Tt=It.current)===null||Tt===void 0?void 0:Tt.querySelectorAll("video");wt==null||wt.forEach(function(jt){if(jt.oncontextmenu=function(){return!1},jt.src.indexOf(".m3u8")>-1&&!jt.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var er=new Y.a;er.loadSource(jt.src),er.attachMedia(jt)}}})};Object(A.useEffect)(function(){if(It.current&&qe&&(qe.match(qt)&&window.PR.prettyPrint()),It.current)return It.current.addEventListener("click",Vt),function(){It.current.removeEventListener("click",Vt),T(),S()}},[qe,It.current,Vt]);var $t=function(Tt){if(!$)return;Tt.target.nodeName==="IMG"?(gr.current.style.display="flex",gr.current.style.width=Tt.target.clientWidth+"px",gr.current.style.height=Tt.target.clientHeight+"px",gr.current.style.top=Tt.target.offsetTop+"px",gr.current.style.left=Tt.target.offsetLeft+"px",zr.current.src=Tt.target.getAttribute("src")):gr.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:It,style:Object(U.a)({},Kt),className:"".concat(V||""," markdown-body ").concat(Wt.a.mdBody),onMouseOver:$t,dangerouslySetInnerHTML:{__html:qe}}),d.a.createElement("div",{ref:gr,className:Wt.a.button},d.a.createElement(J.a,null,d.a.createElement(X.a,{onClick:function(){return In()}},"\u88C1\u526A"),d.a.createElement(X.a,{onClick:function(){return vn()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:zr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),d.a.createElement(pe.a,{close:!0,data:Lr,hasMask:Ve,type:Lr!=null&&Lr.length?cn:"",style:Object(U.a)({},jr),onClose:function(){return Er("")}}))}},"9VGf":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return k});var ue=Q("q1tI"),J=Q.n(ue);function k(X,U){var P=Object(ue.useRef)();Object(ue.useEffect)(function(){P.current=X}),Object(ue.useEffect)(function(){function W(){P.current()}if(U!==null){var B=setInterval(W,U);return function(){return clearInterval(B)}}},[U])}},BU3w:function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return P});var ue=Q("MNnm"),J="rc-util-key";function k(W){if(W.attachTo)return W.attachTo;var B=document.querySelector("head");return B||document.body}function X(W){var B,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var A=document.createElement("style");if((B=O.csp)===null||B===void 0?void 0:B.nonce){var d;A.nonce=(d=O.csp)===null||d===void 0?void 0:d.nonce}A.innerHTML=W;var p=k(O),w=p.firstChild;return O.prepend&&p.prepend?p.prepend(A):O.prepend&&w?p.insertBefore(A,w):p.appendChild(A),A}var U=new Map;function P(W,B){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=k(O);if(!U.has(A)){var d=X("",O),p=d.parentNode;U.set(A,p),p.removeChild(d)}var w=Array.from(U.get(A).children).find(function(i){return i.tagName==="STYLE"&&i[J]===B});if(w){var m,g;if(((m=O.csp)===null||m===void 0?void 0:m.nonce)&&w.nonce!==((g=O.csp)===null||g===void 0?void 0:g.nonce)){var b;w.nonce=(b=O.csp)===null||b===void 0?void 0:b.nonce}return w.innerHTML!==W&&(w.innerHTML=W),w}var a=X(W,O);return a[J]=B,a}},Bd2K:function(bt,Se,Q){(function(ue){ue(Q("VrN/"),Q("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(O,A,d){if(d!=ue.Init&&d&&O.removeKeyMap("autoCloseTags"),!A)return;var p={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(p["'/'"]=function(w){return P(w)}),(typeof A!="object"||A.whenOpening!==!1)&&(p["'>'"]=function(w){return X(w)}),O.addKeyMap(p)});var J=["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(O){if(O.getOption("disableInput"))return ue.Pass;for(var A=O.listSelections(),d=[],p=O.getOption("autoCloseTags"),w=0;w<A.length;w++){if(!A[w].empty())return ue.Pass;var m=A[w].head,g=O.getTokenAt(m),b=ue.innerMode(O.getMode(),g.state),a=b.state,i=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(a),s=i&&i.name;if(!s)return ue.Pass;var l=b.mode.configuration=="html",S=typeof p=="object"&&p.dontCloseTags||l&&J,v=typeof p=="object"&&p.indentTags||l&&k;g.end>m.ch&&(s=s.slice(0,s.length-g.end+m.ch));var y=s.toLowerCase();if(!s||g.type=="string"&&(g.end!=m.ch||!/[\"\']/.test(g.string.charAt(g.string.length-1))||g.string.length==1)||g.type=="tag"&&i.close||g.string.indexOf("/")==m.ch-g.start-1||S&&W(S,y)>-1||B(O,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(a)||[],s,m,!0))return ue.Pass;var R=typeof p=="object"&&p.emptyTags;if(R&&W(R,s)>-1){d[w]={text:"/>",newPos:ue.Pos(m.line,m.ch+2)};continue}var _=v&&W(v,y)>-1;d[w]={indent:_,text:">"+(_?`
`:"")+"</"+s+">",newPos:_?ue.Pos(m.line+1,0):ue.Pos(m.line,m.ch+1)}}for(var C=typeof p=="object"&&p.dontIndentOnAutoClose,w=A.length-1;w>=0;w--){var E=d[w];O.replaceRange(E.text,A[w].head,A[w].anchor,"+insert");var c=O.listSelections().slice(0);c[w]={head:E.newPos,anchor:E.newPos},O.setSelections(c),!C&&E.indent&&(O.indentLine(E.newPos.line,null,!0),O.indentLine(E.newPos.line+1,null,!0))}}function U(O,A){for(var d=O.listSelections(),p=[],w=A?"/":"</",m=O.getOption("autoCloseTags"),g=typeof m=="object"&&m.dontIndentOnSlash,b=0;b<d.length;b++){if(!d[b].empty())return ue.Pass;var a=d[b].head,i=O.getTokenAt(a),s=ue.innerMode(O.getMode(),i.state),l=s.state;if(A&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=a.ch-1))return ue.Pass;var S,v=s.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(v&&s.mode.name=="javascript")S=w+"script";else if(v&&s.mode.name=="css")S=w+"style";else{var y=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!y||y.length&&B(O,y,y[y.length-1],a))return ue.Pass;S=w+y[y.length-1]}O.getLine(a.line).charAt(i.end)!=">"&&(S+=">"),p[b]=S}if(O.replaceSelections(p),d=O.listSelections(),!g)for(var b=0;b<d.length;b++)(b==d.length-1||d[b].head.line<d[b+1].head.line)&&O.indentLine(d[b].head.line)}function P(O){return O.getOption("disableInput")?ue.Pass:U(O,!0)}ue.commands.closeTag=function(O){return U(O)};function W(O,A){if(O.indexOf)return O.indexOf(A);for(var d=0,p=O.length;d<p;++d)if(O[d]==A)return d;return-1}function B(O,A,d,p,w){if(!ue.scanForClosingTag)return!1;var m=Math.min(O.lastLine()+1,p.line+500),g=ue.scanForClosingTag(O,p,null,m);if(!g||g.tag!=d)return!1;for(var b=w?1:0,a=A.length-1;a>=0&&A[a]==d;a--)++b;p=g.to;for(var a=1;a<b;a++){var i=ue.scanForClosingTag(O,p,null,m);if(!i||i.tag!=d)return!1;p=i.to}return!0}})},BjJ7:function(bt,Se,Q){"use strict";Q.d(Se,"d",function(){return J}),Q.d(Se,"c",function(){return k}),Q.d(Se,"e",function(){return X}),Q.d(Se,"b",function(){return U}),Q.d(Se,"a",function(){return W});var ue=Q("m3rI");function J(B){var O=!0;if(B.length>0){for(var A=0;A<B.length;A++)if(B[A].compile_success==0||!B[A].compile_success){O=!1;break}}else O=!1;return O}function k(B){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],d=0;d<B.length;d++){var p=B[d],w=O?"".concat(O,"/").concat(p.name):"".concat(p.name);A.push({title:p.name,isLeaf:!(p.type==="tree"),key:w})}return A}function X(B,O,A){for(var d=0;d<B.length;d++){var p=B[d];if(p.key===O){p.children=A;break}p.children&&X(p.children,O,A)}return B}function U(B,O,A){var d;return function(){var p=this,w=arguments,m=function(){d=null,A||B.apply(p,w)},g=A&&!d;clearTimeout(d),d=setTimeout(m,O),g&&B.apply(p,w)}}var P=!0,W=ue.a.API_SERVER},"C+DQ":function(bt,Se,Q){},"C/vA":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return ue});function ue(J){var k=this,X=!1,U;return function(){return X||(X=!0,U=J.apply(k,arguments)),U}}},"Cg/j":function(bt,Se,Q){"use strict";Q.d(Se,"b",function(){return ue}),Q.d(Se,"a",function(){return J}),Q.d(Se,"c",function(){return X}),Q.d(Se,"d",function(){return U});var ue;(function(P){P.serviceIds=new Map,P.DI_TARGET="$di$target",P.DI_DEPENDENCIES="$di$dependencies";function W(B){return B[P.DI_DEPENDENCIES]||[]}P.getServiceDependencies=W})(ue||(ue={}));var J=X("instantiationService");function k(P,W,B,O){W[ue.DI_TARGET]===W?W[ue.DI_DEPENDENCIES].push({id:P,index:B,optional:O}):(W[ue.DI_DEPENDENCIES]=[{id:P,index:B,optional:O}],W[ue.DI_TARGET]=W)}function X(P){if(ue.serviceIds.has(P))return ue.serviceIds.get(P);var W=function(B,O,A){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");k(W,B,A,!1)};return W.toString=function(){return P},ue.serviceIds.set(P,W),W}function U(P){return function(W,B,O){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");k(P,W,O,!0)}}},DlQD:function(bt,Se,Q){(function(ue,J){bt.exports=J()})(this,function(){"use strict";function ue(Ce,ye){for(var xe=0;xe<ye.length;xe++){var ne=ye[xe];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(Ce,ne.key,ne)}}function J(Ce,ye,xe){return ye&&ue(Ce.prototype,ye),xe&&ue(Ce,xe),Ce}function k(Ce,ye){if(!Ce)return;if(typeof Ce=="string")return X(Ce,ye);var xe=Object.prototype.toString.call(Ce).slice(8,-1);if(xe==="Object"&&Ce.constructor&&(xe=Ce.constructor.name),xe==="Map"||xe==="Set")return Array.from(Ce);if(xe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(xe))return X(Ce,ye)}function X(Ce,ye){(ye==null||ye>Ce.length)&&(ye=Ce.length);for(var xe=0,ne=new Array(ye);xe<ye;xe++)ne[xe]=Ce[xe];return ne}function U(Ce,ye){var xe;if(typeof Symbol=="undefined"||Ce[Symbol.iterator]==null){if(Array.isArray(Ce)||(xe=k(Ce))||ye&&Ce&&typeof Ce.length=="number"){xe&&(Ce=xe);var ne=0;return function(){return ne>=Ce.length?{done:!0}:{done:!1,value:Ce[ne++]}}}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 xe=Ce[Symbol.iterator](),xe.next.bind(xe)}function P(Ce,ye){return ye={exports:{}},Ce(ye,ye.exports),ye.exports}var W=P(function(Ce){function ye(){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 xe(ne){Ce.exports.defaults=ne}Ce.exports={defaults:ye(),getDefaults:ye,changeDefaults:xe}}),B=W.defaults,O=W.getDefaults,A=W.changeDefaults,d=/[&<>"']/,p=/[&<>"']/g,w=/[<>"']|&(?!#?\w+;)/,m=/[<>"']|&(?!#?\w+;)/g,g={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},b=function(ye){return g[ye]};function a(Ce,ye){if(ye){if(d.test(Ce))return Ce.replace(p,b)}else if(w.test(Ce))return Ce.replace(m,b);return Ce}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ce){return Ce.replace(i,function(ye,xe){return xe=xe.toLowerCase(),xe==="colon"?":":xe.charAt(0)==="#"?xe.charAt(1)==="x"?String.fromCharCode(parseInt(xe.substring(2),16)):String.fromCharCode(+xe.substring(1)):""})}var l=/(^|[^\[])\^/g;function S(Ce,ye){Ce=Ce.source||Ce,ye=ye||"";var xe={replace:function(oe,he){return he=he.source||he,he=he.replace(l,"$1"),Ce=Ce.replace(oe,he),xe},getRegex:function(){return new RegExp(Ce,ye)}};return xe}var v=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Ce,ye,xe){if(Ce){var ne;try{ne=decodeURIComponent(s(xe)).replace(v,"").toLowerCase()}catch(oe){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}ye&&!y.test(xe)&&(xe=u(ye,xe));try{xe=encodeURI(xe).replace(/%25/g,"%")}catch(oe){return null}return xe}var _={},C=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(Ce,ye){_[" "+Ce]||(C.test(Ce)?_[" "+Ce]=Ce+"/":_[" "+Ce]=I(Ce,"/",!0)),Ce=_[" "+Ce];var xe=Ce.indexOf(":")===-1;return ye.substring(0,2)==="//"?xe?ye:Ce.replace(E,"$1")+ye:ye.charAt(0)==="/"?xe?ye:Ce.replace(c,"$1")+ye:Ce+ye}var h={exec:function(){}};function T(Ce){for(var ye=1,xe,ne;ye<arguments.length;ye++){xe=arguments[ye];for(ne in xe)Object.prototype.hasOwnProperty.call(xe,ne)&&(Ce[ne]=xe[ne])}return Ce}function L(Ce,ye){var xe=Ce.replace(/\|/g,function(he,ve,Ne){for(var Le=!1,Ke=ve;--Ke>=0&&Ne[Ke]==="\\";)Le=!Le;return Le?"|":" |"}),ne=xe.split(/ \|/),oe=0;if(ne.length>ye)ne.splice(ye);else for(;ne.length<ye;)ne.push("");for(;oe<ne.length;oe++)ne[oe]=ne[oe].trim().replace(/\\\|/g,"|");return ne}function I(Ce,ye,xe){var ne=Ce.length;if(ne===0)return"";for(var oe=0;oe<ne;){var he=Ce.charAt(ne-oe-1);if(he===ye&&!xe)oe++;else if(he!==ye&&xe)oe++;else break}return Ce.substr(0,ne-oe)}function F(Ce,ye){if(Ce.indexOf(ye[1])===-1)return-1;for(var xe=Ce.length,ne=0,oe=0;oe<xe;oe++)if(Ce[oe]==="\\")oe++;else if(Ce[oe]===ye[0])ne++;else if(Ce[oe]===ye[1]&&(ne--,ne<0))return oe;return-1}function j(Ce){Ce&&Ce.sanitize&&!Ce.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var z={escape:a,unescape:s,edit:S,cleanUrl:R,resolveUrl:u,noopTest:h,merge:T,splitCells:L,rtrim:I,findClosingBracket:F,checkSanitizeDeprecation:j},M=W.defaults,N=z.rtrim,Y=z.splitCells,ee=z.escape,le=z.findClosingBracket;function pe(Ce,ye,xe){var ne=ye.href,oe=ye.title?ee(ye.title):null,he=Ce[1].replace(/\\([\[\]])/g,"$1");return Ce[0].charAt(0)!=="!"?{type:"link",raw:xe,href:ne,title:oe,text:he}:{type:"image",raw:xe,href:ne,title:oe,text:ee(he)}}function Oe(Ce,ye){var xe=Ce.match(/^(\s+)(?:```)/);if(xe===null)return ye;var ne=xe[1];return ye.split(`
`).map(function(oe){var he=oe.match(/^\s+/);if(he===null)return oe;var ve=he[0];return ve.length>=ne.length?oe.slice(ne.length):oe}).join(`
`)}var Te=function(){function Ce(xe){this.options=xe||M}var ye=Ce.prototype;return ye.space=function(ne){var oe=this.rules.block.newline.exec(ne);if(oe)return oe[0].length>1?{type:"space",raw:oe[0]}:{raw:`
`}},ye.code=function(ne,oe){var he=this.rules.block.code.exec(ne);if(he){var ve=oe[oe.length-1];if(ve&&ve.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var Ne=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?Ne:N(Ne,`
`)}}},ye.fences=function(ne){var oe=this.rules.block.fences.exec(ne);if(oe){var he=oe[0],ve=Oe(he,oe[3]||"");return{type:"code",raw:he,lang:oe[2]?oe[2].trim():oe[2],text:ve}}},ye.heading=function(ne){var oe=this.rules.block.heading.exec(ne);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},ye.nptable=function(ne){var oe=this.rules.block.nptable.exec(ne);if(oe){var he={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(he.header.length===he.align.length){var ve=he.align.length,Ne;for(Ne=0;Ne<ve;Ne++)/^ *-+: *$/.test(he.align[Ne])?he.align[Ne]="right":/^ *:-+: *$/.test(he.align[Ne])?he.align[Ne]="center":/^ *:-+ *$/.test(he.align[Ne])?he.align[Ne]="left":he.align[Ne]=null;for(ve=he.cells.length,Ne=0;Ne<ve;Ne++)he.cells[Ne]=Y(he.cells[Ne],he.header.length);return he}}},ye.hr=function(ne){var oe=this.rules.block.hr.exec(ne);if(oe)return{type:"hr",raw:oe[0]}},ye.blockquote=function(ne){var oe=this.rules.block.blockquote.exec(ne);if(oe){var he=oe[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:oe[0],text:he}}},ye.list=function(ne){var oe=this.rules.block.list.exec(ne);if(oe){for(var he=oe[0],ve=oe[2],Ne=ve.length>1,Le=ve[ve.length-1]===")",Ke={type:"list",raw:he,ordered:Ne,start:Ne?+ve.slice(0,-1):"",loose:!1,items:[]},at=oe[0].match(this.rules.block.item),mt=!1,pt,Mt,Pt,yt,Ht,Jt,ut,Zt=at.length,Bt=0;Bt<Zt;Bt++)pt=at[Bt],he=pt,Mt=pt.length,pt=pt.replace(/^ *([*+-]|\d+[.)]) */,""),~pt.indexOf(`
`)&&(Mt-=pt.length,pt=this.options.pedantic?pt.replace(/^ {1,4}/gm,""):pt.replace(new RegExp("^ {1,"+Mt+"}","gm"),"")),Bt!==Zt-1&&(Pt=this.rules.block.bullet.exec(at[Bt+1])[0],(Ne?Pt.length===1||!Le&&Pt[Pt.length-1]===")":Pt.length>1||this.options.smartLists&&Pt!==ve)&&(yt=at.slice(Bt+1).join(`
`),Ke.raw=Ke.raw.substring(0,Ke.raw.length-yt.length),Bt=Zt-1)),Ht=mt||/\n\n(?!\s*$)/.test(pt),Bt!==Zt-1&&(mt=pt.charAt(pt.length-1)===`
`,Ht||(Ht=mt)),Ht&&(Ke.loose=!0),Jt=/^\[[ xX]\] /.test(pt),ut=void 0,Jt&&(ut=pt[1]!==" ",pt=pt.replace(/^\[[ xX]\] +/,"")),Ke.items.push({type:"list_item",raw:he,task:Jt,checked:ut,loose:Ht,text:pt});return Ke}},ye.html=function(ne){var oe=this.rules.block.html.exec(ne);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]):ee(oe[0]):oe[0]}},ye.def=function(ne){var oe=this.rules.block.def.exec(ne);if(oe){oe[3]&&(oe[3]=oe[3].substring(1,oe[3].length-1));var he=oe[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:oe[0],href:oe[2],title:oe[3]}}},ye.table=function(ne){var oe=this.rules.block.table.exec(ne);if(oe){var he={type:"table",header:Y(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[]};if(he.header.length===he.align.length){he.raw=oe[0];var ve=he.align.length,Ne;for(Ne=0;Ne<ve;Ne++)/^ *-+: *$/.test(he.align[Ne])?he.align[Ne]="right":/^ *:-+: *$/.test(he.align[Ne])?he.align[Ne]="center":/^ *:-+ *$/.test(he.align[Ne])?he.align[Ne]="left":he.align[Ne]=null;for(ve=he.cells.length,Ne=0;Ne<ve;Ne++)he.cells[Ne]=Y(he.cells[Ne].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},ye.lheading=function(ne){var oe=this.rules.block.lheading.exec(ne);if(oe)return{type:"heading",raw:oe[0],depth:oe[2].charAt(0)==="="?1:2,text:oe[1]}},ye.paragraph=function(ne){var oe=this.rules.block.paragraph.exec(ne);if(oe)return{type:"paragraph",raw:oe[0],text:oe[1].charAt(oe[1].length-1)===`
`?oe[1].slice(0,-1):oe[1]}},ye.text=function(ne,oe){var he=this.rules.block.text.exec(ne);if(he){var ve=oe[oe.length-1];return ve&&ve.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},ye.escape=function(ne){var oe=this.rules.inline.escape.exec(ne);if(oe)return{type:"escape",raw:oe[0],text:ee(oe[1])}},ye.tag=function(ne,oe,he){var ve=this.rules.inline.tag.exec(ne);if(ve)return!oe&&/^<a /i.test(ve[0])?oe=!0:oe&&/^<\/a>/i.test(ve[0])&&(oe=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(ve[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ve[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:ve[0],inLink:oe,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):ee(ve[0]):ve[0]}},ye.link=function(ne){var oe=this.rules.inline.link.exec(ne);if(oe){var he=le(oe[2],"()");if(he>-1){var ve=oe[0].indexOf("!")===0?5:4,Ne=ve+oe[1].length+he;oe[2]=oe[2].substring(0,he),oe[0]=oe[0].substring(0,Ne).trim(),oe[3]=""}var Le=oe[2],Ke="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);at?(Le=at[1],Ke=at[3]):Ke=""}else Ke=oe[3]?oe[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var mt=pe(oe,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:Ke&&Ke.replace(this.rules.inline._escapes,"$1")},oe[0]);return mt}},ye.reflink=function(ne,oe){var he;if((he=this.rules.inline.reflink.exec(ne))||(he=this.rules.inline.nolink.exec(ne))){var ve=(he[2]||he[1]).replace(/\s+/g," ");if(ve=oe[ve.toLowerCase()],!ve||!ve.href){var Ne=he[0].charAt(0);return{type:"text",raw:Ne,text:Ne}}var Le=pe(he,ve,he[0]);return Le}},ye.strong=function(ne,oe,he){he===void 0&&(he="");var ve=this.rules.inline.strong.start.exec(ne);if(ve&&(!ve[1]||ve[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){oe=oe.slice(-1*ne.length);var Ne=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ne.lastIndex=0;for(var Le;(ve=Ne.exec(oe))!=null;)if(Le=this.rules.inline.strong.middle.exec(oe.slice(0,ve.index+3)),Le)return{type:"strong",raw:ne.slice(0,Le[0].length),text:ne.slice(2,Le[0].length-2)}}},ye.em=function(ne,oe,he){he===void 0&&(he="");var ve=this.rules.inline.em.start.exec(ne);if(ve&&(!ve[1]||ve[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){oe=oe.slice(-1*ne.length);var Ne=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ne.lastIndex=0;for(var Le;(ve=Ne.exec(oe))!=null;)if(Le=this.rules.inline.em.middle.exec(oe.slice(0,ve.index+2)),Le)return{type:"em",raw:ne.slice(0,Le[0].length),text:ne.slice(1,Le[0].length-1)}}},ye.codespan=function(ne){var oe=this.rules.inline.code.exec(ne);if(oe){var he=oe[2].replace(/\n/g," "),ve=/[^ ]/.test(he),Ne=he.startsWith(" ")&&he.endsWith(" ");return ve&&Ne&&(he=he.substring(1,he.length-1)),he=ee(he,!0),{type:"codespan",raw:oe[0],text:he}}},ye.br=function(ne){var oe=this.rules.inline.br.exec(ne);if(oe)return{type:"br",raw:oe[0]}},ye.del=function(ne){var oe=this.rules.inline.del.exec(ne);if(oe)return{type:"del",raw:oe[0],text:oe[1]}},ye.autolink=function(ne,oe){var he=this.rules.inline.autolink.exec(ne);if(he){var ve,Ne;return he[2]==="@"?(ve=ee(this.options.mangle?oe(he[1]):he[1]),Ne="mailto:"+ve):(ve=ee(he[1]),Ne=ve),{type:"link",raw:he[0],text:ve,href:Ne,tokens:[{type:"text",raw:ve,text:ve}]}}},ye.url=function(ne,oe){var he;if(he=this.rules.inline.url.exec(ne)){var ve,Ne;if(he[2]==="@")ve=ee(this.options.mangle?oe(he[0]):he[0]),Ne="mailto:"+ve;else{var Le;do Le=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(Le!==he[0]);ve=ee(he[0]),he[1]==="www."?Ne="http://"+ve:Ne=ve}return{type:"link",raw:he[0],text:ve,href:Ne,tokens:[{type:"text",raw:ve,text:ve}]}}},ye.inlineText=function(ne,oe,he){var ve=this.rules.inline.text.exec(ne);if(ve){var Ne;return oe?Ne=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):ee(ve[0]):ve[0]:Ne=ee(this.options.smartypants?he(ve[0]):ve[0]),{type:"text",raw:ve[0],text:Ne}}},Ce}(),Re=z.noopTest,Ae=z.edit,we=z.merge,ge={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:Re,table:Re,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=Ae(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=Ae(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=Ae(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._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",ge._comment=/<!--(?!-?>)[\s\S]*?-->/,ge.html=Ae(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=Ae(ge._paragraph).replace("hr",ge.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",ge._tag).getRegex(),ge.blockquote=Ae(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=we({},ge),ge.gfm=we({},ge.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*|$)"}),ge.gfm.nptable=Ae(ge.gfm.nptable).replace("hr",ge.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",ge._tag).getRegex(),ge.gfm.table=Ae(ge.gfm.table).replace("hr",ge.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",ge._tag).getRegex(),ge.pedantic=we({},ge.normal,{html:Ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._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:Re,paragraph:Ae(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,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:Re,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};de._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",de.punctuation=Ae(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=Ae(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=Ae(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=Ae(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=Ae(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=Ae(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=Ae(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=Ae(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=Ae(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=Ae(de._blockSkip,"g").getRegex(),de.overlapSkip=Ae(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._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])?)+(?![-_])/,de.autolink=Ae(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=Ae(de.tag).replace("comment",ge._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=Ae(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=Ae(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=Ae(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=we({},de),de.pedantic=we({},de.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:Ae(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:Ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=we({},de.normal,{escape:Ae(de.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),de.gfm.url=Ae(de.gfm.url,"i").replace("email",de.gfm._extended_email).getRegex(),de.breaks=we({},de.gfm,{br:Ae(de.br).replace("{2,}","*").getRegex(),text:Ae(de.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var re={block:ge,inline:de},ce=W.defaults,se=re.block,ke=re.inline;function ie(Ce){return Ce.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 ae(Ce){var ye="",xe,ne,oe=Ce.length;for(xe=0;xe<oe;xe++)ne=Ce.charCodeAt(xe),Math.random()>.5&&(ne="x"+ne.toString(16)),ye+="&#"+ne+";";return ye}var me=function(){function Ce(xe){this.tokens=[],this.tokens.links=Object.create(null),this.options=xe||ce,this.options.tokenizer=this.options.tokenizer||new Te,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:se.normal,inline:ke.normal};this.options.pedantic?(ne.block=se.pedantic,ne.inline=ke.pedantic):this.options.gfm&&(ne.block=se.gfm,this.options.breaks?ne.inline=ke.breaks:ne.inline=ke.gfm),this.tokenizer.rules=ne}Ce.lex=function(ne,oe){var he=new Ce(oe);return he.lex(ne)};var ye=Ce.prototype;return ye.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(ne,oe,he){oe===void 0&&(oe=[]),he===void 0&&(he=!0),ne=ne.replace(/^ +$/gm,"");for(var ve,Ne,Le,Ke;ne;){if(ve=this.tokenizer.space(ne)){ne=ne.substring(ve.raw.length),ve.type&&oe.push(ve);continue}if(ve=this.tokenizer.code(ne,oe)){ne=ne.substring(ve.raw.length),ve.type?oe.push(ve):(Ke=oe[oe.length-1],Ke.raw+=`
`+ve.raw,Ke.text+=`
`+ve.text);continue}if(ve=this.tokenizer.fences(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.heading(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.nptable(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.hr(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.blockquote(ne)){ne=ne.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],he),oe.push(ve);continue}if(ve=this.tokenizer.list(ne)){for(ne=ne.substring(ve.raw.length),Le=ve.items.length,Ne=0;Ne<Le;Ne++)ve.items[Ne].tokens=this.blockTokens(ve.items[Ne].text,[],!1);oe.push(ve);continue}if(ve=this.tokenizer.html(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(he&&(ve=this.tokenizer.def(ne))){ne=ne.substring(ve.raw.length),this.tokens.links[ve.tag]||(this.tokens.links[ve.tag]={href:ve.href,title:ve.title});continue}if(ve=this.tokenizer.table(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.lheading(ne)){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(he&&(ve=this.tokenizer.paragraph(ne))){ne=ne.substring(ve.raw.length),oe.push(ve);continue}if(ve=this.tokenizer.text(ne,oe)){ne=ne.substring(ve.raw.length),ve.type?oe.push(ve):(Ke=oe[oe.length-1],Ke.raw+=`
`+ve.raw,Ke.text+=`
`+ve.text);continue}if(ne){var at="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return oe},ye.inline=function(ne){var oe,he,ve,Ne,Le,Ke,at=ne.length;for(oe=0;oe<at;oe++){Ke=ne[oe];switch(Ke.type){case"paragraph":case"text":case"heading":{Ke.tokens=[],this.inlineTokens(Ke.text,Ke.tokens);break}case"table":{for(Ke.tokens={header:[],cells:[]},Ne=Ke.header.length,he=0;he<Ne;he++)Ke.tokens.header[he]=[],this.inlineTokens(Ke.header[he],Ke.tokens.header[he]);for(Ne=Ke.cells.length,he=0;he<Ne;he++)for(Le=Ke.cells[he],Ke.tokens.cells[he]=[],ve=0;ve<Le.length;ve++)Ke.tokens.cells[he][ve]=[],this.inlineTokens(Le[ve],Ke.tokens.cells[he][ve]);break}case"blockquote":{this.inline(Ke.tokens);break}case"list":{for(Ne=Ke.items.length,he=0;he<Ne;he++)this.inline(Ke.items[he].tokens);break}}}return ne},ye.inlineTokens=function(ne,oe,he,ve,Ne){oe===void 0&&(oe=[]),he===void 0&&(he=!1),ve===void 0&&(ve=!1),Ne===void 0&&(Ne="");var Le,Ke=ne,at;if(this.tokens.links){var mt=Object.keys(this.tokens.links);if(mt.length>0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec(Ke))!=null;)mt.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&(Ke=Ke.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec(Ke))!=null;)Ke=Ke.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(Le=this.tokenizer.escape(ne)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.tag(ne,he,ve)){ne=ne.substring(Le.raw.length),he=Le.inLink,ve=Le.inRawBlock,oe.push(Le);continue}if(Le=this.tokenizer.link(ne)){ne=ne.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ve)),oe.push(Le);continue}if(Le=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,ve)),oe.push(Le);continue}if(Le=this.tokenizer.strong(ne,Ke,Ne)){ne=ne.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],he,ve),oe.push(Le);continue}if(Le=this.tokenizer.em(ne,Ke,Ne)){ne=ne.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],he,ve),oe.push(Le);continue}if(Le=this.tokenizer.codespan(ne)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.br(ne)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.del(ne)){ne=ne.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],he,ve),oe.push(Le);continue}if(Le=this.tokenizer.autolink(ne,ae)){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(!he&&(Le=this.tokenizer.url(ne,ae))){ne=ne.substring(Le.raw.length),oe.push(Le);continue}if(Le=this.tokenizer.inlineText(ne,ve,ie)){ne=ne.substring(Le.raw.length),Ne=Le.raw.slice(-1),oe.push(Le);continue}if(ne){var pt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return oe},J(Ce,null,[{key:"rules",get:function(){return{block:se,inline:ke}}}]),Ce}(),_e=W.defaults,Me=z.cleanUrl,Ue=z.escape,je=function(){function Ce(xe){this.options=xe||_e}var ye=Ce.prototype;return ye.code=function(ne,oe,he){var ve=(oe||"").match(/\S*/)[0];if(this.options.highlight){var Ne=this.options.highlight(ne,ve);Ne!=null&&Ne!==ne&&(he=!0,ne=Ne)}return ve?'<pre><code class="'+this.options.langPrefix+Ue(ve,!0)+'">'+(he?ne:Ue(ne,!0))+`</code></pre>
`:"<pre><code>"+(he?ne:Ue(ne,!0))+`</code></pre>
`},ye.blockquote=function(ne){return`<blockquote>
`+ne+`</blockquote>
`},ye.html=function(ne){return ne},ye.heading=function(ne,oe,he,ve){return this.options.headerIds?"<h"+oe+' id="'+this.options.headerPrefix+ve.slug(he)+'">'+ne+"</h"+oe+`>
`:"<h"+oe+">"+ne+"</h"+oe+`>
`},ye.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ye.list=function(ne,oe,he){var ve=oe?"ol":"ul",Ne=oe&&he!==1?' start="'+he+'"':"";return"<"+ve+Ne+`>
`+ne+"</"+ve+`>
`},ye.listitem=function(ne){return"<li>"+ne+`</li>
`},ye.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(ne){return"<p>"+ne+`</p>
`},ye.table=function(ne,oe){return oe&&(oe="<tbody>"+oe+"</tbody>"),`<table>
<thead>
`+ne+`</thead>
`+oe+`</table>
`},ye.tablerow=function(ne){return`<tr>
`+ne+`</tr>
`},ye.tablecell=function(ne,oe){var he=oe.header?"th":"td",ve=oe.align?"<"+he+' align="'+oe.align+'">':"<"+he+">";return ve+ne+"</"+he+`>
`},ye.strong=function(ne){return"<strong>"+ne+"</strong>"},ye.em=function(ne){return"<em>"+ne+"</em>"},ye.codespan=function(ne){return"<code>"+ne+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(ne){return"<del>"+ne+"</del>"},ye.link=function(ne,oe,he){if(ne=Me(this.options.sanitize,this.options.baseUrl,ne),ne===null)return he;var ve='<a href="'+Ue(ne)+'"';return oe&&(ve+=' title="'+oe+'"'),ve+=">"+he+"</a>",ve},ye.image=function(ne,oe,he){if(ne=Me(this.options.sanitize,this.options.baseUrl,ne),ne===null)return he;var ve='<img src="'+ne+'" alt="'+he+'"';return oe&&(ve+=' title="'+oe+'"'),ve+=this.options.xhtml?"/>":">",ve},ye.text=function(ne){return ne},Ce}(),Fe=function(){function Ce(){}var ye=Ce.prototype;return ye.strong=function(ne){return ne},ye.em=function(ne){return ne},ye.codespan=function(ne){return ne},ye.del=function(ne){return ne},ye.html=function(ne){return ne},ye.text=function(ne){return ne},ye.link=function(ne,oe,he){return""+he},ye.image=function(ne,oe,he){return""+he},ye.br=function(){return""},Ce}(),Je=function(){function Ce(){this.seen={}}var ye=Ce.prototype;return ye.slug=function(ne){var oe=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(oe)){var he=oe;do this.seen[he]++,oe=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(oe))}return this.seen[oe]=0,oe},Ce}(),$e=W.defaults,Qe=z.unescape,Xe=function(){function Ce(xe){this.options=xe||$e,this.options.renderer=this.options.renderer||new je,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new Je}Ce.parse=function(ne,oe){var he=new Ce(oe);return he.parse(ne)};var ye=Ce.prototype;return ye.parse=function(ne,oe){oe===void 0&&(oe=!0);var he="",ve,Ne,Le,Ke,at,mt,pt,Mt,Pt,yt,Ht,Jt,ut,Zt,Bt,_r,Ze,gt,Ct=ne.length;for(ve=0;ve<Ct;ve++){yt=ne[ve];switch(yt.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(yt.tokens),yt.depth,Qe(this.parseInline(yt.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(yt.text,yt.lang,yt.escaped);continue}case"table":{for(Mt="",pt="",Ke=yt.header.length,Ne=0;Ne<Ke;Ne++)pt+=this.renderer.tablecell(this.parseInline(yt.tokens.header[Ne]),{header:!0,align:yt.align[Ne]});for(Mt+=this.renderer.tablerow(pt),Pt="",Ke=yt.cells.length,Ne=0;Ne<Ke;Ne++){for(mt=yt.tokens.cells[Ne],pt="",at=mt.length,Le=0;Le<at;Le++)pt+=this.renderer.tablecell(this.parseInline(mt[Le]),{header:!1,align:yt.align[Le]});Pt+=this.renderer.tablerow(pt)}he+=this.renderer.table(Mt,Pt);continue}case"blockquote":{Pt=this.parse(yt.tokens),he+=this.renderer.blockquote(Pt);continue}case"list":{for(Ht=yt.ordered,Jt=yt.start,ut=yt.loose,Ke=yt.items.length,Pt="",Ne=0;Ne<Ke;Ne++)Bt=yt.items[Ne],_r=Bt.checked,Ze=Bt.task,Zt="",Bt.task&&(gt=this.renderer.checkbox(_r),ut?Bt.tokens.length>0&&Bt.tokens[0].type==="text"?(Bt.tokens[0].text=gt+" "+Bt.tokens[0].text,Bt.tokens[0].tokens&&Bt.tokens[0].tokens.length>0&&Bt.tokens[0].tokens[0].type==="text"&&(Bt.tokens[0].tokens[0].text=gt+" "+Bt.tokens[0].tokens[0].text)):Bt.tokens.unshift({type:"text",text:gt}):Zt+=gt),Zt+=this.parse(Bt.tokens,ut),Pt+=this.renderer.listitem(Zt,Ze,_r);he+=this.renderer.list(Pt,Ht,Jt);continue}case"html":{he+=this.renderer.html(yt.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(yt.tokens));continue}case"text":{for(Pt=yt.tokens?this.parseInline(yt.tokens):yt.text;ve+1<Ct&&ne[ve+1].type==="text";)yt=ne[++ve],Pt+=`
`+(yt.tokens?this.parseInline(yt.tokens):yt.text);he+=oe?this.renderer.paragraph(Pt):Pt;continue}default:{var ht='Token with "'+yt.type+'" type was not found.';if(this.options.silent){console.error(ht);return}else throw new Error(ht)}}}return he},ye.parseInline=function(ne,oe){oe=oe||this.renderer;var he="",ve,Ne,Le=ne.length;for(ve=0;ve<Le;ve++){Ne=ne[ve];switch(Ne.type){case"escape":{he+=oe.text(Ne.text);break}case"html":{he+=oe.html(Ne.text);break}case"link":{he+=oe.link(Ne.href,Ne.title,this.parseInline(Ne.tokens,oe));break}case"image":{he+=oe.image(Ne.href,Ne.title,Ne.text);break}case"strong":{he+=oe.strong(this.parseInline(Ne.tokens,oe));break}case"em":{he+=oe.em(this.parseInline(Ne.tokens,oe));break}case"codespan":{he+=oe.codespan(Ne.text);break}case"br":{he+=oe.br();break}case"del":{he+=oe.del(this.parseInline(Ne.tokens,oe));break}case"text":{he+=oe.text(Ne.text);break}default:{var Ke='Token with "'+Ne.type+'" type was not found.';if(this.options.silent){console.error(Ke);return}else throw new Error(Ke)}}}return he},Ce}(),dt=z.merge,tt=z.checkSanitizeDeprecation,lt=z.escape,Ie=W.getDefaults,et=W.changeDefaults,it=W.defaults;function Be(Ce,ye,xe){if(typeof Ce=="undefined"||Ce===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ce!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ce)+", string expected");if(typeof ye=="function"&&(xe=ye,ye=null),ye=dt({},Be.defaults,ye||{}),tt(ye),xe){var ne=ye.highlight,oe;try{oe=me.lex(Ce,ye)}catch(Le){return xe(Le)}var he=function(Ke){var at;if(!Ke)try{at=Xe.parse(oe,ye)}catch(mt){Ke=mt}return ye.highlight=ne,Ke?xe(Ke):xe(null,at)};if(!ne||ne.length<3)return he();if(delete ye.highlight,!oe.length)return he();var ve=0;Be.walkTokens(oe,function(Le){Le.type==="code"&&(ve++,setTimeout(function(){ne(Le.text,Le.lang,function(Ke,at){if(Ke)return he(Ke);at!=null&&at!==Le.text&&(Le.text=at,Le.escaped=!0),ve--,ve===0&&he()})},0))}),ve===0&&he();return}try{var Ne=me.lex(Ce,ye);return ye.walkTokens&&Be.walkTokens(Ne,ye.walkTokens),Xe.parse(Ne,ye)}catch(Le){if(Le.message+=`
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+lt(Le.message+"",!0)+"</pre>";throw Le}}Be.options=Be.setOptions=function(Ce){return dt(Be.defaults,Ce),et(Be.defaults),Be},Be.getDefaults=Ie,Be.defaults=it,Be.use=function(Ce){var ye=dt({},Ce);if(Ce.renderer&&function(){var ne=Be.defaults.renderer||new je,oe=function(Ne){var Le=ne[Ne];ne[Ne]=function(){for(var Ke=arguments.length,at=new Array(Ke),mt=0;mt<Ke;mt++)at[mt]=arguments[mt];var pt=Ce.renderer[Ne].apply(ne,at);return pt===!1&&(pt=Le.apply(ne,at)),pt}};for(var he in Ce.renderer)oe(he);ye.renderer=ne}(),Ce.tokenizer&&function(){var ne=Be.defaults.tokenizer||new Te,oe=function(Ne){var Le=ne[Ne];ne[Ne]=function(){for(var Ke=arguments.length,at=new Array(Ke),mt=0;mt<Ke;mt++)at[mt]=arguments[mt];var pt=Ce.tokenizer[Ne].apply(ne,at);return pt===!1&&(pt=Le.apply(ne,at)),pt}};for(var he in Ce.tokenizer)oe(he);ye.tokenizer=ne}(),Ce.walkTokens){var xe=Be.defaults.walkTokens;ye.walkTokens=function(ne){Ce.walkTokens(ne),xe&&xe(ne)}}Be.setOptions(ye)},Be.walkTokens=function(Ce,ye){for(var xe=U(Ce),ne;!(ne=xe()).done;){var oe=ne.value;ye(oe);switch(oe.type){case"table":{for(var he=U(oe.tokens.header),ve;!(ve=he()).done;){var Ne=ve.value;Be.walkTokens(Ne,ye)}for(var Le=U(oe.tokens.cells),Ke;!(Ke=Le()).done;)for(var at=Ke.value,mt=U(at),pt;!(pt=mt()).done;){var Mt=pt.value;Be.walkTokens(Mt,ye)}break}case"list":{Be.walkTokens(oe.items,ye);break}default:oe.tokens&&Be.walkTokens(oe.tokens,ye)}}},Be.Parser=Xe,Be.parser=Xe.parse,Be.Renderer=je,Be.TextRenderer=Fe,Be.Lexer=me,Be.lexer=me.lex,Be.Tokenizer=Te,Be.Slugger=Je,Be.parse=Be;var ze=Be;return ze})},ELLl:function(bt,Se,Q){(function(ue){ue(Q("VrN/"))})(function(ue){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(g,b,a){a&&a!=ue.Init&&(g.removeKeyMap(U),g.state.closeBrackets=null),b&&(P(X(b,"pairs")),g.state.closeBrackets=b,g.addKeyMap(U))});function X(g,b){return b=="pairs"&&typeof g=="string"?g:typeof g=="object"&&g[b]!=null?g[b]:J[b]}var U={Backspace:O,Enter:A};function P(g){for(var b=0;b<g.length;b++){var a=g.charAt(b),i="'"+a+"'";U[i]||(U[i]=W(a))}}P(J.pairs+"`");function W(g){return function(b){return p(b,g)}}function B(g){var b=g.state.closeBrackets;if(!b||b.override)return b;var a=g.getModeAt(g.getCursor());return a.closeBrackets||b}function O(g){var b=B(g);if(!b||g.getOption("disableInput"))return ue.Pass;for(var a=X(b,"pairs"),i=g.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var l=w(g,i[s].head);if(!l||a.indexOf(l)%2!=0)return ue.Pass}for(var s=i.length-1;s>=0;s--){var S=i[s].head;g.replaceRange("",k(S.line,S.ch-1),k(S.line,S.ch+1),"+delete")}}function A(g){var b=B(g),a=b&&X(b,"explode");if(!a||g.getOption("disableInput"))return ue.Pass;for(var i=g.listSelections(),s=0;s<i.length;s++){if(!i[s].empty())return ue.Pass;var l=w(g,i[s].head);if(!l||a.indexOf(l)%2!=0)return ue.Pass}g.operation(function(){var S=g.lineSeparator()||`
`;g.replaceSelection(S+S,null),g.execCommand("goCharLeft"),i=g.listSelections();for(var v=0;v<i.length;v++){var y=i[v].head.line;g.indentLine(y,null,!0),g.indentLine(y+1,null,!0)}})}function d(g){var b=ue.cmpPos(g.anchor,g.head)>0;return{anchor:new k(g.anchor.line,g.anchor.ch+(b?-1:1)),head:new k(g.head.line,g.head.ch+(b?1:-1))}}function p(g,b){var a=B(g);if(!a||g.getOption("disableInput"))return ue.Pass;var i=X(a,"pairs"),s=i.indexOf(b);if(s==-1)return ue.Pass;for(var l=X(a,"closeBefore"),S=X(a,"triples"),v=i.charAt(s+1)==b,y=g.listSelections(),R=s%2==0,_,C=0;C<y.length;C++){var E=y[C],c=E.head,u,h=g.getRange(c,k(c.line,c.ch+1));if(R&&!E.empty())u="surround";else if((v||!R)&&h==b)v&&m(g,c)?u="both":S.indexOf(b)>=0&&g.getRange(c,k(c.line,c.ch+3))==b+b+b?u="skipThree":u="skip";else if(v&&c.ch>1&&S.indexOf(b)>=0&&g.getRange(k(c.line,c.ch-2),c)==b+b){if(c.ch>2&&/\bstring/.test(g.getTokenTypeAt(k(c.line,c.ch-2))))return ue.Pass;u="addFour"}else if(v){var T=c.ch==0?" ":g.getRange(k(c.line,c.ch-1),c);if(!ue.isWordChar(h)&&T!=b&&!ue.isWordChar(T))u="both";else return ue.Pass}else if(R&&(h.length===0||/\s/.test(h)||l.indexOf(h)>-1))u="both";else return ue.Pass;if(!_)_=u;else if(_!=u)return ue.Pass}var L=s%2?i.charAt(s-1):b,I=s%2?b:i.charAt(s+1);g.operation(function(){if(_=="skip")g.execCommand("goCharRight");else if(_=="skipThree")for(var F=0;F<3;F++)g.execCommand("goCharRight");else if(_=="surround"){for(var j=g.getSelections(),F=0;F<j.length;F++)j[F]=L+j[F]+I;g.replaceSelections(j,"around"),j=g.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=d(j[F]);g.setSelections(j)}else _=="both"?(g.replaceSelection(L+I,null),g.triggerElectric(L+I),g.execCommand("goCharLeft")):_=="addFour"&&(g.replaceSelection(L+L+L+L,"before"),g.execCommand("goCharRight"))})}function w(g,b){var a=g.getRange(k(b.line,b.ch-1),k(b.line,b.ch+1));return a.length==2?a:null}function m(g,b){var a=g.getTokenAt(k(b.line,b.ch+1));return/\bstring/.test(a.type)&&a.start==b.ch&&(b.ch==0||!/\bstring/.test(g.getTokenTypeAt(b)))}})},GfqC:function(bt,Se,Q){"use strict";var ue=Q("q1tI"),J=Q.n(ue),k=Q("TSYQ"),X=Q.n(k);function U(z,M){var N="cannot "+z.method+" "+z.action+" "+M.status+"'",Y=new Error(N);return Y.status=M.status,Y.method=z.method,Y.url=z.action,Y}function P(z){var M=z.responseText||z.response;if(!M)return M;try{return JSON.parse(M)}catch(N){return M}}function W(z){var M=new XMLHttpRequest;z.onProgress&&M.upload&&(M.upload.onprogress=function(le){le.total>0&&(le.percent=le.loaded/le.total*100),z.onProgress(le)});var N=new FormData;z.data&&Object.keys(z.data).forEach(function(ee){var le=z.data[ee];if(Array.isArray(le)){le.forEach(function(pe){N.append(ee+"[]",pe)});return}N.append(ee,z.data[ee])}),z.file instanceof Blob?N.append(z.filename,z.file,z.file.name):N.append(z.filename,z.file),M.onerror=function(le){z.onError(le)},M.onload=function(){return M.status<200||M.status>=300?z.onError(U(z,M),P(M)):z.onSuccess(P(M),M)},M.open(z.method,z.action,!0),z.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var Y=z.headers||{};return Y["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(ee){Y[ee]!==null&&M.setRequestHeader(ee,Y[ee])}),M.send(N),{abort:function(){M.abort()}}}var B=+new Date,O=0;function A(){return"rc-upload-"+B+"-"+ ++O}function d(z,M){return z.indexOf(M,z.length-M.length)!==-1}var p=function(z,M){if(z&&M){var N=Array.isArray(M)?M:M.split(","),Y=z.name||"",ee=z.type||"",le=ee.replace(/\/.*$/,"");return N.some(function(pe){var Oe=pe.trim();return Oe.charAt(0)==="."?d(Y.toLowerCase(),Oe.toLowerCase()):/\/\*$/.test(Oe)?le===Oe.replace(/\/.*$/,""):ee===Oe})}return!0};function w(z,M){var N=z.createReader(),Y=[];function ee(){N.readEntries(function(le){var pe=Array.prototype.slice.apply(le);Y=Y.concat(pe);var Oe=!pe.length;Oe?M(Y):ee()})}ee()}var m=function(M,N,Y){var ee=function le(pe,Oe){Oe=Oe||"",pe.isFile?pe.file(function(Te){Y(Te)&&(pe.fullPath&&!Te.webkitRelativePath&&(Object.defineProperties(Te,{webkitRelativePath:{writable:!0}}),Te.webkitRelativePath=pe.fullPath.replace(/^\//,""),Object.defineProperties(Te,{webkitRelativePath:{writable:!1}})),N([Te]))}):pe.isDirectory&&w(pe,function(Te){Te.forEach(function(Re){le(Re,""+Oe+pe.name+"/")})})};M.forEach(function(le){ee(le.webkitGetAsEntry())})},g=m,b=Object.assign||function(z){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(z[Y]=N[Y])}return z},a=function(){function z(M,N){var Y=[],ee=!0,le=!1,pe=void 0;try{for(var Oe=M[Symbol.iterator](),Te;!(ee=(Te=Oe.next()).done)&&!(Y.push(Te.value),N&&Y.length===N);ee=!0);}catch(Re){le=!0,pe=Re}finally{try{!ee&&Oe.return&&Oe.return()}finally{if(le)throw pe}}return Y}return function(M,N){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return z(M,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function z(M,N){for(var Y=0;Y<N.length;Y++){var ee=N[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(M,ee.key,ee)}}return function(M,N,Y){return N&&z(M.prototype,N),Y&&z(M,Y),M}}();function s(z,M,N){return M in z?Object.defineProperty(z,M,{value:N,enumerable:!0,configurable:!0,writable:!0}):z[M]=N,z}function l(z,M){var N={};for(var Y in z){if(M.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(z,Y))continue;N[Y]=z[Y]}return N}function S(z,M){if(!(z instanceof M))throw new TypeError("Cannot call a class as a function")}function v(z,M){if(!z)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:z}function y(z,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);z.prototype=Object.create(M&&M.prototype,{constructor:{value:z,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(z,M):z.__proto__=M)}var R=function(M){return Object.keys(M).reduce(function(N,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(N[Y]=M[Y]),N},{})},_=function(z){y(M,z);function M(){var N,Y,ee,le;S(this,M);for(var pe=arguments.length,Oe=Array(pe),Te=0;Te<pe;Te++)Oe[Te]=arguments[Te];return le=(Y=(ee=v(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Oe))),ee),ee.state={uid:A()},ee.reqs={},ee.onChange=function(Re){var Ae=Re.target.files;ee.uploadFiles(Ae),ee.reset()},ee.onClick=function(Re){var Ae=ee.fileInput;if(!Ae)return;var we=ee.props,ge=we.children,de=we.onClick;ge&&ge.type==="button"&&(Ae.parentNode.focus(),Ae.parentNode.querySelector("button").blur()),Ae.click(),de&&de(Re)},ee.onKeyDown=function(Re){Re.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Re){var Ae=ee.props.multiple;if(Re.preventDefault(),Re.type==="dragover")return;if(ee.props.directory)g(Array.prototype.slice.call(Re.dataTransfer.items),ee.uploadFiles,function(ge){return p(ge,ee.props.accept)});else{var we=Array.prototype.slice.call(Re.dataTransfer.files).filter(function(ge){return p(ge,ee.props.accept)});Ae===!1&&(we=we.slice(0,1)),ee.uploadFiles(we)}},ee.uploadFiles=function(Re){var Ae=Array.prototype.slice.call(Re);Ae.map(function(we){return we.uid=A(),we}).forEach(function(we){ee.upload(we,Ae)})},ee.saveFileInput=function(Re){ee.fileInput=Re},Y),v(ee,le)}return i(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,ee){var le=this,pe=this.props;if(!pe.beforeUpload)return setTimeout(function(){return le.post(Y)},0);var Oe=pe.beforeUpload(Y,ee);Oe&&Oe.then?Oe.then(function(Te){var Re=Object.prototype.toString.call(Te);return Re==="[object File]"||Re==="[object Blob]"?le.post(Te):le.post(Y)}).catch(function(Te){console.log(Te)}):Oe!==!1&&setTimeout(function(){return le.post(Y)},0);return}},{key:"post",value:function(Y){var ee=this;if(!this._isMounted)return;var le=this.props,pe=le.onStart,Oe=le.onProgress,Te=le.transformFile,Re=Te===void 0?function(Ae){return Ae}:Te;new Promise(function(Ae){var we=le.action;return typeof we=="function"&&(we=we(Y)),Ae(we)}).then(function(Ae){var we=Y.uid,ge=le.customRequest||W,de=Promise.resolve(Re(Y)).then(function(re){var ce=le.data;return typeof ce=="function"&&(ce=ce(re)),Promise.all([re,ce])}).catch(function(re){console.error(re)});de.then(function(re){var ce=a(re,2),se=ce[0],ke=ce[1],ie={action:Ae,filename:le.name,data:ke,file:se,headers:le.headers,withCredentials:le.withCredentials,method:le.method||"post",onProgress:Oe?function(ae){Oe(ae,Y)}:null,onSuccess:function(me,_e){delete ee.reqs[we],le.onSuccess(me,Y,_e)},onError:function(me,_e){delete ee.reqs[we],le.onError(me,_e,Y)}};pe(Y),ee.reqs[we]=ge(ie)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(Y){var ee=this.reqs;if(Y){var le=Y;Y&&Y.uid&&(le=Y.uid),ee[le]&&ee[le].abort&&ee[le].abort(),delete ee[le]}else Object.keys(ee).forEach(function(pe){ee[pe]&&ee[pe].abort&&ee[pe].abort(),delete ee[pe]})}},{key:"render",value:function(){var Y,ee=this.props,le=ee.component,pe=ee.prefixCls,Oe=ee.className,Te=ee.disabled,Re=ee.id,Ae=ee.style,we=ee.multiple,ge=ee.accept,de=ee.children,re=ee.directory,ce=ee.openFileDialogOnClick,se=ee.onMouseEnter,ke=ee.onMouseLeave,ie=l(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ae=X()((Y={},s(Y,pe,!0),s(Y,pe+"-disabled",Te),s(Y,Oe,Oe),Y)),me=Te?{}:{onClick:ce?this.onClick:function(){},onKeyDown:ce?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:ke,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(le,b({},me,{className:ae,role:"button",style:Ae}),J.a.createElement("input",b({},R(ie),{id:Re,type:"file",ref:this.saveFileInput,onClick:function(Me){return Me.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ge,directory:re?"directory":null,webkitdirectory:re?"webkitdirectory":null,multiple:we,onChange:this.onChange})),de)}}]),M}(ue.Component),C=_,E=Object.assign||function(z){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(z[Y]=N[Y])}return z},c=function(){function z(M,N){for(var Y=0;Y<N.length;Y++){var ee=N[Y];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(M,ee.key,ee)}}return function(M,N,Y){return N&&z(M.prototype,N),Y&&z(M,Y),M}}();function u(z,M){if(!(z instanceof M))throw new TypeError("Cannot call a class as a function")}function h(z,M){if(!z)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:z}function T(z,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);z.prototype=Object.create(M&&M.prototype,{constructor:{value:z,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(z,M):z.__proto__=M)}function L(){}var I=function(z){T(M,z);function M(){var N,Y,ee,le;u(this,M);for(var pe=arguments.length,Oe=Array(pe),Te=0;Te<pe;Te++)Oe[Te]=arguments[Te];return le=(Y=(ee=h(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Oe))),ee),ee.saveUploader=function(Re){ee.uploader=Re},Y),h(ee,le)}return c(M,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return J.a.createElement(C,E({},this.props,{ref:this.saveUploader}))}}]),M}(ue.Component);I.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:L,onError:L,onSuccess:L,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=I,j=Se.a=F},HmJG:function(bt,Se,Q){},JYp7:function(bt,Se,Q){"use strict";Q.d(Se,"c",function(){return J}),Q.d(Se,"d",function(){return k}),Q.d(Se,"f",function(){return U}),Q.d(Se,"a",function(){return P}),Q.d(Se,"b",function(){return W}),Q.d(Se,"e",function(){return B});var ue=function(){var O=function(A,d){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,w){p.__proto__=w}||function(p,w){for(var m in w)w.hasOwnProperty(m)&&(p[m]=w[m])},O(A,d)};return function(A,d){O(A,d);function p(){this.constructor=A}A.prototype=d===null?Object.create(d):(p.prototype=d.prototype,new p)}}(),J={done:!0,value:void 0},k;(function(O){var A={next:function(){return J}};function d(){return A}O.empty=d;function p(v){var y=!1;return{next:function(){return y?J:(y=!0,{done:!1,value:v})}}}O.single=p;function w(v,y,R){return y===void 0&&(y=0),R===void 0&&(R=v.length),{next:function(){return y>=R?J:{done:!1,value:v[y++]}}}}O.fromArray=w;function m(v){return{next:function(){var y=v.next();return y.done?J:{done:!1,value:y.value}}}}O.fromNativeIterator=m;function g(v){return v?Array.isArray(v)?O.fromArray(v):v:O.empty()}O.from=g;function b(v,y){return{next:function(){var R=v.next();return R.done?J:{done:!1,value:y(R.value)}}}}O.map=b;function a(v,y){return{next:function(){for(;;){var R=v.next();if(R.done)return J;if(y(R.value))return{done:!1,value:R.value}}}}}O.filter=a;function i(v,y){for(var R=v.next();!R.done;R=v.next())y(R.value)}O.forEach=i;function s(v,y){y===void 0&&(y=Number.POSITIVE_INFINITY);var R=[];if(y===0)return R;for(var _=0,C=v.next();!C.done&&!(R.push(C.value),++_>=y);C=v.next());return R}O.collect=s;function l(){for(var v=[],y=0;y<arguments.length;y++)v[y]=arguments[y];var R=0;return{next:function(){if(R>=v.length)return J;var _=v[R],C=_.next();return C.done?(R++,this.next()):C}}}O.concat=l;function S(v){return new X(v)}O.chain=S})(k||(k={}));var X=function(){function O(A){this.it=A}return O.prototype.next=function(){return this.it.next()},O}();function U(O){return Array.isArray(O)?k.fromArray(O):O||k.empty()}var P=function(){function O(A,d,p,w){d===void 0&&(d=0),p===void 0&&(p=A.length),w===void 0&&(w=d-1),this.items=A,this.start=d,this.end=p,this.index=w}return O.prototype.first=function(){return this.index=this.start,this.current()},O.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},O.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},O}(),W=function(O){ue(A,O);function A(d,p,w,m){return p===void 0&&(p=0),w===void 0&&(w=d.length),m===void 0&&(m=p-1),O.call(this,d,p,w,m)||this}return A.prototype.current=function(){return O.prototype.current.call(this)},A.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},A.prototype.first=function(){return this.index=this.start,this.current()},A.prototype.last=function(){return this.index=this.end-1,this.current()},A.prototype.parent=function(){return null},A}(P),B=function(){function O(A,d){this.iterator=A,this.fn=d}return O.prototype.next=function(){return this.fn(this.iterator.next())},O}()},LdHM:function(bt,Se,Q){"use strict";Q.d(Se,"b",function(){return l}),Q.d(Se,"a",function(){return v});var ue=Q("1OyB"),J=Q("vuIU"),k=Q("Ji7U"),X=Q("LK+K"),U=Q("q1tI"),P=Q("rePB"),W=Q("Ff2n"),B=Q("ODXe"),O=Q("4IlW"),A=Q("bX4T"),d=Q("YrtM"),p=Q("TSYQ"),w=Q.n(p),m=Q("+nKL"),g=Q("8OUc"),b=function(Y,ee){var le=Y.prefixCls,pe=Y.id,Oe=Y.flattenOptions,Te=Y.childrenAsData,Re=Y.values,Ae=Y.searchValue,we=Y.multiple,ge=Y.defaultActiveFirstOption,de=Y.height,re=Y.itemHeight,ce=Y.notFoundContent,se=Y.open,ke=Y.menuItemSelectedIcon,ie=Y.virtual,ae=Y.onSelect,me=Y.onToggleOpen,_e=Y.onActiveValue,Me=Y.onScroll,Ue=Y.onMouseEnter,je="".concat(le,"-item"),Fe=Object(d.a)(function(){return Oe},[se,Oe],function(ze,Ce){return Ce[0]&&ze[1]!==Ce[1]}),Je=U.useRef(null),$e=function(Ce){Ce.preventDefault()},Qe=function(Ce){Je.current&&Je.current.scrollTo({index:Ce})},Xe=function(Ce){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,xe=Fe.length,ne=0;ne<xe;ne+=1){var oe=(Ce+ne*ye+xe)%xe,he=Fe[oe],ve=he.group,Ne=he.data;if(!ve&&!Ne.disabled)return oe}return-1},dt=U.useState(function(){return Xe(0)}),tt=Object(B.a)(dt,2),lt=tt[0],Ie=tt[1],et=function(Ce){Ie(Ce);var ye=Fe[Ce];if(!ye){_e(null,-1);return}_e(ye.data.value,Ce)};U.useEffect(function(){et(ge!==!1?Xe(0):-1)},[Fe.length,Ae]),U.useEffect(function(){var ze=setTimeout(function(){if(!we&&se&&Re.size===1){var Ce=Array.from(Re)[0],ye=Fe.findIndex(function(xe){var ne=xe.data;return ne.value===Ce});et(ye),Qe(ye)}});return function(){return clearTimeout(ze)}},[se]);var it=function(Ce){Ce!==void 0&&ae(Ce,{selected:!Re.has(Ce)}),we||me(!1)};if(U.useImperativeHandle(ee,function(){return{onKeyDown:function(Ce){var ye=Ce.which;switch(ye){case O.a.UP:case O.a.DOWN:{var xe=0;if(ye===O.a.UP?xe=-1:ye===O.a.DOWN&&(xe=1),xe!==0){var ne=Xe(lt+xe,xe);Qe(ne),et(ne)}break}case O.a.ENTER:{var oe=Fe[lt];oe&&!oe.data.disabled?it(oe.data.value):it(void 0),se&&Ce.preventDefault();break}case O.a.ESC:me(!1)}},onKeyUp:function(){},scrollTo:function(Ce){Qe(Ce)}}}),Fe.length===0)return U.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),className:"".concat(je,"-empty"),onMouseDown:$e},ce);function Be(ze){var Ce=Fe[ze];if(!Ce)return null;var ye=Ce.data||{},xe=ye.value,ne=ye.label,oe=ye.children,he=Object(A.a)(ye,!0),ve=Te?oe:ne;return Ce?U.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},he,{key:ze,role:"option",id:"".concat(pe,"_list_").concat(ze),"aria-selected":Re.has(xe)}),xe):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Be(lt-1),Be(lt),Be(lt+1)),U.createElement(m.a,{itemKey:"key",ref:Je,data:Fe,height:de,itemHeight:re,fullHeight:!1,onMouseDown:$e,onScroll:Me,virtual:ie,onMouseEnter:Ue},function(ze,Ce){var ye,xe=ze.group,ne=ze.groupOption,oe=ze.data,he=oe.label,ve=oe.key;if(xe)return U.createElement("div",{className:w()(je,"".concat(je,"-group"))},he!==void 0?he:ve);var Ne=oe.disabled,Le=oe.value,Ke=oe.title,at=oe.children,mt=oe.style,pt=oe.className,Mt=Object(W.a)(oe,["disabled","value","title","children","style","className"]),Pt=Re.has(Le),yt="".concat(je,"-option"),Ht=w()(je,yt,pt,(ye={},Object(P.a)(ye,"".concat(yt,"-grouped"),ne),Object(P.a)(ye,"".concat(yt,"-active"),lt===Ce&&!Ne),Object(P.a)(ye,"".concat(yt,"-disabled"),Ne),Object(P.a)(ye,"".concat(yt,"-selected"),Pt),ye)),Jt=Te?at:he,ut=!ke||typeof ke=="function"||Pt;return U.createElement("div",Object.assign({},Mt,{"aria-selected":Pt,className:Ht,title:Ke,onMouseMove:function(){if(lt===Ce||Ne)return;et(Ce)},onClick:function(){Ne||it(Le)},style:mt}),U.createElement("div",{className:"".concat(yt,"-content")},Jt||Le),U.isValidElement(ke)||Pt,ut&&U.createElement(g.a,{className:"".concat(je,"-option-state"),customizeIcon:ke,customizeIconProps:{isSelected:Pt}},Pt?"\u2713":null))}))},a=U.forwardRef(b);a.displayName="OptionList";var i=a,s=function(){return null};s.isSelectOption=!0;var l=s,S=function(){return null};S.isSelectOptGroup=!0;var v=S,y=Q("VTBJ"),R=Q("Zm9Q");function _(N){var Y=N.key,ee=N.props,le=ee.children,pe=ee.value,Oe=Object(W.a)(ee,["children","value"]);return Object(y.a)({key:Y,value:pe!==void 0?pe:Y,children:le},Oe)}function C(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(N).map(function(ee,le){if(!U.isValidElement(ee)||!ee.type)return null;var pe=ee.type.isSelectOptGroup,Oe=ee.key,Te=ee.props,Re=Te.children,Ae=Object(W.a)(Te,["children"]);return Y||!pe?_(ee):Object(y.a)(Object(y.a)({key:"__RC_SELECT_GRP__".concat(Oe===null?le:Oe,"__"),label:Oe},Ae),{},{options:C(Re)})}).filter(function(ee){return ee})}var E=Q("2Qr1"),c=Q("qNPg"),u=Q("U8pU"),h=Q("Kwbf"),T=Q("WKfj");function L(N){var Y=N.mode,ee=N.options,le=N.children,pe=N.backfill,Oe=N.allowClear,Te=N.placeholder,Re=N.getInputElement,Ae=N.showSearch,we=N.onSearch,ge=N.defaultOpen,de=N.autoFocus,re=N.labelInValue,ce=N.value,se=N.inputValue,ke=N.optionLabelProp,ie=Y==="multiple"||Y==="tags",ae=Ae!==void 0?Ae:ie||Y==="combobox",me=ee||C(le);if(Object(h.a)(Y!=="tags"||me.every(function(je){return!je.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var _e=me.some(function(je){return je.options?je.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in je?je.value:je.key)=="number"});Object(h.a)(!_e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(h.a)(Y!=="combobox"||!ke,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(h.a)(Y==="combobox"||!pe,"`backfill` only works with `combobox` mode."),Object(h.a)(Y==="combobox"||!Re,"`getInputElement` only work with `combobox` mode."),Object(h.b)(Y!=="combobox"||!Re||!Oe||!Te,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),we&&!ae&&Y!=="combobox"&&Y!=="tags"&&Object(h.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(h.b)(!ge||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ce!=null){var Me=Object(T.d)(ce);Object(h.a)(!re||Me.every(function(je){return Object(u.a)(je)==="object"&&("key"in je||"value"in je)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(h.a)(!ie||Array.isArray(ce),"`value` should be array when `mode` is `multiple` or `tags`")}if(le){var Ue=null;Object(R.a)(le).some(function(je){if(!U.isValidElement(je)||!je.type)return!1;var Fe=je.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var Je=Object(R.a)(je.props.children).every(function($e){return!U.isValidElement($e)||!je.type||$e.type.isSelectOption?!0:(Ue=$e.type,!1)});return!Je}return Ue=Fe,!0}),Ue&&Object(h.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ue.displayName||Ue.name||Ue,"`.")),Object(h.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=L,F=Object(c.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:C,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:I,fillOptionsWithMissingValue:E.a}),j=function(N){Object(k.a)(ee,N);var Y=Object(X.a)(ee);function ee(){var le;return Object(ue.a)(this,ee),le=Y.apply(this,arguments),le.selectRef=U.createRef(),le.focus=function(){le.selectRef.current.focus()},le.blur=function(){le.selectRef.current.blur()},le}return Object(J.a)(ee,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),ee}(U.Component);j.Option=l,j.OptGroup=v;var z=j,M=Se.c=z},M8RZ:function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return O});var ue=Q("fWQN"),J=Q("mtLc"),k=Q("yKVA"),X=Q("879j"),U=Q("q1tI"),P=Q.n(U),W=Q("i8i4"),B=Q.n(W),O=function(A){Object(k.a)(p,A);var d=Object(X.a)(p);function p(w){var m;Object(ue.a)(this,p),m=d.call(this,w);var g=window.document;return m.node=g.createElement("div"),g.body.appendChild(m.node),m}return Object(J.a)(p,[{key:"render",value:function(){var m=this.props.children;return Object(W.createPortal)(m,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(P.a.Component)},MI8n:function(bt,Se,Q){"use strict";Q.d(Se,"b",function(){return P}),Q.d(Se,"a",function(){return O}),Q.d(Se,"e",function(){return A}),Q.d(Se,"d",function(){return d}),Q.d(Se,"c",function(){return p}),Q.d(Se,"f",function(){return w});var ue=Q("/cxE"),J=Q("C/vA"),k=Q("pmY6"),X=Q("24hK"),U=function(){var m=function(g,b){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var s in i)i.hasOwnProperty(s)&&(a[s]=i[s])},m(g,b)};return function(g,b){m(g,b);function a(){this.constructor=g}g.prototype=b===null?Object.create(b):(a.prototype=b.prototype,new a)}}(),P;(function(m){m.None=function(){return k.a.None};function g(I){return function(F,j,z){j===void 0&&(j=null);var M=!1,N;return N=I(function(Y){return M?void 0:(N?N.dispose():M=!0,F.call(j,Y))},null,z),M&&N.dispose(),N}}m.once=g;function b(I,F){return v(function(j,z,M){return z===void 0&&(z=null),I(function(N){return j.call(z,F(N))},null,M)})}m.map=b;function a(I,F){return v(function(j,z,M){return z===void 0&&(z=null),I(function(N){F(N),j.call(z,N)},null,M)})}m.forEach=a;function i(I,F){return v(function(j,z,M){return z===void 0&&(z=null),I(function(N){return F(N)&&j.call(z,N)},null,M)})}m.filter=i;function s(I){return I}m.signal=s;function l(){for(var I=[],F=0;F<arguments.length;F++)I[F]=arguments[F];return function(j,z,M){return z===void 0&&(z=null),k.e.apply(void 0,I.map(function(N){return N(function(Y){return j.call(z,Y)},null,M)}))}}m.any=l;function S(I,F,j){var z=j;return b(I,function(M){return z=F(z,M),z})}m.reduce=S;function v(I){var F,j=new O({onFirstListenerAdd:function(){F=I(j.fire,j)},onLastListenerRemove:function(){F.dispose()}});return j.event}m.snapshot=v;function y(I,F,j,z,M){j===void 0&&(j=100),z===void 0&&(z=!1);var N,Y=void 0,ee=void 0,le=0,pe=new O({leakWarningThreshold:M,onFirstListenerAdd:function(){N=I(function(Oe){le++,Y=F(Y,Oe),z&&!ee&&(pe.fire(Y),Y=void 0),clearTimeout(ee),ee=setTimeout(function(){var Te=Y;Y=void 0,ee=void 0,(!z||le>1)&&pe.fire(Te),le=0},j)})},onLastListenerRemove:function(){N.dispose()}});return pe.event}m.debounce=y;function R(I){var F=new Date().getTime();return b(g(I),function(j){return new Date().getTime()-F})}m.stopwatch=R;function _(I){var F=!0,j;return i(I,function(z){var M=F||z!==j;return F=!1,j=z,M})}m.latch=_;function C(I,F,j){F===void 0&&(F=!1),j===void 0&&(j=[]);var z=j.slice(),M=I(function(ee){z?z.push(ee):Y.fire(ee)}),N=function(){z&&z.forEach(function(ee){return Y.fire(ee)}),z=null},Y=new O({onFirstListenerAdd:function(){M||(M=I(function(ee){return Y.fire(ee)}))},onFirstListenerDidAdd:function(){z&&(F?setTimeout(N):N())},onLastListenerRemove:function(){M&&M.dispose(),M=null}});return Y.event}m.buffer=C;var E=function(){function I(F){this.event=F}return I.prototype.map=function(F){return new I(b(this.event,F))},I.prototype.forEach=function(F){return new I(a(this.event,F))},I.prototype.filter=function(F){return new I(i(this.event,F))},I.prototype.reduce=function(F,j){return new I(S(this.event,F,j))},I.prototype.latch=function(){return new I(_(this.event))},I.prototype.debounce=function(F,j,z,M){return j===void 0&&(j=100),z===void 0&&(z=!1),new I(y(this.event,F,j,z,M))},I.prototype.on=function(F,j,z){return this.event(F,j,z)},I.prototype.once=function(F,j,z){return g(this.event)(F,j,z)},I}();function c(I){return new E(I)}m.chain=c;function u(I,F,j){j===void 0&&(j=function(ee){return ee});var z=function(){for(var ee=[],le=0;le<arguments.length;le++)ee[le]=arguments[le];return Y.fire(j.apply(void 0,ee))},M=function(){return I.on(F,z)},N=function(){return I.removeListener(F,z)},Y=new O({onFirstListenerAdd:M,onLastListenerRemove:N});return Y.event}m.fromNodeEventEmitter=u;function h(I,F,j){j===void 0&&(j=function(ee){return ee});var z=function(){for(var ee=[],le=0;le<arguments.length;le++)ee[le]=arguments[le];return Y.fire(j.apply(void 0,ee))},M=function(){return I.addEventListener(F,z)},N=function(){return I.removeEventListener(F,z)},Y=new O({onFirstListenerAdd:M,onLastListenerRemove:N});return Y.event}m.fromDOMEventEmitter=h;function T(I){var F=new O,j=!1;return I.then(void 0,function(){return null}).then(function(){j?F.fire(void 0):setTimeout(function(){return F.fire(void 0)},0)}),j=!0,F.event}m.fromPromise=T;function L(I){return new Promise(function(F){return g(I)(F)})}m.toPromise=L})(P||(P={}));var W=-1,B=function(){function m(g,b){b===void 0&&(b=Math.random().toString(18).slice(2,5)),this.customThreshold=g,this.name=b,this._warnCountdown=0}return m.prototype.dispose=function(){this._stacks&&this._stacks.clear()},m.prototype.check=function(g){var b=this,a=W;if(typeof this.customThreshold=="number"&&(a=this.customThreshold),a<=0||g<a)return;this._stacks||(this._stacks=new Map);var i=new Error().stack.split(`
`).slice(3).join(`
`),s=this._stacks.get(i)||0;if(this._stacks.set(i,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;var l,S=0;this._stacks.forEach(function(v,y){(!l||S<v)&&(l=y,S=v)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+g+" listeners already. MOST frequent listener ("+S+"):"),console.warn(l)}return function(){var v=b._stacks.get(i)||0;b._stacks.set(i,v-1)}},m}(),O=function(){function m(g){this._disposed=!1,this._options=g,this._leakageMon=W>0?new B(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(m.prototype,"event",{get:function(){var g=this;return this._event||(this._event=function(b,a,i){g._listeners||(g._listeners=new X.a);var s=g._listeners.isEmpty();s&&g._options&&g._options.onFirstListenerAdd&&g._options.onFirstListenerAdd(g);var l=g._listeners.push(a?[b,a]:b);s&&g._options&&g._options.onFirstListenerDidAdd&&g._options.onFirstListenerDidAdd(g),g._options&&g._options.onListenerDidAdd&&g._options.onListenerDidAdd(g,b,a);var S;g._leakageMon&&(S=g._leakageMon.check(g._listeners.size));var v;return v={dispose:function(){if(S&&S(),v.dispose=m._noop,!g._disposed&&(l(),g._options&&g._options.onLastListenerRemove)){var y=g._listeners&&!g._listeners.isEmpty();y||g._options.onLastListenerRemove(g)}}},i instanceof k.b?i.add(v):Array.isArray(i)&&i.push(v),v}),this._event},enumerable:!0,configurable:!0}),m.prototype.fire=function(g){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new X.a);for(var b=this._listeners.iterator(),a=b.next();!a.done;a=b.next())this._deliveryQueue.push([a.value,g]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),s=i[0],l=i[1];try{typeof s=="function"?s.call(void 0,l):s[0].call(s[1],l)}catch(S){Object(ue.e)(S)}}}},m.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},m._noop=function(){},m}(),A=function(m){U(g,m);function g(b){var a=m.call(this,b)||this;return a._isPaused=0,a._eventQueue=new X.a,a._mergeFn=b&&b.merge,a}return g.prototype.pause=function(){this._isPaused++},g.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var b=this._eventQueue.toArray();this._eventQueue.clear(),m.prototype.fire.call(this,this._mergeFn(b))}else for(;!this._isPaused&&this._eventQueue.size!==0;)m.prototype.fire.call(this,this._eventQueue.shift())},g.prototype.fire=function(b){this._listeners&&(this._isPaused!==0?this._eventQueue.push(b):m.prototype.fire.call(this,b))},g}(O),d=function(){function m(){var g=this;this.hasListeners=!1,this.events=[],this.emitter=new O({onFirstListenerAdd:function(){return g.onFirstListenerAdd()},onLastListenerRemove:function(){return g.onLastListenerRemove()}})}return Object.defineProperty(m.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),m.prototype.add=function(g){var b=this,a={event:g,listener:null};this.events.push(a),this.hasListeners&&this.hook(a);var i=function(){b.hasListeners&&b.unhook(a);var s=b.events.indexOf(a);b.events.splice(s,1)};return Object(k.h)(Object(J.a)(i))},m.prototype.onFirstListenerAdd=function(){var g=this;this.hasListeners=!0,this.events.forEach(function(b){return g.hook(b)})},m.prototype.onLastListenerRemove=function(){var g=this;this.hasListeners=!1,this.events.forEach(function(b){return g.unhook(b)})},m.prototype.hook=function(g){var b=this;g.listener=g.event(function(a){return b.emitter.fire(a)})},m.prototype.unhook=function(g){g.listener&&g.listener.dispose(),g.listener=null},m.prototype.dispose=function(){this.emitter.dispose()},m}(),p=function(){function m(){this.buffers=[]}return m.prototype.wrapEvent=function(g){var b=this;return function(a,i,s){return g(function(l){var S=b.buffers[b.buffers.length-1];S?S.push(function(){return a.call(i,l)}):a.call(i,l)},void 0,s)}},m.prototype.bufferEvents=function(g){var b=[];this.buffers.push(b);var a=g();return this.buffers.pop(),b.forEach(function(i){return i()}),a},m}(),w=function(){function m(){var g=this;this.listening=!1,this.inputEvent=P.None,this.inputEventListener=k.a.None,this.emitter=new O({onFirstListenerDidAdd:function(){g.listening=!0,g.inputEventListener=g.inputEvent(g.emitter.fire,g.emitter)},onLastListenerRemove:function(){g.listening=!1,g.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(m.prototype,"input",{set:function(g){this.inputEvent=g,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=g(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),m.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},m}()},N0LK:function(bt,Se,Q){"use strict";Q.d(Se,"x",function(){return ue}),Q.d(Se,"F",function(){return J}),Q.d(Se,"r",function(){return X}),Q.d(Se,"o",function(){return U}),Q.d(Se,"p",function(){return P}),Q.d(Se,"Q",function(){return W}),Q.d(Se,"K",function(){return O}),Q.d(Se,"k",function(){return A}),Q.d(Se,"N",function(){return d}),Q.d(Se,"m",function(){return p}),Q.d(Se,"l",function(){return w}),Q.d(Se,"I",function(){return m}),Q.d(Se,"H",function(){return g}),Q.d(Se,"q",function(){return b}),Q.d(Se,"t",function(){return a}),Q.d(Se,"D",function(){return i}),Q.d(Se,"e",function(){return s}),Q.d(Se,"f",function(){return l}),Q.d(Se,"B",function(){return S}),Q.d(Se,"C",function(){return v}),Q.d(Se,"n",function(){return R}),Q.d(Se,"O",function(){return C}),Q.d(Se,"c",function(){return E}),Q.d(Se,"d",function(){return c}),Q.d(Se,"z",function(){return u}),Q.d(Se,"A",function(){return h}),Q.d(Se,"u",function(){return T}),Q.d(Se,"E",function(){return I}),Q.d(Se,"G",function(){return F}),Q.d(Se,"i",function(){return z}),Q.d(Se,"g",function(){return N}),Q.d(Se,"v",function(){return ee}),Q.d(Se,"h",function(){return le}),Q.d(Se,"y",function(){return pe}),Q.d(Se,"w",function(){return Oe}),Q.d(Se,"a",function(){return Te}),Q.d(Se,"P",function(){return Re}),Q.d(Se,"L",function(){return Ae}),Q.d(Se,"J",function(){return we}),Q.d(Se,"j",function(){return ge}),Q.d(Se,"M",function(){return de}),Q.d(Se,"s",function(){return re}),Q.d(Se,"b",function(){return ce});function ue(ie){return!ie||typeof ie!="string"?!0:ie.trim().length===0}function J(ie,ae,me){me===void 0&&(me="0");for(var _e=""+ie,Me=[_e],Ue=_e.length;Ue<ae;Ue++)Me.push(me);return Me.reverse().join("")}var k=/{(\d+)}/g;function X(ie){for(var ae=[],me=1;me<arguments.length;me++)ae[me-1]=arguments[me];return ae.length===0?ie:ie.replace(k,function(_e,Me){var Ue=parseInt(Me,10);return isNaN(Ue)||Ue<0||Ue>=ae.length?_e:ae[Ue]})}function U(ie){return ie.replace(/[<>&]/g,function(ae){switch(ae){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ae}})}function P(ie){return ie.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function W(ie,ae){ae===void 0&&(ae=" ");var me=B(ie,ae);return O(me,ae)}function B(ie,ae){if(!ie||!ae)return ie;var me=ae.length;if(me===0||ie.length===0)return ie;for(var _e=0;ie.indexOf(ae,_e)===_e;)_e=_e+me;return ie.substring(_e)}function O(ie,ae){if(!ie||!ae)return ie;var me=ae.length,_e=ie.length;if(me===0||_e===0)return ie;for(var Me=_e,Ue=-1;!(Ue=ie.lastIndexOf(ae,Me-1),Ue===-1||Ue+me!==Me);){if(Ue===0)return"";Me=Ue}return ie.substring(0,Me)}function A(ie){return ie.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(ie,ae){if(ie.length<ae.length)return!1;if(ie===ae)return!0;for(var me=0;me<ae.length;me++)if(ie[me]!==ae[me])return!1;return!0}function p(ie,ae){var me=ie.length-ae.length;return me>0?ie.indexOf(ae,me)===me:me===0?ie===ae:!1}function w(ie,ae,me){if(me===void 0&&(me={}),!ie)throw new Error("Cannot create regex from empty string");ae||(ie=P(ie)),me.wholeWord&&(/\B/.test(ie.charAt(0))||(ie="\\b"+ie),/\B/.test(ie.charAt(ie.length-1))||(ie=ie+"\\b"));var _e="";return me.global&&(_e+="g"),me.matchCase||(_e+="i"),me.multiline&&(_e+="m"),me.unicode&&(_e+="u"),new RegExp(ie,_e)}function m(ie){if(ie.source==="^"||ie.source==="^$"||ie.source==="$"||ie.source==="^\\s*$")return!1;var ae=ie.exec("");return!!(ae&&ie.lastIndex===0)}function g(ie){return(ie.global?"g":"")+(ie.ignoreCase?"i":"")+(ie.multiline?"m":"")+(ie.unicode?"u":"")}function b(ie){for(var ae=0,me=ie.length;ae<me;ae++){var _e=ie.charCodeAt(ae);if(_e!==32&&_e!==9)return ae}return-1}function a(ie,ae,me){ae===void 0&&(ae=0),me===void 0&&(me=ie.length);for(var _e=ae;_e<me;_e++){var Me=ie.charCodeAt(_e);if(Me!==32&&Me!==9)return ie.substring(ae,_e)}return ie.substring(ae,me)}function i(ie,ae){ae===void 0&&(ae=ie.length-1);for(var me=ae;me>=0;me--){var _e=ie.charCodeAt(me);if(_e!==32&&_e!==9)return me}return-1}function s(ie,ae){return ie<ae?-1:ie>ae?1:0}function l(ie,ae){for(var me=Math.min(ie.length,ae.length),_e=0;_e<me;_e++){var Me=ie.charCodeAt(_e),Ue=ae.charCodeAt(_e);if(Me===Ue)continue;v(Me)&&(Me+=32),v(Ue)&&(Ue+=32);var je=Me-Ue;if(je===0)continue;return S(Me)&&S(Ue)?je:s(ie.toLowerCase(),ae.toLowerCase())}return ie.length<ae.length?-1:ie.length>ae.length?1:0}function S(ie){return ie>=97&&ie<=122}function v(ie){return ie>=65&&ie<=90}function y(ie){return S(ie)||v(ie)}function R(ie,ae){return ie.length===ae.length&&_(ie,ae)}function _(ie,ae,me){me===void 0&&(me=ie.length);for(var _e=0;_e<me;_e++){var Me=ie.charCodeAt(_e),Ue=ae.charCodeAt(_e);if(Me===Ue)continue;if(y(Me)&&y(Ue)){var je=Math.abs(Me-Ue);if(je!==0&&je!==32)return!1}else if(String.fromCharCode(Me).toLowerCase()!==String.fromCharCode(Ue).toLowerCase())return!1}return!0}function C(ie,ae){var me=ae.length;return ae.length>ie.length?!1:_(ie,ae,me)}function E(ie,ae){var me,_e=Math.min(ie.length,ae.length);for(me=0;me<_e;me++)if(ie.charCodeAt(me)!==ae.charCodeAt(me))return me;return _e}function c(ie,ae){var me,_e=Math.min(ie.length,ae.length),Me=ie.length-1,Ue=ae.length-1;for(me=0;me<_e;me++)if(ie.charCodeAt(Me-me)!==ae.charCodeAt(Ue-me))return me;return _e}function u(ie){return 55296<=ie&&ie<=56319}function h(ie){return 56320<=ie&&ie<=57343}function T(ie,ae,me){var _e=ie.charCodeAt(me);if(u(_e)&&me+1<ae){var Me=ie.charCodeAt(me+1);if(h(Me))return(_e-55296<<10)+(Me-56320)+65536}return _e}function L(ie,ae){var me=ie.charCodeAt(ae-1);if(h(me)&&ae>1){var _e=ie.charCodeAt(ae-2);if(u(_e))return(_e-55296<<10)+(me-56320)+65536}return me}function I(ie,ae){var me=se.getInstance(),_e=ae,Me=ie.length,Ue=T(ie,Me,ae);ae+=Ue>=65536?2:1;for(var je=me.getGraphemeBreakType(Ue);ae<Me;){var Fe=T(ie,Me,ae),Je=me.getGraphemeBreakType(Fe);if(ce(je,Je))break;ae+=Fe>=65536?2:1,je=Je}return ae-_e}function F(ie,ae){var me=se.getInstance(),_e=ae,Me=L(ie,ae);ae-=Me>=65536?2:1;for(var Ue=me.getGraphemeBreakType(Me);ae>0;){var je=L(ie,ae),Fe=me.getGraphemeBreakType(je);if(ce(Fe,Ue))break;ae-=je>=65536?2:1,Ue=Fe}return _e-ae}var j=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function z(ie){return j.test(ie)}var M=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function N(ie){return M.test(ie)}var Y=/^[\t\n\r\x20-\x7E]*$/;function ee(ie){return Y.test(ie)}function le(ie){for(var ae=0,me=ie.length;ae<me;ae++)if(pe(ie.charCodeAt(ae)))return!0;return!1}function pe(ie){return ie=+ie,ie>=11904&&ie<=55215||ie>=63744&&ie<=64255||ie>=65281&&ie<=65374}function Oe(ie){return ie>=127462&&ie<=127487||ie>=9728&&ie<=10175||ie>=127744&&ie<=128591||ie>=128640&&ie<=128764||ie>=128992&&ie<=129003||ie>=129280&&ie<=129535||ie>=129648&&ie<=129651||ie>=129656&&ie<=129666||ie>=129680&&ie<=129685}var Te=String.fromCharCode(65279);function Re(ie){return!!(ie&&ie.length>0&&ie.charCodeAt(0)===65279)}function Ae(ie){return btoa(encodeURIComponent(ie))}function we(ie,ae){for(var me="",_e=0;_e<ae;_e++)me+=ie;return me}function ge(ie,ae){return ae===void 0&&(ae=!1),ie?(ae&&(ie=ie.replace(/\\./g,"")),ie.toLowerCase()!==ie):!1}function de(ie){var ae=90-65+1;return ie=ie%(2*ae),ie<ae?String.fromCharCode(97+ie):String.fromCharCode(65+ie-ae)}function re(ie){var ae=se.getInstance();return ae.getGraphemeBreakType(ie)}function ce(ie,ae){return ie===0?ae!==5&&ae!==7:ie===2&&ae===3?!1:ie===4||ie===2||ie===3||(ae===4||ae===2||ae===3)?!0:ie===8&&(ae===8||ae===9||ae===11||ae===12)||((ie===11||ie===9)&&(ae===9||ae===10)||((ie===12||ie===10)&&ae===10||(ae===5||ae===13||(ae===7||(ie===1||ie===13&&ae===14)))))?!1:!(ie===6&&ae===6)}var se=function(){function ie(){this._data=ke()}return ie.getInstance=function(){return ie._INSTANCE||(ie._INSTANCE=new ie),ie._INSTANCE},ie.prototype.getGraphemeBreakType=function(ae){if(ae<32)return ae===10?3:ae===13?2:4;if(ae<127)return 0;for(var me=this._data,_e=me.length/3,Me=1;Me<=_e;)if(ae<me[3*Me])Me=2*Me;else if(ae>me[3*Me+1])Me=2*Me+1;else return me[3*Me+2];return 0},ie._INSTANCE=null,ie}();function ke(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},Ot1p:function(bt,Se,Q){"use strict";var ue=Q("2qtc"),J=Q("kLXV"),k=Q("rAM+"),X=Q("miYZ"),U=Q("tsqr"),P=Q("9og8"),W=Q("tJVT"),B=Q("jrin"),O=Q("WmNS"),A=Q.n(O),d=Q("q1tI"),p=Q.n(d),w=Q("VrN/"),m=Q.n(w),g=Q("bdgK"),b=Q("p77/"),a=Q("Bd2K"),i=Q("ELLl"),s=Q("19Vz"),l=Q("lZu9"),S=Q("+NIl"),v=Q("kSUc"),y=Q("9Bee"),R=function(Le){var Ke=Le.value,at=Ke===void 0?"":Ke,mt=Le.className,pt=Le.showTextOnly,Mt=Le.showLines,Pt=Le.style,yt=Pt===void 0?{}:Pt,Ht=Object(d.useMemo)(function(){return""},[at]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ht}}))},_=Q("0Owb"),C=Q("dejd"),E=Q("C+DQ"),c=Q("1vsH"),u=Q("m3rI"),h=[{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 T(Le){var Ke=Le.onActionCallback,at=Le.title,mt=Le.icon,pt=Le.actionName,Mt=Le.className,Pt=Mt===void 0?"":Mt,yt=Le.children;function Ht(){Ke(pt)}return p.a.createElement("a",{title:at,className:Pt,onClick:Ht},p.a.createElement("i",{className:"md-iconfont ".concat(mt)}),yt)}var L=function(Le){var Ke=Le.watch,at=Le.showNullButton,mt=Le.onActionCallback,pt=Le.fullScreen,Mt=Le.insertTemp,Pt=Le.hidetoolBar,yt=Le.uuid,Ht=Le.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(c.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.D)("_educoder_session"),"&key=").concat(yt,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Jt=[].concat(h,[{title:"".concat(Ke?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ke?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Pt&&Jt.map(function(ut,Zt){return p.a.createElement("li",{key:Zt},ut.actionName?p.a.createElement(T,Object(_.a)({},ut,{onActionCallback:mt})):p.a.createElement("span",{className:"v-line"}))}),at?p.a.createElement("li",null,p.a.createElement(T,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:mt},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Mt&&p.a.createElement("li",null,p.a.createElement(T,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Mt),onActionCallback:mt},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(T,{icon:"".concat(pt?"icon-shrink":"icon-enlarge"),title:pt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:mt})))},I=Q("M8RZ"),F=Q("+L6B"),j=Q("2/Rp"),z=Q("y8nQ"),M=Q("Vl3Y"),N=Q("5NDa"),Y=Q("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},le=function(Le){var Ke=Le.callback,at=Le.onCancel;function mt(pt){Ke(pt)}return p.a.createElement(M.a,Object(_.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:mt}),p.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(Y.a,null)),p.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(Y.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},pe=Q("7ahc"),Oe=Q("k1fw"),Te=Q("HmJG"),Re=Q("BjJ7"),Ae=M.a.useForm,we={width:280,marginRight:10},ge={labelCol:{span:5},wrapperCol:{span:19}},de=function(Le){var Ke=Le.callback,at=Le.onCancel,mt=Ae(),pt=Object(W.a)(mt,1),Mt=pt[0],Pt=Object(d.useRef)();function yt(ut){Ke(Object(Oe.a)(Object(Oe.a)({},ut),{},{name:Pt.current}))}function Ht(ut,Zt){Mt.setFieldsValue({src:"/api/attachments/".concat(ut.id,"?type=").concat(ut.content_type),type:Zt.type})}function Jt(ut){var Zt=ut.target.files[0];Pt.current=Zt.name,ce(Zt,Ht)}return p.a.createElement(M.a,Object(_.a)({form:Mt},ge,{className:"upload-image-panel",onFinish:yt}),p.a.createElement(M.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},p.a.createElement(Y.a,{style:we})),p.a.createElement(re,{onFileChange:Jt}))),p.a.createElement(M.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},p.a.createElement(Y.a,{style:{width:264}})),p.a.createElement(M.a.Item,{style:{textAlign:"right"}},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function re(Le){var Ke=Le.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Ke}))}function ce(Le,Ke){if(!Le)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Le),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var mt=new window.XMLHttpRequest;mt.withCredentials=!0,mt.addEventListener("load",function(pt){Ke(JSON.parse(pt.target.responseText),Le)},!1),mt.addEventListener("error",function(pt){console.error(pt)},!1),mt.open("POST","".concat(Re.a,"/api/attachments.json")),mt.send(at)}var se=Q("giR+"),ke=Q("fyUT"),ie=Q("7Kak"),ae=Q("9yH6"),me=ae.a.Group,_e={margin:"0 8px"},Me=function(Le){var Ke=Le.callback,at=Le.onCancel;function mt(pt){Ke(pt)}return p.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:mt},p.a.createElement("div",{className:"flex-container"},p.a.createElement("span",{style:_e},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:_e},"\u884C\u6570"),p.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(ke.a,null)),p.a.createElement("span",{style:_e},"\u5217\u6570"),p.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(ke.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12}},p.a.createElement("span",{style:_e},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(M.a.Item,{name:"align"},p.a.createElement(me,null,p.a.createElement(ae.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(ae.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(ae.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(ae.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},Ue=Q("ErOA"),je=Q("7Cbv"),Fe="link",Je="upload-image",$e="code-block",Qe="add-table",Xe="------------",dt={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},tt=Q("9VGf"),lt,Ie;function et(){}var it=0,Be=1e4,ze="\u2581",Ce=`
**\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 ye(Le){return/^\d+$/.test(Le)?"".concat(Le,"px"):Le}var xe=navigator.platform.toUpperCase().indexOf("MAC")>=0,ne=xe?"Cmd":"Ctrl",oe=["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"],he=(lt={},Object(B.a)(lt,ne+"-B","bold"),Object(B.a)(lt,ne+"-I","italic"),lt),ve=(Ie={},Object(B.a)(Ie,Fe,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(Ie,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(Ie,Je,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(Ie,Qe,"\u6DFB\u52A0\u8868\u683C"),Ie),Ne=Se.a=function(Le){var Ke=Le.defaultValue,at=Ke===void 0?"":Ke,mt=Le.onChange,pt=Le.width,Mt=pt===void 0?"100%":pt,Pt=Le.height,yt=Pt===void 0?400:Pt,Ht=Le.miniToolbar,Jt=Ht===void 0?!1:Ht,ut=Le.isFocus,Zt=ut===void 0?!1:ut,Bt=Le.watch,_r=Le.insertTemp,Ze=Le.mode,gt=Ze===void 0?"markdown":Ze,Ct=Le.id,ht=Ct===void 0?"markdown-editor-id":Ct,At=Le.showResizeBar,rr=At===void 0?!1:At,hr=Le.noStorage,cr=hr===void 0?!1:hr,Ut=Le.showNullButton,xt=Ut===void 0?!1:Ut,Mr=Le.hidetoolBar,rn=Mr===void 0?!1:Mr,Ar=Le.fullScreen,Ft=Ar===void 0?!1:Ar,Ir=Le.onBlur,Tr=Le.onCMBeforeChange,nn=Le.onFullScreen,He=Le.className,ft=He===void 0?"":He,Wt=Le.disablePaste,qt=Wt===void 0?!1:Wt,nr=Le.placeholder,ir=nr===void 0?"":nr,K=Le.values,f=K===void 0?"":K,x=Object(d.useState)(null),G=Object(W.a)(x,2),$=G[0],V=G[1],be=Object(d.useState)(at),Ge=Object(W.a)(be,2),nt=Ge[0],Et=Ge[1],Ve=Object(d.useState)(Bt),kt=Object(W.a)(Ve,2),Kt=kt[0],sr=kt[1],jr=Object(d.useState)(Ft),Gr=Object(W.a)(jr,2),gr=Gr[0],zr=Gr[1],an=Object(d.useState)(""),br=Object(W.a)(an,2),Lr=br[0],Er=br[1],gn=Object(d.useState)(0),Kr=Object(W.a)(gn,2),cn=Kr[0],on=Kr[1],In=Object(d.useState)(yt),vn=Object(W.a)(In,2),qe=vn[0],It=vn[1],Vt=Object(d.useState)(!1),ct=Object(W.a)(Vt,2),$t=ct[0],Lt=ct[1],Tt=Object(d.useRef)(Object(je.a)()),wt=Object(d.useRef)(!1),jt=Object(d.useRef)(),er=Object(d.useRef)(),Gt=Object(d.useRef)(),yn=Object(d.useRef)(),vr=Object(d.useRef)(),Vr=function(){var _t=Object(P.a)(A.a.mark(function Nt(){var Dt,Xt;return A.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return lr.next=2,Object(Ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Tt.current}});case 2:Xt=lr.sent,Xt!=null&&(Dt=Xt.attachments)!==null&&Dt!==void 0&&Dt.length&&(console.log("cm:",$,er),Xt.attachments.map(function(Qt){Qt.content_type.indexOf("image")>-1?$.replaceSelection("![,](/api/attachments/".concat(Qt.id,"?type=").concat(Qt.content_type,")")):Qt.content_type.indexOf("video")>-1?$.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Qt.content_type.indexOf("pdf")>-1?$.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Qt.content_type,'&disposition=inline" target="_blank">').concat(Qt.name,"</a>")):$.replaceSelection("[".concat(Qt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Qt.content_type,")"))}));case 4:case"end":return lr.stop()}},Nt)}));return function(){return _t.apply(this,arguments)}}();Object(d.useEffect)(function(){Et(f),$==null||$.setValue(f)},[f]),Object(d.useEffect)(function(){nn==null||nn(gr)},[gr]),Object(d.useEffect)(function(){if(er.current){var _t=m.a.fromTextArea(er.current,{mode:gt,lineNumbers:!Jt,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Zt&&_t.focus();function Nt(Dt,Xt){if(qt){Xt.preventDefault();return}var tr=Xt.clipboardData;if(tr){var lr=tr.types.toString(),Qt=tr.items;if(lr==="Files"||tr.types.indexOf("Files")>-1){if(Xt.preventDefault(),gt=="stex")return;try{var xr,Xr=Qt[1];((xr=Qt[0])===null||xr===void 0?void 0:xr.kind)==="file"&&(Xr=Qt[0]);var Yt=Xr.getAsFile(),_n=Yt.name.split(".").pop();ce(Yt,function(ar){if(ar.id){var Rr,un,dn;(Yt==null||((Rr=Yt.type)===null||Rr===void 0)?void 0:Rr.indexOf("image"))>-1?_t.replaceSelection("![,](/api/attachments/".concat(ar.id,"?type=").concat(ar.content_type,")")):(Yt==null||((un=Yt.type)===null||un===void 0)?void 0:un.indexOf("video"))>-1?_t.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,'"></video>')):(Yt==null||((dn=Yt.type)===null||dn===void 0)?void 0:dn.indexOf("pdf"))>-1?_t.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(Yt.type,'&disposition=inline" target="_blank">').concat(Yt.name,"</a>")):oe.includes(_n)?_t.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,'?type=office&disposition=inline" target="_blank">').concat(Yt.name,"</a>")):_t.replaceSelection("[".concat(Yt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(ar.content_type,")"))}else(ar==null?void 0:ar.status)===401&&(document.location.href="/user/login")})}catch(ar){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return _t.on("paste",Nt),_t.on("dragleave",function(Dt,Xt){Gt.current.classList.remove("mouse-hover-md")}),_t.on("dragover",function(Dt,Xt){Gt.current.classList.add("mouse-hover-md")}),_t.on("drop",function(Dt,Xt){Gt.current.classList.add("mouse-hover-md");var tr;if(tr=Xt.dataTransfer.files,tr.length>0){Xt.preventDefault(),Xt.stopPropagation();for(var lr=function(Xr){var Yt=tr[Xr],_n=Yt.name.split(".").pop();ce(Yt,function(ar){if(ar.id){var Rr,un,dn;(Yt==null||((Rr=Yt.type)===null||Rr===void 0)?void 0:Rr.indexOf("image"))>-1?_t.replaceSelection("![,](/api/attachments/".concat(ar.id,"?type=").concat(ar.content_type,")")):(Yt==null||((un=Yt.type)===null||un===void 0)?void 0:un.indexOf("video"))>-1?_t.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,'"></video>')):(Yt==null||((dn=Yt.type)===null||dn===void 0)?void 0:dn.indexOf("pdf"))>-1?_t.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(Yt.type,'&disposition=inline" target="_blank">').concat(Yt.name,"</a>")):oe.includes(_n)?_t.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,'?type=office&disposition=inline" target="_blank">').concat(Yt.name,"</a>")):_t.replaceSelection("[".concat(Yt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(ar.content_type,")"))}else(ar==null?void 0:ar.status)===401&&(document.location.href="/user/login")})},Qt=0;Qt<tr.length;Qt++)lr(Qt)}}),V(_t),function(){_t.off("paste",Nt)}}},[]);var Xn=Object(d.useCallback)(function(){if(Gt.current)try{}catch(_t){console.log(_t,"---- to set md editor body height")}},[qe,Gt,gr]);Object(d.useEffect)(function(){function _t(){var Dt=new g.default(function(Xt){var tr=Object(k.a)(Xt),lr;try{for(tr.s();!(lr=tr.n()).done;){var Qt=lr.value;(Qt.target.offsetHeight>0||Qt.target.offsetWidth>0)&&(Xn(),$.setSize("100%","100%"),$.refresh())}}catch(xr){tr.e(xr)}finally{tr.f()}});return Dt.observe(er.current.parentElement),Dt}if($){var Nt=_t();return function(){Nt.unobserve(er.current.parentElement)}}},[$,Xn]),Object(d.useEffect)(function(){if($){for(var _t=[],Nt=function(){var Qt=Xt[Dt];tr=Object(W.a)(Qt,2);var xr=tr[0],Xr=tr[1],Yt=Object(B.a)({},xr,function(){Yn(Xr)});_t.push(Yt),$.addKeyMap(Yt)},Dt=0,Xt=Object.entries(he);Dt<Xt.length;Dt++){var tr;Nt()}return jt.current=setInterval(function(){wt.current&&Vr()},4e3),function(){clearInterval(jt.current);var lr=Object(k.a)(_t),Qt;try{for(lr.s();!(Qt=lr.n()).done;){var xr=Qt.value;$.removeKeyMap(xr)}}catch(Xr){lr.e(Xr)}finally{lr.f()}}}},[$]),Object(d.useEffect)(function(){Ft!==gr&&zr(Ft)},[Ft]),Object(tt.a)(function(){if(!cr&&cn>0){var _t=new Date().getTime(),Nt=window.sessionStorage.getItem(ht);_t>=cn+Be&&(!Nt||Nt!==nt)&&(window.sessionStorage.setItem(ht,nt),Lt(!0))}},Be),Object(d.useEffect)(function(){sr(Bt)},[$,Bt]),Object(d.useEffect)(function(){$&&(Zt&&$.focus())},[$,Zt]),Object(d.useEffect)(function(){if(Kt&&$){var _t=$.getScrollerElement();function Nt(Dt){var Xt=Dt.target;if(vr.current){var tr=Xt.scrollTop/Xt.scrollHeight;vr.current.scrollTop=vr.current.scrollHeight*tr}}return _t.addEventListener("scroll",Nt),function(){_t.removeEventListener("scroll",Nt)}}},[$,Kt]),Object(d.useEffect)(function(){if($&&Tr){function _t(Nt,Dt){Tr(Nt,Dt)}return $.on("beforeChange",_t),function(){$.off("beforeChange",_t)}}},[$,Tr]),Object(d.useEffect)(function(){if($&&Ir){function _t(){Ir($.getValue())}return $.on("blur",_t),function(){$.off("blur",_t)}}},[$,Ir]),Object(d.useEffect)(function(){if($){function _t(Nt){var Dt=Nt.getValue();Et(Dt),on(new Date().getTime()),Nt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),mt&&mt(Dt)}return $.on("change",_t),function(){$.off("change",_t)}}},[$,mt]),Object(d.useEffect)(function(){$&&(at==null?($.setValue(""),Et("")):at!==$.getValue()&&($.setValue(at),Et(at),$.setCursor($.lineCount(),0)))},[$,at]);var Yn=Object(d.useCallback)(function(_t){var Nt=$.getCursor(),Dt=$.getSelection(),Xt=Dt.split(`
`);switch(_t){case"bold":return $.replaceSelection("**"+Dt+"**"),Dt===""&&$.setCursor(Nt.line,Nt.ch+2),$.focus();case"italic":return $.replaceSelection("*"+Dt+"*"),Dt===""&&$.setCursor(Nt.line,Nt.ch+1),$.focus();case"code":return $.replaceSelection("`"+Dt+"`"),Dt===""&&$.setCursor(Nt.line,Nt.ch+1),$.focus();case"inline-latex":return $.replaceSelection("`$$"+Dt+"$$`"),Dt===""&&$.setCursor(Nt.line,Nt.ch+3),$.focus();case"latex":return $.replaceSelection("```latex\n"+Dt+"\n```"),$.setCursor(Nt.line+1,Dt.length+1),$.focus();case"line-break":return $.replaceSelection(`<br/>
`),$.focus();case"list-ul":return Dt===""?$.replaceSelection("- "+Dt):$.replaceSelection(Xt.map(function(tr){return tr===""?"":"- ".concat(tr)}).join(`
`)),$.focus();case"list-ol":return Dt===""?$.replaceSelection("1. "+Dt):$.replaceSelection(Xt.map(function(tr,lr){return tr===""?"":"".concat(lr+1,". ").concat(tr)}).join(`
`)),$.focus();case"add-null-ch":return Dt===""&&$.setCursor(Nt.line,Nt.ch+1),$.replaceSelection(ze),$.focus();case"inster-template-1":return Dt===""&&$.setCursor(Nt.line,Nt.ch),$.replaceSelection(Ce),$.focus();case"eraser":return $.setValue(""),$.focus();case"trigger-watch":return sr(!Kt),$.focus();case"trigger-full-screen":return zr(!gr),$.focus();case Fe:Er(Fe);return;case $e:Er($e);return;case Je:Er(Je);return;case Qe:Er(Qe);return;default:throw new Error}},[$,Kt,gr]),wn=Object(d.useCallback)(function(_t){Er("");switch(Lr){case Fe:var Nt=_t.title,Dt=_t.link;return $.replaceSelection("[".concat(Nt,"](").concat(Dt,")")),$.focus();case $e:var Xt=_t.language,tr=_t.content;return $.replaceSelection(["```"+Xt,tr,"```"].join(`
`)),$.focus();case Je:var lr=_t.src,Qt=_t.alt,xr=_t.name;return lr.indexOf("type=image")>-1?$.replaceSelection("![ ".concat(Qt||""," ]( ").concat(lr,' "').concat(Qt||"",'" )')):lr.indexOf("type=application/pdf")>-1?$.replaceSelection('<a href="'.concat(lr,'&disposition=inline" target="_blank">').concat(xr,"</a>")):$.replaceSelection('<a href="'.concat(lr,'" target="_blank">').concat(xr,"</a>")),$.focus();case Qe:for(var Xr=_t.row,Yt=_t.col,_n=_t.align,ar=`
`,Rr=0;Rr<Xr;Rr++){for(var un=[],dn=[],Wi=0;Wi<Yt;Wi++)Rr===1&&dn.push(dt[_n]),un.push(" ");Rr===1&&(ar+="| ".concat(dn.join(" | "),` |
`)),ar+="| ".concat(un.join(Yt===1?"":" | "),` |
`)}return $.replaceSelection(ar+`
`),$.focus();default:throw new Error}},[$,Lr]),Bi=Object(d.useMemo)(function(){switch(Lr){case Fe:return p.a.createElement(le,{callback:wn,onCancel:qr});case $e:return p.a.createElement(pe.b,{callback:wn,onCancel:qr});case Je:return p.a.createElement(de,{callback:wn,onCancel:qr});case Qe:return p.a.createElement(Me,{callback:wn,onCancel:qr});default:return null}},[Lr]);function qr(){Er("")}Object(d.useEffect)(function(){if(yn.current){var _t=yn.current,Nt=!1,Dt=0;function Xt(Qt){Nt=!0,Dt=Qt.pageY}function tr(){Nt=!1}function lr(Qt){if(Nt){var xr=Qt.pageY-Dt;xr<0&&(xr=0),xr>300&&(xr=300);var Xr=yt+xr+"px";It(Xr)}}return _t.addEventListener("mousedown",Xt),document.addEventListener("mousemove",lr),document.addEventListener("mouseup",tr),function(){_t.removeEventListener("mousedown",Xt),document.removeEventListener("mousemove",lr),document.removeEventListener("mouseup",tr)}}},[$,yn]),Object(d.useEffect)(function(){It(yt)},[yt]);var fi=ye(Mt),hn=ye(qe),$n={width:fi,height:hn},ji=Object(d.useMemo)(function(){if(cn){var _t=new Date(cn),Nt=_t.getHours(),Dt=_t.getMinutes(),Xt=_t.getSeconds();return Nt=Nt<10?"0"+Nt:Nt,Dt=Dt<10?"0"+Dt:Dt,Xt=Xt<10?"0"+Xt:Xt,"".concat(Nt,":").concat(Dt,":").concat(Xt)}return 0},[cn]);function Nn(){window.sessionStorage.removeItem(ht),Lt(!1),on(0)}function $a(){Lt(!1),on(0),$.setValue(window.sessionStorage.getItem(ht))}function da(_t,Nt){var Dt=$.getValue();Dt=Dt.replace(_t,Nt),Et(Dt),$==null||$.setValue(Dt)}return p.a.createElement(d.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Gt},p.a.createElement("div",{className:"markdown-editor-container ".concat(ft," ").concat(Kt?"on-preview":""," ").concat(Jt?"mini":""," ").concat(gr?"full-screen":""),style:$n},p.a.createElement(L,{insertTemp:_r,watch:Kt,fullScreen:gr,showNullButton:xt,onActionCallback:Yn,hidetoolBar:rn,uuid:Tt.current,setOpenPhones:function(){wt.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:er,placeholder:ir})),Kt?p.a.createElement("div",{ref:vr,className:"preview-container"},gt==="stex"&&p.a.createElement(R,{value:nt}),gt!=="stex"&&p.a.createElement(y.a,{edit:!0,value:nt,replaces:da})):null))),rr?p.a.createElement("a",{ref:yn,className:"editor-resize"}):null,p.a.createElement(I.a,null,ve[Lr]?p.a.createElement(J.a,{centered:!0,title:ve[Lr],visible:!0,onCancel:qr,footer:null},Bi):null))}},QDVR:function(bt,Se,Q){"use strict";Q.d(Se,"e",function(){return J}),Q.d(Se,"d",function(){return k}),Q.d(Se,"c",function(){return W}),Q.d(Se,"b",function(){return B}),Q.d(Se,"a",function(){return A});var ue=function(){var d=function(p,w){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,g){m.__proto__=g}||function(m,g){for(var b in g)g.hasOwnProperty(b)&&(m[b]=g[b])},d(p,w)};return function(p,w){d(p,w);function m(){this.constructor=p}p.prototype=w===null?Object.create(w):(m.prototype=w.prototype,new m)}}();function J(d){var p=[];return d.forEach(function(w){return p.push(w)}),p}function k(d){var p=[];return d.forEach(function(w,m){return p.push(m)}),p}var X=function(){function d(){this._value="",this._pos=0}return d.prototype.reset=function(p){return this._value=p,this._pos=0,this},d.prototype.next=function(){return this._pos+=1,this},d.prototype.hasNext=function(){return this._pos<this._value.length-1},d.prototype.cmp=function(p){var w=p.charCodeAt(0),m=this._value.charCodeAt(this._pos);return w-m},d.prototype.value=function(){return this._value[this._pos]},d}(),U=function(){function d(p){p===void 0&&(p=!0),this._splitOnBackslash=p}return d.prototype.reset=function(p){return this._value=p.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},d.prototype.hasNext=function(){return this._to<this._value.length},d.prototype.next=function(){this._from=this._to;for(var p=!0;this._to<this._value.length;this._to++){var w=this._value.charCodeAt(this._to);if(w===47||this._splitOnBackslash&&w===92)if(p)this._from++;else break;else p=!1}return this},d.prototype.cmp=function(p){for(var w=0,m=p.length,g=this._from;w<m&&g<this._to;){var b=p.charCodeAt(w)-this._value.charCodeAt(g);if(b!==0)return b;w+=1,g+=1}return m===this._to-this._from?0:w<m?-1:1},d.prototype.value=function(){return this._value.substring(this._from,this._to)},d}(),P=function(){function d(){}return d}(),W=function(){function d(p){this._iter=p}return d.forPaths=function(){return new d(new U)},d.forStrings=function(){return new d(new X)},d.prototype.clear=function(){this._root=void 0},d.prototype.set=function(p,w){var m=this._iter.reset(p),g;for(this._root||(this._root=new P,this._root.segment=m.value()),g=this._root;;){var b=m.cmp(g.segment);if(b>0)g.left||(g.left=new P,g.left.segment=m.value()),g=g.left;else if(b<0)g.right||(g.right=new P,g.right.segment=m.value()),g=g.right;else if(m.hasNext())m.next(),g.mid||(g.mid=new P,g.mid.segment=m.value()),g=g.mid;else break}var a=g.value;return g.value=w,g.key=p,a},d.prototype.get=function(p){for(var w=this._iter.reset(p),m=this._root;m;){var g=w.cmp(m.segment);if(g>0)m=m.left;else if(g<0)m=m.right;else if(w.hasNext())w.next(),m=m.mid;else break}return m?m.value:void 0},d.prototype.findSubstr=function(p){for(var w=this._iter.reset(p),m=this._root,g=void 0;m;){var b=w.cmp(m.segment);if(b>0)m=m.left;else if(b<0)m=m.right;else if(w.hasNext())w.next(),g=m.value||g,m=m.mid;else break}return m&&m.value||g},d.prototype.forEach=function(p){this._forEach(this._root,p)},d.prototype._forEach=function(p,w){p&&(this._forEach(p.left,w),p.value&&w(p.value,p.key),this._forEach(p.mid,w),this._forEach(p.right,w))},d}(),B=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(p,w){this.map.set(this.toKey(p),w)},d.prototype.get=function(p){return this.map.get(this.toKey(p))},d.prototype.toKey=function(p){var w=p.toString();return this.ignoreCase&&(w=w.toLowerCase()),w},d}(),O=function(){function d(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return d.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(d.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),d.prototype.get=function(p,w){w===void 0&&(w=0);var m=this._map.get(p);return m?(w!==0&&this.touch(m,w),m.value):void 0},d.prototype.set=function(p,w,m){m===void 0&&(m=0);var g=this._map.get(p);if(g)g.value=w,m!==0&&this.touch(g,m);else{g={key:p,value:w,next:void 0,previous:void 0};switch(m){case 0:this.addItemLast(g);break;case 1:this.addItemFirst(g);break;case 2:this.addItemLast(g);break;default:this.addItemLast(g);break}this._map.set(p,g),this._size++}},d.prototype.delete=function(p){return!!this.remove(p)},d.prototype.remove=function(p){var w=this._map.get(p);return w?(this._map.delete(p),this.removeItem(w),this._size--,w.value):void 0},d.prototype.forEach=function(p,w){for(var m=this._head;m;)w?p.bind(w)(m.value,m.key,this):p(m.value,m.key,this),m=m.next},d.prototype.trimOld=function(p){if(p>=this.size)return;if(p===0){this.clear();return}for(var w=this._head,m=this.size;w&&m>p;)this._map.delete(w.key),w=w.next,m--;this._head=w,this._size=m,w&&(w.previous=void 0)},d.prototype.addItemFirst=function(p){if(!this._head&&!this._tail)this._tail=p;else if(this._head)p.next=this._head,this._head.previous=p;else throw new Error("Invalid list");this._head=p},d.prototype.addItemLast=function(p){if(!this._head&&!this._tail)this._head=p;else if(this._tail)p.previous=this._tail,this._tail.next=p;else throw new Error("Invalid list");this._tail=p},d.prototype.removeItem=function(p){if(p===this._head&&p===this._tail)this._head=void 0,this._tail=void 0;else if(p===this._head){if(!p.next)throw new Error("Invalid list");p.next.previous=void 0,this._head=p.next}else if(p===this._tail){if(!p.previous)throw new Error("Invalid list");p.previous.next=void 0,this._tail=p.previous}else{var w=p.next,m=p.previous;if(!w||!m)throw new Error("Invalid list");w.previous=m,m.next=w}p.next=void 0,p.previous=void 0},d.prototype.touch=function(p,w){if(!this._head||!this._tail)throw new Error("Invalid list");if(w!==1&&w!==2)return;if(w===1){if(p===this._head)return;var m=p.next,g=p.previous;p===this._tail?(g.next=void 0,this._tail=g):(m.previous=g,g.next=m),p.previous=void 0,p.next=this._head,this._head.previous=p,this._head=p}else if(w===2){if(p===this._tail)return;var m=p.next,g=p.previous;p===this._head?(m.previous=void 0,this._head=m):(m.previous=g,g.next=m),p.next=void 0,p.previous=this._tail,this._tail.next=p,this._tail=p}},d.prototype.toJSON=function(){var p=[];return this.forEach(function(w,m){p.push([m,w])}),p},d}(),A=function(d){ue(p,d);function p(w,m){m===void 0&&(m=1);var g=d.call(this)||this;return g._limit=w,g._ratio=Math.min(Math.max(0,m),1),g}return p.prototype.get=function(w){return d.prototype.get.call(this,w,2)},p.prototype.peek=function(w){return d.prototype.get.call(this,w,0)},p.prototype.set=function(w,m){d.prototype.set.call(this,w,m,2),this.checkTrim()},p.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},p}(O)},SJMd:function(bt,Se){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var Q,ue,J,k=!1,X,U;window.PR_SHOULD_USE_CONTINUATION=!0;var P,W;(function(){var B=window,O=["break,continue,do,else,for,if,return,while"],A=[O,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],d=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[d,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],w=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],m=[d,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],g="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",b=[d,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",i=[O,"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=[O,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[p,m,w,b,a,i,s,l],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,y="str",R="kwd",_="com",C="typ",E="lit",c="pun",u="pln",h="tag",T="dec",L="src",I="atn",F="atv",j="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(ae){for(var me=0,_e=!1,Me=!1,Ue=0,je=ae.length;Ue<je;++Ue){var Fe=ae[Ue];if(Fe.ignoreCase)Me=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){_e=!0,Me=!1;break}}var Je={b:8,t:9,n:10,v:11,f:12,r:13};function $e(lt){var Ie=lt.charCodeAt(0);if(Ie!==92)return Ie;var et=lt.charAt(1);return Ie=Je[et],Ie||("0"<=et&&et<="7"?parseInt(lt.substring(1),8):et==="u"||et==="x"?parseInt(lt.substring(2),16):lt.charCodeAt(1))}function Qe(lt){if(lt<32)return(lt<16?"\\x0":"\\x")+lt.toString(16);var Ie=String.fromCharCode(lt);return Ie==="\\"||Ie==="-"||Ie==="]"||Ie==="^"?"\\"+Ie:Ie}function Xe(lt){var Ie=lt.substring(1,lt.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")),et=[],it=Ie[0]==="^",Be=["["];it&&Be.push("^");for(var ze=it?1:0,Ce=Ie.length;ze<Ce;++ze){var ye=Ie[ze];if(/\\[bdsw]/i.test(ye))Be.push(ye);else{var xe=$e(ye),ne;ze+2<Ce&&Ie[ze+1]==="-"?(ne=$e(Ie[ze+2]),ze+=2):ne=xe,et.push([xe,ne]),ne<65||xe>122||(ne<65||xe>90||et.push([Math.max(65,xe)|32,Math.min(ne,90)|32]),ne<97||xe>122||et.push([Math.max(97,xe)&~32,Math.min(ne,122)&~32]))}}et.sort(function(Ne,Le){return Ne[0]-Le[0]||Le[1]-Ne[1]});for(var oe=[],he=[],ze=0;ze<et.length;++ze){var ve=et[ze];ve[0]<=he[1]+1?he[1]=Math.max(he[1],ve[1]):oe.push(he=ve)}for(var ze=0;ze<oe.length;++ze){var ve=oe[ze];Be.push(Qe(ve[0])),ve[1]>ve[0]&&(ve[1]+1>ve[0]&&Be.push("-"),Be.push(Qe(ve[1])))}return Be.push("]"),Be.join("")}function dt(lt){for(var Ie=lt.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")),et=Ie.length,it=[],Be=0,ze=0;Be<et;++Be){var Ce=Ie[Be];if(Ce==="(")++ze;else if(Ce.charAt(0)==="\\"){var ye=+Ce.substring(1);ye&&(ye<=ze?it[ye]=-1:Ie[Be]=Qe(ye))}}for(var Be=1;Be<it.length;++Be)it[Be]===-1&&(it[Be]=++me);for(var Be=0,ze=0;Be<et;++Be){var Ce=Ie[Be];if(Ce==="(")++ze,it[ze]||(Ie[Be]="(?:");else if(Ce.charAt(0)==="\\"){var ye=+Ce.substring(1);ye&&ye<=ze&&(Ie[Be]="\\"+it[ye])}}for(var Be=0;Be<et;++Be)Ie[Be]==="^"&&Ie[Be+1]!=="^"&&(Ie[Be]="");if(lt.ignoreCase&&_e)for(var Be=0;Be<et;++Be){var Ce=Ie[Be],xe=Ce.charAt(0);Ce.length>=2&&xe==="["?Ie[Be]=Xe(Ce):xe!=="\\"&&(Ie[Be]=Ce.replace(/[a-zA-Z]/g,function(he){var ve=he.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return Ie.join("")}for(var tt=[],Ue=0,je=ae.length;Ue<je;++Ue){var Fe=ae[Ue];if(Fe.global||Fe.multiline)throw new Error(""+Fe);tt.push("(?:"+dt(Fe)+")")}return new RegExp(tt.join("|"),Me?"gi":"g")}function N(ae,me){var _e=/(?:^|\s)nocode(?:\s|$)/,Me=[],Ue=0,je=[],Fe=0;function Je($e){var Qe=$e.nodeType;if(Qe==1){if(_e.test($e.className))return;for(var Xe=$e.firstChild;Xe;Xe=Xe.nextSibling)Je(Xe);var dt=$e.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(Me[Fe]=`
`,je[Fe<<1]=Ue++,je[Fe++<<1|1]=$e)}else if(Qe==3||Qe==4){var tt=$e.nodeValue;tt.length&&(me?tt=tt.replace(/\r\n?/g,`
`):tt=tt.replace(/[ \t\r\n]+/g," "),Me[Fe]=tt,je[Fe<<1]=Ue,Ue+=tt.length,je[Fe++<<1|1]=$e)}}return Je(ae),{sourceCode:Me.join("").replace(/\n$/,""),spans:je}}function Y(ae,me,_e,Me,Ue){if(!_e)return;var je={sourceNode:ae,pre:1,langExtension:null,numberLines:null,sourceCode:_e,spans:null,basePos:me,decorations:null};Me(je),Ue.push.apply(Ue,je.decorations)}var ee=/\S/;function le(ae){for(var me=void 0,_e=ae.firstChild;_e;_e=_e.nextSibling){var Me=_e.nodeType;me=Me===1?me?ae:_e:Me===3&&ee.test(_e.nodeValue)?ae:me}return me===ae?void 0:me}function pe(ae,me){var _e={},Me;(function(){for(var Fe=ae.concat(me),Je=[],$e={},Qe=0,Xe=Fe.length;Qe<Xe;++Qe){var dt=Fe[Qe],tt=dt[3];if(tt)for(var lt=tt.length;--lt>=0;)_e[tt.charAt(lt)]=dt;var Ie=dt[1],et=""+Ie;$e.hasOwnProperty(et)||(Je.push(Ie),$e[et]=null)}Je.push(/[\0-\uffff]/),Me=M(Je)})();var Ue=me.length,je=function(Fe){for(var Je=Fe.sourceCode,$e=Fe.basePos,Qe=Fe.sourceNode,Xe=[$e,u],dt=0,tt=Je.match(Me)||[],lt={},Ie=0,et=tt.length;Ie<et;++Ie){var it=tt[Ie],Be=lt[it],ze=void 0,Ce;if(typeof Be=="string")Ce=!1;else{var ye=_e[it.charAt(0)];if(ye)ze=it.match(ye[1]),Be=ye[0];else{for(var xe=0;xe<Ue;++xe)if(ye=me[xe],ze=it.match(ye[1]),ze){Be=ye[0];break}ze||(Be=u)}Ce=Be.length>=5&&Be.substring(0,5)==="lang-",Ce&&!(ze&&typeof ze[1]=="string")&&(Ce=!1,Be=L),Ce||(lt[it]=Be)}var ne=dt;if(dt+=it.length,!Ce)Xe.push($e+ne,Be);else{var oe=ze[1],he=it.indexOf(oe),ve=he+oe.length;ze[2]&&(ve=it.length-ze[2].length,he=ve-oe.length);var Ne=Be.substring(5);Y(Qe,$e+ne,it.substring(0,he),je,Xe),Y(Qe,$e+ne+he,oe,de(Ne,oe),Xe),Y(Qe,$e+ne+ve,it.substring(ve),je,Xe)}}Fe.decorations=Xe};return je}function Oe(ae){var me=[],_e=[];ae.tripleQuotedStrings?me.push([y,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ae.multiLineStrings?me.push([y,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):me.push([y,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ae.verbatimStrings&&_e.push([y,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Me=ae.hashComments;Me&&(ae.cStyleComments?(Me>1?me.push([_,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):me.push([_,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),_e.push([y,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):me.push([_,/^#[^\r\n]*/,null,"#"])),ae.cStyleComments&&(_e.push([_,/^\/\/[^\r\n]*/,null]),_e.push([_,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ue=ae.regexLiterals;if(Ue){var je=Ue>1?"":`
\r`,Fe=je?".":"[\\S\\s]",Je="/(?=[^/*"+je+"])(?:[^/\\x5B\\x5C"+je+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+je+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";_e.push(["lang-regex",RegExp("^"+z+"("+Je+")")])}var $e=ae.types;$e&&_e.push([C,$e]);var Qe=(""+ae.keywords).replace(/^ | $/g,"");Qe.length&&_e.push([R,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),me.push([u,/^\s+/,null,` \r
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return ae.regexLiterals&&(Xe+="(?!s*/)"),_e.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[C,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[c,new RegExp(Xe),null]),pe(me,_e)}var Te=Oe({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Re(ae,me,_e){for(var Me=/(?:^|\s)nocode(?:\s|$)/,Ue=/\r\n?|\n/,je=ae.ownerDocument,Fe=je.createElement("li");ae.firstChild;)Fe.appendChild(ae.firstChild);var Je=[Fe];function $e(Ie){var et=Ie.nodeType;if(et==1&&!Me.test(Ie.className))if(Ie.nodeName==="br")Qe(Ie),Ie.parentNode&&Ie.parentNode.removeChild(Ie);else for(var it=Ie.firstChild;it;it=it.nextSibling)$e(it);else if((et==3||et==4)&&_e){var Be=Ie.nodeValue,ze=Be.match(Ue);if(ze){var Ce=Be.substring(0,ze.index);Ie.nodeValue=Ce;var ye=Be.substring(ze.index+ze[0].length);if(ye){var xe=Ie.parentNode;xe.insertBefore(je.createTextNode(ye),Ie.nextSibling)}Qe(Ie),Ce||Ie.parentNode.removeChild(Ie)}}}function Qe(Ie){for(;!Ie.nextSibling;)if(Ie=Ie.parentNode,!Ie)return;function et(ze,Ce){var ye=Ce?ze.cloneNode(!1):ze,xe=ze.parentNode;if(xe){var ne=et(xe,1),oe=ze.nextSibling;ne.appendChild(ye);for(var he=oe;he;he=oe)oe=he.nextSibling,ne.appendChild(he)}return ye}for(var it=et(Ie.nextSibling,0),Be;(Be=it.parentNode)&&Be.nodeType===1;)it=Be;Je.push(it)}for(var Xe=0;Xe<Je.length;++Xe)$e(Je[Xe]);me===(me|0)&&Je[0].setAttribute("value",me);var dt=je.createElement("ol");dt.className="linenums";for(var tt=Math.max(0,me-1|0)||0,Xe=0,lt=Je.length;Xe<lt;++Xe)Fe=Je[Xe],Fe.className="L"+(Xe+tt)%10,Fe.firstChild||Fe.appendChild(je.createTextNode("\xA0")),dt.appendChild(Fe);ae.appendChild(dt)}function Ae(ae){var me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);me=me&&+me[1]<=8;var _e=/\n/g,Me=ae.sourceCode,Ue=Me.length,je=0,Fe=ae.spans,Je=Fe.length,$e=0,Qe=ae.decorations,Xe=Qe.length,dt=0;Qe[Xe]=Ue;var tt,lt;for(lt=tt=0;lt<Xe;)Qe[lt]!==Qe[lt+2]?(Qe[tt++]=Qe[lt++],Qe[tt++]=Qe[lt++]):lt+=2;for(Xe=tt,lt=tt=0;lt<Xe;){for(var Ie=Qe[lt],et=Qe[lt+1],it=lt+2;it+2<=Xe&&Qe[it+1]===et;)it+=2;Qe[tt++]=Ie,Qe[tt++]=et,lt=it}Xe=Qe.length=tt;var Be=ae.sourceNode,ze="";Be&&(ze=Be.style.display,Be.style.display="none");try{for(var Ce=null;$e<Je;){var ye=Fe[$e],xe=Fe[$e+2]||Ue,ne=Qe[dt+2]||Ue,it=Math.min(xe,ne),oe=Fe[$e+1],he;if(oe.nodeType!==1&&(he=Me.substring(je,it))){me&&(he=he.replace(_e,"\r")),oe.nodeValue=he;var ve=oe.ownerDocument,Ne=ve.createElement("span");Ne.className=Qe[dt+1];var Le=oe.parentNode;Le.replaceChild(Ne,oe),Ne.appendChild(oe),je<xe&&(Fe[$e+1]=oe=ve.createTextNode(Me.substring(it,xe)),Le.insertBefore(oe,Ne.nextSibling))}je=it,je>=xe&&($e+=2),je>=ne&&(dt+=2)}}finally{Be&&(Be.style.display=ze)}}var we={};function ge(ae,me){for(var _e=me.length;--_e>=0;){var Me=me[_e];we.hasOwnProperty(Me)?B.console&&console.warn("cannot override language handler %s",Me):we[Me]=ae}}function de(ae,me){return ae&&we.hasOwnProperty(ae)||(ae=/^\s*</.test(me)?"default-markup":"default-code"),we[ae]}ge(Te,["default-code"]),ge(pe([],[[u,/^[^<?]+/],[T,/^<!\w[^>]*(?:>|$)/],[_,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[c,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ge(pe([[u,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[h,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[c,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ge(pe([],[[F,/^[\s\S]+/]]),["uq.val"]),ge(Oe({keywords:p,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ge(Oe({keywords:"null,true,false"}),["json"]),ge(Oe({keywords:m,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ge(Oe({keywords:w,cStyleComments:!0}),["java"]),ge(Oe({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(Oe({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(Oe({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(Oe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(Oe({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(Oe({keywords:g,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(pe([],[[y,/^[\s\S]+/]]),["regex"]);function re(ae){var me=ae.langExtension;try{var _e=N(ae.sourceNode,ae.pre),Me=_e.sourceCode;ae.sourceCode=Me,ae.spans=_e.spans,ae.basePos=0,de(me,Me)(ae),Ae(ae)}catch(Ue){B.console&&console.log(Ue&&Ue.stack||Ue)}}function ce(ae,me,_e){var Me=_e||!1,Ue=me||null,je=document.createElement("div");je.innerHTML="<pre>"+ae+"</pre>",je=je.firstChild,Me&&Re(je,Me,!0);var Fe={langExtension:Ue,numberLines:Me,sourceNode:je,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return re(Fe),je.innerHTML}function se(ae,me){var _e=me||document.body,Me=_e.ownerDocument||document;function Ue(ye){return _e.getElementsByTagName(ye)}for(var je=[Ue("pre"),Ue("code"),Ue("xmp")],Fe=[],Je=0;Je<je.length;++Je)for(var $e=0,Qe=je[Je].length;$e<Qe;++$e)Fe.push(je[Je][$e]);je=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var dt=0,tt=/\blang(?:uage)?-([\w.]+)(?!\S)/,lt=/\bprettyprint\b/,Ie=/\bprettyprinted\b/,et=/pre|xmp/i,it=/^code$/i,Be=/^(?:pre|code|xmp)$/i,ze={};function Ce(){for(var ye=B.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;dt<Fe.length&&Xe.now()<ye;dt++){for(var xe=Fe[dt],ne=ze,oe=xe;oe=oe.previousSibling;){var he=oe.nodeType,ve=(he===7||he===8)&&oe.nodeValue;if(ve?!/^\??prettify\b/.test(ve):he!==3||/\S/.test(oe.nodeValue))break;if(ve){ne={},ve.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Zt,Bt,_r){ne[Bt]=_r});break}}var Ne=xe.className;if((ne!==ze||lt.test(Ne))&&!Ie.test(Ne)){for(var Le=!1,Ke=xe.parentNode;Ke;Ke=Ke.parentNode){var at=Ke.tagName;if(Be.test(at)&&Ke.className&&lt.test(Ke.className)){Le=!0;break}}if(!Le){xe.className+=" prettyprinted";var mt=ne.lang;if(!mt){mt=Ne.match(tt);var pt;!mt&&(pt=le(xe))&&it.test(pt.tagName)&&(mt=pt.className.match(tt)),mt&&(mt=mt[1])}var Mt;if(et.test(xe.tagName))Mt=1;else{var Pt=xe.currentStyle,yt=Me.defaultView,Ht=Pt?Pt.whiteSpace:yt&&yt.getComputedStyle?yt.getComputedStyle(xe,null).getPropertyValue("white-space"):0;Mt=Ht&&Ht.substring(0,3)==="pre"}var Jt=ne.linenums;(Jt=Jt==="true"||+Jt)||(Jt=Ne.match(/\blinenums\b(?::(\d+))?/),Jt=Jt?Jt[1]&&Jt[1].length?+Jt[1]:!0:!1),Jt&&Re(xe,Jt,Mt);var ut={langExtension:mt,sourceNode:xe,numberLines:Jt,pre:Mt,sourceCode:null,basePos:null,spans:null,decorations:null};re(ut)}}}dt<Fe.length?B.setTimeout(Ce,250):typeof ae=="function"&&ae()}Ce()}var ke=B.PR={createSimpleLexer:pe,registerLangHandler:ge,sourceDecorator:Oe,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:F,PR_COMMENT:_,PR_DECLARATION:T,PR_KEYWORD:R,PR_LITERAL:E,PR_NOCODE:j,PR_PLAIN:u,PR_PUNCTUATION:c,PR_SOURCE:L,PR_STRING:y,PR_TAG:h,PR_TYPE:C,prettyPrintOne:k?B.prettyPrintOne=ce:P=ce,prettyPrint:W=k?B.prettyPrint=se:W=se},ie=B.define;typeof ie=="function"&&ie.amd&&ie("google-code-prettify",[],function(){return ke})})()},Sdqs:function(bt,Se,Q){"use strict";Q.r(Se);var ue=Q("5Dmo"),J=Q("3S7+"),k=Q("+L6B"),X=Q("2/Rp"),U=Q("giR+"),P=Q("fyUT"),W=Q("sRBo"),B=Q("kaz8"),O=Q("/zsF"),A=Q("PArb"),d=Q("14J3"),p=Q("BMrR"),w=Q("jCWc"),m=Q("kPKH"),g=Q("sPJy"),b=Q("bE4q"),a=Q("miYZ"),i=Q("tsqr"),s=Q("9og8"),l=Q("k1fw"),S=Q("y8nQ"),v=Q("Vl3Y"),y=Q("2qtc"),R=Q("kLXV"),_=Q("tJVT"),C=Q("PpiC"),E=Q("WmNS"),c=Q.n(E),u=Q("q1tI"),h=Q.n(u),T=Q("Ty5D"),L=Q("9kvl"),I=Q("55Ip"),F=Q("jhfD"),j=Q("/MfK"),z=Q("kaH+"),M=Q("Ot1p"),N=Q("dhSg"),Y=Q("wd/R"),ee=Q.n(Y),le=Q("m3rI"),pe=Q("LvDl"),Oe=Q("XYT7"),Te=Q("5NDa"),Re=Q("5rEg"),Ae=Q("ErOA"),we=function(Je){var $e=Je.shixunHomeworks,Qe=Je.dispatch,Xe=Object(T.i)(),dt=Object(u.useState)(!0),tt=Object(_.a)(dt,2),lt=tt[0],Ie=tt[1],et=v.a.useForm(),it=Object(_.a)(et,1),Be=it[0];return h.a.createElement(h.a.Fragment,null,h.a.createElement(R.a,{centered:!0,title:"\u8C03\u5206",visible:$e.actionTabs.key==="\u8C03\u5206",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:Object(s.a)(c.a.mark(function ze(){var Ce,ye;return c.a.wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:return ne.next=2,Be.validateFields();case 2:return Ce=Be.getFieldsValue(),ne.next=5,Object(Ae.a)("/api/student_works/".concat($e.actionTabs.id,"/adjust_score.json"),{method:"post",body:Object(l.a)({},Ce)});case 5:ye=ne.sent,ye.status===0&&(i.b.success("\u8BC4\u9605\u6210\u529F"),Be.resetFields(),Qe({type:"shixunHomeworks/setActionTabs",payload:{}}),Qe({type:"shixunHomeworks/getStudentWorkCommon",payload:Object(l.a)({},Xe)}));case 7:case"end":return ne.stop()}},ze)})),onCancel:function(){Qe({type:"shixunHomeworks/setActionTabs",payload:{}})}},h.a.createElement("p",{className:"tc"},"\u8BE5\u5B66\u751F\u7684\u6700\u7EC8\u6210\u7EE9\u5C06\u4E0D\u4F1A\u6309\u7167\u8BC4\u5206\u89C4\u5219\u8FDB\u884C\u8BA1\u7B97"),h.a.createElement(v.a,{form:Be,layout:"horizontal"},h.a.createElement("div",{style:{display:"flex",alignItems:"baseline"}},h.a.createElement(v.a.Item,{label:"\u6210\u7EE9",name:"score",rules:[{required:!0,message:"\u8BF7\u8F93\u5165!"}]},h.a.createElement(P.a,{min:0,placeholder:"\u8BF7\u586B\u5199\u5206\u6570"})),h.a.createElement("span",{className:"ml10"},"\u5206")),h.a.createElement("div",null,h.a.createElement(v.a.Item,{name:"comment"},h.a.createElement(Re.a.TextArea,{placeholder:"\u8BF7\u586B\u5199\u60A8\u5BF9\u4F5C\u54C1\u8C03\u5206\u7684\u539F\u56E0",rows:8}))))))},ge=Object(L.a)(function(Fe){var Je=Fe.shixunHomeworks;return{shixunHomeworks:Je}})(we),de=Q("500L"),re=function(Je){var $e=Je.classroomList,Qe=Je.loading,Xe=Je.dispatch,dt=Object(T.i)(),tt=v.a.useForm(),lt=Object(_.a)(tt,1),Ie=lt[0];return h.a.createElement(R.a,{centered:!0,title:"\u8865\u4EA4\u9644\u4EF6",visible:$e.actionTabs.key==="\u8865\u4EA4\u9644\u4EF6",bodyStyle:{minHeight:200},onOk:Object(s.a)(c.a.mark(function et(){var it,Be,ze,Ce;return c.a.wrap(function(xe){for(;;)switch(xe.prev=xe.next){case 0:return xe.next=2,Ie.validateFields();case 2:return Be=Object(l.a)({},Ie.getFieldValue()),ze=$e.actionTabs.selectArrs,Be.attachment_ids=(it=Be.attachment_ids)===null||it===void 0?void 0:it.map(function(ne){return ne.response.id}),xe.next=7,Object(Oe.R)(Object(l.a)(Object(l.a)({},Be),{},{homeworkId:ze.work_id}));case 7:Ce=xe.sent,Ce.status===0&&(Xe({type:"shixunHomeworks/getStudentWorkSupplyDetail",payload:Object(l.a)({},$e.actionTabs.params)}),Xe({type:"classroomList/setActionTabs",payload:{}}));case 9:case"end":return xe.stop()}},et)})),onCancel:function(){Xe({type:"classroomList/setActionTabs",payload:{}})}},h.a.createElement(v.a,{form:Ie,initialValues:{}},h.a.createElement(v.a.Item,{name:"attachment_ids",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u9644\u4EF6"}]},h.a.createElement(de.b,null)),h.a.createElement(v.a.Item,{name:"description"},h.a.createElement(Re.a.TextArea,{placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u8865\u4EA4\u9644\u4EF6\u7684\u539F\u56E0\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26",rows:7}))))},ce=Object(L.a)(function(Fe){var Je=Fe.classroomList,$e=Fe.loading;return{classroomList:Je,loading:$e}})(re),se=Q("xKgJ"),ke=Q("T/ev"),ie=Q.n(ke),ae=Q("9Bee"),me=Q("1vsH"),_e=Q("p5ED"),Me=["\u5355\u9009\u9898","\u591A\u9009\u9898","\u5224\u65AD\u9898","\u586B\u7A7A\u9898","\u7B80\u7B54\u9898","\u5B9E\u8BAD\u9898"],Ue=function(Je){var $e,Qe,Xe,dt,tt,lt,Ie,et,it,Be,ze,Ce,ye,xe,ne,oe,he,ve,Ne,Le,Ke,at,mt,pt=Je.shixunHomeworks,Mt=Je.globalSetting,Pt=Je.loading,yt=Je.user,Ht=Je.dispatch,Jt=Object(C.a)(Je,["shixunHomeworks","globalSetting","loading","user","dispatch"]),ut=Object(T.i)(),Zt=Object(u.useRef)(),Bt=Object(T.h)(),_r=yt.userInfo,Ze=pt.studentWorkDetail,gt=pt.studentWorkCommon,Ct=pt.studentWorkSupplyDetail,ht=pt.workList,At=Object(u.useState)({}),rr=Object(_.a)(At,2),hr=rr[0],cr=rr[1],Ut=Object(u.useState)(""),xt=Object(_.a)(Ut,2),Mr=xt[0],rn=xt[1],Ar=Object(u.useState)(!1),Ft=Object(_.a)(Ar,2),Ir=Ft[0],Tr=Ft[1],nn=R.a.useModal(),He=Object(_.a)(nn,2),ft=He[0],Wt=He[1],qt=v.a.useForm(),nr=Object(_.a)(qt,1),ir=nr[0],K=Object(u.useState)({last:!1}),f=Object(_.a)(K,2),x=f[0],G=f[1],$=Object(u.useState)({last:!1}),V=Object(_.a)($,2),be=V[0],Ge=V[1],nt=Object(u.useState)(!1),Et=Object(_.a)(nt,2),Ve=Et[0],kt=Et[1],Kt=Object(u.useState)(""),sr=Object(_.a)(Kt,2),jr=sr[0],Gr=sr[1],gr=Object(u.useState)({content:"",type:""}),zr=Object(_.a)(gr,2),an=zr[0],br=zr[1],Lr=Object(u.useRef)(),Er=function(){Ht({type:"shixunHomeworks/getStudentWorkCommon",payload:Object(l.a)({},ut)})};Object(u.useEffect)(function(){return Ht({type:"globalSetting/footerToggle",payload:!1}),function(){Ht({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(u.useEffect)(function(){Ht({type:"shixunHomeworks/getStudentWorkDetail",payload:Object(l.a)({},ut)}),Ht({type:"shixunHomeworks/getStudentWorkSupplyDetail",payload:Object(l.a)({},ut)}),Er(),gn(),Zt.current.onclick=function(qe){qe.target.nodeName==="IMG"&&qe.target.alt!==""&&N.a.publish("preview-image",qe.target.src)}},[ut.categoryId,ut.userId]);function gn(){return Kr.apply(this,arguments)}function Kr(){return Kr=Object(s.a)(c.a.mark(function qe(){var It,Vt,ct,$t,Lt,Tt,wt;return c.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return ct=JSON.parse(localStorage.getItem("all_student_works_param")||"{}"),er.next=3,Ht({type:"shixunHomeworks/getAllStudentWorks",payload:Object(l.a)(Object(l.a)({},ut),ct)});case 3:$t=er.sent,Lt=(It=$t.all_student_works)===null||It===void 0?void 0:It.map(function(Gt){return String(Gt.student_work_id)}).indexOf(ut.userId),Lt===((Vt=$t.all_student_works)===null||Vt===void 0?void 0:Vt.length)-1?G({last:!0}):G((Tt=$t.all_student_works)===null||Tt===void 0?void 0:Tt[Lt+1]),Lt===0?Ge({last:!0}):Ge((wt=$t.all_student_works)===null||wt===void 0?void 0:wt[Lt-1]);case 7:case"end":return er.stop()}},qe)})),Kr.apply(this,arguments)}var cn=function(It){ft.confirm({title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){var Vt=Object(s.a)(c.a.mark(function $t(){var Lt;return c.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return wt.next=2,Ht({type:"shixunHomeworks/deleteReply",payload:{object_id:It.id,object_type:"journals_for_message"}});case 2:Lt=wt.sent,Lt.status===0&&(i.b.success("\u5220\u9664\u6210\u529F"),Er());case 4:case"end":return wt.stop()}},$t)}));function ct(){return Vt.apply(this,arguments)}return ct}()})},on=function(It){ft.confirm({title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){var Vt=Object(s.a)(c.a.mark(function $t(){var Lt;return c.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return wt.next=2,Object(Oe.k)({score_id:It.comment_id,userId:ut.userId});case 2:Lt=wt.sent,Lt.status===0&&(i.b.success("\u5220\u9664\u6210\u529F"),Er());case 4:case"end":return wt.stop()}},$t)}));function ct(){return Vt.apply(this,arguments)}return ct}()})},In=function(){var qe=Object(s.a)(c.a.mark(function It(Vt){var ct,$t;return c.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Vt.attachment_ids=(ct=Vt.attachment_ids)===null||ct===void 0?void 0:ct.map(function(wt){var jt;return wt==null||((jt=wt.response)===null||jt===void 0)?void 0:jt.id}),Tt.next=3,Object(Oe.e)(Object(l.a)(Object(l.a)({},Vt),{},{userId:ut.userId}));case 3:$t=Tt.sent,$t.status===0&&(i.b.success("\u63D0\u4EA4\u6210\u529F"),ir.resetFields(),Er());case 5:case"end":return Tt.stop()}},It)}));return function(Vt){return qe.apply(this,arguments)}}(),vn=function(){var qe=Object(s.a)(c.a.mark(function It(Vt){var ct,$t,Lt,Tt,wt;return c.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:if(ct=ir.getFieldsValue(),$t=ct.comment,Lt=ct.score,Tt=ct.attachment_ids,wt=!Object(pe.isNil)(Lt),console.log("-------",ut),!($t||wt||Tt)){er.next=6;break}return R.a.confirm({centered:!0,okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:h.a.createElement("div",{className:"tc"},"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539"),onOk:function(){ir.resetFields(),Vt==="last"?L.d.push("/classrooms/".concat(ut==null?void 0:ut.coursesId,"/group_homework/").concat(ut==null?void 0:ut.commonHomeworkId,"/review/").concat(be==null?void 0:be.student_work_id)):Vt==="read"?L.d.push("/classrooms/".concat(ut==null?void 0:ut.coursesId,"/group_homework/").concat(ut==null?void 0:ut.commonHomeworkId,"/review/").concat(x==null?void 0:x.student_work_id)):L.d.push("/classrooms/".concat(ut.coursesId,"/group_homework/").concat(ut.commonHomeworkId,"/detail"))}}),er.abrupt("return");case 6:Vt==="last"?L.d.push("/classrooms/".concat(ut==null?void 0:ut.coursesId,"/group_homework/").concat(ut==null?void 0:ut.commonHomeworkId,"/review/").concat(be==null?void 0:be.student_work_id)):Vt==="read"?L.d.push("/classrooms/".concat(ut==null?void 0:ut.coursesId,"/group_homework/").concat(ut==null?void 0:ut.commonHomeworkId,"/review/").concat(x==null?void 0:x.student_work_id)):L.d.push("/classrooms/".concat(ut.coursesId,"/group_homework/").concat(ut.commonHomeworkId,"/detail"));case 7:case"end":return er.stop()}},It)}));return function(Vt){return qe.apply(this,arguments)}}();return h.a.createElement("section",{className:"edu-container",ref:Zt},h.a.createElement("section",{className:"animated fadeIn"},h.a.createElement("aside",{className:"mt10"},_r&&h.a.createElement(b.a,{separator:">"},h.a.createElement(b.a.Item,null,h.a.createElement(I.a,{to:"/classrooms/".concat(ut.coursesId,"/group_homework")},_r==null||(($e=_r.course)===null||$e===void 0)?void 0:$e.course_name)),h.a.createElement(b.a.Item,null,h.a.createElement(I.a,{to:"/classrooms/".concat(ut.coursesId,"/group_homework")},"\u5206\u7EC4\u4F5C\u4E1A")),h.a.createElement(b.a.Item,null,h.a.createElement(I.a,{to:"/classrooms/".concat(ut.coursesId,"/group_homework/").concat(ut.commonHomeworkId,"/detail")},"\u4F5C\u4E1A\u8BE6\u60C5")),h.a.createElement(b.a.Item,null,Ze==null?void 0:Ze.author_name))),h.a.createElement("aside",{className:[ie.a.title,"mt20"].join(" ")},h.a.createElement(p.a,{style:{width:"100%"}},h.a.createElement(m.a,{flex:"1"},h.a.createElement(I.a,{to:"/classrooms/".concat(ut.coursesId,"/group_homework")},h.a.createElement(F.a,{className:"font16 c-black"})),h.a.createElement("strong",{className:"font20 ml5"},Ze==null?void 0:Ze.homework_name),h.a.createElement(me.k,{status:Ze==null?void 0:Ze.homework_status})),h.a.createElement(m.a,null,Object(se.s)()&&(Ze==null||((Qe=Ze.homework_status)===null||Qe===void 0)?void 0:Qe.includes("\u8865\u4EA4\u4E2D"))&&h.a.createElement("span",{onClick:function(){Ht({type:"classroomList/setActionTabs",payload:{key:"\u8865\u4EA4\u9644\u4EF6",params:ut,selectArrs:{homework_id:ut.commonHomeworkId,work_id:ut.userId}}})},className:"c-blue current font14"},"\u8865\u4EA4\u9644\u4EF6"))))),h.a.createElement("section",{className:[ie.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},(Ze==null?void 0:Ze.description)&&h.a.createElement("aside",null,h.a.createElement("div",{className:"font16"},"\u5185\u5BB9"),h.a.createElement("div",{className:"pl30 mt20"},h.a.createElement(ae.a,{value:(Ze==null?void 0:Ze.description)||"\u6682\u65E0\uFF5E"})),Ze==null||((Xe=Ze.attachments)===null||Xe===void 0)?void 0:Xe.map(function(qe,It){return h.a.createElement("div",{className:"pl30",key:It},h.a.createElement("a",{href:"".concat(le.a.API_SERVER).concat(qe.url),onClick:function(){var Vt=Object(s.a)(c.a.mark(function ct($t){var Lt;return c.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if($t.preventDefault(),!(qe.file_type==="txt")){wt.next=6;break}return wt.next=4,Object(Ae.a)(qe.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 4:Lt=wt.sent,Lr.current=Lt;case 6:br({type:qe.file_type,content:window.location.origin+qe.url});case 7:case"end":return wt.stop()}},ct)}));return function(ct){return Vt.apply(this,arguments)}}()},h.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),h.a.createElement("span",{className:"ml10 c-black"},qe.title),h.a.createElement("span",{className:"c-light-black ml20 font12"},qe.filesize),h.a.createElement("span",{className:"ml10 c-light-primary current",onClick:function(ct){ct.preventDefault(),ct.stopPropagation(),Object(me.v)("","".concat(le.a.API_SERVER).concat(qe.url))}},"\u4E0B\u8F7D"),h.a.createElement("span",{className:"ml10 c-green-29b current"},"\u9884\u89C8")))}),h.a.createElement("aside",{className:"tr"},h.a.createElement("span",{className:" c-light-black"},ee()(Ze.commit_time).format("YYYY-MM-DD HH:mm")),h.a.createElement("span",{className:"ml10"},Ze.commit_user_name),h.a.createElement("span",{className:"ml10 c-light-black"},"\u63D0\u4EA4"),h.a.createElement("span",{className:"ml30 c-light-black"},ee()(Ze.update_time).format("YYYY-MM-DD HH:mm")),h.a.createElement("span",{className:"ml10"},Ze.update_user_name),h.a.createElement("span",{className:"ml10 c-light-black"},"\u66F4\u65B0"))),(Ze==null?void 0:Ze.redo_description)&&h.a.createElement("aside",null,h.a.createElement(A.a,null),h.a.createElement("div",{className:"font16"},"\u91CD\u505A\u8BB0\u5F55"),h.a.createElement("div",{className:"pl30 mt20"},h.a.createElement(ae.a,{value:(Ze==null?void 0:Ze.redo_description)||"\u6682\u65E0\uFF5E"})),Ze==null||((dt=Ze.redo_attachments)===null||dt===void 0)?void 0:dt.map(function(qe,It){return h.a.createElement("div",{className:"pl30",key:It},h.a.createElement("a",{href:"".concat(le.a.API_SERVER).concat(qe.url),onClick:function(){var Vt=Object(s.a)(c.a.mark(function ct($t){var Lt;return c.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if($t.preventDefault(),!(qe.file_type==="txt")){wt.next=6;break}return wt.next=4,Object(Ae.a)(qe.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 4:Lt=wt.sent,Lr.current=Lt;case 6:br({type:qe.file_type,content:window.location.origin+qe.url});case 7:case"end":return wt.stop()}},ct)}));return function(ct){return Vt.apply(this,arguments)}}()},h.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),h.a.createElement("span",{className:"ml10 c-black"},qe.title),h.a.createElement("span",{className:"c-light-black ml20 font12"},qe.filesize),h.a.createElement("span",{className:"ml10 c-light-primary current",onClick:function(ct){ct.preventDefault(),ct.stopPropagation(),Object(me.v)("","".concat(le.a.API_SERVER).concat(qe.url))}},"\u4E0B\u8F7D"),h.a.createElement("span",{className:"ml10 c-green-29b current"},"\u9884\u89C8")))}),h.a.createElement("aside",{className:"tr"},h.a.createElement("span",{className:" c-light-black"},ee()(Ze.redo_commit_time).format("YYYY-MM-DD HH:mm")),h.a.createElement("span",{className:"ml10"},Ze.commit_user_name),h.a.createElement("span",{className:"ml10 c-light-black"},"\u63D0\u4EA4"),h.a.createElement("span",{className:"ml30 c-light-black"},ee()(Ze.redo_update_time).format("YYYY-MM-DD HH:mm")),h.a.createElement("span",{className:"ml10"},Ze.update_user_name),h.a.createElement("span",{className:"ml10 c-light-black"},"\u66F4\u65B0"))),(Ct==null?void 0:Ct.revise_reason)&&h.a.createElement("aside",null,h.a.createElement(A.a,null),h.a.createElement("div",{className:"font16"},"\u8865\u4EA4\u5185\u5BB9"),h.a.createElement("div",{className:"pl30 mt20"},h.a.createElement(ae.a,{value:(Ct==null?void 0:Ct.revise_reason)||"\u6682\u65E0\uFF5E"})),Ct==null||((tt=Ct.revise_attachments)===null||tt===void 0)?void 0:tt.map(function(qe,It){return h.a.createElement("div",{className:"pl30",key:It},h.a.createElement("a",{href:"".concat(le.a.API_SERVER).concat(qe.url),onClick:function(){var Vt=Object(s.a)(c.a.mark(function ct($t){var Lt;return c.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if($t.preventDefault(),!(qe.file_type==="txt")){wt.next=6;break}return wt.next=4,Object(Ae.a)(qe.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 4:Lt=wt.sent,Lr.current=Lt;case 6:br({type:qe.file_type,content:window.location.origin+qe.url});case 7:case"end":return wt.stop()}},ct)}));return function(ct){return Vt.apply(this,arguments)}}()},h.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),h.a.createElement("span",{className:"ml10 c-black"},qe.title),h.a.createElement("span",{className:"c-light-black ml20 font12"},qe.filesize),h.a.createElement("span",{className:"ml10 c-light-primary current",onClick:function(ct){ct.preventDefault(),ct.stopPropagation(),Object(me.v)("","".concat(le.a.API_SERVER).concat(qe.url))}},"\u4E0B\u8F7D"),h.a.createElement("span",{className:"ml10 c-green-29b current"},"\u9884\u89C8")))}),h.a.createElement("aside",{className:"tr"},h.a.createElement("span",{className:"ml30 c-light-black"},ee()(Ct.atta_update_time).format("YYYY-MM-DD HH:mm")),h.a.createElement("span",{className:"ml10"},Ct.atta_update_user),h.a.createElement("span",{className:"ml10 c-light-black"},"\u66F4\u65B0"))),h.a.createElement(A.a,null),(Ze==null||((lt=Ze.project_info)===null||lt===void 0)?void 0:lt.id)&&h.a.createElement("aside",null,h.a.createElement("div",{className:"font16"},"\u5173\u8054\u9879\u76EE"),h.a.createElement("div",{className:"pl30 mt20"},(Ze==null||((Ie=Ze.project_info)===null||Ie===void 0)?void 0:Ie.id)===-1&&h.a.createElement("span",{className:"c-blue"},Ze==null||((et=Ze.project_info)===null||et===void 0)?void 0:et.name),(Ze==null||((it=Ze.project_info)===null||it===void 0)?void 0:it.id)!==-1&&h.a.createElement("a",{target:"_blank",href:"".concat((Be=yt.navigationInfo)===null||Be===void 0||((ze=Be.top)===null||ze===void 0)?void 0:ze.old_url).concat(Ze==null||((Ce=Ze.project_info)===null||Ce===void 0)?void 0:Ce.id)},Ze==null||((ye=Ze.project_info)===null||ye===void 0)?void 0:ye.name))),h.a.createElement(A.a,null),(Ze==null||((xe=Ze.project_info)===null||xe===void 0)?void 0:xe.id)&&h.a.createElement("aside",null,h.a.createElement("div",{className:"font16"},"\u5168\u90E8\u7EC4\u5458"),h.a.createElement("div",{className:"pl30 mt20"},"\u5F53\u524D\u7EC4\u5458\uFF1A",Ze==null?void 0:Ze.author_name," ",(Ze==null?void 0:Ze.is_leader_work)&&h.a.createElement("span",{className:ie.a.leader},"\u7EC4\u957F"),h.a.createElement("br",null),(Ze==null||((ne=Ze.work_members)===null||ne===void 0)?void 0:ne.length)>0&&h.a.createElement("span",null,"\u5176\u4ED6\u7EC4\u5458\uFF1A",Ze==null||((oe=Ze.work_members)===null||oe===void 0)?void 0:oe.map(function(qe,It){return Object(se.s)()?h.a.createElement("a",{style:{pointerEvents:"none"}},qe.user_name,(qe==null?void 0:qe.is_leader)&&h.a.createElement("span",{className:ie.a.leader},"\u7EC4\u957F")):h.a.createElement(I.a,{key:It,className:"mr10",to:"/classrooms/".concat(ut.coursesId,"/group_homework/").concat(ut.commonHomeworkId,"/review/").concat(qe.work_id),target:"_blank"},qe.user_name,(qe==null?void 0:qe.is_leader)&&h.a.createElement("span",{className:ie.a.leader},"\u7EC4\u957F"))}))),!Object(se.s)()&&h.a.createElement("div",{className:"c-grey-999 pl30"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u5176\u4ED6\u7EC4\u5458\u7684\u59D3\u540D\uFF0C\u53EF\u4EE5\u5FEB\u901F\u8BC4\u9605TA\u7684\u4F5C\u54C1"))),(Ze==null?void 0:Ze.anonymous_comment)&&Object(se.e)()&&h.a.createElement("section",null,h.a.createElement("aside",{className:[ie.a.replyList,"bg-white"].join(" ")},h.a.createElement("span",{style:{fontSize:"16px"}},"\u533F\u8BC4\u5B66\u5458"),h.a.createElement("br",null),(Ze==null||((he=Ze.no_commented_user_names)===null||he===void 0)?void 0:he.length)>0&&h.a.createElement("p",{style:{marginTop:"1em"}},"\u672A\u5B8C\u6210\u533F\u8BC4\uFF1A",Ze==null||((ve=Ze.no_commented_user_names)===null||ve===void 0)?void 0:ve.toString()),h.a.createElement("span",{style:{marginTop:(Ze==null||((Ne=Ze.no_commented_user_names)===null||Ne===void 0)?void 0:Ne.length)>0?"":"1em",display:"flex"}},"\u5DF2\u5B8C\u6210\u533F\u8BC4\uFF1A",Ze==null||((Le=Ze.commented_user_names)===null||Le===void 0)?void 0:Le.toString()))),(Object(se.c)()||(Ze==null||((Ke=Ze.homework_status)===null||Ke===void 0)?void 0:Ke.includes("\u533F\u8BC4\u4E2D")))&&h.a.createElement("section",null,h.a.createElement("aside",{className:[ie.a.replyList,"bg-white"].join(" ")},h.a.createElement(p.a,{gutter:[10,20]},h.a.createElement(m.a,{flex:1},h.a.createElement("span",{className:"font-16"},"\u5168\u90E8\u8BC4\u9605(",gt==null?void 0:gt.comment_count,")")),h.a.createElement(m.a,{style:{lineHeight:"40px"}},Object(se.c)()&&(gt==null?void 0:gt.ultimate)&&h.a.createElement("span",{className:"font-16 c-blue current",onClick:function(){Ht({type:"shixunHomeworks/setActionTabs",payload:{key:"\u8C03\u5206",selectArrs:Ze,id:ut.userId,params:ut}})}},"\u8C03\u5206")),h.a.createElement(m.a,null)),(!(gt!=null&&gt.ultimate)||(Ze==null||((at=Ze.homework_status)===null||at===void 0)?void 0:at.includes("\u533F\u8BC4\u4E2D")))&&!(gt!=null&&gt.is_author)&&h.a.createElement("aside",null,h.a.createElement(v.a,{layout:"vertical",form:ir,onFinish:function(It){return In(It)},initialValues:{same_score:!0}},h.a.createElement(v.a.Item,{label:"\u8BC4\u8BED",name:"comment",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BC4\u8BED"}]},h.a.createElement(M.a,{placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u5BF9\u672C\u4F5C\u54C1\u7684\u8BC4\u8BED\uFF0C\u6700\u5927\u9650\u52362000\u4E2A\u5B57\u7B26",maxLength:2e3,defaultValue:"",height:200})),h.a.createElement(v.a.Item,{name:"same_score",valuePropName:"checked"},h.a.createElement(B.a,null,"\u6574\u7EC4\u540C\u8BC4(\u9009\u4E2D\uFF0C\u5219\u672C\u6B21\u8BC4\u9605\u5BF9\u8C61\u6307\u5C0F\u7EC4\u5168\u90E8\u6210\u5458\uFF0C\u5426\u5219\u4EC5\u8BC4\u9605\u6B64\u6210\u54581\u4EBA )")),h.a.createElement("div",null,h.a.createElement(v.a.Item,{name:"attachment_ids"},h.a.createElement(de.b,null))),h.a.createElement("div",{className:"mt10"},h.a.createElement(p.a,null,h.a.createElement(m.a,{flex:"1"},h.a.createElement(p.a,{align:"middle",justify:"start"},h.a.createElement(m.a,null,h.a.createElement(v.a.Item,{noStyle:!0,name:"score",rules:[{required:!Object(se.c)(),message:"\u8BF7\u586B\u5199\u5206\u6570"}]},h.a.createElement(P.a,{min:0,step:.1,style:{width:100},size:"large",placeholder:"\u8BF7\u586B\u5199\u5206\u6570"}))),h.a.createElement(m.a,null,h.a.createElement("span",{className:"ml5 mr20"},"\u5206")))))),h.a.createElement("aside",{className:"".concat(ie.a.buttonFixed)},h.a.createElement("aside",{className:"edu-container"},h.a.createElement(p.a,{align:"middle"},h.a.createElement(m.a,{flex:"1"},h.a.createElement(X.a,{type:"default",onClick:function(){return vn("list")}},"\u8FD4\u56DE\u5217\u8868")),h.a.createElement(m.a,{flex:"1",className:"tr"},!Object(se.s)()&&h.a.createElement(X.a,{type:"default",onClick:function(){return vn("last")},disabled:be==null?void 0:be.last},"\u4E0A\u4E00\u4E2A"),!Object(se.s)()&&h.a.createElement(X.a,{type:"default",disabled:x==null?void 0:x.last,style:{marginLeft:"20px",marginRight:"20px"},onClick:function(){return vn("read")}},"\u4E0B\u4E00\u4E2A"),h.a.createElement(X.a,{htmlType:"submit",type:"primary"},"\u63D0\u4EA4\u8BC4\u9605"))))))),h.a.createElement(A.a,null),gt==null||((mt=gt.comment_scores)===null||mt===void 0)?void 0:mt.map(function(qe,It){var Vt;return h.a.createElement("aside",{key:It},h.a.createElement(p.a,{gutter:[12,12],key:It},h.a.createElement(m.a,{flex:"40px"},h.a.createElement("img",{className:ie.a.headpic,width:"40",src:"".concat(le.a.IMG_SERVER,"/images/").concat(qe==null?void 0:qe.user_image_url)})),h.a.createElement(m.a,{flex:"1"},h.a.createElement(p.a,{align:"middle"},h.a.createElement(m.a,{span:24},h.a.createElement(p.a,null,h.a.createElement(m.a,{flex:1},h.a.createElement("span",{className:"c-light-black"},qe==null?void 0:qe.user_name),h.a.createElement("span",{className:"c-light-black"},"\uFF08",qe==null?void 0:qe.comment_role,"\uFF09"),h.a.createElement("span",{className:"c-light-black ml10"},ee()(qe==null?void 0:qe.comment_time).format("YYYY-MM-DD HH:mm")),qe.score!==null&&h.a.createElement("span",{className:"ml30 c-orange"},qe.score,"\u5206")),h.a.createElement(m.a,null,It===0?h.a.createElement("aside",null,qe.delete&&h.a.createElement("span",{className:"c-blue current",onClick:function(){on(qe)}},"\u5220\u9664"),qe.can_appeal&&h.a.createElement("span",{className:"c-blue current",onClick:function(){Tr({show:!0,type:1,active:It})}},"\u7533\u8BC9"),qe.can_reply&&h.a.createElement("span",{className:"c-blue current ml10",onClick:function(){return Tr({show:!0,type:0,active:It})}},"\u56DE\u590D")):h.a.createElement("aside",null,qe.delete&&h.a.createElement("span",{className:"c-blue current",onClick:function(){on(qe)}},"\u5220\u9664"),qe.can_appeal&&h.a.createElement("span",{className:"c-blue current",onClick:function(){Tr({show:!0,type:1,active:It})}},"\u7533\u8BC9"),qe.can_reply&&h.a.createElement("span",{className:"c-blue current ml10",onClick:function(){return Tr({show:!0,type:0,active:It})}},"\u56DE\u590D"),!qe.can_reply&&h.a.createElement("span",{className:"c-light-black ml10"},"\u5931\u6548"))))),h.a.createElement(m.a,{span:24},qe.content&&h.a.createElement(ae.a,{value:qe.content}),!qe.content&&h.a.createElement("span",{className:"c-light-black"},"\u6682\u672A\u5199\u8BC4\u8BED"),qe==null||((Vt=qe.attachments)===null||Vt===void 0)?void 0:Vt.map(function(ct,$t){return h.a.createElement("div",{key:$t},h.a.createElement("a",{href:"".concat(le.a.API_SERVER).concat(ct.url),onClick:function(){var Lt=Object(s.a)(c.a.mark(function Tt(wt){var jt;return c.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:if(wt.preventDefault(),!(ct.file_type==="txt")){Gt.next=6;break}return Gt.next=4,Object(Ae.a)(ct.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 4:jt=Gt.sent,Lr.current=jt;case 6:br({type:ct.file_type,content:window.location.origin+ct.url});case 7:case"end":return Gt.stop()}},Tt)}));return function(Tt){return Lt.apply(this,arguments)}}()},h.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),h.a.createElement("span",{className:"ml10 c-black"},ct.title),h.a.createElement("span",{className:"c-light-black ml20 font12"},ct.filesize),h.a.createElement("span",{className:"ml10 c-light-primary current",onClick:function(Tt){Tt.preventDefault(),Tt.stopPropagation(),Object(me.v)("","".concat(le.a.API_SERVER).concat(ct.url))}},"\u4E0B\u8F7D"),h.a.createElement("span",{className:"ml10 c-green-29b current"},"\u9884\u89C8")))})),qe.journals!=""&&h.a.createElement("div",{className:"w100"},h.a.createElement(A.a,null),h.a.createElement("aside",{className:[ie.a.comment,"w100"].join(" ")},qe.journals.map(function(ct,$t){var Lt,Tt;return h.a.createElement("aside",{key:$t},h.a.createElement(p.a,{key:$t},h.a.createElement(m.a,{span:24},h.a.createElement(p.a,null,h.a.createElement(m.a,{flex:"50px"},h.a.createElement("img",{className:ie.a.headpic,width:"40",src:"".concat(le.a.IMG_SERVER,"/images/").concat(ct==null||((Lt=ct.user_info)===null||Lt===void 0)?void 0:Lt.user_image_url)})),h.a.createElement(m.a,{flex:"1"},ct==null||((Tt=ct.user_info)===null||Tt===void 0)?void 0:Tt.user_name,h.a.createElement("span",{className:"c-light-black ml10"},ee()(ct==null?void 0:ct.time).format("YYYY-MM-DD HH:mm")),h.a.createElement("br",null),h.a.createElement("strong",null,h.a.createElement(ae.a,{value:ct.content}))),h.a.createElement(m.a,null,h.a.createElement(J.a,{title:"\u5220\u9664"},h.a.createElement(j.a,{className:"current c-light-black",onClick:function(){cn(ct)}})))))),h.a.createElement(A.a,null))})))),Ir&&It===0&&h.a.createElement("aside",{className:["bg-white"].join(" ")},h.a.createElement(M.a,{onChange:function($t){rn($t)},height:150,isFocus:!0,watch:!0}),h.a.createElement(p.a,null,h.a.createElement(m.a,{span:24,className:"tr"},h.a.createElement(X.a,{type:"default",size:"large",onClick:Object(s.a)(c.a.mark(function ct(){return c.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:Tr(!1);case 1:case"end":return Lt.stop()}},ct)}))},"\u53D6\u6D88"),h.a.createElement(X.a,{type:"primary",size:"large",className:"ml20",onClick:Object(s.a)(c.a.mark(function ct(){var $t;return c.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!(Mr==="")){Tt.next=4;break}i.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),Tt.next=8;break;case 4:return Tt.next=6,Object(Oe.f)({comment:Mr,userId:ut.userId,score_id:qe.score_id});case 6:$t=Tt.sent,$t.status===0&&(i.b.success("\u64CD\u4F5C\u6210\u529F"),Tr(!1),Er());case 8:case"end":return Tt.stop()}},ct)}))},"\u4FDD\u5B58")))))),h.a.createElement(A.a,null))}))),h.a.createElement(ge,null),h.a.createElement(ce,null),h.a.createElement(z.a,null),h.a.createElement(R.a,{title:"\u786E\u8BA4\u6253\u56DE\u91CD\u505A",visible:Ve,destroyOnClose:!0,forceRender:!0,onCancel:function(){kt(!1)},onOk:Object(s.a)(c.a.mark(function qe(){var It;return c.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:if(jr){ct.next=3;break}return i.b.info("\u8BC4\u8BED\u4E0D\u80FD\u4E3A\u7A7A"),ct.abrupt("return");case 3:return ct.next=5,Object(Ae.a)("/api/student_works/".concat(ut.userId,"/redo_modal.json"),{method:"post",body:{comment:jr,id:ut.userId}});case 5:It=ct.sent,(It==null?void 0:It.status)===0&&(i.b.info("\u6253\u56DE\u91CD\u505A\u6210\u529F"),kt(!1),Er());case 7:case"end":return ct.stop()}},qe)})),width:700},h.a.createElement("div",{style:{padding:"32px"}},h.a.createElement("span",null,"\u786E\u8BA4\u5C06",Ze==null?void 0:Ze.author_name,"\u7684\u4F5C\u4E1A\u6253\u56DE\u91CD\u505A\u5417"),h.a.createElement("div",{style:{marginTop:"20px"}},h.a.createElement("label",null,h.a.createElement("span",{style:{marginRight:"5px",color:"red"}},"*"),"\u8BC4\u8BED\uFF1A"),h.a.createElement(M.a,{className:ie.a.MdEditor,onChange:function(It){return Gr(It)},defaultValue:"",height:250})))),Wt,h.a.createElement(_e.a,{close:!0,data:an==null?void 0:an.content,type:an==null?void 0:an.type,hasMask:!0,monacoEditor:{value:Lr.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){return br({content:"",type:""})}}))},je=Se.default=Object(L.a)(function(Fe){var Je=Fe.shixunHomeworks,$e=Fe.loading,Qe=Fe.user,Xe=Fe.globalSetting;return{shixunHomeworks:Je,globalSetting:Xe,user:Qe,loading:$e.effects}})(Ue)},"T/ev":function(bt,Se,Q){bt.exports={flex_box_center:"flex_box_center___YeRn8",flex_space_between:"flex_space_between___1Koq4",flex_box_vertical_center:"flex_box_vertical_center___iwltW",flex_box_center_end:"flex_box_center_end___Wt8Ci",flex_box_column:"flex_box_column___1_Hpq",bg:"bg___DLoEi",title:"title___Rt3xF",replyList:"replyList___1-Na2",leader:"leader___2AO79",buttonFixed:"buttonFixed___LfzzJ",exitComment:"exitComment___1F28w",nextComment:"nextComment___3Jkyg",modal:"modal___1isyX",MdEditor:"MdEditor___3xy6-"}},T8No:function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return X}),Q.d(Se,"b",function(){return w}),Q.d(Se,"d",function(){return m}),Q.d(Se,"c",function(){return g}),Q.d(Se,"e",function(){return b});var ue=Q("N0LK"),J=Q("Cg/j"),k=function(){var a=function(i,s){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,S){l.__proto__=S}||function(l,S){for(var v in S)S.hasOwnProperty(v)&&(l[v]=S[v])},a(i,s)};return function(i,s){a(i,s);function l(){this.constructor=i}i.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}}(),X=function(){function a(){}return a.has=function(i){return P.create(i)},a.equals=function(i,s){return W.create(i,s)},a.regex=function(i,s){return A.create(i,s)},a.not=function(i){return O.create(i)},a.and=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return p.create(i)},a.or=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return w.create(i)},a.deserialize=function(i,s){return s===void 0&&(s=!1),i?this._deserializeOrExpression(i,s):void 0},a._deserializeOrExpression=function(i,s){var l=this,S=i.split("||");return w.create(S.map(function(v){return l._deserializeAndExpression(v,s)}))},a._deserializeAndExpression=function(i,s){var l=this,S=i.split("&&");return p.create(S.map(function(v){return l._deserializeOne(v,s)}))},a._deserializeOne=function(i,s){if(i=i.trim(),i.indexOf("!=")>=0){var l=i.split("!=");return B.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("==")>=0){var l=i.split("==");return W.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("=~")>=0){var l=i.split("=~");return A.create(l[0].trim(),this._deserializeRegexValue(l[1],s))}return/^\!\s*/.test(i)?O.create(i.substr(1).trim()):P.create(i)},a._deserializeValue=function(i,s){if(i=i.trim(),i==="true")return!0;if(i==="false")return!1;var l=/^'([^']*)'$/.exec(i);return l?l[1].trim():i},a._deserializeRegexValue=function(i,s){if(Object(ue.x)(i)){if(s)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var l=i.indexOf("/"),S=i.lastIndexOf("/");if(l===S||l<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var v=i.slice(l+1,S),y=i[S+1]==="i"?"i":"";try{return new RegExp(v,y)}catch(R){if(s)throw new Error("bad regexp-value '"+i+"', parse error: "+R);return console.warn("bad regexp-value '"+i+"', parse error: "+R),null}},a}();function U(a,i){var s=a.getType(),l=i.getType();if(s!==l)return s-l;switch(s){case 1:return a.cmp(i);case 2:return a.cmp(i);case 3:return a.cmp(i);case 4:return a.cmp(i);case 6:return a.cmp(i);case 7:return a.cmp(i);case 5:return a.cmp(i);default:throw new Error("Unknown ContextKeyExpr!")}}var P=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 1},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return O.create(this.key)},a}(),W=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?P.create(i):O.create(i):new a(i,s)},a.prototype.getType=function(){return 3},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)==this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return B.create(this.key,this.value)},a}(),B=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?O.create(i):P.create(i):new a(i,s)},a.prototype.getType=function(){return 4},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:this.value<i.value?-1:this.value>i.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)!=this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return W.create(this.key,this.value)},a}(),O=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 2},a.prototype.cmp=function(i){return this.key<i.key?-1:this.key>i.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return P.create(this.key)},a}(),A=function(){function a(i,s){this.key=i,this.regexp=s}return a.create=function(i,s){return new a(i,s)},a.prototype.getType=function(){return 6},a.prototype.cmp=function(i){if(this.key<i.key)return-1;if(this.key>i.key)return 1;var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return s<l?-1:s>l?1:0},a.prototype.equals=function(i){if(i instanceof a){var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return this.key===i.key&&s===l}return!1},a.prototype.evaluate=function(i){var s=i.getValue(this.key);return this.regexp?this.regexp.test(s):!1},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return d.create(this)},a}(),d=function(){function a(i){this._actual=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 7},a.prototype.cmp=function(i){return this._actual.cmp(i._actual)},a.prototype.equals=function(i){return i instanceof a?this._actual.equals(i._actual):!1},a.prototype.evaluate=function(i){return!this._actual.evaluate(i)},a.prototype.keys=function(){return this._actual.keys()},a.prototype.negate=function(){return this._actual},a}(),p=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 5},a.prototype.cmp=function(i){if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(var s=0,l=this.expr.length;s<l;s++){var S=U(this.expr[s],i.expr[s]);if(S!==0)return S}return 0},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].evaluate(i))return!1;return!0},a._normalizeArr=function(i){var s=[];if(i){for(var l=0,S=i.length;l<S;l++){var v=i[l];if(!v)continue;if(v instanceof a){s=s.concat(v.expr);continue}if(v instanceof w)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');s.push(v)}s.sort(U)}return s},a.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var S=l[s];i.push.apply(i,S.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var S=l[s];i.push(S.negate())}return w.create(i)},a}(),w=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 8},a.prototype.equals=function(i){if(i instanceof a){if(this.expr.length!==i.expr.length)return!1;for(var s=0,l=this.expr.length;s<l;s++)if(!this.expr[s].equals(i.expr[s]))return!1;return!0}return!1},a.prototype.evaluate=function(i){for(var s=0,l=this.expr.length;s<l;s++)if(this.expr[s].evaluate(i))return!0;return!1},a._normalizeArr=function(i){var s=[];if(i){for(var l=0,S=i.length;l<S;l++){var v=i[l];if(!v)continue;if(v instanceof a){s=s.concat(v.expr);continue}s.push(v)}s.sort(U)}return s},a.prototype.keys=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var S=l[s];i.push.apply(i,S.keys())}return i},a.prototype.negate=function(){for(var i=[],s=0,l=this.expr;s<l.length;s++){var S=l[s];i.push(S.negate())}for(var v=function(L){return L instanceof a?L.expr:[L]};i.length>1;){for(var y=i.shift(),R=i.shift(),_=[],C=0,E=v(y);C<E.length;C++)for(var c=E[C],u=0,h=v(R);u<h.length;u++){var T=h[u];_.push(X.and(c,T))}i.unshift(X.or.apply(X,_))}return i[0]},a}(),m=function(a){k(i,a);function i(s,l){var S=a.call(this,s)||this;return S._defaultValue=l,S}return i.prototype.bindTo=function(s){return s.createKey(this.key,this._defaultValue)},i.prototype.getValue=function(s){return s.getContextKeyValue(this.key)},i.prototype.toNegated=function(){return X.not(this.key)},i}(P),g=Object(J.c)("contextKeyService"),b="setContext"},"VrN/":function(bt,Se,Q){(function(ue,J){bt.exports=J()})(this,function(){"use strict";var ue=navigator.userAgent,J=navigator.platform,k=/gecko\/\d/i.test(ue),X=/MSIE \d/.test(ue),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),P=/Edge\/(\d+)/.exec(ue),W=X||U||P,B=W&&(X?document.documentMode||6:+(P||U)[1]),O=!P&&/WebKit\//.test(ue),A=O&&/Qt\/\d+\.\d+/.test(ue),d=!P&&/Chrome\//.test(ue),p=/Opera\//.test(ue),w=/Apple Computer/.test(navigator.vendor),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),g=/PhantomJS/.test(ue),b=!P&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),a=/Android/.test(ue),i=b||a||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),s=b||/Mac/.test(J),l=/\bCrOS\b/.test(ue),S=/win/i.test(J),v=p&&ue.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(p=!1,O=!0);var y=s&&(A||p&&(v==null||v<12.11)),R=k||W&&B>=9;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C=function(e,t){var n=e.className,r=_(t).exec(n);if(r){var o=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(o?r[1]+o:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function c(e,t){return E(e).appendChild(t)}function u(e,t,n,r){var o=document.createElement(e);if(n&&(o.className=n),r&&(o.style.cssText=r),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var D=0;D<t.length;++D)o.appendChild(t[D]);return o}function h(e,t,n,r){var o=u(e,t,n,r);return o.setAttribute("role","presentation"),o}var T;document.createRange?T=function(e,t,n,r){var o=document.createRange();return o.setEnd(r||e,n),o.setStart(e,t),o}:T=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(o){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function L(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 I(){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 F(e,t){var n=e.className;_(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!_(n[r]).test(t)&&(t+=" "+n[r]);return t}var z=function(e){e.select()};b?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(z=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Y(e,t,n,r,o){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var D=r||0,H=o||0;;){var Z=e.indexOf(" ",D);if(Z<0||Z>=t)return H+(t-D);H+=Z-D,H+=n-H%n,D=Z+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function le(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var pe=50,Oe={toString:function(){return"CodeMirror.Pass"}},Te={scroll:!1},Re={origin:"*mouse"},Ae={origin:"+move"};function we(e,t,n){for(var r=0,o=0;;){var D=e.indexOf(" ",r);D==-1&&(D=e.length);var H=D-r;if(D==e.length||o+H>=t)return r+Math.min(H,t-o);if(o+=D-r,o+=n-o%n,r=D+1,o>=t)return r}}var ge=[""];function de(e){for(;ge.length<=e;)ge.push(re(ge)+" ");return ge[e]}function re(e){return e[e.length-1]}function ce(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function se(e,t,n){for(var r=0,o=n(t);r<e.length&&n(e[r])<=o;)r++;e.splice(r,0,t)}function ke(){}function ie(e,t){var n;return Object.create?n=Object.create(e):(ke.prototype=e,n=new ke),t&&N(t,n),n}var ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function me(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ae.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&me(e)?!0:t.test(e):me(e)}function Me(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ue=/[\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 je(e){return e.charCodeAt(0)>=768&&Ue.test(e)}function Fe(e,t,n){for(;(n<0?t>0:t<e.length)&&je(e.charAt(t));)t+=n;return t}function Je(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var o=(t+n)/2,D=r<0?Math.ceil(o):Math.floor(o);if(D==t)return e(D)?t:n;e(D)?n=D:t=D+r}}function $e(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var o=!1,D=0;D<e.length;++D){var H=e[D];(H.from<n&&H.to>t||t==n&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,n),H.level==1?"rtl":"ltr",D),o=!0)}o||r(t,n,"ltr")}var Qe=null;function Xe(e,t,n){var r;Qe=null;for(var o=0;o<e.length;++o){var D=e[o];if(D.from<t&&D.to>t)return o;D.to==t&&(D.from!=D.to&&n=="before"?r=o:Qe=o),D.from==t&&(D.from!=D.to&&n!="before"?r=o:Qe=o)}return r!=null?r:Qe}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,D=/[LRr]/,H=/[Lb1n]/,Z=/[1n]/;function q(te,fe,Ee){this.level=te,this.from=fe,this.to=Ee}return function(te,fe){var Ee=fe=="ltr"?"L":"R";if(te.length==0||fe=="ltr"&&!r.test(te))return!1;for(var Pe=te.length,De=[],We=0;We<Pe;++We)De.push(n(te.charCodeAt(We)));for(var Ye=0,rt=Ee;Ye<Pe;++Ye){var ot=De[Ye];ot=="m"?De[Ye]=rt:rt=ot}for(var vt=0,st=Ee;vt<Pe;++vt){var St=De[vt];St=="1"&&st=="r"?De[vt]="n":D.test(St)&&(st=St,St=="r"&&(De[vt]="R"))}for(var Ot=1,Rt=De[0];Ot<Pe-1;++Ot){var zt=De[Ot];zt=="+"&&Rt=="1"&&De[Ot+1]=="1"?De[Ot]="1":zt==","&&Rt==De[Ot+1]&&(Rt=="1"||Rt=="n")&&(De[Ot]=Rt),Rt=zt}for(var dr=0;dr<Pe;++dr){var Or=De[dr];if(Or==",")De[dr]="N";else if(Or=="%"){var pr=void 0;for(pr=dr+1;pr<Pe&&De[pr]=="%";++pr);for(var tn=dr&&De[dr-1]=="!"||pr<Pe&&De[pr]=="1"?"1":"N",Jr=dr;Jr<pr;++Jr)De[Jr]=tn;dr=pr-1}}for(var Cr=0,Zr=Ee;Cr<Pe;++Cr){var Ur=De[Cr];Zr=="L"&&Ur=="1"?De[Cr]="L":D.test(Ur)&&(Zr=Ur)}for(var wr=0;wr<Pe;++wr)if(o.test(De[wr])){var Sr=void 0;for(Sr=wr+1;Sr<Pe&&o.test(De[Sr]);++Sr);for(var mr=(wr?De[wr-1]:Ee)=="L",Qr=(Sr<Pe?De[Sr]:Ee)=="L",ci=mr==Qr?mr?"L":"R":Ee,Mn=wr;Mn<Sr;++Mn)De[Mn]=ci;wr=Sr-1}for(var Br=[],xn,Pr=0;Pr<Pe;)if(H.test(De[Pr])){var Xa=Pr;for(++Pr;Pr<Pe&&H.test(De[Pr]);++Pr);Br.push(new q(0,Xa,Pr))}else{var Tn=Pr,Kn=Br.length,Vn=fe=="rtl"?1:0;for(++Pr;Pr<Pe&&De[Pr]!="L";++Pr);for(var Hr=Tn;Hr<Pr;)if(Z.test(De[Hr])){Tn<Hr&&(Br.splice(Kn,0,new q(1,Tn,Hr)),Kn+=Vn);var hi=Hr;for(++Hr;Hr<Pr&&Z.test(De[Hr]);++Hr);Br.splice(Kn,0,new q(2,hi,Hr)),Kn+=Vn,Tn=Hr}else++Hr;Tn<Pr&&Br.splice(Kn,0,new q(1,Tn,Pr))}return fe=="ltr"&&(Br[0].level==1&&(xn=te.match(/^\s+/))&&(Br[0].from=xn[0].length,Br.unshift(new q(0,0,xn[0].length))),re(Br).level==1&&(xn=te.match(/\s+$/))&&(re(Br).to-=xn[0].length,Br.push(new q(0,Pe-xn[0].length,Pe)))),fe=="rtl"?Br.reverse():Br}}();function tt(e,t){var n=e.order;return n==null&&(n=e.order=dt(e.text,t)),n}var lt=[],Ie=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||lt).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||lt}function it(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,o=r&&r[t];if(o){var D=le(o,n);D>-1&&(r[t]=o.slice(0,D).concat(o.slice(D+1)))}}}function Be(e,t){var n=et(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),o=0;o<n.length;++o)n[o].apply(null,r)}function ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Be(e,n||t.type,e,t),he(t)||t.codemirrorIgnore}function Ce(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)le(n,t[r])==-1&&n.push(t[r])}function ye(e,t){return et(e,t).length>0}function xe(e){e.prototype.on=function(t,n){Ie(this,t,n)},e.prototype.off=function(t,n){it(this,t,n)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ve(e){ne(e),oe(e)}function Ne(e){return e.target||e.srcElement}function Le(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Ke=function(){if(W&&B<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),at;function mt(e){if(at==null){var t=u("span","\u200B");c(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(at=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&B<8))}var n=at?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var pt;function Mt(e){if(pt!=null)return pt;var t=c(e,document.createTextNode("A\u062EA")),n=T(t,0,1).getBoundingClientRect(),r=T(t,1,2).getBoundingClientRect();return E(e),!n||n.left==n.right?!1:pt=r.right-n.right<3}var Pt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var o=e.indexOf(`
`,t);o==-1&&(o=e.length);var D=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),H=D.indexOf("\r");H!=-1?(n.push(D.slice(0,H)),t+=H+1):(n.push(D),t=o+1)}return n}:function(e){return e.split(/\r\n?|\n/)},yt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ht=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Jt=null;function ut(e){if(Jt!=null)return Jt;var t=c(e,u("span","x")),n=t.getBoundingClientRect(),r=T(t,0,1).getBoundingClientRect();return Jt=Math.abs(n.left-r.left)>1}var Zt={},Bt={};function _r(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Zt[e]=t}function Ze(e,t){Bt[e]=t}function gt(e){if(typeof e=="string"&&Bt.hasOwnProperty(e))e=Bt[e];else if(e&&typeof e.name=="string"&&Bt.hasOwnProperty(e.name)){var t=Bt[e.name];typeof t=="string"&&(t={name:t}),e=ie(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 Ct(e,t){t=gt(t);var n=Zt[t.name];if(!n)return Ct(e,"text/plain");var r=n(e,t);if(ht.hasOwnProperty(t.name)){var o=ht[t.name];for(var D in o){if(!o.hasOwnProperty(D))continue;r.hasOwnProperty(D)&&(r["_"+D]=r[D]),r[D]=o[D]}}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 ht={};function At(e,t){var n=ht.hasOwnProperty(e)?ht[e]:ht[e]={};N(t,n)}function rr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var o=t[r];o instanceof Array&&(o=o.concat([])),n[r]=o}return n}function hr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function cr(e,t,n){return e.startState?e.startState(t,n):!0}var Ut=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ut.prototype.eol=function(){return this.pos>=this.string.length},Ut.prototype.sol=function(){return this.pos==this.lineStart},Ut.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ut.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ut.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Ut.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ut.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ut.prototype.skipToEnd=function(){this.pos=this.string.length},Ut.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ut.prototype.backUp=function(e){this.pos-=e},Ut.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)},Ut.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(H){return n?H.toLowerCase():H},o=this.string.substr(this.pos,e.length);if(r(o)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var D=this.string.slice(this.pos).match(e);return D&&D.index>0?null:(D&&t!==!1&&(this.pos+=D[0].length),D)}},Ut.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ut.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ut.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ut.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function xt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var o=n.children[r],D=o.chunkSize();if(t<D){n=o;break}t-=D}return n.lines[t]}function Mr(e,t,n){var r=[],o=t.line;return e.iter(t.line,n.line+1,function(D){var H=D.text;o==n.line&&(H=H.slice(0,n.ch)),o==t.line&&(H=H.slice(t.ch)),r.push(H),++o}),r}function rn(e,t,n){var r=[];return e.iter(t,n,function(o){r.push(o.text)}),r}function Ar(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ft(e){if(e.parent==null)return null;for(var t=e.parent,n=le(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var o=0;!(r.children[o]==t);++o)n+=r.children[o].chunkSize();return n+t.first}function Ir(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var o=e.children[r],D=o.height;if(t<D){e=o;continue e}t-=D,n+=o.chunkSize()}return n}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Z=e.lines[H],q=Z.height;if(t<q)break;t-=q}return n+H}function Tr(e,t){return t>=e.first&&t<e.first+e.size}function nn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function He(e,t,n){if(n===void 0&&(n=null),!(this instanceof He))return new He(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function Wt(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function qt(e){return He(e.line,e.ch)}function nr(e,t){return ft(e,t)<0?t:e}function ir(e,t){return ft(e,t)<0?e:t}function K(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function f(e,t){if(t.line<e.first)return He(e.first,0);var n=e.first+e.size-1;return t.line>n?He(n,xt(e,n).text.length):x(t,xt(e,t.line).text.length)}function x(e,t){var n=e.ch;return n==null||n>t?He(e.line,t):n<0?He(e.line,0):e}function G(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=f(e,t[r]);return n}var $=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,n){return t instanceof $?new V(e,rr(e.mode,t.state),n,t.lookAhead):new V(e,rr(e.mode,t),n)},V.prototype.save=function(e){var t=e!==!1?rr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new $(t,this.maxLookAhead):t};function be(e,t,n,r){var o=[e.state.modeGen],D={};Gr(e,t.text,e.doc.mode,n,function(te,fe){return o.push(te,fe)},D,r);for(var H=n.state,Z=function(te){n.baseTokens=o;var fe=e.state.overlays[te],Ee=1,Pe=0;n.state=!0,Gr(e,t.text,fe.mode,n,function(De,We){for(var Ye=Ee;Pe<De;){var rt=o[Ee];rt>De&&o.splice(Ee,1,De,o[Ee+1],rt),Ee+=2,Pe=Math.min(De,rt)}if(!We)return;if(fe.opaque)o.splice(Ye,Ee-Ye,De,"overlay "+We),Ee=Ye+2;else for(;Ye<Ee;Ye+=2){var ot=o[Ye+1];o[Ye+1]=(ot?ot+" ":"")+"overlay "+We}},D),n.state=H,n.baseTokens=null,n.baseTokenPos=1},q=0;q<e.state.overlays.length;++q)Z(q);return{styles:o,classes:D.bgClass||D.textClass?D:null}}function Ge(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=nt(e,Ft(t)),o=t.text.length>e.options.maxHighlightLength&&rr(e.doc.mode,r.state),D=be(e,t,r);o&&(r.state=o),t.stateAfter=r.save(!o),t.styles=D.styles,D.classes?t.styleClasses=D.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function nt(e,t,n){var r=e.doc,o=e.display;if(!r.mode.startState)return new V(r,!0,t);var D=gr(e,t,n),H=D>r.first&&xt(r,D-1).stateAfter,Z=H?V.fromSaved(r,H,D):new V(r,cr(r.mode),D);return r.iter(D,t,function(q){Et(e,q.text,Z);var te=Z.line;q.stateAfter=te==t-1||te%5==0||te>=o.viewFrom&&te<o.viewTo?Z.save():null,Z.nextLine()}),n&&(r.modeFrontier=Z.line),Z}function Et(e,t,n,r){var o=e.doc.mode,D=new Ut(t,e.options.tabSize,n);for(D.start=D.pos=r||0,t==""&&Ve(o,n.state);!D.eol();)kt(o,D,n.state),D.start=D.pos}function Ve(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=hr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function kt(e,t,n,r){for(var o=0;o<10;o++){r&&(r[0]=hr(e,n).mode);var D=e.token(t,n);if(t.pos>t.start)return D}throw new Error("Mode "+e.name+" failed to advance stream.")}var Kt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function sr(e,t,n,r){var o=e.doc,D=o.mode,H;t=f(o,t);var Z=xt(o,t.line),q=nt(e,t.line,n),te=new Ut(Z.text,e.options.tabSize,q),fe;for(r&&(fe=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,H=kt(D,te,q.state),r&&fe.push(new Kt(te,H,rr(o.mode,q.state)));return r?fe:new Kt(te,H,q.state)}function jr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Gr(e,t,n,r,o,D,H){var Z=n.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var q=0,te=null,fe=new Ut(t,e.options.tabSize,r),Ee,Pe=e.options.addModeClass&&[null];for(t==""&&jr(Ve(n,r.state),D);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(Z=!1,H&&Et(e,t,r,fe.pos),fe.pos=t.length,Ee=null):Ee=jr(kt(n,fe,r.state,Pe),D),Pe){var De=Pe[0].name;De&&(Ee="m-"+(Ee?De+" "+Ee:De))}if(!Z||te!=Ee){for(;q<fe.start;)q=Math.min(fe.start,q+5e3),o(q,te);te=Ee}fe.start=fe.pos}for(;q<fe.pos;){var We=Math.min(fe.pos,q+5e3);o(We,te),q=We}}function gr(e,t,n){for(var r,o,D=e.doc,H=n?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>H;--Z){if(Z<=D.first)return D.first;var q=xt(D,Z-1),te=q.stateAfter;if(te&&(!n||Z+(te instanceof $?te.lookAhead:0)<=D.modeFrontier))return Z;var fe=Y(q.text,null,e.options.tabSize);(o==null||r>fe)&&(o=Z-1,r=fe)}return o}function zr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var o=xt(e,r).stateAfter;if(o&&(!(o instanceof $)||r+o.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var an=!1,br=!1;function Lr(){an=!0}function Er(){br=!0}function gn(e,t,n){this.marker=e,this.from=t,this.to=n}function Kr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function cn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function on(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function In(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var D=e[o],H=D.marker,Z=D.from==null||(H.inclusiveLeft?D.from<=t:D.from<t);if(Z||D.from==t&&H.type=="bookmark"&&(!n||!D.marker.insertLeft)){var q=D.to==null||(H.inclusiveRight?D.to>=t:D.to>t);(r||(r=[])).push(new gn(H,D.from,q?null:D.to))}}return r}function vn(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var D=e[o],H=D.marker,Z=D.to==null||(H.inclusiveRight?D.to>=t:D.to>t);if(Z||D.from==t&&H.type=="bookmark"&&(!n||D.marker.insertLeft)){var q=D.from==null||(H.inclusiveLeft?D.from<=t:D.from<t);(r||(r=[])).push(new gn(H,q?null:D.from-t,D.to==null?null:D.to-t))}}return r}function qe(e,t){if(t.full)return null;var n=Tr(e,t.from.line)&&xt(e,t.from.line).markedSpans,r=Tr(e,t.to.line)&&xt(e,t.to.line).markedSpans;if(!n&&!r)return null;var o=t.from.ch,D=t.to.ch,H=ft(t.from,t.to)==0,Z=In(n,o,H),q=vn(r,D,H),te=t.text.length==1,fe=re(t.text).length+(te?o:0);if(Z)for(var Ee=0;Ee<Z.length;++Ee){var Pe=Z[Ee];if(Pe.to==null){var De=Kr(q,Pe.marker);De?te&&(Pe.to=De.to==null?null:De.to+fe):Pe.to=o}}if(q)for(var We=0;We<q.length;++We){var Ye=q[We];if(Ye.to!=null&&(Ye.to+=fe),Ye.from==null){var rt=Kr(Z,Ye.marker);rt||(Ye.from=fe,te&&(Z||(Z=[])).push(Ye))}else Ye.from+=fe,te&&(Z||(Z=[])).push(Ye)}Z&&(Z=It(Z)),q&&q!=Z&&(q=It(q));var ot=[Z];if(!te){var vt=t.text.length-2,st;if(vt>0&&Z)for(var St=0;St<Z.length;++St)Z[St].to==null&&(st||(st=[])).push(new gn(Z[St].marker,null,null));for(var Ot=0;Ot<vt;++Ot)ot.push(st);ot.push(q)}return ot}function It(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Vt(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(De){if(De.markedSpans)for(var We=0;We<De.markedSpans.length;++We){var Ye=De.markedSpans[We].marker;Ye.readOnly&&(!r||le(r,Ye)==-1)&&(r||(r=[])).push(Ye)}}),!r)return null;for(var o=[{from:t,to:n}],D=0;D<r.length;++D)for(var H=r[D],Z=H.find(0),q=0;q<o.length;++q){var te=o[q];if(ft(te.to,Z.from)<0||ft(te.from,Z.to)>0)continue;var fe=[q,1],Ee=ft(te.from,Z.from),Pe=ft(te.to,Z.to);(Ee<0||!H.inclusiveLeft&&!Ee)&&fe.push({from:te.from,to:Z.from}),(Pe>0||!H.inclusiveRight&&!Pe)&&fe.push({from:Z.to,to:te.to}),o.splice.apply(o,fe),q+=fe.length-3}return o}function ct(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function $t(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Lt(e){return e.inclusiveLeft?-1:0}function Tt(e){return e.inclusiveRight?1:0}function wt(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),o=t.find(),D=ft(r.from,o.from)||Lt(e)-Lt(t);if(D)return-D;var H=ft(r.to,o.to)||Tt(e)-Tt(t);return H||t.id-e.id}function jt(e,t){var n=br&&e.markedSpans,r;if(n)for(var o=void 0,D=0;D<n.length;++D)o=n[D],o.marker.collapsed&&(t?o.from:o.to)==null&&(!r||wt(r,o.marker)<0)&&(r=o.marker);return r}function er(e){return jt(e,!0)}function Gt(e){return jt(e,!1)}function yn(e,t){var n=br&&e.markedSpans,r;if(n)for(var o=0;o<n.length;++o){var D=n[o];D.marker.collapsed&&(D.from==null||D.from<t)&&(D.to==null||D.to>t)&&(!r||wt(r,D.marker)<0)&&(r=D.marker)}return r}function vr(e,t,n,r,o){var D=xt(e,t),H=br&&D.markedSpans;if(H)for(var Z=0;Z<H.length;++Z){var q=H[Z];if(!q.marker.collapsed)continue;var te=q.marker.find(0),fe=ft(te.from,n)||Lt(q.marker)-Lt(o),Ee=ft(te.to,r)||Tt(q.marker)-Tt(o);if(fe>=0&&Ee<=0||fe<=0&&Ee>=0)continue;if(fe<=0&&(q.marker.inclusiveRight&&o.inclusiveLeft?ft(te.to,n)>=0:ft(te.to,n)>0)||fe>=0&&(q.marker.inclusiveRight&&o.inclusiveLeft?ft(te.from,r)<=0:ft(te.from,r)<0))return!0}}function Vr(e){for(var t;t=er(e);)e=t.find(-1,!0).line;return e}function Xn(e){for(var t;t=Gt(e);)e=t.find(1,!0).line;return e}function Yn(e){for(var t,n;t=Gt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function wn(e,t){var n=xt(e,t),r=Vr(n);return n==r?t:Ft(r)}function Bi(e,t){if(t>e.lastLine())return t;var n=xt(e,t),r;if(!qr(e,n))return t;for(;r=Gt(n);)n=r.find(1,!0).line;return Ft(n)+1}function qr(e,t){var n=br&&t.markedSpans;if(n)for(var r=void 0,o=0;o<n.length;++o){if(r=n[o],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fi(e,t,r))return!0}}function fi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return fi(e,r.line,Kr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var o=void 0,D=0;D<t.markedSpans.length;++D)if(o=t.markedSpans[D],o.marker.collapsed&&!o.marker.widgetNode&&o.from==n.to&&(o.to==null||o.to!=n.from)&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&fi(e,t,o))return!0}function hn(e){e=Vr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var o=n.lines[r];if(o==e)break;t+=o.height}for(var D=n.parent;D;n=D,D=n.parent)for(var H=0;H<D.children.length;++H){var Z=D.children[H];if(Z==n)break;t+=Z.height}return t}function $n(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=er(r);){var o=n.find(0,!0);r=o.from.line,t+=o.from.ch-o.to.ch}for(r=e;n=Gt(r);){var D=n.find(0,!0);t-=r.text.length-D.from.ch,r=D.to.line,t+=r.text.length-D.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=xt(n,n.first),t.maxLineLength=$n(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var o=$n(r);o>t.maxLineLength&&(t.maxLineLength=o,t.maxLine=r)})}var Nn=function(e,t,n){this.text=e,$t(this,t),this.height=n?n(this):1};Nn.prototype.lineNo=function(){return Ft(this)},xe(Nn);function $a(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ct(e),$t(e,n);var o=r?r(e):1;o!=e.height&&Ar(e,o)}function da(e){e.parent=null,ct(e)}var _t={},Nt={};function Dt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Nt:_t;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,t){var n=h("span",null,null,O?"padding-right: .1px":null),r={pre:h("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var D=o?t.rest[o-1]:t.line,H=void 0;r.pos=0,r.addToken=lr,Mt(e.display.measure)&&(H=tt(D,e.doc.direction))&&(r.addToken=xr(r.addToken,H)),r.map=[];var Z=t!=e.display.externalMeasured&&Ft(D);Yt(D,r,Ge(e,D,Z)),D.styleClasses&&(D.styleClasses.bgClass&&(r.bgClass=j(D.styleClasses.bgClass,r.bgClass||"")),D.styleClasses.textClass&&(r.textClass=j(D.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(mt(e.display.measure))),o==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(O){var q=r.content.lastChild;(/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function tr(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function lr(e,t,n,r,o,D,H){if(!t)return;var Z=e.splitSpaces?Qt(t,e.trailingSpace):t,q=e.cm.state.specialChars,te=!1,fe;if(!q.test(t))e.col+=t.length,fe=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,fe),W&&B<9&&(te=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var Ee=0;;){q.lastIndex=Ee;var Pe=q.exec(t),De=Pe?Pe.index-Ee:t.length-Ee;if(De){var We=document.createTextNode(Z.slice(Ee,Ee+De));W&&B<9?fe.appendChild(u("span",[We])):fe.appendChild(We),e.map.push(e.pos,e.pos+De,We),e.col+=De,e.pos+=De}if(!Pe)break;Ee+=De+1;var Ye=void 0;if(Pe[0]==" "){var rt=e.cm.options.tabSize,ot=rt-e.col%rt;Ye=fe.appendChild(u("span",de(ot),"cm-tab")),Ye.setAttribute("role","presentation"),Ye.setAttribute("cm-text"," "),e.col+=ot}else Pe[0]=="\r"||Pe[0]==`
`?(Ye=fe.appendChild(u("span",Pe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ye.setAttribute("cm-text",Pe[0]),e.col+=1):(Ye=e.cm.options.specialCharPlaceholder(Pe[0]),Ye.setAttribute("cm-text",Pe[0]),W&&B<9?fe.appendChild(u("span",[Ye])):fe.appendChild(Ye),e.col+=1);e.map.push(e.pos,e.pos+1,Ye),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,n||r||o||te||D||H){var vt=n||"";r&&(vt+=r),o&&(vt+=o);var st=u("span",[fe],vt,D);if(H)for(var St in H)H.hasOwnProperty(St)&&St!="style"&&St!="class"&&st.setAttribute(St,H[St]);return e.content.appendChild(st)}e.content.appendChild(fe)}function Qt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",o=0;o<e.length;o++){var D=e.charAt(o);D==" "&&n&&(o==e.length-1||e.charCodeAt(o+1)==32)&&(D="\xA0"),r+=D,n=D==" "}return r}function xr(e,t){return function(n,r,o,D,H,Z,q){o=o?o+" cm-force-border":"cm-force-border";for(var te=n.pos,fe=te+r.length;;){for(var Ee=void 0,Pe=0;Pe<t.length&&!(Ee=t[Pe],Ee.to>te&&Ee.from<=te);Pe++);if(Ee.to>=fe)return e(n,r,o,D,H,Z,q);e(n,r.slice(0,Ee.to-te),o,D,null,Z,q),D=null,r=r.slice(Ee.to-te),te=Ee.to}}}function Xr(e,t,n,r){var o=!r&&n.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!r&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",n.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function Yt(e,t,n){var r=e.markedSpans,o=e.text,D=0;if(!r){for(var H=1;H<n.length;H+=2)t.addToken(t,o.slice(D,D=n[H]),Dt(n[H+1],t.cm.options));return}for(var Z=o.length,q=0,te=1,fe="",Ee,Pe,De=0,We,Ye,rt,ot,vt;;){if(De==q){We=Ye=rt=Pe="",vt=null,ot=null,De=Infinity;for(var st=[],St=void 0,Ot=0;Ot<r.length;++Ot){var Rt=r[Ot],zt=Rt.marker;if(zt.type=="bookmark"&&Rt.from==q&&zt.widgetNode)st.push(zt);else if(Rt.from<=q&&(Rt.to==null||Rt.to>q||zt.collapsed&&Rt.to==q&&Rt.from==q)){if(Rt.to!=null&&Rt.to!=q&&De>Rt.to&&(De=Rt.to,Ye=""),zt.className&&(We+=" "+zt.className),zt.css&&(Pe=(Pe?Pe+";":"")+zt.css),zt.startStyle&&Rt.from==q&&(rt+=" "+zt.startStyle),zt.endStyle&&Rt.to==De&&(St||(St=[])).push(zt.endStyle,Rt.to),zt.title&&((vt||(vt={})).title=zt.title),zt.attributes)for(var dr in zt.attributes)(vt||(vt={}))[dr]=zt.attributes[dr];zt.collapsed&&(!ot||wt(ot.marker,zt)<0)&&(ot=Rt)}else Rt.from>q&&De>Rt.from&&(De=Rt.from)}if(St)for(var Or=0;Or<St.length;Or+=2)St[Or+1]==De&&(Ye+=" "+St[Or]);if(!ot||ot.from==q)for(var pr=0;pr<st.length;++pr)Xr(t,0,st[pr]);if(ot&&(ot.from||0)==q){if(Xr(t,(ot.to==null?Z+1:ot.to)-q,ot.marker,ot.from==null),ot.to==null)return;ot.to==q&&(ot=!1)}}if(q>=Z)break;for(var tn=Math.min(Z,De);;){if(fe){var Jr=q+fe.length;if(!ot){var Cr=Jr>tn?fe.slice(0,tn-q):fe;t.addToken(t,Cr,Ee?Ee+We:We,rt,q+Cr.length==De?Ye:"",Pe,vt)}if(Jr>=tn){fe=fe.slice(tn-q),q=tn;break}q=Jr,rt=""}fe=o.slice(D,D=n[te++]),Ee=Dt(n[te++],t.cm.options)}}}function _n(e,t,n){this.line=t,this.rest=Yn(t),this.size=this.rest?Ft(re(this.rest))-n+1:1,this.node=this.text=null,this.hidden=qr(e,t)}function ar(e,t,n){for(var r=[],o,D=t;D<n;D=o){var H=new _n(e.doc,xt(e.doc,D),D);o=D+H.size,r.push(H)}return r}var Rr=null;function un(e){Rr?Rr.ops.push(e):e.ownsGroup=Rr={ops:[e],delayedCallbacks:[]}}function dn(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var o=e.ops[r];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(n<t.length)}function Wi(e,t){var n=e.ownsGroup;if(!n)return;try{dn(n)}finally{Rr=null,t(n)}}var pi=null;function Nr(e,t){var n=et(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),o;Rr?o=Rr.delayedCallbacks:pi?o=pi:(o=pi=[],setTimeout(Os,0));for(var D=function(Z){o.push(function(){return n[Z].apply(null,r)})},H=0;H<n.length;++H)D(H)}function Os(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var o=0;o<t.changes.length;o++){var D=t.changes[o];D=="text"?Ms(e,t):D=="gutter"?Qa(e,t,n,r):D=="class"?ca(e,t):D=="widget"&&Is(e,t,r)}t.changes=null}function mi(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&B<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=mi(t);t.background=r.insertBefore(u("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Xt(e,t)}function Ms(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ps(e,t),t.line.wrapClass?mi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=mi(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var D=t.line.gutterMarkers;if(e.options.lineNumbers||D){var H=mi(t),Z=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),H.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!D||!D["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(u("div",nn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),D)for(var q=0;q<e.display.gutterSpecs.length;++q){var te=e.display.gutterSpecs[q].className,fe=D.hasOwnProperty(te)&&D[te];fe&&Z.appendChild(u("div",[fe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=_("CodeMirror-linewidget"),o=t.node.firstChild,D=void 0;o;o=D)D=o.nextSibling,r.test(o.className)&&t.node.removeChild(o);qa(e,t,n)}function Ns(e,t,n,r){var o=Za(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),ca(e,t),Qa(e,t,n,r),qa(e,t,r),t.node}function qa(e,t,n){if(eo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,n,!1)}function eo(e,t,n,r,o){if(!t.widgets)return;for(var D=mi(n),H=0,Z=t.widgets;H<Z.length;++H){var q=Z[H],te=u("div",[q.node],"CodeMirror-linewidget"+(q.className?" "+q.className:""));q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Us(q,te,n,r),e.display.input.setUneditable(te),o&&q.above?D.insertBefore(te,n.gutter||n.text):D.appendChild(te),Nr(q,"redraw")}}function Us(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var o=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(o-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!L(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),c(t.display.measure,u("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Cn(e,t){for(var n=Ne(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Hi(e){return e.lineSpace.offsetTop}function ha(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=c(e.measure,u("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function bn(e){return pe-e.display.nativeBarWidth}function Un(e){return e.display.scroller.clientWidth-bn(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-bn(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,o=r&&Un(e);if(!t.measure.heights||r&&t.measure.width!=o){var D=t.measure.heights=[];if(r){t.measure.width=o;for(var H=t.text.firstChild.getClientRects(),Z=0;Z<H.length-1;Z++){var q=H[Z],te=H[Z+1];Math.abs(q.bottom-te.bottom)>2&&D.push((q.bottom+te.top)/2-n.top)}}D.push(n.bottom-n.top)}}function ro(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var o=0;o<e.rest.length;o++)if(Ft(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Bs(e,t){t=Vr(t);var n=Ft(t),r=e.display.externalMeasured=new _n(e.doc,t,n);r.lineN=n;var o=r.built=Xt(e,r);return r.text=o.pre,c(e.display.lineMeasure,o.pre),r}function no(e,t,n,r){return En(e,Jn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[jn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Jn(e,t){var n=Ft(t),r=pa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var o=ro(r,t,n);return{line:t,view:r,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function En(e,t,n,r,o){t.before&&(n=-1);var D=n+(r||""),H;return t.cache.hasOwnProperty(D)?H=t.cache[D]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,n,r),H.bogus||(t.cache[D]=H)),{left:H.left,right:H.right,top:o?H.rtop:H.top,bottom:o?H.rbottom:H.bottom}}var io={left:0,right:0,top:0,bottom:0};function ao(e,t,n){for(var r,o,D,H,Z,q,te=0;te<e.length;te+=3)if(Z=e[te],q=e[te+1],t<Z?(o=0,D=1,H="left"):t<q?(o=t-Z,D=o+1):(te==e.length-3||t==q&&e[te+3]>t)&&(D=q-Z,o=D-1,t>=q&&(H="right")),o!=null){if(r=e[te+2],Z==q&&n==(r.insertLeft?"left":"right")&&(H=n),n=="left"&&o==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],H="left";if(n=="right"&&o==q-Z)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],H="right";break}return{node:r,start:o,end:D,collapse:H,coverStart:Z,coverEnd:q}}function js(e,t){var n=io;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var o=e.length-1;o>=0&&!((n=e[o]).left!=n.right);o--);return n}function Ws(e,t,n,r){var o=ao(t.map,n,r),D=o.node,H=o.start,Z=o.end,q=o.collapse,te;if(D.nodeType==3){for(var fe=0;fe<4;fe++){for(;H&&je(t.line.text.charAt(o.coverStart+H));)--H;for(;o.coverStart+Z<o.coverEnd&&je(t.line.text.charAt(o.coverStart+Z));)++Z;if(W&&B<9&&H==0&&Z==o.coverEnd-o.coverStart?te=D.parentNode.getBoundingClientRect():te=js(T(D,H,Z).getClientRects(),r),te.left||te.right||H==0)break;Z=H,H=H-1,q="right"}W&&B<11&&(te=Hs(e.display.measure,te))}else{H>0&&(q=r="right");var Ee;e.options.lineWrapping&&(Ee=D.getClientRects()).length>1?te=Ee[r=="right"?Ee.length-1:0]:te=D.getBoundingClientRect()}if(W&&B<9&&!H&&(!te||!te.left&&!te.right)){var Pe=D.parentNode.getClientRects()[0];Pe?te={left:Pe.left,right:Pe.left+Qn(e.display),top:Pe.top,bottom:Pe.bottom}:te=io}for(var De=te.top-t.rect.top,We=te.bottom-t.rect.top,Ye=(De+We)/2,rt=t.view.measure.heights,ot=0;ot<rt.length-1&&!(Ye<rt[ot]);ot++);var vt=ot?rt[ot-1]:0,st=rt[ot],St={left:(q=="right"?te.right:te.left)-t.rect.left,right:(q=="left"?te.left:te.right)-t.rect.left,top:vt,bottom:st};return!te.left&&!te.right&&(St.bogus=!0),e.options.singleCursorHeightPerLine||(St.rtop=De,St.rbottom=We),St}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!ut(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,E(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vi(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return d&&a?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return d&&a?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=gi(e.widgets[n]));return t}function Gi(e,t,n,r,o){if(!o){var D=ma(t);n.top+=D,n.bottom+=D}if(r=="line")return n;r||(r="local");var H=hn(t);if(r=="local"?H+=Hi(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Z=e.display.lineSpace.getBoundingClientRect();H+=Z.top+(r=="window"?0:uo());var q=Z.left+(r=="window"?0:lo());n.left+=q,n.right+=q}return n.top+=H,n.bottom+=H,n}function co(e,t,n){if(n=="div")return t;var r=t.left,o=t.top;if(n=="page")r-=lo(),o-=uo();else if(n=="local"||!n){var D=e.display.sizer.getBoundingClientRect();r+=D.left,o+=D.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:o-H.top}}function ga(e,t,n,r,o){return r||(r=xt(e.doc,t.line)),Gi(e,r,no(e,r,t.ch,o),n)}function fn(e,t,n,r,o,D){r=r||xt(e.doc,t.line),o||(o=Jn(e,r));function H(We,Ye){var rt=En(e,o,We,Ye?"right":"left",D);return Ye?rt.left=rt.right:rt.right=rt.left,Gi(e,r,rt,n)}var Z=tt(r,e.doc.direction),q=t.ch,te=t.sticky;if(q>=r.text.length?(q=r.text.length,te="before"):q<=0&&(q=0,te="after"),!Z)return H(te=="before"?q-1:q,te=="before");function fe(We,Ye,rt){var ot=Z[Ye],vt=ot.level==1;return H(rt?We-1:We,vt!=rt)}var Ee=Xe(Z,q,te),Pe=Qe,De=fe(q,Ee,te=="before");return Pe!=null&&(De.other=fe(q,Pe,te!="before")),De}function ho(e,t){var n=0;t=f(e.doc,t),e.options.lineWrapping||(n=Qn(e.display)*t.ch);var r=xt(e.doc,t.line),o=hn(r)+Hi(e.display);return{left:n,right:n,top:o,bottom:o+r.height}}function va(e,t,n,r,o){var D=He(e,t,n);return D.xRel=o,r&&(D.outside=r),D}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var o=Ir(r,n),D=r.first+r.size-1;if(o>D)return va(r.first+r.size-1,xt(r,D).text.length,null,1,1);t<0&&(t=0);for(var H=xt(r,o);;){var Z=Gs(e,H,o,t,n),q=yn(H,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!q)return Z;var te=q.find(1);if(te.line==o)return te;H=xt(r,o=te.line)}}function fo(e,t,n,r){r-=ma(t);var o=t.text.length,D=Je(function(H){return En(e,n,H-1).bottom<=r},o,0);return o=Je(function(H){return En(e,n,H).top>r},D,o),{begin:D,end:o}}function po(e,t,n,r){n||(n=Jn(e,t));var o=Gi(e,t,En(e,n,r),"line").top;return fo(e,t,n,o)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Gs(e,t,n,r,o){o-=hn(t);var D=Jn(e,t),H=ma(t),Z=0,q=t.text.length,te=!0,fe=tt(t,e.doc.direction);if(fe){var Ee=(e.options.lineWrapping?Ks:zs)(e,t,n,D,fe,r,o);te=Ee.level!=1,Z=te?Ee.from:Ee.to-1,q=te?Ee.to:Ee.from-1}var Pe=null,De=null,We=Je(function(Ot){var Rt=En(e,D,Ot);return Rt.top+=H,Rt.bottom+=H,ba(Rt,r,o,!1)?(Rt.top<=o&&Rt.left<=r&&(Pe=Ot,De=Rt),!0):!1},Z,q),Ye,rt,ot=!1;if(De){var vt=r-De.left<De.right-r,st=vt==te;We=Pe+(st?0:1),rt=st?"after":"before",Ye=vt?De.left:De.right}else{!te&&(We==q||We==Z)&&We++,rt=We==0?"after":We==t.text.length?"before":En(e,D,We-(te?1:0)).bottom+H<=o==te?"after":"before";var St=fn(e,He(n,We,rt),"line",t,D);Ye=St.left,ot=o<St.top?-1:o>=St.bottom?1:0}return We=Fe(t.text,We,1),va(n,We,rt,ot,r-Ye)}function zs(e,t,n,r,o,D,H){var Z=Je(function(Ee){var Pe=o[Ee],De=Pe.level!=1;return ba(fn(e,He(n,De?Pe.to:Pe.from,De?"before":"after"),"line",t,r),D,H,!0)},0,o.length-1),q=o[Z];if(Z>0){var te=q.level!=1,fe=fn(e,He(n,te?q.from:q.to,te?"after":"before"),"line",t,r);ba(fe,D,H,!0)&&fe.top>H&&(q=o[Z-1])}return q}function Ks(e,t,n,r,o,D,H){var Z=fo(e,t,r,H),q=Z.begin,te=Z.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var fe=null,Ee=null,Pe=0;Pe<o.length;Pe++){var De=o[Pe];if(De.from>=te||De.to<=q)continue;var We=De.level!=1,Ye=En(e,r,We?Math.min(te,De.to)-1:Math.max(q,De.from)).right,rt=Ye<D?D-Ye+1e9:Ye-D;(!fe||Ee>rt)&&(fe=De,Ee=rt)}return fe||(fe=o[o.length-1]),fe.from<q&&(fe={from:q,to:fe.to,level:fe.level}),fe.to>te&&(fe={from:fe.from,to:te,level:fe.level}),fe}var Fn;function Zn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Fn==null){Fn=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Fn.appendChild(document.createTextNode("x")),Fn.appendChild(u("br"));Fn.appendChild(document.createTextNode("x"))}c(e.measure,Fn);var n=Fn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),E(e.measure),n||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),n=u("pre",[t],"CodeMirror-line-like");c(e.measure,n);var r=t.getBoundingClientRect(),o=(r.right-r.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function Ea(e){for(var t=e.display,n={},r={},o=t.gutters.clientLeft,D=t.gutters.firstChild,H=0;D;D=D.nextSibling,++H){var Z=e.display.gutterSpecs[H].className;n[Z]=D.offsetLeft+D.clientLeft+o,r[Z]=D.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=Zn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(o){if(qr(e.doc,o))return 0;var D=0;if(o.widgets)for(var H=0;H<o.widgets.length;H++)o.widgets[H].height&&(D+=o.widgets[H].height);return n?D+(Math.ceil(o.text.length/r)||1)*t:D+t}}function Ca(e){var t=e.doc,n=mo(e);t.iter(function(r){var o=n(r);o!=r.height&&Ar(r,o)})}function Bn(e,t,n,r){var o=e.display;if(!n&&Ne(t).getAttribute("cm-not-content")=="true")return null;var D,H,Z=o.lineSpace.getBoundingClientRect();try{D=t.clientX-Z.left,H=t.clientY-Z.top}catch(Ee){return null}var q=ya(e,D,H),te;if(r&&q.xRel>0&&(te=xt(e.doc,q.line).text).length==q.ch){var fe=Y(te,te.length,e.options.tabSize)-te.length;q=He(q.line,Math.max(0,Math.round((D-to(e.display).left)/Qn(e.display))-fe))}return q}function jn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Yr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var o=e.display;if(r&&n<o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)br&&wn(e.doc,t)<o.viewTo&&Ln(e);else if(n<=o.viewFrom)br&&Bi(e.doc,n+r)>o.viewFrom?Ln(e):(o.viewFrom+=r,o.viewTo+=r);else if(t<=o.viewFrom&&n>=o.viewTo)Ln(e);else if(t<=o.viewFrom){var D=zi(e,n,n+r,1);D?(o.view=o.view.slice(D.index),o.viewFrom=D.lineN,o.viewTo+=r):Ln(e)}else if(n>=o.viewTo){var H=zi(e,t,t,-1);H?(o.view=o.view.slice(0,H.index),o.viewTo=H.lineN):Ln(e)}else{var Z=zi(e,t,t,-1),q=zi(e,n,n+r,1);Z&&q?(o.view=o.view.slice(0,Z.index).concat(ar(e,Z.lineN,q.lineN)).concat(o.view.slice(q.index)),o.viewTo+=r):Ln(e)}var te=o.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(o.externalMeasured=null))}function An(e,t,n){e.curOp.viewChanged=!0;var r=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var D=r.view[jn(e,t)];if(D.node==null)return;var H=D.changes||(D.changes=[]);le(H,n)==-1&&H.push(n)}function Ln(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zi(e,t,n,r){var o=jn(e,t),D,H=e.display.view;if(!br||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var Z=e.display.viewFrom,q=0;q<o;q++)Z+=H[q].size;if(Z!=t){if(r>0){if(o==H.length-1)return null;D=Z+H[o].size-t,o++}else D=Z-t;t+=D,n+=D}for(;wn(e.doc,n)!=n;){if(o==(r<0?0:H.length-1))return null;n+=r*H[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Vs(e,t,n){var r=e.display,o=r.view;o.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=ar(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=ar(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(jn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(ar(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,jn(e,n)))),r.viewTo=n}function go(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var o=t[r];!o.hidden&&(!o.node||o.changes)&&++n}return n}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},o=r.cursors=document.createDocumentFragment(),D=r.selection=document.createDocumentFragment(),H=0;H<n.sel.ranges.length;H++){if(!t&&H==n.sel.primIndex)continue;var Z=n.sel.ranges[H];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var q=Z.empty();(q||e.options.showCursorWhenSelecting)&&yo(e,Z.head,o),q||Xs(e,Z,D)}return r}function yo(e,t,n){var r=fn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=n.appendChild(u("div","\xA0","CodeMirror-cursor"));if(o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var D=n.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));D.style.display="",D.style.left=r.other.left+"px",D.style.top=r.other.top+"px",D.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,o=e.doc,D=document.createDocumentFragment(),H=to(e.display),Z=H.left,q=Math.max(r.sizerWidth,Un(e)-r.sizer.offsetLeft)-H.right,te=o.direction=="ltr";function fe(st,St,Ot,Rt){St<0&&(St=0),St=Math.round(St),Rt=Math.round(Rt),D.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+st+`px;
top: `+St+"px; width: "+(Ot==null?q-st:Ot)+`px;
height: `+(Rt-St)+"px"))}function Ee(st,St,Ot){var Rt=xt(o,st),zt=Rt.text.length,dr,Or;function pr(Cr,Zr){return ga(e,He(st,Cr),"div",Rt,Zr)}function tn(Cr,Zr,Ur){var wr=po(e,Rt,null,Cr),Sr=Zr=="ltr"==(Ur=="after")?"left":"right",mr=Ur=="after"?wr.begin:wr.end-(/\s/.test(Rt.text.charAt(wr.end-1))?2:1);return pr(mr,Sr)[Sr]}var Jr=tt(Rt,o.direction);return $e(Jr,St||0,Ot==null?zt:Ot,function(Cr,Zr,Ur,wr){var Sr=Ur=="ltr",mr=pr(Cr,Sr?"left":"right"),Qr=pr(Zr-1,Sr?"right":"left"),ci=St==null&&Cr==0,Mn=Ot==null&&Zr==zt,Br=wr==0,xn=!Jr||wr==Jr.length-1;if(Qr.top-mr.top<=3){var Pr=(te?ci:Mn)&&Br,Xa=(te?Mn:ci)&&xn,Tn=Pr?Z:(Sr?mr:Qr).left,Kn=Xa?q:(Sr?Qr:mr).right;fe(Tn,mr.top,Kn-Tn,mr.bottom)}else{var Vn,Hr,hi,Ya;Sr?(Vn=te&&ci&&Br?Z:mr.left,Hr=te?q:tn(Cr,Ur,"before"),hi=te?Z:tn(Zr,Ur,"after"),Ya=te&&Mn&&xn?q:Qr.right):(Vn=te?tn(Cr,Ur,"before"):Z,Hr=!te&&ci&&Br?q:mr.right,hi=!te&&Mn&&xn?Z:Qr.left,Ya=te?tn(Zr,Ur,"after"):q),fe(Vn,mr.top,Hr-Vn,mr.bottom),mr.bottom<Qr.top&&fe(Z,mr.bottom,null,Qr.top),fe(hi,Qr.top,Ya-hi,Qr.bottom)}(!dr||Ki(mr,dr)<0)&&(dr=mr),Ki(Qr,dr)<0&&(dr=Qr),(!Or||Ki(mr,Or)<0)&&(Or=mr),Ki(Qr,Or)<0&&(Or=Qr)}),{start:dr,end:Or}}var Pe=t.from(),De=t.to();if(Pe.line==De.line)Ee(Pe.line,Pe.ch,De.ch);else{var We=xt(o,Pe.line),Ye=xt(o,De.line),rt=Vr(We)==Vr(Ye),ot=Ee(Pe.line,Pe.ch,rt?We.text.length+1:null).end,vt=Ee(De.line,rt?0:null,De.ch).start;rt&&(ot.top<vt.top-2?(fe(ot.right,ot.top,null,ot.bottom),fe(Z,vt.top,vt.left,vt.bottom)):fe(ot.right,ot.top,vt.left-ot.right,ot.bottom)),ot.bottom<vt.top&&fe(Z,ot.bottom,null,vt.top)}n.appendChild(D)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||qn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,qn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Be(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function qn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Be(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var o=t.view[r],D=e.options.lineWrapping,H=void 0,Z=0;if(o.hidden)continue;if(W&&B<8){var q=o.node.offsetTop+o.node.offsetHeight;H=q-n,n=q}else{var te=o.node.getBoundingClientRect();H=te.bottom-te.top,!D&&o.text.firstChild&&(Z=o.text.firstChild.getBoundingClientRect().right-te.left-1)}var fe=o.line.height-H;if((fe>.005||fe<-.005)&&(Ar(o.line,H),xo(o.line),o.rest))for(var Ee=0;Ee<o.rest.length;Ee++)xo(o.rest[Ee]);if(Z>e.display.sizerWidth){var Pe=Math.ceil(Z/Qn(e.display));Pe>e.display.maxLineLength&&(e.display.maxLineLength=Pe,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function xo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Xi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Hi(e));var o=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,D=Ir(t,r),H=Ir(t,o);if(n&&n.ensure){var Z=n.ensure.from.line,q=n.ensure.to.line;Z<D?(D=Z,H=Ir(t,hn(xt(t,Z))+e.wrapper.clientHeight)):Math.min(q,t.lastLine())>=H&&(D=Ir(t,hn(xt(t,q))-e.wrapper.clientHeight),H=q)}return{from:D,to:Math.max(H,D+1)}}function Ys(e,t){if(ze(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),o=null;if(t.top+r.top<0?o=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!g){var D=u("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Hi(e.display))+`px;
height: `+(t.bottom-t.top+bn(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(D),D.scrollIntoView(o),e.display.lineSpace.removeChild(D)}}function $s(e,t,n,r){r==null&&(r=0);var o;!e.options.lineWrapping&&t==n&&(t=t.ch?He(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?He(t.line,t.ch+1,"before"):t);for(var D=0;D<5;D++){var H=!1,Z=fn(e,t),q=!n||n==t?Z:fn(e,n);o={left:Math.min(Z.left,q.left),top:Math.min(Z.top,q.top)-r,right:Math.max(Z.left,q.left),bottom:Math.max(Z.bottom,q.bottom)+r};var te=wa(e,o),fe=e.doc.scrollTop,Ee=e.doc.scrollLeft;if(te.scrollTop!=null&&(Ei(e,te.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(H=!0)),te.scrollLeft!=null&&(Wn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-Ee)>1&&(H=!0)),!H)break}return o}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&Ei(e,n.scrollTop),n.scrollLeft!=null&&Wn(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=Zn(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,D=fa(e),H={};t.bottom-t.top>D&&(t.bottom=t.top+D);var Z=e.doc.height+ha(n),q=t.top<r,te=t.bottom>Z-r;if(t.top<o)H.scrollTop=q?0:t.top;else if(t.bottom>o+D){var fe=Math.min(t.top,(te?Z:t.bottom)-D);fe!=o&&(H.scrollTop=fe)}var Ee=e.options.fixedGutter?0:n.gutters.offsetWidth,Pe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-Ee,De=Un(e)-n.gutters.offsetWidth,We=t.right-t.left>De;return We&&(t.right=t.left+De),t.left<10?H.scrollLeft=0:t.left<Pe?H.scrollLeft=Math.max(0,t.left+Ee-(We?0:10)):t.right>De+Pe-3&&(H.scrollLeft=t.right+(We?0:10)-De),H}function _a(e,t){if(t==null)return;Yi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ei(e){Yi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,n){(t!=null||n!=null)&&Yi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){Yi(e),e.curOp.scrollToPos=t}function Yi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);Co(e,n,r,t.margin)}}function Co(e,t,n,r){var o=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});bi(e,o.scrollLeft,o.scrollTop)}function Ei(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;k||La(e,{top:t}),So(e,t,!0),k&&La(e),Si(e,100)}function So(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Wn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Lo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ha(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+bn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Hn=function(e,t,n){this.cm=n;var r=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),Ie(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ie(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var o=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var D=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+D)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Hn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hn.prototype.zeroWidthHack=function(){var e=s&&!m?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Hn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var o=e.getBoundingClientRect(),D=n=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);D!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Hn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ci=function(){};Ci.prototype.update=function(){return{bottom:0,right:0}},Ci.prototype.setScrollLeft=function(){},Ci.prototype.setScrollTop=function(){},Ci.prototype.clear=function(){};function ti(e,t){t||(t=xi(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var o=0;o<4&&n!=e.display.barWidth||r!=e.display.barHeight;o++)n!=e.display.barWidth&&e.options.lineWrapping&&Vi(e),To(e,xi(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var wo={native:Hn,null:Ci};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&C(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ie(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Wn(e,t):Ei(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Gn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},un(e.curOp)}function zn(e){var t=e.curOp;t&&Wi(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var o=0;o<t.length;o++)rl(t[o]);for(var D=0;D<t.length;D++)nl(t[D]);for(var H=0;H<t.length;H++)il(t[H])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $i(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vi(t),e.barMeasure=xi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+bn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Un(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Wn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ti(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&bo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ao(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Wn(t,e.scrollLeft,!0,!0),e.scrollToPos){var o=$s(t,f(r,e.scrollToPos.from),f(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,o)}var D=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(D)for(var Z=0;Z<D.length;++Z)D[Z].lines.length||Be(D[Z],"hide");if(H)for(var q=0;q<H.length;++q)H[q].lines.length&&Be(H[q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function en(e,t){if(e.curOp)return t();Gn(e);try{return t()}finally{zn(e)}}function Dr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Gn(e);try{return t.apply(e,arguments)}finally{zn(e)}}}function Wr(e){return function(){if(this.curOp)return e.apply(this,arguments);Gn(this);try{return e.apply(this,arguments)}finally{zn(this)}}}function kr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Gn(t);try{return e.apply(this,arguments)}finally{zn(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nt(e,t.highlightFrontier),o=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(D){if(r.line>=e.display.viewFrom){var H=D.styles,Z=D.text.length>e.options.maxHighlightLength?rr(t.mode,r.state):null,q=be(e,D,r,!0);Z&&(r.state=Z),D.styles=q.styles;var te=D.styleClasses,fe=q.classes;fe?D.styleClasses=fe:te&&(D.styleClasses=null);for(var Ee=!H||H.length!=D.styles.length||te!=fe&&(!te||!fe||te.bgClass!=fe.bgClass||te.textClass!=fe.textClass),Pe=0;!Ee&&Pe<H.length;++Pe)Ee=H[Pe]!=D.styles[Pe];Ee&&o.push(r.line),D.stateAfter=r.save(),r.nextLine()}else D.text.length<=e.options.maxHighlightLength&&Et(e,D.text,r),D.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),o.length&&en(e,function(){for(var D=0;D<o.length;D++)An(e,o[D],"text")})}var $i=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Xi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Un(e),this.force=n,this.dims=Ea(e),this.events=[]};$i.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},$i.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Be.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=bn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=bn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=I();if(!t||!L(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&L(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==I())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&L(document.body,e.anchorNode)&&L(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Ln(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&go(e)==0)return!1;Ro(e)&&(Ln(e),t.dims=Ea(e));var o=r.first+r.size,D=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(o,t.visible.to+e.options.viewportMargin);n.viewFrom<D&&D-n.viewFrom<20&&(D=Math.max(r.first,n.viewFrom)),n.viewTo>H&&n.viewTo-H<20&&(H=Math.min(o,n.viewTo)),br&&(D=wn(e.doc,D),H=Bi(e.doc,H));var Z=D!=n.viewFrom||H!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,D,H),n.viewOffset=hn(xt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var q=go(e);if(!Z&&q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=sl(e);return q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(te),E(n.cursorDiv),E(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Z&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Si(e,400)),n.updateLineNumbers=null,!0}function Ao(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Un(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ha(e.display)-fa(e),n.top)}),t.visible=Xi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xi(e.display,e.doc,n));if(!Aa(e,t))break;Vi(e);var o=xi(e);yi(e),ti(e,o),Da(e,o),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var n=new $i(e,t);if(Aa(e,n)){Vi(e),Ao(e,n);var r=xi(e);yi(e),ti(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,o=e.options.lineNumbers,D=r.lineDiv,H=D.firstChild;function Z(We){var Ye=We.nextSibling;return O&&s&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),Ye}for(var q=r.view,te=r.viewFrom,fe=0;fe<q.length;fe++){var Ee=q[fe];if(!Ee.hidden)if(!Ee.node||Ee.node.parentNode!=D){var Pe=Ns(e,Ee,te,n);D.insertBefore(Pe,H)}else{for(;H!=Ee.node;)H=Z(H);var De=o&&t!=null&&t<=te&&Ee.lineNumber;Ee.changes&&(le(Ee.changes,"gutter")>-1&&(De=!1),Ja(e,Ee,te,n)),De&&(E(Ee.lineNumber),Ee.lineNumber.appendChild(document.createTextNode(nn(e.options,te)))),H=Ee.node.nextSibling}te+=Ee.size}for(;H;)H=Z(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+bn(e)+"px"}function Lo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,D=r+"px",H=0;H<n.length;H++)if(!n[H].hidden){e.options.fixedGutter&&(n[H].gutter&&(n[H].gutter.style.left=D),n[H].gutterBackground&&(n[H].gutterBackground.style.left=D));var Z=n[H].alignable;if(Z)for(var q=0;q<Z.length;q++)Z[q].style.left=D}e.options.fixedGutter&&(t.gutters.style.left=r+o+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=nn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var o=r.measure.appendChild(u("div",[u("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),D=o.firstChild.offsetWidth,H=o.offsetWidth-D;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(D,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function ka(e,t){for(var n=[],r=!1,o=0;o<e.length;o++){var D=e[o],H=null;if(typeof D!="string"&&(H=D.style,D=D.className),D=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:D,style:H})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Do(e){var t=e.gutters,n=e.gutterSpecs;E(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var o=n[r],D=o.className,H=o.style,Z=t.appendChild(u("div",null,"CodeMirror-gutter "+D));H&&(Z.style.cssText=H),D=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function Ti(e){Do(e.display),Yr(e),Lo(e)}function dl(e,t,n,r){var o=this;this.input=n,o.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=h("div",null,"CodeMirror-code"),o.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=u("div",null,"CodeMirror-cursors"),o.measure=u("div",null,"CodeMirror-measure"),o.lineMeasure=u("div",null,"CodeMirror-measure"),o.lineSpace=h("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var D=h("div",[o.lineSpace],"CodeMirror-lines");o.mover=u("div",[D],null,"position: relative"),o.sizer=u("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=u("div",null,null,"position: absolute; height: "+pe+"px; width: 1px;"),o.gutters=u("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=u("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=u("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),W&&B<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),!O&&!(k&&i)&&(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=ka(r.gutters,r.lineNumbers),Do(o),n.init(o)}var Ji=0,sn=null;W?sn=-.53:k?sn=15:d?sn=-.7:w&&(sn=-1/3);function ko(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=ko(e);return t.x*=sn,t.y*=sn,t}function Oo(e,t){var n=ko(t),r=n.x,o=n.y,D=e.display,H=D.scroller,Z=H.scrollWidth>H.clientWidth,q=H.scrollHeight>H.clientHeight;if(!(r&&Z||o&&q))return;if(o&&s&&O){e:for(var te=t.target,fe=D.view;te!=H;te=te.parentNode)for(var Ee=0;Ee<fe.length;Ee++)if(fe[Ee].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!k&&!p&&sn!=null){o&&q&&Ei(e,Math.max(0,H.scrollTop+o*sn)),Wn(e,Math.max(0,H.scrollLeft+r*sn)),(!o||o&&q)&&ne(t),D.wheelStartX=null;return}if(o&&sn!=null){var Pe=o*sn,De=e.doc.scrollTop,We=De+D.wrapper.clientHeight;Pe<0?De=Math.max(0,De+Pe-50):We=Math.min(e.doc.height,We+Pe+50),La(e,{top:De,bottom:We})}Ji<20&&(D.wheelStartX==null?(D.wheelStartX=H.scrollLeft,D.wheelStartY=H.scrollTop,D.wheelDX=r,D.wheelDY=o,setTimeout(function(){if(D.wheelStartX==null)return;var Ye=H.scrollLeft-D.wheelStartX,rt=H.scrollTop-D.wheelStartY,ot=rt&&D.wheelDY&&rt/D.wheelDY||Ye&&D.wheelDX&&Ye/D.wheelDX;if(D.wheelStartX=D.wheelStartY=null,!ot)return;sn=(sn*Ji+ot)/(Ji+1),++Ji},200)):(D.wheelDX+=r,D.wheelDY+=o))}var ln=function(e,t){this.ranges=e,this.primIndex=t};ln.prototype.primary=function(){return this.ranges[this.primIndex]},ln.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Wt(n.anchor,r.anchor)||!Wt(n.head,r.head))return!1}return!0},ln.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new or(qt(this.ranges[t].anchor),qt(this.ranges[t].head));return new ln(e,this.primIndex)},ln.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ln.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var or=function(e,t){this.anchor=e,this.head=t};or.prototype.from=function(){return ir(this.anchor,this.head)},or.prototype.to=function(){return nr(this.anchor,this.head)},or.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function pn(e,t,n){var r=e&&e.options.selectionsMayTouch,o=t[n];t.sort(function(Pe,De){return ft(Pe.from(),De.from())}),n=le(t,o);for(var D=1;D<t.length;D++){var H=t[D],Z=t[D-1],q=ft(Z.to(),H.from());if(r&&!H.empty()?q>0:q>=0){var te=ir(Z.from(),H.from()),fe=nr(Z.to(),H.to()),Ee=Z.empty()?H.from()==H.head:Z.from()==Z.head;D<=n&&--n,t.splice(--D,2,new or(Ee?fe:te,Ee?te:fe))}}return new ln(t,n)}function Rn(e,t){return new ln([new or(e,t||e)],0)}function Dn(e){return e.text?He(e.from.line+e.text.length-1,re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Dn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Dn(t).ch-t.to.ch),He(n,r)}function Oa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var o=e.sel.ranges[r];n.push(new or(Po(o.anchor,t),Po(o.head,t)))}return pn(e.cm,n,e.sel.primIndex)}function Mo(e,t,n){return e.line==t.line?He(n.line,e.ch-t.ch+n.ch):He(n.line+(e.line-t.line),e.ch)}function hl(e,t,n){for(var r=[],o=He(e.first,0),D=o,H=0;H<t.length;H++){var Z=t[H],q=Mo(Z.from,o,D),te=Mo(Dn(Z),o,D);if(o=Z.to,D=te,n=="around"){var fe=e.sel.ranges[H],Ee=ft(fe.head,fe.anchor)<0;r[H]=new or(Ee?te:q,Ee?q:te)}else r[H]=new or(q,q)}return new ln(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Ct(e.options,e.doc.modeOption),wi(e)}function wi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Si(e,100),e.state.modeGen++,e.curOp&&Yr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function o(vt){return n?n[vt]:null}function D(vt,st,St){$a(vt,st,St,r),Nr(vt,"change",vt,t)}function H(vt,st){for(var St=[],Ot=vt;Ot<st;++Ot)St.push(new Nn(te[Ot],o(Ot),r));return St}var Z=t.from,q=t.to,te=t.text,fe=xt(e,Z.line),Ee=xt(e,q.line),Pe=re(te),De=o(te.length-1),We=q.line-Z.line;if(t.full)e.insert(0,H(0,te.length)),e.remove(te.length,e.size-te.length);else if(Io(e,t)){var Ye=H(0,te.length-1);D(Ee,Ee.text,De),We&&e.remove(Z.line,We),Ye.length&&e.insert(Z.line,Ye)}else if(fe==Ee)if(te.length==1)D(fe,fe.text.slice(0,Z.ch)+Pe+fe.text.slice(q.ch),De);else{var rt=H(1,te.length-1);rt.push(new Nn(Pe+fe.text.slice(q.ch),De,r)),D(fe,fe.text.slice(0,Z.ch)+te[0],o(0)),e.insert(Z.line+1,rt)}else if(te.length==1)D(fe,fe.text.slice(0,Z.ch)+te[0]+Ee.text.slice(q.ch),o(0)),e.remove(Z.line+1,We);else{D(fe,fe.text.slice(0,Z.ch)+te[0],o(0)),D(Ee,Pe+Ee.text.slice(q.ch),De);var ot=H(1,te.length-1);We>1&&e.remove(Z.line+1,We-1),e.insert(Z.line+1,ot)}Nr(e,"change",e,t)}function kn(e,t,n){function r(o,D,H){if(o.linked)for(var Z=0;Z<o.linked.length;++Z){var q=o.linked[Z];if(q.doc==D)continue;var te=H&&q.sharedHist;if(n&&!te)continue;t(q.doc,te),r(q.doc,o,te)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Pa(e),Uo(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,Yr(e)}function Uo(e){(e.doc.direction=="rtl"?F:C)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){en(e,function(){Uo(e),Yr(e)})}function Zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:qt(t.from),to:Dn(t),text:Mr(e,t.from,t.to)};return jo(e,n,t.from.line,t.to.line+1),kn(e,function(r){return jo(r,n,t.from.line,t.to.line+1)},!0),n}function Fo(e){for(;e.length;){var t=re(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(e.done),re(e.done);if(e.done.length&&!re(e.done).ranges)return re(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),re(e.done)}function Bo(e,t,n,r){var o=e.history;o.undone.length=0;var D=+new Date,H,Z;if((o.lastOp==r||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>D-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(o,o.lastOp==r)))Z=re(H.changes),ft(t.from,t.to)==0&&ft(t.from,Z.to)==0?Z.to=Dn(t):H.changes.push(Ia(e,t));else{var q=re(o.done);for((!q||!q.ranges)&&Qi(e.sel,o.done),H={changes:[Ia(e,t)],generation:o.generation},o.done.push(H);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(n),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=D,o.lastOp=o.lastSelOp=r,o.lastOrigin=o.lastSelOrigin=t.origin,Z||Be(e,"historyAdded")}function ml(e,t,n,r){var o=t.charAt(0);return o=="*"||o=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var o=e.history,D=r&&r.origin;n==o.lastSelOp||D&&o.lastSelOrigin==D&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==D||ml(e,D,re(o.done),t))?o.done[o.done.length-1]=t:Qi(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=D,o.lastSelOp=n,r&&r.clearRedo!==!1&&Fo(o.undone)}function Qi(e,t){var n=re(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var o=t["spans_"+e.id],D=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((o||(o=t["spans_"+e.id]={}))[D]=H.markedSpans),++D})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],o=0;o<t.text.length;++o)r.push(vl(n[o]));return r}function Wo(e,t){var n=yl(e,t),r=qe(e,t);if(!n)return r;if(!r)return n;for(var o=0;o<n.length;++o){var D=n[o],H=r[o];if(D&&H){e:for(var Z=0;Z<H.length;++Z){for(var q=H[Z],te=0;te<D.length;++te)if(D[te].marker==q.marker)continue e;D.push(q)}}else H&&(n[o]=H)}return n}function ri(e,t,n){for(var r=[],o=0;o<e.length;++o){var D=e[o];if(D.ranges){r.push(n?ln.prototype.deepCopy.call(D):D);continue}var H=D.changes,Z=[];r.push({changes:Z});for(var q=0;q<H.length;++q){var te=H[q],fe=void 0;if(Z.push({from:te.from,to:te.to,text:te.text}),t)for(var Ee in te)(fe=Ee.match(/^spans_(\d+)$/))&&(le(t,Number(fe[1]))>-1&&(re(Z)[Ee]=te[Ee],delete te[Ee]))}}return r}function Na(e,t,n,r){if(r){var o=e.anchor;if(n){var D=ft(t,o)<0;D!=ft(n,o)<0?(o=t,t=n):D!=ft(t,n)<0&&(t=n)}return new or(o,t)}else return new or(n||t,t)}function qi(e,t,n,r,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),Fr(e,new ln([Na(e.sel.primary(),t,n,o)],0),r)}function Ho(e,t,n){for(var r=[],o=e.cm&&(e.cm.display.shift||e.extend),D=0;D<e.sel.ranges.length;D++)r[D]=Na(e.sel.ranges[D],t[D],null,o);var H=pn(e.cm,r,e.sel.primIndex);Fr(e,H,n)}function Ua(e,t,n,r){var o=e.sel.ranges.slice(0);o[t]=n,Fr(e,pn(e.cm,o,e.sel.primIndex),r)}function Go(e,t,n,r){Fr(e,Rn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(o){this.ranges=[];for(var D=0;D<o.length;D++)this.ranges[D]=new or(f(e,o[D].anchor),f(e,o[D].head))},origin:n&&n.origin};return Be(e,"beforeSelectionChange",e,r),e.cm&&Be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?pn(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,o=re(r);o&&o.ranges?(r[r.length-1]=t,ea(e,t,n)):Fr(e,t,n)}function Fr(e,t,n){ea(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ea(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&ei(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ce(e.cm)),Nr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,n,r){for(var o,D=0;D<t.ranges.length;D++){var H=t.ranges[D],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[D],q=ta(e,H.anchor,Z&&Z.anchor,n,r),te=ta(e,H.head,Z&&Z.head,n,r);(o||q!=H.anchor||te!=H.head)&&(o||(o=t.ranges.slice(0,D)),o[D]=new or(q,te))}return o?pn(e.cm,o,t.primIndex):t}function ni(e,t,n,r,o){var D=xt(e,t.line);if(D.markedSpans)for(var H=0;H<D.markedSpans.length;++H){var Z=D.markedSpans[H],q=Z.marker,te="selectLeft"in q?!q.selectLeft:q.inclusiveLeft,fe="selectRight"in q?!q.selectRight:q.inclusiveRight;if((Z.from==null||(te?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(fe?Z.to>=t.ch:Z.to>t.ch))){if(o&&(Be(q,"beforeCursorEnter"),q.explicitlyCleared))if(D.markedSpans){--H;continue}else break;if(!q.atomic)continue;if(n){var Ee=q.find(r<0?1:-1),Pe=void 0;if((r<0?fe:te)&&(Ee=Yo(e,Ee,-r,Ee&&Ee.line==t.line?D:null)),Ee&&Ee.line==t.line&&(Pe=ft(Ee,n))&&(r<0?Pe<0:Pe>0))return ni(e,Ee,t,r,o)}var De=q.find(r<0?-1:1);return(r<0?te:fe)&&(De=Yo(e,De,r,De.line==t.line?D:null)),De?ni(e,De,t,r,o):null}}return t}function ta(e,t,n,r,o){var D=r||1,H=ni(e,t,n,D,o)||!o&&ni(e,t,n,D,!0)||ni(e,t,n,-D,o)||!o&&ni(e,t,n,-D,!0);return H||(e.cantEdit=!0,He(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?f(e,He(t.line-1)):null:n>0&&t.ch==(r||xt(e,t.line)).text.length?t.line<e.first+e.size-1?He(t.line+1,0):null:new He(t.line,t.ch+n)}function $o(e){e.setSelection(He(e.firstLine(),0),He(e.lastLine()),Te)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(o,D,H,Z){o&&(r.from=f(e,o)),D&&(r.to=f(e,D)),H&&(r.text=H),Z!==void 0&&(r.origin=Z)}),Be(e,"beforeChange",e,r),e.cm&&Be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ii(e,t,n){if(e.cm){if(!e.cm.curOp)return Dr(e.cm,ii)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=an&&!n&&Vt(e,t.from,t.to);if(r)for(var o=r.length-1;o>=0;--o)Zo(e,{from:r[o].from,to:r[o].to,text:o?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Oa(e,t);Bo(e,t,n,e.cm?e.cm.curOp.id:NaN),_i(e,t,n,qe(e,t));var r=[];kn(e,function(o,D){!D&&le(r,o.history)==-1&&(ts(o.history,t),r.push(o.history)),_i(o,t,null,qe(o,t))})}function ra(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var o=e.history,D,H=e.sel,Z=t=="undo"?o.done:o.undone,q=t=="undo"?o.undone:o.done,te=0;te<Z.length&&!(D=Z[te],n?D.ranges&&!D.equals(e.sel):!D.ranges);te++);if(te==Z.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(D=Z.pop(),D.ranges){if(Qi(D,q),n&&!D.equals(e.sel)){Fr(e,D,{clearRedo:!1});return}H=D}else if(r){Z.push(D);return}else break;var fe=[];Qi(H,q),q.push({changes:fe,generation:o.generation}),o.generation=D.generation||++o.maxGeneration;for(var Ee=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),Pe=function(Ye){var rt=D.changes[Ye];if(rt.origin=t,Ee&&!Jo(e,rt,!1))return Z.length=0,{};fe.push(Ia(e,rt));var ot=Ye?Oa(e,rt):re(Z);_i(e,rt,ot,Wo(e,rt)),!Ye&&e.cm&&e.cm.scrollIntoView({from:rt.from,to:Dn(rt)});var vt=[];kn(e,function(st,St){!St&&le(vt,st.history)==-1&&(ts(st.history,rt),vt.push(st.history)),_i(st,rt,null,Wo(st,rt))})},De=D.changes.length-1;De>=0;--De){var We=Pe(De);if(We)return We.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new ln(ce(e.sel.ranges,function(o){return new or(He(o.anchor.line+t,o.anchor.ch),He(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){Yr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)An(e.cm,r,"gutter")}}function _i(e,t,n,r){if(e.cm&&!e.cm.curOp)return Dr(e.cm,_i)(e,t,n,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);Qo(e,o),t={from:He(e.first,0),to:He(t.to.line+o,t.to.ch),text:[re(t.text)],origin:t.origin}}var D=e.lastLine();t.to.line>D&&(t={from:t.from,to:He(D,xt(e,D).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),n||(n=Oa(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),ea(e,n,Te),e.cantEdit&&ta(e,He(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,o=e.display,D=t.from,H=t.to,Z=!1,q=D.line;e.options.lineWrapping||(q=Ft(Vr(xt(r,D.line))),r.iter(q,H.line+1,function(De){if(De==o.maxLine)return Z=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ce(e),Ma(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(q,D.line+t.text.length,function(De){var We=$n(De);We>o.maxLineLength&&(o.maxLine=De,o.maxLineLength=We,o.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),zr(r,D.line),Si(e,400);var te=t.text.length-(H.line-D.line)-1;t.full?Yr(e):D.line==H.line&&t.text.length==1&&!Io(e.doc,t)?An(e,D.line,"text"):Yr(e,D.line,H.line+1,te);var fe=ye(e,"changes"),Ee=ye(e,"change");if(Ee||fe){var Pe={from:D,to:H,text:t.text,removed:t.removed,origin:t.origin};Ee&&Nr(e,"change",e,Pe),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Pe)}e.display.selForContextMenu=null}function ai(e,t,n,r,o){var D;r||(r=n),ft(r,n)<0&&(D=[r,n],n=D[0],r=D[1]),typeof t=="string"&&(t=e.splitLines(t)),ii(e,{from:n,to:r,text:t,origin:o})}function qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,n,r){for(var o=0;o<e.length;++o){var D=e[o],H=!0;if(D.ranges){D.copied||(D=e[o]=D.deepCopy(),D.copied=!0);for(var Z=0;Z<D.ranges.length;Z++)qo(D.ranges[Z].anchor,t,n,r),qo(D.ranges[Z].head,t,n,r);continue}for(var q=0;q<D.changes.length;++q){var te=D.changes[q];if(n<te.from.line)te.from=He(te.from.line+r,te.from.ch),te.to=He(te.to.line+r,te.to.ch);else if(t<=te.to.line){H=!1;break}}H||(e.splice(0,o+1),o=0)}}function ts(e,t){var n=t.from.line,r=t.to.line,o=t.text.length-(r-n)-1;es(e.done,n,r,o),es(e.undone,n,r,o)}function Ai(e,t,n,r){var o=t,D=t;return typeof t=="number"?D=xt(e,K(e,t)):o=Ft(t),o==null?null:(r(D,o)&&e.cm&&An(e.cm,o,n),D)}function Li(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Li.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var o=this.lines[n];this.height-=o.height,da(o),Nr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Ri(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var o=e[r];t+=o.chunkSize(),n+=o.height,o.parent=this}this.size=t,this.height=n,this.parent=null}Ri.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],o=r.chunkSize();if(e<o){var D=Math.min(t,o-e),H=r.height;if(r.removeInner(e,D),this.height-=H-r.height,o==D&&(this.children.splice(n--,1),r.parent=null),(t-=D)==0)break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Li))){var Z=[];this.collapse(Z),this.children=[new Li(Z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var o=this.children[r],D=o.chunkSize();if(e<=D){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var H=o.lines.length%25+25,Z=H;Z<o.lines.length;){var q=new Li(o.lines.slice(Z,Z+=25));o.height-=q.height,this.children.splice(++r,0,q),q.parent=this}o.lines=o.lines.slice(0,H),this.maybeSpill()}break}e-=D}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ri(t);if(e.parent){e.size-=n.size,e.height-=n.height;var o=le(e.parent.children,e);e.parent.children.splice(o+1,0,n)}else{var r=new Ri(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var o=this.children[r],D=o.chunkSize();if(e<D){var H=Math.min(t,D-e);if(o.iterN(e,H,n))return!0;if((t-=H)==0)break;e=0}else e-=D}}};var Di=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Di.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ft(n);if(r==null||!t)return;for(var o=0;o<t.length;++o)t[o]==this&&t.splice(o--,1);t.length||(n.widgets=null);var D=gi(this);Ar(n,Math.max(0,n.height-D)),e&&(en(e,function(){rs(e,n,-D),An(e,r,"widget")}),Nr(e,"lineWidgetCleared",e,this,r))},Di.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var o=gi(this)-t;if(!o)return;qr(this.doc,r)||Ar(r,r.height+o),n&&en(n,function(){n.curOp.forceUpdate=!0,rs(n,r,o),Nr(n,"lineWidgetChanged",n,e,Ft(r))})},xe(Di);function rs(e,t,n){hn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,n)}function xl(e,t,n,r){var o=new Di(e,n,r),D=e.cm;return D&&o.noHScroll&&(D.display.alignWidgets=!0),Ai(e,t,"widget",function(H){var Z=H.widgets||(H.widgets=[]);if(o.insertAt==null?Z.push(o):Z.splice(Math.min(Z.length-1,Math.max(0,o.insertAt)),0,o),o.line=H,D&&!qr(e,H)){var q=hn(H)<e.scrollTop;Ar(H,H.height+gi(o)),q&&_a(D,o.height),D.curOp.forceUpdate=!0}return!0}),D&&Nr(D,"lineWidgetAdded",D,o,typeof t=="number"?t:Ft(t)),o}var ns=0,On=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};On.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Gn(e),ye(this,"clear")){var n=this.find();n&&Nr(this,"clear",n.from,n.to)}for(var r=null,o=null,D=0;D<this.lines.length;++D){var H=this.lines[D],Z=Kr(H.markedSpans,this);e&&!this.collapsed?An(e,Ft(H),"text"):e&&(Z.to!=null&&(o=Ft(H)),Z.from!=null&&(r=Ft(H))),H.markedSpans=cn(H.markedSpans,Z),Z.from==null&&this.collapsed&&!qr(this.doc,H)&&e&&Ar(H,Zn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var q=0;q<this.lines.length;++q){var te=Vr(this.lines[q]),fe=$n(te);fe>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Yr(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Nr(e,"markerCleared",e,this,r,o),t&&zn(e),this.parent&&this.parent.clear()},On.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,o=0;o<this.lines.length;++o){var D=this.lines[o],H=Kr(D.markedSpans,this);if(H.from!=null&&(n=He(t?D:Ft(D),H.from),e==-1))return n;if(H.to!=null&&(r=He(t?D:Ft(D),H.to),e==1))return r}return n&&{from:n,to:r}},On.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;en(r,function(){var o=t.line,D=Ft(t.line),H=pa(r,D);if(H&&(oo(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!qr(n.doc,o)&&n.height!=null){var Z=n.height;n.height=null;var q=gi(n)-Z;q&&Ar(o,o.height+q)}Nr(r,"markerChanged",r,e)})},On.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||le(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},On.prototype.detachLine=function(e){if(this.lines.splice(le(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xe(On);function oi(e,t,n,r,o){if(r&&r.shared)return Cl(e,t,n,r,o);if(e.cm&&!e.cm.curOp)return Dr(e.cm,oi)(e,t,n,r,o);var D=new On(e,o),H=ft(t,n);if(r&&N(r,D,!1),H>0||H==0&&D.clearWhenEmpty!==!1)return D;if(D.replacedWith&&(D.collapsed=!0,D.widgetNode=h("span",[D.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||D.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(D.widgetNode.insertLeft=!0)),D.collapsed){if(vr(e,t.line,t,n,D)||t.line!=n.line&&vr(e,n.line,t,n,D))throw new Error("Inserting collapsed marker partially overlapping an existing one");Er()}D.addToHistory&&Bo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Z=t.line,q=e.cm,te;if(e.iter(Z,n.line+1,function(Ee){q&&D.collapsed&&!q.options.lineWrapping&&Vr(Ee)==q.display.maxLine&&(te=!0),D.collapsed&&Z!=t.line&&Ar(Ee,0),on(Ee,new gn(D,Z==t.line?t.ch:null,Z==n.line?n.ch:null)),++Z}),D.collapsed&&e.iter(t.line,n.line+1,function(Ee){qr(e,Ee)&&Ar(Ee,0)}),D.clearOnEnter&&Ie(D,"beforeCursorEnter",function(){return D.clear()}),D.readOnly&&(Lr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),D.collapsed&&(D.id=++ns,D.atomic=!0),q){if(te&&(q.curOp.updateMaxLine=!0),D.collapsed)Yr(q,t.line,n.line+1);else if(D.className||D.startStyle||D.endStyle||D.css||D.attributes||D.title)for(var fe=t.line;fe<=n.line;fe++)An(q,fe,"text");D.atomic&&Vo(q.doc),Nr(q,"markerAdded",q,D)}return D}var ki=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};ki.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Nr(this,"clear")},ki.prototype.find=function(e,t){return this.primary.find(e,t)},xe(ki);function Cl(e,t,n,r,o){r=N(r),r.shared=!1;var D=[oi(e,t,n,r,o)],H=D[0],Z=r.widgetNode;return kn(e,function(q){Z&&(r.widgetNode=Z.cloneNode(!0)),D.push(oi(q,f(q,t),f(q,n),r,o));for(var te=0;te<q.linked.length;++te)if(q.linked[te].isParent)return;H=re(D)}),new ki(D,H)}function is(e){return e.findMarks(He(e.first,0),e.clipPos(He(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],o=r.find(),D=e.clipPos(o.from),H=e.clipPos(o.to);if(ft(D,H)){var Z=oi(e,D,H,r.primary,r.primary.type);r.markers.push(Z),Z.parent=r}}}function Tl(e){for(var t=function(r){var o=e[r],D=[o.primary.doc];kn(o.primary.doc,function(q){return D.push(q)});for(var H=0;H<o.markers.length;H++){var Z=o.markers[H];le(D,Z.doc)==-1&&(Z.parent=null,o.markers.splice(H--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,$r=function(e,t,n,r,o){if(!(this instanceof $r))return new $r(e,t,n,r,o);n==null&&(n=0),Ri.call(this,[new Li([new Nn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var D=He(n,0);this.sel=Rn(D),this.history=new Zi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=o=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:D,to:D,text:e}),Fr(this,Rn(D),Te)};$r.prototype=ie(Ri.prototype,{constructor:$r,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=rn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:kr(function(e){var t=He(this.first,0),n=this.first+this.size-1;ii(this,{from:t,to:He(n,xt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),Fr(this,Rn(t),Te)}),replaceRange:function(e,t,n,r){t=f(this,t),n=n?f(this,n):t,ai(this,e,t,n,r)},getRange:function(e,t,n){var r=Mr(this,f(this,e),f(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Tr(this,e))return xt(this,e)},getLineNumber:function(e){return Ft(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=xt(this,e)),Vr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return f(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:kr(function(e,t,n){Go(this,f(this,typeof e=="number"?He(e,t||0):e),null,n)}),setSelection:kr(function(e,t,n){Go(this,f(this,e),f(this,t||e),n)}),extendSelection:kr(function(e,t,n){qi(this,f(this,e),t&&f(this,t),n)}),extendSelections:kr(function(e,t){Ho(this,G(this,e),t)}),extendSelectionsBy:kr(function(e,t){var n=ce(this.sel.ranges,e);Ho(this,G(this,n),t)}),setSelections:kr(function(e,t,n){if(!e.length)return;for(var r=[],o=0;o<e.length;o++)r[o]=new or(f(this,e[o].anchor),f(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Fr(this,pn(this.cm,r,t),n)}),addSelection:kr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new or(f(this,e),f(this,t||e))),Fr(this,pn(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var o=Mr(this,t[r].from(),t[r].to());n=n?n.concat(o):o}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var o=Mr(this,n[r].from(),n[r].to());e!==!1&&(o=o.join(e||this.lineSeparator())),t[r]=o}return t},replaceSelection:function(e,t,n){for(var r=[],o=0;o<this.sel.ranges.length;o++)r[o]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:kr(function(e,t,n){for(var r=[],o=this.sel,D=0;D<o.ranges.length;D++){var H=o.ranges[D];r[D]={from:H.from(),to:H.to(),text:this.splitLines(e[D]),origin:n}}for(var Z=t&&t!="end"&&hl(this,r,t),q=r.length-1;q>=0;q--)ii(this,r[q]);Z?zo(this,Z):this.cm&&ei(this.cm)}),undo:kr(function(){ra(this,"undo")}),redo:kr(function(){ra(this,"redo")}),undoSelection:kr(function(){ra(this,"undo",!0)}),redoSelection:kr(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Zi(this.history.maxGeneration),kn(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:ri(this.history.done),undone:ri(this.history.undone)}},setHistory:function(e){var t=this.history=new Zi(this.history.maxGeneration);t.done=ri(e.done.slice(0),null,!0),t.undone=ri(e.undone.slice(0),null,!0)},setGutterMarker:kr(function(e,t,n){return Ai(this,e,"gutter",function(r){var o=r.gutterMarkers||(r.gutterMarkers={});return o[t]=n,!n&&Me(o)&&(r.gutterMarkers=null),!0})}),clearGutter:kr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ai(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Me(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Tr(this,e))return null;if(t=e,e=xt(this,e),!e)return null}else if(t=Ft(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:kr(function(e,t,n){return Ai(this,e,t=="gutter"?"gutter":"class",function(r){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[o])r[o]=n;else{if(_(n).test(r[o]))return!1;r[o]+=" "+n}return!0})}),removeLineClass:kr(function(e,t,n){return Ai(this,e,t=="gutter"?"gutter":"class",function(r){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",D=r[o];if(D)if(n==null)r[o]=null;else{var H=D.match(_(n));if(!H)return!1;var Z=H.index+H[0].length;r[o]=D.slice(0,H.index)+(!H.index||Z==D.length?"":" ")+D.slice(Z)||null}else return!1;return!0})}),addLineWidget:kr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return oi(this,f(this,e),f(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=f(this,e),oi(this,e,e,n,"bookmark")},findMarksAt:function(e){e=f(this,e);var t=[],n=xt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var o=n[r];(o.from==null||o.from<=e.ch)&&(o.to==null||o.to>=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,n){e=f(this,e),t=f(this,t);var r=[],o=e.line;return this.iter(e.line,t.line+1,function(D){var H=D.markedSpans;if(H)for(var Z=0;Z<H.length;Z++){var q=H[Z];!(q.to!=null&&o==e.line&&e.ch>=q.to||q.from==null&&o!=e.line||q.from!=null&&o==t.line&&q.from>=t.ch)&&(!n||n(q.marker))&&r.push(q.marker.parent||q.marker)}++o}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(o){var D=o.text.length+r;if(D>e)return t=e,!0;e-=D,++n}),f(this,He(n,t))},indexFromPos:function(e){e=f(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new $r(rn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new $r(rn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,is(this)),r},unlinkDoc:function(e){if(e instanceof fr&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(is(this));break}if(e.history==this.history){var r=[e.id];kn(e,function(o){return r.push(o.id)},!0),e.history=new Zi(null),e.history.done=ri(this.history.done,r),e.history.undone=ri(this.history.undone,r)}},iterLinkedDocs:function(e){kn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Pt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:kr(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)})}),$r.prototype.eachLine=$r.prototype.iter;var as=0;function _l(e){var t=this;if(os(t),ze(t,e)||Cn(t.display,e))return;ne(e),W&&(as=+new Date);var n=Bn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var o=r.length,D=Array(o),H=0,Z=function(){++H==o&&Dr(t,function(){n=f(t.doc,n);var De={from:n,to:n,text:t.doc.splitLines(D.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};ii(t.doc,De),zo(t.doc,Rn(f(t.doc,n),f(t.doc,Dn(De))))})()},q=function(De,We){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,De.type)==-1){Z();return}var Ye=new FileReader;Ye.onerror=function(){return Z()},Ye.onload=function(){var rt=Ye.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(rt)){Z();return}D[We]=rt,Z()},Ye.readAsText(De)},te=0;te<r.length;te++)q(r[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var fe=e.dataTransfer.getData("Text");if(fe){var Ee;if(t.state.draggingText&&!t.state.draggingText.copy&&(Ee=t.listSelections()),ea(t.doc,Rn(n,n)),Ee)for(var Pe=0;Pe<Ee.length;++Pe)ai(t.doc,"",Ee[Pe].anchor,Ee[Pe].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(De){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-as<100)){ve(t);return}if(ze(e,t)||Cn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!w){var n=u("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),p&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=Bn(e,t);if(!n)return;var r=document.createDocumentFragment();yo(e,n,r),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),c(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var o=t[r].CodeMirror;o&&n.push(o)}n.length&&n[0].operation(function(){for(var D=0;D<n.length;D++)e(n[D])})}var ls=!1;function Rl(){if(ls)return;Dl(),ls=!0}function Dl(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(kl)},100))}),Ie(window,"blur",function(){return ss(qn)})}function kl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Pn={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"},Oi=0;Oi<10;Oi++)Pn[Oi+48]=Pn[Oi+96]=String(Oi);for(var na=65;na<=90;na++)Pn[na]=String.fromCharCode(na);for(var Pi=1;Pi<=12;Pi++)Pn[Pi+111]=Pn[Pi+63235]="F"+Pi;var Sn={};Sn.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"},Sn.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"},Sn.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"},Sn.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"]},Sn.default=s?Sn.macDefault:Sn.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,o,D,H=0;H<t.length-1;H++){var Z=t[H];if(/^(cmd|meta|m)$/i.test(Z))D=!0;else if(/^a(lt)?$/i.test(Z))n=!0;else if(/^(c|ctrl|control)$/i.test(Z))r=!0;else if(/^s(hift)?$/i.test(Z))o=!0;else throw new Error("Unrecognized modifier name: "+Z)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),D&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var o=ce(n.split(" "),Ol),D=0;D<o.length;D++){var H=void 0,Z=void 0;D==o.length-1?(Z=o.join(" "),H=r):(Z=o.slice(0,D+1).join(" "),H="...");var q=t[Z];if(!q)t[Z]=H;else if(q!=H)throw new Error("Inconsistent bindings for "+Z)}delete e[n]}for(var te in t)e[te]=t[te];return e}function si(e,t,n,r){t=ia(t);var o=t.call?t.call(e,r):t[e];if(o===!1)return"nothing";if(o==="...")return"multi";if(o!=null&&n(o))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return si(e,t.fallthrough,n,r);for(var D=0;D<t.fallthrough.length;D++){var H=si(e,t.fallthrough[D],n,r);if(H)return H}}}function us(e){var t=typeof e=="string"?e:Pn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(p&&e.keyCode==34&&e.char)return!1;var n=Pn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ds(n,e,t))}function ia(e){return typeof e=="string"?Sn[e]:e}function li(e,t){for(var n=e.doc.sel.ranges,r=[],o=0;o<n.length;o++){for(var D=t(n[o]);r.length&&ft(D.from,re(r).to)<=0;){var H=r.pop();if(ft(H.from,D.from)<0){D.from=H.from;break}}r.push(D)}en(e,function(){for(var Z=r.length-1;Z>=0;Z--)ai(e.doc,"",r[Z].from,r[Z].to,"+delete");ei(e)})}function Fa(e,t,n){var r=Fe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new He(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,o){if(e){t.doc.direction=="rtl"&&(o=-o);var D=tt(n,t.doc.direction);if(D){var H=o<0?re(D):D[0],Z=o<0==(H.level==1),q=Z?"after":"before",te;if(H.level>0||t.doc.direction=="rtl"){var fe=Jn(t,n);te=o<0?n.text.length-1:0;var Ee=En(t,fe,te).top;te=Je(function(Pe){return En(t,fe,Pe).top==Ee},o<0==(H.level==1)?H.from:H.to-1,te),q=="before"&&(te=Fa(n,te,1))}else te=o<0?H.to:H.from;return new He(r,te,q)}}return new He(r,o<0?n.text.length:0,o<0?"before":"after")}function Ml(e,t,n,r){var o=tt(t,e.doc.direction);if(!o)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var D=Xe(o,n.ch,n.sticky),H=o[D];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>n.ch:H.from<n.ch))return Ba(t,n,r);var Z=function(ot,vt){return Fa(t,ot instanceof He?ot.ch:ot,vt)},q,te=function(ot){return e.options.lineWrapping?(q=q||Jn(e,t),po(e,t,q,ot)):{begin:0,end:t.text.length}},fe=te(n.sticky=="before"?Z(n,-1):n.ch);if(e.doc.direction=="rtl"||H.level==1){var Ee=H.level==1==r<0,Pe=Z(n,Ee?1:-1);if(Pe!=null&&(Ee?Pe<=H.to&&Pe<=fe.end:Pe>=H.from&&Pe>=fe.begin)){var De=Ee?"before":"after";return new He(n.line,Pe,De)}}var We=function(ot,vt,st){for(var St=function(dr,Or){return Or?new He(n.line,Z(dr,1),"before"):new He(n.line,dr,"after")};ot>=0&&ot<o.length;ot+=vt){var Ot=o[ot],Rt=vt>0==(Ot.level!=1),zt=Rt?st.begin:Z(st.end,-1);if(Ot.from<=zt&&zt<Ot.to)return St(zt,Rt);if(zt=Rt?Ot.from:Z(Ot.to,-1),st.begin<=zt&&zt<st.end)return St(zt,Rt)}},Ye=We(D+r,r,fe);if(Ye)return Ye;var rt=r>0?fe.end:Z(fe.begin,-1);return rt!=null&&!(r>0&&rt==t.text.length)&&(Ye=We(r>0?0:o.length-1,r,te(rt)),Ye)?Ye:null}var Mi={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Te)},killLine:function(e){return li(e,function(t){if(t.empty()){var n=xt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:He(t.head.line+1,0)}:{from:t.head,to:He(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return li(e,function(t){return{from:He(t.from().line,0),to:f(e.doc,He(t.to().line+1,0))}})},delLineLeft:function(e){return li(e,function(t){return{from:He(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return li(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return li(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(He(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(He(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ae)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Ae)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},Ae)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,o=0;o<n.length;o++){var D=n[o].from(),H=Y(e.getLine(D.line),D.ch,r);t.push(de(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return en(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var o=t[r].head,D=xt(e.doc,o.line).text;if(D){if(o.ch==D.length&&(o=new He(o.line,o.ch-1)),o.ch>0)o=new He(o.line,o.ch+1),e.replaceRange(D.charAt(o.ch-1)+D.charAt(o.ch-2),He(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var H=xt(e.doc,o.line-1).text;H&&(o=new He(o.line,1),e.replaceRange(D.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),He(o.line-1,H.length-1),o,"+transpose"))}}n.push(new or(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return en(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);ei(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=xt(e.doc,t),r=Vr(n);return r!=n&&(t=Ft(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=xt(e.doc,t),r=Xn(n);return r!=n&&(t=Ft(r)),ja(!0,e,n,t,-1)}function fs(e,t){var n=hs(e,t.line),r=xt(e.doc,n.line),o=tt(r,e.doc.direction);if(!o||o[0].level==0){var D=Math.max(n.ch,r.text.search(/\S/)),H=t.line==n.line&&t.ch<=D&&t.ch;return He(n.line,H?0:D,n.sticky)}return n}function aa(e,t,n){if(typeof t=="string"&&(t=Mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),o=t(e)!=Oe}finally{e.display.shift=r,e.state.suppressEdits=!1}return o}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var o=si(t,e.state.keyMaps[r],n,e);if(o)return o}return e.options.extraKeys&&si(t,e.options.extraKeys,n,e)||si(t,e.options.keyMap,n,e)}var Ul=new ee;function Ii(e,t,n,r){var o=e.state.keySeq;if(o){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==o&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,o+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var o=Nl(e,t,r);return o=="multi"&&(e.state.keySeq=t),o=="handled"&&Nr(e,"keyHandled",e,t,n),(o=="handled"||o=="multi")&&(ne(n),Sa(e)),!!o}function ms(e,t){var n=cs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ii(e,"Shift-"+n,t,function(r){return aa(e,r,!0)})||Ii(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):Ii(e,n,t,function(r){return aa(e,r)}):!1}function Fl(e,t,n){return Ii(e,"'"+n+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=I(),ze(t,e))return;W&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ms(t,e);p&&(Wa=r?n:null,!r&&n==88&&!Ht&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(C(t,"CodeMirror-crosshair"),it(document,"keyup",n),it(document,"mouseover",n))}Ie(document,"keyup",n),Ie(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),ze(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Cn(t.display,e)||ze(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(p&&n==Wa){Wa=null,ne(e);return}if(p&&(!e.which||e.which<10)&&ms(t,e))return;var o=String.fromCharCode(r==null?n:r);if(o=="\b")return;if(Fl(t,e,o))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var Ni,Ui;function Wl(e,t){var n=+new Date;return Ui&&Ui.compare(n,e,t)?(Ni=Ui=null,"triple"):Ni&&Ni.compare(n,e,t)?(Ui=new Ha(n,e,t),Ni=null,"double"):(Ni=new Ha(n,e,t),Ui=null,"single")}function bs(e){var t=this,n=t.display;if(ze(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Cn(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Bn(t,e),o=Le(e),D=r?Wl(r,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,o,r,D,e))return;o==1?r?zl(t,r,D,e):Ne(e)==n.scroller&&ne(e):o==2?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):o==3&&(R?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,n,r,o){var D="Click";return r=="double"?D="Double"+D:r=="triple"&&(D="Triple"+D),D=(t==1?"Left":t==2?"Middle":"Right")+D,Ii(e,ds(D,o),o,function(H){if(typeof H=="string"&&(H=Mi[H]),!H)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=H(e,n)!=Oe}finally{e.state.suppressEdits=!1}return Z})}function Gl(e,t,n){var r=e.getOption("configureMouse"),o=r?r(e,t,n):{};if(o.unit==null){var D=l?n.shiftKey&&n.metaKey:n.altKey;o.unit=D?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||n.shiftKey),o.addNew==null&&(o.addNew=s?n.metaKey:n.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(s?n.altKey:n.ctrlKey)),o}function zl(e,t,n,r){W?setTimeout(M(bo,e),0):e.curOp.focus=I();var o=Gl(e,n,r),D=e.doc.sel,H;e.options.dragDrop&&Ke&&!e.isReadOnly()&&n=="single"&&(H=D.contains(t))>-1&&(ft((H=D.ranges[H]).from(),t)<0||t.xRel>0)&&(ft(H.to(),t)>0||t.xRel<0)?Kl(e,r,t,o):Vl(e,r,t,o)}function Kl(e,t,n,r){var o=e.display,D=!1,H=Dr(e,function(te){O&&(o.scroller.draggable=!1),e.state.draggingText=!1,it(o.wrapper.ownerDocument,"mouseup",H),it(o.wrapper.ownerDocument,"mousemove",Z),it(o.scroller,"dragstart",q),it(o.scroller,"drop",H),D||(ne(te),r.addNew||qi(e.doc,n,null,null,r.extend),O&&!w||W&&B==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),Z=function(te){D=D||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},q=function(){return D=!0};O&&(o.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Ie(o.wrapper.ownerDocument,"mouseup",H),Ie(o.wrapper.ownerDocument,"mousemove",Z),Ie(o.scroller,"dragstart",q),Ie(o.scroller,"drop",H),Eo(e),setTimeout(function(){return o.input.focus()},20)}function Es(e,t,n){if(n=="char")return new or(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new or(He(t.line,0),f(e.doc,He(t.line+1,0)));var r=n(e,t);return new or(r.from,r.to)}function Vl(e,t,n,r){var o=e.display,D=e.doc;ne(t);var H,Z,q=D.sel,te=q.ranges;if(r.addNew&&!r.extend?(Z=D.sel.contains(n),Z>-1?H=te[Z]:H=new or(n,n)):(H=D.sel.primary(),Z=D.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new or(n,n)),n=Bn(e,t,!0,!0),Z=-1;else{var fe=Es(e,n,r.unit);r.extend?H=Na(H,fe.anchor,fe.head,r.extend):H=fe}r.addNew?Z==-1?(Z=te.length,Fr(D,pn(e,te.concat([H]),Z),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Z].empty()&&r.unit=="char"&&!r.extend?(Fr(D,pn(e,te.slice(0,Z).concat(te.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),q=D.sel):Ua(D,Z,H,Re):(Z=0,Fr(D,new ln([H],0),Re),q=D.sel);var Ee=n;function Pe(st){if(ft(Ee,st)==0)return;if(Ee=st,r.unit=="rectangle"){for(var St=[],Ot=e.options.tabSize,Rt=Y(xt(D,n.line).text,n.ch,Ot),zt=Y(xt(D,st.line).text,st.ch,Ot),dr=Math.min(Rt,zt),Or=Math.max(Rt,zt),pr=Math.min(n.line,st.line),tn=Math.min(e.lastLine(),Math.max(n.line,st.line));pr<=tn;pr++){var Jr=xt(D,pr).text,Cr=we(Jr,dr,Ot);dr==Or?St.push(new or(He(pr,Cr),He(pr,Cr))):Jr.length>Cr&&St.push(new or(He(pr,Cr),He(pr,we(Jr,Or,Ot))))}St.length||St.push(new or(n,n)),Fr(D,pn(e,q.ranges.slice(0,Z).concat(St),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(st)}else{var Zr=H,Ur=Es(e,st,r.unit),wr=Zr.anchor,Sr;ft(Ur.anchor,wr)>0?(Sr=Ur.head,wr=ir(Zr.from(),Ur.anchor)):(Sr=Ur.anchor,wr=nr(Zr.to(),Ur.head));var mr=q.ranges.slice(0);mr[Z]=Xl(e,new or(f(D,wr),Sr)),Fr(D,pn(e,mr,Z),Re)}}var De=o.wrapper.getBoundingClientRect(),We=0;function Ye(st){var St=++We,Ot=Bn(e,st,!0,r.unit=="rectangle");if(!Ot)return;if(ft(Ot,Ee)!=0){e.curOp.focus=I(),Pe(Ot);var Rt=Xi(o,D);(Ot.line>=Rt.to||Ot.line<Rt.from)&&setTimeout(Dr(e,function(){We==St&&Ye(st)}),150)}else{var zt=st.clientY<De.top?-20:st.clientY>De.bottom?20:0;zt&&setTimeout(Dr(e,function(){if(We!=St)return;o.scroller.scrollTop+=zt,Ye(st)}),50)}}function rt(st){e.state.selectingText=!1,We=Infinity,st&&(ne(st),o.input.focus()),it(o.wrapper.ownerDocument,"mousemove",ot),it(o.wrapper.ownerDocument,"mouseup",vt),D.history.lastSelOrigin=null}var ot=Dr(e,function(st){st.buttons===0||!Le(st)?rt(st):Ye(st)}),vt=Dr(e,rt);e.state.selectingText=vt,Ie(o.wrapper.ownerDocument,"mousemove",ot),Ie(o.wrapper.ownerDocument,"mouseup",vt)}function Xl(e,t){var n=t.anchor,r=t.head,o=xt(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var D=tt(o);if(!D)return t;var H=Xe(D,n.ch,n.sticky),Z=D[H];if(Z.from!=n.ch&&Z.to!=n.ch)return t;var q=H+(Z.from==n.ch==(Z.level!=1)?0:1);if(q==0||q==D.length)return t;var te;if(r.line!=n.line)te=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=Xe(D,r.ch,r.sticky),Ee=fe-H||(r.ch-n.ch)*(Z.level==1?-1:1);fe==q-1||fe==q?te=Ee<0:te=Ee>0}var Pe=D[q+(te?-1:0)],De=te==(Pe.level==1),We=De?Pe.from:Pe.to,Ye=De?"after":"before";return n.ch==We&&n.sticky==Ye?t:new or(new He(n.line,We,Ye),r)}function xs(e,t,n,r){var o,D;if(t.touches)o=t.touches[0].clientX,D=t.touches[0].clientY;else try{o=t.clientX,D=t.clientY}catch(Pe){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ne(t);var H=e.display,Z=H.lineDiv.getBoundingClientRect();if(D>Z.bottom||!ye(e,n))return he(t);D-=Z.top-H.viewOffset;for(var q=0;q<e.display.gutterSpecs.length;++q){var te=H.gutters.childNodes[q];if(te&&te.getBoundingClientRect().right>=o){var fe=Ir(e.doc,D),Ee=e.display.gutterSpecs[q];return Be(e,n,e,fe,Ee.className,t),he(t)}}}function Ga(e,t){return xs(e,t,"gutterClick",!0)}function Cs(e,t){if(Cn(e.display,t)||Yl(e,t))return;if(ze(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return ye(e,"gutterContextMenu")?xs(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var ui={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function n(r,o,D,H){e.defaults[r]=o,D&&(t[r]=H?function(Z,q,te){te!=ui&&D(Z,q,te)}:D)}e.defineOption=n,e.Init=ui,n("value","",function(r,o){return r.setValue(o)},!0),n("mode",null,function(r,o){r.doc.modeOption=o,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),Yr(r)},!0),n("lineSeparator",null,function(r,o){if(r.doc.lineSep=o,!o)return;var D=[],H=r.doc.first;r.doc.iter(function(q){for(var te=0;;){var fe=q.text.indexOf(o,te);if(fe==-1)break;te=fe+o.length,D.push(He(H,fe))}H++});for(var Z=D.length-1;Z>=0;Z--)ai(r.doc,o,D[Z],He(D[Z].line,D[Z].ch+o.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,o,D){r.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),D!=ui&&r.refresh()}),n("specialCharPlaceholder",tr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,o){return r.getInputField().spellcheck=o},!0),n("autocorrect",!1,function(r,o){return r.getInputField().autocorrect=o},!0),n("autocapitalize",!1,function(r,o){return r.getInputField().autocapitalize=o},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),Ti(r)},!0),n("keyMap","default",function(r,o,D){var H=ia(o),Z=D!=ui&&ia(D);Z&&Z.detach&&Z.detach(r,H),H.attach&&H.attach(r,Z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,o){r.display.gutterSpecs=ka(o,r.options.lineNumbers),Ti(r)},!0),n("fixedGutter",!0,function(r,o){r.display.gutters.style.left=o?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return ti(r)},!0),n("scrollbarStyle","native",function(r){_o(r),ti(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,o){r.display.gutterSpecs=ka(r.options.gutters,o),Ti(r)},!0),n("firstLineNumber",1,Ti,!0),n("lineNumberFormatter",function(r){return r},Ti,!0),n("showCursorWhenSelecting",!1,yi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,o){o=="nocursor"&&(qn(r),r.display.input.blur()),r.display.input.readOnlyChanged(o)}),n("screenReaderLabel",null,function(r,o){o=o===""?null:o,r.display.input.screenReaderLabelChanged(o)}),n("disableInput",!1,function(r,o){o||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,yi,!0),n("singleCursorHeightPerLine",!0,yi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wi,!0),n("addModeClass",!1,wi,!0),n("pollInterval",100),n("undoDepth",200,function(r,o){return r.doc.history.undoDepth=o}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wi,!0),n("moveInputWithCursor",!0,function(r,o){o||r.display.input.resetPosition()}),n("tabindex",null,function(r,o){return r.display.input.getField().tabIndex=o||""}),n("autofocus",null),n("direction","ltr",function(r,o){return r.doc.setDirection(o)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=ui;if(!t!=!r){var o=e.display.dragFunctions,D=t?Ie:it;D(e.display.scroller,"dragstart",o.start),D(e.display.scroller,"dragenter",o.enter),D(e.display.scroller,"dragover",o.over),D(e.display.scroller,"dragleave",o.leave),D(e.display.scroller,"drop",o.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Ca(e),Yr(e),vi(e),setTimeout(function(){return ti(e)},100)}function fr(e,t){var n=this;if(!(this instanceof fr))return new fr(e,t);this.options=t=t?N(t):{},N(Ts,t,!1);var r=t.value;typeof r=="string"?r=new $r(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var o=new fr.inputStyles[t.inputStyle](this),D=this.display=new dl(e,r,o,t);D.wrapper.CodeMirror=this,Ss(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 ee,keySeq:null,specialChars:null},t.autofocus&&!i&&D.input.focus(),W&&B<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Rl(),Gn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):qn(this);for(var H in oa)oa.hasOwnProperty(H)&&oa[H](this,t[H],ui);Ro(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<za.length;++Z)za[Z](this);zn(this),O&&t.lineWrapping&&getComputedStyle(D.lineDiv).textRendering=="optimizelegibility"&&(D.lineDiv.style.textRendering="auto")}fr.defaults=Ts,fr.optionHandlers=oa;function Ql(e){var t=e.display;Ie(t.scroller,"mousedown",Dr(e,bs)),W&&B<11?Ie(t.scroller,"dblclick",Dr(e,function(q){if(ze(e,q))return;var te=Bn(e,q);if(!te||Ga(e,q)||Cn(e.display,q))return;ne(q);var fe=e.findWordAt(te);qi(e.doc,fe.anchor,fe.head)})):Ie(t.scroller,"dblclick",function(q){return ze(e,q)||ne(q)}),Ie(t.scroller,"contextmenu",function(q){return Cs(e,q)}),Ie(t.input.getField(),"contextmenu",function(q){t.scroller.contains(q.target)||Cs(e,q)});var n,r={end:0};function o(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function D(q){if(q.touches.length!=1)return!1;var te=q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function H(q,te){if(te.left==null)return!0;var fe=te.left-q.left,Ee=te.top-q.top;return fe*fe+Ee*Ee>20*20}Ie(t.scroller,"touchstart",function(q){if(!ze(e,q)&&!D(q)&&!Ga(e,q)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},q.touches.length==1&&(t.activeTouch.left=q.touches[0].pageX,t.activeTouch.top=q.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(q){var te=t.activeTouch;if(te&&!Cn(t,q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var fe=e.coordsChar(t.activeTouch,"page"),Ee;!te.prev||H(te,te.prev)?Ee=new or(fe,fe):!te.prev.prev||H(te,te.prev.prev)?Ee=e.findWordAt(fe):Ee=new or(He(fe.line,0),f(e.doc,He(fe.line+1,0))),e.setSelection(Ee.anchor,Ee.head),e.focus(),ne(q)}o()}),Ie(t.scroller,"touchcancel",o),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ei(e,t.scroller.scrollTop),Wn(e,t.scroller.scrollLeft,!0),Be(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(q){return Oo(e,q)}),Ie(t.scroller,"DOMMouseScroll",function(q){return Oo(e,q)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(q){ze(e,q)||ve(q)},over:function(q){ze(e,q)||(Ll(e,q),ve(q))},start:function(q){return Al(e,q)},drop:Dr(e,_l),leave:function(q){ze(e,q)||os(e)}};var Z=t.input.getField();Ie(Z,"keyup",function(q){return vs.call(e,q)}),Ie(Z,"keydown",Dr(e,gs)),Ie(Z,"keypress",Dr(e,ys)),Ie(Z,"focus",function(q){return Ta(e,q)}),Ie(Z,"blur",function(q){return qn(e,q)})}var za=[];fr.defineInitHook=function(e){return za.push(e)};function Fi(e,t,n,r){var o=e.doc,D;n==null&&(n="add"),n=="smart"&&(o.mode.indent?D=nt(e,t).state:n="prev");var H=e.options.tabSize,Z=xt(o,t),q=Y(Z.text,null,H);Z.stateAfter&&(Z.stateAfter=null);var te=Z.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(Z.text))fe=0,n="not";else if(n=="smart"&&(fe=o.mode.indent(D,Z.text.slice(te.length),Z.text),fe==Oe||fe>150)){if(!r)return;n="prev"}n=="prev"?t>o.first?fe=Y(xt(o,t-1).text,null,H):fe=0:n=="add"?fe=q+e.options.indentUnit:n=="subtract"?fe=q-e.options.indentUnit:typeof n=="number"&&(fe=q+n),fe=Math.max(0,fe);var Ee="",Pe=0;if(e.options.indentWithTabs)for(var De=Math.floor(fe/H);De;--De)Pe+=H,Ee+=" ";if(Pe<fe&&(Ee+=de(fe-Pe)),Ee!=te)return ai(o,Ee,He(t,0),He(t,te.length),"+input"),Z.stateAfter=null,!0;for(var We=0;We<o.sel.ranges.length;We++){var Ye=o.sel.ranges[We];if(Ye.head.line==t&&Ye.head.ch<te.length){var rt=He(t,te.length);Ua(o,We,new or(rt,rt));break}}}var mn=null;function sa(e){mn=e}function Ka(e,t,n,r,o){var D=e.doc;e.display.shift=!1,r||(r=D.sel);var H=+new Date-200,Z=o=="paste"||e.state.pasteIncoming>H,q=Pt(t),te=null;if(Z&&r.ranges.length>1)if(mn&&mn.text.join(`
`)==t){if(r.ranges.length%mn.text.length==0){te=[];for(var fe=0;fe<mn.text.length;fe++)te.push(D.splitLines(mn.text[fe]))}}else q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=ce(q,function(ot){return[ot]}));for(var Ee=e.curOp.updateInput,Pe=r.ranges.length-1;Pe>=0;Pe--){var De=r.ranges[Pe],We=De.from(),Ye=De.to();De.empty()&&(n&&n>0?We=He(We.line,We.ch-n):e.state.overwrite&&!Z?Ye=He(Ye.line,Math.min(xt(D,Ye.line).text.length,Ye.ch+re(q).length)):Z&&mn&&mn.lineWise&&mn.text.join(`
`)==q.join(`
`)&&(We=Ye=He(We.line,0)));var rt={from:We,to:Ye,text:te?te[Pe%te.length]:q,origin:o||(Z?"paste":e.state.cutIncoming>H?"cut":"+input")};ii(e.doc,rt),Nr(e,"inputRead",e,rt)}t&&!Z&&_s(e,t),ei(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Ee),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&en(t,function(){return Ka(t,n,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var o=n.ranges[r];if(o.head.ch>100||r&&n.ranges[r-1].head.line==o.head.line)continue;var D=e.getModeAt(o.head),H=!1;if(D.electricChars){for(var Z=0;Z<D.electricChars.length;Z++)if(t.indexOf(D.electricChars.charAt(Z))>-1){H=Fi(e,o.head.line,"smart");break}}else D.electricInput&&(D.electricInput.test(xt(e.doc,o.head.line).text.slice(0,o.head.ch))&&(H=Fi(e,o.head.line,"smart")));H&&Nr(e,"electricInput",e,o.head.line)}}function As(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var o=e.doc.sel.ranges[r].head.line,D={anchor:He(o,0),head:He(o+1,0)};n.push(D),t.push(e.getRange(D.anchor,D.head))}return{text:t,ranges:n}}function Ls(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Ls(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,o){var D=this.options,H=D[r];if(D[r]==o&&r!="mode")return;D[r]=o,t.hasOwnProperty(r)&&Dr(this,t[r])(this,o,H),Be(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,o){this.state.keyMaps[o?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var o=this.state.keyMaps,D=0;D<o.length;++D)if(o[D]==r||o[D].name==r)return o.splice(D,1),!0},addOverlay:Wr(function(r,o){var D=r.token?r:e.getMode(this.options,r);if(D.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:D,modeSpec:r,opaque:o&&o.opaque,priority:o&&o.priority||0},function(H){return H.priority}),this.state.modeGen++,Yr(this)}),removeOverlay:Wr(function(r){for(var o=this.state.overlays,D=0;D<o.length;++D){var H=o[D].modeSpec;if(H==r||typeof r=="string"&&H.name==r){o.splice(D,1),this.state.modeGen++,Yr(this);return}}}),indentLine:Wr(function(r,o,D){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),Tr(this.doc,r)&&Fi(this,r,o,D)}),indentSelection:Wr(function(r){for(var o=this.doc.sel.ranges,D=-1,H=0;H<o.length;H++){var Z=o[H];if(Z.empty())Z.head.line>D&&(Fi(this,Z.head.line,r,!0),D=Z.head.line,H==this.doc.sel.primIndex&&ei(this));else{var q=Z.from(),te=Z.to(),fe=Math.max(D,q.line);D=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var Ee=fe;Ee<D;++Ee)Fi(this,Ee,r);var Pe=this.doc.sel.ranges;q.ch==0&&o.length==Pe.length&&Pe[H].from().ch>0&&Ua(this.doc,H,new or(q,Pe[H].to()),Te)}}}),getTokenAt:function(r,o){return sr(this,r,o)},getLineTokens:function(r,o){return sr(this,He(r),o,!0)},getTokenTypeAt:function(r){r=f(this.doc,r);var o=Ge(this,xt(this.doc,r.line)),D=0,H=(o.length-1)/2,Z=r.ch,q;if(Z==0)q=o[2];else for(;;){var te=D+H>>1;if((te?o[te*2-1]:0)>=Z)H=te;else if(o[te*2+1]<Z)D=te+1;else{q=o[te*2+2];break}}var fe=q?q.indexOf("overlay "):-1;return fe<0?q:fe==0?null:q.slice(0,fe-1)},getModeAt:function(r){var o=this.doc.mode;return o.innerMode?e.innerMode(o,this.getTokenAt(r).state).mode:o},getHelper:function(r,o){return this.getHelpers(r,o)[0]},getHelpers:function(r,o){var D=[];if(!n.hasOwnProperty(o))return D;var H=n[o],Z=this.getModeAt(r);if(typeof Z[o]=="string")H[Z[o]]&&D.push(H[Z[o]]);else if(Z[o])for(var q=0;q<Z[o].length;q++){var te=H[Z[o][q]];te&&D.push(te)}else Z.helperType&&H[Z.helperType]?D.push(H[Z.helperType]):H[Z.name]&&D.push(H[Z.name]);for(var fe=0;fe<H._global.length;fe++){var Ee=H._global[fe];Ee.pred(Z,this)&&le(D,Ee.val)==-1&&D.push(Ee.val)}return D},getStateAfter:function(r,o){var D=this.doc;return r=K(D,r==null?D.first+D.size-1:r),nt(this,r+1,o).state},cursorCoords:function(r,o){var D,H=this.doc.sel.primary();return r==null?D=H.head:typeof r=="object"?D=f(this.doc,r):D=r?H.from():H.to(),fn(this,D,o||"page")},charCoords:function(r,o){return ga(this,f(this.doc,r),o||"page")},coordsChar:function(r,o){return r=co(this,r,o||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,o){return r=co(this,{top:r,left:0},o||"page").top,Ir(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,o,D){var H=!1,Z;if(typeof r=="number"){var q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>q&&(r=q,H=!0),Z=xt(this.doc,r)}else Z=r;return Gi(this,Z,{top:0,left:0},o||"page",D||H).top+(H?this.doc.height-hn(Z):0)},defaultTextHeight:function(){return Zn(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,o,D,H,Z){var q=this.display;r=fn(this,f(this.doc,r));var te=r.bottom,fe=r.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),q.sizer.appendChild(o),H=="over")te=r.top;else if(H=="above"||H=="near"){var Ee=Math.max(q.wrapper.clientHeight,this.doc.height),Pe=Math.max(q.sizer.clientWidth,q.lineSpace.clientWidth);(H=="above"||r.bottom+o.offsetHeight>Ee)&&r.top>o.offsetHeight?te=r.top-o.offsetHeight:r.bottom+o.offsetHeight<=Ee&&(te=r.bottom),fe+o.offsetWidth>Pe&&(fe=Pe-o.offsetWidth)}o.style.top=te+"px",o.style.left=o.style.right="",Z=="right"?(fe=q.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(Z=="left"?fe=0:Z=="middle"&&(fe=(q.sizer.clientWidth-o.offsetWidth)/2),o.style.left=fe+"px"),D&&Js(this,{left:fe,top:te,right:fe+o.offsetWidth,bottom:te+o.offsetHeight})},triggerOnKeyDown:Wr(gs),triggerOnKeyPress:Wr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Wr(bs),execCommand:function(r){if(Mi.hasOwnProperty(r))return Mi[r].call(null,this)},triggerElectric:Wr(function(r){_s(this,r)}),findPosH:function(r,o,D,H){var Z=1;o<0&&(Z=-1,o=-o);for(var q=f(this.doc,r),te=0;te<o&&!(q=Va(this.doc,q,Z,D,H),q.hitSide);++te);return q},moveH:Wr(function(r,o){var D=this;this.extendSelectionsBy(function(H){return D.display.shift||D.doc.extend||H.empty()?Va(D.doc,H.head,r,o,D.options.rtlMoveVisually):r<0?H.from():H.to()},Ae)}),deleteH:Wr(function(r,o){var D=this.doc.sel,H=this.doc;D.somethingSelected()?H.replaceSelection("",null,"+delete"):li(this,function(Z){var q=Va(H,Z.head,r,o,!1);return r<0?{from:q,to:Z.head}:{from:Z.head,to:q}})}),findPosV:function(r,o,D,H){var Z=1,q=H;o<0&&(Z=-1,o=-o);for(var te=f(this.doc,r),fe=0;fe<o;++fe){var Ee=fn(this,te,"div");if(q==null?q=Ee.left:Ee.left=q,te=Ds(this,Ee,Z,D),te.hitSide)break}return te},moveV:Wr(function(r,o){var D=this,H=this.doc,Z=[],q=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(fe){if(q)return r<0?fe.from():fe.to();var Ee=fn(D,fe.head,"div");fe.goalColumn!=null&&(Ee.left=fe.goalColumn),Z.push(Ee.left);var Pe=Ds(D,Ee,r,o);return o=="page"&&fe==H.sel.primary()&&_a(D,ga(D,Pe,"div").top-Ee.top),Pe},Ae),Z.length)for(var te=0;te<H.sel.ranges.length;te++)H.sel.ranges[te].goalColumn=Z[te]}),findWordAt:function(r){var o=this.doc,D=xt(o,r.line).text,H=r.ch,Z=r.ch;if(D){var q=this.getHelper(r,"wordChars");(r.sticky=="before"||Z==D.length)&&H?--H:++Z;for(var te=D.charAt(H),fe=_e(te,q)?function(Ee){return _e(Ee,q)}:/\s/.test(te)?function(Ee){return/\s/.test(Ee)}:function(Ee){return!/\s/.test(Ee)&&!_e(Ee)};H>0&&fe(D.charAt(H-1));)--H;for(;Z<D.length&&fe(D.charAt(Z));)++Z}return new or(He(r.line,H),He(r.line,Z))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),Be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Wr(function(r,o){bi(this,r,o)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-bn(this)-this.display.barHeight,width:r.scrollWidth-bn(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Un(this)}},scrollIntoView:Wr(function(r,o){r==null?(r={from:this.doc.sel.primary().head,to:null},o==null&&(o=this.options.cursorScrollMargin)):typeof r=="number"?r={from:He(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=o||0,r.from.line!=null?Zs(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Wr(function(r,o){var D=this,H=function(q){return typeof q=="number"||/^\d+$/.test(String(q))?q+"px":q};r!=null&&(this.display.wrapper.style.width=H(r)),o!=null&&(this.display.wrapper.style.height=H(o)),this.options.lineWrapping&&so(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(q){if(q.widgets){for(var te=0;te<q.widgets.length;te++)if(q.widgets[te].noHScroll){An(D,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,Be(this,"refresh",this)}),operation:function(r){return en(this,r)},startOperation:function(){return Gn(this)},endOperation:function(){return zn(this)},refresh:Wr(function(){var r=this.display.cachedTextHeight;Yr(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-Zn(this.display))>.5||this.options.lineWrapping)&&Ca(this),Be(this,"refresh",this)}),swapDoc:Wr(function(r){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Nr(this,"swapDoc",this,o),o}),phrase:function(r){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,r)?o[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}},xe(e),e.registerHelper=function(r,o,D){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][o]=D},e.registerGlobalHelper=function(r,o,D,H){e.registerHelper(r,o,H),n[r]._global.push({pred:D,val:H})}}function Va(e,t,n,r,o){var D=t,H=n,Z=xt(e,t.line),q=o&&e.direction=="rtl"?-n:n;function te(){var vt=t.line+q;return vt<e.first||vt>=e.first+e.size?!1:(t=new He(vt,t.ch,t.sticky),Z=xt(e,vt))}function fe(vt){var st;if(r=="codepoint"){var St=Z.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(St)?st=null:st=new He(t.line,Math.max(0,Math.min(Z.text.length,t.ch+n*(St>=55296&&St<56320?2:1))),-n)}else o?st=Ml(e.cm,Z,t,n):st=Ba(Z,t,n);if(st==null)if(!vt&&te())t=ja(o,e.cm,Z,t.line,q);else return!1;else t=st;return!0}if(r=="char"||r=="codepoint")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var Ee=null,Pe=r=="group",De=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(n<0&&!fe(!We));We=!1){var Ye=Z.text.charAt(t.ch)||`
`,rt=_e(Ye,De)?"w":Pe&&Ye==`
`?"n":!Pe||/\s/.test(Ye)?null:"p";if(Pe&&!We&&!rt&&(rt="s"),Ee&&Ee!=rt){n<0&&(n=1,fe(),t.sticky="after");break}if(rt&&(Ee=rt),n>0&&!fe(!We))break}var ot=ta(e,t,D,H,!0);return Wt(D,ot)&&(ot.hitSide=!0),ot}function Ds(e,t,n,r){var o=e.doc,D=t.left,H;if(r=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),q=Math.max(Z-.5*Zn(e.display),3);H=(n>0?t.bottom:t.top)+n*q}else r=="line"&&(H=n>0?t.bottom+3:t.top-3);for(var te;!(te=ya(e,D,H),!te.outside);){if(n<0?H<=0:H>=o.height){te.hitSide=!0;break}H+=n*5}return te}var ur=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ur.prototype.init=function(e){var t=this,n=this,r=n.cm,o=n.div=e.lineDiv;Ls(o,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function D(Z){for(var q=Z.target;q;q=q.parentNode){if(q==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(q.className))break}return!1}Ie(o,"paste",function(Z){if(!D(Z)||ze(r,Z)||ws(Z,r))return;B<=11&&setTimeout(Dr(r,function(){return t.updateFromDOM()}),20)}),Ie(o,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),Ie(o,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),Ie(o,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(o,"touchstart",function(){return n.forceCompositionEnd()}),Ie(o,"input",function(){t.composing||t.readFromDOMSoon()});function H(Z){if(!D(Z)||ze(r,Z))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Z.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var q=As(r);sa({lineWise:!0,text:q.text}),Z.type=="cut"&&r.operation(function(){r.setSelections(q.ranges,0,Te),r.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var te=mn.text.join(`
`);if(Z.clipboardData.setData("Text",te),Z.clipboardData.getData("Text")==te){Z.preventDefault();return}}var fe=Rs(),Ee=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),Ee.value=mn.text.join(`
`);var Pe=document.activeElement;z(Ee),setTimeout(function(){r.display.lineSpace.removeChild(fe),Pe.focus(),Pe==o&&n.showPrimarySelection()},50)}Ie(o,"copy",H),Ie(o,"cut",H)},ur.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ur.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},ur.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},ur.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ur.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line<t.display.viewFrom){e.removeAllRanges();return}var D=la(t,e.anchorNode,e.anchorOffset),H=la(t,e.focusNode,e.focusOffset);if(D&&!D.bad&&H&&!H.bad&&ft(ir(D,H),r)==0&&ft(nr(D,H),o)==0)return;var Z=t.display.view,q=r.line>=t.display.viewFrom&&ks(t,r)||{node:Z[0].measure.map[2],offset:0},te=o.line<t.display.viewTo&&ks(t,o);if(!te){var fe=Z[Z.length-1].measure,Ee=fe.maps?fe.maps[fe.maps.length-1]:fe.map;te={node:Ee[Ee.length-1],offset:Ee[Ee.length-2]-Ee[Ee.length-3]}}if(!q||!te){e.removeAllRanges();return}var Pe=e.rangeCount&&e.getRangeAt(0),De;try{De=T(q.node,q.offset,te.offset,te.node)}catch(We){}De&&(!k&&t.state.focused?(e.collapse(q.node,q.offset),De.collapsed||(e.removeAllRanges(),e.addRange(De))):(e.removeAllRanges(),e.addRange(De)),Pe&&e.anchorNode==null?e.addRange(Pe):k&&this.startGracePeriod()),this.rememberSelection()},ur.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)},ur.prototype.showMultipleSelections=function(e){c(this.cm.display.cursorDiv,e.cursors),c(this.cm.display.selectionDiv,e.selection)},ur.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ur.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return L(this.div,t)},ur.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},ur.prototype.blur=function(){this.div.blur()},ur.prototype.getField=function(){return this.div},ur.prototype.supportsTouch=function(){return!0},ur.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():en(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)},ur.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ur.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(a&&d&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);n&&r&&en(t,function(){Fr(t.doc,Rn(n,r),Te),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},ur.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),o=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=He(r.line-1,xt(e.doc,r.line-1).length)),o.ch==xt(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=He(o.line+1,0)),r.line<t.viewFrom||o.line>t.viewTo-1)return!1;var D,H,Z;r.line==t.viewFrom||(D=jn(e,r.line))==0?(H=Ft(t.view[0].line),Z=t.view[0].node):(H=Ft(t.view[D].line),Z=t.view[D-1].node.nextSibling);var q=jn(e,o.line),te,fe;if(q==t.view.length-1?(te=t.viewTo-1,fe=t.lineDiv.lastChild):(te=Ft(t.view[q+1].line)-1,fe=t.view[q+1].node.previousSibling),!Z)return!1;for(var Ee=e.doc.splitLines(tu(e,Z,fe,H,te)),Pe=Mr(e.doc,He(H,0),He(te,xt(e.doc,te).text.length));Ee.length>1&&Pe.length>1;)if(re(Ee)==re(Pe))Ee.pop(),Pe.pop(),te--;else if(Ee[0]==Pe[0])Ee.shift(),Pe.shift(),H++;else break;for(var De=0,We=0,Ye=Ee[0],rt=Pe[0],ot=Math.min(Ye.length,rt.length);De<ot&&Ye.charCodeAt(De)==rt.charCodeAt(De);)++De;for(var vt=re(Ee),st=re(Pe),St=Math.min(vt.length-(Ee.length==1?De:0),st.length-(Pe.length==1?De:0));We<St&&vt.charCodeAt(vt.length-We-1)==st.charCodeAt(st.length-We-1);)++We;if(Ee.length==1&&Pe.length==1&&H==r.line)for(;De&&De>r.ch&&vt.charCodeAt(vt.length-We-1)==st.charCodeAt(st.length-We-1);)De--,We++;Ee[Ee.length-1]=vt.slice(0,vt.length-We).replace(/^\u200b+/,""),Ee[0]=Ee[0].slice(De).replace(/\u200b+$/,"");var Ot=He(H,De),Rt=He(te,Pe.length?re(Pe).length-We:0);if(Ee.length>1||Ee[0]||ft(Ot,Rt))return ai(e.doc,Ee,Ot,Rt,"+input"),!0},ur.prototype.ensurePolled=function(){this.forceCompositionEnd()},ur.prototype.reset=function(){this.forceCompositionEnd()},ur.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},ur.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)},ur.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&en(this.cm,function(){return Yr(e.cm)})},ur.prototype.setUneditable=function(e){e.contentEditable="false"},ur.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Dr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},ur.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ur.prototype.onContextMenu=function(){},ur.prototype.resetPosition=function(){},ur.prototype.needsContentAttribute=!0;function ks(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=xt(e.doc,t.line),o=ro(n,r,t.line),D=tt(r,e.doc.direction),H="left";if(D){var Z=Xe(D,t.ch);H=Z%2?"right":"left"}var q=ao(o.map,t.ch,H);return q.offset=q.collapse=="right"?q.end:q.start,q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function di(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,o){var D="",H=!1,Z=e.doc.lineSeparator(),q=!1;function te(De){return function(We){return We.id==De}}function fe(){H&&(D+=Z,q&&(D+=Z),H=q=!1)}function Ee(De){De&&(fe(),D+=De)}function Pe(De){if(De.nodeType==1){var We=De.getAttribute("cm-text");if(We){Ee(We);return}var Ye=De.getAttribute("cm-marker"),rt;if(Ye){var ot=e.findMarks(He(r,0),He(o+1,0),te(+Ye));ot.length&&(rt=ot[0].find(0))&&Ee(Mr(e.doc,rt.from,rt.to).join(Z));return}if(De.getAttribute("contenteditable")=="false")return;var vt=/^(pre|div|p|li|table|br)$/i.test(De.nodeName);if(!/^br$/i.test(De.nodeName)&&De.textContent.length==0)return;vt&&fe();for(var st=0;st<De.childNodes.length;st++)Pe(De.childNodes[st]);/^(pre|p)$/i.test(De.nodeName)&&(q=!0),vt&&(H=!0)}else De.nodeType==3&&Ee(De.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Pe(t),t==n);)t=t.nextSibling,q=!1;return D}function la(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return di(e.clipPos(He(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var o=0;o<e.display.view.length;o++){var D=e.display.view[o];if(D.node==r)return ru(D,t,n)}}function ru(e,t,n){var r=e.text.firstChild,o=!1;if(!t||!L(r,t))return di(He(Ft(e.line),0),!0);if(t==r&&(o=!0,t=r.childNodes[n],n=0,!t)){var D=e.rest?re(e.rest):e.line;return di(He(Ft(D),D.text.length),o)}var H=t.nodeType==3?t:null,Z=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,n&&(n=H.nodeValue.length));Z.parentNode!=r;)Z=Z.parentNode;var q=e.measure,te=q.maps;function fe(rt,ot,vt){for(var st=-1;st<(te?te.length:0);st++)for(var St=st<0?q.map:te[st],Ot=0;Ot<St.length;Ot+=3){var Rt=St[Ot+2];if(Rt==rt||Rt==ot){var zt=Ft(st<0?e.line:e.rest[st]),dr=St[Ot]+vt;return(vt<0||Rt!=rt)&&(dr=St[Ot+(vt?1:0)]),He(zt,dr)}}}var Ee=fe(H,Z,n);if(Ee)return di(Ee,o);for(var Pe=Z.nextSibling,De=H?H.nodeValue.length-n:0;Pe;Pe=Pe.nextSibling){if(Ee=fe(Pe,Pe.firstChild,0),Ee)return di(He(Ee.line,Ee.ch-De),o);De+=Pe.textContent.length}for(var We=Z.previousSibling,Ye=n;We;We=We.previousSibling){if(Ee=fe(We,We.firstChild,-1),Ee)return di(He(Ee.line,Ee.ch+Ye),o);Ye+=We.textContent.length}}var yr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};yr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(o.style.width="0px"),Ie(o,"input",function(){W&&B>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ie(o,"paste",function(H){if(ze(r,H)||ws(H,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function D(H){if(ze(r,H))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Z=As(r);sa({lineWise:!0,text:Z.text}),H.type=="cut"?r.setSelections(Z.ranges,null,Te):(n.prevInput="",o.value=Z.text.join(`
`),z(o))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Ie(o,"cut",D),Ie(o,"copy",D),Ie(e.scroller,"paste",function(H){if(Cn(e,H)||ze(r,H))return;if(!o.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Z=new Event("paste");Z.clipboardData=H.clipboardData,o.dispatchEvent(Z)}),Ie(e.lineSpace,"selectstart",function(H){Cn(e,H)||ne(H)}),Ie(o,"compositionstart",function(){var H=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},yr.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},yr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},yr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var o=fn(e,n.sel.primary().head,"div"),D=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+H.top-D.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+H.left-D.left))}return r},yr.prototype.showSelection=function(e){var t=this.cm,n=t.display;c(n.cursorDiv,e.cursors),c(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},yr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&z(this.textarea),W&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&B>=9&&(this.hasSelection=null))},yr.prototype.getField=function(){return this.textarea},yr.prototype.supportsTouch=function(){return!1},yr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},yr.prototype.blur=function(){this.textarea.blur()},yr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},yr.prototype.receivedFocus=function(){this.slowPoll()},yr.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()})},yr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},yr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||yt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=n.value;if(o==r&&!t.somethingSelected())return!1;if(W&&B>=9&&this.hasSelection===o||s&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var D=o.charCodeAt(0);if(D==8203&&!r&&(r="\u200B"),D==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Z=Math.min(r.length,o.length);H<Z&&r.charCodeAt(H)==o.charCodeAt(H);)++H;return en(t,function(){Ka(t,o.slice(H),r.length-H,null,e.composing?"*compose":null),o.length>1e3||o.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},yr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},yr.prototype.onKeyPress=function(){W&&B>=9&&(this.hasSelection=null),this.fastPoll()},yr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var D=Bn(n,e),H=r.scroller.scrollTop;if(!D||p)return;var Z=n.options.resetSelectionOnContextMenu;Z&&n.doc.sel.contains(D)==-1&&Dr(n,Fr)(n.doc,Rn(D),Te);var q=o.style.cssText,te=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.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 Ee;O&&(Ee=window.scrollY),r.input.focus(),O&&window.scrollTo(null,Ee),r.input.reset(),n.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=De,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Pe(){if(o.selectionStart!=null){var Ye=n.somethingSelected(),rt="\u200B"+(Ye?o.value:"");o.value="\u21DA",o.value=rt,t.prevInput=Ye?"":"\u200B",o.selectionStart=1,o.selectionEnd=rt.length,r.selForContextMenu=n.doc.sel}}function De(){if(t.contextMenuPending!=De)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,o.style.cssText=q,W&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),o.selectionStart!=null){(!W||W&&B<9)&&Pe();var Ye=0,rt=function(){r.selForContextMenu==n.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?Dr(n,$o)(n):Ye++<10?r.detectingSelectAll=setTimeout(rt,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(rt,200)}}if(W&&B>=9&&Pe(),R){ve(e);var We=function(){it(window,"mouseup",We),setTimeout(De,20)};Ie(window,"mouseup",We)}else setTimeout(De,50)},yr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},yr.prototype.setUneditable=function(){},yr.prototype.needsContentAttribute=!1;function nu(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 n=I();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Z.getValue()}var o;if(e.form&&(Ie(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var D=e.form;o=D.submit;try{var H=D.submit=function(){r(),D.submit=o,D.submit(),D.submit=H}}catch(q){}}t.finishInit=function(q){q.save=r,q.getTextArea=function(){return e},q.toTextArea=function(){q.toTextArea=isNaN,r(),e.parentNode.removeChild(q.getWrapperElement()),e.style.display="",e.form&&(it(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var Z=fr(function(q){return e.parentNode.insertBefore(q,e.nextSibling)},t);return Z}function iu(e){e.off=it,e.on=Ie,e.wheelEventPixels=cl,e.Doc=$r,e.splitLines=Pt,e.countColumn=Y,e.findColumn=we,e.isWordChar=me,e.Pass=Oe,e.signal=Be,e.Line=Nn,e.changeEnd=Dn,e.scrollbarModel=wo,e.Pos=He,e.cmpPos=ft,e.modes=Zt,e.mimeModes=Bt,e.resolveMode=gt,e.getMode=Ct,e.modeExtensions=ht,e.extendMode=At,e.copyState=rr,e.startState=cr,e.innerMode=hr,e.commands=Mi,e.keyMap=Sn,e.keyName=cs,e.isModifierKey=us,e.lookupKey=si,e.normalizeKeyMap=Pl,e.StringStream=Ut,e.SharedTextMarker=ki,e.TextMarker=On,e.LineWidget=Di,e.e_preventDefault=ne,e.e_stopPropagation=oe,e.e_stop=ve,e.addClass=F,e.contains=L,e.rmClass=C,e.keyNames=Pn}$l(fr),ql(fr);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in $r.prototype)$r.prototype.hasOwnProperty(ua)&&le(au,ua)<0&&(fr.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}($r.prototype[ua]));return xe($r),fr.inputStyles={textarea:yr,contenteditable:ur},fr.defineMode=function(e){!fr.defaults.mode&&e!="null"&&(fr.defaults.mode=e),_r.apply(this,arguments)},fr.defineMIME=Ze,fr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),fr.defineMIME("text/plain","null"),fr.defineExtension=function(e,t){fr.prototype[e]=t},fr.defineDocExtension=function(e,t){$r.prototype[e]=t},fr.fromTextArea=nu,iu(fr),fr.version="5.58.2",fr})},XFxt:function(bt,Se,Q){bt.exports={"image-preview-container":"image-preview-container___1L8o9","image-preview":"image-preview___3YjNO","button-group":"button-group___3y9R5","preview-wrp-group":"preview-wrp-group___19bWd"}},Y1PL:function(bt,Se,Q){"use strict";Q.r(Se),Q.d(Se,"ResizableTextArea",function(){return le});var ue=Q("wx14"),J=Q("1OyB"),k=Q("vuIU"),X=Q("Ji7U"),U=Q("LK+K"),P=Q("q1tI"),W=Q("VTBJ"),B=Q("rePB"),O=Q("Zm9Q"),A=Q("Kwbf"),d=Q("c+Xe"),p=Q("m+aA"),w=Q("bdgK"),m=new Map;function g(Te){Te.forEach(function(Re){var Ae,we=Re.target;(Ae=m.get(we))===null||Ae===void 0||Ae.forEach(function(ge){return ge(we)})})}var b=new w.default(g),a=null,i=null;function s(Te,Re){m.has(Te)||(m.set(Te,new Set),b.observe(Te)),m.get(Te).add(Re)}function l(Te,Re){m.has(Te)&&(m.get(Te).delete(Re),m.get(Te).size||(b.unobserve(Te),m.delete(Te)))}var S=function(Te){Object(X.a)(Ae,Te);var Re=Object(U.a)(Ae);function Ae(){return Object(J.a)(this,Ae),Re.apply(this,arguments)}return Object(k.a)(Ae,[{key:"render",value:function(){return this.props.children}}]),Ae}(P.Component),v=P.createContext(null);function y(Te){var Re=Te.children,Ae=Te.onBatchResize,we=P.useRef(0),ge=P.useRef([]),de=P.useContext(v),re=P.useCallback(function(ce,se,ke){we.current+=1;var ie=we.current;ge.current.push({size:ce,element:se,data:ke}),Promise.resolve().then(function(){ie===we.current&&(Ae==null||Ae(ge.current),ge.current=[])}),de==null||de(ce,se,ke)},[Ae,de]);return P.createElement(v.Provider,{value:re},Re)}function R(Te){var Re=Te.children,Ae=Te.disabled,we=P.useRef(null),ge=P.useRef(null),de=P.useContext(v),re=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ce=P.isValidElement(Re)&&Object(d.c)(Re),se=ce?Re.ref:null,ke=P.useMemo(function(){return Object(d.a)(se,we)},[se,we]),ie=P.useRef(Te);ie.current=Te;var ae=P.useCallback(function(me){var _e=ie.current,Me=_e.onResize,Ue=_e.data,je=me.getBoundingClientRect(),Fe=je.width,Je=je.height,$e=me.offsetWidth,Qe=me.offsetHeight,Xe=Math.floor(Fe),dt=Math.floor(Je);if(re.current.width!==Xe||re.current.height!==dt||re.current.offsetWidth!==$e||re.current.offsetHeight!==Qe){var tt={width:Xe,height:dt,offsetWidth:$e,offsetHeight:Qe};re.current=tt;var lt=$e===Math.round(Fe)?Fe:$e,Ie=Qe===Math.round(Je)?Je:Qe,et=Object(W.a)(Object(W.a)({},tt),{},{offsetWidth:lt,offsetHeight:Ie});de==null||de(et,me,Ue),Me&&Promise.resolve().then(function(){Me(et,me)})}},[]);return P.useEffect(function(){var me=Object(p.a)(we.current)||Object(p.a)(ge.current);return me&&!Ae&&s(me,ae),function(){return l(me,ae)}},[we.current,Ae]),P.createElement(S,{ref:ge},ce?P.cloneElement(Re,{ref:ke}):Re)}var _="rc-observer-key";function C(Te){var Re=Te.children,Ae=Object(O.a)(Re);return Ae.map(function(we,ge){var de=(we==null?void 0:we.key)||"".concat(_,"-").concat(ge);return P.createElement(R,Object(ue.a)({},Te,{key:de}),we)})}C.Collection=y;var E=C,c=Q("bT9E"),u=Q("TSYQ"),h=Q.n(u),T=`
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
`,L=["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"],I={},F;function j(Te){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ae=Te.getAttribute("id")||Te.getAttribute("data-reactid")||Te.getAttribute("name");if(Re&&I[Ae])return I[Ae];var we=window.getComputedStyle(Te),ge=we.getPropertyValue("box-sizing")||we.getPropertyValue("-moz-box-sizing")||we.getPropertyValue("-webkit-box-sizing"),de=parseFloat(we.getPropertyValue("padding-bottom"))+parseFloat(we.getPropertyValue("padding-top")),re=parseFloat(we.getPropertyValue("border-bottom-width"))+parseFloat(we.getPropertyValue("border-top-width")),ce=L.map(function(ke){return"".concat(ke,":").concat(we.getPropertyValue(ke))}).join(";"),se={sizingStyle:ce,paddingSize:de,borderSize:re,boxSizing:ge};return Re&&Ae&&(I[Ae]=se),se}function z(Te){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,we=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),Te.getAttribute("wrap")?F.setAttribute("wrap",Te.getAttribute("wrap")):F.removeAttribute("wrap");var ge=j(Te,Re),de=ge.paddingSize,re=ge.borderSize,ce=ge.boxSizing,se=ge.sizingStyle;F.setAttribute("style","".concat(se,";").concat(T)),F.value=Te.value||Te.placeholder||"";var ke=Number.MIN_SAFE_INTEGER,ie=Number.MAX_SAFE_INTEGER,ae=F.scrollHeight,me;if(ce==="border-box"?ae+=re:ce==="content-box"&&(ae-=de),Ae!==null||we!==null){F.value=" ";var _e=F.scrollHeight-de;Ae!==null&&(ke=_e*Ae,ce==="border-box"&&(ke=ke+de+re),ae=Math.max(ke,ae)),we!==null&&(ie=_e*we,ce==="border-box"&&(ie=ie+de+re),me=ae>ie?"":"hidden",ae=Math.min(ie,ae))}return{height:ae,minHeight:ke,maxHeight:ie,overflowY:me,resize:"none"}}var M=Q("Gytx"),N=Q.n(M),Y;(function(Te){Te[Te.NONE=0]="NONE",Te[Te.RESIZING=1]="RESIZING",Te[Te.RESIZED=2]="RESIZED"})(Y||(Y={}));var ee=function(Te){Object(X.a)(Ae,Te);var Re=Object(U.a)(Ae);function Ae(we){var ge;return Object(J.a)(this,Ae),ge=Re.call(this,we),ge.nextFrameActionId=void 0,ge.resizeFrameId=void 0,ge.textArea=void 0,ge.saveTextArea=function(de){ge.textArea=de},ge.handleResize=function(de){var re=ge.state.resizeStatus,ce=ge.props,se=ce.autoSize,ke=ce.onResize;if(re!==Y.NONE)return;typeof ke=="function"&&ke(de),se&&ge.resizeOnNextFrame()},ge.resizeOnNextFrame=function(){cancelAnimationFrame(ge.nextFrameActionId),ge.nextFrameActionId=requestAnimationFrame(ge.resizeTextarea)},ge.resizeTextarea=function(){var de=ge.props.autoSize;if(!de||!ge.textArea)return;var re=de.minRows,ce=de.maxRows,se=z(ge.textArea,!1,re,ce);ge.setState({textareaStyles:se,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(ge.resizeFrameId),ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:Y.RESIZED},function(){ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:Y.NONE}),ge.fixFirefoxAutoScroll()})})})})},ge.renderTextArea=function(){var de=ge.props,re=de.prefixCls,ce=re===void 0?"rc-textarea":re,se=de.autoSize,ke=de.onResize,ie=de.className,ae=de.disabled,me=ge.state,_e=me.textareaStyles,Me=me.resizeStatus,Ue=Object(c.a)(ge.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),je=h()(ce,ie,Object(B.a)({},"".concat(ce,"-disabled"),ae));"value"in Ue&&(Ue.value=Ue.value||"");var Fe=Object(W.a)(Object(W.a)(Object(W.a)({},ge.props.style),_e),Me===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(E,{onResize:ge.handleResize,disabled:!(se||ke)},P.createElement("textarea",Object(ue.a)({},Ue,{className:je,style:Fe,ref:ge.saveTextArea})))},ge.state={textareaStyles:{},resizeStatus:Y.NONE},ge}return Object(k.a)(Ae,[{key:"componentDidUpdate",value:function(ge){(ge.value!==this.props.value||!N()(ge.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 ge=this.textArea.selectionStart,de=this.textArea.selectionEnd;this.textArea.setSelectionRange(ge,de)}}catch(re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ae}(P.Component),le=ee,pe=function(Te){Object(X.a)(Ae,Te);var Re=Object(U.a)(Ae);function Ae(we){var ge;Object(J.a)(this,Ae),ge=Re.call(this,we),ge.resizableTextArea=void 0,ge.focus=function(){ge.resizableTextArea.textArea.focus()},ge.saveTextArea=function(re){ge.resizableTextArea=re},ge.handleChange=function(re){var ce=ge.props.onChange;ge.setValue(re.target.value,function(){ge.resizableTextArea.resizeTextarea()}),ce&&ce(re)},ge.handleKeyDown=function(re){var ce=ge.props,se=ce.onPressEnter,ke=ce.onKeyDown;re.keyCode===13&&se&&se(re),ke&&ke(re)};var de=typeof we.value=="undefined"||we.value===null?we.defaultValue:we.value;return ge.state={value:de},ge}return Object(k.a)(Ae,[{key:"setValue",value:function(ge,de){"value"in this.props||this.setState({value:ge},de)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(le,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ge){return"value"in ge?{value:ge.value}:null}}]),Ae}(P.Component),Oe=Se.default=pe},ZW9T:function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return E});var ue=Q("k1fw"),J=Q("oBTY"),k=Q("9og8"),X=Q("miYZ"),U=Q("tsqr"),P=Q("rAM+"),W=Q("tJVT"),B=Q("PpiC"),O=Q("WmNS"),A=Q.n(O),d=Q("q1tI"),p=Q.n(d),w=Q("bdgK");function m(c,u,h,T,L){var I=u.getWordUntilPosition(h),F={startLineNumber:h.lineNumber,endLineNumber:h.lineNumber,startColumn:I.startColumn,endColumn:I.endColumn},j=T.map(function(z){return{label:z,kind:c.languages.CompletionItemKind.Keyword,insertText:z,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:F}});return L.map(function(z){j.push(Object(ue.a)(Object(ue.a)({},z),{},{range:F}))}),j}var g=function(c){var u={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},h=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];c.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(F,j){var z=m(c,F,j,h,[u]);return{suggestions:z}}});var T=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];c.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(F,j){var z=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],M=m(c,F,j,T,z);return{suggestions:M}}});var L=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];c.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(F,j){var z=[u,{label:"main",kind:c.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:c.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],M=m(c,F,j,L,z);return{suggestions:M}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",a=Q("fjLI"),i=Q("LvDl"),s=Q("+ua5");function l(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function S(){}var v=!1,y={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function R(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=c;if(Array.isArray(c)){for(var h=0;h<c.length;h++){var T=y[c[h]];if(T)return T}return u[0]}return y[u]||u}var _=null,C=Se.b=function(c){var u=c.width,h=u===void 0?"100%":u,T=c.height,L=T===void 0?"100%":T,I=c.value,F=c.language,j=F===void 0?"javascript":F,z=c.style,M=z===void 0?{}:z,N=c.options,Y=N===void 0?{}:N,ee=c.overrideServices,le=ee===void 0?{}:ee,pe=c.theme,Oe=pe===void 0?"vs-dark":pe,Te=c.onEditBlur,Re=c.onSave,Ae=c.autoHeight,we=Ae===void 0?!1:Ae,ge=c.forbidCopy,de=ge===void 0?!1:ge,re=c.onChange,ce=re===void 0?S:re,se=c.editorDidMount,ke=se===void 0?S:se,ie=c.onFocus,ae=ie===void 0?S:ie,me=c.onBreakPoint,_e=me===void 0?S:me,Me=c.breakPointValue,Ue=Me===void 0?[]:Me,je=c.filename,Fe=je===void 0?"educoder.txt":je,Je=c.errorLine,$e=c.errorContent,Qe=$e===void 0?"":$e,Xe=c.highlightLine,dt=c.openBreakPoint,tt=dt===void 0?!1:dt,lt=Object(B.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),Ie=Object(d.useRef)(),et=Object(d.useRef)({}),it=Object(d.useRef)(),Be=Object(d.useRef)(),ze=Object(d.useRef)([]),Ce=Object(d.useRef)(!1),ye=Object(d.useRef)(),xe=Object(d.useState)(!1),ne=Object(W.a)(xe,2),oe=ne[0],he=ne[1];function ve(){var Ct;return Ie.current&&(Ct=new w.default(function(ht){var At=Object(P.a)(ht),rr;try{for(At.s();!(rr=At.n()).done;){var hr=rr.value;(hr.target.offsetHeight>0||hr.target.offsetWidth>0)&&et.current.instance.layout()}}catch(cr){At.e(cr)}finally{At.f()}}),Ct.observe(Ie.current)),Ct}function Ne(){U.b.warn({content:decodeURIComponent(b),key:"monaco-editor-tip"})}var Le=function(){var ht=et.current.instance;if(I!=null&&ht&&oe){var At=ht.getModel();At&&I!==At.getValue()&&(v=!0,At.setValue(I),ht.layout(),v=!1)}};Object(d.useEffect)(function(){try{var Ct,ht=et.current.instance;Be.current&&clearTimeout(Be.current),Be.current=setTimeout(function(){Le()},500),ht==null||((Ct=ht.updateOptions)===null||Ct===void 0)||Ct.call(ht,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(I.split(/\r\n|\r|\n/g).length))+3,5)})}catch(At){debugger}},[I,oe,et.current]),Object(d.useEffect)(function(){try{if(Je&&et.current&&et.current.instance){var Ct=et.current.instance;Ct.changeViewZones(function(At){var rr=document.createElement("div");rr.style.padding="10px 20px",rr.style.width="calc(100% - 20px)",rr.className="my-error-line-wrp",rr.innerHTML=Qe,At.addZone({afterLineNumber:Je||11,heightInLines:3,domNode:rr})});var ht={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ct.addOverlayWidget(ht),Ct.revealPositionInCenter({lineNumber:20,column:1})}}catch(At){debugger}},[Je,et.current,oe]),Object(d.useEffect)(function(){var Ct;if((Ct=et.current)!==null&&Ct!==void 0&&Ct.instance&&oe&&tt){var ht=et.current.instance,At=ht.getModel();if(!At)return;var rr=function(){var ft=[],Wt=[],qt=At.getAllDecorations(),nr=Object(P.a)(qt),ir;try{for(nr.s();!(ir=nr.n()).done;){var K=ir.value;if(K.options.className==="highlighted-line"){var f;ft.push(K==null||((f=K.range)===null||f===void 0)?void 0:f.startLineNumber),Wt.push(K==null?void 0:K.id)}}}catch(G){nr.e(G)}finally{nr.f()}At.deltaDecorations(Wt,[]);var x=At.getLineCount();!!Xe&&Xe<=x&&(ht.deltaDecorations([],[{range:new _.Range(Xe,1,Xe,At.getLineMaxColumn(Xe)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ht.revealLineInCenter(Xe))};rr();var hr=function(){var ft=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Wt=[],qt=[],nr=At.getAllDecorations(),ir=Object(P.a)(nr),K;try{for(ir.s();!(K=ir.n()).done;){var f=K.value;if(f.options.linesDecorationsClassName==="breakpoints"){var x;Wt.push(f==null||((x=f.range)===null||x===void 0)?void 0:x.startLineNumber),qt.push(f==null?void 0:f.id)}}}catch(G){ir.e(G)}finally{ir.f()}if(ft)return{lines:Wt,ids:qt};_e(Wt)},cr=function(){var He=Object(k.a)(A.a.mark(function ft(Wt){var qt;return A.a.wrap(function(ir){for(;;)switch(ir.prev=ir.next){case 0:return qt={range:new _.Range(Wt,1,Wt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},ir.next=3,At.deltaDecorations([],[qt]);case 3:hr();case 4:case"end":return ir.stop()}},ft)}));return function(Wt){return He.apply(this,arguments)}}(),Ut=function(){var He=Object(k.a)(A.a.mark(function ft(Wt){var qt,nr,ir,K,f;return A.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:qt=[],nr=ht.getLineDecorations(Wt),ir=Object(P.a)(nr);try{for(ir.s();!(K=ir.n()).done;)f=K.value,f.options.linesDecorationsClassName==="breakpoints"&&qt.push(f.id)}catch($){ir.e($)}finally{ir.f()}return G.next=6,At.deltaDecorations(qt,[]);case 6:hr();case 7:case"end":return G.stop()}},ft)}));return function(Wt){return He.apply(this,arguments)}}(),xt=function(ft){var Wt=ht.getLineDecorations(ft),qt=Object(P.a)(Wt),nr;try{for(qt.s();!(nr=qt.n()).done;){var ir=nr.value;if(ir.options.linesDecorationsClassName==="breakpoints")return!0}}catch(K){qt.e(K)}finally{qt.f()}return!1};if(!Object(i.isEqual)(Ue,hr(!0).lines)){At.deltaDecorations(hr(!0).ids,[]);var Mr=Ue.map(function(He){return{range:new _.Range(He,1,He,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});At.deltaDecorations([],Mr)}var rn=ht.onDidChangeModelContent(function(He){var ft=ht.getPosition();if(ft){var Wt=ft.lineNumber;At.getLineContent(Wt).trim()===""?Ut(Wt):xt(Wt)&&(Ut(Wt),cr(Wt))}}),Ar=ht.onMouseDown(function(He){var ft,Wt,qt;if(He.target.detail&&(ft=He.target)!==null&&ft!==void 0&&(Wt=ft.element)!==null&&Wt!==void 0&&(qt=Wt.className)!==null&&qt!==void 0&&qt.includes("line-numbers")){var nr=He.target.position.lineNumber;if(At.getLineContent(nr).trim()==="")return;xt(nr)?Ut(nr):cr(nr)}}),Ft=function(ft){var Wt={range:new _.Range(ft,1,ft,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ze.current=ht.deltaDecorations(ze.current,[Wt])},Ir=function(){ze.current=ht.deltaDecorations(ze.current,[])},Tr=ht.onMouseMove(function(He){var ft,Wt,qt;if(Ir(),He.target.detail&&(ft=He.target)!==null&&ft!==void 0&&(Wt=ft.element)!==null&&Wt!==void 0&&(qt=Wt.className)!==null&&qt!==void 0&&qt.includes("line-numbers")){var nr=He.target.position.lineNumber;if(At.getLineContent(nr).trim()==="")return;Ft(nr)}}),nn=ht.onMouseLeave(function(){Ir()});return function(){rn.dispose(),Ar.dispose(),Tr.dispose(),nn.dispose()}}},[et.current,oe,Ue,Xe,tt]);function Ke(){var Ct=et.current.instance;if(Ct){var ht=Ct.getSelection(),At=et.current.pastePos||{},rr=new _.Range(At.startLineNumber||ht.endLineNumber,At.startColumn||ht.endColumn,At.endLineNumber||ht.endLineNumber,At.endColumn||ht.endColumn);setTimeout(function(){Ct.executeEdits("",[{range:rr,text:""}])},300)}}function at(Ct){(window.navigator.platform.match("Mac")?Ct.metaKey:Ct.ctrlKey)&&Ct.keyCode==83&&(Ct.preventDefault(),Re())}var mt=function(){if(we&&et.current.instance){var ht=et.current.instance.getContentHeight();Ze(ht<L?L:ht)}else Ze(L)};function pt(Ct){var ht=document.createEvent("MouseEvents");ht.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ct.dispatchEvent(ht)}var Mt=function(ht){var At=ht.keyCode,rr=ht.ctrlKey,hr=ht.metaKey,cr=ht.target,Ut=ht.type;return(Ut==="paste"||(At===67||At===86)&&(hr||rr))&&cr.nodeName==="TEXTAREA"&&(Ne(),ht.preventDefault()),!1};function Pt(Ct,ht){var At=window.URL||window.webkitURL||window,rr=new Blob([ht]),hr=document.createElementNS("http://www.w3.org/1999/xhtml","a");hr.href=At.createObjectURL(rr),hr.download=Ct,pt(hr)}Object(d.useEffect)(function(){mt()},[mt]),Object(d.useEffect)(function(){Ie.current&&!oe&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(Ct){try{_=Ct,et.current.instance=_.editor.create(Ie.current,{value:I,language:R(j),theme:Oe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},le);var ht=et.current.instance,At=a.c._menuItems,rr=Object(J.a)(At).find(function(cr){return cr[0]._debugName=="EditorContext"});if(ke(ht,_),setTimeout(function(){mt(),et.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Pt(Fe||"educoder.txt",ht.getValue())}}),ht.getDomNode().addEventListener("input",function(){it.current.autoFormat&&ht.getAction("editor.action.formatDocument").run()})},500),et.current.subscription=ht.onDidChangeModelContent(function(cr){debugger;Ce.current?clearTimeout(ye.current):(mt(),ce(ht.getValue(),cr)),ye.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||g(_,R(j)),de&&(Ie.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Mt),window.removeEventListener("paste",Mt),window.addEventListener("keydown",Mt),window.addEventListener("paste",Mt)),window.Monaco=_,Te&&ht.onDidBlurEditorWidget(function(){Te(ht.getValue())}),ae&&ht.onDidFocusEditorText(function(){ae(ht.getValue())}),de)try{window.addEventListener("paste",Ke)}catch(cr){}var hr=ve();return he(!0),function(){var cr=et.current.instance;cr.dispose();var Ut=cr.getModel();Ut&&Ut.dispose(),et.current.subscription&&et.current.subscription.dispose(),de&&window.removeEventListener("paste",Ke),hr.unobserve(Ie.current)}}catch(cr){debugger}})},[]),Object(d.useEffect)(function(){var Ct=et.current.instance;if(Ct&&oe)return document.addEventListener("keydown",at,!1),function(){document.removeEventListener("keydown",at)}},[Re,oe]),Object(d.useEffect)(function(){var Ct=et.current.instance;if(Ct&&oe){var ht=R(j);_.editor.setModelLanguage(Ct.getModel(),ht)}},[j,oe]),Object(d.useEffect)(function(){var Ct=et.current.instance;Ct&&oe&&_.editor.setTheme(Oe)},[Oe,oe]),Object(d.useEffect)(function(){var Ct=et.current.instance;it.current=Y,Ct&&oe&&(Ct.updateOptions(Object(ue.a)({},Y)),setTimeout(function(){Ct.getModel().updateOptions(Object(ue.a)({},Y))},200))},[JSON.stringify(Y),oe]),Object(d.useEffect)(function(){var Ct=et.current.instance;Ct&&oe&&Ct.layout()},[h,L,oe]);var yt=Object(d.useState)(l(h)),Ht=Object(W.a)(yt,2),Jt=Ht[0],ut=Ht[1],Zt=Object(d.useState)(l(L)),Bt=Object(W.a)(Zt,2),_r=Bt[0],Ze=Bt[1],gt=Object(ue.a)(Object(ue.a)({},M),{},{width:Jt,height:_r});return p.a.createElement("div",{className:"my-monaco-editor",ref:Ie,style:gt})};function E(c){var u=c.width,h=u===void 0?"100%":u,T=c.height,L=T===void 0?"100%":T,I=c.original,F=c.modified,j=c.language,z=c.options,M=z===void 0?{}:z,N=Object(d.useRef)(),Y=Object(d.useState)(null),ee=Object(W.a)(Y,2),le=ee[0],pe=ee[1];function Oe(we){var ge;return N.current&&(ge=new w.default(function(de){var re=Object(P.a)(de),ce;try{for(re.s();!(ce=re.n()).done;){var se=ce.value;(se.target.offsetHeight>0||se.target.offsetWidth>0)&&we.layout()}}catch(ke){re.e(ke)}finally{re.f()}}),ge.observe(N.current)),ge}Object(d.useEffect)(function(){return N.current&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(we){_=we;var ge=_.editor.createDiffEditor(N.current,Object(ue.a)(Object(ue.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},M),{},{wordWrap:!0}));pe(ge);var de=Oe(ge);return function(){ge.dispose();var re=ge.getModel();re&&re.dispose(),de.unobserve(N.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){le&&le.setModel({original:_.editor.createModel(I,j),modified:_.editor.createModel(F,j)})},[I,F,j,le]);var Te=l(h),Re=l(L),Ae={width:Te,height:Re};return p.a.createElement("div",{className:"my-diff-editor",ref:N,style:Ae})}},ZpRC:function(bt,Se,Q){"use strict";function ue(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function J(d,p){return(!p||d!=="hidden")&&d!=="visible"&&d!=="clip"}function k(d,p){if(d.clientHeight<d.scrollHeight||d.clientWidth<d.scrollWidth){var w=getComputedStyle(d,null);return J(w.overflowY,p)||J(w.overflowX,p)||function(m){var g=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(a){return null}}(m);return!!g&&(g.clientHeight<m.scrollHeight||g.clientWidth<m.scrollWidth)}(d)}return!1}function X(d,p,w,m,g,b,a,i){return b<d&&a>p||b>d&&a<p?0:b<=d&&i<=w||a>=p&&i>=w?b-d-m:a>p&&i<w||b<d&&i>w?a-p+g:0}var U=function(d,p){var w=window,m=p.scrollMode,g=p.block,b=p.inline,a=p.boundary,i=p.skipOverflowHiddenElements,s=typeof a=="function"?a:function(_e){return _e!==a};if(!ue(d))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,S=[],v=d;ue(v)&&s(v);){if((v=v.parentElement)===l){S.push(v);break}v!=null&&v===document.body&&k(v)&&!k(document.documentElement)||v!=null&&k(v,i)&&S.push(v)}for(var y=w.visualViewport?w.visualViewport.width:innerWidth,R=w.visualViewport?w.visualViewport.height:innerHeight,_=window.scrollX||pageXOffset,C=window.scrollY||pageYOffset,E=d.getBoundingClientRect(),c=E.height,u=E.width,h=E.top,T=E.right,L=E.bottom,I=E.left,F=g==="start"||g==="nearest"?h:g==="end"?L:h+c/2,j=b==="center"?I+u/2:b==="end"?T:I,z=[],M=0;M<S.length;M++){var N=S[M],Y=N.getBoundingClientRect(),ee=Y.height,le=Y.width,pe=Y.top,Oe=Y.right,Te=Y.bottom,Re=Y.left;if(m==="if-needed"&&h>=0&&I>=0&&L<=R&&T<=y&&h>=pe&&L<=Te&&I>=Re&&T<=Oe)return z;var Ae=getComputedStyle(N),we=parseInt(Ae.borderLeftWidth,10),ge=parseInt(Ae.borderTopWidth,10),de=parseInt(Ae.borderRightWidth,10),re=parseInt(Ae.borderBottomWidth,10),ce=0,se=0,ke="offsetWidth"in N?N.offsetWidth-N.clientWidth-we-de:0,ie="offsetHeight"in N?N.offsetHeight-N.clientHeight-ge-re:0;if(l===N)ce=g==="start"?F:g==="end"?F-R:g==="nearest"?X(C,C+R,R,ge,re,C+F,C+F+c,c):F-R/2,se=b==="start"?j:b==="center"?j-y/2:b==="end"?j-y:X(_,_+y,y,we,de,_+j,_+j+u,u),ce=Math.max(0,ce+C),se=Math.max(0,se+_);else{ce=g==="start"?F-pe-ge:g==="end"?F-Te+re+ie:g==="nearest"?X(pe,Te,ee,ge,re+ie,F,F+c,c):F-(pe+ee/2)+ie/2,se=b==="start"?j-Re-we:b==="center"?j-(Re+le/2)+ke/2:b==="end"?j-Oe+de+ke:X(Re,Oe,le,we,de+ke,j,j+u,u);var ae=N.scrollLeft,me=N.scrollTop;F+=me-(ce=Math.max(0,Math.min(me+ce,N.scrollHeight-ee+ie))),j+=ae-(se=Math.max(0,Math.min(ae+se,N.scrollWidth-le+ke)))}z.push({el:N,top:ce,left:se})}return z};function P(d){return d===Object(d)&&Object.keys(d).length!==0}function W(d,p){p===void 0&&(p="auto");var w="scrollBehavior"in document.body.style;d.forEach(function(m){var g=m.el,b=m.top,a=m.left;g.scroll&&w?g.scroll({top:b,left:a,behavior:p}):(g.scrollTop=b,g.scrollLeft=a)})}function B(d){return d===!1?{block:"end",inline:"nearest"}:P(d)?d:{block:"start",inline:"nearest"}}function O(d,p){var w=!d.ownerDocument.documentElement.contains(d);if(P(p)&&typeof p.behavior=="function")return p.behavior(w?[]:U(d,p));if(w)return;var m=B(p);return W(U(d,m),m.behavior)}var A=Se.a=O},Zss7:function(bt,Se,Q){var ue;(function(J){var k=/^\s+/,X=/\s+$/,U=0,P=J.round,W=J.min,B=J.max,O=J.random;function A(re,ce){if(re=re||"",ce=ce||{},re instanceof A)return re;if(!(this instanceof A))return new A(re,ce);var se=d(re);this._originalInput=re,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=P(100*this._a)/100,this._format=ce.format||se.format,this._gradientType=ce.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=se.ok,this._tc_id=U++}A.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 re=this.toRgb();return(re.r*299+re.g*587+re.b*114)/1e3},getLuminance:function(){var re=this.toRgb(),ce,se,ke,ie,ae,me;return ce=re.r/255,se=re.g/255,ke=re.b/255,ce<=.03928?ie=ce/12.92:ie=J.pow((ce+.055)/1.055,2.4),se<=.03928?ae=se/12.92:ae=J.pow((se+.055)/1.055,2.4),ke<=.03928?me=ke/12.92:me=J.pow((ke+.055)/1.055,2.4),.2126*ie+.7152*ae+.0722*me},setAlpha:function(re){return this._a=z(re),this._roundA=P(100*this._a)/100,this},toHsv:function(){var re=g(this._r,this._g,this._b);return{h:re.h*360,s:re.s,v:re.v,a:this._a}},toHsvString:function(){var re=g(this._r,this._g,this._b),ce=P(re.h*360),se=P(re.s*100),ke=P(re.v*100);return this._a==1?"hsv("+ce+", "+se+"%, "+ke+"%)":"hsva("+ce+", "+se+"%, "+ke+"%, "+this._roundA+")"},toHsl:function(){var re=w(this._r,this._g,this._b);return{h:re.h*360,s:re.s,l:re.l,a:this._a}},toHslString:function(){var re=w(this._r,this._g,this._b),ce=P(re.h*360),se=P(re.s*100),ke=P(re.l*100);return this._a==1?"hsl("+ce+", "+se+"%, "+ke+"%)":"hsla("+ce+", "+se+"%, "+ke+"%, "+this._roundA+")"},toHex:function(re){return a(this._r,this._g,this._b,re)},toHexString:function(re){return"#"+this.toHex(re)},toHex8:function(re){return i(this._r,this._g,this._b,this._a,re)},toHex8String:function(re){return"#"+this.toHex8(re)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(M(this._r,255)*100)+"%",g:P(M(this._g,255)*100)+"%",b:P(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(M(this._r,255)*100)+"%, "+P(M(this._g,255)*100)+"%, "+P(M(this._b,255)*100)+"%)":"rgba("+P(M(this._r,255)*100)+"%, "+P(M(this._g,255)*100)+"%, "+P(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[a(this._r,this._g,this._b,!0)]||!1},toFilter:function(re){var ce="#"+s(this._r,this._g,this._b,this._a),se=ce,ke=this._gradientType?"GradientType = 1, ":"";if(re){var ie=A(re);se="#"+s(ie._r,ie._g,ie._b,ie._a)}return"progid:DXImageTransform.Microsoft.gradient("+ke+"startColorstr="+ce+",endColorstr="+se+")"},toString:function(re){var ce=!!re;re=re||this._format;var se=!1,ke=this._a<1&&this._a>=0,ie=!ce&&ke&&(re==="hex"||re==="hex6"||re==="hex3"||re==="hex4"||re==="hex8"||re==="name");return ie?re==="name"&&this._a===0?this.toName():this.toRgbString():(re==="rgb"&&(se=this.toRgbString()),re==="prgb"&&(se=this.toPercentageRgbString()),(re==="hex"||re==="hex6")&&(se=this.toHexString()),re==="hex3"&&(se=this.toHexString(!0)),re==="hex4"&&(se=this.toHex8String(!0)),re==="hex8"&&(se=this.toHex8String()),re==="name"&&(se=this.toName()),re==="hsl"&&(se=this.toHslString()),re==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(re,ce){var se=re.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(y,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(C,arguments)},_applyCombination:function(re,ce){return re.apply(null,[this].concat([].slice.call(ce)))},analogous:function(){return this._applyCombination(T,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(L,arguments)},splitcomplement:function(){return this._applyCombination(h,arguments)},triad:function(){return this._applyCombination(c,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},A.fromRatio=function(re,ce){if(typeof re=="object"){var se={};for(var ke in re)re.hasOwnProperty(ke)&&(ke==="a"?se[ke]=re[ke]:se[ke]=Oe(re[ke]));re=se}return A(re,ce)};function d(re){var ce={r:0,g:0,b:0},se=1,ke=null,ie=null,ae=null,me=!1,_e=!1;return typeof re=="string"&&(re=ge(re)),typeof re=="object"&&(we(re.r)&&we(re.g)&&we(re.b)?(ce=p(re.r,re.g,re.b),me=!0,_e=String(re.r).substr(-1)==="%"?"prgb":"rgb"):we(re.h)&&we(re.s)&&we(re.v)?(ke=Oe(re.s),ie=Oe(re.v),ce=b(re.h,ke,ie),me=!0,_e="hsv"):we(re.h)&&we(re.s)&&we(re.l)&&(ke=Oe(re.s),ae=Oe(re.l),ce=m(re.h,ke,ae),me=!0,_e="hsl"),re.hasOwnProperty("a")&&(se=re.a)),se=z(se),{ok:me,format:re.format||_e,r:W(255,B(ce.r,0)),g:W(255,B(ce.g,0)),b:W(255,B(ce.b,0)),a:se}}function p(re,ce,se){return{r:M(re,255)*255,g:M(ce,255)*255,b:M(se,255)*255}}function w(re,ce,se){re=M(re,255),ce=M(ce,255),se=M(se,255);var ke=B(re,ce,se),ie=W(re,ce,se),ae,me,_e=(ke+ie)/2;if(ke==ie)ae=me=0;else{var Me=ke-ie;me=_e>.5?Me/(2-ke-ie):Me/(ke+ie);switch(ke){case re:ae=(ce-se)/Me+(ce<se?6:0);break;case ce:ae=(se-re)/Me+2;break;case se:ae=(re-ce)/Me+4;break}ae/=6}return{h:ae,s:me,l:_e}}function m(re,ce,se){var ke,ie,ae;re=M(re,360),ce=M(ce,100),se=M(se,100);function me(Ue,je,Fe){return Fe<0&&(Fe+=1),Fe>1&&(Fe-=1),Fe<1/6?Ue+(je-Ue)*6*Fe:Fe<1/2?je:Fe<2/3?Ue+(je-Ue)*(2/3-Fe)*6:Ue}if(ce===0)ke=ie=ae=se;else{var _e=se<.5?se*(1+ce):se+ce-se*ce,Me=2*se-_e;ke=me(Me,_e,re+1/3),ie=me(Me,_e,re),ae=me(Me,_e,re-1/3)}return{r:ke*255,g:ie*255,b:ae*255}}function g(re,ce,se){re=M(re,255),ce=M(ce,255),se=M(se,255);var ke=B(re,ce,se),ie=W(re,ce,se),ae,me,_e=ke,Me=ke-ie;if(me=ke===0?0:Me/ke,ke==ie)ae=0;else{switch(ke){case re:ae=(ce-se)/Me+(ce<se?6:0);break;case ce:ae=(se-re)/Me+2;break;case se:ae=(re-ce)/Me+4;break}ae/=6}return{h:ae,s:me,v:_e}}function b(re,ce,se){re=M(re,360)*6,ce=M(ce,100),se=M(se,100);var ke=J.floor(re),ie=re-ke,ae=se*(1-ce),me=se*(1-ie*ce),_e=se*(1-(1-ie)*ce),Me=ke%6,Ue=[se,me,ae,ae,_e,se][Me],je=[_e,se,se,me,ae,ae][Me],Fe=[ae,ae,_e,se,se,me][Me];return{r:Ue*255,g:je*255,b:Fe*255}}function a(re,ce,se,ke){var ie=[pe(P(re).toString(16)),pe(P(ce).toString(16)),pe(P(se).toString(16))];return ke&&ie[0].charAt(0)==ie[0].charAt(1)&&ie[1].charAt(0)==ie[1].charAt(1)&&ie[2].charAt(0)==ie[2].charAt(1)?ie[0].charAt(0)+ie[1].charAt(0)+ie[2].charAt(0):ie.join("")}function i(re,ce,se,ke,ie){var ae=[pe(P(re).toString(16)),pe(P(ce).toString(16)),pe(P(se).toString(16)),pe(Te(ke))];return ie&&ae[0].charAt(0)==ae[0].charAt(1)&&ae[1].charAt(0)==ae[1].charAt(1)&&ae[2].charAt(0)==ae[2].charAt(1)&&ae[3].charAt(0)==ae[3].charAt(1)?ae[0].charAt(0)+ae[1].charAt(0)+ae[2].charAt(0)+ae[3].charAt(0):ae.join("")}function s(re,ce,se,ke){var ie=[pe(Te(ke)),pe(P(re).toString(16)),pe(P(ce).toString(16)),pe(P(se).toString(16))];return ie.join("")}A.equals=function(re,ce){return!re||!ce?!1:A(re).toRgbString()==A(ce).toRgbString()},A.random=function(){return A.fromRatio({r:O(),g:O(),b:O()})};function l(re,ce){ce=ce===0?0:ce||10;var se=A(re).toHsl();return se.s-=ce/100,se.s=N(se.s),A(se)}function S(re,ce){ce=ce===0?0:ce||10;var se=A(re).toHsl();return se.s+=ce/100,se.s=N(se.s),A(se)}function v(re){return A(re).desaturate(100)}function y(re,ce){ce=ce===0?0:ce||10;var se=A(re).toHsl();return se.l+=ce/100,se.l=N(se.l),A(se)}function R(re,ce){ce=ce===0?0:ce||10;var se=A(re).toRgb();return se.r=B(0,W(255,se.r-P(255*-(ce/100)))),se.g=B(0,W(255,se.g-P(255*-(ce/100)))),se.b=B(0,W(255,se.b-P(255*-(ce/100)))),A(se)}function _(re,ce){ce=ce===0?0:ce||10;var se=A(re).toHsl();return se.l-=ce/100,se.l=N(se.l),A(se)}function C(re,ce){var se=A(re).toHsl(),ke=(se.h+ce)%360;return se.h=ke<0?360+ke:ke,A(se)}function E(re){var ce=A(re).toHsl();return ce.h=(ce.h+180)%360,A(ce)}function c(re){var ce=A(re).toHsl(),se=ce.h;return[A(re),A({h:(se+120)%360,s:ce.s,l:ce.l}),A({h:(se+240)%360,s:ce.s,l:ce.l})]}function u(re){var ce=A(re).toHsl(),se=ce.h;return[A(re),A({h:(se+90)%360,s:ce.s,l:ce.l}),A({h:(se+180)%360,s:ce.s,l:ce.l}),A({h:(se+270)%360,s:ce.s,l:ce.l})]}function h(re){var ce=A(re).toHsl(),se=ce.h;return[A(re),A({h:(se+72)%360,s:ce.s,l:ce.l}),A({h:(se+216)%360,s:ce.s,l:ce.l})]}function T(re,ce,se){ce=ce||6,se=se||30;var ke=A(re).toHsl(),ie=360/se,ae=[A(re)];for(ke.h=(ke.h-(ie*ce>>1)+720)%360;--ce;)ke.h=(ke.h+ie)%360,ae.push(A(ke));return ae}function L(re,ce){ce=ce||6;for(var se=A(re).toHsv(),ke=se.h,ie=se.s,ae=se.v,me=[],_e=1/ce;ce--;)me.push(A({h:ke,s:ie,v:ae})),ae=(ae+_e)%1;return me}A.mix=function(re,ce,se){se=se===0?0:se||50;var ke=A(re).toRgb(),ie=A(ce).toRgb(),ae=se/100,me={r:(ie.r-ke.r)*ae+ke.r,g:(ie.g-ke.g)*ae+ke.g,b:(ie.b-ke.b)*ae+ke.b,a:(ie.a-ke.a)*ae+ke.a};return A(me)},A.readability=function(re,ce){var se=A(re),ke=A(ce);return(J.max(se.getLuminance(),ke.getLuminance())+.05)/(J.min(se.getLuminance(),ke.getLuminance())+.05)},A.isReadable=function(re,ce,se){var ke=A.readability(re,ce),ie,ae;ae=!1,ie=de(se);switch(ie.level+ie.size){case"AAsmall":case"AAAlarge":ae=ke>=4.5;break;case"AAlarge":ae=ke>=3;break;case"AAAsmall":ae=ke>=7;break}return ae},A.mostReadable=function(re,ce,se){var ke=null,ie=0,ae,me,_e,Me;se=se||{},me=se.includeFallbackColors,_e=se.level,Me=se.size;for(var Ue=0;Ue<ce.length;Ue++)ae=A.readability(re,ce[Ue]),ae>ie&&(ie=ae,ke=A(ce[Ue]));return A.isReadable(re,ke,{level:_e,size:Me})||!me?ke:(se.includeFallbackColors=!1,A.mostReadable(re,["#fff","#000"],se))};var I=A.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"},F=A.hexNames=j(I);function j(re){var ce={};for(var se in re)re.hasOwnProperty(se)&&(ce[re[se]]=se);return ce}function z(re){return re=parseFloat(re),(isNaN(re)||re<0||re>1)&&(re=1),re}function M(re,ce){ee(re)&&(re="100%");var se=le(re);return re=W(ce,B(0,parseFloat(re))),se&&(re=parseInt(re*ce,10)/100),J.abs(re-ce)<1e-6?1:re%ce/parseFloat(ce)}function N(re){return W(1,B(0,re))}function Y(re){return parseInt(re,16)}function ee(re){return typeof re=="string"&&re.indexOf(".")!=-1&&parseFloat(re)===1}function le(re){return typeof re=="string"&&re.indexOf("%")!=-1}function pe(re){return re.length==1?"0"+re:""+re}function Oe(re){return re<=1&&(re=re*100+"%"),re}function Te(re){return J.round(parseFloat(re)*255).toString(16)}function Re(re){return Y(re)/255}var Ae=function(){var re="[-\\+]?\\d+%?",ce="[-\\+]?\\d*\\.\\d+%?",se="(?:"+ce+")|(?:"+re+")",ke="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",ie="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+ke),rgba:new RegExp("rgba"+ie),hsl:new RegExp("hsl"+ke),hsla:new RegExp("hsla"+ie),hsv:new RegExp("hsv"+ke),hsva:new RegExp("hsva"+ie),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 we(re){return!!Ae.CSS_UNIT.exec(re)}function ge(re){re=re.replace(k,"").replace(X,"").toLowerCase();var ce=!1;if(I[re])re=I[re],ce=!0;else if(re=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Ae.rgb.exec(re))?{r:se[1],g:se[2],b:se[3]}:(se=Ae.rgba.exec(re))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Ae.hsl.exec(re))?{h:se[1],s:se[2],l:se[3]}:(se=Ae.hsla.exec(re))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Ae.hsv.exec(re))?{h:se[1],s:se[2],v:se[3]}:(se=Ae.hsva.exec(re))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Ae.hex8.exec(re))?{r:Y(se[1]),g:Y(se[2]),b:Y(se[3]),a:Re(se[4]),format:ce?"name":"hex8"}:(se=Ae.hex6.exec(re))?{r:Y(se[1]),g:Y(se[2]),b:Y(se[3]),format:ce?"name":"hex"}:(se=Ae.hex4.exec(re))?{r:Y(se[1]+""+se[1]),g:Y(se[2]+""+se[2]),b:Y(se[3]+""+se[3]),a:Re(se[4]+""+se[4]),format:ce?"name":"hex8"}:(se=Ae.hex3.exec(re))?{r:Y(se[1]+""+se[1]),g:Y(se[2]+""+se[2]),b:Y(se[3]+""+se[3]),format:ce?"name":"hex"}:!1}function de(re){var ce,se;return re=re||{level:"AA",size:"small"},ce=(re.level||"AA").toUpperCase(),se=(re.size||"small").toLowerCase(),ce!=="AA"&&ce!=="AAA"&&(ce="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:ce,size:se}}bt.exports?bt.exports=A:!(ue=function(){return A}.call(Se,Q,Se,bt),ue!==void 0&&(bt.exports=ue))})(Math)},bT9E:function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return J});var ue=Q("VTBJ");function J(k,X){var U=Object(ue.a)({},k);return Array.isArray(X)&&X.forEach(function(P){delete U[P]}),U}},c5Ni:function(bt,Se,Q){},dejd:function(bt,Se,Q){},dmUQ:function(bt,Se,Q){"use strict";var ue=Q("Ff2n"),J=Q("rePB"),k=Q("1OyB"),X=Q("vuIU"),U=Q("Ji7U"),P=Q("md7G"),W=Q("foSv"),B=Q("q1tI"),O=Q.n(B),A=Q("TSYQ"),d=Q.n(A),p=Q("4IlW");function w(c,u){var h=Object.keys(c);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(c);u&&(T=T.filter(function(L){return Object.getOwnPropertyDescriptor(c,L).enumerable})),h.push.apply(h,T)}return h}function m(c){for(var u=1;u<arguments.length;u++){var h=arguments[u]!=null?arguments[u]:{};u%2?w(Object(h),!0).forEach(function(T){Object(J.a)(c,T,h[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(h)):w(Object(h)).forEach(function(T){Object.defineProperty(c,T,Object.getOwnPropertyDescriptor(h,T))})}return c}function g(c){var u=b();return function(){var T=Object(W.a)(c),L;if(u){var I=Object(W.a)(this).constructor;L=Reflect.construct(T,arguments,I)}else L=T.apply(this,arguments);return Object(P.a)(this,L)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(c){return!1}}function a(){}function i(c){c.preventDefault()}var s=function(u){return u.replace(/[^\w.-]+/g,"")},l=200,S=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,y=function(u){return u!=null},R=function(u,h){return h===u||typeof h=="number"&&typeof u=="number"&&isNaN(h)&&isNaN(u)},_=function(c){Object(U.a)(h,c);var u=g(h);function h(T){var L;Object(k.a)(this,h),L=u.call(this,T),L.onKeyDown=function(j){var z=L.props,M=z.onKeyDown,N=z.onPressEnter;if(j.keyCode===p.a.UP){var Y=L.getRatio(j);L.up(j,Y,null),L.stop()}else if(j.keyCode===p.a.DOWN){var ee=L.getRatio(j);L.down(j,ee,null),L.stop()}else j.keyCode===p.a.ENTER&&N&&N(j);if(L.recordCursorPosition(),L.lastKeyCode=j.keyCode,M){for(var le=arguments.length,pe=new Array(le>1?le-1:0),Oe=1;Oe<le;Oe++)pe[Oe-1]=arguments[Oe];M.apply(void 0,[j].concat(pe))}},L.onKeyUp=function(j){var z=L.props.onKeyUp;if(L.stop(),L.recordCursorPosition(),z){for(var M=arguments.length,N=new Array(M>1?M-1:0),Y=1;Y<M;Y++)N[Y-1]=arguments[Y];z.apply(void 0,[j].concat(N))}},L.onChange=function(j){var z=L.props.onChange;L.state.focused&&(L.inputting=!0),L.rawInput=L.props.parser(L.getValueFromEvent(j)),L.setState({inputValue:L.rawInput}),z(L.toNumber(L.rawInput))},L.onMouseUp=function(){var j=L.props.onMouseUp;L.recordCursorPosition(),j&&j.apply(void 0,arguments)},L.onFocus=function(){var j;L.setState({focused:!0}),(j=L.props).onFocus.apply(j,arguments)},L.onBlur=function(){var j=L.props.onBlur;L.inputting=!1,L.setState({focused:!1});var z=L.getCurrentValidValue(L.state.inputValue),M=L.setValue(z,a);if(j){var N=L.input.value,Y=L.getInputDisplayValue({focus:!1,value:M});L.input.value=Y&&Number(Y),j.apply(void 0,arguments),L.input.value=N}},L.getRatio=function(j){var z=1;return j.metaKey||j.ctrlKey?z=.1:j.shiftKey&&(z=10),z},L.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},L.getPrecision=function(j){if(y(L.props.precision))return L.props.precision;var z=String(j);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var M=0;return z.indexOf(".")>=0&&(M=z.length-z.indexOf(".")-1),M},L.getInputDisplayValue=function(j){var z=j||L.state,M=z.focused,N=z.inputValue,Y=z.value,ee;M?ee=N:ee=L.toPrecisionAsStep(Y),ee==null&&(ee="");var le=L.formatWrapper(ee);return y(L.props.decimalSeparator)&&(le=le.toString().replace(".",L.props.decimalSeparator)),le},L.recordCursorPosition=function(){try{L.cursorStart=L.input.selectionStart,L.cursorEnd=L.input.selectionEnd,L.currentValue=L.input.value,L.cursorBefore=L.input.value.substring(0,L.cursorStart),L.cursorAfter=L.input.value.substring(L.cursorEnd)}catch(j){}},L.restoreByAfter=function(j){if(j===void 0)return!1;var z=L.input.value,M=z.lastIndexOf(j);if(M===-1)return!1;var N=L.cursorBefore.length;return L.lastKeyCode===p.a.DELETE&&L.cursorBefore.charAt(N-1)===j[0]?(L.fixCaret(N,N),!0):M+j.length===z.length?(L.fixCaret(M,M),!0):!1},L.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(z,M){var N=j.substring(M);return L.restoreByAfter(N)})},L.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},L.stop=function(){L.autoStepTimer&&clearTimeout(L.autoStepTimer)},L.down=function(j,z,M){L.pressingUpOrDown=!0,L.step("down",j,z,M)},L.up=function(j,z,M){L.pressingUpOrDown=!0,L.step("up",j,z,M)},L.saveInput=function(j){L.input=j};var I=T.value;I===void 0&&(I=T.defaultValue),L.state={focused:T.autoFocus};var F=L.getValidValue(L.toNumber(I));return L.state=m(m({},L.state),{},{inputValue:L.toPrecisionAsStep(F),value:F}),L}return Object(X.a)(h,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(L){var I=this.props,F=I.value,j=I.onChange,z=I.max,M=I.min,N=this.state.focused;if(L){if(!R(L.value,F)||!R(L.max,z)||!R(L.min,M)){var Y=N?F:this.getValidValue(F),ee;this.pressingUpOrDown?ee=Y:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:ee})}var le="value"in this.props?F:this.state.value;"max"in this.props&&L.max!==z&&typeof le=="number"&&le>z&&j&&j(z),"min"in this.props&&L.min!==M&&typeof le=="number"&&le<M&&j&&j(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var pe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?pe=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(pe=this.cursorStart):pe=this.input.value.length,this.fixCaret(pe,pe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Oe){}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(L){var I=L;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(L){var I=L.target.value.trim().replace(/。/g,".");return y(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(L);return isNaN(j)?L:(j<I&&(j=I),j>F&&(j=F),j)}},{key:"setValue",value:function(L,I){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(L))?null:parseFloat(L),z=this.state.value,M=z===void 0?null:z,N=this.state.inputValue,Y=N===void 0?null:N,ee=typeof j=="number"?j.toFixed(F):"".concat(j),le=j!==M||ee!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},I)):this.setState({value:j,inputValue:this.toPrecisionAsStep(L)},I),le&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,z=F.step;if(y(j))return j;var M=this.getPrecision(I),N=this.getPrecision(z),Y=this.getPrecision(L);return L?Math.max(Y,M+N):M+N}},{key:"getPrecisionFactor",value:function(L){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(L,I);return Math.pow(10,F)}},{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(L){return this.props.formatter?this.props.formatter(L):L}},{key:"toPrecisionAsStep",value:function(L){if(this.isNotCompleteNumber(L)||L==="")return L;var I=Math.abs(this.getMaxPrecision(L));return isNaN(I)?L.toString():Number(L).toFixed(I)}},{key:"toNumber",value:function(L){var I=this.props.precision,F=this.state.focused,j=L&&L.length>16&&F;return this.isNotCompleteNumber(L)||j?L:y(I)?Math.round(L*Math.pow(10,I))/Math.pow(10,I):Number(L)}},{key:"upStep",value:function(L,I){var F=this.props.step,j=this.getPrecisionFactor(L,I),z=Math.abs(this.getMaxPrecision(L,I)),M=((j*L+j*F*I)/j).toFixed(z);return this.toNumber(M)}},{key:"downStep",value:function(L,I){var F=this.props.step,j=this.getPrecisionFactor(L,I),z=Math.abs(this.getMaxPrecision(L,I)),M=((j*L-j*F*I)/j).toFixed(z);return this.toNumber(M)}},{key:"step",value:function(L,I){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var M=this.props;if(M.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var Y=this["".concat(L,"Step")](N,j),ee=Y>M.max||Y<M.min;if(Y>M.max?Y=M.max:Y<M.min&&(Y=M.min),this.setValue(Y,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){F[L](I,j,!0)},z?l:S)}},{key:"fixCaret",value:function(L,I){if(L===void 0||I===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(L!==F||I!==j)&&this.input.setSelectionRange(L,I)}catch(z){}}},{key:"render",value:function(){var L,I=this.props,F=I.prefixCls,j=I.disabled,z=I.readOnly,M=I.useTouch,N=I.autoComplete,Y=I.upHandler,ee=I.downHandler,le=I.className,pe=I.max,Oe=I.min,Te=I.style,Re=I.title,Ae=I.onMouseEnter,we=I.onMouseLeave,ge=I.onMouseOver,de=I.onMouseOut,re=I.required,ce=I.onClick,se=I.tabIndex,ke=I.type,ie=I.placeholder,ae=I.id,me=I.inputMode,_e=I.pattern,Me=I.step,Ue=I.maxLength,je=I.autoFocus,Fe=I.name,Je=I.onPaste,$e=I.onInput,Qe=Object(ue.a)(I,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Xe=this.state,dt=Xe.value,tt=Xe.focused,lt=d()(F,(L={},Object(J.a)(L,le,!!le),Object(J.a)(L,"".concat(F,"-disabled"),j),Object(J.a)(L,"".concat(F,"-focused"),tt),L)),Ie={};Object.keys(Qe).forEach(function(ve){(ve.substr(0,5)==="data-"||ve.substr(0,5)==="aria-"||ve==="role")&&(Ie[ve]=Qe[ve])});var et=!z&&!j,it=this.getInputDisplayValue(null),Be=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=pe),ze=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=Oe),Ce=Be||j||z,ye=ze||j||z,xe=d()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(J.a)({},"".concat(F,"-handler-up-disabled"),Ce)),ne=d()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(J.a)({},"".concat(F,"-handler-down-disabled"),ye)),oe=M?{onTouchStart:Ce?a:this.up,onTouchEnd:this.stop}:{onMouseDown:Ce?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=M?{onTouchStart:ye?a:this.down,onTouchEnd:this.stop}:{onMouseDown:ye?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:lt,style:Te,title:Re,onMouseEnter:Ae,onMouseLeave:we,onMouseOver:ge,onMouseOut:de,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(F,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Increase Value","aria-disabled":Ce,className:xe}),Y||O.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:i})),O.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:ne}),ee||O.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:i}))),O.a.createElement("div",{className:"".concat(F,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Oe,"aria-valuemax":pe,"aria-valuenow":dt,required:re,type:ke,placeholder:ie,onPaste:Je,onClick:ce,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:se,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:et?this.onKeyDown:a,onKeyUp:et?this.onKeyUp:a,autoFocus:je,maxLength:Ue,readOnly:z,disabled:j,max:pe,min:Oe,step:Me,name:Fe,title:Re,id:ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(it),pattern:_e,inputMode:me,onInput:$e},Ie))))}}]),h}(O.a.Component);_.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:s,required:!1,autoComplete:"off"};var C=_,E=Se.a=C},fjLI:function(bt,Se,Q){"use strict";Q.d(Se,"e",function(){return A}),Q.d(Se,"a",function(){return d}),Q.d(Se,"c",function(){return p}),Q.d(Se,"d",function(){return m}),Q.d(Se,"b",function(){return g});var ue=Q("8HAY"),J=Q("Cg/j"),k=Q("T8No"),X=Q("nnTU"),U=Q("MI8n"),P=function(){var b=function(a,i){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var S in l)l.hasOwnProperty(S)&&(s[S]=l[S])},b(a,i)};return function(a,i){b(a,i);function s(){this.constructor=a}a.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),W=function(b,a,i,s){var l=arguments.length,S=l<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,i):s,v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,a,i,s);else for(var y=b.length-1;y>=0;y--)(v=b[y])&&(S=(l<3?v(S):l>3?v(a,i,S):v(a,i))||S);return l>3&&S&&Object.defineProperty(a,i,S),S},B=function(b,a){return function(i,s){a(i,s,b)}},O=function(){for(var b=0,a=0,i=arguments.length;a<i;a++)b+=arguments[a].length;for(var s=Array(b),l=0,a=0;a<i;a++)for(var S=arguments[a],v=0,y=S.length;v<y;v++,l++)s[l]=S[v];return s};function A(b){return b.command!==void 0}var d=Object(J.c)("menuService"),p=new(function(){function b(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new U.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return b.prototype.addCommand=function(a){var i=this;return this._commands.set(a.id,a),this._onDidChangeMenu.fire(0),{dispose:function(){i._commands.delete(a.id)&&i._onDidChangeMenu.fire(0)}}},b.prototype.getCommand=function(a){return this._commands.get(a)},b.prototype.getCommands=function(){var a=new Map;return this._commands.forEach(function(i,s){return a.set(s,i)}),a},b.prototype.appendMenuItem=function(a,i){var s=this,l=this._menuItems.get(a);return l?l.push(i):(l=[i],this._menuItems.set(a,l)),this._onDidChangeMenu.fire(a),{dispose:function(){var S=l.indexOf(i);S>=0&&(l.splice(S,1),s._onDidChangeMenu.fire(a))}}},b.prototype.getMenuItems=function(a){var i=(this._menuItems.get(a)||[]).slice(0);return a===0&&this._appendImplicitItems(i),i},b.prototype._appendImplicitItems=function(a){for(var i=new Set,s=a.filter(function(_){return A(_)}),l=0,S=s;l<S.length;l++){var v=S[l],y=v.command,R=v.alt;i.add(y.id),R&&i.add(R.id)}this._commands.forEach(function(_,C){i.has(C)||a.push({command:_})})},b}()),w=function(b){P(a,b);function a(i,s,l){var S=b.call(this,i,s)||this;return S._commandService=l,S}return a.prototype.run=function(){for(var i,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return(i=this._commandService).executeCommand.apply(i,O([this.id],s))},a=W([B(2,X.b)],a),a}(ue.a),m=function(b){P(a,b);function a(i){var s=this;return typeof i.title=="string"?s=b.call(this,"",i.title,"submenu")||this:s=b.call(this,"",i.title.value,"submenu")||this,s.item=i,s}return a}(ue.a),g=function(b){P(a,b);function a(i,s,l,S,v){var y=this;return typeof i.title=="string"?y=b.call(this,i.id,i.title,v)||this:y=b.call(this,i.id,i.title.value,v)||this,y._cssClass=void 0,y._enabled=!i.precondition||S.contextMatchesRules(i.precondition),y._checked=Boolean(i.toggled&&S.contextMatchesRules(i.toggled)),y._options=l||{},y.item=i,y.alt=s?new a(s,void 0,y._options,S,v):void 0,y}return a.prototype.dispose=function(){this.alt&&this.alt.dispose(),b.prototype.dispose.call(this)},a.prototype.run=function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var l=[];return this._options.arg&&(l=O(l,[this._options.arg])),this._options.shouldForwardArgs&&(l=O(l,i)),b.prototype.run.apply(this,l)},a=W([B(3,k.c),B(4,X.b)],a),a}(w)},h78n:function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return L});var ue=Q("q1tI"),J=Q.n(ue),k=Q("TSYQ"),X=Q.n(k),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(j){var z=j.map(function(){return Object(ue.useRef)()}),M=Object(ue.useRef)();return Object(ue.useEffect)(function(){var N=Date.now(),Y=!1;Object.keys(z).forEach(function(ee){var le=z[ee].current;if(!le)return;Y=!0;var pe=le.style;pe.transitionDuration=".3s, .3s, .3s, .06s",M.current&&N-M.current<100&&(pe.transitionDuration="0s, 0s")}),Y&&(M.current=Date.now())}),[z]};function W(){return W=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var z=arguments[j];for(var M in z)Object.prototype.hasOwnProperty.call(z,M)&&(F[M]=z[M])}return F},W.apply(this,arguments)}function B(F,j){return w(F)||p(F,j)||A(F,j)||O()}function O(){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 A(F,j){if(!F)return;if(typeof F=="string")return d(F,j);var z=Object.prototype.toString.call(F).slice(8,-1);if(z==="Object"&&F.constructor&&(z=F.constructor.name),z==="Map"||z==="Set")return Array.from(F);if(z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(z))return d(F,j)}function d(F,j){(j==null||j>F.length)&&(j=F.length);for(var z=0,M=new Array(j);z<j;z++)M[z]=F[z];return M}function p(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var z=[],M=!0,N=!1,Y=void 0;try{for(var ee=F[Symbol.iterator](),le;!(M=(le=ee.next()).done)&&!(z.push(le.value),j&&z.length===j);M=!0);}catch(pe){N=!0,Y=pe}finally{try{!M&&ee.return!=null&&ee.return()}finally{if(N)throw Y}}return z}function w(F){if(Array.isArray(F))return F}function m(F,j){if(F==null)return{};var z=g(F,j),M,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(F);for(N=0;N<Y.length;N++){if(M=Y[N],j.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,M))continue;z[M]=F[M]}}return z}function g(F,j){if(F==null)return{};var z={},M=Object.keys(F),N,Y;for(Y=0;Y<M.length;Y++){if(N=M[Y],j.indexOf(N)>=0)continue;z[N]=F[N]}return z}var b=function(j){var z=j.className,M=j.percent,N=j.prefixCls,Y=j.strokeColor,ee=j.strokeLinecap,le=j.strokeWidth,pe=j.style,Oe=j.trailColor,Te=j.trailWidth,Re=j.transition,Ae=m(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ae.gapPosition;var we=Array.isArray(M)?M:[M],ge=Array.isArray(Y)?Y:[Y],de=P(we),re=B(de,1),ce=re[0],se=le/2,ke=100-le/2,ie="M ".concat(ee==="round"?se:0,",").concat(se,`
L `).concat(ee==="round"?ke:100,",").concat(se),ae="0 0 100 ".concat(le),me=0;return J.a.createElement("svg",W({className:X()("".concat(N,"-line"),z),viewBox:ae,preserveAspectRatio:"none",style:pe},Ae),J.a.createElement("path",{className:"".concat(N,"-line-trail"),d:ie,strokeLinecap:ee,stroke:Oe,strokeWidth:Te||le,fillOpacity:"0"}),we.map(function(_e,Me){var Ue={strokeDasharray:"".concat(_e,"px, 100px"),strokeDashoffset:"-".concat(me,"px"),transition:Re||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},je=ge[Me]||ge[ge.length-1];return me+=_e,J.a.createElement("path",{key:Me,className:"".concat(N,"-line-path"),d:ie,strokeLinecap:ee,stroke:je,strokeWidth:le,fillOpacity:"0",ref:ce[Me],style:Ue})}))};b.defaultProps=U;var a=b;function i(){return i=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var z=arguments[j];for(var M in z)Object.prototype.hasOwnProperty.call(z,M)&&(F[M]=z[M])}return F},i.apply(this,arguments)}function s(F,j){return R(F)||y(F,j)||S(F,j)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(F,j){if(!F)return;if(typeof F=="string")return v(F,j);var z=Object.prototype.toString.call(F).slice(8,-1);if(z==="Object"&&F.constructor&&(z=F.constructor.name),z==="Map"||z==="Set")return Array.from(F);if(z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(z))return v(F,j)}function v(F,j){(j==null||j>F.length)&&(j=F.length);for(var z=0,M=new Array(j);z<j;z++)M[z]=F[z];return M}function y(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var z=[],M=!0,N=!1,Y=void 0;try{for(var ee=F[Symbol.iterator](),le;!(M=(le=ee.next()).done)&&!(z.push(le.value),j&&z.length===j);M=!0);}catch(pe){N=!0,Y=pe}finally{try{!M&&ee.return!=null&&ee.return()}finally{if(N)throw Y}}return z}function R(F){if(Array.isArray(F))return F}function _(F,j){if(F==null)return{};var z=C(F,j),M,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(F);for(N=0;N<Y.length;N++){if(M=Y[N],j.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,M))continue;z[M]=F[M]}}return z}function C(F,j){if(F==null)return{};var z={},M=Object.keys(F),N,Y;for(Y=0;Y<M.length;Y++){if(N=M[Y],j.indexOf(N)>=0)continue;z[N]=F[N]}return z}var E=0;function c(F){return+F.replace("%","")}function u(F){return Array.isArray(F)?F:[F]}function h(F,j,z,M){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,ee=50-M/2,le=0,pe=-ee,Oe=0,Te=-2*ee;switch(Y){case"left":le=-ee,pe=0,Oe=2*ee,Te=0;break;case"right":le=ee,pe=0,Oe=-2*ee,Te=0;break;case"bottom":pe=ee,Te=2*ee;break;default:}var Re="M 50,50 m ".concat(le,",").concat(pe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Oe,",").concat(-Te,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Oe,",").concat(Te),Ae=Math.PI*2*ee,we={stroke:z,strokeDasharray:"".concat(j/100*(Ae-N),"px ").concat(Ae,"px"),strokeDashoffset:"-".concat(N/2+F/100*(Ae-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Re,pathStyle:we}}var T=function(j){var z=j.prefixCls,M=j.strokeWidth,N=j.trailWidth,Y=j.gapDegree,ee=j.gapPosition,le=j.trailColor,pe=j.strokeLinecap,Oe=j.style,Te=j.className,Re=j.strokeColor,Ae=j.percent,we=_(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ge=Object(ue.useMemo)(function(){return E+=1,E},[]),de=h(0,100,le,M,Y,ee),re=de.pathString,ce=de.pathStyle,se=u(Ae),ke=u(Re),ie=ke.find(function(Ue){return Object.prototype.toString.call(Ue)==="[object Object]"}),ae=P(se),me=s(ae,1),_e=me[0],Me=function(){var je=0;return se.map(function(Fe,Je){var $e=ke[Je]||ke[ke.length-1],Qe=Object.prototype.toString.call($e)==="[object Object]"?"url(#".concat(z,"-gradient-").concat(ge,")"):"",Xe=h(je,Fe,$e,M,Y,ee);return je+=Fe,J.a.createElement("path",{key:Je,className:"".concat(z,"-circle-path"),d:Xe.pathString,stroke:Qe,strokeLinecap:pe,strokeWidth:M,opacity:Fe===0?0:1,fillOpacity:"0",style:Xe.pathStyle,ref:_e[Je]})})};return J.a.createElement("svg",i({className:X()("".concat(z,"-circle"),Te),viewBox:"0 0 100 100",style:Oe},we),ie&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(z,"-gradient-").concat(ge),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ie).sort(function(Ue,je){return c(Ue)-c(je)}).map(function(Ue,je){return J.a.createElement("stop",{key:je,offset:Ue,stopColor:ie[Ue]})}))),J.a.createElement("path",{className:"".concat(z,"-circle-trail"),d:re,stroke:le,strokeLinecap:pe,strokeWidth:N||M,fillOpacity:"0",style:ce}),Me().reverse())};T.defaultProps=U;var L=T,I={Line:a,Circle:L}},kSUc:function(bt,Se,Q){},"kaH+":function(bt,Se,Q){"use strict";var ue=Q("+L6B"),J=Q("2/Rp"),k=Q("tJVT"),X=Q("q1tI"),U=Q.n(X),P=Q("XFxt"),W=Q.n(P),B=Q("dhSg"),O=Q("rLCj"),A=Q("dF/Y"),d=Q("4i/N");Se.a=function(){var p=Object(X.useState)(""),w=Object(k.a)(p,2),m=w[0],g=w[1],b=Object(X.useState)(0),a=Object(k.a)(b,2),i=a[0],s=a[1],l=Object(X.useRef)("");Object(X.useEffect)(function(){var R=B.a.subscribe("preview-image",function(_){g(_),document.body.style.overflow="hidden"});return R},[]),Object(X.useEffect)(function(){return document.addEventListener("keydown",S),function(){document.removeEventListener("keydown",S)}},[]),Object(X.useEffect)(function(){l.current=m},[m]);function S(R){R.keyCode==27&&l.current&&v()}function v(){document.body.style.overflow="auto",g("")}function y(){s(i+90)}return U.a.createElement(X.Fragment,null,m?U.a.createElement("div",{className:W.a["image-preview-container"]},U.a.createElement("div",{className:W.a["button-group"]},U.a.createElement(J.a,{onClick:y},"\u65CB\u8F6C",U.a.createElement(O.a,null)),U.a.createElement(J.a,{href:m},"\u4E0B\u8F7D",U.a.createElement(A.a,null)),U.a.createElement(J.a,{onClick:v},"\u5173\u95ED",U.a.createElement(d.a,null))),U.a.createElement("div",{className:W.a["preview-wrp-group"]},U.a.createElement("img",{className:W.a["image-preview"],src:m,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(i,"deg)")}}))):null)}},lZu9:function(bt,Se,Q){(function(ue){ue(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(J,k){var X=ue.getMode(J,"text/html"),U=X.name=="null";function P(M){if(ue.findModeByName){var N=ue.findModeByName(M);N&&(M=N.mime||N.mimes[0])}var Y=ue.getMode(J,M);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 B in W)W.hasOwnProperty(B)&&k.tokenTypeOverrides[B]&&(W[B]=k.tokenTypeOverrides[B]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,d=/^\[(x| )\](?=\s)/i,p=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,w=/^ {0,3}(?:\={1,}|-{2,})\s*$/,m=/^[^#!\[\]*_\\<>` "'(~:]+/,g=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,a=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,i=" ";function s(M,N,Y){return N.f=N.inline=Y,Y(M,N)}function l(M,N,Y){return N.f=N.block=Y,Y(M,N)}function S(M){return!M||!/\S/.test(M.string)}function v(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==R){var N=U;if(!N){var Y=ue.innerMode(X,M.htmlState);N=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}N&&(M.f=c,M.block=y,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function y(M,N){var Y=M.column()===N.indentation,ee=S(N.prevLine.stream),le=N.indentedCode,pe=N.prevLine.hr,Oe=N.list!==!1,Te=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Re=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Oe)){for(N.list=null;Re<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=Re-N.listStack[N.listStack.length-1])}var Ae=!ee&&!pe&&!N.prevLine.header&&(!Oe||!le)&&!N.prevLine.fencedCodeEnd,we=(N.list===!1||pe||ee)&&N.indentation<=Te&&M.match(O),ge=null;if(N.indentationDiff>=4&&(le||N.prevLine.fencedCodeEnd||N.prevLine.header||ee))return M.skipToEnd(),N.indentedCode=!0,W.code;if(M.eatSpace())return null;if(Y&&N.indentation<=Te&&(ge=M.match(p))&&ge[1].length<=6)return N.quote=0,N.header=ge[1].length,N.thisLine.header=!0,k.highlightFormatting&&(N.formatting="header"),N.f=N.inline,C(N);if(N.indentation<=Te&&M.eat(">"))return N.quote=Y?1:N.quote+1,k.highlightFormatting&&(N.formatting="quote"),M.eatSpace(),C(N);if(!we&&!N.setext&&Y&&N.indentation<=Te&&(ge=M.match(A))){var de=ge[1]?"ol":"ul";return N.indentation=Re+M.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&&M.match(d,!1)&&(N.taskList=!0),N.f=N.inline,k.highlightFormatting&&(N.formatting=["list","list-"+de]),C(N)}else{if(Y&&N.indentation<=Te&&(ge=M.match(g,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ge[1]+"+ *$"),N.localMode=k.fencedCodeBlockHighlighting&&P(ge[2]||k.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ue.startState(N.localMode)),N.f=N.block=_,k.highlightFormatting&&(N.formatting="code-block"),N.code=-1,C(N);if(N.setext||(!Ae||!Oe)&&!N.quote&&N.list===!1&&!N.code&&!we&&!b.test(M.string)&&(ge=M.lookAhead(1))&&(ge=ge.match(w)))return N.setext?(N.header=N.setext,N.setext=0,M.skipToEnd(),k.highlightFormatting&&(N.formatting="header")):(N.header=ge[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,C(N);if(we)return M.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,W.hr;if(M.peek()==="[")return s(M,N,I)}return s(M,N,N.inline)}function R(M,N){var Y=X.token(M,N.htmlState);if(!U){var ee=ue.innerMode(X,N.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||N.md_inside&&M.current().indexOf(">")>-1)&&(N.f=c,N.block=y,N.htmlState=null)}return Y}function _(M,N){var Y=N.listStack[N.listStack.length-1]||0,ee=N.indentation<Y,le=Y+3;if(N.fencedEndRE&&N.indentation<=le&&(ee||M.match(N.fencedEndRE))){k.highlightFormatting&&(N.formatting="code-block");var pe;return ee||(pe=C(N)),N.localMode=N.localState=null,N.block=y,N.f=c,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ee?l(M,N,N.block):pe}else return N.localMode?N.localMode.token(M,N.localState):(M.skipToEnd(),W.code)}function C(M){var N=[];if(M.formatting){N.push(W.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var Y=0;Y<M.formatting.length;Y++)N.push(W.formatting+"-"+M.formatting[Y]),M.formatting[Y]==="header"&&N.push(W.formatting+"-"+M.formatting[Y]+"-"+M.header),M.formatting[Y]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=M.quote?N.push(W.formatting+"-"+M.formatting[Y]+"-"+M.quote):N.push("error"))}if(M.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(M.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(M.linkHref?N.push(W.linkHref,"url"):(M.strong&&N.push(W.strong),M.em&&N.push(W.em),M.strikethrough&&N.push(W.strikethrough),M.emoji&&N.push(W.emoji),M.linkText&&N.push(W.linkText),M.code&&N.push(W.code),M.image&&N.push(W.image),M.imageAltText&&N.push(W.imageAltText,"link"),M.imageMarker&&N.push(W.imageMarker)),M.header&&N.push(W.header,W.header+"-"+M.header),M.quote&&(N.push(W.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=M.quote?N.push(W.quote+"-"+M.quote):N.push(W.quote+"-"+k.maxBlockquoteDepth)),M.list!==!1){var ee=(M.listStack.length-1)%3;ee?ee===1?N.push(W.list2):N.push(W.list3):N.push(W.list1)}return M.trailingSpaceNewLine?N.push("trailing-space-new-line"):M.trailingSpace&&N.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function E(M,N){return M.match(m,!0)?C(N):void 0}function c(M,N){var Y=N.text(M,N);if(typeof Y!="undefined")return Y;if(N.list)return N.list=null,C(N);if(N.taskList){var ee=M.match(d,!0)[1]===" ";return ee?N.taskOpen=!0:N.taskClosed=!0,k.highlightFormatting&&(N.formatting="task"),N.taskList=!1,C(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&M.match(/^#+$/,!0))return k.highlightFormatting&&(N.formatting="header"),C(N);var le=M.next();if(N.linkTitle){N.linkTitle=!1;var pe=le;le==="("&&(pe=")"),pe=(pe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Oe="^\\s*(?:[^"+pe+"\\\\]+|\\\\\\\\|\\\\.)"+pe;if(M.match(new RegExp(Oe),!0))return W.linkHref}if(le==="`"){var Te=N.formatting;k.highlightFormatting&&(N.formatting="code"),M.eatWhile("`");var Re=M.current().length;if(N.code==0&&(!N.quote||Re==1))return N.code=Re,C(N);if(Re==N.code){var Ae=C(N);return N.code=0,Ae}else return N.formatting=Te,C(N)}else if(N.code)return C(N);if(le==="\\"&&(M.next(),k.highlightFormatting)){var we=C(N),ge=W.formatting+"-escape";return we?we+" "+ge:ge}if(le==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,k.highlightFormatting&&(N.formatting="image"),C(N);if(le==="["&&N.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,k.highlightFormatting&&(N.formatting="image"),C(N);if(le==="]"&&N.imageAltText){k.highlightFormatting&&(N.formatting="image");var we=C(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=h,we}if(le==="["&&!N.image)return N.linkText&&M.match(/^.*?\]/)||(N.linkText=!0,k.highlightFormatting&&(N.formatting="link")),C(N);if(le==="]"&&N.linkText){k.highlightFormatting&&(N.formatting="link");var we=C(N);return N.linkText=!1,N.inline=N.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?h:c,we}if(le==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=u,k.highlightFormatting&&(N.formatting="link");var we=C(N);return we?we+=" ":we="",we+W.linkInline}if(le==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=u,k.highlightFormatting&&(N.formatting="link");var we=C(N);return we?we+=" ":we="",we+W.linkEmail}if(k.xml&&le==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var de=M.string.indexOf(">",M.pos);if(de!=-1){var re=M.string.substring(M.start,de);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(N.md_inside=!0)}return M.backUp(1),N.htmlState=ue.startState(X),l(M,N,R)}if(k.xml&&le==="<"&&M.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(le==="*"||le==="_"){for(var ce=1,se=M.pos==1?" ":M.string.charAt(M.pos-2);ce<3&&M.eat(le);)ce++;var ke=M.peek()||" ",ie=!/\s/.test(ke)&&(!a.test(ke)||/\s/.test(se)||a.test(se)),ae=!/\s/.test(se)&&(!a.test(se)||/\s/.test(ke)||a.test(ke)),me=null,_e=null;if(ce%2&&(!N.em&&ie&&(le==="*"||!ae||a.test(se))?me=!0:N.em==le&&ae&&(le==="*"||!ie||a.test(ke))&&(me=!1)),ce>1&&(!N.strong&&ie&&(le==="*"||!ae||a.test(se))?_e=!0:N.strong==le&&ae&&(le==="*"||!ie||a.test(ke))&&(_e=!1)),_e!=null||me!=null){k.highlightFormatting&&(N.formatting=me==null?"strong":_e==null?"em":"strong em"),me===!0&&(N.em=le),_e===!0&&(N.strong=le);var Ae=C(N);return me===!1&&(N.em=!1),_e===!1&&(N.strong=!1),Ae}}else if(le===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return C(N);M.backUp(1)}if(k.strikethrough){if(le==="~"&&M.eatWhile(le)){if(N.strikethrough){k.highlightFormatting&&(N.formatting="strikethrough");var Ae=C(N);return N.strikethrough=!1,Ae}else if(M.match(/^[^\s]/,!1))return N.strikethrough=!0,k.highlightFormatting&&(N.formatting="strikethrough"),C(N)}else if(le===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return C(N);M.backUp(2)}}if(k.emoji&&le===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,k.highlightFormatting&&(N.formatting="emoji");var Me=C(N);return N.emoji=!1,Me}return le===" "&&(M.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),C(N)}function u(M,N){var Y=M.next();if(Y===">"){N.f=N.inline=c,k.highlightFormatting&&(N.formatting="link");var ee=C(N);return ee?ee+=" ":ee="",ee+W.linkInline}return M.match(/^[^>]+/,!0),W.linkInline}function h(M,N){if(M.eatSpace())return null;var Y=M.next();return Y==="("||Y==="["?(N.f=N.inline=L(Y==="("?")":"]"),k.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,C(N)):"error"}var T={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function L(M){return function(N,Y){var ee=N.next();if(ee===M){Y.f=Y.inline=c,k.highlightFormatting&&(Y.formatting="link-string");var le=C(Y);return Y.linkHref=!1,le}return N.match(T[M]),Y.linkHref=!0,C(Y)}}function I(M,N){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=F,M.next(),k.highlightFormatting&&(N.formatting="link"),N.linkText=!0,C(N)):s(M,N,c)}function F(M,N){if(M.match(/^\]:/,!0)){N.f=N.inline=j,k.highlightFormatting&&(N.formatting="link");var Y=C(N);return N.linkText=!1,Y}return M.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function j(M,N){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?N.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=c,W.linkHref+" url")}var z={startState:function(){return{f:y,prevLine:{stream:null},thisLine:{stream:null},block:y,htmlState:null,indentation:0,inline:c,text:E,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(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&ue.copyState(X,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?ue.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,N){if(N.formatting=!1,M!=N.thisLine.stream){if(N.header=0,N.hr=!1,M.match(/^\s*$/,!0))return v(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:M},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=R)){var Y=M.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(N.indentation=Y,N.indentationDiff=null,Y>0)return null}}return N.f(M,N)},innerMode:function(M){return M.block==R?{state:M.htmlState,mode:X}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:z}},indent:function(M,N,Y){return M.block==R&&X.indent?X.indent(M.htmlState,N,Y):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,N,Y):ue.Pass},blankLine:v,getType:C,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},nnTU:function(bt,Se,Q){"use strict";Q.d(Se,"b",function(){return B}),Q.d(Se,"a",function(){return O});var ue=Q("pmY6"),J=Q("746U"),k=Q("Cg/j"),X=Q("MI8n"),U=Q("24hK"),P=Q("QDVR"),W=function(){for(var A=0,d=0,p=arguments.length;d<p;d++)A+=arguments[d].length;for(var w=Array(A),m=0,d=0;d<p;d++)for(var g=arguments[d],b=0,a=g.length;b<a;b++,m++)w[m]=g[b];return w},B=Object(k.c)("commandService"),O=new(function(){function A(){this._commands=new Map,this._onDidRegisterCommand=new X.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return A.prototype.registerCommand=function(d,p){var w=this;if(!d)throw new Error("invalid command");if(typeof d=="string"){if(!p)throw new Error("invalid command");return this.registerCommand({id:d,handler:p})}if(d.description){for(var m=[],g=0,b=d.description.args;g<b.length;g++){var a=b[g];m.push(a.constraint)}var i=d.handler;d.handler=function(y){for(var R=[],_=1;_<arguments.length;_++)R[_-1]=arguments[_];return Object(J.m)(R,m),i.apply(void 0,W([y],R))}}var s=d.id,l=this._commands.get(s);l||(l=new U.a,this._commands.set(s,l));var S=l.unshift(d),v=Object(ue.h)(function(){S();var y=w._commands.get(s);(y==null?void 0:y.isEmpty())&&w._commands.delete(s)});return this._onDidRegisterCommand.fire(s),v},A.prototype.registerCommandAlias=function(d,p){return O.registerCommand(d,function(w){for(var m,g=[],b=1;b<arguments.length;b++)g[b-1]=arguments[b];return(m=w.get(B)).executeCommand.apply(m,W([p],g))})},A.prototype.getCommand=function(d){var p=this._commands.get(d);return!p||p.isEmpty()?void 0:p.iterator().next().value},A.prototype.getCommands=function(){for(var d=new Map,p=0,w=Object(P.d)(this._commands);p<w.length;p++){var m=w[p],g=this.getCommand(m);g&&d.set(m,g)}return d},A}())},osHv:function(bt,Se,Q){(function(ue){ue(Q("VrN/"))})(function(ue){"use strict";var J=ue.Pos;function k(a,i){return a.line-i.line||a.ch-i.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",P=new RegExp("<(/?)(["+X+"]["+U+"]*)","g");function W(a,i,s,l){this.line=i,this.ch=s,this.cm=a,this.text=a.getLine(i),this.min=l?Math.max(l.from,a.firstLine()):a.firstLine(),this.max=l?Math.min(l.to-1,a.lastLine()):a.lastLine()}function B(a,i){var s=a.cm.getTokenTypeAt(J(a.line,i));return s&&/\btag\b/.test(s)}function O(a){return a.line>=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function A(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function d(a){for(;;){var i=a.text.indexOf(">",a.ch);if(i==-1){if(O(a))continue;return}if(!B(a,i+1)){a.ch=i+1;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function p(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(A(a))continue;return}if(!B(a,i+1)){a.ch=i;continue}P.lastIndex=i,a.ch=i;var s=P.exec(a.text);if(s&&s.index==i)return s}}function w(a){for(;;){P.lastIndex=a.ch;var i=P.exec(a.text);if(!i){if(O(a))continue;return}if(!B(a,i.index+1)){a.ch=i.index+1;continue}return a.ch=i.index+i[0].length,i}}function m(a){for(;;){var i=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(i==-1){if(A(a))continue;return}if(!B(a,i+1)){a.ch=i;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function g(a,i){for(var s=[];;){var l=w(a),S,v=a.line,y=a.ch-(l?l[0].length:0);if(!l||!(S=d(a)))return;if(S=="selfClose")continue;if(l[1]){for(var R=s.length-1;R>=0;--R)if(s[R]==l[2]){s.length=R;break}if(R<0&&(!i||i==l[2]))return{tag:l[2],from:J(v,y),to:J(a.line,a.ch)}}else s.push(l[2])}}function b(a,i){for(var s=[];;){var l=m(a);if(!l)return;if(l=="selfClose"){p(a);continue}var S=a.line,v=a.ch,y=p(a);if(!y)return;if(y[1])s.push(y[2]);else{for(var R=s.length-1;R>=0;--R)if(s[R]==y[2]){s.length=R;break}if(R<0&&(!i||i==y[2]))return{tag:y[2],from:J(a.line,a.ch),to:J(S,v)}}}}ue.registerHelper("fold","xml",function(a,i){for(var s=new W(a,i.line,0);;){var l=w(s);if(!l||s.line!=i.line)return;var S=d(s);if(!S)return;if(!l[1]&&S!="selfClose"){var v=J(s.line,s.ch),y=g(s,l[2]);return y&&k(y.from,v)>0?{from:v,to:y.from}:null}}}),ue.findMatchingTag=function(a,i,s){var l=new W(a,i.line,i.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var S=d(l),v=S&&J(l.line,l.ch),y=S&&p(l);if(!S||!y||k(l,i)>0)return;var R={from:J(l.line,l.ch),to:v,tag:y[2]};return S=="selfClose"?{open:R,close:null,at:"open"}:y[1]?{open:b(l,y[2]),close:R,at:"close"}:(l=new W(a,v.line,v.ch,s),{open:R,close:g(l,y[2]),at:"open"})},ue.findEnclosingTag=function(a,i,s,l){for(var S=new W(a,i.line,i.ch,s);;){var v=b(S,l);if(!v)break;var y=new W(a,i.line,i.ch,s),R=g(y,v.tag);if(R)return{open:v,close:R}}},ue.scanForClosingTag=function(a,i,s,l){var S=new W(a,i.line,i.ch,l?{from:0,to:l}:null);return g(S,s)}})},p5ED:function(bt,Se,Q){"use strict";var ue=Q("+L6B"),J=Q("2/Rp"),k=Q("5Dmo"),X=Q("3S7+"),U=Q("k1fw"),P=Q("9og8"),W=Q("tJVT"),B=Q("WmNS"),O=Q.n(B),A=Q("q1tI"),d=Q.n(A),p=Q("vHTk"),w=Q.n(p),m=Q("yEEn"),g=Q("ZW9T"),b=Q("1vsH"),a=Q("V0Rq"),i=Q("m3rI");Se.a=function(s){var l,S,v,y,R,_,C=s.editOffice,E=C===void 0?"view":C,c=s.name,u=s.data,h=s.theme,T=s.type,L=s.filename,I=s.monacoEditor,F=s.className,j=s.style,z=s.close,M=s.onClose,N=s.hasMask,Y=s.disabledDownload,ee=s.onImgDimensions,le=s.otherData,pe=Object(A.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Oe=Object(W.a)(pe,2),Te=Oe[0],Re=Oe[1],Ae=Object(A.useState)(""),we=Object(W.a)(Ae,2),ge=we[0],de=we[1],re=Object(A.useState)(),ce=Object(W.a)(re,2),se=ce[0],ke=ce[1],ie=window.ENV==="build"?"/react/build":"",ae=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,me,_e=1024*1024,Me=10*_e,Ue=Object(A.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&T!=="txt"&&(u=i.a.API_SERVER+u),T==="office"&&(me=Object(b.P)(u).filesize,me>Me&&(T="other")),L&&(I.filename=L),Object(A.useEffect)(function(){var $e,Qe,Xe=($e=document.cookie)===null||$e===void 0||((Qe=$e.replace(/\s/g,""))===null||Qe===void 0)?void 0:Qe.split(";");Xe==null||Xe.map(function(dt){var tt=dt.split("=");tt[0]==="_educoder_session"&&de(tt[1])})},[]),Object(A.useEffect)(function(){T==="office"&&je()},[T,u]);var je=function(){var $e=Object(P.a)(O.a.mark(function Qe(){var Xe,dt,tt;return O.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return console.log("data:",u),Xe=u,u.startsWith("http")||(Xe=location.origin+Xe),dt=new URL(Xe).pathname.split("/").pop(),Ie.next=6,Object(a.U)({attachment_id:dt});case 6:tt=Ie.sent,ke(tt);case 8:case"end":return Ie.stop()}},Qe)}));return function(){return $e.apply(this,arguments)}}(),Fe=function(){if(u.startsWith("http")||u.startsWith("blob:")){Je();return}Object(b.x)(L||"educoder",u,L)},Je=function(){Object(b.v)(L||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(U.a)({},j||{}),className:"".concat(N&&w.a.bgBlack," ").concat(T?w.a.wrp:"hide")},z&&d.a.createElement("div",{className:w.a.close,ref:Ue},!!ee&&d.a.createElement(X.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return Ue.current}},d.a.createElement("span",{onClick:function(){M(),ee()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!Y&&d.a.createElement(X.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Ue.current}},d.a.createElement("span",{onClick:Je},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(X.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Ue.current}},d.a.createElement("span",{className:"",onClick:M},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(w.a[F]," ").concat(F," ").concat(w.a.monaco," ").concat(T==="txt"?"show":"hide")},T==="txt"&&d.a.createElement(g.b,I)),T==="audio"&&d.a.createElement("audio",{src:"".concat(((S=u)===null||S===void 0?void 0:S.indexOf("http://"))>-1||((v=u)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),T==="video"&&d.a.createElement(d.a.Fragment,null,((y=u)===null||y===void 0?void 0:y.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),T==="office"&&se&&d.a.createElement("iframe",{src:"".concat(ie,"/office.html?key=").concat(se.key,"&url=").concat(ae+se.url,"&callbackUrl=").concat(ae+se.callbackUrl,"&fileType=").concat(se.fileType,"&title=").concat(se.title,"&model=").concat(E,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!Y)}),(T==="xlsx"||T==="doc"||T==="pptx"||T==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(le.key,"&url=").concat(i.a.API_SERVER+le.url,"&callbackUrl=").concat(i.a.API_SERVER+le.callbackUrl,"&fileType=").concat(le.fileType,"&title=").concat(le.title,"&model=").concat(le.model)}),T==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),T==="pdf"&&d.a.createElement("embed",{className:w.a.embed,src:u}),T==="image"&&d.a.createElement("img",{src:"".concat(((R=u)===null||R===void 0?void 0:R.indexOf("http://"))>-1||((_=u)===null||_===void 0?void 0:_.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)}),T==="other"&&d.a.createElement("div",null,d.a.createElement(J.a,{type:"primary",size:"large",onClick:Fe},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),T==="download"&&d.a.createElement(J.a,{type:"primary",size:"large",onClick:Fe},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(bt,Se,Q){},pmY6:function(bt,Se,Q){"use strict";Q.d(Se,"g",function(){return U}),Q.d(Se,"f",function(){return P}),Q.d(Se,"e",function(){return W}),Q.d(Se,"h",function(){return B}),Q.d(Se,"b",function(){return O}),Q.d(Se,"a",function(){return A}),Q.d(Se,"d",function(){return d}),Q.d(Se,"c",function(){return p});var ue=!1,J="__is_disposable_tracked__";function k(w){if(!ue)return;if(w&&w!==A.None)try{w[J]=!0}catch(m){}}function X(w){if(!ue)return w;var m=new Error("Potentially leaked disposable").stack;return setTimeout(function(){w[J]||console.log(m)},3e3),w}function U(w){return typeof w.dispose=="function"&&w.dispose.length===0}function P(w){return Array.isArray(w)?(w.forEach(function(m){m&&(k(m),m.dispose())}),[]):w?(k(w),w.dispose(),w):void 0}function W(){for(var w=[],m=0;m<arguments.length;m++)w[m]=arguments[m];return w.forEach(k),X({dispose:function(){return P(w)}})}function B(w){var m=X({dispose:function(){k(m),w()}});return m}var O=function(){function w(){this._toDispose=new Set,this._isDisposed=!1}return w.prototype.dispose=function(){if(this._isDisposed)return;k(this),this._isDisposed=!0,this.clear()},w.prototype.clear=function(){this._toDispose.forEach(function(m){return m.dispose()}),this._toDispose.clear()},w.prototype.add=function(m){if(!m)return m;if(m===this)throw new Error("Cannot register a disposable on itself!");return k(m),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(m),m},w}(),A=function(){function w(){this._store=new O,X(this)}return w.prototype.dispose=function(){k(this),this._store.dispose()},w.prototype._register=function(m){if(m===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(m)},w.None=Object.freeze({dispose:function(){}}),w}(),d=function(){function w(){this._isDisposed=!1,X(this)}return Object.defineProperty(w.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(m){if(this._isDisposed||m===this._value)return;this._value&&this._value.dispose(),m&&k(m),this._value=m},enumerable:!0,configurable:!0}),w.prototype.clear=function(){this.value=void 0},w.prototype.dispose=function(){this._isDisposed=!0,k(this),this._value&&this._value.dispose(),this._value=void 0},w}(),p=function(){function w(m){this.object=m}return w.prototype.dispose=function(){},w}()},"rAM+":function(bt,Se,Q){"use strict";Q.d(Se,"a",function(){return J});var ue=Q("Qw5x");function J(k,X){var U;if(typeof Symbol=="undefined"||k[Symbol.iterator]==null){if(Array.isArray(k)||(U=Object(ue.a)(k))||X&&k&&typeof k.length=="number"){U&&(k=U);var P=0,W=function(){};return{s:W,n:function(){return P>=k.length?{done:!0}:{done:!1,value:k[P++]}},e:function(p){throw p},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 B=!0,O=!1,A;return{s:function(){U=k[Symbol.iterator]()},n:function(){var p=U.next();return B=p.done,p},e:function(p){O=!0,A=p},f:function(){try{!B&&U.return!=null&&U.return()}finally{if(O)throw A}}}}},rUJ1:function(bt,Se){const Q=/[&<>"']/,ue=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,X={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=_=>X[_];function P(_,C){if(C){if(Q.test(_))return _.replace(ue,U)}else if(J.test(_))return _.replace(k,U);return _}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(_){return _.replace(W,(C,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const O=/(^|[^\[])\^/g;function A(_,C){_=_.source||_,C=C||"";const E={replace:(c,u)=>(u=u.source||u,u=u.replace(O,"$1"),_=_.replace(c,u),E),getRegex:()=>new RegExp(_,C)};return E}const d=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(_,C,E){if(_){let c;try{c=decodeURIComponent(B(E)).replace(d,"").toLowerCase()}catch(u){return null}if(c.indexOf("javascript:")===0||c.indexOf("vbscript:")===0||c.indexOf("data:")===0)return null}C&&!p.test(E)&&(E=i(C,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(c){return null}return E}const m={},g=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(_,C){m[" "+_]||(g.test(_)?m[" "+_]=_+"/":m[" "+_]=v(_,"/",!0)),_=m[" "+_];const E=_.indexOf(":")===-1;return C.substring(0,2)==="//"?E?C:_.replace(b,"$1")+C:C.charAt(0)==="/"?E?C:_.replace(a,"$1")+C:_+C}const s={exec:function(){}};function l(_){let C=1,E,c;for(;C<arguments.length;C++){E=arguments[C];for(c in E)Object.prototype.hasOwnProperty.call(E,c)&&(_[c]=E[c])}return _}function S(_,C){const E=_.replace(/\|/g,(h,T,L)=>{let I=!1,F=T;for(;--F>=0&&L[F]==="\\";)I=!I;return I?"|":" |"}),c=E.split(/ \|/);let u=0;if(c.length>C)c.splice(C);else for(;c.length<C;)c.push("");for(;u<c.length;u++)c[u]=c[u].trim().replace(/\\\|/g,"|");return c}function v(_,C,E){const c=_.length;if(c===0)return"";let u=0;for(;u<c;){const h=_.charAt(c-u-1);if(h===C&&!E)u++;else if(h!==C&&E)u++;else break}return _.substr(0,c-u)}function y(_,C){if(_.indexOf(C[1])===-1)return-1;const E=_.length;let c=0,u=0;for(;u<E;u++)if(_[u]==="\\")u++;else if(_[u]===C[0])c++;else if(_[u]===C[1]&&(c--,c<0))return u;return-1}function R(_){_&&_.sanitize&&!_.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}bt.exports={escape:P,unescape:B,edit:A,cleanUrl:w,resolveUrl:i,noopTest:s,merge:l,splitCells:S,rtrim:v,findClosingBracket:y,checkSanitizeDeprecation:R}},ulZh:function(bt,Se,Q){typeof window!="undefined"&&function(J,k){bt.exports=k()}(this,function(){return function(ue){var J={};function k(X){if(J[X])return J[X].exports;var U=J[X]={i:X,l:!1,exports:{}};return ue[X].call(U.exports,U,U.exports,k),U.l=!0,U.exports}return k.m=ue,k.c=J,k.d=function(X,U,P){k.o(X,U)||Object.defineProperty(X,U,{enumerable:!0,get:P})},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 P=Object.create(null);if(k.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:X}),U&2&&typeof X!="string")for(var W in X)k.d(P,W,function(B){return X[B]}.bind(null,W));return P},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(ue,J,k){"use strict";var X=Object.prototype.hasOwnProperty,U="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(U=!1));function W(d,p,w){this.fn=d,this.context=p,this.once=w||!1}function B(d,p,w,m,g){if(typeof w!="function")throw new TypeError("The listener must be a function");var b=new W(w,m||d,g),a=U?U+p:p;return d._events[a]?d._events[a].fn?d._events[a]=[d._events[a],b]:d._events[a].push(b):(d._events[a]=b,d._eventsCount++),d}function O(d,p){--d._eventsCount===0?d._events=new P:delete d._events[p]}function A(){this._events=new P,this._eventsCount=0}A.prototype.eventNames=function(){var p=[],w,m;if(this._eventsCount===0)return p;for(m in w=this._events)X.call(w,m)&&p.push(U?m.slice(1):m);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(w)):p},A.prototype.listeners=function(p){var w=U?U+p:p,m=this._events[w];if(!m)return[];if(m.fn)return[m.fn];for(var g=0,b=m.length,a=new Array(b);g<b;g++)a[g]=m[g].fn;return a},A.prototype.listenerCount=function(p){var w=U?U+p:p,m=this._events[w];return m?m.fn?1:m.length:0},A.prototype.emit=function(p,w,m,g,b,a){var i=U?U+p:p;if(!this._events[i])return!1;var s=this._events[i],l=arguments.length,S,v;if(s.fn){s.once&&this.removeListener(p,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,w),!0;case 3:return s.fn.call(s.context,w,m),!0;case 4:return s.fn.call(s.context,w,m,g),!0;case 5:return s.fn.call(s.context,w,m,g,b),!0;case 6:return s.fn.call(s.context,w,m,g,b,a),!0}for(v=1,S=new Array(l-1);v<l;v++)S[v-1]=arguments[v];s.fn.apply(s.context,S)}else{var y=s.length,R;for(v=0;v<y;v++){s[v].once&&this.removeListener(p,s[v].fn,void 0,!0);switch(l){case 1:s[v].fn.call(s[v].context);break;case 2:s[v].fn.call(s[v].context,w);break;case 3:s[v].fn.call(s[v].context,w,m);break;case 4:s[v].fn.call(s[v].context,w,m,g);break;default:if(!S)for(R=1,S=new Array(l-1);R<l;R++)S[R-1]=arguments[R];s[v].fn.apply(s[v].context,S)}}}return!0},A.prototype.on=function(p,w,m){return B(this,p,w,m,!1)},A.prototype.once=function(p,w,m){return B(this,p,w,m,!0)},A.prototype.removeListener=function(p,w,m,g){var b=U?U+p:p;if(!this._events[b])return this;if(!w)return O(this,b),this;var a=this._events[b];if(a.fn)a.fn===w&&(!g||a.once)&&(!m||a.context===m)&&O(this,b);else{for(var i=0,s=[],l=a.length;i<l;i++)(a[i].fn!==w||g&&!a[i].once||m&&a[i].context!==m)&&s.push(a[i]);s.length?this._events[b]=s.length===1?s[0]:s:O(this,b)}return this},A.prototype.removeAllListeners=function(p){var w;return p?(w=U?U+p:p,this._events[w]&&O(this,w)):(this._events=new P,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=U,A.EventEmitter=A,ue.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,J,k){(function(X){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(A,d,p){if(p=p||{},A=A.trim(),d=d.trim(),!d){if(!p.alwaysNormalize)return A;var w=O.parseURL(A);if(!w)throw new Error("Error trying to parse base URL.");return w.path=O.normalizePath(w.path),O.buildURLFromParts(w)}var m=O.parseURL(d);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return p.alwaysNormalize?(m.path=O.normalizePath(m.path),O.buildURLFromParts(m)):d;var g=O.parseURL(A);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var b=P.exec(g.path);g.netLoc=b[1],g.path=b[2]}g.netLoc&&!g.path&&(g.path="/");var a={scheme:g.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(a.netLoc=g.netLoc,m.path[0]!=="/"))if(!m.path)a.path=g.path,m.params||(a.params=g.params,m.query||(a.query=g.query));else{var i=g.path,s=i.substring(0,i.lastIndexOf("/")+1)+m.path;a.path=O.normalizePath(s)}return a.path===null&&(a.path=p.alwaysNormalize?O.normalizePath(m.path):m.path),O.buildURLFromParts(a)},parseURL:function(A){var d=U.exec(A);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(W,"");A.length!==(A=A.replace(B,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};ue.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,J,k){function X(p){var w={};function m(b){if(w[b])return w[b].exports;var a=w[b]={i:b,l:!1,exports:{}};return p[b].call(a.exports,a,a.exports,m),a.l=!0,a.exports}m.m=p,m.c=w,m.i=function(b){return b},m.d=function(b,a,i){m.o(b,a)||Object.defineProperty(b,a,{configurable:!1,enumerable:!0,get:i})},m.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},m.n=function(b){var a=b&&b.__esModule?function(){return b.default}:function(){return b};return m.d(a,"a",a),a},m.o=function(b,a){return Object.prototype.hasOwnProperty.call(b,a)},m.p="/",m.oe=function(b){throw console.error(b),b};var g=m(m.s=ENTRY_MODULE);return g.default||g}var U="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function W(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(p){return!isNaN(1*p)}function O(p,w,m){var g={};g[m]=[];var b=w.toString(),a=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return g;for(var i=a[1],s=new RegExp("(\\\\n|\\W)"+W(i)+P,"g"),l;l=s.exec(b);){if(l[3]==="dll-reference")continue;g[m].push(l[3])}for(s=new RegExp("\\("+W(i)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+P,"g");l=s.exec(b);)p[l[2]]||(g[m].push(l[1]),p[l[2]]=k(l[1]).m),g[l[2]]=g[l[2]]||[],g[l[2]].push(l[4]);for(var S=Object.keys(g),v=0;v<S.length;v++)for(var y=0;y<g[S[v]].length;y++)B(g[S[v]][y])&&(g[S[v]][y]=1*g[S[v]][y]);return g}function A(p){var w=Object.keys(p);return w.reduce(function(m,g){return m||p[g].length>0},!1)}function d(p,w){for(var m={main:[w]},g={main:[]},b={main:{}};A(m);)for(var a=Object.keys(m),i=0;i<a.length;i++){var s=a[i],l=m[s],S=l.pop();if(b[s]=b[s]||{},b[s][S]||!p[s][S])continue;b[s][S]=!0,g[s]=g[s]||[],g[s].push(S);for(var v=O(p,p[s][S],s),y=Object.keys(v),R=0;R<y.length;R++)m[y[R]]=m[y[R]]||[],m[y[R]]=m[y[R]].concat(v[y[R]])}return g}ue.exports=function(p,w){w=w||{};var m={main:k.m},g=w.all?{main:Object.keys(m.main)}:d(m,p),b="";Object.keys(g).filter(function(S){return S!=="main"}).forEach(function(S){for(var v=0;g[S][v];)v++;g[S].push(v),m[S][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+S+" = ("+X.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+g[S].map(function(y){return""+JSON.stringify(y)+": "+m[S][y].toString()}).join(",")+`});
`}),b=b+"new (("+X.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+g.main.map(function(S){return""+JSON.stringify(S)+": "+m.main[S].toString()}).join(",")+"}))(self);";var a=new window.Blob([b],{type:"text/javascript"});if(w.bare)return a;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,s=i.createObjectURL(a),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"hlsDefaultConfig",function(){return R}),k.d(J,"mergeConfig",function(){return C}),k.d(J,"enableStreamingMode",function(){return E});var X=k("./src/controller/abr-controller.ts"),U=k("./src/controller/audio-stream-controller.ts"),P=k("./src/controller/audio-track-controller.ts"),W=k("./src/controller/subtitle-stream-controller.ts"),B=k("./src/controller/subtitle-track-controller.ts"),O=k("./src/controller/buffer-controller.ts"),A=k("./src/controller/timeline-controller.ts"),d=k("./src/controller/cap-level-controller.ts"),p=k("./src/controller/fps-controller.ts"),w=k("./src/controller/eme-controller.ts"),m=k("./src/controller/cmcd-controller.ts"),g=k("./src/utils/xhr-loader.ts"),b=k("./src/utils/fetch-loader.ts"),a=k("./src/utils/cues.ts"),i=k("./src/utils/mediakeys-helper.ts"),s=k("./src/utils/logger.ts");function l(){return l=Object.assign||function(c){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var T in h)Object.prototype.hasOwnProperty.call(h,T)&&(c[T]=h[T])}return c},l.apply(this,arguments)}function S(c,u){var h=Object.keys(c);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(c);u&&(T=T.filter(function(L){return Object.getOwnPropertyDescriptor(c,L).enumerable})),h.push.apply(h,T)}return h}function v(c){for(var u=1;u<arguments.length;u++){var h=arguments[u]!=null?arguments[u]:{};u%2?S(Object(h),!0).forEach(function(T){y(c,T,h[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(h)):S(Object(h)).forEach(function(T){Object.defineProperty(c,T,Object.getOwnPropertyDescriptor(h,T))})}return c}function y(c,u,h){return u in c?Object.defineProperty(c,u,{value:h,enumerable:!0,configurable:!0,writable:!0}):c[u]=h,c}var R=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:g.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:X.default,bufferController:O.default,capLevelController:d.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},_()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:B.default,timelineController:A.TimelineController,audioStreamController:U.default,audioTrackController:P.default,emeController:w.default,cmcdController:m.default});function _(){return{cueHandler:a.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function C(c,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},c,u)}function E(c){var u=c.loader;if(u!==b.default&&u!==g.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),c.progressive=!1;else{var h=Object(b.fetchSupported)();h&&(c.loader=b.default,c.progressive=!0,c.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/polyfills/number.ts"),U=k("./src/utils/ewma-bandwidth-estimator.ts"),P=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/errors.ts"),O=k("./src/types/loader.ts"),A=k("./src/utils/logger.ts");function d(m,g){for(var b=0;b<g.length;b++){var a=g[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(m,a.key,a)}}function p(m,g,b){return g&&d(m.prototype,g),b&&d(m,b),m}var w=function(){function m(b){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=b;var a=b.config;this.bwEstimator=new U.default(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate),this.registerListeners()}var g=m.prototype;return g.registerListeners=function(){var a=this.hls;a.on(P.Events.FRAG_LOADING,this.onFragLoading,this),a.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(P.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var a=this.hls;a.off(P.Events.FRAG_LOADING,this.onFragLoading,this),a.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(P.Events.ERROR,this.onError,this)},g.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},g.onFragLoading=function(a,i){var s=i.frag;if(s.type===O.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=i.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},g.onLevelLoaded=function(a,i){var s=this.hls.config;i.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},g._abandonRulesCheck=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,S=s.config,v=s.media;if(!a||!v)return;var y=i?i.stats:a.stats,R=i?i.duration:a.duration;if(y.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||v.paused||!v.playbackRate||!v.readyState)return;var _=performance.now()-y.loading.start,C=Math.abs(v.playbackRate);if(_<=500*R/C)return;var E=s.levels,c=s.minAutoLevel,u=E[a.level],h=y.total||Math.max(y.loaded,Math.round(R*u.maxBitrate/8)),T=Math.max(1,y.bwEstimate?y.bwEstimate/8:y.loaded*1e3/_),L=(h-y.loaded)/T,I=v.currentTime,F=(W.BufferHelper.bufferInfo(v,I,S.maxBufferHole).end-I)/C;if(F>=2*R/C||L<=F)return;var j=Number.POSITIVE_INFINITY,z;for(z=a.level-1;z>c;z--){var M=E[z].maxBitrate;if(j=R*M/(8*.8*T),j<F)break}if(j>=L)return;var N=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+a.sn+(i?" part "+i.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
Current BW estimate: `+(Object(X.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+L.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=z,this.bwEstimator.sample(_,y.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:i,stats:y})},g.onFragLoaded=function(a,i){var s=i.frag,l=i.part;if(s.type===O.PlaylistLevelType.MAIN&&Object(X.isFiniteNumber)(s.sn)){var S=l?l.stats:s.stats,v=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var y=this.hls.levels[s.level],R=(y.loaded?y.loaded.bytes:0)+S.loaded,_=(y.loaded?y.loaded.duration:0)+v;y.loaded={bytes:R,duration:_},y.realBitrate=Math.round(8*R/_)}if(s.bitrateTest){var C={stats:S,frag:s,part:l,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,C),s.bitrateTest=!1}}},g.onFragBuffered=function(a,i){var s=i.frag,l=i.part,S=l?l.stats:s.stats;if(S.aborted)return;if(s.type!==O.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var v=S.parsing.end-S.loading.start;this.bwEstimator.sample(v,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},g.onError=function(a,i){switch(i.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},g.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},g.getNextABRAutoLevel=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.maxAutoLevel,S=s.config,v=s.minAutoLevel,y=s.media,R=i?i.duration:a?a.duration:0,_=y?y.currentTime:0,C=y&&y.playbackRate!==0?Math.abs(y.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,c=(W.BufferHelper.bufferInfo(y,_,S.maxBufferHole).end-_)/C,u=this.findBestLevel(E,v,l,c,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(u>=0)return u;A.logger.trace((c?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var h=R?Math.min(R,S.maxStarvationDelay):S.maxStarvationDelay,T=S.abrBandWidthFactor,L=S.abrBandWidthUpFactor;if(!c){var I=this.bitrateTestDelay;if(I){var F=R?Math.min(R,S.maxLoadingDelay):S.maxLoadingDelay;h=F-I,A.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),T=L=1}}return u=this.findBestLevel(E,v,l,c+h,T,L),Math.max(u,0)},g.findBestLevel=function(a,i,s,l,S,v){for(var y,R=this.fragCurrent,_=this.partCurrent,C=this.lastLoadedFragLevel,E=this.hls.levels,c=E[C],u=!!(c!=null&&(y=c.details)!==null&&y!==void 0&&y.live),h=c==null?void 0:c.codecSet,T=_?_.duration:R?R.duration:0,L=s;L>=i;L--){var I=E[L];if(!I||h&&I.codecSet!==h)continue;var F=I.details,j=(_?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||T,z=void 0;L<=C?z=S*a:z=v*a;var M=E[L].maxBitrate,N=M*j/z;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+L+"/"+Math.round(z)+"/"+M+"/"+j+"/"+l+"/"+N),z>M&&(!N||u&&!this.bitrateTestDelay||N<l))return L}return-1},p(m,[{key:"nextAutoLevel",get:function(){var a=this._nextAutoLevel,i=this.bwEstimator;if(a!==-1&&(!i||!i.canEstimate()))return a;var s=this.getNextABRAutoLevel();return a!==-1&&(s=Math.min(a,s)),s},set:function(a){this._nextAutoLevel=a}}]),m}();J.default=w},"./src/controller/audio-stream-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/polyfills/number.ts"),U=k("./src/controller/base-stream-controller.ts"),P=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/controller/fragment-tracker.ts"),O=k("./src/types/level.ts"),A=k("./src/types/loader.ts"),d=k("./src/loader/fragment.ts"),p=k("./src/demux/chunk-cache.ts"),w=k("./src/demux/transmuxer-interface.ts"),m=k("./src/types/transmuxer.ts"),g=k("./src/controller/fragment-finders.ts"),b=k("./src/utils/discontinuities.ts"),a=k("./src/errors.ts"),i=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(R){for(var _=1;_<arguments.length;_++){var C=arguments[_];for(var E in C)Object.prototype.hasOwnProperty.call(C,E)&&(R[E]=C[E])}return R},s.apply(this,arguments)}function l(R,_){R.prototype=Object.create(_.prototype),R.prototype.constructor=R,S(R,_)}function S(R,_){return S=Object.setPrototypeOf||function(E,c){return E.__proto__=c,E},S(R,_)}var v=100,y=function(R){l(_,R);function _(E,c){var u;return u=R.call(this,E,c,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var C=_.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var c=this.hls;c.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(P.Events.ERROR,this.onError,this),c.on(P.Events.BUFFER_RESET,this.onBufferReset,this),c.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var c=this.hls;c.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(P.Events.ERROR,this.onError,this),c.off(P.Events.BUFFER_RESET,this.onBufferReset,this),c.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onInitPtsFound=function(c,u){var h=u.frag,T=u.id,L=u.initPTS;if(T==="main"){var I=h.cc;this.initPTS[h.cc]=L,this.log("InitPTS for cc: "+I+" found from main: "+L),this.videoTrackCC=I,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},C.startLoad=function(c){if(!this.levels){this.startPosition=c,this.state=U.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,u>0&&c===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()},C.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var c,u=this.levels,h=this.trackId,T=u==null||((c=u[h])===null||c===void 0)?void 0:c.details;if(T){if(this.waitForCdnTuneIn(T))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var L,I=performance.now(),F=this.retryDate;(!F||I>=F||(L=this.media)!==null&&L!==void 0&&L.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 z=j.frag,M=j.part,N=j.cache,Y=j.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ee=N.flush(),le={frag:z,part:M,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(le),Y&&R.prototype._handleFragmentLoadComplete.call(this,le)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var pe=this.getLoadPosition(),Oe=W.BufferHelper.bufferInfo(this.mediaBuffer,pe,this.config.maxBufferHole),Te=Object(g.fragmentWithinToleranceTest)(Oe.end,this.config.maxFragLookUpTolerance,z);Te<0&&(i.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+Oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},C.clearWaitingFragment=function(){var c=this.waitingData;c&&(this.fragmentTracker.removeFragment(c.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},C.onTickEnd=function(){var c=this.media;if(!c||!c.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:c,h=u.buffered;!this.loadedmetadata&&h.length&&(this.loadedmetadata=!0),this.lastCurrentTime=c.currentTime},C.doTickIdle=function(){var c,u,h=this.hls,T=this.levels,L=this.media,I=this.trackId,F=h.config;if(!T||!T[I])return;if(!L&&(this.startFragRequested||!F.startFragPrefetch))return;var j=T[I],z=j.details;if(!z||z.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(z)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(M===null)return;var N=M.len,Y=this.getMaxBufferLength(),ee=this.audioSwitch;if(N>=Y&&!ee)return;if(!ee&&this._streamEnded(M,z)){h.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var le=z.fragments,pe=le[0].start,Oe=M.end;if(ee){var Te=this.getLoadPosition();Oe=Te,z.PTSKnown&&Te<pe&&((M.end>pe||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),L.currentTime=pe+.05))}var Re=this.getNextFragment(Oe,z);if(!Re){this.bufferFlushed=!0;return}((c=Re.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=Re.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Re,z):this.loadFragment(Re,z,Oe)},C.getMaxBufferLength=function(){var c=R.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return u===null?c:Math.max(c,u.len)},C.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},C.onAudioTracksUpdated=function(c,u){var h=u.audioTracks;this.resetTransmuxer(),this.levels=h.map(function(T){return new O.Level(T)})},C.onAudioTrackSwitching=function(c,u){var h=!!u.url;this.trackId=u.id;var T=this.fragCurrent;T!=null&&T.loader&&T.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),h?this.setInterval(v):this.resetTransmuxer(),h?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},C.onLevelLoaded=function(c,u){this.mainDetails=u.details},C.onAudioTrackLoaded=function(c,u){var h,T=this.levels,L=u.details,I=u.id;if(!T){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+L.startSN+","+L.endSN+"],duration:"+L.totalduration);var F=T[I],j=0;if(L.live||(h=F.details)!==null&&h!==void 0&&h.live){var z=this.mainDetails;if(L.fragments[0]||(L.deltaUpdateFailed=!0),L.deltaUpdateFailed||!z)return;!F.details&&L.hasProgramDateTime&&z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(L,z),j=L.fragments[0].start):j=this.alignPlaylists(L,F.details)}F.details=L,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!L.live)&&this.setStartPosition(F.details,j),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(L)&&(this.state=U.State.IDLE),this.tick()},C._handleFragmentLoadProgress=function(c){var u,h=c.frag,T=c.part,L=c.payload,I=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var z=j[F];console.assert(z,"Audio track is defined on fragment load progress");var M=z.details;console.assert(M,"Audio track details are defined on fragment load progress");var N=I.defaultAudioCodec||z.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new w.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[h.cc],le=(u=h.initSegment)===null||u===void 0?void 0:u.data;if(ee!==void 0){var pe=!1,Oe=T?T.index:-1,Te=Oe!==-1,Re=new m.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,L.byteLength,Oe,Te);Y.push(L,le,N,"",h,T,M.totalduration,pe,Re,ee)}else{i.logger.log("Unknown video PTS for cc "+h.cc+", waiting for video PTS before demuxing audio frag "+h.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+F);var Ae=this.waitingData=this.waitingData||{frag:h,part:T,cache:new p.default,complete:!1},we=Ae.cache;we.push(new Uint8Array(L)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},C._handleFragmentLoadComplete=function(c){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,c)},C.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},C.onBufferCreated=function(c,u){var h=u.tracks.audio;h&&(this.mediaBuffer=h.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},C.onFragBuffered=function(c,u){var h=u.frag,T=u.part;if(h.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(T?" p: "+T.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}h.sn!=="initSegment"&&(this.fragPrevious=h,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(h,T)},C.onError=function(c,u){switch(u.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,u);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=u.fatal?U.State.ERROR:U.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var h=!0,T=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);T&&T.len>.5&&(h=!this.reduceMaxBufferLength(T.len)),h&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},C.onBufferFlushed=function(c,u){var h=u.type;h===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},C._handleTransmuxComplete=function(c){var u,h="audio",T=this.hls,L=c.remuxResult,I=c.chunkMeta,F=this.getCurrentContext(I);if(!F){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var j=F.frag,z=F.part,M=L.audio,N=L.text,Y=L.id3,ee=L.initSegment;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,j,I),T.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:h,tracks:ee.tracks})),M){var le=M.startPTS,pe=M.endPTS,Oe=M.startDTS,Te=M.endDTS;z&&(z.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:pe,startDTS:Oe,endDTS:Te}),j.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,le,pe,Oe,Te),this.bufferFragmentData(M,j,z,I)}if(Y!=null&&(u=Y.samples)!==null&&u!==void 0&&u.length){var Re=s({frag:j,id:h},Y);T.trigger(P.Events.FRAG_PARSING_METADATA,Re)}if(N){var Ae=s({frag:j,id:h},N);T.trigger(P.Events.FRAG_PARSING_USERDATA,Ae)}},C._bufferInitSegment=function(c,u,h){if(this.state!==U.State.PARSING)return;c.video&&delete c.video;var T=c.audio;if(!T)return;T.levelCodec=T.codec,T.id="audio",this.log("Init audio buffer, container:"+T.container+", codecs[parsed]=["+T.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,c);var L=T.initSegment;if(L!=null&&L.byteLength){var I={type:"audio",frag:u,part:null,chunkMeta:h,parent:u.type,data:L};this.hls.trigger(P.Events.BUFFER_APPENDING,I)}this.tick()},C.loadFragment=function(c,u,h){var T=this.fragmentTracker.getState(c);this.fragCurrent=c,(this.audioSwitch||T===B.FragmentState.NOT_LOADED||T===B.FragmentState.PARTIAL)&&(c.sn==="initSegment"?this._loadInitSegment(c):u.live&&!Object(X.isFiniteNumber)(this.initPTS[c.cc])?(this.log("Waiting for video PTS in continuity counter "+c.cc+" of live stream before loading audio fragment "+c.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,c,u,h)))},C.completeAudioSwitch=function(){var c=this.hls,u=this.media,h=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,c.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:h})},_}(U.default);J.default=y},"./src/controller/audio-track-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/events.ts"),U=k("./src/errors.ts"),P=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function B(w,m){for(var g=0;g<m.length;g++){var b=m[g];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(w,b.key,b)}}function O(w,m,g){return m&&B(w.prototype,m),g&&B(w,g),w}function A(w,m){w.prototype=Object.create(m.prototype),w.prototype.constructor=w,d(w,m)}function d(w,m){return d=Object.setPrototypeOf||function(b,a){return b.__proto__=a,b},d(w,m)}var p=function(w){A(m,w);function m(b){var a;return a=w.call(this,b,"[audio-track-controller]")||this,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.trackName="",a.selectDefaultTrack=!0,a.registerListeners(),a}var g=m.prototype;return g.registerListeners=function(){var a=this.hls;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.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(X.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var a=this.hls;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.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(X.Events.ERROR,this.onError,this)},g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,w.prototype.destroy.call(this)},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},g.onManifestParsed=function(a,i){this.tracks=i.audioTracks||[]},g.onAudioTrackLoaded=function(a,i){var s=i.id,l=i.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var v=S.details;S.details=i.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,i,v))},g.onLevelLoading=function(a,i){this.switchLevel(i.level)},g.onLevelSwitching=function(a,i){this.switchLevel(i.level)},g.switchLevel=function(a){var i=this.hls.levels[a];if(!(i!=null&&i.audioGroupIds))return;var s=i.audioGroupIds[i.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(v){return!s||v.groupId===s});this.selectDefaultTrack&&!l.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var S={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(X.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},g.onError=function(a,i){if(w.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===W.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},g.setAudioTrack=function(a){var i=this.tracksInGroup;if(a<0||a>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=i[this.trackId];this.log("Now switching to audio-track index "+a);var l=i[a],S=l.id,v=l.groupId,y=v===void 0?"":v,R=l.name,_=l.type,C=l.url;if(this.trackId=a,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger(X.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:y,name:R,type:_,url:C}),l.details&&!l.details.live)return;var E=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(E)},g.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,s=this.findTrackId(i)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},g.findTrackId=function(a){for(var i=this.tracksInGroup,s=0;s<i.length;s++){var l=i[s];if((!this.selectDefaultTrack||l.default)&&(!a||a===l.name))return l.id}return-1},g.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var s=i.id,l=i.groupId,S=i.url;if(a)try{S=a.addDirectives(S)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(X.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:l,deliveryDirectives:a||null})}},O(m,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}}]),m}(P.default);J.default=p},"./src/controller/base-playlist-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return O});var X=k("./src/polyfills/number.ts"),U=k("./src/types/level.ts"),P=k("./src/controller/level-helper.ts"),W=k("./src/utils/logger.ts"),B=k("./src/errors.ts"),O=function(){function A(p,w){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,w+":"),this.warn=W.logger.warn.bind(W.logger,w+":"),this.hls=p}var d=A.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(w,m){m.fatal&&m.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},d.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},d.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},d.stopLoad=function(){this.canLoad=!1,this.clearTimer()},d.switchParams=function(w,m){var g=m==null?void 0:m.renditionReports;if(g)for(var b=0;b<g.length;b++){var a=g[b],i=""+a.URI;if(i===w.substr(-i.length)){var s=parseInt(a["LAST-MSN"]),l=parseInt(a["LAST-PART"]);if(m&&this.hls.config.lowLatencyMode){var S=Math.min(m.age-m.partTarget,m.targetduration);l!==void 0&&S>m.partTarget&&(l+=1)}if(Object(X.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(X.isFiniteNumber)(l)?l:void 0,U.HlsSkip.No)}}},d.loadPlaylist=function(w){},d.shouldLoadTrack=function(w){return this.canLoad&&w&&!!w.url&&(!w.details||w.details.live)},d.playlistLoaded=function(w,m,g){var b=this,a=m.details,i=m.stats,s=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(a.advancedDateTime=Date.now()-s,a.live||g!=null&&g.live){if(a.reloaded(g),g&&this.log("live playlist "+w+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),g&&a.fragments.length>0&&Object(P.mergeDetails)(g,a),!this.canLoad||!a.live)return;var l,S=void 0,v=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var y=this.hls.config.lowLatencyMode,R=a.lastPartSn,_=a.endSN,C=a.lastPartIndex,E=C!==-1,c=R===_,u=y?0:C;E?(S=c?_+1:R,v=c?u:C+1):S=_+1;var h=a.age,T=h+a.ageHeader,L=Math.min(T-a.partTarget,a.targetduration*1.5);if(L>0){if(g&&L>g.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+g.tuneInGoal+" to: "+L+" with playlist age: "+a.age),L=0;else{var I=Math.floor(L/a.targetduration);if(S+=I,v!==void 0){var F=Math.round(L%a.targetduration/a.partTarget);v+=F}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+h.toFixed(2)+"s goal: "+L+" skip sn "+I+" to part "+v)}a.tuneInGoal=L}if(l=this.getDeliveryDirectives(a,m.deliveryDirectives,S,v),y||!c){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(a,m.deliveryDirectives,S,v);var j=Object(P.computeReloadInterval)(a,i);S!==void 0&&a.canBlockReload&&(j-=a.partTarget||1),this.log("reload live playlist "+w+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(l)},j)}else this.clearTimer()},d.getDeliveryDirectives=function(w,m,g,b){var a=Object(U.getSkipValue)(w,g);return m!=null&&m.skip&&w.deltaUpdateFailed&&(g=m.msn,b=m.part,a=U.HlsSkip.No),new U.HlsUrlParameters(g,b,a)},d.retryLoadingOrFail=function(w){var m=this,g=this.hls.config,b=this.retryCount<g.levelLoadingMaxRetry;if(b){var a;if(this.retryCount++,w.details.indexOf("LoadTimeOut")>-1&&(a=w.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+w.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*g.levelLoadingRetryDelay,g.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return m.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+w.details+'"')}}else this.warn('cannot recover from error "'+w.details+'"'),this.clearTimer(),w.fatal=!0;return b},A}()},"./src/controller/base-stream-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"State",function(){return _}),k.d(J,"default",function(){return C});var X=k("./src/polyfills/number.ts"),U=k("./src/task-loop.ts"),P=k("./src/controller/fragment-tracker.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/utils/logger.ts"),O=k("./src/events.ts"),A=k("./src/errors.ts"),d=k("./src/types/transmuxer.ts"),p=k("./src/utils/mp4-tools.ts"),w=k("./src/utils/discontinuities.ts"),m=k("./src/controller/fragment-finders.ts"),g=k("./src/controller/level-helper.ts"),b=k("./src/loader/fragment-loader.ts"),a=k("./src/crypt/decrypter.ts"),i=k("./src/utils/time-ranges.ts"),s=k("./src/types/loader.ts");function l(E,c){for(var u=0;u<c.length;u++){var h=c[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(E,h.key,h)}}function S(E,c,u){return c&&l(E.prototype,c),u&&l(E,u),E}function v(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function y(E,c){E.prototype=Object.create(c.prototype),E.prototype.constructor=E,R(E,c)}function R(E,c){return R=Object.setPrototypeOf||function(h,T){return h.__proto__=T,h},R(E,c)}var _={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},C=function(E){y(c,E);function c(h,T,L){var I;return I=E.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=_.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=L,I.log=B.logger.log.bind(B.logger,L+":"),I.warn=B.logger.warn.bind(B.logger,L+":"),I.hls=h,I.fragmentLoader=new b.default(h.config),I.fragmentTracker=T,I.config=h.config,I.decrypter=new a.default(h,h.config),h.on(O.Events.KEY_LOADED,I.onKeyLoaded,v(I)),I}var u=c.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(T){},u.stopLoad=function(){this.fragmentLoader.abort();var T=this.fragCurrent;T&&this.fragmentTracker.removeFragment(T),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_.STOPPED},u._streamEnded=function(T,L){var I=this.fragCurrent,F=this.fragmentTracker;if(!L.live&&I&&I.sn===L.endSN&&!T.nextStart){var j=F.getState(I);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},u.onMediaAttached=function(T,L){var I=this.media=this.mediaBuffer=L.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===_.STOPPED&&this.startLoad(F.startPosition)},u.onMediaDetaching=function(){var T=this.media;T!=null&&T.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),T&&(T.removeEventListener("seeking",this.onvseeking),T.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var T=this.config,L=this.fragCurrent,I=this.media,F=this.mediaBuffer,j=this.state,z=I?I.currentTime:0,M=W.BufferHelper.bufferInfo(F||I,z,T.maxBufferHole);if(this.log("media seeking to "+(Object(X.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+j),j===_.ENDED)this.resetLoadingState();else if(L&&!M.len){var N=T.maxFragLookUpTolerance,Y=L.start-N,ee=L.start+L.duration+N,le=z>ee;(z<Y||le)&&(le&&L.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),L.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=z),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(T,L){if(this.state!==_.KEY_LOADING||L.frag!==this.fragCurrent||!this.levels)return;this.state=_.IDLE;var I=this.levels[L.frag.level].details;I&&this.loadFragment(L.frag,I,L.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=_.STOPPED,this.hls.off(O.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,E.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(T,L){this.log("Loading key for "+T.sn+" of ["+L.startSN+"-"+L.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+T.level),this.state=_.KEY_LOADING,this.fragCurrent=T,this.hls.trigger(O.Events.KEY_LOADING,{frag:T})},u.loadFragment=function(T,L,I){this._loadFragForPlayback(T,L,I)},u._loadFragForPlayback=function(T,L,I){var F=this,j=function(M){if(F.fragContextChanged(T)){F.warn("Fragment "+T.sn+(M.part?" p: "+M.part.index:"")+" of level "+T.level+" was dropped during download."),F.fragmentTracker.removeFragment(T);return}T.stats.chunkCount++,F._handleFragmentLoadProgress(M)};this._doFragLoad(T,L,I,j).then(function(z){if(!z)return;F.fragLoadError=0;var M=F.state;if(F.fragContextChanged(T)){(M===_.FRAG_LOADING||M===_.BACKTRACKING||!F.fragCurrent&&M===_.PARSING)&&(F.fragmentTracker.removeFragment(T),F.state=_.IDLE);return}if("payload"in z&&(F.log("Loaded fragment "+T.sn+" of level "+T.level),F.hls.trigger(O.Events.FRAG_LOADED,z),F.state===_.BACKTRACKING)){F.fragmentTracker.backtrack(T,z),F.resetFragmentLoading(T);return}F._handleFragmentLoadComplete(z)}).catch(function(z){F.warn(z),F.resetFragmentLoading(T)})},u.flushMainBuffer=function(T,L,I){if(I===void 0&&(I=null),!(T-L))return;var F={startOffset:T,endOffset:L,type:I};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,F)},u._loadInitSegment=function(T){var L=this;this._doFragLoad(T).then(function(I){if(!I||L.fragContextChanged(T)||!L.levels)throw new Error("init load aborted");return I}).then(function(I){var F=L.hls,j=I.payload,z=T.decryptdata;if(j&&j.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var M=self.performance.now();return L.decrypter.webCryptoDecrypt(new Uint8Array(j),z.key.buffer,z.iv.buffer).then(function(N){var Y=self.performance.now();return F.trigger(O.Events.FRAG_DECRYPTED,{frag:T,payload:N,stats:{tstart:M,tdecrypt:Y}}),I.payload=N,I})}return I}).then(function(I){var F=L.fragCurrent,j=L.hls,z=L.levels;if(!z)throw new Error("init load aborted, missing levels");var M=z[T.level].details;console.assert(M,"Level details are defined when init segment is loaded");var N=T.stats;L.state=_.IDLE,L.fragLoadError=0,T.data=new Uint8Array(I.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),I.frag===F&&j.trigger(O.Events.FRAG_BUFFERED,{stats:N,frag:F,part:null,id:T.type}),L.tick()}).catch(function(I){L.warn(I),L.resetFragmentLoading(T)})},u.fragContextChanged=function(T){var L=this.fragCurrent;return!T||!L||T.level!==L.level||T.sn!==L.sn||T.urlId!==L.urlId},u.fragBufferedComplete=function(T,L){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+T.type+" sn: "+T.sn+(L?" part: "+L.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+T.level+" "+i.default.toString(W.BufferHelper.getBuffered(I))),this.state=_.IDLE,this.tick()},u._handleFragmentLoadComplete=function(T){var L=this.transmuxer;if(!L)return;var I=T.frag,F=T.part,j=T.partsLoaded,z=!j||j.length===0||j.some(function(N){return!N}),M=new d.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,F?F.index:-1,!z);L.flush(M)},u._handleFragmentLoadProgress=function(T){},u._doFragLoad=function(T,L,I,F){var j=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(T.start,I||0),this.config.lowLatencyMode&&L){var z=L.partList;if(z&&F){I>T.end&&L.fragmentHint&&(T=L.fragmentHint);var M=this.getNextPart(z,T,I);if(M>-1){var N=z[M];return this.log("Loading part sn: "+T.sn+" p: "+N.index+" cc: "+T.cc+" of playlist ["+L.startSN+"-"+L.endSN+"] parts [0-"+M+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+T.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=_.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:T,part:z[M],targetBufferTime:I}),this.doFragPartsLoad(T,z,M,F).catch(function(Y){return j.handleFragLoadError(Y)})}else if(!T.url||this.loadedEndOfParts(z,I))return Promise.resolve(null)}}return this.log("Loading fragment "+T.sn+" cc: "+T.cc+" "+(L?"of ["+L.startSN+"-"+L.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+T.level+", target: "+parseFloat(I.toFixed(3))),Object(X.isFiniteNumber)(T.sn)&&!this.bitrateTest&&(this.nextLoadPosition=T.start+T.duration),this.state=_.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:T,targetBufferTime:I}),this.fragmentLoader.load(T,F).catch(function(Y){return j.handleFragLoadError(Y)})},u.doFragPartsLoad=function(T,L,I,F){var j=this;return new Promise(function(z,M){var N=[],Y=function ee(le){var pe=L[le];j.fragmentLoader.loadPart(T,pe,F).then(function(Oe){N[pe.index]=Oe;var Te=Oe.part;j.hls.trigger(O.Events.FRAG_LOADED,Oe);var Re=L[le+1];if(Re&&Re.fragment===T)ee(le+1);else return z({frag:T,part:Te,partsLoaded:N})}).catch(M)};Y(I)})},u.handleFragLoadError=function(T){var L=T.data;return L&&L.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(L.frag,L.part):this.hls.trigger(O.Events.ERROR,L),null},u._handleTransmuxerFlush=function(T){var L=this.getCurrentContext(T);if(!L||this.state!==_.PARSING){this.fragCurrent||(this.state=_.IDLE);return}var I=L.frag,F=L.part,j=L.level,z=self.performance.now();I.stats.parsing.end=z,F&&(F.stats.parsing.end=z),this.updateLevelTiming(I,F,j,T.partial)},u.getCurrentContext=function(T){var L=this.levels,I=T.level,F=T.sn,j=T.part;if(!L||!L[I])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+I+". The current chunk will not be buffered."),null;var z=L[I],M=j>-1?Object(g.getPartWith)(z,F,j):null,N=M?M.fragment:Object(g.getFragmentWithSN)(z,F,this.fragCurrent);return N?{frag:N,part:M,level:z}:null},u.bufferFragmentData=function(T,L,I,F){if(!T||this.state!==_.PARSING)return;var j=T.data1,z=T.data2,M=j;if(j&&z&&(M=Object(p.appendUint8Array)(j,z)),!M||!M.length)return;var N={type:T.type,frag:L,part:I,chunkMeta:F,parent:L.type,data:M};this.hls.trigger(O.Events.BUFFER_APPENDING,N),T.dropped&&T.independent&&!I&&this.flushBufferGap(L)},u.flushBufferGap=function(T){var L=this.media;if(!L)return;if(!W.BufferHelper.isBuffered(L,L.currentTime)){this.flushMainBuffer(0,T.start);return}var I=L.currentTime,F=W.BufferHelper.bufferInfo(L,I,0),j=T.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),M=Math.max(Math.min(T.start-z,F.end-z),I+z);T.start-M>z&&this.flushMainBuffer(M,T.start)},u.getFwdBufferInfo=function(T,L){var I=this.config,F=this.getLoadPosition();if(!Object(X.isFiniteNumber)(F))return null;var j=W.BufferHelper.bufferInfo(T,F,I.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(F,L);if(z&&j.nextStart<z.end)return W.BufferHelper.bufferInfo(T,F,Math.max(j.nextStart,I.maxBufferHole))}return j},u.getMaxBufferLength=function(T){var L=this.config,I;return T?I=Math.max(8*L.maxBufferSize/T,L.maxBufferLength):I=L.maxBufferLength,Math.min(I,L.maxMaxBufferLength)},u.reduceMaxBufferLength=function(T){var L=this.config,I=T||L.maxBufferLength;return L.maxMaxBufferLength>=I?(L.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+L.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(T,L){var I,F,j=L.fragments,z=j.length;if(!z)return null;var M=this.config,N=j[0].start,Y;if(L.live){var ee=M.initialLiveManifestSize;if(z<ee)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+ee+")"),null;!L.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(L,j),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:T)}else T<=N&&(Y=j[0]);if(!Y){var le=M.lowLatencyMode?L.partEnd:L.fragmentEnd;Y=this.getFragmentAtPosition(T,le,L)}return(I=Y)!==null&&I!==void 0&&I.initSegment&&!((F=Y)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},u.getNextPart=function(T,L,I){for(var F=-1,j=!1,z=!0,M=0,N=T.length;M<N;M++){var Y=T[M];if(z=z&&!Y.independent,F>-1&&I<Y.start)break;var ee=Y.loaded;!ee&&(j||Y.independent||z)&&Y.fragment===L&&(F=M),j=ee}return F},u.loadedEndOfParts=function(T,L){var I=T[T.length-1];return I&&L>I.start&&I.loaded},u.getInitialLiveFragment=function(T,L){var I=this.fragPrevious,F=null;if(I){if(T.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),F=Object(m.findFragmentByPDT)(L,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=I.sn+1;if(j>=T.startSN&&j<=T.endSN){var z=L[j-T.startSN];I.cc===z.cc&&(F=z,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(m.findFragWithCC)(L,I.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(F=this.getFragmentAtPosition(M,this.bitrateTest?T.fragmentEnd:T.edge,T))}return F},u.getFragmentAtPosition=function(T,L,I){var F=this.config,j=this.fragPrevious,z=I.fragments,M=I.endSN,N=I.fragmentHint,Y=F.maxFragLookUpTolerance,ee=!!(F.lowLatencyMode&&I.partList&&N);ee&&N&&!this.bitrateTest&&(z=z.concat(N),M=N.sn);var le;if(T<L){var pe=T>L-Y?0:Y;le=Object(m.findFragmentByPTS)(j,z,T,pe)}else le=z[z.length-1];if(le){var Oe=le.sn-I.startSN,Te=j&&le.level===j.level,Re=z[Oe+1],Ae=this.fragmentTracker.getState(le);if(Ae===P.FragmentState.BACKTRACKED){le=null;for(var we=Oe;z[we]&&this.fragmentTracker.getState(z[we])===P.FragmentState.BACKTRACKED;)j?le=z[we--]:le=z[--we];le||(le=Re)}else j&&le.sn===j.sn&&!ee&&(Te&&(le.sn<M&&this.fragmentTracker.getState(Re)!==P.FragmentState.OK?(this.log("SN "+le.sn+" just loaded, load next one: "+Re.sn),le=Re):le=null))}return le},u.synchronizeToLiveEdge=function(T){var L=this.config,I=this.media;if(!I)return;var F=this.hls.liveSyncPosition,j=I.currentTime,z=T.fragments[0].start,M=T.edge,N=j>=z-L.maxFragLookUpTolerance&&j<=M;if(F!==null&&I.duration>F&&(j<F||!N)){var Y=L.liveMaxLatencyDuration!==void 0?L.liveMaxLatencyDuration:L.liveMaxLatencyDurationCount*T.targetduration;(!N&&I.readyState<4||j<M-Y)&&(this.loadedmetadata||(this.nextLoadPosition=F),I.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+F.toFixed(3)),I.currentTime=F))}},u.alignPlaylists=function(T,L){var I=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,z=F!==null?I[F]:null,M=T.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var N=T.fragments[0].start,Y=!L,ee=T.alignedSliding&&Object(X.isFiniteNumber)(N);if(Y||!ee&&!N){Object(w.alignStream)(j,z,T);var le=T.fragments[0].start;return this.log("Live playlist sliding: "+le.toFixed(2)+" start-sn: "+(L?L.startSN:"na")+"->"+T.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+M),le}return N},u.waitForCdnTuneIn=function(T){var L=3;return T.live&&T.canBlockReload&&T.tuneInGoal>Math.max(T.partHoldBack,T.partTarget*L)},u.setStartPosition=function(T,L){var I=this.startPosition;if(I<L&&(I=-1),I===-1||this.lastCurrentTime===-1){var F=T.startTimeOffset;Object(X.isFiniteNumber)(F)?(I=L+F,F<0&&(I+=T.totalduration),I=Math.min(Math.max(L,I),L+T.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+I),this.startPosition=I):T.live?I=this.hls.liveSyncPosition||L:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},u.getLoadPosition=function(){var T=this.media,L=0;return this.loadedmetadata&&T?L=T.currentTime:this.nextLoadPosition&&(L=this.nextLoadPosition),L},u.handleFragLoadAborted=function(T,L){this.transmuxer&&T.sn!=="initSegment"&&T.stats.aborted&&(this.warn("Fragment "+T.sn+(L?" part"+L.index:"")+" of level "+T.level+" was aborted"),this.resetFragmentLoading(T))},u.resetFragmentLoading=function(T){(!this.fragCurrent||!this.fragContextChanged(T))&&(this.state=_.IDLE)},u.onFragmentOrKeyLoadError=function(T,L){if(L.fatal)return;var I=L.frag;if(!I||I.type!==T)return;var F=this.fragCurrent;console.assert(F&&I.sn===F.sn&&I.level===F.level&&I.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+T+" "+I.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=_.FRAG_LOADING_WAITING_RETRY}else L.levelRetry?(T===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=_.IDLE):(B.logger.error(L.details+" reaches max retry, redispatch as fatal ..."),L.fatal=!0,this.hls.stopLoad(),this.state=_.ERROR)},u.afterBufferFlushed=function(T,L,I){if(!T)return;var F=W.BufferHelper.getBuffered(T);this.fragmentTracker.detectEvictedFragments(L,F,I),this.state===_.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE},u.resetLiveStartWhenNotLoaded=function(T){if(!this.loadedmetadata){this.startFragRequested=!1;var L=this.levels?this.levels[T].details:null;if(L!=null&&L.live)return this.startPosition=-1,this.setStartPosition(L,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(T,L,I,F){var j=this,z=I.details;console.assert(!!z,"level.details must be defined");var M=Object.keys(T.elementaryStreams).reduce(function(N,Y){var ee=T.elementaryStreams[Y];if(ee){var le=ee.endPTS-ee.startPTS;if(le<=0)return j.warn("Could not parse fragment "+T.sn+" "+Y+" duration reliably ("+le+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var pe=F?0:Object(g.updateFragPTSDTS)(z,T,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return j.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:z,level:I,drift:pe,type:Y,frag:T,start:ee.startPTS,end:ee.endPTS}),!0}return N},!1);M?(this.state=_.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:T,part:L})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(c,[{key:"state",get:function(){return this._state},set:function(T){var L=this._state;L!==T&&(this._state=T,this.log(L+"->"+T))}}]),c}(U.default)},"./src/controller/buffer-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return m});var X=k("./src/polyfills/number.ts"),U=k("./src/events.ts"),P=k("./src/utils/logger.ts"),W=k("./src/errors.ts"),B=k("./src/utils/buffer-helper.ts"),O=k("./src/utils/mediasource-helper.ts"),A=k("./src/loader/fragment.ts"),d=k("./src/controller/buffer-operation-queue.ts"),p=Object(O.getMediaSource)(),w=/([ha]vc.)(?:\.[^.,]+)+/,m=function(){function g(a){var i=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=i.hls,l=i.media,S=i.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:l})),S&&S.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=a,this._initSourceBuffer(),this.registerListeners()}var b=g.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var i=this.hls;i.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(U.Events.BUFFER_RESET,this.onBufferReset,this),i.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(U.Events.BUFFER_EOS,this.onBufferEos,this),i.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(U.Events.FRAG_PARSED,this.onFragParsed,this),i.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var i=this.hls;i.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(U.Events.BUFFER_RESET,this.onBufferReset,this),i.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(U.Events.BUFFER_EOS,this.onBufferEos,this),i.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(U.Events.FRAG_PARSED,this.onFragParsed,this),i.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(i,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(i,s){var l=this.media=s.media;if(l&&p){var S=this.mediaSource=new p;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(S),this._objectUrl=l.src}},b.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){P.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(l&&self.URL.revokeObjectURL(l),i.src===l?(i.removeAttribute("src"),i.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(s){var l=i.sourceBuffer[s];try{l&&(i.removeBufferListeners(s),i.mediaSource&&i.mediaSource.removeSourceBuffer(l),i.sourceBuffer[s]=void 0)}catch(S){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},b.onBufferCodecs=function(i,s){var l=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(v){if(S){var y=l.tracks[v];if(y&&typeof y.buffer.changeType=="function"){var R=s[v],_=R.codec,C=R.levelCodec,E=R.container,c=(y.levelCodec||y.codec).replace(w,"$1"),u=(C||_).replace(w,"$1");if(c!==u){var h=E+";codecs="+(C||_);l.appendChangeType(v,h)}}}else l.pendingTracks[v]=s[v]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(i,s){var l=this,S=this.operationQueue,v={execute:function(){var R=l.sourceBuffer[i];R&&(P.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),R.changeType(s)),S.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(R){P.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",R)}};S.append(v,i)},b.onBufferAppending=function(i,s){var l=this,S=this.hls,v=this.operationQueue,y=this.tracks,R=s.data,_=s.type,C=s.frag,E=s.part,c=s.chunkMeta,u=c.buffering[_],h=self.performance.now();u.start=h;var T=C.stats.buffering,L=E?E.stats.buffering:null;T.start===0&&(T.start=h),L&&L.start===0&&(L.start=h);var I=y.audio,F=_==="audio"&&c.id===1&&(I==null?void 0:I.container)==="audio/mpeg",j={execute:function(){if(u.executeStart=self.performance.now(),F){var M=l.sourceBuffer[_];if(M){var N=C.start-M.timestampOffset;Math.abs(N)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+C.start+" (delta: "+N+") sn: "+C.sn+")"),M.timestampOffset=C.start)}}l.appendExecutor(R,_)},onStart:function(){},onComplete:function(){var M=self.performance.now();u.executeEnd=u.end=M,T.first===0&&(T.first=M),L&&L.first===0&&(L.first=M);var N=l.sourceBuffer,Y={};for(var ee in N)Y[ee]=B.BufferHelper.getBuffered(N[ee]);l.appendError=0,l.hls.trigger(U.Events.BUFFER_APPENDED,{type:_,frag:C,part:E,chunkMeta:c,parent:C.type,timeRanges:Y})},onError:function(M){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+_+" SourceBuffer",M);var N={type:W.ErrorTypes.MEDIA_ERROR,parent:C.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=W.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,N.details=W.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>S.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),S.trigger(U.Events.ERROR,N)}};v.append(j,_)},b.onBufferFlushing=function(i,s){var l=this,S=this.operationQueue,v=function(R){return{execute:l.removeExecutor.bind(l,R,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(U.Events.BUFFER_FLUSHED,{type:R})},onError:function(C){P.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",C)}}};s.type?S.append(v(s.type),s.type):this.getSourceBufferTypes().forEach(function(y){S.append(v(y),y)})},b.onFragParsed=function(i,s){var l=this,S=s.frag,v=s.part,y=[],R=v?v.elementaryStreams:S.elementaryStreams;R[A.ElementaryStreamTypes.AUDIOVIDEO]?y.push("audiovideo"):(R[A.ElementaryStreamTypes.AUDIO]&&y.push("audio"),R[A.ElementaryStreamTypes.VIDEO]&&y.push("video"));var _=function(){var E=self.performance.now();S.stats.buffering.end=E,v&&(v.stats.buffering.end=E);var c=v?v.stats:S.stats;l.hls.trigger(U.Events.FRAG_BUFFERED,{frag:S,part:v,stats:c,id:S.type})};y.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(_,y)},b.onFragChanged=function(i,s){this.flushBackBuffer()},b.onBufferEos=function(i,s){var l=this,S=this.getSourceBufferTypes().reduce(function(v,y){var R=l.sourceBuffer[y];return(!s.type||s.type===y)&&(R&&!R.ended&&(R.ended=!0,P.logger.log("[buffer-controller]: "+y+" sourceBuffer now EOS"))),v&&!!(!R||R.ended)},!0);S&&this.blockBuffers(function(){var v=l.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},b.onLevelUpdated=function(i,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var i=this.hls,s=this.details,l=this.media,S=this.sourceBuffer;if(!l||s===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var y=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(X.isFiniteNumber)(y)||y<0)return;var R=l.currentTime,_=s.levelTargetDuration,C=Math.max(y,_),E=Math.floor(R/_)*_-C;v.forEach(function(c){var u=S[c];if(u){var h=B.BufferHelper.getBuffered(u);h.length>0&&E>h.start(0)&&(i.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),s.live&&i.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),i.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:c}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,s=this.hls,l=this.media,S=this.mediaSource,v=i.fragments[0].start+i.totalduration,y=l.duration,R=Object(X.isFiniteNumber)(S.duration)?S.duration:0;i.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(i)):(v>R&&v>y||!Object(X.isFiniteNumber)(y))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),S.duration=v)},b.updateSeekableRange=function(i){var s=this.mediaSource,l=i.fragments,S=l.length;if(S&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var v=Math.max(0,l[0].start),y=Math.max(v,v+i.totalduration);s.setLiveSeekableRange(v,y)}},b.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,S=Object.keys(l).length;if(S&&!i||S===2){this.createSourceBuffers(l),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.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}v.forEach(function(y){s.executeNext(y)})}},b.createSourceBuffers=function(i){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var v in i)if(!s[v]){var y=i[v];if(!y)throw Error("source buffer exists for track "+v+", however track does not");var R=y.levelCodec||y.codec,_=y.container+";codecs="+R;P.logger.log("[buffer-controller]: creating sourceBuffer("+_+")");try{var C=s[v]=l.addSourceBuffer(_),E=v;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[v]={buffer:C,codec:R,container:y.container,levelCodec:y.levelCodec,id:y.id},S++}catch(c){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+c.message),this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,mimeType:_})}}S&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(i){var s=this.operationQueue,l=s.current(i);l.onStart()},b._onSBUpdateEnd=function(i){var s=this.operationQueue,l=s.current(i);l.onComplete(),s.shiftAndExecuteNext(i)},b._onSBUpdateError=function(i,s){P.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(s)},b.removeExecutor=function(i,s,l){var S=this.media,v=this.mediaSource,y=this.operationQueue,R=this.sourceBuffer,_=R[i];if(!S||!v||!_){P.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),y.shiftAndExecuteNext(i);return}var C=Object(X.isFiniteNumber)(S.duration)?S.duration:Infinity,E=Object(X.isFiniteNumber)(v.duration)?v.duration:Infinity,c=Math.max(0,s),u=Math.min(l,C,E);u>c?(P.logger.log("[buffer-controller]: Removing ["+c+","+u+"] from the "+i+" SourceBuffer"),console.assert(!_.updating,i+" sourceBuffer must not be updating"),_.remove(c,u)):y.shiftAndExecuteNext(i)},b.appendExecutor=function(i,s){var l=this.operationQueue,S=this.sourceBuffer,v=S[s];if(!v){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}v.ended=!1,console.assert(!v.updating,s+" sourceBuffer must not be updating"),v.appendBuffer(i)},b.blockBuffers=function(i,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var S=this.operationQueue,v=s.map(function(y){return S.appendBlocker(y)});Promise.all(v).then(function(){i(),s.forEach(function(y){var R=l.sourceBuffer[y];(!R||!R.updating)&&S.shiftAndExecuteNext(y)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(i,s,l){var S=this.sourceBuffer[i];if(!S)return;var v=l.bind(this,i);this.listeners[i].push({event:s,listener:v}),S.addEventListener(s,v)},b.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(l){s.removeEventListener(l.event,l.listener)})},g}()},"./src/controller/buffer-operation-queue.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return U});var X=k("./src/utils/logger.ts"),U=function(){function P(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var W=P.prototype;return W.append=function(O,A){var d=this.queues[A];d.push(O),d.length===1&&this.buffers[A]&&this.executeNext(A)},W.insertAbort=function(O,A){var d=this.queues[A];d.unshift(O),this.executeNext(A)},W.appendBlocker=function(O){var A,d=new Promise(function(w){A=w}),p={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,O),d},W.executeNext=function(O){var A=this.buffers,d=this.queues,p=A[O],w=d[O];if(w.length){var m=w[0];try{m.execute()}catch(g){X.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),m.onError(g),(!p||!p.updating)&&(w.shift(),this.executeNext(O))}}},W.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},W.current=function(O){return this.queues[O][0]},P}()},"./src/controller/cap-level-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/events.ts");function U(B,O){for(var A=0;A<O.length;A++){var d=O[A];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(B,d.key,d)}}function P(B,O,A){return O&&U(B.prototype,O),A&&U(B,A),B}var W=function(){function B(A){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=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=B.prototype;return O.setStreamController=function(d){this.streamController=d},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var d=this.hls;d.on(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var d=this.hls;d.off(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(d,p){B.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},O.onMediaAttaching=function(d,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},O.onManifestParsed=function(d,p){var w=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,w.config.capLevelToPlayerSize&&p.video&&this.startCapping()},O.onBufferCodecs=function(d,p){var w=this.hls;w.config.capLevelToPlayerSize&&p.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(d.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},O.getMaxLevel=function(d){var p=this,w=this.hls.levels;if(!w.length)return-1;var m=w.filter(function(g,b){return B.isLevelAllowed(b,p.restrictedLevels)&&b<=d});return this.clientRect=null,B.getMaxLevelByMediaSize(m,this.mediaWidth,this.mediaHeight)},O.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()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,p={width:0,height:0};if(d){var w=d.getBoundingClientRect();p.width=w.width,p.height=w.height,!p.width&&!p.height&&(p.width=w.right-w.left||d.width||0,p.height=w.bottom-w.top||d.height||0)}return this.clientRect=p,p},B.isLevelAllowed=function(d,p){return p===void 0&&(p=[]),p.indexOf(d)===-1},B.getMaxLevelByMediaSize=function(d,p,w){if(!d||!d.length)return-1;for(var m=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},g=d.length-1,b=0;b<d.length;b+=1){var a=d[b];if((a.width>=p||a.height>=w)&&m(a,d[b+1])){g=b;break}}return g},P(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(p){}return d}}]),B}();J.default=W},"./src/controller/cmcd-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return m});var X=k("./src/events.ts"),U=k("./src/types/cmcd.ts"),P=k("./src/utils/buffer-helper.ts"),W=k("./src/utils/logger.ts");function B(g,b){for(var a=0;a<b.length;a++){var i=b[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(g,i.key,i)}}function O(g,b,a){return b&&B(g.prototype,b),a&&B(g,a),g}function A(g,b){var a=typeof Symbol!="undefined"&&g[Symbol.iterator]||g["@@iterator"];if(a)return(a=a.call(g)).next.bind(a);if(Array.isArray(g)||(a=d(g))||b&&g&&typeof g.length=="number"){a&&(g=a);var i=0;return function(){return i>=g.length?{done:!0}:{done:!1,value:g[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d(g,b){if(!g)return;if(typeof g=="string")return p(g,b);var a=Object.prototype.toString.call(g).slice(8,-1);if(a==="Object"&&g.constructor&&(a=g.constructor.name),a==="Map"||a==="Set")return Array.from(g);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return p(g,b)}function p(g,b){(b==null||b>g.length)&&(b=g.length);for(var a=0,i=new Array(b);a<b;a++)i[a]=g[a];return i}function w(){return w=Object.assign||function(g){for(var b=1;b<arguments.length;b++){var a=arguments[b];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(g[i]=a[i])}return g},w.apply(this,arguments)}var m=function(){function g(a){var i=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(S){try{i.apply(S,{ot:U.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(v){W.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(S){try{var v=S.frag,y=i.hls.levels[v.level],R=i.getObjectType(v),_={d:v.duration*1e3,ot:R};(R===U.CMCDObjectType.VIDEO||R===U.CMCDObjectType.AUDIO||R==U.CMCDObjectType.MUXED)&&(_.br=y.bitrate/1e3,_.tb=i.getTopBandwidth(R),_.bl=i.getBufferLength(R)),i.apply(S,_)}catch(C){W.logger.warn("Could not generate segment CMCD data.",C)}},this.hls=a;var s=this.config=a.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||g.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var b=g.prototype;return b.registerListeners=function(){var i=this.hls;i.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(X.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var i=this.hls;i.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(X.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(i,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(i,s){var l,S;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},b.createData=function(){var i;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(i,s){s===void 0&&(s={}),w(s,this.createData());var l=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=g.toHeaders(s);if(!Object.keys(S).length)return;i.headers||(i.headers={}),w(i.headers,S)}else{var v=g.toQuery(s);if(!v)return;i.url=g.appendQueryToUri(i.url,v)}},b.getObjectType=function(i){var s=i.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?U.CMCDObjectType.INIT:s==="audio"?U.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(i){for(var s=0,l=i===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=A(l),v;!(v=S()).done;){var y=v.value;y.bitrate>s&&(s=y.bitrate)}return s>0?s:NaN},b.getBufferLength=function(i){var s=this.hls.media,l=i===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var S=P.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return S.len*1e3},b.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,l=i||this.config.loader;return function(){function S(y){this.loader=void 0,this.loader=new l(y)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(R,_,C){s(R),this.loader.load(R,_,C)},O(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},b.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,l=i||this.config.loader;return function(){function S(y){this.loader=void 0,this.loader=new l(y)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(R,_,C){s(R),this.loader.load(R,_,C)},O(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},g.uuid=function(){var i=URL.createObjectURL(new Blob),s=i.toString();return URL.revokeObjectURL(i),s.substr(s.lastIndexOf("/")+1)},g.serialize=function(i){for(var s=[],l=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},S=function(F){return Math.round(F)},v=function(F){return S(F/100)*100},y=function(F){return encodeURIComponent(F)},R={br:S,d:S,bl:v,dl:v,mtp:v,nor:y,rtp:v,tb:S},_=Object.keys(i||{}).sort(),C=A(_),E;!(E=C()).done;){var c=E.value,u=i[c];if(!l(u))continue;if(c==="v"&&u===1)continue;if(c=="pr"&&u===1)continue;var h=R[c];h&&(u=h(u));var T=typeof u,L=void 0;c==="ot"||c==="sf"||c==="st"?L=c+"="+u:T==="boolean"?L=c:T==="number"?L=c+"="+u:L=c+"="+JSON.stringify(u),s.push(L)}return s.join(",")},g.toHeaders=function(i){for(var s=Object.keys(i),l={},S=["Object","Request","Session","Status"],v=[{},{},{},{}],y={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},R=0,_=s;R<_.length;R++){var C=_[R],E=y[C]!=null?y[C]:1;v[E][C]=i[C]}for(var c=0;c<v.length;c++){var u=g.serialize(v[c]);u&&(l["CMCD-"+S[c]]=u)}return l},g.toQuery=function(i){return"CMCD="+encodeURIComponent(g.serialize(i))},g.appendQueryToUri=function(i,s){if(!s)return i;var l=i.includes("?")?"&":"?";return""+i+l+s},g}()},"./src/controller/eme-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/events.ts"),U=k("./src/errors.ts"),P=k("./src/utils/logger.ts"),W=k("./src/utils/mediakeys-helper.ts");function B(m,g){for(var b=0;b<g.length;b++){var a=g[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(m,a.key,a)}}function O(m,g,b){return g&&B(m.prototype,g),b&&B(m,b),m}var A=3,d=function(g,b,a){var i={audioCapabilities:[],videoCapabilities:[]};return g.forEach(function(s){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:a.audioRobustness||""})}),b.forEach(function(s){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:a.videoRobustness||""})}),[i]},p=function(g,b,a,i){switch(g){case W.KeySystems.WIDEVINE:return d(b,a,i);default:throw new Error("Unknown key-system: "+g)}},w=function(){function m(b){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=b,this._config=b.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var g=m.prototype;return g.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},g._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)},g._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)},g.getLicenseServerUrl=function(a){switch(a){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+a+'"')},g._attemptKeySystemAccess=function(a,i,s){var l=this,S=p(a,i,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(a,S);this.mediaKeysPromise=v.then(function(y){return l._onMediaKeySystemAccessObtained(a,y)}),v.catch(function(y){P.logger.error('Failed to obtain key-system "'+a+'" access:',y)})},g._onMediaKeySystemAccessObtained=function(a,i){var s=this;P.logger.log('Access for key-system "'+a+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:a};this._mediaKeysList.push(l);var S=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(v){return l.mediaKeys=v,P.logger.log('Media-keys created for key-system "'+a+'"'),s._onMediaKeysCreated(),v});return S.catch(function(v){P.logger.error("Failed to create media-keys:",v)}),S},g._onMediaKeysCreated=function(){var a=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),a._onNewMediaKeySession(i.mediaKeysSession))})},g._onNewMediaKeySession=function(a){var i=this;P.logger.log("New key-system session "+a.sessionId),a.addEventListener("message",function(s){i._onKeySessionMessage(a,s.message)},!1)},g._onKeySessionMessage=function(a,i){P.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),a.update(s)})},g.onMediaEncrypted=function(a){var i=this;if(P.logger.log('Media is encrypted using "'+a.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!i._media)return;i._attemptSetMediaKeys(S),i._generateRequestWithPreferredKeySession(a.initDataType,a.initData)};this.mediaKeysPromise.then(s).catch(s)},g._attemptSetMediaKeys=function(a){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.mediaKeys){P.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}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},g._generateRequestWithPreferredKeySession=function(a,i){var s=this,l=this._mediaKeysList[0];if(!l){P.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(l.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var S=l.mediaKeysSession;if(!S){P.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(!i){P.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}P.logger.log('Generating key-session request for "'+a+'" init data type'),l.mediaKeysSessionInitialized=!0,S.generateRequest(a,i).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(v){P.logger.error("Error generating key-session request:",v),s.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},g._createLicenseXhr=function(a,i,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,a,i,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,l,a),S=void 0}catch(v){P.logger.error(v)}try{l.readyState||l.open("POST",a,!0),S&&S.call(this.hls,l,a)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return l},g._onLicenseRequestReadyStageChange=function(a,i,s,l){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var S=a.response,v=this._licenseResponseCallback;if(v)try{S=v.call(this.hls,a,i)}catch(R){P.logger.error(R)}l(S)}else{if(P.logger.error("License Request XHR failed ("+i+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var y=A-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+y+" attempts left"),this._requestLicense(s,l)}break}},g._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},g._requestLicense=function(a,i){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.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 l=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(l,a,i);P.logger.log("Sending license request to URL: "+l);var v=this._generateLicenseRequestChallenge(s,a);S.send(v)}catch(y){P.logger.error("Failure requesting DRM license: "+y),this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},g.onMediaAttached=function(a,i){if(!this._emeEnabled)return;var s=i.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},g.onMediaDetached=function(){var a=this._media,i=this._mediaKeysList;if(!a)return;a.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return a.setMediaKeys(null)}).catch(function(){})},g.onManifestParsed=function(a,i){if(!this._emeEnabled)return;var s=i.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),l=i.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,l)},O(m,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),m}();J.default=w},"./src/controller/fps-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/events.ts"),U=k("./src/utils/logger.ts"),P=function(){function W(O){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=O,this.registerListeners()}var B=W.prototype;return B.setStreamController=function(A){this.streamController=A},B.registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(A,d){var p=this.hls.config;if(p.capLevelOnFPSDrop){var w=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=w,w&&typeof w.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(A,d,p){var w=performance.now();if(d){if(this.lastTime){var m=w-this.lastTime,g=p-this.lastDroppedFrames,b=d-this.lastDecodedFrames,a=1e3*g/m,i=this.hls;if(i.trigger(X.Events.FPS_DROP,{currentDropped:g,currentDecoded:b,totalDroppedFrames:p}),a>0&&g>i.config.fpsDroppedMonitoringThreshold*b){var s=i.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=s)&&(s=s-1,i.trigger(X.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=w,this.lastDroppedFrames=p,this.lastDecodedFrames=d}},B.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var d=A.getVideoPlaybackQuality();this.checkFPS(A,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},W}();J.default=P},"./src/controller/fragment-finders.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"findFragmentByPDT",function(){return P}),k.d(J,"findFragmentByPTS",function(){return W}),k.d(J,"fragmentWithinToleranceTest",function(){return B}),k.d(J,"pdtWithinToleranceTest",function(){return O}),k.d(J,"findFragWithCC",function(){return A});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/binary-search.ts");function P(d,p,w){if(p===null||!Array.isArray(d)||!d.length||!Object(X.isFiniteNumber)(p))return null;var m=d[0].programDateTime;if(p<(m||0))return null;var g=d[d.length-1].endProgramDateTime;if(p>=(g||0))return null;w=w||0;for(var b=0;b<d.length;++b){var a=d[b];if(O(p,w,a))return a}return null}function W(d,p,w,m){w===void 0&&(w=0),m===void 0&&(m=0);var g=null;if(d?g=p[d.sn-p[0].sn+1]||null:w===0&&p[0].start===0&&(g=p[0]),g&&B(w,m,g)===0)return g;var b=U.default.search(p,B.bind(null,w,m));return b||g}function B(d,p,w){d===void 0&&(d=0),p===void 0&&(p=0);var m=Math.min(p,w.duration+(w.deltaPTS?w.deltaPTS:0));return w.start+w.duration-m<=d?1:w.start-m>d&&w.start?-1:0}function O(d,p,w){var m=Math.min(p,w.duration+(w.deltaPTS?w.deltaPTS:0))*1e3,g=w.endProgramDateTime||0;return g-m>d}function A(d,p){return U.default.search(d,function(w){return w.cc<p?1:w.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"FragmentState",function(){return P}),k.d(J,"FragmentTracker",function(){return W});var X=k("./src/events.ts"),U=k("./src/types/loader.ts"),P;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(P||(P={}));var W=function(){function A(p){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=p,this._registerListeners()}var d=A.prototype;return d._registerListeners=function(){var w=this.hls;w.on(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.on(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.on(X.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var w=this.hls;w.off(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.off(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.off(X.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(w,m){if(m===U.PlaylistLevelType.MAIN){var g=this.activeFragment,b=this.activeParts;if(!g)return null;if(b)for(var a=b.length;a--;){var i=b[a],s=i?i.end:g.appendedPTS;if(i.start<=w&&s!==void 0&&w<=s)return a>9&&(this.activeParts=b.slice(a-9)),i}else if(g.start<=w&&g.appendedPTS!==void 0&&w<=g.appendedPTS)return g}return this.getBufferedFrag(w,m)},d.getBufferedFrag=function(w,m){for(var g=this.fragments,b=Object.keys(g),a=b.length;a--;){var i=g[b[a]];if((i==null?void 0:i.body.type)===m&&i.buffered){var s=i.body;if(s.start<=w&&w<=s.end)return s}}return null},d.detectEvictedFragments=function(w,m,g){var b=this;Object.keys(this.fragments).forEach(function(a){var i=b.fragments[a];if(!i)return;if(!i.buffered){i.body.type===g&&b.removeFragment(i.body);return}var s=i.range[w];if(!s)return;s.time.some(function(l){var S=!b.isTimeBuffered(l.startPTS,l.endPTS,m);return S&&b.removeFragment(i.body),S})})},d.detectPartialFragments=function(w){var m=this,g=this.timeRanges,b=w.frag,a=w.part;if(!g||b.sn==="initSegment")return;var i=O(b),s=this.fragments[i];if(!s)return;Object.keys(g).forEach(function(l){var S=b.elementaryStreams[l];if(!S)return;var v=g[l],y=a!==null||S.partial===!0;s.range[l]=m.getBufferedTimes(b,a,y,v)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},d.fragBuffered=function(w){var m=O(w),g=this.fragments[m];g&&(g.backtrack=g.loaded=null,g.buffered=!0)},d.getBufferedTimes=function(w,m,g,b){for(var a={time:[],partial:g},i=m?m.start:w.start,s=m?m.end:w.end,l=w.minEndPTS||s,S=w.maxStartPTS||i,v=0;v<b.length;v++){var y=b.start(v)-this.bufferPadding,R=b.end(v)+this.bufferPadding;if(S>=y&&l<=R){a.time.push({startPTS:Math.max(i,b.start(v)),endPTS:Math.min(s,b.end(v))});break}else if(i<R&&s>y)a.partial=!0,a.time.push({startPTS:Math.max(i,b.start(v)),endPTS:Math.min(s,b.end(v))});else if(s<=y)break}return a},d.getPartialFragment=function(w){var m=null,g,b,a,i=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(S){var v=l[S];if(!v)return;B(v)&&(b=v.body.start-s,a=v.body.end+s,w>=b&&w<=a&&(g=Math.min(w-b,a-w),i<=g&&(m=v.body,i=g)))}),m},d.getState=function(w){var m=O(w),g=this.fragments[m];return g?g.buffered?B(g)?P.PARTIAL:P.OK:g.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},d.backtrack=function(w,m){var g=O(w),b=this.fragments[g];if(!b||b.backtrack)return null;var a=b.backtrack=m||b.loaded;return b.loaded=null,a},d.getBacktrackData=function(w){var m=O(w),g=this.fragments[m];if(g){var b,a=g.backtrack;if(a!=null&&(b=a.payload)!==null&&b!==void 0&&b.byteLength)return a;this.removeFragment(w)}return null},d.isTimeBuffered=function(w,m,g){for(var b,a,i=0;i<g.length;i++){if(b=g.start(i)-this.bufferPadding,a=g.end(i)+this.bufferPadding,w>=b&&m<=a)return!0;if(m<=b)return!1}return!1},d.onFragLoaded=function(w,m){var g=m.frag,b=m.part;if(g.sn==="initSegment"||g.bitrateTest||b)return;var a=O(g);this.fragments[a]={body:g,loaded:m,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(w,m){var g=this,b=m.frag,a=m.part,i=m.timeRanges;if(b.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=b,a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(l){var S=i[l];if(g.detectEvictedFragments(l,S),!a)for(var v=0;v<S.length;v++)b.appendedPTS=Math.max(S.end(v),b.appendedPTS||0)})},d.onFragBuffered=function(w,m){this.detectPartialFragments(m)},d.hasFragment=function(w){var m=O(w);return!!this.fragments[m]},d.removeFragmentsInRange=function(w,m,g){var b=this;Object.keys(this.fragments).forEach(function(a){var i=b.fragments[a];if(!i)return;if(i.buffered){var s=i.body;s.type===g&&s.start<m&&s.end>w&&b.removeFragment(s)}})},d.removeFragment=function(w){var m=O(w);w.stats.loaded=0,w.clearElementaryStreamInfo(),delete this.fragments[m]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function B(A){var d,p;return A.buffered&&(((d=A.range.video)===null||d===void 0?void 0:d.partial)||((p=A.range.audio)===null||p===void 0?void 0:p.partial))}function O(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"STALL_MINIMUM_DURATION_MS",function(){return B}),k.d(J,"MAX_START_GAP_JUMP",function(){return O}),k.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),k.d(J,"SKIP_BUFFER_RANGE_START",function(){return d}),k.d(J,"default",function(){return p});var X=k("./src/utils/buffer-helper.ts"),U=k("./src/errors.ts"),P=k("./src/events.ts"),W=k("./src/utils/logger.ts"),B=250,O=2,A=.1,d=.05,p=function(){function w(g,b,a,i){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=g,this.media=b,this.fragmentTracker=a,this.hls=i}var m=w.prototype;return m.destroy=function(){this.hls=this.fragmentTracker=this.media=null},m.poll=function(b){var a=this.config,i=this.media,s=this.stalled,l=i.currentTime,S=i.seeking,v=this.seeking&&!S,y=!this.seeking&&S;if(this.seeking=S,l!==b){if(this.moved=!0,s!==null){if(this.stallReported){var R=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((y||v)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!X.BufferHelper.getBuffered(i).length)return;var _=X.BufferHelper.bufferInfo(i,l,0),C=_.len>0,E=_.nextStart||0;if(!C&&!E)return;if(S){var c=_.len>O,u=!E||E-l>O&&!this.fragmentTracker.getPartialFragment(l);if(c||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h,T=Math.max(E,_.start||0)-l,L=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=L==null||((h=L.details)===null||h===void 0)?void 0:h.live,F=I?L.details.targetduration*2:O;if(T>0&&T<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var z=j-s;!S&&z>=B&&this._reportStall(_.len);var M=X.BufferHelper.bufferInfo(i,l,a.maxBufferHole);this._tryFixBufferStall(M,z)},m._tryFixBufferStall=function(b,a){var i=this.config,s=this.fragmentTracker,l=this.media,S=l.currentTime,v=s.getPartialFragment(S);if(v){var y=this._trySkipBufferHole(v);if(y)return}b.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},m._reportStall=function(b){var a=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+b+")"),a.trigger(P.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},m._trySkipBufferHole=function(b){for(var a=this.config,i=this.hls,s=this.media,l=s.currentTime,S=0,v=X.BufferHelper.getBuffered(s),y=0;y<v.length;y++){var R=v.start(y);if(l+a.maxBufferHole>=S&&l<R){var _=Math.max(R+d,s.currentTime+A);return W.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+_),this.moved=!0,this.stalled=null,s.currentTime=_,b&&i.trigger(P.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+_,frag:b}),_}S=v.end(y)}return 0},m._tryNudgeBuffer=function(){var b=this.config,a=this.hls,i=this.media,s=i.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<b.nudgeMaxRetry){var S=s+l*b.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+S),i.currentTime=S,a.trigger(P.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 "+b.nudgeMaxRetry+" nudges"),a.trigger(P.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},w}()},"./src/controller/id3-track-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/events.ts"),U=k("./src/utils/texttrack-utils.ts"),P=k("./src/demux/id3.ts"),W=.25,B=function(){function O(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var A=O.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var p=this.hls;p.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var p=this.hls;p.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(p,w){this.media=w.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(p){if(!this.media)return;for(var w=0;w<p.length;w++){var m=p[w];if(m.kind==="metadata"&&m.label==="id3")return Object(U.sendAddTrackEvent)(m,this.media),m}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(p,w){if(!this.media)return;var m=w.frag,g=w.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<g.length;a++){var i=P.getID3Frames(g[a].data);if(i){var s=g[a].pts,l=a<g.length-1?g[a+1].pts:m.end,S=l-s;S<=0&&(l=s+W);for(var v=0;v<i.length;v++){var y=i[v];if(!P.isTimeStampFrame(y)){var R=new b(s,l,"");R.value=y,this.id3Track.addCue(R)}}}}},A.onBufferFlushing=function(p,w){var m=w.startOffset,g=w.endOffset,b=w.type;if(!b||b==="audio"){var a=this.id3Track;a&&Object(U.removeCuesInRange)(a,m,g)}},O}();J.default=B},"./src/controller/latency-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return O});var X=k("./src/errors.ts"),U=k("./src/events.ts"),P=k("./src/utils/logger.ts");function W(A,d){for(var p=0;p<d.length;p++){var w=d[p];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(A,w.key,w)}}function B(A,d,p){return d&&W(A.prototype,d),p&&W(A,p),A}var O=function(){function A(p){var w=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return w.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var d=A.prototype;return d.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},d.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)},d.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)},d.onMediaAttached=function(w,m){this.media=m.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},d.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},d.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},d.onLevelUpdated=function(w,m){var g=m.details;this.levelDetails=g,g.advanced&&this.timeupdate(),!g.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(w,m){if(m.details!==X.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var w=this.media,m=this.levelDetails;if(!w||!m)return;this.currentTime=w.currentTime;var g=this.computeLatency();if(g===null)return;this._latency=g;var b=this.config,a=b.lowLatencyMode,i=b.maxLiveSyncPlaybackRate;if(!a||i===1)return;var s=this.targetLatency;if(s===null)return;var l=g-s,S=Math.min(this.maxLatency,s+m.targetduration),v=l<S;if(m.live&&v&&l>.05&&this.forwardBufferLength>1){var y=Math.min(2,Math.max(1,i)),R=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;w.playbackRate=Math.min(y,Math.max(1,R))}else w.playbackRate!==1&&w.playbackRate!==0&&(w.playbackRate=1)},d.estimateLiveEdge=function(){var w=this.levelDetails;return w===null?null:w.edge+w.age},d.computeLatency=function(){var w=this.estimateLiveEdge();return w===null?null:w-this.currentTime},B(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var w=this.config,m=this.levelDetails;return w.liveMaxLatencyDuration!==void 0?w.liveMaxLatencyDuration:m?w.liveMaxLatencyDurationCount*m.targetduration:0}},{key:"targetLatency",get:function(){var w=this.levelDetails;if(w===null)return null;var m=w.holdBack,g=w.partHoldBack,b=w.targetduration,a=this.config,i=a.liveSyncDuration,s=a.liveSyncDurationCount,l=a.lowLatencyMode,S=this.hls.userConfig,v=l&&g||m;(S.liveSyncDuration||S.liveSyncDurationCount||v===0)&&(v=i!==void 0?i:s*b);var y=b,R=1;return v+Math.min(this.stallCount*R,y)}},{key:"liveSyncPosition",get:function(){var w=this.estimateLiveEdge(),m=this.targetLatency,g=this.levelDetails;if(w===null||m===null||g===null)return null;var b=g.edge,a=w-m-this.edgeStalled,i=b-g.totalduration,s=b-(this.config.lowLatencyMode&&g.partTarget||g.targetduration);return Math.min(Math.max(i,a),s)}},{key:"drift",get:function(){var w=this.levelDetails;return w===null?1:w.drift}},{key:"edgeStalled",get:function(){var w=this.levelDetails;if(w===null)return 0;var m=(this.config.lowLatencyMode&&w.partTarget||w.targetduration)*3;return Math.max(w.age-m,0)}},{key:"forwardBufferLength",get:function(){var w=this.media,m=this.levelDetails;if(!w||!m)return 0;var g=w.buffered.length;return g?w.buffered.end(g-1):m.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return a});var X=k("./src/types/level.ts"),U=k("./src/events.ts"),P=k("./src/errors.ts"),W=k("./src/utils/codecs.ts"),B=k("./src/controller/level-helper.ts"),O=k("./src/controller/base-playlist-controller.ts"),A=k("./src/types/loader.ts");function d(){return d=Object.assign||function(i){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(i[S]=l[S])}return i},d.apply(this,arguments)}function p(i,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(i,S.key,S)}}function w(i,s,l){return s&&p(i.prototype,s),l&&p(i,l),i}function m(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,g(i,s)}function g(i,s){return g=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},g(i,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(i){m(s,i);function s(S){var v;return v=i.call(this,S,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var l=s.prototype;return l._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},l.startLoad=function(){var v=this._levels;v.forEach(function(y){y.loadError=0}),i.prototype.startLoad.call(this)},l.onManifestLoaded=function(v,y){var R=[],_=[],C=[],E,c={},u,h=!1,T=!1,L=!1;if(y.levels.forEach(function(z){var M=z.attrs;h=h||!!(z.width&&z.height),T=T||!!z.videoCodec,L=L||!!z.audioCodec,b&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var N=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;u=c[N],u?u.url.push(z.url):(u=new X.Level(z),c[N]=u,R.push(u)),M&&(M.AUDIO&&Object(B.addGroupId)(u,"audio",M.AUDIO),M.SUBTITLES&&Object(B.addGroupId)(u,"text",M.SUBTITLES))}),(h||T)&&L&&(R=R.filter(function(z){var M=z.videoCodec,N=z.width,Y=z.height;return!!M||!!(N&&Y)})),R=R.filter(function(z){var M=z.audioCodec,N=z.videoCodec;return(!M||Object(W.isCodecSupportedInMp4)(M,"audio"))&&(!N||Object(W.isCodecSupportedInMp4)(N,"video"))}),y.audioTracks&&(_=y.audioTracks.filter(function(z){return!z.audioCodec||Object(W.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(_)),y.subtitles&&(C=y.subtitles,Object(B.assignTrackIdsByGroup)(C)),R.length>0){E=R[0].bitrate,R.sort(function(z,M){return z.bitrate-M.bitrate}),this._levels=R;for(var I=0;I<R.length;I++)if(R[I].bitrate===E){this._firstLevel=I,this.log("manifest loaded, "+R.length+" level(s) found, first bitrate: "+E);break}var F=L&&!T,j={levels:R,audioTracks:_,subtitleTracks:C,firstLevel:this._firstLevel,stats:y.stats,audio:L,video:T,altAudio:!F&&_.some(function(z){return!!z.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:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:y.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(v,y){if(i.prototype.onError.call(this,v,y),y.fatal)return;var R=y.context,_=this._levels[this.currentLevelIndex];if(R&&(R.type===A.PlaylistContextType.AUDIO_TRACK&&_.audioGroupIds&&R.groupId===_.audioGroupIds[_.urlId]||R.type===A.PlaylistContextType.SUBTITLE_TRACK&&_.textGroupIds&&R.groupId===_.textGroupIds[_.urlId])){this.redundantFailover(this.currentLevelIndex);return}var C=!1,E=!0,c;switch(y.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(y.frag){var u=this._levels[y.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(c=y.frag.level)):c=y.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(E=!1),c=R.level),C=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:c=y.level,C=!0;break}c!==void 0&&this.recoverLevel(y,c,C,E)},l.recoverLevel=function(v,y,R,_){var C=v.details,E=this._levels[y];if(E.loadError++,R){var c=this.retryLoadingOrFail(v);if(c)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(_){var u=E.url.length;if(u>1&&E.loadError<u)v.levelRetry=!0,this.redundantFailover(y);else if(this.manualLevelIndex===-1){var h=y===0?this._levels.length-1:y-1;this.currentLevelIndex!==h&&this._levels[h].loadError===0&&(this.warn(C+": switch to "+h),v.levelRetry=!0,this.hls.nextAutoLevel=h)}}},l.redundantFailover=function(v){var y=this._levels[v],R=y.url.length;if(R>1){var _=(y.urlId+1)%R;this.warn("Switching to redundant URL-id "+_),this._levels.forEach(function(C){C.urlId=_}),this.level=v}},l.onFragLoaded=function(v,y){var R=y.frag;if(R!==void 0&&R.type===A.PlaylistLevelType.MAIN){var _=this._levels[R.level];_!==void 0&&(_.fragmentError=0,_.loadError=0)}},l.onLevelLoaded=function(v,y){var R,_=y.level,C=y.details,E=this._levels[_];if(!E){var c;this.warn("Invalid level index "+_),(c=y.deliveryDirectives)!==null&&c!==void 0&&c.skip&&(C.deltaUpdateFailed=!0);return}_===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(_,y,E.details)):(R=y.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(C.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(v,y){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var _=-1,C=this.hls.audioTracks[y.id].groupId,E=0;E<R.audioGroupIds.length;E++)if(R.audioGroupIds[E]===C){_=E;break}_!==R.urlId&&(R.urlId=_,this.startLoad())}},l.loadPlaylist=function(v){var y=this.currentLevelIndex,R=this._levels[y];if(this.canLoad&&R&&R.url.length>0){var _=R.urlId,C=R.url[_];if(v)try{C=v.addDirectives(C)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+y+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+_+" "+C),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:C,level:y,id:_,deliveryDirectives:v||null})}},l.removeLevel=function(v,y){var R=function(E,c){return c!==y},_=this._levels.filter(function(C,E){return E!==v?!0:C.url.length>1&&y!==void 0?(C.url=C.url.filter(R),C.audioGroupIds&&(C.audioGroupIds=C.audioGroupIds.filter(R)),C.textGroupIds&&(C.textGroupIds=C.textGroupIds.filter(R)),C.urlId=0,!0):!1}).map(function(C,E){var c=C.details;return c!=null&&c.fragments&&c.fragments.forEach(function(u){u.level=E}),C});this._levels=_,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:_})},w(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var y,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===v&&(y=R[v])!==null&&y!==void 0&&y.details)return;if(v<0||v>=R.length){var _=v<0;if(this.hls.trigger(U.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:_,reason:"invalid level idx"}),_)return;v=Math.min(v,R.length-1)}this.clearTimer();var C=this.currentLevelIndex,E=R[C],c=R[v];this.log("switching to level "+v+" from "+C),this.currentLevelIndex=v;var u=d({},c,{level:v,maxBitrate:c.maxBitrate,uri:c.uri,urlId:c.urlId});delete u._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,u);var h=c.details;if(!h||h.live){var T=this.switchParams(c.uri,E==null?void 0:E.details);this.loadPlaylist(T)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),s}(O.default)},"./src/controller/level-helper.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"addGroupId",function(){return P}),k.d(J,"assignTrackIdsByGroup",function(){return W}),k.d(J,"updatePTS",function(){return B}),k.d(J,"updateFragPTSDTS",function(){return A}),k.d(J,"mergeDetails",function(){return d}),k.d(J,"mapPartIntersection",function(){return p}),k.d(J,"mapFragmentIntersection",function(){return w}),k.d(J,"adjustSliding",function(){return m}),k.d(J,"addSliding",function(){return g}),k.d(J,"computeReloadInterval",function(){return b}),k.d(J,"getFragmentWithSN",function(){return a}),k.d(J,"getPartWith",function(){return i});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/logger.ts");function P(s,l,S){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function W(s){var l={};s.forEach(function(S){var v=S.groupId||"";S.id=l[v]=l[v]||0,l[v]++})}function B(s,l,S){var v=s[l],y=s[S];O(v,y)}function O(s,l){var S=l.startPTS;if(Object(X.isFiniteNumber)(S)){var v=0,y;l.sn>s.sn?(v=S-s.start,y=s):(v=s.start-S,y=l),y.duration!==v&&(y.duration=v)}else if(l.sn>s.sn){var R=s.cc===l.cc;R&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function A(s,l,S,v,y,R){var _=v-S;_<=0&&(U.logger.warn("Fragment should have a positive duration",l),v=S+l.duration,R=y+l.duration);var C=S,E=v,c=l.startPTS,u=l.endPTS;if(Object(X.isFiniteNumber)(c)){var h=Math.abs(c-S);Object(X.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(h,l.deltaPTS):l.deltaPTS=h,C=Math.max(S,c),S=Math.min(S,c),y=Math.min(y,l.startDTS),E=Math.min(v,u),v=Math.max(v,u),R=Math.max(R,l.endDTS)}l.duration=v-S;var T=S-l.start;l.appendedPTS=v,l.start=l.startPTS=S,l.maxStartPTS=C,l.startDTS=y,l.endPTS=v,l.minEndPTS=E,l.endDTS=R;var L=l.sn;if(!s||L<s.startSN||L>s.endSN)return 0;var I,F=L-s.startSN,j=s.fragments;for(j[F]=l,I=F;I>0;I--)O(j[I],j[I-1]);for(I=F;I<j.length-1;I++)O(j[I],j[I+1]);return s.fragmentHint&&O(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,T}function d(s,l){for(var S=null,v=s.fragments,y=v.length-1;y>=0;y--){var R=v[y].initSegment;if(R){S=R;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var _=0,C;if(w(s,l,function(I,F){I.relurl&&(_=I.cc-F.cc),Object(X.isFiniteNumber)(I.startPTS)&&Object(X.isFiniteNumber)(I.endPTS)&&(F.start=F.startPTS=I.startPTS,F.startDTS=I.startDTS,F.appendedPTS=I.appendedPTS,F.maxStartPTS=I.maxStartPTS,F.endPTS=I.endPTS,F.endDTS=I.endDTS,F.minEndPTS=I.minEndPTS,F.duration=I.endPTS-I.startPTS,F.duration&&(C=F),l.PTSKnown=l.alignedSliding=!0),F.elementaryStreams=I.elementaryStreams,F.loader=I.loader,F.stats=I.stats,F.urlId=I.urlId,I.initSegment&&(F.initSegment=I.initSegment,S=I.initSegment)}),S){var E=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;E.forEach(function(I){var F;(!I.initSegment||I.initSegment.relurl===((F=S)===null||F===void 0?void 0:F.relurl))&&(I.initSegment=S)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(I){return!I}),l.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=l.skippedSegments;c--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var u=l.fragments;if(_){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var h=0;h<u.length;h++)u[h].cc+=_}l.skippedSegments&&(l.startCC=l.fragments[0].cc),p(s.partList,l.partList,function(I,F){F.elementaryStreams=I.elementaryStreams,F.stats=I.stats}),C?A(l,C,C.startPTS,C.endPTS,C.startDTS,C.endDTS):m(s,l),u.length&&(l.totalduration=l.edge-u[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var T=l.advancedDateTime;if(l.advanced&&T){var L=l.edge;l.driftStart||(l.driftStartTime=T,l.driftStart=L),l.driftEndTime=T,l.driftEnd=L}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function p(s,l,S){if(s&&l)for(var v=0,y=0,R=s.length;y<=R;y++){var _=s[y],C=l[y+v];_&&C&&_.index===C.index&&_.fragment.sn===C.fragment.sn?S(_,C):v--}}function w(s,l,S){for(var v=l.skippedSegments,y=Math.max(s.startSN,l.startSN)-l.startSN,R=(s.fragmentHint?1:0)+(v?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,_=l.startSN-s.startSN,C=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,E=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=y;c<=R;c++){var u=E[_+c],h=C[c];v&&!h&&c<v&&(h=l.fragments[c]=u),u&&h&&S(u,h)}}function m(s,l){var S=l.startSN+l.skippedSegments-s.startSN,v=s.fragments;if(S<0||S>=v.length)return;g(l,v[S].start)}function g(s,l){if(l){for(var S=s.fragments,v=s.skippedSegments;v<S.length;v++)S[v].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function b(s,l){var S=1e3*s.levelTargetDuration,v=S/2,y=s.age,R=y>0&&y<S*3,_=l.loading.end-l.loading.start,C,E=s.availabilityDelay;if(s.updated===!1)if(R){var c=333*s.misses;C=Math.max(Math.min(v,_*2),c),s.availabilityDelay=(s.availabilityDelay||0)+C}else C=v;else R?(E=Math.min(E||S/2,y),s.availabilityDelay=E,C=E+S-y):C=S-_;return Math.round(C)}function a(s,l,S){if(!s||!s.details)return null;var v=s.details,y=v.fragments[l-v.startSN];return y||(y=v.fragmentHint,y&&y.sn===l?y:l<v.startSN&&S&&S.sn===l?S:null)}function i(s,l,S){if(!s||!s.details)return null;var v=s.details.partList;if(v)for(var y=v.length;y--;){var R=v[y];if(R.index===S&&R.fragment.sn===l)return R}return null}},"./src/controller/stream-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return v});var X=k("./src/polyfills/number.ts"),U=k("./src/controller/base-stream-controller.ts"),P=k("./src/is-supported.ts"),W=k("./src/events.ts"),B=k("./src/utils/buffer-helper.ts"),O=k("./src/controller/fragment-tracker.ts"),A=k("./src/types/loader.ts"),d=k("./src/loader/fragment.ts"),p=k("./src/demux/transmuxer-interface.ts"),w=k("./src/types/transmuxer.ts"),m=k("./src/controller/gap-controller.ts"),g=k("./src/errors.ts"),b=k("./src/utils/logger.ts");function a(y,R){for(var _=0;_<R.length;_++){var C=R[_];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(y,C.key,C)}}function i(y,R,_){return R&&a(y.prototype,R),_&&a(y,_),y}function s(y,R){y.prototype=Object.create(R.prototype),y.prototype.constructor=y,l(y,R)}function l(y,R){return l=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},l(y,R)}var S=100,v=function(y){s(R,y);function R(C,E){var c;return c=y.call(this,C,E,"[stream-controller]")||this,c.audioCodecSwap=!1,c.gapController=null,c.level=-1,c._forceStartLoad=!1,c.altAudio=!1,c.audioOnly=!1,c.fragPlaying=null,c.onvplaying=null,c.onvseeked=null,c.fragLastKbps=0,c.stalled=!1,c.couldBacktrack=!1,c.audioCodecSwitch=!1,c.videoBuffer=null,c._registerListeners(),c}var _=R.prototype;return _._registerListeners=function(){var E=this.hls;E.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),E.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.on(W.Events.ERROR,this.onError,this),E.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_._unregisterListeners=function(){var E=this.hls;E.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.off(W.Events.ERROR,this.onError,this),E.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},_.startLoad=function(E){if(this.levels){var c=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var h=u.startLevel;h===-1&&(u.config.testBandwidth?(h=0,this.bitrateTest=!0):h=u.nextAutoLevel),this.level=u.nextLoadLevel=h,this.loadedmetadata=!1}c>0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),E=c),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},_.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},_.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var E,c=this.levels,u=this.level,h=c==null||((E=c[u])===null||E===void 0)?void 0:E.details;if(h&&(!h.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(h))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var T,L=self.performance.now(),I=this.retryDate;(!I||L>=I||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},_.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},_.doTickIdle=function(){var E,c,u=this.hls,h=this.levelLastLoaded,T=this.levels,L=this.media,I=u.config,F=u.nextLoadLevel;if(h===null||!L&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!T||!T[F])return;var j=T[F];this.level=u.nextLoadLevel=F;var z=j.details;if(!z||this.state===U.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:L,A.PlaylistLevelType.MAIN);if(M===null)return;var N=M.len,Y=this.getMaxBufferLength(j.maxBitrate);if(N>=Y)return;if(this._streamEnded(M,z)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ee),this.state=U.State.ENDED;return}var le=M.end,pe=this.getNextFragment(le,z);if(this.couldBacktrack&&!this.fragPrevious&&pe&&pe.sn!=="initSegment"){var Oe=pe.sn-z.startSN;Oe>1&&(pe=z.fragments[Oe-1],this.fragmentTracker.removeFragment(pe))}if(pe&&this.fragmentTracker.getState(pe)===O.FragmentState.OK&&this.nextLoadPosition>le){var Te=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(L,Te,A.PlaylistLevelType.MAIN),pe=this.getNextFragment(this.nextLoadPosition,z)}if(!pe)return;pe.initSegment&&!pe.initSegment.data&&!this.bitrateTest&&(pe=pe.initSegment),((E=pe.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((c=pe.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(pe,z):this.loadFragment(pe,z,le)},_.loadFragment=function(E,c,u){var h,T=this.fragmentTracker.getState(E);if(this.fragCurrent=E,T===O.FragmentState.BACKTRACKED){var L=this.fragmentTracker.getBacktrackData(E);if(L){this._handleFragmentLoadProgress(L),this._handleFragmentLoadComplete(L);return}else T=O.FragmentState.NOT_LOADED}T===O.FragmentState.NOT_LOADED||T===O.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,E,c,u)):T===O.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((h=this.media)===null||h===void 0?void 0:h.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},_.getAppendedFrag=function(E){var c=this.fragmentTracker.getAppendedFrag(E,A.PlaylistLevelType.MAIN);return c&&"fragment"in c?c.fragment:c},_.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,A.PlaylistLevelType.MAIN)},_.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},_.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},_.nextLevelSwitch=function(){var E=this.levels,c=this.media;if(c!=null&&c.readyState){var u,h=this.getAppendedFrag(c.currentTime);if(h&&h.start>1&&this.flushMainBuffer(0,h.start-1),!c.paused&&E){var T=this.hls.nextLoadLevel,L=E[T],I=this.fragLastKbps;I&&this.fragCurrent?u=this.fragCurrent.duration*L.maxBitrate/(1e3*I)+1:u=0}else u=0;var F=this.getBufferedFrag(c.currentTime+u);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var z=j.maxStartPTS?j.maxStartPTS:j.start,M=j.duration,N=Math.max(F.end,z+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},_.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},_.flushMainBuffer=function(E,c){y.prototype.flushMainBuffer.call(this,E,c,this.altAudio?"video":null)},_.onMediaAttached=function(E,c){y.prototype.onMediaAttached.call(this,E,c);var u=c.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new m.default(this.config,u,this.fragmentTracker,this.hls)},_.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),y.prototype.onMediaDetaching.call(this)},_.onMediaPlaying=function(){this.tick()},_.onMediaSeeked=function(){var E=this.media,c=E?E.currentTime:null;Object(X.isFiniteNumber)(c)&&this.log("Media seeked to "+c.toFixed(3)),this.tick()},_.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},_.onManifestParsed=function(E,c){var u=!1,h=!1,T;c.levels.forEach(function(L){T=L.audioCodec,T&&(T.indexOf("mp4a.40.2")!==-1&&(u=!0),T.indexOf("mp4a.40.5")!==-1&&(h=!0))}),this.audioCodecSwitch=u&&h&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=c.levels,this.startFragRequested=!1},_.onLevelLoading=function(E,c){var u=this.levels;if(!u||this.state!==U.State.IDLE)return;var h=u[c.level];(!h.details||h.details.live&&this.levelLastLoaded!==c.level||this.waitForCdnTuneIn(h.details))&&(this.state=U.State.WAITING_LEVEL)},_.onLevelLoaded=function(E,c){var u,h=this.levels,T=c.level,L=c.details,I=L.totalduration;if(!h){this.warn("Levels were reset while loading level "+T);return}this.log("Level "+T+" loaded ["+L.startSN+","+L.endSN+"], cc ["+L.startCC+", "+L.endCC+"] duration:"+I);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==c.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var j=h[T],z=0;if(L.live||(u=j.details)!==null&&u!==void 0&&u.live){if(L.fragments[0]||(L.deltaUpdateFailed=!0),L.deltaUpdateFailed)return;z=this.alignPlaylists(L,j.details)}if(j.details=L,this.levelLastLoaded=T,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:L,level:T}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(L))return;this.state=U.State.IDLE}this.startFragRequested?L.live&&this.synchronizeToLiveEdge(L):this.setStartPosition(L,z),this.tick()},_._handleFragmentLoadProgress=function(E){var c,u=E.frag,h=E.part,T=E.payload,L=this.levels;if(!L){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var I=L[u.level],F=I.details;if(!F){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var j=I.videoCodec,z=F.PTSKnown||!F.live,M=(c=u.initSegment)===null||c===void 0?void 0:c.data,N=this._getAudioCodec(I),Y=this.transmuxer=this.transmuxer||new p.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=h?h.index:-1,le=ee!==-1,pe=new w.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,T.byteLength,ee,le),Oe=this.initPTS[u.cc];Y.push(T,M,N,j,u,h,F.totalduration,z,pe,Oe)},_.onAudioTrackSwitching=function(E,c){var u=this.altAudio,h=!!c.url,T=c.id;if(!h){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var L=this.fragCurrent;L!=null&&L.loader&&(this.log("Switching to main audio track, cancel main fragment load"),L.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;u&&I.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:T})}},_.onAudioTrackSwitched=function(E,c){var u=c.id,h=!!this.hls.audioTracks[u].url;if(h){var T=this.videoBuffer;T&&this.mediaBuffer!==T&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=T)}this.altAudio=h,this.tick()},_.onBufferCreated=function(E,c){var u=c.tracks,h,T,L=!1;for(var I in u){var F=u[I];if(F.id==="main"){if(T=I,h=F,I==="video"){var j=u[I];j&&(this.videoBuffer=j.buffer)}}else L=!0}L&&h?(this.log("Alternate track found, use "+T+".buffered to schedule main fragment loading"),this.mediaBuffer=h.buffer):this.mediaBuffer=this.media},_.onFragBuffered=function(E,c){var u=c.frag,h=c.part;if(u&&u.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(h?" p: "+h.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var T=h?h.stats:u.stats;this.fragLastKbps=Math.round(8*T.total/(T.buffering.end-T.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,h)},_.onError=function(E,c){switch(c.details){case g.ErrorDetails.FRAG_LOAD_ERROR:case g.ErrorDetails.FRAG_LOAD_TIMEOUT:case g.ErrorDetails.KEY_LOAD_ERROR:case g.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,c);break;case g.ErrorDetails.LEVEL_LOAD_ERROR:case g.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(c.fatal?(this.warn(""+c.details),this.state=U.State.ERROR):!c.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case g.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var u=!0,h=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);h&&h.len>.5&&(u=!this.reduceMaxBufferLength(h.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},_.checkBuffer=function(){var E=this.media,c=this.gapController;if(!E||!c||!E.readyState)return;var u=B.BufferHelper.getBuffered(E);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):c.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},_.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},_.onBufferFlushed=function(E,c){var u=c.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var h=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(h,u,A.PlaylistLevelType.MAIN)}},_.onLevelsUpdated=function(E,c){this.levels=c.levels},_.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},_.seekToStartPos=function(){var E=this.media,c=E.currentTime,u=this.startPosition;if(u>=0&&c<u){if(E.seeking){b.logger.log("could not seek to "+u+", already seeking at "+c);return}var h=B.BufferHelper.getBuffered(E),T=h.length?h.start(0):0,L=T-u;L>0&&(L<this.config.maxBufferHole||L<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+L+" to match buffer start"),u+=L,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+c),E.currentTime=u}},_._getAudioCodec=function(E){var c=this.config.defaultAudioCodec||E.audioCodec;return this.audioCodecSwap&&c&&(this.log("Swapping audio codec"),c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5"),c},_._loadBitrateTestFrag=function(E){var c=this;this._doFragLoad(E).then(function(u){var h=c.hls;if(!u||h.nextLoadLevel||c.fragContextChanged(E))return;c.fragLoadError=0,c.state=U.State.IDLE,c.startFragRequested=!1,c.bitrateTest=!1;var T=E.stats;T.parsing.start=T.parsing.end=T.buffering.start=T.buffering.end=self.performance.now(),h.trigger(W.Events.FRAG_LOADED,u)})},_._handleTransmuxComplete=function(E){var c,u="main",h=this.hls,T=E.remuxResult,L=E.chunkMeta,I=this.getCurrentContext(L);if(!I){this.warn("The loading context changed while buffering fragment "+L.sn+" of level "+L.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(L.level);return}var F=I.frag,j=I.part,z=I.level,M=T.video,N=T.text,Y=T.id3,ee=T.initSegment,le=this.altAudio?void 0:T.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(z,ee.tracks,F,L),h.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:u,tracks:ee.tracks}));var pe=ee.initPTS,Oe=ee.timescale;Object(X.isFiniteNumber)(pe)&&(this.initPTS[F.cc]=pe,h.trigger(W.Events.INIT_PTS_FOUND,{frag:F,id:u,initPTS:pe,timescale:Oe}))}if(M&&T.independent!==!1){if(z.details){var Te=M.startPTS,Re=M.endPTS,Ae=M.startDTS,we=M.endDTS;if(j)j.elementaryStreams[M.type]={startPTS:Te,endPTS:Re,startDTS:Ae,endDTS:we};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ge=this.getLoadPosition()+this.config.maxBufferHole;if(ge<Te){this.backtrack(F);return}F.setElementaryStreamInfo(M.type,F.start,Re,F.start,we,!0)}F.setElementaryStreamInfo(M.type,Te,Re,Ae,we),this.bufferFragmentData(M,F,j,L)}}else if(T.independent===!1){this.backtrack(F);return}if(le){var de=le.startPTS,re=le.endPTS,ce=le.startDTS,se=le.endDTS;j&&(j.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:re,startDTS:ce,endDTS:se}),F.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,de,re,ce,se),this.bufferFragmentData(le,F,j,L)}if(Y!=null&&(c=Y.samples)!==null&&c!==void 0&&c.length){var ke={frag:F,id:u,samples:Y.samples};h.trigger(W.Events.FRAG_PARSING_METADATA,ke)}if(N){var ie={frag:F,id:u,samples:N.samples};h.trigger(W.Events.FRAG_PARSING_USERDATA,ie)}},_._bufferInitSegment=function(E,c,u,h){var T=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!c.audio&&!c.video,this.altAudio&&!this.audioOnly&&delete c.audio;var L=c.audio,I=c.video,F=c.audiovideo;if(L){var j=E.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),L.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(j="mp4a.40.5")),z.indexOf("android")!==-1&&L.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),E.audioCodec&&E.audioCodec!==j&&this.log('Swapping manifest audio codec "'+E.audioCodec+'" for "'+j+'"'),L.levelCodec=j,L.id="main",this.log("Init audio buffer, container:"+L.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(E.audioCodec||"")+"/"+L.codec+"]")}I&&(I.levelCodec=E.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(E.videoCodec||"")+"/"+I.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(E.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,c),Object.keys(c).forEach(function(M){var N=c[M],Y=N.initSegment;Y!=null&&Y.byteLength&&T.hls.trigger(W.Events.BUFFER_APPENDING,{type:M,data:Y,frag:u,part:null,chunkMeta:h,parent:u.type})}),this.tick()},_.backtrack=function(E){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(E);var c=this.fragmentTracker.backtrack(E);this.fragPrevious=null,this.nextLoadPosition=E.start,c?this.resetFragmentLoading(E):this.state=U.State.BACKTRACKING},_.checkFragmentChanged=function(){var E=this.media,c=null;if(E&&E.readyState>1&&E.seeking===!1){var u=E.currentTime;if(B.BufferHelper.isBuffered(E,u)?c=this.getAppendedFrag(u):B.BufferHelper.isBuffered(E,u+.1)&&(c=this.getAppendedFrag(u+.1)),c){var h=this.fragPlaying,T=c.level;(!h||c.sn!==h.sn||h.level!==T||c.urlId!==h.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:c}),(!h||h.level!==T)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:T}),this.fragPlaying=c)}}},i(R,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var c=this.getAppendedFrag(E.currentTime);if(c)return c.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var c=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(c)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"SubtitleStreamController",function(){return s});var X=k("./src/events.ts"),U=k("./src/utils/logger.ts"),P=k("./src/utils/buffer-helper.ts"),W=k("./src/controller/fragment-finders.ts"),B=k("./src/utils/discontinuities.ts"),O=k("./src/controller/level-helper.ts"),A=k("./src/controller/fragment-tracker.ts"),d=k("./src/controller/base-stream-controller.ts"),p=k("./src/types/loader.ts"),w=k("./src/types/level.ts");function m(l,S){for(var v=0;v<S.length;v++){var y=S[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}function g(l,S,v){return S&&m(l.prototype,S),v&&m(l,v),l}function b(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,a(l,S)}function a(l,S){return a=Object.setPrototypeOf||function(y,R){return y.__proto__=R,y},a(l,S)}var i=500,s=function(l){b(S,l);function S(y,R){var _;return _=l.call(this,y,R,"[subtitle-stream-controller]")||this,_.levels=[],_.currentTrackId=-1,_.tracksBuffered=[],_.mainDetails=null,_._registerListeners(),_}var v=S.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var R=this.hls;R.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.on(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on(X.Events.ERROR,this.onError,this),R.on(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.on(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.on(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var R=this.hls;R.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.off(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off(X.Events.ERROR,this.onError,this),R.off(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.off(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.off(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(i),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(R,_){this.mainDetails=_.details},v.onSubtitleFragProcessed=function(R,_){var C=_.frag,E=_.success;if(this.fragPrevious=C,this.state=d.State.IDLE,!E)return;var c=this.tracksBuffered[this.currentTrackId];if(!c)return;for(var u,h=C.start,T=0;T<c.length;T++)if(h>=c[T].start&&h<=c[T].end){u=c[T];break}var L=C.start+C.duration;u?u.end=L:(u={start:h,end:L},c.push(u)),this.fragmentTracker.fragBuffered(C)},v.onBufferFlushing=function(R,_){var C=_.startOffset,E=_.endOffset;if(C===0&&E!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,u=this.levels;if(!u.length||!u[c]||!u[c].details)return;var h=u[c].details,T=h.targetduration,L=E-T;if(L<=0)return;_.endOffsetSubtitles=Math.max(0,L),this.tracksBuffered.forEach(function(I){for(var F=0;F<I.length;){if(I[F].end<=L){I.shift();continue}else if(I[F].start<L)I[F].start=L;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(C,L,p.PlaylistLevelType.SUBTITLE)}},v.onError=function(R,_){var C,E=_.frag;if(!E||E.type!==p.PlaylistLevelType.SUBTITLE)return;(C=this.fragCurrent)!==null&&C!==void 0&&C.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},v.onSubtitleTracksUpdated=function(R,_){var C=this,E=_.subtitleTracks;this.tracksBuffered=[],this.levels=E.map(function(c){return new w.Level(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){C.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(R,_){if(this.currentTrackId=_.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var C=this.levels[this.currentTrackId];C!=null&&C.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,C&&this.setInterval(i)},v.onSubtitleTrackLoaded=function(R,_){var C,E=_.details,c=_.id,u=this.currentTrackId,h=this.levels;if(!h.length)return;var T=h[u];if(c>=h.length||c!==u||!T)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(C=T.details)!==null&&C!==void 0&&C.live){var L=this.mainDetails;if(E.deltaUpdateFailed||!L)return;var I=L.fragments[0];if(!T.details)E.hasProgramDateTime&&L.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(E,L):I&&Object(O.addSliding)(E,I.start);else{var F=this.alignPlaylists(E,T.details);F===0&&I&&Object(O.addSliding)(E,I.start)}}if(T.details=E,this.levelLastLoaded=c,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var j=Object(W.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),T.details=void 0)}},v._handleFragmentLoadComplete=function(R){var _=R.frag,C=R.payload,E=_.decryptdata,c=this.hls;if(this.fragContextChanged(_))return;if(C&&C.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(C),E.key.buffer,E.iv.buffer).then(function(h){var T=performance.now();c.trigger(X.Events.FRAG_DECRYPTED,{frag:_,payload:h,stats:{tstart:u,tdecrypt:T}})})}},v.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var R,_=this.currentTrackId,C=this.levels;if(!C.length||!C[_]||!C[_].details)return;var E=C[_].details,c=E.targetduration,u=this.config,h=this.media,T=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,h.currentTime-c,u.maxBufferHole),L=T.end,I=T.len,F=this.getMaxBufferLength()+c;if(I>F)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var j=E.fragments,z=j.length,M=E.edge,N,Y=this.fragPrevious;if(L<M){var ee=u.maxFragLookUpTolerance;Y&&E.hasProgramDateTime&&(N=Object(W.findFragmentByPDT)(j,Y.endProgramDateTime,ee)),N||(N=Object(W.findFragmentByPTS)(Y,j,L,ee),!N&&Y&&Y.start<j[0].start&&(N=j[0]))}else N=j[z-1];(R=N)!==null&&R!==void 0&&R.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=d.State.KEY_LOADING,this.hls.trigger(X.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===A.FragmentState.NOT_LOADED&&this.loadFragment(N,E,L)}},v.loadFragment=function(R,_,C){this.fragCurrent=R,l.prototype.loadFragment.call(this,R,_,C)},g(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/events.ts"),U=k("./src/utils/texttrack-utils.ts"),P=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function B(m,g){for(var b=0;b<g.length;b++){var a=g[b];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(m,a.key,a)}}function O(m,g,b){return g&&B(m.prototype,g),b&&B(m,b),m}function A(m,g){m.prototype=Object.create(g.prototype),m.prototype.constructor=m,d(m,g)}function d(m,g){return d=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},d(m,g)}var p=function(m){A(g,m);function g(a){var i;return i=m.call(this,a,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}var b=g.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,m.prototype.destroy.call(this)},b.registerListeners=function(){var i=this.hls;i.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(X.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var i=this.hls;i.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(X.Events.ERROR,this.onError,this)},b.onMediaAttached=function(i,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var i=w(this.media.textTracks);i.forEach(function(s){Object(U.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(i,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(i,s){var l=s.id,S=s.details,v=this.trackId,y=this.tracksInGroup[v];if(!y){this.warn("Invalid subtitle track id "+l);return}var R=y.details;y.details=s.details,this.log("subtitle track "+l+" loaded ["+S.startSN+"-"+S.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,R))},b.onLevelLoading=function(i,s){this.switchLevel(s.level)},b.onLevelSwitching=function(i,s){this.switchLevel(s.level)},b.switchLevel=function(i){var s=this.hls.levels[i];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(_){return!l||_.groupId===l});this.tracksInGroup=v;var y=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=l;var R={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(X.Events.SUBTITLE_TRACKS_UPDATED,R),y!==-1&&this.setSubtitleTrack(y,S)}},b.findTrackId=function(i){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var S=s[l];if((!this.selectDefaultTrack||S.default)&&(!i||i===S.name))return S.id}return-1},b.onError=function(i,s){if(m.prototype.onError.call(this,i,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(i){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,S=s.groupId,v=s.url;if(i)try{v=i.addDirectives(v)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(X.Events.SUBTITLE_TRACK_LOADING,{url:v,id:l,groupId:S,deliveryDirectives:i||null})}},b.toggleTrackModes=function(i){var s=this,l=this.media,S=this.subtitleDisplay,v=this.trackId;if(!l)return;var y=w(l.textTracks),R=y.filter(function(E){return E.groupId===s.groupId});if(i===-1)[].slice.call(y).forEach(function(E){E.mode="disabled"});else{var _=R[v];_&&(_.mode="disabled")}var C=R[i];C&&(C.mode=S?"showing":"hidden")},b.setSubtitleTrack=function(i,s){var l,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(l=S[i])!==null&&l!==void 0&&l.details)||i<-1||i>=S.length)return;this.clearTimer();var v=S[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,v){var y=v.id,R=v.groupId,_=R===void 0?"":R,C=v.name,E=v.type,c=v.url;this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:y,groupId:_,name:C,type:E,url:c});var u=this.switchParams(v.url,s==null?void 0:s.details);this.loadPlaylist(u)}else this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:i})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,s=w(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")i=l;else if(s[l].mode==="showing"){i=l;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},O(g,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,s)}}]),g}(P.default);function w(m){for(var g=[],b=0;b<m.length;b++){var a=m[b];a.kind==="subtitles"&&a.label&&g.push(m[b])}return g}J.default=p},"./src/controller/timeline-controller.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"TimelineController",function(){return w});var X=k("./src/polyfills/number.ts"),U=k("./src/events.ts"),P=k("./src/utils/cea-608-parser.ts"),W=k("./src/utils/output-filter.ts"),B=k("./src/utils/webvtt-parser.ts"),O=k("./src/utils/texttrack-utils.ts"),A=k("./src/utils/imsc1-ttml-parser.ts"),d=k("./src/types/loader.ts"),p=k("./src/utils/logger.ts"),w=function(){function a(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new W.default(this,"textTrack1"),S=new W.default(this,"textTrack2"),v=new W.default(this,"textTrack3"),y=new W.default(this,"textTrack4");this.cea608Parser1=new P.default(1,l,S),this.cea608Parser2=new P.default(3,v,y)}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 i=a.prototype;return i.destroy=function(){var l=this.hls;l.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(U.Events.FRAG_LOADING,this.onFragLoading,this),l.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(l,S,v,y,R){for(var _=!1,C=R.length;C--;){var E=R[C],c=g(E[0],E[1],S,v);if(c>=0&&(E[0]=Math.min(E[0],S),E[1]=Math.max(E[1],v),_=!0,c/(v-S)>.5))return}if(_||R.push([S,v]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,S,v,y)}else{var h=this.Cues.newCue(null,S,v,y);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:h,track:l})}},i.onInitPtsFound=function(l,S){var v=this,y=S.frag,R=S.id,_=S.initPTS,C=S.timescale,E=this.unparsedVttFrags;R==="main"&&(this.initPTS[y.cc]=_,this.timescale[y.cc]=C),E.length&&(this.unparsedVttFrags=[],E.forEach(function(c){v.onFragLoaded(U.Events.FRAG_LOADED,c)}))},i.getExistingTrack=function(l){var S=this.media;if(S)for(var v=0;v<S.textTracks.length;v++){var y=S.textTracks[v];if(y[l])return y}return null},i.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},i.createNativeTrack=function(l){if(this.captionsTracks[l])return;var S=this.captionsProperties,v=this.captionsTracks,y=this.media,R=S[l],_=R.label,C=R.languageCode,E=this.getExistingTrack(l);if(E)v[l]=E,Object(O.clearCurrentCues)(v[l]),Object(O.sendAddTrackEvent)(v[l],y);else{var c=this.createTextTrack("captions",_,C);c&&(c[l]=!0,v[l]=c)}},i.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var S=this.captionsProperties[l];if(!S)return;var v=S.label,y={_id:l,label:v,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[l]=y,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[y]})},i.createTextTrack=function(l,S,v){var y=this.media;return y?y.addTextTrack(l,S,v):void 0},i.onMediaAttaching=function(l,S){this.media=S.media,this._cleanTracks()},i.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(S){Object(O.clearCurrentCues)(l[S]),delete l[S]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},i._cleanTracks=function(){var l=this.media;if(!l)return;var S=l.textTracks;if(S)for(var v=0;v<S.length;v++)Object(O.clearCurrentCues)(S[v])},i.onSubtitleTracksUpdated=function(l,S){var v=this;this.textTracks=[];var y=S.subtitleTracks||[],R=y.some(function(c){return c.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||R&&this.config.enableIMSC1){var _=this.tracks&&y&&this.tracks.length===y.length;if(this.tracks=y||[],this.config.renderTextTracksNatively){var C=this.media?this.media.textTracks:[];this.tracks.forEach(function(c,u){var h;if(u<C.length){for(var T=null,L=0;L<C.length;L++)if(m(C[L],c)){T=C[L];break}T&&(h=T)}h?Object(O.clearCurrentCues)(h):(h=v.createTextTrack("subtitles",c.name,c.lang),h&&(h.mode="disabled")),h&&(h.groupId=c.groupId,v.textTracks.push(h))})}else if(!_&&this.tracks&&this.tracks.length){var E=this.tracks.map(function(c){return{label:c.name,kind:c.type.toLowerCase(),default:c.default,subtitleTrack:c}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:E})}}},i.onManifestLoaded=function(l,S){var v=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(y){var R=/(?:CC|SERVICE)([1-4])/.exec(y.instreamId);if(!R)return;var _="textTrack"+R[1],C=v.captionsProperties[_];if(!C)return;C.label=y.name,y.lang&&(C.languageCode=y.lang),C.media=y})},i.onFragLoading=function(l,S){var v=this.cea608Parser1,y=this.cea608Parser2,R=this.lastSn,_=this.lastPartIndex;if(!this.enabled||!(v&&y))return;if(S.frag.type===d.PlaylistLevelType.MAIN){var C,E,c=S.frag.sn,u=(C=S==null||((E=S.part)===null||E===void 0)?void 0:E.index)!=null?C:-1;c===R+1||c===R&&u===_+1||(v.reset(),y.reset()),this.lastSn=c,this.lastPartIndex=u}},i.onFragLoaded=function(l,S){var v=S.frag,y=S.payload,R=this.initPTS,_=this.unparsedVttFrags;if(v.type===d.PlaylistLevelType.SUBTITLE)if(y.byteLength){if(!Object(X.isFiniteNumber)(R[v.cc])){_.push(S),R.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var C=v.decryptdata;if(C==null||C.key==null||C.method!=="AES-128"){var E=this.tracks[v.level],c=this.vttCCs;c[v.cc]||(c[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),E&&E.textCodec===A.IMSC1_CODEC?this._parseIMSC1(v,y):this._parseVTTs(v,y,c)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(l,S){var v=this,y=this.hls;Object(A.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(R){v._appendCues(R,l.level),y.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(R){p.logger.log("Failed to parse IMSC1: "+R),y.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:R})})},i._parseVTTs=function(l,S,v){var y=this,R=this.hls;Object(B.parseWebVTT)(S,this.initPTS[l.cc],this.timescale[l.cc],v,l.cc,l.start,function(_){y._appendCues(_,l.level),R.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(_){y._fallbackToIMSC1(l,S),p.logger.log("Failed to parse VTT cue: "+_),R.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:_})})},i._fallbackToIMSC1=function(l,S){var v=this,y=this.tracks[l.level];y.textCodec||Object(A.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(){y.textCodec=A.IMSC1_CODEC,v._parseIMSC1(l,S)},function(){y.textCodec="wvtt"})},i._appendCues=function(l,S){var v=this.hls;if(this.config.renderTextTracksNatively){var y=this.textTracks[S];if(y.mode==="disabled")return;l.forEach(function(C){return Object(O.addCueToTrack)(y,C)})}else{var R=this.tracks[S],_=R.default?"default":"subtitles"+S;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:l,track:_})}},i.onFragDecrypted=function(l,S){var v=S.frag;if(v.type===d.PlaylistLevelType.SUBTITLE){if(!Object(X.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(U.Events.FRAG_LOADED,S)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(l,S){var v=this.cea608Parser1,y=this.cea608Parser2;if(!this.enabled||!(v&&y))return;for(var R=0;R<S.samples.length;R++){var _=S.samples[R].bytes;if(_){var C=this.extractCea608Data(_);v.addData(S.samples[R].pts,C[0]),y.addData(S.samples[R].pts,C[1])}}},i.onBufferFlushing=function(l,S){var v=S.startOffset,y=S.endOffset,R=S.endOffsetSubtitles,_=S.type,C=this.media;if(!C||C.currentTime<y)return;if(!_||_==="video"){var E=this.captionsTracks;Object.keys(E).forEach(function(u){return Object(O.removeCuesInRange)(E[u],v,y)})}if(this.config.renderTextTracksNatively&&(v===0&&R!==void 0)){var c=this.textTracks;Object.keys(c).forEach(function(u){return Object(O.removeCuesInRange)(c[u],v,R)})}},i.extractCea608Data=function(l){for(var S=l[0]&31,v=2,y=[[],[]],R=0;R<S;R++){var _=l[v++],C=127&l[v++],E=127&l[v++],c=(4&_)!==0,u=3&_;if(C===0&&E===0)continue;c&&((u===0||u===1)&&(y[u].push(C),y[u].push(E)))}return y},a}();function m(a,i){return a&&a.label===i.name&&!(a.textTrack1||a.textTrack2)}function g(a,i,s,l){return Math.min(i,l)-Math.max(a,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return X});var X=function(){function U(W,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=B}var P=U.prototype;return P.decrypt=function(B,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,B)},U}()},"./src/crypt/aes-decryptor.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"removePadding",function(){return U}),k.d(J,"default",function(){return P});var X=k("./src/utils/typed-array.ts");function U(W){var B=W.byteLength,O=B&&new DataView(W.buffer).getUint8(B-1);return O?Object(X.sliceUint8)(W,0,B-O):W}var P=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 B=W.prototype;return B.uint8ArrayToUint32Array_=function(A){for(var d=new DataView(A),p=new Uint32Array(4),w=0;w<4;w++)p[w]=d.getUint32(w*4);return p},B.initTable=function(){var A=this.sBox,d=this.invSBox,p=this.subMix,w=p[0],m=p[1],g=p[2],b=p[3],a=this.invSubMix,i=a[0],s=a[1],l=a[2],S=a[3],v=new Uint32Array(256),y=0,R=0,_=0;for(_=0;_<256;_++)_<128?v[_]=_<<1:v[_]=_<<1^283;for(_=0;_<256;_++){var C=R^R<<1^R<<2^R<<3^R<<4;C=C>>>8^C&255^99,A[y]=C,d[C]=y;var E=v[y],c=v[E],u=v[c],h=v[C]*257^C*16843008;w[y]=h<<24|h>>>8,m[y]=h<<16|h>>>16,g[y]=h<<8|h>>>24,b[y]=h,h=u*16843009^c*65537^E*257^y*16843008,i[C]=h<<24|h>>>8,s[C]=h<<16|h>>>16,l[C]=h<<8|h>>>24,S[C]=h,y?(y=E^v[v[v[u^E]]],R^=v[v[R]]):y=R=1}},B.expandKey=function(A){for(var d=this.uint8ArrayToUint32Array_(A),p=!0,w=0;w<d.length&&p;)p=d[w]===this.key[w],w++;if(p)return;this.key=d;var m=this.keySize=d.length;if(m!==4&&m!==6&&m!==8)throw new Error("Invalid aes key size="+m);var g=this.ksRows=(m+6+1)*4,b,a,i=this.keySchedule=new Uint32Array(g),s=this.invKeySchedule=new Uint32Array(g),l=this.sBox,S=this.rcon,v=this.invSubMix,y=v[0],R=v[1],_=v[2],C=v[3],E,c;for(b=0;b<g;b++){if(b<m){E=i[b]=d[b];continue}c=E,b%m===0?(c=c<<8|c>>>24,c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255],c^=S[b/m|0]<<24):m>6&&b%m===4&&(c=l[c>>>24]<<24|l[c>>>16&255]<<16|l[c>>>8&255]<<8|l[c&255]),i[b]=E=(i[b-m]^c)>>>0}for(a=0;a<g;a++)b=g-a,a&3?c=i[b]:c=i[b-4],a<4||b<=4?s[a]=c:s[a]=y[l[c>>>24]]^R[l[c>>>16&255]]^_[l[c>>>8&255]]^C[l[c&255]],s[a]=s[a]>>>0},B.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},B.decrypt=function(A,d,p){for(var w=this.keySize+6,m=this.invKeySchedule,g=this.invSBox,b=this.invSubMix,a=b[0],i=b[1],s=b[2],l=b[3],S=this.uint8ArrayToUint32Array_(p),v=S[0],y=S[1],R=S[2],_=S[3],C=new Int32Array(A),E=new Int32Array(C.length),c,u,h,T,L,I,F,j,z,M,N,Y,ee,le,pe=this.networkToHostOrderSwap;d<C.length;){for(z=pe(C[d]),M=pe(C[d+1]),N=pe(C[d+2]),Y=pe(C[d+3]),L=z^m[0],I=Y^m[1],F=N^m[2],j=M^m[3],ee=4,le=1;le<w;le++)c=a[L>>>24]^i[I>>16&255]^s[F>>8&255]^l[j&255]^m[ee],u=a[I>>>24]^i[F>>16&255]^s[j>>8&255]^l[L&255]^m[ee+1],h=a[F>>>24]^i[j>>16&255]^s[L>>8&255]^l[I&255]^m[ee+2],T=a[j>>>24]^i[L>>16&255]^s[I>>8&255]^l[F&255]^m[ee+3],L=c,I=u,F=h,j=T,ee=ee+4;c=g[L>>>24]<<24^g[I>>16&255]<<16^g[F>>8&255]<<8^g[j&255]^m[ee],u=g[I>>>24]<<24^g[F>>16&255]<<16^g[j>>8&255]<<8^g[L&255]^m[ee+1],h=g[F>>>24]<<24^g[j>>16&255]<<16^g[L>>8&255]<<8^g[I&255]^m[ee+2],T=g[j>>>24]<<24^g[L>>16&255]<<16^g[I>>8&255]<<8^g[F&255]^m[ee+3],E[d]=pe(c^v),E[d+1]=pe(T^y),E[d+2]=pe(h^R),E[d+3]=pe(u^_),v=z,y=M,R=N,_=Y,d=d+4}return E.buffer},W}()},"./src/crypt/decrypter.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return d});var X=k("./src/crypt/aes-crypto.ts"),U=k("./src/crypt/fast-aes-key.ts"),P=k("./src/crypt/aes-decryptor.ts"),W=k("./src/utils/logger.ts"),B=k("./src/utils/mp4-tools.ts"),O=k("./src/utils/typed-array.ts"),A=16,d=function(){function p(m,g,b){var a=b===void 0?{}:b,i=a.removePKCS7Padding,s=i===void 0?!0:i;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=m,this.config=g,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var w=p.prototype;return w.destroy=function(){this.observer=null},w.isSync=function(){return this.config.enableSoftwareAES},w.flush=function(){var g=this.currentResult;if(!g){this.reset();return}var b=new Uint8Array(g);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},w.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},w.decrypt=function(g,b,a,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(g),b,a);var s=this.flush();s&&i(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(g),b,a).then(i)},w.softwareDecrypt=function(g,b,a){var i=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(g=Object(B.appendUint8Array)(l,g),this.remainderData=null);var S=this.getValidChunk(g);if(!S.length)return null;i&&(a=i);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new P.default),v.expandKey(b);var y=s;return this.currentResult=v.decrypt(S.buffer,0,a),this.currentIV=Object(O.sliceUint8)(S,-16).buffer,y||null},w.webCryptoDecrypt=function(g,b,a){var i=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new U.default(s,b)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new X.default(s,a);return S.decrypt(g.buffer,l)}).catch(function(l){return i.onWebCryptoError(l,g,b,a)})},w.onWebCryptoError=function(g,b,a,i){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",g),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,a,i)},w.getValidChunk=function(g){var b=g,a=g.length-g.length%A;return a!==g.length&&(b=Object(O.sliceUint8)(g,0,a),this.remainderData=Object(O.sliceUint8)(g,a)),b},w.logOnce=function(g){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+g),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return X});var X=function(){function U(W,B){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=B}var P=U.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/demux/base-audio-demuxer.ts"),U=k("./src/demux/adts.ts"),P=k("./src/utils/logger.ts"),W=k("./src/demux/id3.ts");function B(d,p){d.prototype=Object.create(p.prototype),d.prototype.constructor=d,O(d,p)}function O(d,p){return O=Object.setPrototypeOf||function(m,g){return m.__proto__=g,m},O(d,p)}var A=function(d){B(p,d);function p(m,g){var b;return b=d.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=m,b.config=g,b}var w=p.prototype;return w.resetInitSegment=function(g,b,a){d.prototype.resetInitSegment.call(this,g,b,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:g,duration:a,inputTimeScale:9e4,dropped:0}},p.probe=function(g){if(!g)return!1;for(var b=W.getID3Data(g,0)||[],a=b.length,i=g.length;a<i;a++)if(U.probe(g,a))return P.logger.log("ADTS sync word found !"),!0;return!1},w.canParse=function(g,b){return U.canParse(g,b)},w.appendFrame=function(g,b,a){U.initTrackConfig(g,this.observer,b,a,g.manifestCodec);var i=U.appendFrame(g,b,a,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},p}(X.default);A.minProbeByteLength=9,J.default=A},"./src/demux/adts.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"getAudioConfig",function(){return W}),k.d(J,"isHeaderPattern",function(){return B}),k.d(J,"getHeaderLength",function(){return O}),k.d(J,"getFullFrameLength",function(){return A}),k.d(J,"canGetFrameLength",function(){return d}),k.d(J,"isHeader",function(){return p}),k.d(J,"canParse",function(){return w}),k.d(J,"probe",function(){return m}),k.d(J,"initTrackConfig",function(){return g}),k.d(J,"getFrameDuration",function(){return b}),k.d(J,"parseFrameHeader",function(){return a}),k.d(J,"appendFrame",function(){return i});var X=k("./src/utils/logger.ts"),U=k("./src/errors.ts"),P=k("./src/events.ts");function W(s,l,S,v){var y,R,_,C,E=navigator.userAgent.toLowerCase(),c=v,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];y=((l[S+2]&192)>>>6)+1;var h=(l[S+2]&60)>>>2;if(h>u.length-1){s.trigger(P.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+h});return}return _=(l[S+2]&1)<<2,_|=(l[S+3]&192)>>>6,X.logger.log("manifest codec:"+v+", ADTS type:"+y+", samplingIndex:"+h),/firefox/i.test(E)?h>=6?(y=5,C=new Array(4),R=h-3):(y=2,C=new Array(2),R=h):E.indexOf("android")!==-1?(y=2,C=new Array(2),R=h):(y=5,C=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&h>=6?R=h-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(h>=6&&_===1||/vivaldi/i.test(E))||!v&&_===1)&&(y=2,C=new Array(2)),R=h)),C[0]=y<<3,C[0]|=(h&14)>>1,C[1]|=(h&1)<<7,C[1]|=_<<3,y===5&&(C[1]|=(R&14)>>1,C[2]=(R&1)<<7,C[2]|=2<<2,C[3]=0),{config:C,samplerate:u[h],channelCount:_,codec:"mp4a.40."+y,manifestCodec:c}}function B(s,l){return s[l]===255&&(s[l+1]&246)===240}function O(s,l){return s[l+1]&1?7:9}function A(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function d(s,l){return l+5<s.length}function p(s,l){return l+1<s.length&&B(s,l)}function w(s,l){return d(s,l)&&B(s,l)&&A(s,l)<=s.length-l}function m(s,l){if(p(s,l)){var S=O(s,l);if(l+S>=s.length)return!1;var v=A(s,l);if(v<=S)return!1;var y=l+v;return y===s.length||p(s,y)}return!1}function g(s,l,S,v,y){if(!s.samplerate){var R=W(l,S,v,y);if(!R)return;s.config=R.config,s.samplerate=R.samplerate,s.channelCount=R.channelCount,s.codec=R.codec,s.manifestCodec=R.manifestCodec,X.logger.log("parsed codec:"+s.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function b(s){return 1024*9e4/s}function a(s,l,S,v,y){var R=O(s,l),_=A(s,l);if(_-=R,_>0){var C=S+v*y;return{headerLength:R,frameLength:_,stamp:C}}}function i(s,l,S,v,y){var R=b(s.samplerate),_=a(l,S,v,y,R);if(_){var C=_.frameLength,E=_.headerLength,c=_.stamp,u=E+C,h=Math.max(0,S+u-l.length),T;h?(T=new Uint8Array(u-E),T.set(l.subarray(S+E,l.length),0)):T=l.subarray(S+E,S+u);var L={unit:T,pts:c};return h||s.samples.push(L),{sample:L,length:u,missing:h}}}},"./src/demux/base-audio-demuxer.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"initPTSFn",function(){return A});var X=k("./src/polyfills/number.ts"),U=k("./src/demux/id3.ts"),P=k("./src/demux/dummy-demuxed-track.ts"),W=k("./src/utils/mp4-tools.ts"),B=k("./src/utils/typed-array.ts"),O=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=d.prototype;return p.resetInitSegment=function(m,g,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(m,g){return!1},p.appendFrame=function(m,g,b){},p.demux=function(m,g){this.cachedData&&(m=Object(W.appendUint8Array)(this.cachedData,m),this.cachedData=null);var b=U.getID3Data(m,0),a=b?b.length:0,i,s,l=this._audioTrack,S=this._id3Track,v=b?U.getTimeStamp(b):void 0,y=m.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(v,g)),b&&b.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;a<y;){if(this.canParse(m,a)){var R=this.appendFrame(l,m,a);R?(this.frameIndex++,s=R.sample.pts,a+=R.length,i=a):a=y}else U.canParse(m,a)?(b=U.getID3Data(m,a),S.samples.push({pts:s,dts:s,data:b}),a+=b.length,i=a):a++;if(a===y&&i!==y){var _=Object(B.sliceUint8)(m,i);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,_):this.cachedData=_}}return{audioTrack:l,avcTrack:Object(P.dummyTrack)(),id3Track:S,textTrack:Object(P.dummyTrack)()}},p.demuxSampleAes=function(m,g,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(m){var g=this.cachedData;return g&&(this.cachedData=null,this.demux(g,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},p.destroy=function(){},d}(),A=function(p,w){return Object(X.isFiniteNumber)(p)?p*90:w*9e4};J.default=O},"./src/demux/chunk-cache.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return X});var X=function(){function P(){this.chunks=[],this.dataLength=0}var W=P.prototype;return W.push=function(O){this.chunks.push(O),this.dataLength+=O.length},W.flush=function(){var O=this.chunks,A=this.dataLength,d;if(O.length)O.length===1?d=O[0]:d=U(O,A);else return new Uint8Array(0);return this.reset(),d},W.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function U(P,W){for(var B=new Uint8Array(W),O=0,A=0;A<P.length;A++){var d=P[A];B.set(d,O),O+=d.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"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(ue,J,k){"use strict";k.r(J);var X=k("./src/utils/logger.ts"),U=function(){function P(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var W=P.prototype;return W.loadWord=function(){var O=this.data,A=this.bytesAvailable,d=O.byteLength-A,p=new Uint8Array(4),w=Math.min(4,A);if(w===0)throw new Error("no bytes available");p.set(O.subarray(d,d+w)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=w*8,this.bytesAvailable-=w},W.skipBits=function(O){var A;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,A=O>>3,O-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},W.readBits=function(O){var A=Math.min(this.bitsAvailable,O),d=this.word>>>32-A;return O>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=O-A,A>0&&this.bitsAvailable?d<<A|this.readBits(A):d},W.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},W.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>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(O){for(var A=8,d=8,p,w=0;w<O;w++)d!==0&&(p=this.readEG(),d=(A+p+256)%256),A=d===0?A:d},W.readSPS=function(){var O=0,A=0,d=0,p=0,w,m,g,b=this.readUByte.bind(this),a=this.readBits.bind(this),i=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),S=this.skipEG.bind(this),v=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);b();var R=b();if(a(5),l(3),b(),v(),R===100||R===110||R===122||R===244||R===44||R===83||R===86||R===118||R===128){var _=i();if(_===3&&l(1),v(),v(),l(1),s())for(m=_!==3?8:12,g=0;g<m;g++)s()&&(g<6?y(16):y(64))}v();var C=i();if(C===0)i();else if(C===1)for(l(1),S(),S(),w=i(),g=0;g<w;g++)S();v(),l(1);var E=i(),c=i(),u=a(1);u===0&&l(1),l(1),s()&&(O=i(),A=i(),d=i(),p=i());var h=[1,1];if(s()&&s()){var T=b();switch(T){case 1:h=[1,1];break;case 2:h=[12,11];break;case 3:h=[10,11];break;case 4:h=[16,11];break;case 5:h=[40,33];break;case 6:h=[24,11];break;case 7:h=[20,11];break;case 8:h=[32,11];break;case 9:h=[80,33];break;case 10:h=[18,11];break;case 11:h=[15,11];break;case 12:h=[64,33];break;case 13:h=[160,99];break;case 14:h=[4,3];break;case 15:h=[3,2];break;case 16:h=[2,1];break;case 255:{h=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((E+1)*16-O*2-A*2),height:(2-u)*(c+1)*16-(u?2:4)*(d+p),pixelRatio:h}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();J.default=U},"./src/demux/id3.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"isHeader",function(){return X}),k.d(J,"isFooter",function(){return U}),k.d(J,"getID3Data",function(){return P}),k.d(J,"canParse",function(){return B}),k.d(J,"getTimeStamp",function(){return O}),k.d(J,"isTimeStampFrame",function(){return A}),k.d(J,"getID3Frames",function(){return p}),k.d(J,"decodeFrame",function(){return w}),k.d(J,"utf8ArrayToStr",function(){return i}),k.d(J,"testables",function(){return s});var X=function(y,R){return R+10<=y.length&&(y[R]===73&&y[R+1]===68&&y[R+2]===51&&(y[R+3]<255&&y[R+4]<255&&(y[R+6]<128&&y[R+7]<128&&y[R+8]<128&&y[R+9]<128)))},U=function(y,R){return R+10<=y.length&&(y[R]===51&&y[R+1]===68&&y[R+2]===73&&(y[R+3]<255&&y[R+4]<255&&(y[R+6]<128&&y[R+7]<128&&y[R+8]<128&&y[R+9]<128)))},P=function(y,R){for(var _=R,C=0;X(y,R);){C+=10;var E=W(y,R+6);C+=E,U(y,R+10)&&(C+=10),R+=C}return C>0?y.subarray(_,_+C):void 0},W=function(y,R){var _=0;return _=(y[R]&127)<<21,_|=(y[R+1]&127)<<14,_|=(y[R+2]&127)<<7,_|=y[R+3]&127,_},B=function(y,R){return X(y,R)&&W(y,R+6)+10<=y.length-R},O=function(y){for(var R=p(y),_=0;_<R.length;_++){var C=R[_];if(A(C))return a(C)}return},A=function(y){return y&&y.key==="PRIV"&&y.info==="com.apple.streaming.transportStreamTimestamp"},d=function(y){var R=String.fromCharCode(y[0],y[1],y[2],y[3]),_=W(y,4),C=10;return{type:R,size:_,data:y.subarray(C,C+_)}},p=function(y){for(var R=0,_=[];X(y,R);){var C=W(y,R+6);R+=10;for(var E=R+C;R+8<E;){var c=d(y.subarray(R)),u=w(c);u&&_.push(u),R+=c.size+10}U(y,R)&&(R+=10)}return _},w=function(y){return y.type==="PRIV"?m(y):y.type[0]==="W"?b(y):g(y)},m=function(y){if(y.size<2)return;var R=i(y.data,!0),_=new Uint8Array(y.data.subarray(R.length+1));return{key:y.type,info:R,data:_.buffer}},g=function(y){if(y.size<2)return;if(y.type==="TXXX"){var R=1,_=i(y.data.subarray(R),!0);R+=_.length+1;var C=i(y.data.subarray(R));return{key:y.type,info:_,data:C}}var E=i(y.data.subarray(1));return{key:y.type,data:E}},b=function(y){if(y.type==="WXXX"){if(y.size<2)return;var R=1,_=i(y.data.subarray(R),!0);R+=_.length+1;var C=i(y.data.subarray(R));return{key:y.type,info:_,data:C}}var E=i(y.data);return{key:y.type,data:E}},a=function(y){if(y.data.byteLength===8){var R=new Uint8Array(y.data),_=R[3]&1,C=(R[4]<<23)+(R[5]<<15)+(R[6]<<7)+R[7];return C/=45,_&&(C+=4772185884e-2),Math.round(C)}return},i=function(y,R){R===void 0&&(R=!1);var _=S();if(_){var C=_.decode(y);if(R){var E=C.indexOf("\0");return E!==-1?C.substring(0,E):C}return C.replace(/\0/g,"")}for(var c=y.length,u,h,T,L="",I=0;I<c;){if(u=y[I++],u===0&&R)return L;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:L+=String.fromCharCode(u);break;case 12:case 13:h=y[I++],L+=String.fromCharCode((u&31)<<6|h&63);break;case 14:h=y[I++],T=y[I++],L+=String.fromCharCode((u&15)<<12|(h&63)<<6|(T&63)<<0);break;default:}}return L},s={decodeTextFrame:g},l;function S(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/demux/base-audio-demuxer.ts"),U=k("./src/demux/id3.ts"),P=k("./src/utils/logger.ts"),W=k("./src/demux/mpegaudio.ts");function B(d,p){d.prototype=Object.create(p.prototype),d.prototype.constructor=d,O(d,p)}function O(d,p){return O=Object.setPrototypeOf||function(m,g){return m.__proto__=g,m},O(d,p)}var A=function(d){B(p,d);function p(){return d.apply(this,arguments)||this}var w=p.prototype;return w.resetInitSegment=function(g,b,a){d.prototype.resetInitSegment.call(this,g,b,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:g,duration:a,inputTimeScale:9e4,dropped:0}},p.probe=function(g){if(!g)return!1;for(var b=U.getID3Data(g,0)||[],a=b.length,i=g.length;a<i;a++)if(W.probe(g,a))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},w.canParse=function(g,b){return W.canParse(g,b)},w.appendFrame=function(g,b,a){return this.initPTS===null?void 0:W.appendFrame(g,b,a,this.initPTS,this.frameIndex)},p}(X.default);A.minProbeByteLength=4,J.default=A},"./src/demux/mp4demuxer.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/utils/mp4-tools.ts"),U=k("./src/demux/dummy-demuxed-track.ts"),P=function(){function W(O,A){this.remainderData=null,this.config=void 0,this.config=A}var B=W.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},W.probe=function(A){return Object(X.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},B.demux=function(A){var d=A,p=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(X.appendUint8Array)(this.remainderData,A));var w=Object(X.segmentValidRange)(d);this.remainderData=w.remainder,p.samples=w.valid||new Uint8Array}else p.samples=d;return{audioTrack:Object(U.dummyTrack)(),avcTrack:p,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.flush=function(){var A=Object(U.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.demuxSampleAes=function(A,d,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},W}();P.minProbeByteLength=1024,J.default=P},"./src/demux/mpegaudio.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"appendFrame",function(){return O}),k.d(J,"parseHeader",function(){return A}),k.d(J,"isHeaderPattern",function(){return d}),k.d(J,"isHeader",function(){return p}),k.d(J,"canParse",function(){return w}),k.d(J,"probe",function(){return m});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],P=[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]],B=[0,1,1,4];function O(g,b,a,i,s){if(a+24>b.length)return;var l=A(b,a);if(l&&a+l.frameLength<=b.length){var S=l.samplesPerFrame*9e4/l.sampleRate,v=i+s*S,y={unit:b.subarray(a,a+l.frameLength),pts:v,dts:v};return g.config=[],g.channelCount=l.channelCount,g.samplerate=l.sampleRate,g.samples.push(y),{sample:y,length:l.frameLength,missing:0}}}function A(g,b){var a=g[b+1]>>3&3,i=g[b+1]>>1&3,s=g[b+2]>>4&15,l=g[b+2]>>2&3;if(a!==1&&s!==0&&s!==15&&l!==3){var S=g[b+2]>>1&1,v=g[b+3]>>6,y=a===3?3-i:i===3?3:4,R=U[y*14+s-1]*1e3,_=a===3?0:a===2?1:2,C=P[_*3+l],E=v===3?1:2,c=W[a][i],u=B[i],h=c*8*u,T=Math.floor(c*R/C+S)*u;if(X===null){var L=navigator.userAgent||"",I=L.match(/Chrome\/(\d+)/i);X=I?parseInt(I[1]):0}var F=!!X&&X<=87;return F&&i===2&&R>=224e3&&v===0&&(g[b+3]=g[b+3]|128),{sampleRate:C,channelCount:E,frameLength:T,samplesPerFrame:h}}}function d(g,b){return g[b]===255&&(g[b+1]&224)===224&&(g[b+1]&6)!==0}function p(g,b){return b+1<g.length&&d(g,b)}function w(g,b){var a=4;return d(g,b)&&a<=g.length-b}function m(g,b){if(b+1<g.length&&d(g,b)){var a=4,i=A(g,b),s=a;i!=null&&i.frameLength&&(s=i.frameLength);var l=b+s;return l===g.length||p(g,l)}return!1}},"./src/demux/sample-aes.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/crypt/decrypter.ts"),U=k("./src/demux/tsdemuxer.ts"),P=function(){function W(O,A,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new X.default(O,A,{removePKCS7Padding:!1})}var B=W.prototype;return B.decryptBuffer=function(A,d){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,d)},B.decryptAacSample=function(A,d,p,w){var m=A[d].unit,g=m.subarray(16,m.length-m.length%16),b=g.buffer.slice(g.byteOffset,g.byteOffset+g.length),a=this;this.decryptBuffer(b,function(i){var s=new Uint8Array(i);m.set(s,16),w||a.decryptAacSamples(A,d+1,p)})},B.decryptAacSamples=function(A,d,p){for(;;d++){if(d>=A.length){p();return}if(A[d].unit.length<32)continue;var w=this.decrypter.isSync();if(this.decryptAacSample(A,d,p,w),!w)return}},B.getAvcEncryptedData=function(A){for(var d=Math.floor((A.length-48)/160)*16+16,p=new Int8Array(d),w=0,m=32;m<=A.length-16;m+=160,w+=16)p.set(A.subarray(m,m+16),w);return p},B.getAvcDecryptedUnit=function(A,d){for(var p=new Uint8Array(d),w=0,m=32;m<=A.length-16;m+=160,w+=16)A.set(p.subarray(w,w+16),m);return A},B.decryptAvcSample=function(A,d,p,w,m,g){var b=Object(U.discardEPB)(m.data),a=this.getAvcEncryptedData(b),i=this;this.decryptBuffer(a.buffer,function(s){m.data=i.getAvcDecryptedUnit(b,s),g||i.decryptAvcSamples(A,d,p+1,w)})},B.decryptAvcSamples=function(A,d,p,w){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,p=0){if(d>=A.length){w();return}for(var m=A[d].units;!(p>=m.length);p++){var g=m[p];if(g.data.length<=48||g.type!==1&&g.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(A,d,p,w,g,b),!b)return}}},W}();J.default=P},"./src/demux/transmuxer-interface.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return m});var X=k("./node_modules/webworkify-webpack/index.js"),U=k.n(X),P=k("./src/events.ts"),W=k("./src/demux/transmuxer.ts"),B=k("./src/utils/logger.ts"),O=k("./src/errors.ts"),A=k("./src/utils/mediasource-helper.ts"),d=k("./node_modules/eventemitter3/index.js"),p=k.n(d),w=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},m=function(){function g(a,i,s,l){var S=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=a,this.id=i,this.onTransmuxComplete=s,this.onFlush=l;var v=a.config,y=function(c,u){u=u||{},u.frag=S.frag,u.id=S.id,a.trigger(c,u)};this.observer=new d.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,y),this.observer.on(P.Events.ERROR,y);var R={mp4:w.isTypeSupported("video/mp4"),mpeg:w.isTypeSupported("audio/mpeg"),mp3:w.isTypeSupported('audio/mp4; codecs="mp3"')},_=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var C;try{C=this.worker=X("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),C.addEventListener("message",this.onwmsg),C.onerror=function(E){a.trigger(P.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},C.postMessage({cmd:"init",typeSupported:R,vendor:_,id:i,config:JSON.stringify(v)})}catch(E){B.logger.warn("Error in worker:",E),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),C&&self.URL.revokeObjectURL(C.objectURL),this.transmuxer=new W.default(this.observer,R,v,_,i),this.worker=null}}else this.transmuxer=new W.default(this.observer,R,v,_,i)}var b=g.prototype;return b.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},b.push=function(i,s,l,S,v,y,R,_,C,E){var c=this;C.transmuxing.start=self.performance.now();var u=this.transmuxer,h=this.worker,T=y?y.start:v.start,L=v.decryptdata,I=this.frag,F=!(I&&v.cc===I.cc),j=!(I&&C.level===I.level),z=I?C.sn-I.sn:-1,M=this.part?C.part-this.part.index:1,N=!j&&(z===1||z===0&&M===1),Y=self.performance.now();(j||z||v.stats.parsing.start===0)&&(v.stats.parsing.start=Y),y&&(M||!N)&&(y.stats.parsing.start=Y);var ee=new W.TransmuxState(F,N,_,j,T);if(!N||F){B.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+C.sn+" p: "+C.part+" level: "+C.level+" id: "+C.id+`
discontinuity: `+F+`
trackSwitch: `+j+`
contiguous: `+N+`
accurateTimeOffset: `+_+`
timeOffset: `+T);var le=new W.TransmuxConfig(l,S,s,R,E);this.configureTransmuxer(le)}if(this.frag=v,this.part=y,h)h.postMessage({cmd:"demux",data:i,decryptdata:L,chunkMeta:C,state:ee},i instanceof ArrayBuffer?[i]:[]);else if(u){var pe=u.push(i,L,C,ee);Object(W.isPromise)(pe)?pe.then(function(Oe){c.handleTransmuxComplete(Oe)}):this.handleTransmuxComplete(pe)}},b.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:i});else if(l){var v=l.flush(i);Object(W.isPromise)(v)?v.then(function(y){s.handleFlushResult(y,i)}):this.handleFlushResult(v,i)}},b.handleFlushResult=function(i,s){var l=this;i.forEach(function(S){l.handleTransmuxComplete(S)}),this.onFlush(s)},b.onWorkerMessage=function(i){var s=i.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(i){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:i}):l&&l.configure(i)},b.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},g}()},"./src/demux/transmuxer-worker.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return O});var X=k("./src/demux/transmuxer.ts"),U=k("./src/events.ts"),P=k("./src/utils/logger.ts"),W=k("./node_modules/eventemitter3/index.js"),B=k.n(W);function O(m){var g=new W.EventEmitter,b=function(i,s){m.postMessage({event:i,data:s})};g.on(U.Events.FRAG_DECRYPTED,b),g.on(U.Events.ERROR,b),m.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);m.transmuxer=new X.default(g,i.typeSupported,s,i.vendor,i.id),Object(P.enableLogs)(s.debug),b("init",null);break}case"configure":{m.transmuxer.configure(i.config);break}case"demux":{var l=m.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(X.isPromise)(l)?l.then(function(y){A(m,y)}):A(m,l);break}case"flush":{var S=i.chunkMeta,v=m.transmuxer.flush(S);Object(X.isPromise)(v)?v.then(function(y){p(m,y,S)}):p(m,v,S);break}default:break}})}function A(m,g){if(w(g.remuxResult))return;var b=[],a=g.remuxResult,i=a.audio,s=a.video;i&&d(b,i),s&&d(b,s),m.postMessage({event:"transmuxComplete",data:g},b)}function d(m,g){g.data1&&m.push(g.data1.buffer),g.data2&&m.push(g.data2.buffer)}function p(m,g,b){g.forEach(function(a){A(m,a)}),m.postMessage({event:"flush",data:b})}function w(m){return!m.audio&&!m.video&&!m.text&&!m.id3&&!m.initSegment}},"./src/demux/transmuxer.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s}),k.d(J,"isPromise",function(){return v}),k.d(J,"TransmuxConfig",function(){return y}),k.d(J,"TransmuxState",function(){return R});var X=k("./src/events.ts"),U=k("./src/errors.ts"),P=k("./src/crypt/decrypter.ts"),W=k("./src/demux/aacdemuxer.ts"),B=k("./src/demux/mp4demuxer.ts"),O=k("./src/demux/tsdemuxer.ts"),A=k("./src/demux/mp3demuxer.ts"),d=k("./src/remux/mp4-remuxer.ts"),p=k("./src/remux/passthrough-remuxer.ts"),w=k("./src/demux/chunk-cache.ts"),m=k("./src/utils/mp4-tools.ts"),g=k("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(_){g.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var a=[{demux:O.default,remux:d.default},{demux:B.default,remux:p.default},{demux:W.default,remux:d.default},{demux:A.default,remux:d.default}],i=1024;a.forEach(function(_){var C=_.demux;i=Math.max(i,C.minProbeByteLength)});var s=function(){function _(E,c,u,h,T){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new w.default,this.observer=E,this.typeSupported=c,this.config=u,this.vendor=h,this.id=T}var C=_.prototype;return C.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},C.push=function(c,u,h,T){var L=this,I=h.transmuxing;I.executeStart=b();var F=new Uint8Array(c),j=this.cache,z=this.config,M=this.currentTransmuxState,N=this.transmuxConfig;T&&(this.currentTransmuxState=T);var Y=l(F,u);if(Y&&Y.method==="AES-128"){var ee=this.getDecrypter();if(z.enableSoftwareAES){var le=ee.softwareDecrypt(F,Y.key.buffer,Y.iv.buffer);if(!le)return I.executeEnd=b(),S(h);F=new Uint8Array(le)}else return this.decryptionPromise=ee.webCryptoDecrypt(F,Y.key.buffer,Y.iv.buffer).then(function(me){var _e=L.push(me,null,h);return L.decryptionPromise=null,_e}),this.decryptionPromise}var pe=T||M,Oe=pe.contiguous,Te=pe.discontinuity,Re=pe.trackSwitch,Ae=pe.accurateTimeOffset,we=pe.timeOffset,ge=N.audioCodec,de=N.videoCodec,re=N.defaultInitPts,ce=N.duration,se=N.initSegmentData;if((Te||Re)&&this.resetInitSegment(se,ge,de,ce),Te&&this.resetInitialTimestamp(re),Oe||this.resetContiguity(),this.needsProbing(F,Te,Re)){if(j.dataLength){var ke=j.flush();F=Object(m.appendUint8Array)(ke,F)}this.configureTransmuxer(F,N)}var ie=this.transmux(F,Y,we,Ae,h),ae=this.currentTransmuxState;return ae.contiguous=!0,ae.discontinuity=!1,ae.trackSwitch=!1,I.executeEnd=b(),ie},C.flush=function(c){var u=this,h=c.transmuxing;h.executeStart=b();var T=this.decrypter,L=this.cache,I=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return u.flush(c)});var j=[],z=I.timeOffset;if(T){var M=T.flush();M&&j.push(this.push(M,null,c))}var N=L.dataLength;L.reset();var Y=this.demuxer,ee=this.remuxer;if(!Y||!ee)return N>=i&&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"}),h.executeEnd=b(),[S(c)];var le=Y.flush(z);return v(le)?le.then(function(pe){return u.flushRemux(j,pe,c),j}):(this.flushRemux(j,le,c),j)},C.flushRemux=function(c,u,h){var T=u.audioTrack,L=u.avcTrack,I=u.id3Track,F=u.textTrack,j=this.currentTransmuxState,z=j.accurateTimeOffset,M=j.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+h.sn+(h.part>-1?" p: "+h.part:"")+" of level "+h.level);var N=this.remuxer.remux(T,L,I,F,M,z,!0,this.id);c.push({remuxResult:N,chunkMeta:h}),h.transmuxing.executeEnd=b()},C.resetInitialTimestamp=function(c){var u=this.demuxer,h=this.remuxer;if(!u||!h)return;u.resetTimeStamp(c),h.resetTimeStamp(c)},C.resetContiguity=function(){var c=this.demuxer,u=this.remuxer;if(!c||!u)return;c.resetContiguity(),u.resetNextTimestamp()},C.resetInitSegment=function(c,u,h,T){var L=this.demuxer,I=this.remuxer;if(!L||!I)return;L.resetInitSegment(u,h,T),I.resetInitSegment(c,u,h)},C.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},C.transmux=function(c,u,h,T,L){var I;return u&&u.method==="SAMPLE-AES"?I=this.transmuxSampleAes(c,u,h,T,L):I=this.transmuxUnencrypted(c,h,T,L),I},C.transmuxUnencrypted=function(c,u,h,T){var L=this.demuxer.demux(c,u,!1,!this.config.progressive),I=L.audioTrack,F=L.avcTrack,j=L.id3Track,z=L.textTrack,M=this.remuxer.remux(I,F,j,z,u,h,!1,this.id);return{remuxResult:M,chunkMeta:T}},C.transmuxSampleAes=function(c,u,h,T,L){var I=this;return this.demuxer.demuxSampleAes(c,u,h).then(function(F){var j=I.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,h,T,!1,I.id);return{remuxResult:j,chunkMeta:L}})},C.configureTransmuxer=function(c,u){for(var h=this.config,T=this.observer,L=this.typeSupported,I=this.vendor,F=u.audioCodec,j=u.defaultInitPts,z=u.duration,M=u.initSegmentData,N=u.videoCodec,Y,ee=0,le=a.length;ee<le;ee++)if(a[ee].demux.probe(c)){Y=a[ee];break}Y||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:B.default,remux:p.default});var pe=this.demuxer,Oe=this.remuxer,Te=Y.remux,Re=Y.demux;(!Oe||!(Oe instanceof Te))&&(this.remuxer=new Te(T,h,L,I)),(!pe||!(pe instanceof Re))&&(this.demuxer=new Re(T,h,L),this.probe=Re.probe),this.resetInitSegment(M,F,N,z),this.resetInitialTimestamp(j)},C.needsProbing=function(c,u,h){return!this.demuxer||!this.remuxer||u||h},C.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new P.default(this.observer,this.config)),c},_}();function l(_,C){var E=null;return _.byteLength>0&&C!=null&&C.key!=null&&C.iv!==null&&C.method!=null&&(E=C),E}var S=function(C){return{remuxResult:{},chunkMeta:C}};function v(_){return"then"in _&&_.then instanceof Function}var y=function(C,E,c,u,h){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=C,this.videoCodec=E,this.initSegmentData=c,this.duration=u,this.defaultInitPts=h},R=function(C,E,c,u,h){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=C,this.contiguous=E,this.accurateTimeOffset=c,this.trackSwitch=u,this.timeOffset=h}},"./src/demux/tsdemuxer.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"discardEPB",function(){return S});var X=k("./src/demux/adts.ts"),U=k("./src/demux/mpegaudio.ts"),P=k("./src/demux/exp-golomb.ts"),W=k("./src/demux/id3.ts"),B=k("./src/demux/sample-aes.ts"),O=k("./src/events.ts"),A=k("./src/utils/mp4-tools.ts"),d=k("./src/utils/logger.ts"),p=k("./src/errors.ts"),w={video:1,audio:2,id3:3,text:4},m=function(){function v(R,_,C){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=R,this.config=_,this.typeSupported=C}v.probe=function(_){var C=v.syncOffset(_);return C<0?!1:(C&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+C+", junk ahead ?"),!0)},v.syncOffset=function(_){for(var C=Math.min(1e3,_.length-3*188),E=0;E<C;){if(_[E]===71&&_[E+188]===71&&_[E+2*188]===71)return E;E++}return-1},v.createTrack=function(_,C){return{container:_==="video"||_==="audio"?"video/mp2t":void 0,type:_,id:w[_],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:_==="audio"?C:void 0}};var y=v.prototype;return y.resetInitSegment=function(_,C,E){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",E),this._audioTrack=v.createTrack("audio",E),this._id3Track=v.createTrack("id3",E),this._txtTrack=v.createTrack("text",E),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=_,this.videoCodec=C,this._duration=E},y.resetTimeStamp=function(){},y.resetContiguity=function(){var _=this._audioTrack,C=this._avcTrack,E=this._id3Track;_&&(_.pesData=null),C&&(C.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},y.demux=function(_,C,E,c){E===void 0&&(E=!1),c===void 0&&(c=!1),E||(this.sampleAes=null);var u,h=this._avcTrack,T=this._audioTrack,L=this._id3Track,I=h.pid,F=h.pesData,j=T.pid,z=L.pid,M=T.pesData,N=L.pesData,Y=!1,ee=this.pmtParsed,le=this._pmtId,pe=_.length;if(this.remainderData&&(_=Object(A.appendUint8Array)(this.remainderData,_),pe=_.length,this.remainderData=null),pe<188&&!c)return this.remainderData=_,{audioTrack:T,avcTrack:h,id3Track:L,textTrack:this._txtTrack};var Oe=Math.max(0,v.syncOffset(_));pe-=(pe+Oe)%188,pe<_.byteLength&&!c&&(this.remainderData=new Uint8Array(_.buffer,pe,_.buffer.byteLength-pe));for(var Te=Oe;Te<pe;Te+=188)if(_[Te]===71){var Re=!!(_[Te+1]&64),Ae=((_[Te+1]&31)<<8)+_[Te+2],we=(_[Te+3]&48)>>4,ge=void 0;if(we>1){if(ge=Te+5+_[Te+4],ge===Te+188)continue}else ge=Te+4;switch(Ae){case I:Re&&(F&&(u=i(F))&&this.parseAVCPES(u,!1),F={data:[],size:0}),F&&(F.data.push(_.subarray(ge,Te+188)),F.size+=Te+188-ge);break;case j:Re&&(M&&(u=i(M))&&(T.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),M={data:[],size:0}),M&&(M.data.push(_.subarray(ge,Te+188)),M.size+=Te+188-ge);break;case z:Re&&(N&&(u=i(N))&&this.parseID3PES(u),N={data:[],size:0}),N&&(N.data.push(_.subarray(ge,Te+188)),N.size+=Te+188-ge);break;case 0:Re&&(ge+=_[ge]+1),le=this._pmtId=b(_,ge);break;case le:{Re&&(ge+=_[ge]+1);var de=a(_,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);I=de.avc,I>0&&(h.pid=I),j=de.audio,j>0&&(T.pid=j,T.isAAC=de.isAAC),z=de.id3,z>0&&(L.pid=z),Y&&!ee&&(d.logger.log("reparse from beginning"),Y=!1,Te=Oe-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});h.pesData=F,T.pesData=M,L.pesData=N;var re={audioTrack:T,avcTrack:h,id3Track:L,textTrack:this._txtTrack};return c&&this.extractRemainingSamples(re),re},y.flush=function(){var _=this.remainderData;this.remainderData=null;var C;return _?C=this.demux(_,-1,!1,!0):C={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(C),this.sampleAes?this.decrypt(C,this.sampleAes):C},y.extractRemainingSamples=function(_){var C=_.audioTrack,E=_.avcTrack,c=_.id3Track,u=E.pesData,h=C.pesData,T=c.pesData,L;u&&(L=i(u))?(this.parseAVCPES(L,!0),E.pesData=null):E.pesData=u,h&&(L=i(h))?(C.isAAC?this.parseAACPES(L):this.parseMPEGPES(L),C.pesData=null):(h!=null&&h.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),C.pesData=h),T&&(L=i(T))?(this.parseID3PES(L),c.pesData=null):c.pesData=T},y.demuxSampleAes=function(_,C,E){var c=this.demux(_,E,!0,!this.config.progressive),u=this.sampleAes=new B.default(this.observer,this.config,C);return this.decrypt(c,u)},y.decrypt=function(_,C){return new Promise(function(E){var c=_.audioTrack,u=_.avcTrack;c.samples&&c.isAAC?C.decryptAacSamples(c.samples,0,function(){u.samples?C.decryptAvcSamples(u.samples,0,0,function(){E(_)}):E(_)}):u.samples&&C.decryptAvcSamples(u.samples,0,0,function(){E(_)})})},y.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},y.parseAVCPES=function(_,C){var E=this,c=this._avcTrack,u=this.parseAVCNALu(_.data),h=!1,T=this.avcSample,L,I=!1;_.data=null,T&&u.length&&!c.audFound&&(s(T,c),T=this.avcSample=g(!1,_.pts,_.dts,"")),u.forEach(function(F){switch(F.type){case 1:{L=!0,T||(T=E.avcSample=g(!0,_.pts,_.dts,"")),h&&(T.debug+="NDR "),T.frame=!0;var j=F.data;if(I&&j.length>4){var z=new P.default(j).readSliceType();(z===2||z===4||z===7||z===9)&&(T.key=!0)}break}case 5:L=!0,T||(T=E.avcSample=g(!0,_.pts,_.dts,"")),h&&(T.debug+="IDR "),T.key=!0,T.frame=!0;break;case 6:{L=!0,h&&T&&(T.debug+="SEI ");var M=new P.default(S(F.data));M.readUByte();for(var N=0,Y=0,ee=!1,le=0;!ee&&M.bytesAvailable>1;){N=0;do le=M.readUByte(),N+=le;while(le===255);Y=0;do le=M.readUByte(),Y+=le;while(le===255);if(N===4&&M.bytesAvailable!==0){ee=!0;var pe=M.readUByte();if(pe===181){var Oe=M.readUShort();if(Oe===49){var Te=M.readUInt();if(Te===1195456820){var Re=M.readUByte();if(Re===3){for(var Ae=M.readUByte(),we=M.readUByte(),ge=31&Ae,de=[Ae,we],re=0;re<ge;re++)de.push(M.readUByte()),de.push(M.readUByte()),de.push(M.readUByte());l(E._txtTrack.samples,{type:3,pts:_.pts,bytes:de})}}}}}else if(N===5&&M.bytesAvailable!==0){if(ee=!0,Y>16){for(var ce=[],se=0;se<16;se++)ce.push(M.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&ce.push("-");for(var ke=Y-16,ie=new Uint8Array(ke),ae=0;ae<ke;ae++)ie[ae]=M.readUByte();l(E._txtTrack.samples,{pts:_.pts,payloadType:N,uuid:ce.join(""),userData:Object(W.utf8ArrayToStr)(ie),userDataBytes:ie})}}else if(Y<M.bytesAvailable)for(var me=0;me<Y;me++)M.readUByte()}break}case 7:if(L=!0,I=!0,h&&T&&(T.debug+="SPS "),!c.sps){var _e=new P.default(F.data),Me=_e.readSPS();c.width=Me.width,c.height=Me.height,c.pixelRatio=Me.pixelRatio,c.sps=[F.data],c.duration=E._duration;for(var Ue=F.data.subarray(1,4),je="avc1.",Fe=0;Fe<3;Fe++){var Je=Ue[Fe].toString(16);Je.length<2&&(Je="0"+Je),je+=Je}c.codec=je}break;case 8:L=!0,h&&T&&(T.debug+="PPS "),c.pps||(c.pps=[F.data]);break;case 9:L=!1,c.audFound=!0,T&&s(T,c),T=E.avcSample=g(!1,_.pts,_.dts,h?"AUD ":"");break;case 12:L=!1;break;default:L=!1,T&&(T.debug+="unknown NAL "+F.type+" ");break}if(T&&L){var $e=T.units;$e.push(F)}}),C&&T&&(s(T,c),this.avcSample=null)},y.getLastNalUnit=function(){var _,C=this.avcSample,E;if(!C||C.units.length===0){var c=this._avcTrack.samples;C=c[c.length-1]}if((_=C)!==null&&_!==void 0&&_.units){var u=C.units;E=u[u.length-1]}return E},y.parseAVCNALu=function(_){var C=_.byteLength,E=this._avcTrack,c=E.naluState||0,u=c,h=[],T=0,L,I,F,j=-1,z=0;for(c===-1&&(j=0,z=_[0]&31,c=0,T=1);T<C;){if(L=_[T++],!c){c=L?0:1;continue}if(c===1){c=L?0:2;continue}if(!L)c=3;else if(L===1){if(j>=0){var M={data:_.subarray(j,T-c-1),type:z};h.push(M)}else{var N=this.getLastNalUnit();if(N&&(u&&T<=4-u&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-u))),I=T-c-1,I>0)){var Y=new Uint8Array(N.data.byteLength+I);Y.set(N.data,0),Y.set(_.subarray(0,I),N.data.byteLength),N.data=Y,N.state=0}}T<C?(F=_[T]&31,j=T,z=F,c=0):c=-1}else c=0}if(j>=0&&c>=0){var ee={data:_.subarray(j,C),type:z,state:c};h.push(ee)}if(h.length===0){var le=this.getLastNalUnit();if(le){var pe=new Uint8Array(le.data.byteLength+_.byteLength);pe.set(le.data,0),pe.set(_,le.data.byteLength),le.data=pe}}return E.naluState=c,h},y.parseAACPES=function(_){var C=0,E=this._audioTrack,c=this.aacOverFlow,u=_.data;if(c){this.aacOverFlow=null;var h=c.sample.unit.byteLength,T=Math.min(c.missing,h),L=h-T;c.sample.unit.set(u.subarray(0,T),L),E.samples.push(c.sample),C=c.missing}var I,F;for(I=C,F=u.length;I<F-1&&!X.isHeader(u,I);I++);if(I!==C){var j,z;if(I<F-1?(j="AAC PES did not start with ADTS header,offset:"+I,z=!1):(j="no ADTS header found in AAC PES",z=!0),d.logger.warn("parsing error:"+j),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:j}),z)return}X.initTrackConfig(E,this.observer,u,I,this.audioCodec);var M;if(_.pts!==void 0)M=_.pts;else if(c){var N=X.getFrameDuration(E.samplerate);M=c.sample.pts+N}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;I<F;)if(X.isHeader(u,I)){if(I+5<F){var ee=X.appendFrame(E,u,I,M,Y);if(ee)if(ee.missing)this.aacOverFlow=ee;else{I+=ee.length,Y++;continue}}break}else I++},y.parseMPEGPES=function(_){var C=_.data,E=C.length,c=0,u=0,h=_.pts;if(h===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<E;)if(U.isHeader(C,u)){var T=U.appendFrame(this._audioTrack,C,u,h,c);if(T)u+=T.length,c++;else break}else u++},y.parseID3PES=function(_){if(_.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(_)},v}();m.minProbeByteLength=188;function g(v,y,R,_){return{key:v,frame:!1,pts:y,dts:R,units:[],debug:_,length:0}}function b(v,y){return(v[y+10]&31)<<8|v[y+11]}function a(v,y,R,_){var C={audio:-1,avc:-1,id3:-1,isAAC:!0},E=(v[y+1]&15)<<8|v[y+2],c=y+3+E-4,u=(v[y+10]&15)<<8|v[y+11];for(y+=12+u;y<c;){var h=(v[y+1]&31)<<8|v[y+2];switch(v[y]){case 207:if(!_){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:C.audio===-1&&(C.audio=h);break;case 21:C.id3===-1&&(C.id3=h);break;case 219:if(!_){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:C.avc===-1&&(C.avc=h);break;case 3:case 4:R?C.audio===-1&&(C.audio=h,C.isAAC=!1):d.logger.log("MPEG audio found, not supported in this browser");break;case 36:d.logger.warn("Unsupported HEVC stream type found");break;default:break}y+=((v[y+3]&15)<<8|v[y+4])+5}return C}function i(v){var y=0,R,_,C,E,c,u=v.data;if(!v||v.size===0)return null;for(;u[0].length<19&&u.length>1;){var h=new Uint8Array(u[0].length+u[1].length);h.set(u[0]),h.set(u[1],u[0].length),u[0]=h,u.splice(1,1)}R=u[0];var T=(R[0]<<16)+(R[1]<<8)+R[2];if(T===1){if(_=(R[4]<<8)+R[5],_&&_>v.size-6)return null;var L=R[7];L&192&&(E=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,L&64?(c=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,E-c>60*9e4&&(d.logger.warn(Math.round((E-c)/9e4)+"s delta between PTS and DTS, align them"),E=c)):c=E),C=R[8];var I=C+9;if(v.size<=I)return null;v.size-=I;for(var F=new Uint8Array(v.size),j=0,z=u.length;j<z;j++){R=u[j];var M=R.byteLength;if(I)if(I>M){I-=M;continue}else R=R.subarray(I),M-=I,I=0;F.set(R,y),y+=M}return _&&(_-=C+3),{data:F,pts:E,dts:c,len:_}}return null}function s(v,y){if(v.units.length&&v.frame){if(v.pts===void 0){var R=y.samples,_=R.length;if(_){var C=R[_-1];v.pts=C.pts,v.dts=C.dts}else{y.dropped++;return}}y.samples.push(v)}v.debug.length&&d.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function l(v,y){var R=v.length;if(R>0){if(y.pts>=v[R-1].pts)v.push(y);else for(var _=R-1;_>=0;_--)if(y.pts<v[_].pts){v.splice(_,0,y);break}}else v.push(y)}function S(v){for(var y=v.byteLength,R=[],_=1;_<y-2;)v[_]===0&&v[_+1]===0&&v[_+2]===3?(R.push(_+2),_+=2):_++;if(R.length===0)return v;var C=y-R.length,E=new Uint8Array(C),c=0;for(_=0;_<C;c++,_++)c===R[0]&&(c++,R.shift()),E[_]=v[c];return E}J.default=m},"./src/errors.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"ErrorTypes",function(){return X}),k.d(J,"ErrorDetails",function(){return U});var X;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(X||(X={}));var U;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"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(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return v});var X=k("./node_modules/url-toolkit/src/url-toolkit.js"),U=k.n(X),P=k("./src/loader/playlist-loader.ts"),W=k("./src/loader/key-loader.ts"),B=k("./src/controller/id3-track-controller.ts"),O=k("./src/controller/latency-controller.ts"),A=k("./src/controller/level-controller.ts"),d=k("./src/controller/fragment-tracker.ts"),p=k("./src/controller/stream-controller.ts"),w=k("./src/is-supported.ts"),m=k("./src/utils/logger.ts"),g=k("./src/config.ts"),b=k("./node_modules/eventemitter3/index.js"),a=k.n(b),i=k("./src/events.ts"),s=k("./src/errors.ts");function l(y,R){for(var _=0;_<R.length;_++){var C=R[_];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(y,C.key,C)}}function S(y,R,_){return R&&l(y.prototype,R),_&&l(y,_),y}var v=function(){y.isSupported=function(){return Object(w.isSupported)()};function y(_){_===void 0&&(_={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var C=this.config=Object(g.mergeConfig)(y.DefaultConfig,_);this.userConfig=_,Object(m.enableLogs)(C.debug),this._autoLevelCapping=-1,C.progressive&&Object(g.enableStreamingMode)(C);var E=C.abrController,c=C.bufferController,u=C.capLevelController,h=C.fpsController,T=this.abrController=new E(this),L=this.bufferController=new c(this),I=this.capLevelController=new u(this),F=new h(this),j=new P.default(this),z=new W.default(this),M=new B.default(this),N=this.levelController=new A.default(this),Y=new d.FragmentTracker(this),ee=this.streamController=new p.default(this,Y);I.setStreamController(ee),F.setStreamController(ee);var le=[N,ee];this.networkControllers=le;var pe=[j,z,T,L,I,F,M,Y];this.audioTrackController=this.createController(C.audioTrackController,null,le),this.createController(C.audioStreamController,Y,le),this.subtitleTrackController=this.createController(C.subtitleTrackController,null,le),this.createController(C.subtitleStreamController,Y,le),this.createController(C.timelineController,null,pe),this.emeController=this.createController(C.emeController,null,pe),this.cmcdController=this.createController(C.cmcdController,null,pe),this.latencyController=this.createController(O.default,null,pe),this.coreComponents=pe}var R=y.prototype;return R.createController=function(C,E,c){if(C){var u=E?new C(this,E):new C(this);return c&&c.push(u),u}return null},R.on=function(C,E,c){c===void 0&&(c=this),this._emitter.on(C,E,c)},R.once=function(C,E,c){c===void 0&&(c=this),this._emitter.once(C,E,c)},R.removeAllListeners=function(C){this._emitter.removeAllListeners(C)},R.off=function(C,E,c,u){c===void 0&&(c=this),this._emitter.off(C,E,c,u)},R.listeners=function(C){return this._emitter.listeners(C)},R.emit=function(C,E,c){return this._emitter.emit(C,E,c)},R.trigger=function(C,E){if(this.config.debug)return this.emit(C,C,E);try{return this.emit(C,C,E)}catch(c){m.logger.error("An internal error happened while handling event "+C+'. Error message: "'+c.message+'". Here is a stacktrace:',c),this.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:C,error:c})}return!1},R.listenerCount=function(C){return this._emitter.listenerCount(C)},R.destroy=function(){m.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(C){return C.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(C){return C.destroy()}),this.coreComponents.length=0},R.attachMedia=function(C){m.logger.log("attachMedia"),this._media=C,this.trigger(i.Events.MEDIA_ATTACHING,{media:C})},R.detachMedia=function(){m.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},R.loadSource=function(C){this.stopLoad();var E=this.media,c=this.url,u=this.url=X.buildAbsoluteURL(self.location.href,C,{alwaysNormalize:!0});m.logger.log("loadSource:"+u),E&&c&&c!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(E)),this.trigger(i.Events.MANIFEST_LOADING,{url:C})},R.startLoad=function(C){C===void 0&&(C=-1),m.logger.log("startLoad("+C+")"),this.networkControllers.forEach(function(E){E.startLoad(C)})},R.stopLoad=function(){m.logger.log("stopLoad"),this.networkControllers.forEach(function(C){C.stopLoad()})},R.swapAudioCodec=function(){m.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},R.recoverMediaError=function(){m.logger.log("recoverMediaError");var C=this._media;this.detachMedia(),C&&this.attachMedia(C)},R.removeLevel=function(C,E){E===void 0&&(E=0),this.levelController.removeLevel(C,E)},S(y,[{key:"levels",get:function(){var C=this.levelController.levels;return C||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(C){m.logger.log("set currentLevel:"+C),this.loadLevel=C,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(C){m.logger.log("set nextLevel:"+C),this.levelController.manualLevel=C,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(C){m.logger.log("set loadLevel:"+C),this.levelController.manualLevel=C}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(C){this.levelController.nextLoadLevel=C}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(C){m.logger.log("set firstLevel:"+C),this.levelController.firstLevel=C}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(C){m.logger.log("set startLevel:"+C),C!==-1&&(C=Math.max(C,this.minAutoLevel)),this.levelController.startLevel=C}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(C){var E=!!C;E!==this.config.capLevelToPlayerSize&&(E?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=E)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(C){this._autoLevelCapping!==C&&(m.logger.log("set autoLevelCapping:"+C),this._autoLevelCapping=C)}},{key:"bandwidthEstimate",get:function(){var C=this.abrController.bwEstimator;return C?C.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var C=this.levels,E=this.config.minAutoBitrate;if(!C)return 0;for(var c=C.length,u=0;u<c;u++)if(C[u].maxBitrate>E)return u;return 0}},{key:"maxAutoLevel",get:function(){var C=this.levels,E=this.autoLevelCapping,c;return E===-1&&C&&C.length?c=C.length-1:c=E,c}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(C){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,C)}},{key:"audioTracks",get:function(){var C=this.audioTrackController;return C?C.audioTracks:[]}},{key:"audioTrack",get:function(){var C=this.audioTrackController;return C?C.audioTrack:-1},set:function(C){var E=this.audioTrackController;E&&(E.audioTrack=C)}},{key:"subtitleTracks",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var C=this.subtitleTrackController;return C?C.subtitleTrack:-1},set:function(C){var E=this.subtitleTrackController;E&&(E.subtitleTrack=C)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var C=this.subtitleTrackController;return C?C.subtitleDisplay:!1},set:function(C){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=C)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(C){this.config.lowLatencyMode=C}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return i.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return y.defaultConfig?y.defaultConfig:g.hlsDefaultConfig},set:function(C){y.defaultConfig=C}}]),y}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"isSupported",function(){return P}),k.d(J,"changeTypeSupported",function(){return W});var X=k("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var B=Object(X.getMediaSource)();if(!B)return!1;var O=U(),A=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!A&&!!d}function W(){var B,O=U();return typeof(O==null||((B=O.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return m}),k.d(J,"LoadError",function(){return b});var X=k("./src/polyfills/number.ts"),U=k("./src/errors.ts");function P(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,d(a,i)}function W(a){var i=typeof Map=="function"?new Map:void 0;return W=function(l){if(l===null||!A(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(l))return i.get(l);i.set(l,S)}function S(){return B(l,arguments,p(this).constructor)}return S.prototype=Object.create(l.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),d(S,l)},W(a)}function B(a,i,s){return O()?B=Reflect.construct:B=function(S,v,y){var R=[null];R.push.apply(R,v);var _=Function.bind.apply(S,R),C=new _;return y&&d(C,y.prototype),C},B.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function A(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function d(a,i){return d=Object.setPrototypeOf||function(l,S){return l.__proto__=S,l},d(a,i)}function p(a){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},p(a)}var w=Math.pow(2,17),m=function(){function a(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var i=a.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(l,S){var v=this,y=l.url;if(!y)return Promise.reject(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(y?"part list":"url")));this.abort();var R=this.config,_=R.fLoader,C=R.loader;return new Promise(function(E,c){v.loader&&v.loader.destroy();var u=v.loader=l.loader=_?new _(R):new C(R),h=g(l),T={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:w};l.stats=u.stats,u.load(h,T,{onSuccess:function(I,F,j,z){v.resetLoader(l,u),E({frag:l,part:null,payload:I.data,networkDetails:z})},onError:function(I,F,j){v.resetLoader(l,u),c(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:I,networkDetails:j}))},onAbort:function(I,F,j){v.resetLoader(l,u),c(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(I,F,j){v.resetLoader(l,u),c(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(I,F,j,z){S&&S({frag:l,part:null,payload:j,networkDetails:z})}})})},i.loadPart=function(l,S,v){var y=this;this.abort();var R=this.config,_=R.fLoader,C=R.loader;return new Promise(function(E,c){y.loader&&y.loader.destroy();var u=y.loader=l.loader=_?new _(R):new C(R),h=g(l,S),T={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:w};S.stats=u.stats,u.load(h,T,{onSuccess:function(I,F,j,z){y.resetLoader(l,u),y.updateStatsFromPart(l,S);var M={frag:l,part:S,payload:I.data,networkDetails:z};v(M),E(M)},onError:function(I,F,j){y.resetLoader(l,u),c(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:S,response:I,networkDetails:j}))},onAbort:function(I,F,j){l.stats.aborted=S.stats.aborted,y.resetLoader(l,u),c(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:S,networkDetails:j}))},onTimeout:function(I,F,j){y.resetLoader(l,u),c(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:S,networkDetails:j}))}})})},i.updateStatsFromPart=function(l,S){var v=l.stats,y=S.stats,R=y.total;if(v.loaded+=y.loaded,R){var _=Math.round(l.duration/S.duration),C=Math.min(Math.round(v.loaded/R),_),E=_-C,c=E*Math.round(v.loaded/C);v.total=v.loaded+c}else v.total=Math.max(v.loaded,v.total);var u=v.loading,h=y.loading;u.start?u.first+=h.first-h.start:(u.start=h.start,u.first=h.first),u.end=h.end},i.resetLoader=function(l,S){l.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},a}();function g(a,i){i===void 0&&(i=null);var s=i||a,l={frag:a,part:i,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,v=s.byteRangeEndOffset;return Object(X.isFiniteNumber)(S)&&Object(X.isFiniteNumber)(v)&&(l.rangeStart=S,l.rangeEnd=v),l}var b=function(a){P(i,a);function i(s){for(var l,S=arguments.length,v=new Array(S>1?S-1:0),y=1;y<S;y++)v[y-1]=arguments[y];return l=a.call.apply(a,[this].concat(v))||this,l.data=void 0,l.data=s,l}return i}(W(Error))},"./src/loader/fragment.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"ElementaryStreamTypes",function(){return m}),k.d(J,"BaseSegment",function(){return g}),k.d(J,"Fragment",function(){return b}),k.d(J,"Part",function(){return a});var X=k("./src/polyfills/number.ts"),U=k("./node_modules/url-toolkit/src/url-toolkit.js"),P=k.n(U),W=k("./src/utils/logger.ts"),B=k("./src/loader/level-key.ts"),O=k("./src/loader/load-stats.ts");function A(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,d(i,s)}function d(i,s){return d=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},d(i,s)}function p(i,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(i,S.key,S)}}function w(i,s,l){return s&&p(i.prototype,s),l&&p(i,l),i}var m;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(m||(m={}));var g=function(){function i(l){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[m.AUDIO]=null,S[m.VIDEO]=null,S[m.AUDIOVIDEO]=null,S),this.baseurl=l}var s=i.prototype;return s.setByteRange=function(S,v){var y=S.split("@",2),R=[];y.length===1?R[0]=v?v.byteRangeEndOffset:0:R[0]=parseInt(y[1]),R[1]=parseInt(y[0])+R[0],this._byteRange=R},w(i,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),i}(),b=function(i){A(s,i);function s(S,v){var y;return y=i.call(this,v)||this,y._decryptdata=null,y.rawProgramDateTime=null,y.programDateTime=null,y.tagList=[],y.duration=0,y.sn=0,y.levelkey=void 0,y.type=void 0,y.loader=null,y.level=-1,y.cc=0,y.startPTS=void 0,y.endPTS=void 0,y.appendedPTS=void 0,y.startDTS=void 0,y.endDTS=void 0,y.start=0,y.deltaPTS=void 0,y.maxStartPTS=void 0,y.minEndPTS=void 0,y.stats=new O.LoadStats,y.urlId=0,y.data=void 0,y.bitrateTest=!1,y.title=null,y.initSegment=null,y.type=S,y}var l=s.prototype;return l.createInitializationVector=function(v){for(var y=new Uint8Array(16),R=12;R<16;R++)y[R]=v>>8*(15-R)&255;return y},l.setDecryptDataFromLevelKey=function(v,y){var R=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(R=B.LevelKey.fromURI(v.uri),R.method=v.method,R.iv=this.createInitializationVector(y),R.keyFormat="identity"),R},l.setElementaryStreamInfo=function(v,y,R,_,C,E){E===void 0&&(E=!1);var c=this.elementaryStreams,u=c[v];if(!u){c[v]={startPTS:y,endPTS:R,startDTS:_,endDTS:C,partial:E};return}u.startPTS=Math.min(u.startPTS,y),u.endPTS=Math.max(u.endPTS,R),u.startDTS=Math.min(u.startDTS,_),u.endDTS=Math.max(u.endDTS,C)},l.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[m.AUDIO]=null,v[m.VIDEO]=null,v[m.AUDIOVIDEO]=null},w(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="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'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}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 v=Object(X.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),s}(g),a=function(i){A(s,i);function s(l,S,v,y,R){var _;_=i.call(this,v)||this,_.fragOffset=0,_.duration=0,_.gap=!1,_.independent=!1,_.relurl=void 0,_.fragment=void 0,_.index=void 0,_.stats=new O.LoadStats,_.duration=l.decimalFloatingPoint("DURATION"),_.gap=l.bool("GAP"),_.independent=l.bool("INDEPENDENT"),_.relurl=l.enumeratedString("URI"),_.fragment=S,_.index=y;var C=l.enumeratedString("BYTERANGE");return C&&_.setByteRange(C,R),R&&(_.fragOffset=R.fragOffset+R.duration),_}return w(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(g)},"./src/loader/key-loader.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return W});var X=k("./src/events.ts"),U=k("./src/errors.ts"),P=k("./src/utils/logger.ts"),W=function(){function B(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var O=B.prototype;return O._registerListeners=function(){this.hls.on(X.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(X.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var p=this.loaders[d];p&&p.destroy()}this.loaders={}},O.onKeyLoading=function(d,p){var w=p.frag,m=w.type,g=this.loaders[m];if(!w.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=w.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(g&&(P.logger.warn("abort previous key loader for type:"+m),g.abort()),!b){P.logger.warn("key uri is falsy");return}var i=a.loader,s=w.loader=this.loaders[m]=new i(a);this.decrypturl=b,this.decryptkey=null;var l={url:b,frag:w,responseType:"arraybuffer"},S={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,S,v)}else this.decryptkey&&(w.decryptdata.key=this.decryptkey,this.hls.trigger(X.Events.KEY_LOADED,{frag:w}))},O.loadsuccess=function(d,p,w){var m=w.frag;if(!m.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=m.decryptdata.key=new Uint8Array(d.data),m.loader=null,delete this.loaders[m.type],this.hls.trigger(X.Events.KEY_LOADED,{frag:m})},O.loaderror=function(d,p){var w=p.frag,m=w.loader;m&&m.abort(),delete this.loaders[w.type],this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:w,response:d})},O.loadtimeout=function(d,p){var w=p.frag,m=w.loader;m&&m.abort(),delete this.loaders[w.type],this.hls.trigger(X.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:w})},B}()},"./src/loader/level-details.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"LevelDetails",function(){return B});var X=k("./src/polyfills/number.ts");function U(O,A){for(var d=0;d<A.length;d++){var p=A[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function P(O,A,d){return A&&U(O.prototype,A),d&&U(O,d),O}var W=10,B=function(){function O(d){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=d}var A=O.prototype;return A.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var w=this.lastPartSn-p.lastPartSn,m=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!m||!!w,this.advanced=this.endSN>p.endSN||w>0||w===0&&m>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},P(O,[{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 p=this.driftEndTime-this.driftStartTime;if(p>0){var w=this.driftEnd-this.driftStart;return w*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.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 p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"LevelKey",function(){return B});var X=k("./node_modules/url-toolkit/src/url-toolkit.js"),U=k.n(X);function P(O,A){for(var d=0;d<A.length;d++){var p=A[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function W(O,A,d){return A&&P(O.prototype,A),d&&P(O,d),O}var B=function(){O.fromURL=function(d,p){return new O(d,p)},O.fromURI=function(d){return new O(d)};function O(A,d){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,d?this._uri=Object(X.buildAbsoluteURL)(A,d,{alwaysNormalize:!0}):this._uri=A}return W(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"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(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s});var X=k("./src/polyfills/number.ts"),U=k("./node_modules/url-toolkit/src/url-toolkit.js"),P=k.n(U),W=k("./src/loader/fragment.ts"),B=k("./src/loader/level-details.ts"),O=k("./src/loader/level-key.ts"),A=k("./src/utils/attr-list.ts"),d=k("./src/utils/logger.ts"),p=k("./src/utils/codecs.ts"),w=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,m=/#EXT-X-MEDIA:(.*)/g,g=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function i(R){var _,C;return a.test((_=(C=U.parseURL(R))===null||C===void 0?void 0:C.path)!=null?_:"")}var s=function(){function R(){}return R.findGroup=function(C,E){for(var c=0;c<C.length;c++){var u=C[c];if(u.id===E)return u}},R.convertAVC1ToAVCOTI=function(C){var E=C.split(".");if(E.length>2){var c=E.shift()+".";return c+=parseInt(E.shift()).toString(16),c+=("000"+parseInt(E.shift()).toString(16)).substr(-4),c}return C},R.resolve=function(C,E){return U.buildAbsoluteURL(E,C,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(C,E){var c=[],u={},h=!1;w.lastIndex=0;for(var T;(T=w.exec(C))!=null;)if(T[1]){var L=new A.AttrList(T[1]),I={attrs:L,bitrate:L.decimalInteger("AVERAGE-BANDWIDTH")||L.decimalInteger("BANDWIDTH"),name:L.NAME,url:R.resolve(T[2],E)},F=L.decimalResolution("RESOLUTION");F&&(I.width=F.width,I.height=F.height),l((L.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=R.convertAVC1ToAVCOTI(I.videoCodec)),c.push(I)}else if(T[3]){var j=new A.AttrList(T[3]);j["DATA-ID"]&&(h=!0,u[j["DATA-ID"]]=j)}return{levels:c,sessionData:h?u:null}},R.parseMasterPlaylistMedia=function(C,E,c,u){u===void 0&&(u=[]);var h,T=[],L=0;for(m.lastIndex=0;(h=m.exec(C))!==null;){var I=new A.AttrList(h[1]);if(I.TYPE===c){var F={attrs:I,bitrate:0,id:L++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:c,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?R.resolve(I.URI,E):""};if(u.length){var j=R.findGroup(u,F.groupId)||u[0];S(F,j,"audioCodec"),S(F,j,"textCodec")}T.push(F)}}return T},R.parseLevelPlaylist=function(C,E,c,u,h){var T=new B.LevelDetails(E),L=T.fragments,I=null,F=0,j=0,z=0,M=0,N=null,Y=new W.Fragment(u,E),ee,le,pe,Oe=-1,Te=!1;for(g.lastIndex=0,T.m3u8=C;(ee=g.exec(C))!==null;){Te&&(Te=!1,Y=new W.Fragment(u,E),Y.start=z,Y.sn=F,Y.cc=M,Y.level=c,I&&(Y.initSegment=I,Y.rawProgramDateTime=I.rawProgramDateTime));var Re=ee[1];if(Re){Y.duration=parseFloat(Re);var Ae=(" "+ee[2]).slice(1);Y.title=Ae||null,Y.tagList.push(Ae?["INF",Re,Ae]:["INF",Re])}else if(ee[3])Object(X.isFiniteNumber)(Y.duration)&&(Y.start=z,pe&&(Y.levelkey=pe),Y.sn=F,Y.level=c,Y.cc=M,Y.urlId=h,L.push(Y),Y.relurl=(" "+ee[3]).slice(1),y(Y,N),N=Y,z+=Y.duration,F++,j=0,Te=!0);else if(ee[4]){var we=(" "+ee[4]).slice(1);N?Y.setByteRange(we,N):Y.setByteRange(we)}else if(ee[5])Y.rawProgramDateTime=(" "+ee[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Oe===-1&&(Oe=L.length);else{if(ee=ee[0].match(b),!ee){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(le=1;le<ee.length&&!(typeof ee[le]!="undefined");le++);var ge=(" "+ee[le]).slice(1),de=(" "+ee[le+1]).slice(1),re=ee[le+2]?(" "+ee[le+2]).slice(1):"";switch(ge){case"PLAYLIST-TYPE":T.type=de.toUpperCase();break;case"MEDIA-SEQUENCE":F=T.startSN=parseInt(de);break;case"SKIP":{var ce=new A.AttrList(de),se=ce.decimalInteger("SKIPPED-SEGMENTS");if(Object(X.isFiniteNumber)(se)){T.skippedSegments=se;for(var ke=se;ke--;)L.unshift(null);F+=se}var ie=ce.enumeratedString("RECENTLY-REMOVED-DATERANGES");ie&&(T.recentlyRemovedDateranges=ie.split(" "));break}case"TARGETDURATION":T.targetduration=parseFloat(de);break;case"VERSION":T.version=parseInt(de);break;case"EXTM3U":break;case"ENDLIST":T.live=!1;break;case"#":(de||re)&&Y.tagList.push(re?[de,re]:[de]);break;case"DIS":M++;case"GAP":Y.tagList.push([ge]);break;case"BITRATE":Y.tagList.push([ge,de]);break;case"DISCONTINUITY-SEQ":M=parseInt(de);break;case"KEY":{var ae,me=new A.AttrList(de),_e=me.enumeratedString("METHOD"),Me=me.URI,Ue=me.hexadecimalInteger("IV"),je=me.enumeratedString("KEYFORMATVERSIONS"),Fe=me.enumeratedString("KEYID"),Je=(ae=me.enumeratedString("KEYFORMAT"))!=null?ae:"identity",$e=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if($e.indexOf(Je)>-1){d.logger.warn("Keyformat "+Je+" is not supported from the manifest");continue}else if(Je!=="identity")continue;_e&&(pe=O.LevelKey.fromURL(E,Me),Me&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(_e)>=0&&(pe.method=_e,pe.keyFormat=Je,Fe&&(pe.keyID=Fe),je&&(pe.keyFormatVersions=je),pe.iv=Ue));break}case"START":{var Qe=new A.AttrList(de),Xe=Qe.decimalFloatingPoint("TIME-OFFSET");Object(X.isFiniteNumber)(Xe)&&(T.startTimeOffset=Xe);break}case"MAP":{var dt=new A.AttrList(de);Y.relurl=dt.URI,dt.BYTERANGE&&Y.setByteRange(dt.BYTERANGE),Y.level=c,Y.sn="initSegment",pe&&(Y.levelkey=pe),Y.initSegment=null,I=Y,Te=!0;break}case"SERVER-CONTROL":{var tt=new A.AttrList(de);T.canBlockReload=tt.bool("CAN-BLOCK-RELOAD"),T.canSkipUntil=tt.optionalFloat("CAN-SKIP-UNTIL",0),T.canSkipDateRanges=T.canSkipUntil>0&&tt.bool("CAN-SKIP-DATERANGES"),T.partHoldBack=tt.optionalFloat("PART-HOLD-BACK",0),T.holdBack=tt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var lt=new A.AttrList(de);T.partTarget=lt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ie=T.partList;Ie||(Ie=T.partList=[]);var et=j>0?Ie[Ie.length-1]:void 0,it=j++,Be=new W.Part(new A.AttrList(de),Y,E,it,et);Ie.push(Be),Y.duration+=Be.duration;break}case"PRELOAD-HINT":{var ze=new A.AttrList(de);T.preloadHint=ze;break}case"RENDITION-REPORT":{var Ce=new A.AttrList(de);T.renditionReports=T.renditionReports||[],T.renditionReports.push(Ce);break}default:d.logger.warn("line parsed but not handled: "+ee);break}}}N&&!N.relurl?(L.pop(),z-=N.duration,T.partList&&(T.fragmentHint=N)):T.partList&&(y(Y,N),Y.cc=M,T.fragmentHint=Y);var ye=L.length,xe=L[0],ne=L[ye-1];if(z+=T.skippedSegments*T.targetduration,z>0&&ye&&ne){T.averagetargetduration=z/ye;var oe=ne.sn;T.endSN=oe!=="initSegment"?oe:0,xe&&(T.startCC=xe.cc,xe.initSegment||T.fragments.every(function(he){return he.relurl&&i(he.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new W.Fragment(u,E),Y.relurl=ne.relurl,Y.level=c,Y.sn="initSegment",xe.initSegment=Y,T.needSidxRanges=!0))}else T.endSN=0,T.startCC=0;return T.fragmentHint&&(z+=T.fragmentHint.duration),T.totalduration=z,T.endCC=M,Oe>0&&v(L,Oe),T},R}();function l(R,_){["video","audio","text"].forEach(function(C){var E=R.filter(function(u){return Object(p.isCodecType)(u,C)});if(E.length){var c=E.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});_[C+"Codec"]=c.length>0?c[0]:E[0],R=R.filter(function(u){return E.indexOf(u)===-1})}}),_.unknownCodecs=R}function S(R,_,C){var E=_[C];E&&(R[C]=E)}function v(R,_){for(var C=R[_],E=_;E--;){var c=R[E];if(!c)return;c.programDateTime=C.programDateTime-c.duration*1e3,C=c}}function y(R,_){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):_!=null&&_.programDateTime&&(R.programDateTime=_.endProgramDateTime),Object(X.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/polyfills/number.ts"),U=k("./src/events.ts"),P=k("./src/errors.ts"),W=k("./src/utils/logger.ts"),B=k("./src/utils/mp4-tools.ts"),O=k("./src/loader/m3u8-parser.ts"),A=k("./src/types/loader.ts"),d=k("./src/utils/attr-list.ts");function p(g){var b=g.type;switch(b){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function w(g,b){var a=g.url;return(a===void 0||a.indexOf("data:")===0)&&(a=b.url),a}var m=function(){function g(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var b=g.prototype;return b.registerListeners=function(){var i=this.hls;i.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var i=this.hls;i.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(i){var s=this.hls.config,l=s.pLoader,S=s.loader,v=l||S,y=new v(s);return i.loader=y,this.loaders[i.type]=y,y},b.getInternalLoader=function(i){return this.loaders[i.type]},b.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},b.destroyInternalLoaders=function(){for(var i in this.loaders){var s=this.loaders[i];s&&s.destroy(),this.resetInternalLoader(i)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(i,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},b.onLevelLoading=function(i,s){var l=s.id,S=s.level,v=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:null,level:S,responseType:"text",type:A.PlaylistContextType.LEVEL,url:v,deliveryDirectives:y})},b.onAudioTrackLoading=function(i,s){var l=s.id,S=s.groupId,v=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:y})},b.onSubtitleTrackLoading=function(i,s){var l=s.id,S=s.groupId,v=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:y})},b.load=function(i){var s,l=this.hls.config,S=this.getInternalLoader(i);if(S){var v=S.context;if(v&&v.url===i.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),S.abort()}var y,R,_,C;switch(i.type){case A.PlaylistContextType.MANIFEST:y=l.manifestLoadingMaxRetry,R=l.manifestLoadingTimeOut,_=l.manifestLoadingRetryDelay,C=l.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:y=0,R=l.levelLoadingTimeOut;break;default:y=l.levelLoadingMaxRetry,R=l.levelLoadingTimeOut,_=l.levelLoadingRetryDelay,C=l.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var E;if(i.type===A.PlaylistContextType.LEVEL&&i.level!==null?E=this.hls.levels[i.level].details:i.type===A.PlaylistContextType.AUDIO_TRACK&&i.id!==null?E=this.hls.audioTracks[i.id].details:i.type===A.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(E=this.hls.subtitleTracks[i.id].details),E){var c=E.partTarget,u=E.targetduration;c&&u&&(R=Math.min(Math.max(c*3,u*.8)*1e3,R))}}var h={timeout:R,maxRetry:y,retryDelay:_,maxRetryDelay:C,highWaterMark:0},T={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(i,h,T)},b.loadsuccess=function(i,s,l,S){if(S===void 0&&(S=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,s,l,S);return}this.resetInternalLoader(l.type);var v=i.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,l,S):this.handleMasterPlaylist(i,s,l,S)},b.loaderror=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,i)},b.loadtimeout=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},b.handleMasterPlaylist=function(i,s,l,S){var v=this.hls,y=i.data,R=w(i,l),_=O.default.parseMasterPlaylist(y,R),C=_.levels,E=_.sessionData;if(!C.length){this.handleManifestParsingError(i,l,"no level found in manifest",S);return}var c=C.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),u=C.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),h=O.default.parseMasterPlaylistMedia(y,R,"AUDIO",c),T=O.default.parseMasterPlaylistMedia(y,R,"SUBTITLES",u),L=O.default.parseMasterPlaylistMedia(y,R,"CLOSED-CAPTIONS");if(h.length){var I=h.some(function(F){return!F.url});!I&&C[0].audioCodec&&!C[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:C,audioTracks:h,subtitles:T,captions:L,url:R,stats:s,networkDetails:S,sessionData:E})},b.handleTrackOrLevelPlaylist=function(i,s,l,S){var v=this.hls,y=l.id,R=l.level,_=l.type,C=w(i,l),E=Object(X.isFiniteNumber)(y)?y:0,c=Object(X.isFiniteNumber)(R)?R:E,u=p(l),h=O.default.parseLevelPlaylist(i.data,C,c,u,E);if(!h.fragments.length){v.trigger(U.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:C,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(_===A.PlaylistContextType.MANIFEST){var T={attrs:new d.AttrList({}),bitrate:0,details:h,name:"",url:C};v.trigger(U.Events.MANIFEST_LOADED,{levels:[T],audioTracks:[],url:C,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),h.needSidxRanges){var L,I=(L=h.fragments[0].initSegment)===null||L===void 0?void 0:L.url;this.load({url:I,isSidxRequest:!0,type:_,level:R,levelDetails:h,id:y,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=h,this.handlePlaylistLoaded(i,s,l,S)},b.handleSidxRequest=function(i,s){var l=Object(B.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var S=l.references,v=s.levelDetails;S.forEach(function(y,R){var _=y.info,C=v.fragments[R];C.byteRange.length===0&&C.setByteRange(String(1+_.end-_.start)+"@"+String(_.start)),C.initSegment&&C.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(i,s,l,S){this.hls.trigger(U.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:s,networkDetails:S})},b.handleNetworkError=function(i,s,l,S){l===void 0&&(l=!1),W.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var v=P.ErrorDetails.UNKNOWN,y=!1,R=this.getInternalLoader(i);switch(i.type){case A.PlaylistContextType.MANIFEST:v=l?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,y=!0;break;case A.PlaylistContextType.LEVEL:v=l?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,y=!1;break;case A.PlaylistContextType.AUDIO_TRACK:v=l?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,y=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:v=l?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,y=!1;break}R&&this.resetInternalLoader(i.type);var _={type:P.ErrorTypes.NETWORK_ERROR,details:v,fatal:y,url:i.url,loader:R,context:i,networkDetails:s};S&&(_.response=S),this.hls.trigger(U.Events.ERROR,_)},b.handlePlaylistLoaded=function(i,s,l,S){var v=l.type,y=l.level,R=l.id,_=l.groupId,C=l.loader,E=l.levelDetails,c=l.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",S);return}if(!C)return;E.live&&(C.getCacheAge&&(E.ageHeader=C.getCacheAge()||0),(!C.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(v){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:E,level:y||0,id:R||0,stats:s,networkDetails:S,deliveryDirectives:c});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:E,id:R||0,groupId:_||"",stats:s,networkDetails:S,deliveryDirectives:c});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:E,id:R||0,groupId:_||"",stats:s,networkDetails:S,deliveryDirectives:c});break}},g}();J.default=m},"./src/polyfills/number.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"isFiniteNumber",function(){return X}),k.d(J,"MAX_SAFE_INTEGER",function(){return U});var X=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,J,k){"use strict";k.r(J);var X=function(){function U(){}return U.getSilentFrame=function(W,B){switch(W){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===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}();J.default=X},"./src/remux/mp4-generator.ts":function(ue,J,k){"use strict";k.r(J);var X=Math.pow(2,32)-1,U=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var B;for(B in P.types)P.types.hasOwnProperty(B)&&(P.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var O=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]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:O,audio:A};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=p,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var w=new Uint8Array([105,115,111,109]),m=new Uint8Array([97,118,99,49]),g=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,w,g,w,m),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,d))},P.box=function(B){for(var O=8,A=arguments.length,d=new Array(A>1?A-1:0),p=1;p<A;p++)d[p-1]=arguments[p];for(var w=d.length,m=w;w--;)O+=d[w].byteLength;var g=new Uint8Array(O);for(g[0]=O>>24&255,g[1]=O>>16&255,g[2]=O>>8&255,g[3]=O&255,g.set(B,4),w=0,O=8;w<m;w++)g.set(d[w],O),O+=d[w].byteLength;return g},P.hdlr=function(B){return P.box(P.types.hdlr,P.HDLR_TYPES[B])},P.mdat=function(B){return P.box(P.types.mdat,B)},P.mdhd=function(B,O){O*=B;var A=Math.floor(O/(X+1)),d=Math.floor(O%(X+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},P.mdia=function(B){return P.box(P.types.mdia,P.mdhd(B.timescale,B.duration),P.hdlr(B.type),P.minf(B))},P.mfhd=function(B){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},P.minf=function(B){return B.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(B)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(B))},P.moof=function(B,O,A){return P.box(P.types.moof,P.mfhd(B),P.traf(A,O))},P.moov=function(B){for(var O=B.length,A=[];O--;)A[O]=P.trak(B[O]);return P.box.apply(null,[P.types.moov,P.mvhd(B[0].timescale,B[0].duration)].concat(A).concat(P.mvex(B)))},P.mvex=function(B){for(var O=B.length,A=[];O--;)A[O]=P.trex(B[O]);return P.box.apply(null,[P.types.mvex].concat(A))},P.mvhd=function(B,O){O*=B;var A=Math.floor(O/(X+1)),d=Math.floor(O%(X+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,d>>24,d>>16&255,d>>8&255,d&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,p)},P.sdtp=function(B){var O=B.samples||[],A=new Uint8Array(4+O.length),d,p;for(d=0;d<O.length;d++)p=O[d].flags,A[d+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return P.box(P.types.sdtp,A)},P.stbl=function(B){return P.box(P.types.stbl,P.stsd(B),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(B){var O=[],A=[],d,p,w;for(d=0;d<B.sps.length;d++)p=B.sps[d],w=p.byteLength,O.push(w>>>8&255),O.push(w&255),O=O.concat(Array.prototype.slice.call(p));for(d=0;d<B.pps.length;d++)p=B.pps[d],w=p.byteLength,A.push(w>>>8&255),A.push(w&255),A=A.concat(Array.prototype.slice.call(p));var m=P.box(P.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|B.sps.length].concat(O).concat([B.pps.length]).concat(A))),g=B.width,b=B.height,a=B.pixelRatio[0],i=B.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,g>>8&255,g&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),m,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255])))},P.esds=function(B){var O=B.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(B.config).concat([6,1,2]))},P.mp4a=function(B){var O=B.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),P.box(P.types.esds,P.esds(B)))},P.mp3=function(B){var O=B.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},P.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(B)):P.box(P.types.stsd,P.STSD,P.mp4a(B)):P.box(P.types.stsd,P.STSD,P.avc1(B))},P.tkhd=function(B){var O=B.id,A=B.duration*B.timescale,d=B.width,p=B.height,w=Math.floor(A/(X+1)),m=Math.floor(A%(X+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,m>>24,m>>16&255,m>>8&255,m&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,d>>8&255,d&255,0,0,p>>8&255,p&255,0,0]))},P.traf=function(B,O){var A=P.sdtp(B),d=B.id,p=Math.floor(O/(X+1)),w=Math.floor(O%(X+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,w>>24,w>>16&255,w>>8&255,w&255])),P.trun(B,A.length+16+20+8+16+8+8),A)},P.trak=function(B){return B.duration=B.duration||4294967295,P.box(P.types.trak,P.tkhd(B),P.mdia(B))},P.trex=function(B){var O=B.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(B,O){var A=B.samples||[],d=A.length,p=12+16*d,w=new Uint8Array(p),m,g,b,a,i,s;for(O+=8+p,w.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),m=0;m<d;m++)g=A[m],b=g.duration,a=g.size,i=g.flags,s=g.cts,w.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*m);return P.box(P.types.trun,w)},P.initSegment=function(B){P.types||P.init();var O=P.moov(B),A=new Uint8Array(P.FTYP.byteLength+O.byteLength);return A.set(P.FTYP),A.set(O,P.FTYP.byteLength),A},P}();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,J.default=U},"./src/remux/mp4-remuxer.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s}),k.d(J,"normalizePts",function(){return l});var X=k("./src/polyfills/number.ts"),U=k("./src/remux/aac-helper.ts"),P=k("./src/remux/mp4-generator.ts"),W=k("./src/events.ts"),B=k("./src/errors.ts"),O=k("./src/utils/logger.ts"),A=k("./src/types/loader.ts"),d=k("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(R){for(var _=1;_<arguments.length;_++){var C=arguments[_];for(var E in C)Object.prototype.hasOwnProperty.call(C,E)&&(R[E]=C[E])}return R},p.apply(this,arguments)}var w=10*1e3,m=1024,g=1152,b=null,a=null,i=!1,s=function(){function R(C,E,c,u){if(u===void 0&&(u=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=C,this.config=E,this.typeSupported=c,this.ISGenerated=!1,b===null){var h=navigator.userAgent||"",T=h.match(/Chrome\/(\d+)/i);b=T?parseInt(T[1]):0}if(a===null){var L=navigator.userAgent.match(/Safari\/(\d+)/i);a=L?parseInt(L[1]):0}i=!!b&&b<75||!!a&&a<600}var _=R.prototype;return _.destroy=function(){},_.resetTimeStamp=function(E){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=E},_.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},_.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},_.getVideoStartPts=function(E){var c=!1,u=E.reduce(function(h,T){var L=T.pts-h;return L<-4294967296?(c=!0,l(h,T.pts)):L>0?h:T.pts},E[0].pts);return c&&O.logger.debug("PTS rollover detected"),u},_.remux=function(E,c,u,h,T,L,I,F){var j,z,M,N,Y,ee,le=T,pe=T,Oe=E.pid>-1,Te=c.pid>-1,Re=c.samples.length,Ae=E.samples.length>0,we=Re>1,ge=(!Oe||Ae)&&(!Te||we)||this.ISGenerated||I;if(ge){this.ISGenerated||(M=this.generateIS(E,c,T));var de=this.isVideoContiguous,re=-1;if(we&&(re=S(c.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,re>0){O.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+Re+" video samples due to a missing keyframe");var ce=this.getVideoStartPts(c.samples);c.samples=c.samples.slice(re),c.dropped+=re,pe+=(c.samples[0].pts-ce)/(c.timescale||9e4)}else re===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+Re+" video samples"),ee=!1);if(this.ISGenerated){if(Ae&&we){var se=this.getVideoStartPts(c.samples),ke=l(E.samples[0].pts,se)-se,ie=ke/c.inputTimeScale;le+=Math.max(0,ie),pe+=Math.max(0,-ie)}if(Ae){if(E.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(E,c,T)),z=this.remuxAudio(E,le,this.isAudioContiguous,L,Te||we||F===A.PlaylistLevelType.AUDIO?pe:void 0),we){var ae=z?z.endPTS-z.startPTS:0;c.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(E,c,T)),j=this.remuxVideo(c,pe,de,ae)}}else we&&(j=this.remuxVideo(c,pe,de,0));j&&(j.firstKeyFrame=re,j.independent=re!==-1)}}return this.ISGenerated&&(u.samples.length&&(Y=this.remuxID3(u,T)),h.samples.length&&(N=this.remuxText(h,T))),{audio:z,video:j,initSegment:M,independent:ee,text:N,id3:Y}},_.generateIS=function(E,c,u){var h=E.samples,T=c.samples,L=this.typeSupported,I={},F=!Object(X.isFiniteNumber)(this._initPTS),j="audio/mp4",z,M,N;if(F&&(z=M=Infinity),E.config&&h.length&&(E.timescale=E.samplerate,E.isAAC||(L.mpeg?(j="audio/mpeg",E.codec=""):L.mp3&&(E.codec="mp3")),I.audio={id:"audio",container:j,codec:E.codec,initSegment:!E.isAAC&&L.mpeg?new Uint8Array(0):P.default.initSegment([E]),metadata:{channelCount:E.channelCount}},F&&(N=E.inputTimeScale,z=M=h[0].pts-Math.round(N*u))),c.sps&&c.pps&&T.length&&(c.timescale=c.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:c.codec,initSegment:P.default.initSegment([c]),metadata:{width:c.width,height:c.height}},F)){N=c.inputTimeScale;var Y=this.getVideoStartPts(T),ee=Math.round(N*u);M=Math.min(M,l(T[0].dts,Y)-ee),z=Math.min(z,Y-ee)}if(Object.keys(I).length)return this.ISGenerated=!0,F&&(this._initPTS=z,this._initDTS=M),{tracks:I,initPTS:z,timescale:N}},_.remuxVideo=function(E,c,u,h){var T=E.inputTimeScale,L=E.samples,I=[],F=L.length,j=this._initPTS,z=this.nextAvcDts,M=8,N,Y,ee,le=Number.POSITIVE_INFINITY,pe=Number.NEGATIVE_INFINITY,Oe=0,Te=!1;if(!u||z===null){var Re=c*T,Ae=L[0].pts-l(L[0].dts,L[0].pts);z=Re-Ae}for(var we=0;we<F;we++){var ge=L[we];if(ge.pts=l(ge.pts-j,z),ge.dts=l(ge.dts-j,z),ge.dts>ge.pts){var de=9e4*.2;Oe=Math.max(Math.min(Oe,ge.pts-ge.dts),-1*de)}ge.dts<L[we>0?we-1:we].dts&&(Te=!0)}Te&&L.sort(function(Mt,Pt){var yt=Mt.dts-Pt.dts,Ht=Mt.pts-Pt.pts;return yt||Ht}),Y=L[0].dts,ee=L[L.length-1].dts;var re=Math.round((ee-Y)/(F-1));if(Oe<0){if(Oe<re*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-re,!0)+" ms");for(var ce=Oe,se=0;se<F;se++)L[se].dts=ce=Math.max(ce,L[se].pts-re),L[se].pts=Math.max(ce,L[se].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(Oe,!0)+" ms to overcome this issue");for(var ke=0;ke<F;ke++)L[ke].dts=L[ke].dts+Oe}Y=L[0].dts}if(u){var ie=Y-z,ae=ie>re,me=ie<-1;if(ae||me){ae?O.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(ie,!0)+" ms ("+ie+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-ie,!0)+" ms ("+ie+"dts) overlapping between fragments detected"),Y=z;var _e=L[0].pts-ie;L[0].dts=Y,L[0].pts=_e,O.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(_e,!0)+"/"+Object(d.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(ie,!0)+" ms")}}i&&(Y=Math.max(0,Y));for(var Me=0,Ue=0,je=0;je<F;je++){for(var Fe=L[je],Je=Fe.units,$e=Je.length,Qe=0,Xe=0;Xe<$e;Xe++)Qe+=Je[Xe].data.length;Ue+=Qe,Me+=$e,Fe.length=Qe,Fe.dts=Math.max(Fe.dts,Y),Fe.pts=Math.max(Fe.pts,Fe.dts,0),le=Math.min(Fe.pts,le),pe=Math.max(Fe.pts,pe)}ee=L[F-1].dts;var dt=Ue+4*Me+8,tt;try{tt=new Uint8Array(dt)}catch(Mt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var lt=new DataView(tt.buffer);lt.setUint32(0,dt),tt.set(P.default.types.mdat,4);for(var Ie=0;Ie<F;Ie++){for(var et=L[Ie],it=et.units,Be=0,ze=0,Ce=it.length;ze<Ce;ze++){var ye=it[ze],xe=ye.data,ne=ye.data.byteLength;lt.setUint32(M,ne),M+=4,tt.set(xe,M),M+=ne,Be+=4+ne}if(Ie<F-1)N=L[Ie+1].dts-et.dts;else{var oe=this.config,he=et.dts-L[Ie>0?Ie-1:Ie].dts;if(oe.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(oe.maxBufferHole*T),Ne=(h?le+h*T:this.nextAudioPts)-et.pts;Ne>ve?(N=Ne-he,N<0&&(N=he),O.logger.log("[mp4-remuxer]: It is approximately "+Ne/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=he}else N=he}var Le=Math.round(et.pts-et.dts);I.push(new v(et.key,N,Be,Le))}if(I.length&&b&&b<70){var Ke=I[0].flags;Ke.dependsOn=2,Ke.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=ee+N,this.isVideoContiguous=!0;var at=P.default.moof(E.sequenceNumber++,Y,p({},E,{samples:I})),mt="video",pt={data1:at,data2:tt,startPTS:le/T,endPTS:(pe+N)/T,startDTS:Y/T,endDTS:z/T,type:mt,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(tt.length,"MDAT length must not be zero"),pt},_.remuxAudio=function(E,c,u,h,T){var L=E.inputTimeScale,I=E.samplerate?E.samplerate:L,F=L/I,j=E.isAAC?m:g,z=j*F,M=this._initPTS,N=!E.isAAC&&this.typeSupported.mpeg,Y=[],ee=E.samples,le=N?0:8,pe=this.nextAudioPts||-1,Oe=c*L;if(this.isAudioContiguous=u=u||ee.length&&pe>0&&(h&&Math.abs(Oe-pe)<9e3||Math.abs(l(ee[0].pts-M,Oe)-pe)<20*z),ee.forEach(function(xe){xe.pts=l(xe.pts-M,Oe)}),!u||pe<0){if(ee=ee.filter(function(xe){return xe.pts>=0}),!ee.length)return;T===0?pe=0:h?pe=Math.max(0,Oe):pe=ee[0].pts}if(E.isAAC)for(var Te=T!==void 0,Re=this.config.maxAudioFramesDrift,Ae=0,we=pe;Ae<ee.length;Ae++){var ge=ee[Ae],de=ge.pts,re=de-we,ce=Math.abs(1e3*re/L);if(re<=-Re*z&&Te)Ae===0&&(O.logger.warn("Audio frame @ "+(de/L).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/L)+" ms."),this.nextAudioPts=pe=we=de);else if(re>=Re*z&&ce<w&&Te){var se=Math.round(re/z);we=de-se*z,we<0&&(se--,we+=z),Ae===0&&(this.nextAudioPts=pe=we),O.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(we/L).toFixed(3)+"s due to "+Math.round(1e3*re/L)+" ms gap.");for(var ke=0;ke<se;ke++){var ie=Math.max(we,0),ae=U.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);ae||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ae=ge.unit.subarray()),ee.splice(Ae,0,{unit:ae,pts:ie}),we+=z,Ae++}}ge.pts=we,we+=z}for(var me=null,_e=null,Me,Ue=0,je=ee.length;je--;)Ue+=ee[je].unit.byteLength;for(var Fe=0,Je=ee.length;Fe<Je;Fe++){var $e=ee[Fe],Qe=$e.unit,Xe=$e.pts;if(_e!==null){var dt=Y[Fe-1];dt.duration=Math.round((Xe-_e)/F)}else if(u&&E.isAAC&&(Xe=pe),me=Xe,Ue>0){Ue+=le;try{Me=new Uint8Array(Ue)}catch(xe){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ue,reason:"fail allocating audio mdat "+Ue});return}if(!N){var tt=new DataView(Me.buffer);tt.setUint32(0,Ue),Me.set(P.default.types.mdat,4)}}else return;Me.set(Qe,le);var lt=Qe.byteLength;le+=lt,Y.push(new v(!0,j,lt,0)),_e=Xe}var Ie=Y.length;if(!Ie)return;var et=Y[Y.length-1];this.nextAudioPts=pe=_e+F*et.duration;var it=N?new Uint8Array(0):P.default.moof(E.sequenceNumber++,me/F,p({},E,{samples:Y}));E.samples=[];var Be=me/L,ze=pe/L,Ce="audio",ye={data1:it,data2:Me,startPTS:Be,endPTS:ze,startDTS:Be,endDTS:ze,type:Ce,hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,console.assert(Me.length,"MDAT length must not be zero"),ye},_.remuxEmptyAudio=function(E,c,u,h){var T=E.inputTimeScale,L=E.samplerate?E.samplerate:T,I=T/L,F=this.nextAudioPts,j=(F!==null?F:h.startDTS*T)+this._initDTS,z=h.endDTS*T+this._initDTS,M=I*m,N=Math.ceil((z-j)/M),Y=U.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],le=0;le<N;le++){var pe=j+le*M;ee.push({unit:Y,pts:pe,dts:pe})}return E.samples=ee,this.remuxAudio(E,c,u,!1)},_.remuxID3=function(E,c){var u=E.samples.length;if(!u)return;for(var h=E.inputTimeScale,T=this._initPTS,L=this._initDTS,I=0;I<u;I++){var F=E.samples[I];F.pts=l(F.pts-T,c*h)/h,F.dts=l(F.dts-L,c*h)/h}var j=E.samples;return E.samples=[],{samples:j}},_.remuxText=function(E,c){var u=E.samples.length;if(!u)return;for(var h=E.inputTimeScale,T=this._initPTS,L=0;L<u;L++){var I=E.samples[L];I.pts=l(I.pts-T,c*h)/h}E.samples.sort(function(j,z){return j.pts-z.pts});var F=E.samples;return E.samples=[],{samples:F}},R}();function l(R,_){var C;if(_===null)return R;for(_<R?C=-8589934592:C=8589934592;Math.abs(R-_)>4294967296;)R+=C;return R}function S(R){for(var _=0;_<R.length;_++)if(R[_].key)return _;return-1}var v=function(_,C,E,c){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=C,this.size=E,this.cts=c,this.flags=new y(_)},y=function(_){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=_?2:1,this.isNonSync=_?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/polyfills/number.ts"),U=k("./src/utils/mp4-tools.ts"),P=k("./src/loader/fragment.ts"),W=k("./src/utils/logger.ts"),B=function(){function d(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var p=d.prototype;return p.destroy=function(){},p.resetTimeStamp=function(m){this.initPTS=m,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(m,g,b){this.audioCodec=g,this.videoCodec=b,this.generateInitSegment(m),this.emitInitSegment=!0},p.generateInitSegment=function(m){var g=this.audioCodec,b=this.videoCodec;if(!m||!m.byteLength){this.initTracks=void 0,this.initData=void 0;return}var a=this.initData=Object(U.parseInitSegment)(m);g||(g=A(a.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=A(a.video,P.ElementaryStreamTypes.VIDEO));var i={};a.audio&&a.video?i.audiovideo={container:"video/mp4",codec:g+","+b,initSegment:m,id:"main"}:a.audio?i.audio={container:"audio/mp4",codec:g,initSegment:m,id:"audio"}:a.video?i.video={container:"video/mp4",codec:b,initSegment:m,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},p.remux=function(m,g,b,a,i){var s=this.initPTS,l=this.lastEndDTS,S={audio:void 0,video:void 0,text:a,id3:b,initSegment:void 0};Object(X.isFiniteNumber)(l)||(l=this.lastEndDTS=i||0);var v=g.samples;if(!v||!v.length)return S;var y={initPTS:void 0,timescale:1},R=this.initData;if((!R||!R.length)&&(this.generateInitSegment(v),R=this.initData),!R||!R.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1),Object(X.isFiniteNumber)(s)||(this.initPTS=y.initPTS=s=O(R,v,l));var _=Object(U.getDuration)(v,R),C=l,E=_+C;Object(U.offsetStartDTS)(R,v,s),_>0?this.lastEndDTS=E:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var c=!!R.audio,u=!!R.video,h="";c&&(h+="audio"),u&&(h+="video");var T={data1:v,startPTS:C,startDTS:C,endPTS:E,endDTS:E,type:h,hasAudio:c,hasVideo:u,nb:1,dropped:0};return S.audio=T.type==="audio"?T:void 0,S.video=T.type!=="audio"?T:void 0,S.text=a,S.id3=b,S.initSegment=y,S},d}(),O=function(p,w,m){return Object(U.getStartDTS)(p,w)-m};function A(d,p){var w=d==null?void 0:d.codec;return w&&w.length>4?w:w==="hvc1"?"hvc1.1.c.L120.90":w==="av01"?"av01.0.04M.08":w==="avc1"||p===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=B},"./src/task-loop.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"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 P=U.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"CMCDVersion",function(){return X}),k.d(J,"CMCDObjectType",function(){return U}),k.d(J,"CMCDStreamingFormat",function(){return P}),k.d(J,"CMCDStreamType",function(){return W});var X=1,U;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(U||(U={}));var P;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(P||(P={}));var W;(function(B){B.VOD="v",B.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"HlsSkip",function(){return P}),k.d(J,"getSkipValue",function(){return W}),k.d(J,"HlsUrlParameters",function(){return B}),k.d(J,"Level",function(){return O});function X(A,d){for(var p=0;p<d.length;p++){var w=d[p];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(A,w.key,w)}}function U(A,d,p){return d&&X(A.prototype,d),p&&X(A,p),A}var P;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(P||(P={}));function W(A,d){var p=A.canSkipUntil,w=A.canSkipDateRanges,m=A.endSN,g=d!==void 0?d-m:0;return p&&g<p?w?P.v2:P.Yes:P.No}var B=function(){function A(p,w,m){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=w,this.skip=m}var d=A.prototype;return d.addDirectives=function(w){var m=new self.URL(w);return this.msn!==void 0&&m.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&m.searchParams.set("_HLS_part",this.part.toString()),this.skip&&m.searchParams.set("_HLS_skip",this.skip),m.toString()},A}(),O=function(){function A(d){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[d.url],this.attrs=d.attrs,this.bitrate=d.bitrate,d.details&&(this.details=d.details),this.id=d.id||0,this.name=d.name,this.width=d.width||0,this.height=d.height||0,this.audioCodec=d.audioCodec,this.videoCodec=d.videoCodec,this.unknownCodecs=d.unknownCodecs,this.codecSet=[d.videoCodec,d.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return U(A,[{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(p){var w=p%this.url.length;this._urlId!==w&&(this.details=void 0,this._urlId=w)}}]),A}()},"./src/types/loader.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"PlaylistContextType",function(){return X}),k.d(J,"PlaylistLevelType",function(){return U});var X;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(X||(X={}));var U;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"ChunkMetadata",function(){return X});var X=function(W,B,O,A,d,p){A===void 0&&(A=0),d===void 0&&(d=-1),p===void 0&&(p=!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=B,this.id=O,this.size=A,this.part=d,this.partial=p};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"AttrList",function(){return P});var X=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function W(O){typeof O=="string"&&(O=W.parseAttrList(O));for(var A in O)O.hasOwnProperty(A)&&(this[A]=O[A])}var B=W.prototype;return B.decimalInteger=function(A){var d=parseInt(this[A],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},B.hexadecimalInteger=function(A){if(this[A]){var d=(this[A]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var p=new Uint8Array(d.length/2),w=0;w<d.length/2;w++)p[w]=parseInt(d.slice(w*2,w*2+2),16);return p}else return null},B.hexadecimalIntegerAsNumber=function(A){var d=parseInt(this[A],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},B.decimalFloatingPoint=function(A){return parseFloat(this[A])},B.optionalFloat=function(A,d){var p=this[A];return p?parseFloat(p):d},B.enumeratedString=function(A){return this[A]},B.bool=function(A){return this[A]==="YES"},B.decimalResolution=function(A){var d=X.exec(this[A]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},W.parseAttrList=function(A){var d,p={},w='"';for(U.lastIndex=0;(d=U.exec(A))!==null;){var m=d[2];m.indexOf(w)===0&&m.lastIndexOf(w)===m.length-1&&(m=m.slice(1,-1)),p[d[1]]=m}return p},W}()},"./src/utils/binary-search.ts":function(ue,J,k){"use strict";k.r(J);var X={search:function(P,W){for(var B=0,O=P.length-1,A=null,d=null;B<=O;){A=(B+O)/2|0,d=P[A];var p=W(d);if(p>0)B=A+1;else if(p<0)O=A-1;else return d}return null}};J.default=X},"./src/utils/buffer-helper.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"BufferHelper",function(){return P});var X=k("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function W(){}return W.isBuffered=function(O,A){try{if(O){for(var d=W.getBuffered(O),p=0;p<d.length;p++)if(A>=d.start(p)&&A<=d.end(p))return!0}}catch(w){}return!1},W.bufferInfo=function(O,A,d){try{if(O){var p=W.getBuffered(O),w=[],m;for(m=0;m<p.length;m++)w.push({start:p.start(m),end:p.end(m)});return this.bufferedInfo(w,A,d)}}catch(g){}return{len:0,start:A,end:A,nextStart:void 0}},W.bufferedInfo=function(O,A,d){A=Math.max(0,A),O.sort(function(y,R){var _=y.start-R.start;return _||R.end-y.end});var p=[];if(d)for(var w=0;w<O.length;w++){var m=p.length;if(m){var g=p[m-1].end;O[w].start-g<d?O[w].end>g&&(p[m-1].end=O[w].end):p.push(O[w])}else p.push(O[w])}else p=O;for(var b=0,a,i=A,s=A,l=0;l<p.length;l++){var S=p[l].start,v=p[l].end;if(A+d>=S&&A<v)i=S,s=v,b=s-A;else if(A+d<S){a=S;break}}return{len:b,start:i||0,end:s||0,nextStart:a}},W.getBuffered=function(O){try{return O.buffered}catch(A){return X.logger.log("failed to get media.buffered",A),U}},W}()},"./src/utils/cea-608-parser.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"Row",function(){return s}),k.d(J,"CaptionScreen",function(){return l});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},P=function(E){var c=E;return U.hasOwnProperty(E)&&(c=U[E]),String.fromCharCode(c)},W=15,B=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},w=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],m;(function(C){C[C.ERROR=0]="ERROR",C[C.TEXT=1]="TEXT",C[C.WARNING=2]="WARNING",C[C.INFO=2]="INFO",C[C.DEBUG=3]="DEBUG",C[C.DATA=3]="DATA"})(m||(m={}));var g=function(){function C(){this.time=null,this.verboseLevel=m.ERROR}var E=C.prototype;return E.log=function(u,h){this.verboseLevel>=u&&X.logger.log(this.time+" ["+u+"] "+h)},C}(),b=function(E){for(var c=[],u=0;u<E.length;u++)c.push(E[u].toString(16));return c},a=function(){function C(c,u,h,T,L){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=c||"white",this.underline=u||!1,this.italics=h||!1,this.background=T||"black",this.flash=L||!1}var E=C.prototype;return E.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},E.setStyles=function(u){for(var h=["foreground","underline","italics","background","flash"],T=0;T<h.length;T++){var L=h[T];u.hasOwnProperty(L)&&(this[L]=u[L])}},E.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},E.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},E.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},E.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},C}(),i=function(){function C(c,u,h,T,L,I){this.uchar=void 0,this.penState=void 0,this.uchar=c||" ",this.penState=new a(u,h,T,L,I)}var E=C.prototype;return E.reset=function(){this.uchar=" ",this.penState.reset()},E.setChar=function(u,h){this.uchar=u,this.penState.copy(h)},E.setPenState=function(u){this.penState.copy(u)},E.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},E.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},E.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},C}(),s=function(){function C(c){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<B;u++)this.chars.push(new i);this.logger=c,this.pos=0,this.currPenState=new a}var E=C.prototype;return E.equals=function(u){for(var h=!0,T=0;T<B;T++)if(!this.chars[T].equals(u.chars[T])){h=!1;break}return h},E.copy=function(u){for(var h=0;h<B;h++)this.chars[h].copy(u.chars[h])},E.isEmpty=function(){for(var u=!0,h=0;h<B;h++)if(!this.chars[h].isEmpty()){u=!1;break}return u},E.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(m.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(m.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},E.moveCursor=function(u){var h=this.pos+u;if(u>1)for(var T=this.pos+1;T<h+1;T++)this.chars[T].setPenState(this.currPenState);this.setCursor(h)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(u){u>=144&&this.backSpace();var h=P(u);if(this.pos>=B){this.logger.log(m.ERROR,"Cannot insert "+u.toString(16)+" ("+h+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(h,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(u){var h;for(h=u;h<B;h++)this.chars[h].reset()},E.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},E.clearToEndOfRow=function(){this.clearFromPos(this.pos)},E.getTextString=function(){for(var u=[],h=!0,T=0;T<B;T++){var L=this.chars[T].uchar;L!==" "&&(h=!1),u.push(L)}return h?"":u.join("")},E.setPenStyles=function(u){this.currPenState.setStyles(u);var h=this.chars[this.pos];h.setPenState(this.currPenState)},C}(),l=function(){function C(c){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<W;u++)this.rows.push(new s(c));this.logger=c,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var E=C.prototype;return E.reset=function(){for(var u=0;u<W;u++)this.rows[u].clear();this.currRow=W-1},E.equals=function(u){for(var h=!0,T=0;T<W;T++)if(!this.rows[T].equals(u.rows[T])){h=!1;break}return h},E.copy=function(u){for(var h=0;h<W;h++)this.rows[h].copy(u.rows[h])},E.isEmpty=function(){for(var u=!0,h=0;h<W;h++)if(!this.rows[h].isEmpty()){u=!1;break}return u},E.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},E.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},E.insertChar=function(u){var h=this.rows[this.currRow];h.insertChar(u)},E.setPen=function(u){var h=this.rows[this.currRow];h.setPenStyles(u)},E.moveCursor=function(u){var h=this.rows[this.currRow];h.moveCursor(u)},E.setCursor=function(u){this.logger.log(m.INFO,"setCursor: "+u);var h=this.rows[this.currRow];h.setCursor(u)},E.setPAC=function(u){this.logger.log(m.INFO,"pacData = "+JSON.stringify(u));var h=u.row-1;if(this.nrRollUpRows&&h<this.nrRollUpRows-1&&(h=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==h){for(var T=0;T<W;T++)this.rows[T].clear();var L=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var F=I.rows[L].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var z=0;z<this.nrRollUpRows;z++)this.rows[h-this.nrRollUpRows+z+1].copy(I.rows[L+z])}}this.currRow=h;var M=this.rows[this.currRow];if(u.indent!==null){var N=u.indent,Y=Math.max(N-1,0);M.setCursor(u.indent),u.color=M.chars[Y].penState.foreground}var ee={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(ee)},E.setBkgData=function(u){this.logger.log(m.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},E.setRollUpRows=function(u){this.nrRollUpRows=u},E.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(m.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(m.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,h=this.rows.splice(u,1)[0];h.clear(),this.rows.splice(this.currRow,0,h),this.logger.log(m.INFO,"Rolling up")},E.getDisplayText=function(u){u=u||!1;for(var h=[],T="",L=-1,I=0;I<W;I++){var F=this.rows[I].getTextString();F&&(L=I+1,u?h.push("Row "+L+": '"+F+"'"):h.push(F.trim()))}return h.length>0&&(u?T="["+h.join(" | ")+"]":T=h.join(`
`)),T},E.getTextAndFormat=function(){return this.rows},C}(),S=function(){function C(c,u,h){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=c,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new l(h),this.nonDisplayedMemory=new l(h),this.lastOutputScreen=new l(h),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=h}var E=C.prototype;return E.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},E.getHandler=function(){return this.outputFilter},E.setHandler=function(u){this.outputFilter=u},E.setPAC=function(u){this.writeScreen.setPAC(u)},E.setBkgData=function(u){this.writeScreen.setBkgData(u)},E.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(m.INFO,"MODE="+u),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=u},E.insertChars=function(u){for(var h=0;h<u.length;h++)this.writeScreen.insertChar(u[h]);var T=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(m.INFO,T+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(m.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},E.ccRCL=function(){this.logger.log(m.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},E.ccBS=function(){if(this.logger.log(m.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},E.ccAOF=function(){},E.ccAON=function(){},E.ccDER=function(){this.logger.log(m.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},E.ccRU=function(u){this.logger.log(m.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},E.ccFON=function(){this.logger.log(m.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},E.ccRDC=function(){this.logger.log(m.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},E.ccTR=function(){this.logger.log(m.INFO,"TR"),this.setMode("MODE_TEXT")},E.ccRTD=function(){this.logger.log(m.INFO,"RTD"),this.setMode("MODE_TEXT")},E.ccEDM=function(){this.logger.log(m.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},E.ccCR=function(){this.logger.log(m.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},E.ccENM=function(){this.logger.log(m.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},E.ccEOC=function(){if(this.logger.log(m.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(m.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},E.ccTO=function(u){this.logger.log(m.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},E.ccMIDROW=function(u){var h={flash:!1};if(h.underline=u%2===1,h.italics=u>=46,h.italics)h.foreground="white";else{var T=Math.floor(u/2)-16,L=["white","green","blue","cyan","red","yellow","magenta"];h.foreground=L[T]}this.logger.log(m.INFO,"MIDROW: "+JSON.stringify(h)),this.writeScreen.setPen(h)},E.outputDataUpdate=function(u){u===void 0&&(u=!1);var h=this.logger.time;if(h===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=h:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,h,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:h),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},C}(),v=function(){function C(c,u,h){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var T=new g;this.channels=[null,new S(c,u,T),new S(c+1,h,T)],this.cmdHistory=_(),this.logger=T}var E=C.prototype;return E.getHandler=function(u){return this.channels[u].getHandler()},E.setHandler=function(u,h){this.channels[u].setHandler(h)},E.addData=function(u,h){var T,L,I,F=!1;this.logger.time=u;for(var j=0;j<h.length;j+=2){if(L=h[j]&127,I=h[j+1]&127,L===0&&I===0)continue;if(this.logger.log(m.DATA,"["+b([h[j],h[j+1]])+"] -> ("+b([L,I])+")"),T=this.parseCmd(L,I),T||(T=this.parseMidrow(L,I)),T||(T=this.parsePAC(L,I)),T||(T=this.parseBackgroundAttributes(L,I)),!T&&(F=this.parseChars(L,I),F)){var z=this.currentChannel;if(z&&z>0){var M=this.channels[z];M.insertChars(F)}else this.logger.log(m.WARNING,"No channel found yet. TEXT-MODE?")}!T&&!F&&this.logger.log(m.WARNING,"Couldn't parse cleaned data "+b([L,I])+" orig: "+b([h[j],h[j+1]]))}},E.parseCmd=function(u,h){var T=this.cmdHistory,L=(u===20||u===28||u===21||u===29)&&h>=32&&h<=47,I=(u===23||u===31)&&h>=33&&h<=35;if(!(L||I))return!1;if(R(u,h,T))return y(null,null,T),this.logger.log(m.DEBUG,"Repeated command ("+b([u,h])+") is dropped"),!0;var F=u===20||u===21||u===23?1:2,j=this.channels[F];return u===20||u===21||u===28||u===29?h===32?j.ccRCL():h===33?j.ccBS():h===34?j.ccAOF():h===35?j.ccAON():h===36?j.ccDER():h===37?j.ccRU(2):h===38?j.ccRU(3):h===39?j.ccRU(4):h===40?j.ccFON():h===41?j.ccRDC():h===42?j.ccTR():h===43?j.ccRTD():h===44?j.ccEDM():h===45?j.ccCR():h===46?j.ccENM():h===47&&j.ccEOC():j.ccTO(h-32),y(u,h,T),this.currentChannel=F,!0},E.parseMidrow=function(u,h){var T=0;if((u===17||u===25)&&h>=32&&h<=47){if(u===17?T=1:T=2,T!==this.currentChannel)return this.logger.log(m.ERROR,"Mismatch channel in midrow parsing"),!1;var L=this.channels[T];return L?(L.ccMIDROW(h),this.logger.log(m.DEBUG,"MIDROW ("+b([u,h])+")"),!0):!1}return!1},E.parsePAC=function(u,h){var T,L=this.cmdHistory,I=(u>=17&&u<=23||u>=25&&u<=31)&&h>=64&&h<=127,F=(u===16||u===24)&&h>=64&&h<=95;if(!(I||F))return!1;if(R(u,h,L))return y(null,null,L),!0;var j=u<=23?1:2;h>=64&&h<=95?T=j===1?O[u]:d[u]:T=j===1?A[u]:p[u];var z=this.channels[j];return z?(z.setPAC(this.interpretPAC(T,h)),y(u,h,L),this.currentChannel=j,!0):!1},E.interpretPAC=function(u,h){var T,L={color:null,italics:!1,indent:null,underline:!1,row:u};return h>95?T=h-96:T=h-64,L.underline=(T&1)===1,T<=13?L.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(T/2)]:T<=15?(L.italics=!0,L.color="white"):L.indent=Math.floor((T-16)/2)*4,L},E.parseChars=function(u,h){var T,L=null,I=null;if(u>=25?(T=2,I=u-8):(T=1,I=u),I>=17&&I<=19){var F;I===17?F=h+80:I===18?F=h+112:F=h+144,this.logger.log(m.INFO,"Special char '"+P(F)+"' in channel "+T),L=[F]}else u>=32&&u<=127&&(L=h===0?[u]:[u,h]);if(L){var j=b(L);this.logger.log(m.DEBUG,"Char codes = "+j.join(",")),y(u,h,this.cmdHistory)}return L},E.parseBackgroundAttributes=function(u,h){var T=(u===16||u===24)&&h>=32&&h<=47,L=(u===23||u===31)&&h>=45&&h<=47;if(!(T||L))return!1;var I,F={};u===16||u===24?(I=Math.floor((h-32)/2),F.background=w[I],h%2===1&&(F.background=F.background+"_semi")):h===45?F.background="transparent":(F.foreground="black",h===47&&(F.underline=!0));var j=u<=23?1:2,z=this.channels[j];return z.setBkgData(F),y(u,h,this.cmdHistory),!0},E.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var h=this.channels[u];h&&h.reset()}this.cmdHistory=_()},E.cueSplitAtTime=function(u){for(var h=0;h<this.channels.length;h++){var T=this.channels[h];T&&T.cueSplitAtTime(u)}},C}();function y(C,E,c){c.a=C,c.b=E}function R(C,E,c){return c.a===C&&c.b===E}function _(){return{a:null,b:null}}J.default=v},"./src/utils/codecs.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"isCodecType",function(){return U}),k.d(J,"isCodecSupportedInMp4",function(){return P});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,B){var O=X[B];return!!O&&O[W.slice(0,4)]===!0}function P(W,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/utils/vttparser.ts"),U=k("./src/utils/webvtt-parser.ts"),P=k("./src/utils/texttrack-utils.ts"),W=/\s/,B={newCue:function(A,d,p,w){for(var m=[],g,b,a,i,s,l=self.VTTCue||self.TextTrackCue,S=0;S<w.rows.length;S++)if(g=w.rows[S],a=!0,i=0,s="",!g.isEmpty()){for(var v=0;v<g.chars.length;v++)W.test(g.chars[v].uchar)&&a?i++:(s+=g.chars[v].uchar,a=!1);g.cueStartTime=d,d===p&&(p+=1e-4),i>=16?i--:i++;var y=Object(X.fixLineBreaks)(s.trim()),R=Object(U.generateCueId)(d,p,y);(!A||!A.cues||!A.cues.getCueById(R))&&(b=new l(d,p,y),b.id=R,b.line=S+1,b.align="left",b.position=10+Math.min(80,Math.floor(i*8/32)*10),m.push(b))}return A&&m.length&&(m.sort(function(_,C){return _.line==="auto"||C.line==="auto"?0:_.line>8&&C.line>8?C.line-_.line:_.line-C.line}),m.forEach(function(_){return Object(P.addCueToTrack)(A,_)})),m}};J.default=B},"./src/utils/discontinuities.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"findFirstFragWithCC",function(){return W}),k.d(J,"shouldAlignOnDiscontinuities",function(){return B}),k.d(J,"findDiscontinuousReferenceFrag",function(){return O}),k.d(J,"adjustSlidingStart",function(){return d}),k.d(J,"alignStream",function(){return p}),k.d(J,"alignPDT",function(){return m}),k.d(J,"alignFragmentByPDTDelta",function(){return g}),k.d(J,"alignMediaPlaylistByPDT",function(){return b});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/logger.ts"),P=k("./src/controller/level-helper.ts");function W(a,i){for(var s=null,l=0,S=a.length;l<S;l++){var v=a[l];if(v&&v.cc===i){s=v;break}}return s}function B(a,i,s){return!!(i.details&&(s.endCC>s.startCC||a&&a.cc<s.startCC))}function O(a,i){var s=a.fragments,l=i.fragments;if(!l.length||!s.length){U.logger.log("No fragments to align");return}var S=W(s,l[0].cc);if(!S||S&&!S.startPTS){U.logger.log("No frag in previous level to align on");return}return S}function A(a,i){if(a){var s=a.start+i;a.start=a.startPTS=s,a.endPTS=s+a.duration}}function d(a,i){for(var s=i.fragments,l=0,S=s.length;l<S;l++)A(s[l],a);i.fragmentHint&&A(i.fragmentHint,a),i.alignedSliding=!0}function p(a,i,s){if(!i)return;w(a,s,i),!s.alignedSliding&&i.details&&m(s,i.details),!s.alignedSliding&&i.details&&!s.skippedSegments&&Object(P.adjustSliding)(i.details,s)}function w(a,i,s){if(B(a,s,i)){var l=O(s.details,i);l&&Object(X.isFiniteNumber)(l.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),d(l.start,i))}}function m(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=a.fragments[0].programDateTime,S=(l-s)/1e3+i.fragments[0].start;S&&Object(X.isFiniteNumber)(S)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+S.toFixed(3)+" "+a.url+" "),d(S,a))}function g(a,i){var s=a.programDateTime;if(!s)return;var l=(s-i)/1e3;a.start=a.startPTS=l,a.endPTS=l+a.duration}function b(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var s=i.fragments[0].programDateTime,l=i.fragments[0].start,S=s-l*1e3;a.fragments.forEach(function(v){g(v,S)}),a.fragmentHint&&g(a.fragmentHint,S),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/utils/ewma.ts"),U=function(){function P(B,O,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new X.default(B),this.fast_=new X.default(O)}var W=P.prototype;return W.update=function(O,A){var d=this.slow_,p=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new X.default(O,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new X.default(A,p.getEstimate(),p.getTotalWeight()))},W.sample=function(O,A){O=Math.max(O,this.minDelayMs_);var d=8*A,p=O/1e3,w=d/p;this.fast_.sample(p,w),this.slow_.sample(p,w)},W.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},P}();J.default=U},"./src/utils/ewma.ts":function(ue,J,k){"use strict";k.r(J);var X=function(){function U(W,B,O){B===void 0&&(B=0),O===void 0&&(O=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_=B,this.totalWeight_=O}var P=U.prototype;return P.sample=function(B,O){var A=Math.pow(this.alpha_,B);this.estimate_=O*(1-A)+A*this.estimate_,this.totalWeight_+=B},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},U}();J.default=X},"./src/utils/fetch-loader.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"fetchSupported",function(){return g});var X=k("./src/polyfills/number.ts"),U=k("./src/loader/load-stats.ts"),P=k("./src/demux/chunk-cache.ts");function W(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,p(l,S)}function B(l){var S=typeof Map=="function"?new Map:void 0;return B=function(y){if(y===null||!d(y))return y;if(typeof y!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(y))return S.get(y);S.set(y,R)}function R(){return O(y,arguments,w(this).constructor)}return R.prototype=Object.create(y.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),p(R,y)},B(l)}function O(l,S,v){return A()?O=Reflect.construct:O=function(R,_,C){var E=[null];E.push.apply(E,_);var c=Function.bind.apply(R,E),u=new c;return C&&p(u,C.prototype),u},O.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function d(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function p(l,S){return p=Object.setPrototypeOf||function(y,R){return y.__proto__=R,y},p(l,S)}function w(l){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},w(l)}function m(){return m=Object.assign||function(l){for(var S=1;S<arguments.length;S++){var v=arguments[S];for(var y in v)Object.prototype.hasOwnProperty.call(v,y)&&(l[y]=v[y])}return l},m.apply(this,arguments)}function g(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var b=function(){function l(v){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=v.fetchSetup||i,this.controller=new self.AbortController,this.stats=new U.LoadStats}var S=l.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var y=this.response;(!y||!y.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(y,R,_){var C=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var c=a(y,this.controller.signal),u=_.onProgress,h=y.responseType==="arraybuffer",T=h?"byteLength":"length";this.context=y,this.config=R,this.callbacks=_,this.request=this.fetchSetup(y,c),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){C.abortInternal(),_.onTimeout(E,y,C.response)},R.timeout),self.fetch(this.request).then(function(L){if(C.response=C.loader=L,!L.ok){var I=L.status,F=L.statusText;throw new s(F||"fetch, bad network response",I,L)}return E.loading.first=Math.max(self.performance.now(),E.loading.start),E.total=parseInt(L.headers.get("Content-Length")||"0"),u&&Object(X.isFiniteNumber)(R.highWaterMark)?C.loadProgressively(L,E,y,R.highWaterMark,u):h?L.arrayBuffer():L.text()}).then(function(L){var I=C.response;self.clearTimeout(C.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first),E.loaded=E.total=L[T];var F={url:I.url,data:L};u&&!Object(X.isFiniteNumber)(R.highWaterMark)&&u(E,y,L,I),_.onSuccess(F,E,y,I)}).catch(function(L){if(self.clearTimeout(C.requestTimeout),E.aborted)return;var I=L.code||0;_.onError({code:I,text:L.message},y,L.details)})},S.getCacheAge=function(){var y=null;if(this.response){var R=this.response.headers.get("age");y=R?parseFloat(R):null}return y},S.loadProgressively=function(y,R,_,C,E){C===void 0&&(C=0);var c=new P.default,u=y.body.getReader(),h=function T(){return u.read().then(function(L){if(L.done)return c.dataLength&&E(R,_,c.flush(),y),Promise.resolve(new ArrayBuffer(0));var I=L.value,F=I.length;return R.loaded+=F,F<C||c.dataLength?(c.push(I),c.dataLength>=C&&E(R,_,c.flush(),y)):E(R,_,I,y),T()}).catch(function(){return Promise.reject()})};return h()},l}();function a(l,S){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(m({},l.headers))};return l.rangeEnd&&v.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),v}function i(l,S){return new self.Request(l.url,S)}var s=function(l){W(S,l);function S(v,y,R){var _;return _=l.call(this,v)||this,_.code=void 0,_.details=void 0,_.code=y,_.details=R,_}return S}(B(Error));J.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"IMSC1_CODEC",function(){return d}),k.d(J,"parseIMSC1",function(){return g});var X=k("./src/utils/mp4-tools.ts"),U=k("./src/utils/vttparser.ts"),P=k("./src/utils/vttcue.ts"),W=k("./src/demux/id3.ts"),B=k("./src/utils/timescale-conversion.ts"),O=k("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(C){for(var E=1;E<arguments.length;E++){var c=arguments[E];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(C[u]=c[u])}return C},A.apply(this,arguments)}var d="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,w=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,m={left:"start",center:"center",right:"end",start:"start",end:"end"};function g(C,E,c,u,h){var T=Object(X.findBox)(new Uint8Array(C),["mdat"]);if(T.length===0){h(new Error("Could not parse IMSC1 mdat"));return}var L=T[0],I=Object(W.utf8ArrayToStr)(new Uint8Array(C,L.start,L.end-L.start)),F=Object(B.toTimescaleFromScale)(E,1,c);try{u(b(I,F))}catch(j){h(j)}}function b(C,E){var c=new DOMParser,u=c.parseFromString(C,"text/xml"),h=u.getElementsByTagName("tt")[0];if(!h)throw new Error("Invalid ttml");var T={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},L=Object.keys(T).reduce(function(M,N){return M[N]=h.getAttribute("ttp:"+N)||T[N],M},{}),I=h.getAttribute("xml:space")!=="preserve",F=i(a(h,"styling","style")),j=i(a(h,"layout","region")),z=a(h,"body","[begin]");return[].map.call(z,function(M){var N=s(M,I);if(!N||!M.hasAttribute("begin"))return null;var Y=y(M.getAttribute("begin"),L),ee=y(M.getAttribute("dur"),L),le=y(M.getAttribute("end"),L);if(Y===null)throw v(M);if(le===null){if(ee===null)throw v(M);le=Y+ee}var pe=new P.default(Y-E,le-E,N);pe.id=Object(O.generateCueId)(pe.startTime,pe.endTime,pe.text);var Oe=j[M.getAttribute("region")],Te=F[M.getAttribute("style")];pe.position=10,pe.size=80;var Re=l(Oe,Te),Ae=Re.textAlign;if(Ae){var we=m[Ae];we&&(pe.lineAlign=we),pe.align=Ae}return A(pe,Re),pe}).filter(function(M){return M!==null})}function a(C,E,c){var u=C.getElementsByTagName(E)[0];return u?[].slice.call(u.querySelectorAll(c)):[]}function i(C){return C.reduce(function(E,c){var u=c.getAttribute("xml:id");return u&&(E[u]=c),E},{})}function s(C,E){return[].slice.call(C.childNodes).reduce(function(c,u,h){var T;return u.nodeName==="br"&&h?c+`
`:(T=u.childNodes)!==null&&T!==void 0&&T.length?s(u,E):E?c+u.textContent.trim().replace(/\s+/g," "):c+u.textContent},"")}function l(C,E){var c="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(h,T){var L=S(E,c,T)||S(C,c,T);return L&&(h[T]=L),h},{})}function S(C,E,c){return C.hasAttributeNS(E,c)?C.getAttributeNS(E,c):null}function v(C){return new Error("Could not parse ttml timestamp "+C)}function y(C,E){if(!C)return null;var c=Object(U.parseTimeStamp)(C);return c===null&&(p.test(C)?c=R(C,E):w.test(C)&&(c=_(C,E))),c}function R(C,E){var c=p.exec(C),u=(c[4]|0)+(c[5]|0)/E.subFrameRate;return(c[1]|0)*3600+(c[2]|0)*60+(c[3]|0)+u/E.frameRate}function _(C,E){var c=w.exec(C),u=Number(c[1]),h=c[2];switch(h){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/E.frameRate;case"t":return u/E.tickRate}return u}},"./src/utils/logger.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"enableLogs",function(){return O}),k.d(J,"logger",function(){return A});var X=function(){},U={trace:X,debug:X,log:X,warn:X,info:X,error:X},P=U;function W(d){var p=self.console[d];return p?p.bind(self.console,"["+d+"] >"):X}function B(d){for(var p=arguments.length,w=new Array(p>1?p-1:0),m=1;m<p;m++)w[m-1]=arguments[m];w.forEach(function(g){P[g]=d[g]?d[g].bind(d):W(g)})}function O(d){if(self.console&&d===!0||typeof d=="object"){B(d,"debug","log","info","warn","error");try{P.log()}catch(p){P=U}}else P=U}var A=P},"./src/utils/mediakeys-helper.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"KeySystems",function(){return X}),k.d(J,"requestMediaKeySystemAccess",function(){return U});var X;(function(P){P.WIDEVINE="com.widevine.alpha",P.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(ue,J,k){"use strict";k.r(J),k.d(J,"getMediaSource",function(){return X});function X(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"bin2str",function(){return B}),k.d(J,"readUint16",function(){return O}),k.d(J,"readUint32",function(){return A}),k.d(J,"writeUint32",function(){return d}),k.d(J,"findBox",function(){return p}),k.d(J,"parseSegmentIndex",function(){return w}),k.d(J,"parseInitSegment",function(){return m}),k.d(J,"getStartDTS",function(){return g}),k.d(J,"getDuration",function(){return b}),k.d(J,"computeRawDurationFromSamples",function(){return a}),k.d(J,"offsetStartDTS",function(){return i}),k.d(J,"segmentValidRange",function(){return s}),k.d(J,"appendUint8Array",function(){return l});var X=k("./src/utils/typed-array.ts"),U=k("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,W=[].push;function B(S){return String.fromCharCode.apply(null,S)}function O(S,v){"data"in S&&(v+=S.start,S=S.data);var y=S[v]<<8|S[v+1];return y<0?65536+y:y}function A(S,v){"data"in S&&(v+=S.start,S=S.data);var y=S[v]<<24|S[v+1]<<16|S[v+2]<<8|S[v+3];return y<0?4294967296+y:y}function d(S,v,y){"data"in S&&(v+=S.start,S=S.data),S[v]=y>>24,S[v+1]=y>>16&255,S[v+2]=y>>8&255,S[v+3]=y&255}function p(S,v){var y=[];if(!v.length)return y;var R,_,C;"data"in S?(R=S.data,_=S.start,C=S.end):(R=S,_=0,C=R.byteLength);for(var E=_;E<C;){var c=A(R,E),u=B(R.subarray(E+4,E+8)),h=c>1?E+c:C;if(u===v[0])if(v.length===1)y.push({data:R,start:E+8,end:h});else{var T=p({data:R,start:E+8,end:h},v.slice(1));T.length&&W.apply(y,T)}E=h}return y}function w(S){var v=p(S,["moov"]),y=v[0],R=y?y.end:null,_=p(S,["sidx"]);if(!_||!_[0])return null;var C=[],E=_[0],c=E.data[0],u=c===0?8:16,h=A(E,u);u+=4;var T=0,L=0;c===0?u+=8:u+=16,u+=2;var I=E.end+L,F=O(E,u);u+=2;for(var j=0;j<F;j++){var z=u,M=A(E,z);z+=4;var N=M&2147483647,Y=(M&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=A(E,z);z+=4,C.push({referenceSize:N,subsegmentDuration:ee,info:{duration:ee/h,start:I,end:I+N-1}}),I+=N,z+=4,u=z}return{earliestPresentationTime:T,timescale:h,version:c,referencesCount:F,references:C,moovEndOffset:R}}function m(S){for(var v=[],y=p(S,["moov","trak"]),R=0;R<y.length;R++){var _=y[R],C=p(_,["tkhd"])[0];if(C){var E=C.data[C.start],c=E===0?12:20,u=A(C,c),h=p(_,["mdia","mdhd"])[0];if(h){E=h.data[h.start],c=E===0?12:20;var T=A(h,c),L=p(_,["mdia","hdlr"])[0];if(L){var I=B(L.data.subarray(L.start+8,L.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[I];if(F){var j=p(_,["mdia","minf","stbl","stsd"])[0],z=void 0;j&&(z=B(j.data.subarray(j.start+12,j.start+16))),v[u]={timescale:T,type:F},v[F]={timescale:T,id:u,codec:z}}}}}}var M=p(S,["moov","mvex","trex"]);return M.forEach(function(N){var Y=A(N,4),ee=v[Y];ee&&(ee.default={duration:A(N,12),flags:A(N,20)})}),v}function g(S,v){return p(v,["moof","traf"]).reduce(function(y,R){var _=p(R,["tfdt"])[0],C=_.data[_.start],E=p(R,["tfhd"]).reduce(function(c,u){var h=A(u,4),T=S[h];if(T){var L=A(_,4);C===1&&(L*=Math.pow(2,32),L+=A(_,8));var I=T.timescale||9e4,F=L/I;if(isFinite(F)&&(c===null||F<c))return F}return c},null);return E!==null&&isFinite(E)&&(y===null||E<y)?E:y},null)||0}function b(S,v){for(var y=0,R=0,_=0,C=p(S,["moof","traf"]),E=0;E<C.length;E++){var c=C[E],u=p(c,["tfhd"])[0],h=A(u,4),T=v[h];if(!T)continue;var L=T.default,I=A(u,0)|(L==null?void 0:L.flags),F=L==null?void 0:L.duration;I&8&&(I&2?F=A(u,12):F=A(u,8));for(var j=T.timescale||9e4,z=p(c,["trun"]),M=0;M<z.length;M++){if(F){var N=A(z[M],4);y=F*N}else y=a(z[M]);T.type===U.ElementaryStreamTypes.VIDEO?R+=y/j:T.type===U.ElementaryStreamTypes.AUDIO&&(_+=y/j)}}if(R===0&&_===0){var Y=w(S);if(Y!=null&&Y.references)return Y.references.reduce(function(ee,le){return ee+le.info.duration||0},0)}return R||_}function a(S){var v=A(S,0),y=8;v&1&&(y+=4),v&4&&(y+=4);for(var R=0,_=A(S,4),C=0;C<_;C++){if(v&256){var E=A(S,y);R+=E,y+=4}v&512&&(y+=4),v&1024&&(y+=4),v&2048&&(y+=4)}return R}function i(S,v,y){p(v,["moof","traf"]).forEach(function(R){p(R,["tfhd"]).forEach(function(_){var C=A(_,4),E=S[C];if(!E)return;var c=E.timescale||9e4;p(R,["tfdt"]).forEach(function(u){var h=u.data[u.start],T=A(u,4);if(h===0)d(u,4,T-y*c);else{T*=Math.pow(2,32),T+=A(u,8),T-=y*c,T=Math.max(T,0);var L=Math.floor(T/(P+1)),I=Math.floor(T%(P+1));d(u,4,L),d(u,8,I)}})})})}function s(S){var v={valid:null,remainder:null},y=p(S,["moof"]);if(y){if(y.length<2)return v.remainder=S,v}else return v;var R=y[y.length-1];return v.valid=Object(X.sliceUint8)(S,0,R.start-8),v.remainder=Object(X.sliceUint8)(S,R.start-8),v}function l(S,v){var y=new Uint8Array(S.length+v.length);return y.set(S),y.set(v,S.length),y}},"./src/utils/output-filter.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"default",function(){return X});var X=function(){function U(W,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=B}var P=U.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(B,O,A){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=O,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"sendAddTrackEvent",function(){return U}),k.d(J,"addCueToTrack",function(){return P}),k.d(J,"clearCurrentCues",function(){return W}),k.d(J,"removeCuesInRange",function(){return B}),k.d(J,"getCuesInRange",function(){return A});var X=k("./src/utils/logger.ts");function U(d,p){var w;try{w=new Event("addtrack")}catch(m){w=document.createEvent("Event"),w.initEvent("addtrack",!1,!1)}w.track=d,p.dispatchEvent(w)}function P(d,p){var w=d.mode;if(w==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(p.id))try{if(d.addCue(p),!d.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(g){X.logger.debug("[texttrack-utils]: "+g);var m=new self.TextTrackCue(p.startTime,p.endTime,p.text);m.id=p.id,d.addCue(m)}w==="disabled"&&(d.mode=w)}function W(d){var p=d.mode;if(p==="disabled"&&(d.mode="hidden"),d.cues)for(var w=d.cues.length;w--;)d.removeCue(d.cues[w]);p==="disabled"&&(d.mode=p)}function B(d,p,w){var m=d.mode;if(m==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var g=A(d.cues,p,w),b=0;b<g.length;b++)d.removeCue(g[b]);m==="disabled"&&(d.mode=m)}function O(d,p){if(p<d[0].startTime)return 0;var w=d.length-1;if(p>d[w].endTime)return-1;for(var m=0,g=w;m<=g;){var b=Math.floor((g+m)/2);if(p<d[b].startTime)g=b-1;else if(p>d[b].startTime&&m<w)m=b+1;else return b}return d[m].startTime-p<p-d[g].startTime?m:g}function A(d,p,w){var m=[],g=O(d,p);if(g>-1)for(var b=g,a=d.length;b<a;b++){var i=d[b];if(i.startTime>=p&&i.endTime<=w)m.push(i);else if(i.startTime>w)return m}return m}},"./src/utils/time-ranges.ts":function(ue,J,k){"use strict";k.r(J);var X={toString:function(P){for(var W="",B=P.length,O=0;O<B;O++)W+="["+P.start(O).toFixed(3)+","+P.end(O).toFixed(3)+"]";return W}};J.default=X},"./src/utils/timescale-conversion.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"toTimescaleFromBase",function(){return U}),k.d(J,"toTimescaleFromScale",function(){return P}),k.d(J,"toMsFromMpegTsClock",function(){return W}),k.d(J,"toMpegTsClockFromTimescale",function(){return B});var X=9e4;function U(O,A,d,p){d===void 0&&(d=1),p===void 0&&(p=!1);var w=O*A*d;return p?Math.round(w):w}function P(O,A,d,p){return d===void 0&&(d=1),p===void 0&&(p=!1),U(O,A,1/d,p)}function W(O,A){return A===void 0&&(A=!1),U(O,1e3,1/X,A)}function B(O,A){return A===void 0&&(A=1),U(O,X,1/A)}},"./src/utils/typed-array.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"sliceUint8",function(){return X});function X(U,P,W){return Uint8Array.prototype.slice?U.slice(P,W):new Uint8Array(Array.prototype.slice.call(U,P,W))}},"./src/utils/vttcue.ts":function(ue,J,k){"use strict";k.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var X=["","lr","rl"],U=["start","middle","end","left","right"];function P(d,p){if(typeof p!="string")return!1;if(!Array.isArray(d))return!1;var w=p.toLowerCase();return~d.indexOf(w)?w:!1}function W(d){return P(X,d)}function B(d){return P(U,d)}function O(d){for(var p=arguments.length,w=new Array(p>1?p-1:0),m=1;m<p;m++)w[m-1]=arguments[m];for(var g=1;g<arguments.length;g++){var b=arguments[g];for(var a in b)d[a]=b[a]}return d}function A(d,p,w){var m=this,g={enumerable:!0};m.hasBeenReset=!1;var b="",a=!1,i=d,s=p,l=w,S=null,v="",y=!0,R="auto",_="start",C=50,E="middle",c=50,u="middle";Object.defineProperty(m,"id",O({},g,{get:function(){return b},set:function(T){b=""+T}})),Object.defineProperty(m,"pauseOnExit",O({},g,{get:function(){return a},set:function(T){a=!!T}})),Object.defineProperty(m,"startTime",O({},g,{get:function(){return i},set:function(T){if(typeof T!="number")throw new TypeError("Start time must be set to a number.");i=T,this.hasBeenReset=!0}})),Object.defineProperty(m,"endTime",O({},g,{get:function(){return s},set:function(T){if(typeof T!="number")throw new TypeError("End time must be set to a number.");s=T,this.hasBeenReset=!0}})),Object.defineProperty(m,"text",O({},g,{get:function(){return l},set:function(T){l=""+T,this.hasBeenReset=!0}})),Object.defineProperty(m,"region",O({},g,{get:function(){return S},set:function(T){S=T,this.hasBeenReset=!0}})),Object.defineProperty(m,"vertical",O({},g,{get:function(){return v},set:function(T){var L=W(T);if(L===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=L,this.hasBeenReset=!0}})),Object.defineProperty(m,"snapToLines",O({},g,{get:function(){return y},set:function(T){y=!!T,this.hasBeenReset=!0}})),Object.defineProperty(m,"line",O({},g,{get:function(){return R},set:function(T){if(typeof T!="number"&&T!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");R=T,this.hasBeenReset=!0}})),Object.defineProperty(m,"lineAlign",O({},g,{get:function(){return _},set:function(T){var L=B(T);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");_=L,this.hasBeenReset=!0}})),Object.defineProperty(m,"position",O({},g,{get:function(){return C},set:function(T){if(T<0||T>100)throw new Error("Position must be between 0 and 100.");C=T,this.hasBeenReset=!0}})),Object.defineProperty(m,"positionAlign",O({},g,{get:function(){return E},set:function(T){var L=B(T);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");E=L,this.hasBeenReset=!0}})),Object.defineProperty(m,"size",O({},g,{get:function(){return c},set:function(T){if(T<0||T>100)throw new Error("Size must be between 0 and 100.");c=T,this.hasBeenReset=!0}})),Object.defineProperty(m,"align",O({},g,{get:function(){return u},set:function(T){var L=B(T);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");u=L,this.hasBeenReset=!0}})),m.displayState=void 0}return A.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"parseTimeStamp",function(){return P}),k.d(J,"fixLineBreaks",function(){return p}),k.d(J,"VTTParser",function(){return w});var X=k("./src/utils/vttcue.ts"),U=function(){function m(){}var g=m.prototype;return g.decode=function(a,i){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},m}();function P(m){function g(a,i,s,l){return(a|0)*3600+(i|0)*60+(s|0)+parseFloat(l||0)}var b=m.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?g(b[2],b[3],0,b[4]):g(b[1],b[2],b[3],b[4]):null}var W=function(){function m(){this.values=Object.create(null)}var g=m.prototype;return g.set=function(a,i){!this.get(a)&&i!==""&&(this.values[a]=i)},g.get=function(a,i,s){return s?this.has(a)?this.values[a]:i[s]:this.has(a)?this.values[a]:i},g.has=function(a){return a in this.values},g.alt=function(a,i,s){for(var l=0;l<s.length;++l)if(i===s[l]){this.set(a,i);break}},g.integer=function(a,i){/^-?\d+$/.test(i)&&this.set(a,parseInt(i,10))},g.percent=function(a,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var s=parseFloat(i);if(s>=0&&s<=100)return this.set(a,s),!0}return!1},m}();function B(m,g,b,a){var i=a?m.split(a):[m];for(var s in i){if(typeof i[s]!="string")continue;var l=i[s].split(b);if(l.length!==2)continue;var S=l[0],v=l[1];g(S,v)}}var O=new X.default(0,0,""),A=O.align==="middle"?"middle":"center";function d(m,g,b){var a=m;function i(){var S=P(m);if(S===null)throw new Error("Malformed timestamp: "+a);return m=m.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,v){var y=new W;B(S,function(C,E){var c;switch(C){case"region":for(var u=b.length-1;u>=0;u--)if(b[u].id===E){y.set(C,b[u].region);break}break;case"vertical":y.alt(C,E,["rl","lr"]);break;case"line":c=E.split(","),y.integer(C,c[0]),y.percent(C,c[0])&&y.set("snapToLines",!1),y.alt(C,c[0],["auto"]),c.length===2&&y.alt("lineAlign",c[1],["start",A,"end"]);break;case"position":c=E.split(","),y.percent(C,c[0]),c.length===2&&y.alt("positionAlign",c[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":y.percent(C,E);break;case"align":y.alt(C,E,["start",A,"end","left","right"]);break}},/:/,/\s/),v.region=y.get("region",null),v.vertical=y.get("vertical","");var R=y.get("line","auto");R==="auto"&&O.line===-1&&(R=-1),v.line=R,v.lineAlign=y.get("lineAlign","start"),v.snapToLines=y.get("snapToLines",!0),v.size=y.get("size",100),v.align=y.get("align",A);var _=y.get("position","auto");_==="auto"&&O.position===50&&(_=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=_}function l(){m=m.replace(/^\s+/,"")}if(l(),g.startTime=i(),l(),m.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);m=m.substr(3),l(),g.endTime=i(),l(),s(m,g)}function p(m){return m.replace(/<br(?: \/)?>/gi,`
`)}var w=function(){function m(){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 g=m.prototype;return g.parse=function(a){var i=this;a&&(i.buffer+=i.decoder.decode(a,{stream:!0}));function s(){var _=i.buffer,C=0;for(_=p(_);C<_.length&&_[C]!=="\r"&&_[C]!==`
`;)++C;var E=_.substr(0,C);return _[C]==="\r"&&++C,_[C]===`
`&&++C,i.buffer=_.substr(C),E}function l(_){B(_,function(C,E){},/:/)}try{var S="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;S=s();var v=S.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var y=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;y?y=!1:S=s();switch(i.state){case"HEADER":/:/.test(S)?l(S):S||(i.state="ID");continue;case"NOTE":S||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){i.state="NOTE";break}if(!S)continue;if(i.cue=new X.default(0,0,""),i.state="CUE",S.indexOf("-->")===-1){i.cue.id=S;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{d(S,i.cue,i.regionList)}catch(_){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var R=S.indexOf("-->")!==-1;if(!S||R&&(y=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
`),i.cue.text+=S}continue;case"BADCUE":S||(i.state="ID")}}}catch(_){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},g.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=`
`,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){a.onparsingerror&&a.onparsingerror(i)}return a.onflush&&a.onflush(),this},m}()},"./src/utils/webvtt-parser.ts":function(ue,J,k){"use strict";k.r(J),k.d(J,"generateCueId",function(){return w}),k.d(J,"parseWebVTT",function(){return g});var X=k("./src/polyfills/number.ts"),U=k("./src/utils/vttparser.ts"),P=k("./src/demux/id3.ts"),W=k("./src/utils/timescale-conversion.ts"),B=k("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,A=function(a,i,s){return s===void 0&&(s=0),a.substr(s,i.length)===i},d=function(a){var i=parseInt(a.substr(-3)),s=parseInt(a.substr(-6,2)),l=parseInt(a.substr(-9,2)),S=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(X.isFiniteNumber)(i)||!Object(X.isFiniteNumber)(s)||!Object(X.isFiniteNumber)(l)||!Object(X.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*s,i+=60*1e3*l,i+=60*60*1e3*S,i},p=function(a){for(var i=5381,s=a.length;s;)i=i*33^a.charCodeAt(--s);return(i>>>0).toString()};function w(b,a,i){return p(b.toString())+p(a.toString())+p(i)}var m=function(a,i,s){var l=a[i],S=a[l.prevCC];if(!S||!S.new&&l.new){a.ccOffset=a.presentationOffset=l.start,l.new=!1;return}for(;(v=S)!==null&&v!==void 0&&v.new;){var v;a.ccOffset+=l.start-S.start,l.new=!1,l=S,S=a[l.prevCC]}a.presentationOffset=s};function g(b,a,i,s,l,S,v,y){var R=new U.VTTParser,_=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(O,`
`).split(`
`),C=[],E=Object(W.toMpegTsClockFromTimescale)(a,i),c="00:00.000",u=0,h=0,T,L=!0,I=!1;R.oncue=function(F){var j=s[l],z=s.ccOffset,M=(u-E)/9e4;if(j!=null&&j.new&&(h!==void 0?z=s.ccOffset=j.start:m(s,l,M)),M&&(z=M-s.presentationOffset),I){var N=F.endTime-F.startTime,Y=Object(B.normalizePts)((F.startTime+z-h)*9e4,S*9e4)/9e4;F.startTime=Y,F.endTime=Y+N}var ee=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(ee)),F.id||(F.id=w(F.startTime,F.endTime,ee)),F.endTime>0&&C.push(F)},R.onparsingerror=function(F){T=F},R.onflush=function(){if(T){y(T);return}v(C)},_.forEach(function(F){if(L)if(A(F,"X-TIMESTAMP-MAP=")){L=!1,I=!0,F.substr(16).split(",").forEach(function(j){A(j,"LOCAL:")?c=j.substr(6):A(j,"MPEGTS:")&&(u=parseInt(j.substr(7)))});try{h=d(c)/1e3}catch(j){I=!1,T=j}return}else F===""&&(L=!1);R.parse(F+`
`)}),R.flush()}},"./src/utils/xhr-loader.ts":function(ue,J,k){"use strict";k.r(J);var X=k("./src/utils/logger.ts"),U=k("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,W=function(){function B(A){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=A?A.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var O=B.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},O.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(d,p,w){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=p,this.callbacks=w,this.retryDelay=p.retryDelay,this.loadInternal()},O.loadInternal=function(){var d=this.config,p=this.context;if(!d)return;var w=this.loader=new self.XMLHttpRequest,m=this.stats;m.loading.first=0,m.loaded=0;var g=this.xhrSetup;try{if(g)try{g(w,p.url)}catch(i){w.open("GET",p.url,!0),g(w,p.url)}w.readyState||w.open("GET",p.url,!0);var b=this.context.headers;if(b)for(var a in b)w.setRequestHeader(a,b[a])}catch(i){this.callbacks.onError({code:w.status,text:i.message},p,w);return}p.rangeEnd&&w.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),w.onreadystatechange=this.readystatechange.bind(this),w.onprogress=this.loadprogress.bind(this),w.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),w.send()},O.readystatechange=function(){var d=this.context,p=this.loader,w=this.stats;if(!d||!p)return;var m=p.readyState,g=this.config;if(w.aborted)return;if(m>=2)if(self.clearTimeout(this.requestTimeout),w.loading.first===0&&(w.loading.first=Math.max(self.performance.now(),w.loading.start)),m===4){p.onreadystatechange=null,p.onprogress=null;var b=p.status;if(b>=200&&b<300){w.loading.end=Math.max(self.performance.now(),w.loading.first);var a,i;if(d.responseType==="arraybuffer"?(a=p.response,i=a.byteLength):(a=p.responseText,i=a.length),w.loaded=w.total=i,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(w,d,a,p),!this.callbacks)return;var l={url:p.responseURL,data:a};this.callbacks.onSuccess(l,w,d,p)}else w.retry>=g.maxRetry||b>=400&&b<499?(X.logger.error(b+" while loading "+d.url),this.callbacks.onError({code:b,text:p.statusText},d,p)):(X.logger.warn(b+" while loading "+d.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,g.maxRetryDelay),w.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout)},O.loadtimeout=function(){X.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(d){var p=this.stats;p.loaded=d.loaded,d.lengthComputable&&(p.total=d.total)},O.getCacheAge=function(){var d=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");d=p?parseFloat(p):null}return d},B}();J.default=W}}).default})},vHTk:function(bt,Se,Q){bt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(bt,Se,Q){"use strict";Q.d(Se,"c",function(){return U}),Q.d(Se,"b",function(){return P}),Q.d(Se,"d",function(){return W}),Q.d(Se,"a",function(){return O}),Q.d(Se,"e",function(){return A});var ue=Q("9og8"),J=Q("WmNS"),k=Q.n(J),X=Q("ErOA");function U(d){return Object(X.c)("libraries/".concat(d,".json"))}function P(){return Object(X.c)("library_tags.json")}function W(d){return B.apply(this,arguments)}function B(){return B=Object(ue.a)(k.a.mark(function d(p){var w;return k.a.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,Object(X.b)("attachments/".concat(p,".json"));case 2:return w=g.sent,g.abrupt("return",w.status===0);case 4:case"end":return g.stop()}},d)})),B.apply(this,arguments)}function O(d){return Object(X.f)("libraries.json",d)}function A(d,p){return Object(X.g)("libraries/".concat(d,".json"),p)}},y5JW:function(bt,Se,Q){"use strict";Q.d(Se,"c",function(){return b}),Q.d(Se,"a",function(){return a});var ue=Q("DZo9"),J=Q("8z0m"),k=Q("+L6B"),X=Q("2/Rp"),U=Q("9og8"),P=Q("k1fw"),W=Q("oBTY"),B=Q("miYZ"),O=Q("tsqr"),A=Q("WmNS"),d=Q.n(A),p=Q("q1tI"),w=Q.n(p),m=Q("m3rI"),g=Q("wzkS"),b="\u3000\u3000";function a(i){var s=["Bytes","KB","MB","GB","TB"];if(i==0)return"0 Byte";var l=parseInt(""+Math.floor(Math.log(i)/Math.log(1024)),10);return(i/Math.pow(1024,l)).toFixed(1)+" "+s[l]}Se.b=function(i){var s=i.value,l=s===void 0?[]:s,S=i.action,v=i.onChange,y=i.className,R=i.maxSize,_=R===void 0?150:R,C=i.title,E=C===void 0?"\u6587\u4EF6\u4E0A\u4F20":C,c=i.accept,u=c===void 0?null:c,h={multiple:!1,fileList:l,accept:u,withCredentials:!0,beforeUpload:function(I){var F=I.size/1024/1024;return F<_?!0:(O.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(_,"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(m.a.API_SERVER,"/api/attachments.json"),onChange:function(I){var F=Object(W.a)(I.fileList);F=F.map(function(j){return j.name.indexOf(b)===-1&&(j.name="".concat(j.name).concat(b).concat(a(j.size))),Object(P.a)({},j)}),v(F)},onRemove:function(){var L=Object(U.a)(d.a.mark(function F(j){var z,M,N;return d.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(z=j.size/1024/1024,!(j.status==="uploading")){ee.next=3;break}return ee.abrupt("return",!0);case 3:if(z<_){ee.next=7;break}return ee.abrupt("return",!0);case 7:if(M=j.response?j.response.id:j.uid,!M){ee.next=15;break}return ee.next=11,Object(g.d)(j.response?j.response.id:j.id);case 11:return N=ee.sent,ee.abrupt("return",N);case 15:return ee.abrupt("return",!0);case 16:case"end":return ee.stop()}},F)}));function I(F){return L.apply(this,arguments)}return I}()};function T(L){L.preventDefault(),L.stopPropagation()}return w.a.createElement("div",{className:"single-upload ".concat(y||"")},w.a.createElement(J.a,h,w.a.createElement(X.a,{type:"primary",title:l.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:l.length>0,ghost:!0},E),w.a.createElement("span",{onClick:T,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",_,"M) ")))}}}]);