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.
144 lines
747 KiB
144 lines
747 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[77,5,6,7],{"+NIl":function(ot,He,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function(V,A){"use strict";function G(C,T){C.cmdState.push(T)}function U(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var T=C.cmdState.pop();T&&T.closeBracket()}function B(C){for(var T=C.cmdState,b=T.length-1;b>=0;b--){var d=T[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function I(C,T,b){return function(){this.name=C,this.bracketNo=0,this.style=T,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 D={};D.importmodule=I("importmodule","tag",["string","builtin"]),D.documentclass=I("documentclass","tag",["","atom"]),D.usepackage=I("usepackage","tag",["atom"]),D.begin=I("begin","tag",["atom"]),D.end=I("end","tag",["atom"]),D.label=I("label","tag",["atom"]),D.ref=I("ref","tag",["atom"]),D.eqref=I("eqref","tag",["atom"]),D.cite=I("cite","tag",["atom"]),D.bibitem=I("bibitem","tag",["atom"]),D.Bibitem=I("Bibitem","tag",["atom"]),D.RBibitem=I("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(C,T){C.f=T}function E(C,T){var b;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return b=D.hasOwnProperty(d)?D[d]:D.DEFAULT,b=new b,G(T,b),L(T,M),b.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return L(T,function(s,u){return _(s,u,"\\]")}),"keyword";if(C.match("\\("))return L(T,function(s,u){return _(s,u,"\\)")}),"keyword";if(C.match("$$"))return L(T,function(s,u){return _(s,u,"$$")}),"keyword";if(C.match("$"))return L(T,function(s,u){return _(s,u,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(b=U(T),b)b.closeBracket(o),L(T,M);else return"error";return"bracket"}else return o=="{"||o=="["?(b=D.DEFAULT,b=new b,G(T,b),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),b=B(T),b.name=="begin"&&(b.argument=C.current()),b.styleIdentifier())}function _(C,T,b){if(C.eatSpace())return null;if(b&&C.match(b))return L(T,E),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function M(C,T){var b=C.peek(),d;return b=="{"||b=="["?(d=U(T),d.openBracket(b),C.eat(b),L(T,E),"bracket"):/[ \t\r]/.test(b)?(C.eat(b),null):(L(T,E),R(T),E(C,T))}return{startState:function(){var C=A.inMathMode?function(T,b){return _(T,b)}:E;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,T){return T.f(C,T)},blankLine:function(C){C.f=E,C.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(ot,He,ee){(function(ne){ne(ee("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(I,D,L){var E=L&&L!=ne.Init;if(D&&!E)I.on("blur",U),I.on("change",R),I.on("swapDoc",R),ne.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){G(I)}),R(I);else if(!D&&E){I.off("blur",U),I.off("change",R),I.off("swapDoc",R),ne.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),V(I);var _=I.getWrapperElement();_.className=_.className.replace(" CodeMirror-empty","")}D&&!I.hasFocus()&&U(I)});function V(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function A(I){V(I);var D=I.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=I.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var L=I.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),D.appendChild(L),I.display.lineSpace.insertBefore(D,I.display.lineSpace.firstChild)}function G(I){setTimeout(function(){var D=!1,L=I.getInputField();L.nodeName=="TEXTAREA"?D=!L.value:I.lineCount()==1&&(D=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),D?A(I):V(I)},20)}function U(I){B(I)&&A(I)}function R(I){var D=I.getWrapperElement(),L=B(I);D.className=D.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?A(I):V(I)}function B(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(ot,He,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";var V={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},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(G,U){var R=G.indentUnit,B={},I=U.htmlMode?V:A;for(var D in I)B[D]=I[D];for(var D in U)B[D]=U[D];var L,E;function _(a,v){function g(F){return v.tokenize=F,F(a,v)}var y=a.next();if(y=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(T("atom","]]>")):null:a.match("--")?g(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=T("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",v.tokenize=M,"tag bracket");if(y=="&"){var k;return a.eat("#")?a.eat("x")?k=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):k=a.eatWhile(/[\d]/)&&a.eat(";"):k=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),k?"atom":"error"}else return a.eatWhile(/[^&<]/),null}_.isInText=!0;function M(a,v){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return v.tokenize=_,L=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return L="equals",null;if(g=="<"){v.tokenize=_,v.state=u,v.tagName=v.tagStart=null;var y=v.tokenize(a,v);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(g)?(v.tokenize=C(g),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(g,y){for(;!g.eol();)if(g.next()==a){y.tokenize=M;break}return"string"};return v.isInAttribute=!0,v}function T(a,v){return function(g,y){for(;!g.eol();){if(g.match(v)){y.tokenize=_;break}g.next()}return a}}function b(a){return function(v,g){for(var y;(y=v.next())!=null;){if(y=="<")return g.tokenize=b(a+1),g.tokenize(v,g);if(y==">")if(a==1){g.tokenize=_;break}else return g.tokenize=b(a-1),g.tokenize(v,g)}return"meta"}}function d(a,v,g){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=g,(B.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,v){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!B.contextGrabbers.hasOwnProperty(g)||!B.contextGrabbers[g].hasOwnProperty(v))return;o(a)}}function u(a,v,g){return a=="openTag"?(g.tagStart=v.column(),S):a=="closeTag"?f:u}function S(a,v,g){return a=="word"?(g.tagName=v.current(),E="tag",p):B.allowMissingTagName&&a=="endTag"?(E="tag bracket",p(a,v,g)):(E="error",S)}function f(a,v,g){if(a=="word"){var y=v.current();return g.context&&g.context.tagName!=y&&B.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==y||B.matchClosing===!1?(E="tag",m):(E="tag error",w)}else return B.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,v,g)):(E="error",w)}function m(a,v,g){return a!="endTag"?(E="error",m):(o(g),u)}function w(a,v,g){return E="error",m(a,v,g)}function p(a,v,g){if(a=="word")return E="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var y=g.tagName,k=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(y)?s(g,y):(s(g,y),g.context=new d(g,y,k==g.indented)),u}return E="error",p}function h(a,v,g){return a=="equals"?c:(B.allowMissing||(E="error"),p(a,v,g))}function c(a,v,g){return a=="string"?l:a=="word"&&B.allowUnquoted?(E="string",p):(E="error",p(a,v,g))}function l(a,v,g){return a=="string"?l:p(a,v,g)}return{startState:function(a){var v={tokenize:_,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;L=null;var g=v.tokenize(a,v);return(g||L)&&g!="comment"&&(E=null,v.state=v.state(L||g,a,v),E&&(g=E=="error"?g+" error":E)),g},indent:function(a,v,g){var y=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(y&&y.noIndent)return ne.Pass;if(a.tokenize!=M&&a.tokenize!=_)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var k=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(k&&k[1])for(;y;)if(y.tagName==k[2]){y=y.prev;break}else if(B.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(k)for(;y;){var F=B.contextGrabbers[y.tagName];if(F&&F.hasOwnProperty(k[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=p)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],g=a.context;g;g=g.prev)g.tagName&&v.push(g.tagName);return v.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(ot,He,ee){"use strict";ee.d(He,"a",function(){return f});var ne=ee("+L6B"),V=ee("2/Rp"),A=ee("2qtc"),G=ee("kLXV"),U=ee("9og8"),R=ee("k1fw"),B=ee("miYZ"),I=ee("tsqr"),D=ee("oBTY"),L=ee("tJVT"),E=ee("DZo9"),_=ee("8z0m"),M=ee("WmNS"),C=ee.n(M),T=ee("cDcd"),b=ee.n(T),d=ee("m3rI"),o=ee("wzkS"),s=ee("y5JW"),u=ee("LtfV"),S=_.a.Dragger;function f(m){var w=[];return m&&m.length>0&&(w=m.map(function(p){return{uid:p.id,id:p.id,name:p.title+s.c+p.filesize,url:p.url,filesize:p.filesize,status:"done",response:{id:p.id}}})),w}He.b=function(m){var w=m.value,p=m.onChange,h=m.action,c=m.className,l=m.maxSize,a=l===void 0?150:l,v=m.title,g=v===void 0?"\u4E0A\u4F20\u9644\u4EF6":v,y=m.showRemoveModal,k=y===void 0?!1:y,F=m.accept,j=F===void 0?"":F,W=m.additionalText,O=m.isDragger,P=m.number,H=P===void 0?1e3:P,X=m.aloneClear,Z=X===void 0?!1:X,re=m.restrict,be=re===void 0?!0:re,fe=Object(T.useState)(!1),Te=Object(L.a)(fe,2),pe=Te[0],ge=Te[1],ce=Object(T.useState)(w||[]),he=Object(L.a)(ce,2),J=he[0],oe=he[1];Object(T.useEffect)(function(){w&&(oe(Object(D.a)(w)),H===(w==null?void 0:w.length)&&ge(!0))},[w]);var q=function(){setTimeout(function(){J.pop(),oe(Object(D.a)(J))},500)},ye={multiple:!0,disabled:pe,accept:j,withCredentials:!0,fileList:J,beforeUpload:function(we,_e){var Oe=we.size/1024/1024;return J.concat(_e).length>H?(J.pop(),oe(Object(D.a)(J)),I.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),Z?Promise.reject():(q(),!1)):Oe<a?!0:(I.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(a,"MB).")),Z?Promise.reject():(q(),!1))},action:h||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(we){var _e=Object(D.a)(we.fileList);_e.length>=H?ge(!0):ge(!1),oe(Object(D.a)(_e)),_e=_e.map(function(Oe){var Me;if(Oe!=null&&(Me=Oe.response)!==null&&Me!==void 0&&Me.id){var De;Oe.url="/api/attachments/".concat(Oe==null||((De=Oe.response)===null||De===void 0)?void 0:De.id)}return Oe.name.indexOf(s.c)===-1&&(Oe.name="".concat(Oe.name).concat(s.c).concat(Object(s.a)(Oe.size))),Object(R.a)({},Oe)}),console.log("info:",we),p(_e)},onRemove:function(){var me=Object(U.a)(C.a.mark(function _e(Oe){var Me;return C.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:if(Me=function(){var We=Object(U.a)(C.a.mark(function Ve(){var Xe,Be;return C.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:if(Xe=Oe.response?Oe.response.id:Oe.id,!Xe){Ke.next=8;break}return Ke.next=4,Object(o.d)(Oe.response?Oe.response.id:Oe.uid);case 4:return Be=Ke.sent,Ke.abrupt("return",Be);case 8:return Ke.abrupt("return",!0);case 9:case"end":return Ke.stop()}},Ve)}));return function(){return We.apply(this,arguments)}}(),!k){Le.next=5;break}return Le.abrupt("return",new Promise(function(We,Ve){G.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 Xe=Object(U.a)(C.a.mark(function Qe(){var Ke;return C.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,Me();case 2:Ke=Ae.sent,I.b.success("\u5220\u9664\u6210\u529F"),We(!0);case 5:case"end":return Ae.stop()}},Qe)}));function Be(){return Xe.apply(this,arguments)}return Be}(),onCancel:function(){return We(!1)}})}));case 5:return Le.next=7,Me();case 7:return Le.abrupt("return",Le.sent);case 8:case"end":return Le.stop()}},_e)}));function we(_e){return me.apply(this,arguments)}return we}()};function Se(me){me.preventDefault(),me.stopPropagation()}return b.a.createElement("div",{className:"multi-upload ".concat(c||"")},O&&b.a.createElement(S,ye,b.a.createElement("p",{className:"ant-upload-drag-icon"},b.a.createElement(u.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:be?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB) ")),W),!O&&b.a.createElement(_.a,ye,b.a.createElement(V.a,{disabled:pe},g),b.a.createElement("span",{onClick:Se,style:{marginLeft:10,color:"#FA6400",display:be?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB) ")))}},"55Ip":function(ot,He,ee){"use strict";ee.d(He,"a",function(){return s}),ee.d(He,"b",function(){return p});var ne=ee("Ty5D"),V=ee("dI71"),A=ee("cDcd"),G=ee.n(A),U=ee("YS25"),R=ee("17x9"),B=ee.n(R),I=ee("wx14"),D=ee("zLVn"),L=ee("9R94"),E=function(c){Object(V.a)(l,c);function l(){for(var v,g=arguments.length,y=new Array(g),k=0;k<g;k++)y[k]=arguments[k];return v=c.call.apply(c,[this].concat(y))||this,v.history=Object(U.a)(v.props),v}var a=l.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},l}(G.a.Component),_=function(c){Object(V.a)(l,c);function l(){for(var v,g=arguments.length,y=new Array(g),k=0;k<g;k++)y[k]=arguments[k];return v=c.call.apply(c,[this].concat(y))||this,v.history=Object(U.b)(v.props),v}var a=l.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},l}(G.a.Component),M=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(U.c)(l,null,null,a):l},T=function(l){return l},b=G.a.forwardRef;typeof b=="undefined"&&(b=T);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=b(function(c,l){var a=c.innerRef,v=c.navigate,g=c.onClick,y=Object(D.a)(c,["innerRef","navigate","onClick"]),k=y.target,F=Object(I.a)({},y,{onClick:function(W){try{g&&g(W)}catch(O){throw W.preventDefault(),O}!W.defaultPrevented&&W.button===0&&(!k||k==="_self")&&!d(W)&&(W.preventDefault(),v())}});return T!==b?F.ref=l||a:F.ref=a,G.a.createElement("a",F)}),s=b(function(c,l){var a=c.component,v=a===void 0?o:a,g=c.replace,y=c.to,k=c.innerRef,F=Object(D.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(ne.e.Consumer,null,function(j){j||Object(L.a)(!1);var W=j.history,O=C(M(y,j.location),j.location),P=O?W.createHref(O):"",H=Object(I.a)({},F,{href:P,navigate:function(){var Z=M(y,j.location),re=g?W.replace:W.push;re(Z)}});return T!==b?H.ref=l||k:H.innerRef=k,G.a.createElement(v,H)})});if(!1)var u,S;var f=function(l){return l},m=G.a.forwardRef;typeof m=="undefined"&&(m=f);function w(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(v){return v}).join(" ")}var p=m(function(c,l){var a=c["aria-current"],v=a===void 0?"page":a,g=c.activeClassName,y=g===void 0?"active":g,k=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,O=c.location,P=c.sensitive,H=c.strict,X=c.style,Z=c.to,re=c.innerRef,be=Object(D.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(ne.e.Consumer,null,function(fe){fe||Object(L.a)(!1);var Te=O||fe.location,pe=C(M(Z,Te),Te),ge=pe.pathname,ce=ge&&ge.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),he=ce?Object(ne.f)(Te.pathname,{path:ce,exact:j,sensitive:P,strict:H}):null,J=!!(W?W(he,Te):he),oe=J?w(F,y):F,q=J?Object(I.a)({},X,{},k):X,ye=Object(I.a)({"aria-current":J&&v||null,className:oe,style:q,to:pe},be);return f!==m?ye.ref=l||re:ye.innerRef=re,G.a.createElement(s,ye)})});if(!1)var h},"7ahc":function(ot,He,ee){"use strict";ee.d(He,"a",function(){return S});var ne=ee("k1fw"),V=ee("0Owb"),A=ee("+L6B"),G=ee("2/Rp"),U=ee("y8nQ"),R=ee("Vl3Y"),B=ee("tJVT"),I=ee("OaEy"),D=ee("2fM7"),L=ee("cDcd"),E=ee.n(L),_=ee("VrN/"),M=ee.n(_),C=ee("p77/"),T=ee.n(C),b=ee("c5Ni"),d=ee.n(b),o=D.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};He.b=function(f){var m=f.callback,w=f.onCancel,p=Object(L.useState)("python"),h=Object(B.a)(p,2),c=h[0],l=h[1];function a(g){l(u[g][1])}function v(g){m(g)}return E.a.createElement(R.a,Object(V.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),E.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(D.a,{onChange:a},Object.keys(u).map(function(g){return E.a.createElement(o,{key:g,value:g},u[g][0])}))),E.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(S,{mode:c})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(G.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(f){var m=f.value,w=f.onChange,p=f.mode,h=f.options,c=h===void 0?{}:h,l=Object(L.useRef)(),a=Object(L.useState)(),v=Object(B.a)(a,2),g=v[0],y=v[1];return Object(L.useEffect)(function(){if(g){function k(F){var j=F.getValue();w&&w(j)}return g.on("change",k),function(){g.off("change",k)}}},[g,w]),Object(L.useEffect)(function(){g&&g.setOption("mode",p)},[g,p]),Object(L.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(L.useEffect)(function(){if(l.current&&!g){var k=M.a.fromTextArea(l.current,Object(ne.a)({mode:p,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));y(k)}},[l.current,g]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:l}))}},"8EBN":function(ot,He,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";ne.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<ne.modeInfo.length;V++){var A=ne.modeInfo[V];A.mimes&&(A.mime=A.mimes[0])}ne.findModeByMIME=function(G){G=G.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.mime==G)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==G)return R}}if(/\+xml$/.test(G))return ne.findModeByMIME("application/xml");if(/\+json$/.test(G))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(G){G=G.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==G)return R}}},ne.findModeByFileName=function(G){for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.file&&R.file.test(G))return R}var B=G.lastIndexOf("."),I=B>-1&&G.substring(B+1,G.length);if(I)return ne.findModeByExtension(I)},ne.findModeByName=function(G){G=G.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.name.toLowerCase()==G)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==G)return R}}}})},"9Bee":function(ot,He,ee){"use strict";var ne=ee("k1fw"),V=ee("tJVT"),A=ee("cDcd"),G=ee.n(A),U=ee("vg9a"),R=ee("DlQD"),B=ee.n(R),I=ee("rUJ1");function D(H,X){var Z=H.match(/^(\s+)(?:```)/);if(Z===null)return X;var re=Z[1];return X.split(`
|
|
`).map(function(be){var fe=be.match(/^\s+/);if(fe===null)return be;var Te=Object(V.a)(fe,1),pe=Te[0];return pe.length>=re.length?be.slice(re.length):be}).join(`
|
|
`)}var L=[],E=["<ul>"],_=new B.a.Renderer,M=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){L.length=0,E=["<ul>"]}var T={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(H,X,Z,re){if(X>=H.length||H[X].level<=Z)return X;var be=H[X];re.push("<li><a href='#"+be.anchor+"'>"+be.text+"</a>"),X++;var fe=[];return X=b(H,X,be.level,fe),fe.length>0&&(re.push("<ul>"),fe.forEach(function(Te){re.push(Te)}),re.push("</ul>")),re.push("</li>"),X=b(H,X,Z,re),X}function d(){return b(L,0,0,E),E.push("</ul>"),E.join("")}var o={heading:function(X){var Z=M.exec(X);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},fences:function(X){var Z=this.rules.block.fences.exec(X);if(Z){var re=Z[0],be=D(re,Z[3]||""),fe=Z[2]?Z[2].trim():Z[2];if(["latex","katex","math"].indexOf(fe)>=0){var Te=S(),pe=be;be=Te,f[Te]={type:"block",expression:pe}}return{type:"code",raw:re,lang:fe,text:be}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,S=function(){return"__special_katext_id_".concat(u++,"__")},f={};function m(){return f}function w(){u=0,f={}}function p(H){return H=H.replace(s,function(X,Z){var re=S();return f[re]={type:"inline",expression:Z},re}),H}var h=_.listitem;_.listitem=function(H){return h(p(H))};var c=_.paragraph;_.paragraph=function(H){return c(p(H))};var l=_.tablecell;_.tablecell=function(H,X){return l(p(H),X)},_.code=function(H,X,Z){var re=(X||"").match(/\S*/)[0];return re?["latex","katex","math"].indexOf(re)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(X,'">').concat(Z?H:Object(I.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(Z?H:Object(I.escape)(H,!0))+"</code></pre>"},_.heading=function(H,X,Z){var re=this.options.headerPrefix+Z.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return L.push({anchor:re,level:X,text:H}),"<h"+X+' id="'+re+'">'+H+"</h"+X+">"},B.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),B.a.use({tokenizer:o,renderer:_});var a=B.a,v=ee("SJMd"),g=ee("ulZh"),y=ee.n(g),k=ee("m3rI"),F=ee("Oy/b"),j=ee("p5ED"),W=/<pre[^>]*>/g;function O(H){var X=document.createElement("div");return X.innerHTML=H,X.childNodes.length===0?"":X.childNodes[0].nodeValue}var P=He.a=function(H){var X=H.value,Z=X===void 0?"":X,re=H.className,be=H.showTextOnly,fe=H.showLines,Te=H.style,pe=Te===void 0?{}:Te,ge=H.stylesPrev,ce=ge===void 0?{}:ge,he=String(Z),J=Object(A.useState)(""),oe=Object(V.a)(J,2),q=oe[0],ye=oe[1],Se=Object(A.useMemo)(function(){try{var Oe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Me=/\"\/api\/attachments\/|\"\/attachments\/download\//g,De=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;he=he.replace(Oe,"("+k.a.API_SERVER+"/api/attachments/").replace(Me,'"'+k.a.API_SERVER+"/api/attachments/").replace(De,'"'+k.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,`
|
|
`),he=he.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Xe){}var Le=a(he),We=m();if(he.match(/\[TOC\]/)&&(Le=Le.replace("<p>[TOC]</p>",d()),C()),Le=Le.replace(/(__special_katext_id_\d+__)/g,function(Xe,Be){var Qe=We[Be],Ke=Qe.type,$e=Qe.expression;return Object(F.renderToString)(O($e)||"",{displayMode:Ke==="block",throwOnError:!1,output:"html"})}),Le=Le.replace(/▁/g,"\u2581\u2581\u2581"),w(),be){var Ve=document.createElement("div");return Ve.innerHTML=Le,Ve.innerText}return setTimeout(function(){return _e()},500),Le},[he]),me=Object(A.useRef)();T.WebkitLineClamp=fe,fe&&(pe=Object(ne.a)(Object(ne.a)({},pe),T));function we(Oe){var Me=Oe.target;if(Me.tagName.toUpperCase()==="A"){var De=Me.getAttribute("href");if(De.indexOf("office")>-1)Oe.preventDefault(),ye(De);else if(De.startsWith("#")){Oe.preventDefault();var Le=document.getElementById(De.replace("#",""));Le&&Le.scrollIntoView(!0)}}}var _e=function(){var Me,De=(Me=me.current)===null||Me===void 0?void 0:Me.querySelectorAll("video");De==null||De.forEach(function(Le){if(Le.oncontextmenu=function(){return!1},Le.src.indexOf(".m3u8")>-1&&!Le.canPlayType("application/vnd.apple.mpegurl")){if(y.a.isSupported()){var We=new y.a;We.loadSource(Le.src),We.attachMedia(Le)}}})};return Object(A.useEffect)(function(){if(me.current&&Se&&(Se.match(W)&&window.PR.prettyPrint()),me.current)return me.current.addEventListener("click",we),function(){me.current.removeEventListener("click",we),w(),C()}},[Se,me.current,we]),G.a.createElement(G.a.Fragment,null,G.a.createElement("div",{ref:me,style:Object(ne.a)({},pe),className:"".concat(re||""," markdown-body "),dangerouslySetInnerHTML:{__html:Se}}),G.a.createElement(j.a,{close:!0,data:q,type:q!=null&&q.length?"office":"",style:Object(ne.a)({},ce),onClose:function(){return ye("")}}))}},"9VGf":function(ot,He,ee){"use strict";ee.d(He,"a",function(){return A});var ne=ee("cDcd"),V=ee.n(ne);function A(G,U){var R=Object(ne.useRef)();Object(ne.useEffect)(function(){R.current=G}),Object(ne.useEffect)(function(){function B(){R.current()}if(U!==null){var I=setInterval(B,U);return function(){return clearInterval(I)}}},[U])}},BU3w:function(ot,He,ee){"use strict";ee.d(He,"a",function(){return R});var ne=ee("MNnm"),V="rc-util-key";function A(B){if(B.attachTo)return B.attachTo;var I=document.querySelector("head");return I||document.body}function G(B){var I,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var L=document.createElement("style");if((I=D.csp)===null||I===void 0?void 0:I.nonce){var E;L.nonce=(E=D.csp)===null||E===void 0?void 0:E.nonce}L.innerHTML=B;var _=A(D),M=_.firstChild;return D.prepend&&_.prepend?_.prepend(L):D.prepend&&M?_.insertBefore(L,M):_.appendChild(L),L}var U=new Map;function R(B,I){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=A(D);if(!U.has(L)){var E=G("",D),_=E.parentNode;U.set(L,_),_.removeChild(E)}var M=Array.from(U.get(L).children).find(function(o){return o.tagName==="STYLE"&&o[V]===I});if(M){var C,T;if(((C=D.csp)===null||C===void 0?void 0:C.nonce)&&M.nonce!==((T=D.csp)===null||T===void 0?void 0:T.nonce)){var b;M.nonce=(b=D.csp)===null||b===void 0?void 0:b.nonce}return M.innerHTML!==B&&(M.innerHTML=B),M}var d=G(B,D);return d[V]=I,d}},Bd2K:function(ot,He,ee){(function(ne){ne(ee("VrN/"),ee("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(D,L,E){if(E!=ne.Init&&E&&D.removeKeyMap("autoCloseTags"),!L)return;var _={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(_["'/'"]=function(M){return R(M)}),(typeof L!="object"||L.whenOpening!==!1)&&(_["'>'"]=function(M){return G(M)}),D.addKeyMap(_)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["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 G(D){if(D.getOption("disableInput"))return ne.Pass;for(var L=D.listSelections(),E=[],_=D.getOption("autoCloseTags"),M=0;M<L.length;M++){if(!L[M].empty())return ne.Pass;var C=L[M].head,T=D.getTokenAt(C),b=ne.innerMode(D.getMode(),T.state),d=b.state,o=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),s=o&&o.name;if(!s)return ne.Pass;var u=b.mode.configuration=="html",S=typeof _=="object"&&_.dontCloseTags||u&&V,f=typeof _=="object"&&_.indentTags||u&&A;T.end>C.ch&&(s=s.slice(0,s.length-T.end+C.ch));var m=s.toLowerCase();if(!s||T.type=="string"&&(T.end!=C.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&o.close||T.string.indexOf("/")==C.ch-T.start-1||S&&B(S,m)>-1||I(D,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],s,C,!0))return ne.Pass;var w=typeof _=="object"&&_.emptyTags;if(w&&B(w,s)>-1){E[M]={text:"/>",newPos:ne.Pos(C.line,C.ch+2)};continue}var p=f&&B(f,m)>-1;E[M]={indent:p,text:">"+(p?`
|
|
|
|
`:"")+"</"+s+">",newPos:p?ne.Pos(C.line+1,0):ne.Pos(C.line,C.ch+1)}}for(var h=typeof _=="object"&&_.dontIndentOnAutoClose,M=L.length-1;M>=0;M--){var c=E[M];D.replaceRange(c.text,L[M].head,L[M].anchor,"+insert");var l=D.listSelections().slice(0);l[M]={head:c.newPos,anchor:c.newPos},D.setSelections(l),!h&&c.indent&&(D.indentLine(c.newPos.line,null,!0),D.indentLine(c.newPos.line+1,null,!0))}}function U(D,L){for(var E=D.listSelections(),_=[],M=L?"/":"</",C=D.getOption("autoCloseTags"),T=typeof C=="object"&&C.dontIndentOnSlash,b=0;b<E.length;b++){if(!E[b].empty())return ne.Pass;var d=E[b].head,o=D.getTokenAt(d),s=ne.innerMode(D.getMode(),o.state),u=s.state;if(L&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return ne.Pass;var S,f=s.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")S=M+"script";else if(f&&s.mode.name=="css")S=M+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!m||m.length&&I(D,m,m[m.length-1],d))return ne.Pass;S=M+m[m.length-1]}D.getLine(d.line).charAt(o.end)!=">"&&(S+=">"),_[b]=S}if(D.replaceSelections(_),E=D.listSelections(),!T)for(var b=0;b<E.length;b++)(b==E.length-1||E[b].head.line<E[b+1].head.line)&&D.indentLine(E[b].head.line)}function R(D){return D.getOption("disableInput")?ne.Pass:U(D,!0)}ne.commands.closeTag=function(D){return U(D)};function B(D,L){if(D.indexOf)return D.indexOf(L);for(var E=0,_=D.length;E<_;++E)if(D[E]==L)return E;return-1}function I(D,L,E,_,M){if(!ne.scanForClosingTag)return!1;var C=Math.min(D.lastLine()+1,_.line+500),T=ne.scanForClosingTag(D,_,null,C);if(!T||T.tag!=E)return!1;for(var b=M?1:0,d=L.length-1;d>=0&&L[d]==E;d--)++b;_=T.to;for(var d=1;d<b;d++){var o=ne.scanForClosingTag(D,_,null,C);if(!o||o.tag!=E)return!1;_=o.to}return!0}})},BjJ7:function(ot,He,ee){"use strict";ee.d(He,"d",function(){return V}),ee.d(He,"c",function(){return A}),ee.d(He,"e",function(){return G}),ee.d(He,"b",function(){return U}),ee.d(He,"a",function(){return B});var ne=ee("m3rI");function V(I){var D=!0;if(I.length>0){for(var L=0;L<I.length;L++)if(I[L].compile_success==0||!I[L].compile_success){D=!1;break}}else D=!1;return D}function A(I){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],E=0;E<I.length;E++){var _=I[E],M=D?"".concat(D,"/").concat(_.name):"".concat(_.name);L.push({title:_.name,isLeaf:!(_.type==="tree"),key:M})}return L}function G(I,D,L){for(var E=0;E<I.length;E++){var _=I[E];if(_.key===D){_.children=L;break}_.children&&G(_.children,D,L)}return I}function U(I,D,L){var E;return function(){var _=this,M=arguments,C=function(){E=null,L||I.apply(_,M)},T=L&&!E;clearTimeout(E),E=setTimeout(C,D),T&&I.apply(_,M)}}var R=!0,B=ne.a.API_SERVER},"C+DQ":function(ot,He,ee){},DlQD:function(ot,He,ee){(function(ne,V){ot.exports=V()})(this,function(){"use strict";function ne(se,le){for(var ue=0;ue<le.length;ue++){var $=le[ue];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(se,$.key,$)}}function V(se,le,ue){return le&&ne(se.prototype,le),ue&&ne(se,ue),se}function A(se,le){if(!se)return;if(typeof se=="string")return G(se,le);var ue=Object.prototype.toString.call(se).slice(8,-1);if(ue==="Object"&&se.constructor&&(ue=se.constructor.name),ue==="Map"||ue==="Set")return Array.from(se);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return G(se,le)}function G(se,le){(le==null||le>se.length)&&(le=se.length);for(var ue=0,$=new Array(le);ue<le;ue++)$[ue]=se[ue];return $}function U(se,le){var ue;if(typeof Symbol=="undefined"||se[Symbol.iterator]==null){if(Array.isArray(se)||(ue=A(se))||le&&se&&typeof se.length=="number"){ue&&(se=ue);var $=0;return function(){return $>=se.length?{done:!0}:{done:!1,value:se[$++]}}}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 ue=se[Symbol.iterator](),ue.next.bind(ue)}function R(se,le){return le={exports:{}},se(le,le.exports),le.exports}var B=R(function(se){function le(){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 ue($){se.exports.defaults=$}se.exports={defaults:le(),getDefaults:le,changeDefaults:ue}}),I=B.defaults,D=B.getDefaults,L=B.changeDefaults,E=/[&<>"']/,_=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(le){return T[le]};function d(se,le){if(le){if(E.test(se))return se.replace(_,b)}else if(M.test(se))return se.replace(C,b);return se}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(se){return se.replace(o,function(le,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var u=/(^|[^\[])\^/g;function S(se,le){se=se.source||se,le=le||"";var ue={replace:function(Q,te){return te=te.source||te,te=te.replace(u,"$1"),se=se.replace(Q,te),ue},getRegex:function(){return new RegExp(se,le)}};return ue}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(se,le,ue){if(se){var $;try{$=decodeURIComponent(s(ue)).replace(f,"").toLowerCase()}catch(Q){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}le&&!m.test(ue)&&(ue=a(le,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(Q){return null}return ue}var p={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(se,le){p[" "+se]||(h.test(se)?p[" "+se]=se+"/":p[" "+se]=k(se,"/",!0)),se=p[" "+se];var ue=se.indexOf(":")===-1;return le.substring(0,2)==="//"?ue?le:se.replace(c,"$1")+le:le.charAt(0)==="/"?ue?le:se.replace(l,"$1")+le:se+le}var v={exec:function(){}};function g(se){for(var le=1,ue,$;le<arguments.length;le++){ue=arguments[le];for($ in ue)Object.prototype.hasOwnProperty.call(ue,$)&&(se[$]=ue[$])}return se}function y(se,le){var ue=se.replace(/\|/g,function(te,ie,Ee){for(var Ce=!1,Ie=ie;--Ie>=0&&Ee[Ie]==="\\";)Ce=!Ce;return Ce?"|":" |"}),$=ue.split(/ \|/),Q=0;if($.length>le)$.splice(le);else for(;$.length<le;)$.push("");for(;Q<$.length;Q++)$[Q]=$[Q].trim().replace(/\\\|/g,"|");return $}function k(se,le,ue){var $=se.length;if($===0)return"";for(var Q=0;Q<$;){var te=se.charAt($-Q-1);if(te===le&&!ue)Q++;else if(te!==le&&ue)Q++;else break}return se.substr(0,$-Q)}function F(se,le){if(se.indexOf(le[1])===-1)return-1;for(var ue=se.length,$=0,Q=0;Q<ue;Q++)if(se[Q]==="\\")Q++;else if(se[Q]===le[0])$++;else if(se[Q]===le[1]&&($--,$<0))return Q;return-1}function j(se){se&&se.sanitize&&!se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:d,unescape:s,edit:S,cleanUrl:w,resolveUrl:a,noopTest:v,merge:g,splitCells:y,rtrim:k,findClosingBracket:F,checkSanitizeDeprecation:j},O=B.defaults,P=W.rtrim,H=W.splitCells,X=W.escape,Z=W.findClosingBracket;function re(se,le,ue){var $=le.href,Q=le.title?X(le.title):null,te=se[1].replace(/\\([\[\]])/g,"$1");return se[0].charAt(0)!=="!"?{type:"link",raw:ue,href:$,title:Q,text:te}:{type:"image",raw:ue,href:$,title:Q,text:X(te)}}function be(se,le){var ue=se.match(/^(\s+)(?:```)/);if(ue===null)return le;var $=ue[1];return le.split(`
|
|
`).map(function(Q){var te=Q.match(/^\s+/);if(te===null)return Q;var ie=te[0];return ie.length>=$.length?Q.slice($.length):Q}).join(`
|
|
`)}var fe=function(){function se(ue){this.options=ue||O}var le=se.prototype;return le.space=function($){var Q=this.rules.block.newline.exec($);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},le.code=function($,Q){var te=this.rules.block.code.exec($);if(te){var ie=Q[Q.length-1];if(ie&&ie.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var Ee=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?Ee:P(Ee,`
|
|
`)}}},le.fences=function($){var Q=this.rules.block.fences.exec($);if(Q){var te=Q[0],ie=be(te,Q[3]||"");return{type:"code",raw:te,lang:Q[2]?Q[2].trim():Q[2],text:ie}}},le.heading=function($){var Q=this.rules.block.heading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},le.nptable=function($){var Q=this.rules.block.nptable.exec($);if(Q){var te={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Q[0]};if(te.header.length===te.align.length){var ie=te.align.length,Ee;for(Ee=0;Ee<ie;Ee++)/^ *-+: *$/.test(te.align[Ee])?te.align[Ee]="right":/^ *:-+: *$/.test(te.align[Ee])?te.align[Ee]="center":/^ *:-+ *$/.test(te.align[Ee])?te.align[Ee]="left":te.align[Ee]=null;for(ie=te.cells.length,Ee=0;Ee<ie;Ee++)te.cells[Ee]=H(te.cells[Ee],te.header.length);return te}}},le.hr=function($){var Q=this.rules.block.hr.exec($);if(Q)return{type:"hr",raw:Q[0]}},le.blockquote=function($){var Q=this.rules.block.blockquote.exec($);if(Q){var te=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:te}}},le.list=function($){var Q=this.rules.block.list.exec($);if(Q){for(var te=Q[0],ie=Q[2],Ee=ie.length>1,Ce=ie[ie.length-1]===")",Ie={type:"list",raw:te,ordered:Ee,start:Ee?+ie.slice(0,-1):"",loose:!1,items:[]},tt=Q[0].match(this.rules.block.item),dt=!1,it,Lt,mt,st,It,yt,Yt,Wt=tt.length,pt=0;pt<Wt;pt++)it=tt[pt],te=it,Lt=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(`
|
|
`)&&(Lt-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+Lt+"}","gm"),"")),pt!==Wt-1&&(mt=this.rules.block.bullet.exec(tt[pt+1])[0],(Ee?mt.length===1||!Ce&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==ie)&&(st=tt.slice(pt+1).join(`
|
|
`),Ie.raw=Ie.raw.substring(0,Ie.raw.length-st.length),pt=Wt-1)),It=dt||/\n\n(?!\s*$)/.test(it),pt!==Wt-1&&(dt=it.charAt(it.length-1)===`
|
|
`,It||(It=dt)),It&&(Ie.loose=!0),yt=/^\[[ xX]\] /.test(it),Yt=void 0,yt&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),Ie.items.push({type:"list_item",raw:te,task:yt,checked:Yt,loose:It,text:it});return Ie}},le.html=function($){var Q=this.rules.block.html.exec($);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):X(Q[0]):Q[0]}},le.def=function($){var Q=this.rules.block.def.exec($);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var te=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Q[0],href:Q[2],title:Q[3]}}},le.table=function($){var Q=this.rules.block.table.exec($);if(Q){var te={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=Q[0];var ie=te.align.length,Ee;for(Ee=0;Ee<ie;Ee++)/^ *-+: *$/.test(te.align[Ee])?te.align[Ee]="right":/^ *:-+: *$/.test(te.align[Ee])?te.align[Ee]="center":/^ *:-+ *$/.test(te.align[Ee])?te.align[Ee]="left":te.align[Ee]=null;for(ie=te.cells.length,Ee=0;Ee<ie;Ee++)te.cells[Ee]=H(te.cells[Ee].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},le.lheading=function($){var Q=this.rules.block.lheading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},le.paragraph=function($){var Q=this.rules.block.paragraph.exec($);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
|
|
`?Q[1].slice(0,-1):Q[1]}},le.text=function($,Q){var te=this.rules.block.text.exec($);if(te){var ie=Q[Q.length-1];return ie&&ie.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},le.escape=function($){var Q=this.rules.inline.escape.exec($);if(Q)return{type:"escape",raw:Q[0],text:X(Q[1])}},le.tag=function($,Q,te){var ie=this.rules.inline.tag.exec($);if(ie)return!Q&&/^<a /i.test(ie[0])?Q=!0:Q&&/^<\/a>/i.test(ie[0])&&(Q=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(ie[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ie[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:ie[0],inLink:Q,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):X(ie[0]):ie[0]}},le.link=function($){var Q=this.rules.inline.link.exec($);if(Q){var te=Z(Q[2],"()");if(te>-1){var ie=Q[0].indexOf("!")===0?5:4,Ee=ie+Q[1].length+te;Q[2]=Q[2].substring(0,te),Q[0]=Q[0].substring(0,Ee).trim(),Q[3]=""}var Ce=Q[2],Ie="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);tt?(Ce=tt[1],Ie=tt[3]):Ie=""}else Ie=Q[3]?Q[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=re(Q,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:Ie&&Ie.replace(this.rules.inline._escapes,"$1")},Q[0]);return dt}},le.reflink=function($,Q){var te;if((te=this.rules.inline.reflink.exec($))||(te=this.rules.inline.nolink.exec($))){var ie=(te[2]||te[1]).replace(/\s+/g," ");if(ie=Q[ie.toLowerCase()],!ie||!ie.href){var Ee=te[0].charAt(0);return{type:"text",raw:Ee,text:Ee}}var Ce=re(te,ie,te[0]);return Ce}},le.strong=function($,Q,te){te===void 0&&(te="");var ie=this.rules.inline.strong.start.exec($);if(ie&&(!ie[1]||ie[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Q=Q.slice(-1*$.length);var Ee=ie[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ee.lastIndex=0;for(var Ce;(ie=Ee.exec(Q))!=null;)if(Ce=this.rules.inline.strong.middle.exec(Q.slice(0,ie.index+3)),Ce)return{type:"strong",raw:$.slice(0,Ce[0].length),text:$.slice(2,Ce[0].length-2)}}},le.em=function($,Q,te){te===void 0&&(te="");var ie=this.rules.inline.em.start.exec($);if(ie&&(!ie[1]||ie[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Q=Q.slice(-1*$.length);var Ee=ie[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ee.lastIndex=0;for(var Ce;(ie=Ee.exec(Q))!=null;)if(Ce=this.rules.inline.em.middle.exec(Q.slice(0,ie.index+2)),Ce)return{type:"em",raw:$.slice(0,Ce[0].length),text:$.slice(1,Ce[0].length-1)}}},le.codespan=function($){var Q=this.rules.inline.code.exec($);if(Q){var te=Q[2].replace(/\n/g," "),ie=/[^ ]/.test(te),Ee=te.startsWith(" ")&&te.endsWith(" ");return ie&&Ee&&(te=te.substring(1,te.length-1)),te=X(te,!0),{type:"codespan",raw:Q[0],text:te}}},le.br=function($){var Q=this.rules.inline.br.exec($);if(Q)return{type:"br",raw:Q[0]}},le.del=function($){var Q=this.rules.inline.del.exec($);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},le.autolink=function($,Q){var te=this.rules.inline.autolink.exec($);if(te){var ie,Ee;return te[2]==="@"?(ie=X(this.options.mangle?Q(te[1]):te[1]),Ee="mailto:"+ie):(ie=X(te[1]),Ee=ie),{type:"link",raw:te[0],text:ie,href:Ee,tokens:[{type:"text",raw:ie,text:ie}]}}},le.url=function($,Q){var te;if(te=this.rules.inline.url.exec($)){var ie,Ee;if(te[2]==="@")ie=X(this.options.mangle?Q(te[0]):te[0]),Ee="mailto:"+ie;else{var Ce;do Ce=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ce!==te[0]);ie=X(te[0]),te[1]==="www."?Ee="http://"+ie:Ee=ie}return{type:"link",raw:te[0],text:ie,href:Ee,tokens:[{type:"text",raw:ie,text:ie}]}}},le.inlineText=function($,Q,te){var ie=this.rules.inline.text.exec($);if(ie){var Ee;return Q?Ee=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):X(ie[0]):ie[0]:Ee=X(this.options.smartypants?te(ie[0]):ie[0]),{type:"text",raw:ie[0],text:Ee}}},se}(),Te=W.noopTest,pe=W.edit,ge=W.merge,ce={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=pe(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=pe(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=pe(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._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",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=pe(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=pe(ce._paragraph).replace("hr",ce.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",ce._tag).getRegex(),ce.blockquote=pe(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=ge({},ce),ce.gfm=ge({},ce.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*|$)"}),ce.gfm.nptable=pe(ce.gfm.nptable).replace("hr",ce.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",ce._tag).getRegex(),ce.gfm.table=pe(ce.gfm.table).replace("hr",ce.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",ce._tag).getRegex(),ce.pedantic=ge({},ce.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Te,paragraph:pe(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=pe(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=pe(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=pe(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=pe(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=pe(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=pe(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=pe(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=pe(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=pe(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=pe(he._blockSkip,"g").getRegex(),he.overlapSkip=pe(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._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])?)+(?![-_])/,he.autolink=pe(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=pe(he.tag).replace("comment",ce._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=pe(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=pe(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=pe(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=ge({},he),he.pedantic=ge({},he.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:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=ge({},he.normal,{escape:pe(he.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=pe(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=ge({},he.gfm,{br:pe(he.br).replace("{2,}","*").getRegex(),text:pe(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ce,inline:he},oe=B.defaults,q=J.block,ye=J.inline;function Se(se){return se.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function me(se){var le="",ue,$,Q=se.length;for(ue=0;ue<Q;ue++)$=se.charCodeAt(ue),Math.random()>.5&&($="x"+$.toString(16)),le+="&#"+$+";";return le}var we=function(){function se(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||oe,this.options.tokenizer=this.options.tokenizer||new fe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:q.normal,inline:ye.normal};this.options.pedantic?($.block=q.pedantic,$.inline=ye.pedantic):this.options.gfm&&($.block=q.gfm,this.options.breaks?$.inline=ye.breaks:$.inline=ye.gfm),this.tokenizer.rules=$}se.lex=function($,Q){var te=new se(Q);return te.lex($)};var le=se.prototype;return le.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function($,Q,te){Q===void 0&&(Q=[]),te===void 0&&(te=!0),$=$.replace(/^ +$/gm,"");for(var ie,Ee,Ce,Ie;$;){if(ie=this.tokenizer.space($)){$=$.substring(ie.raw.length),ie.type&&Q.push(ie);continue}if(ie=this.tokenizer.code($,Q)){$=$.substring(ie.raw.length),ie.type?Q.push(ie):(Ie=Q[Q.length-1],Ie.raw+=`
|
|
`+ie.raw,Ie.text+=`
|
|
`+ie.text);continue}if(ie=this.tokenizer.fences($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.heading($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.nptable($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.hr($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.blockquote($)){$=$.substring(ie.raw.length),ie.tokens=this.blockTokens(ie.text,[],te),Q.push(ie);continue}if(ie=this.tokenizer.list($)){for($=$.substring(ie.raw.length),Ce=ie.items.length,Ee=0;Ee<Ce;Ee++)ie.items[Ee].tokens=this.blockTokens(ie.items[Ee].text,[],!1);Q.push(ie);continue}if(ie=this.tokenizer.html($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(te&&(ie=this.tokenizer.def($))){$=$.substring(ie.raw.length),this.tokens.links[ie.tag]||(this.tokens.links[ie.tag]={href:ie.href,title:ie.title});continue}if(ie=this.tokenizer.table($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.lheading($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(te&&(ie=this.tokenizer.paragraph($))){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.text($,Q)){$=$.substring(ie.raw.length),ie.type?Q.push(ie):(Ie=Q[Q.length-1],Ie.raw+=`
|
|
`+ie.raw,Ie.text+=`
|
|
`+ie.text);continue}if($){var tt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return Q},le.inline=function($){var Q,te,ie,Ee,Ce,Ie,tt=$.length;for(Q=0;Q<tt;Q++){Ie=$[Q];switch(Ie.type){case"paragraph":case"text":case"heading":{Ie.tokens=[],this.inlineTokens(Ie.text,Ie.tokens);break}case"table":{for(Ie.tokens={header:[],cells:[]},Ee=Ie.header.length,te=0;te<Ee;te++)Ie.tokens.header[te]=[],this.inlineTokens(Ie.header[te],Ie.tokens.header[te]);for(Ee=Ie.cells.length,te=0;te<Ee;te++)for(Ce=Ie.cells[te],Ie.tokens.cells[te]=[],ie=0;ie<Ce.length;ie++)Ie.tokens.cells[te][ie]=[],this.inlineTokens(Ce[ie],Ie.tokens.cells[te][ie]);break}case"blockquote":{this.inline(Ie.tokens);break}case"list":{for(Ee=Ie.items.length,te=0;te<Ee;te++)this.inline(Ie.items[te].tokens);break}}}return $},le.inlineTokens=function($,Q,te,ie,Ee){Q===void 0&&(Q=[]),te===void 0&&(te=!1),ie===void 0&&(ie=!1),Ee===void 0&&(Ee="");var Ce,Ie=$,tt;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Ie))!=null;)dt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Ie=Ie.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Ie))!=null;)Ie=Ie.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Ce=this.tokenizer.escape($)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.tag($,te,ie)){$=$.substring(Ce.raw.length),te=Ce.inLink,ie=Ce.inRawBlock,Q.push(Ce);continue}if(Ce=this.tokenizer.link($)){$=$.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,ie)),Q.push(Ce);continue}if(Ce=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,ie)),Q.push(Ce);continue}if(Ce=this.tokenizer.strong($,Ie,Ee)){$=$.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],te,ie),Q.push(Ce);continue}if(Ce=this.tokenizer.em($,Ie,Ee)){$=$.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],te,ie),Q.push(Ce);continue}if(Ce=this.tokenizer.codespan($)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.br($)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.del($)){$=$.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],te,ie),Q.push(Ce);continue}if(Ce=this.tokenizer.autolink($,me)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(!te&&(Ce=this.tokenizer.url($,me))){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.inlineText($,ie,Se)){$=$.substring(Ce.raw.length),Ee=Ce.raw.slice(-1),Q.push(Ce);continue}if($){var it="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return Q},V(se,null,[{key:"rules",get:function(){return{block:q,inline:ye}}}]),se}(),_e=B.defaults,Oe=W.cleanUrl,Me=W.escape,De=function(){function se(ue){this.options=ue||_e}var le=se.prototype;return le.code=function($,Q,te){var ie=(Q||"").match(/\S*/)[0];if(this.options.highlight){var Ee=this.options.highlight($,ie);Ee!=null&&Ee!==$&&(te=!0,$=Ee)}return ie?'<pre><code class="'+this.options.langPrefix+Me(ie,!0)+'">'+(te?$:Me($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?$:Me($,!0))+`</code></pre>
|
|
`},le.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},le.html=function($){return $},le.heading=function($,Q,te,ie){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+ie.slug(te)+'">'+$+"</h"+Q+`>
|
|
`:"<h"+Q+">"+$+"</h"+Q+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function($,Q,te){var ie=Q?"ol":"ul",Ee=Q&&te!==1?' start="'+te+'"':"";return"<"+ie+Ee+`>
|
|
`+$+"</"+ie+`>
|
|
`},le.listitem=function($){return"<li>"+$+`</li>
|
|
`},le.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function($){return"<p>"+$+`</p>
|
|
`},le.table=function($,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+Q+`</table>
|
|
`},le.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},le.tablecell=function($,Q){var te=Q.header?"th":"td",ie=Q.align?"<"+te+' align="'+Q.align+'">':"<"+te+">";return ie+$+"</"+te+`>
|
|
`},le.strong=function($){return"<strong>"+$+"</strong>"},le.em=function($){return"<em>"+$+"</em>"},le.codespan=function($){return"<code>"+$+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function($){return"<del>"+$+"</del>"},le.link=function($,Q,te){if($=Oe(this.options.sanitize,this.options.baseUrl,$),$===null)return te;var ie='<a href="'+Me($)+'"';return Q&&(ie+=' title="'+Q+'"'),ie+=">"+te+"</a>",ie},le.image=function($,Q,te){if($=Oe(this.options.sanitize,this.options.baseUrl,$),$===null)return te;var ie='<img src="'+$+'" alt="'+te+'"';return Q&&(ie+=' title="'+Q+'"'),ie+=this.options.xhtml?"/>":">",ie},le.text=function($){return $},se}(),Le=function(){function se(){}var le=se.prototype;return le.strong=function($){return $},le.em=function($){return $},le.codespan=function($){return $},le.del=function($){return $},le.html=function($){return $},le.text=function($){return $},le.link=function($,Q,te){return""+te},le.image=function($,Q,te){return""+te},le.br=function(){return""},se}(),We=function(){function se(){this.seen={}}var le=se.prototype;return le.slug=function($){var Q=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var te=Q;do this.seen[te]++,Q=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},se}(),Ve=B.defaults,Xe=W.unescape,Be=function(){function se(ue){this.options=ue||Ve,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new We}se.parse=function($,Q){var te=new se(Q);return te.parse($)};var le=se.prototype;return le.parse=function($,Q){Q===void 0&&(Q=!0);var te="",ie,Ee,Ce,Ie,tt,dt,it,Lt,mt,st,It,yt,Yt,Wt,pt,Tr,zr,lr,Sr=$.length;for(ie=0;ie<Sr;ie++){st=$[ie];switch(st.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Xe(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Lt="",it="",Ie=st.header.length,Ee=0;Ee<Ie;Ee++)it+=this.renderer.tablecell(this.parseInline(st.tokens.header[Ee]),{header:!0,align:st.align[Ee]});for(Lt+=this.renderer.tablerow(it),mt="",Ie=st.cells.length,Ee=0;Ee<Ie;Ee++){for(dt=st.tokens.cells[Ee],it="",tt=dt.length,Ce=0;Ce<tt;Ce++)it+=this.renderer.tablecell(this.parseInline(dt[Ce]),{header:!1,align:st.align[Ce]});mt+=this.renderer.tablerow(it)}te+=this.renderer.table(Lt,mt);continue}case"blockquote":{mt=this.parse(st.tokens),te+=this.renderer.blockquote(mt);continue}case"list":{for(It=st.ordered,yt=st.start,Yt=st.loose,Ie=st.items.length,mt="",Ee=0;Ee<Ie;Ee++)pt=st.items[Ee],Tr=pt.checked,zr=pt.task,Wt="",pt.task&&(lr=this.renderer.checkbox(Tr),Yt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=lr+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=lr+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:lr}):Wt+=lr),Wt+=this.parse(pt.tokens,Yt),mt+=this.renderer.listitem(Wt,zr,Tr);te+=this.renderer.list(mt,It,yt);continue}case"html":{te+=this.renderer.html(st.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(mt=st.tokens?this.parseInline(st.tokens):st.text;ie+1<Sr&&$[ie+1].type==="text";)st=$[++ie],mt+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);te+=Q?this.renderer.paragraph(mt):mt;continue}default:{var hr='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return te},le.parseInline=function($,Q){Q=Q||this.renderer;var te="",ie,Ee,Ce=$.length;for(ie=0;ie<Ce;ie++){Ee=$[ie];switch(Ee.type){case"escape":{te+=Q.text(Ee.text);break}case"html":{te+=Q.html(Ee.text);break}case"link":{te+=Q.link(Ee.href,Ee.title,this.parseInline(Ee.tokens,Q));break}case"image":{te+=Q.image(Ee.href,Ee.title,Ee.text);break}case"strong":{te+=Q.strong(this.parseInline(Ee.tokens,Q));break}case"em":{te+=Q.em(this.parseInline(Ee.tokens,Q));break}case"codespan":{te+=Q.codespan(Ee.text);break}case"br":{te+=Q.br();break}case"del":{te+=Q.del(this.parseInline(Ee.tokens,Q));break}case"text":{te+=Q.text(Ee.text);break}default:{var Ie='Token with "'+Ee.type+'" type was not found.';if(this.options.silent){console.error(Ie);return}else throw new Error(Ie)}}}return te},se}(),Qe=W.merge,Ke=W.checkSanitizeDeprecation,$e=W.escape,Ae=B.getDefaults,qe=B.changeDefaults,Je=B.defaults;function Re(se,le,ue){if(typeof se=="undefined"||se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(se)+", string expected");if(typeof le=="function"&&(ue=le,le=null),le=Qe({},Re.defaults,le||{}),Ke(le),ue){var $=le.highlight,Q;try{Q=we.lex(se,le)}catch(Ce){return ue(Ce)}var te=function(Ie){var tt;if(!Ie)try{tt=Be.parse(Q,le)}catch(dt){Ie=dt}return le.highlight=$,Ie?ue(Ie):ue(null,tt)};if(!$||$.length<3)return te();if(delete le.highlight,!Q.length)return te();var ie=0;Re.walkTokens(Q,function(Ce){Ce.type==="code"&&(ie++,setTimeout(function(){$(Ce.text,Ce.lang,function(Ie,tt){if(Ie)return te(Ie);tt!=null&&tt!==Ce.text&&(Ce.text=tt,Ce.escaped=!0),ie--,ie===0&&te()})},0))}),ie===0&&te();return}try{var Ee=we.lex(se,le);return le.walkTokens&&Re.walkTokens(Ee,le.walkTokens),Be.parse(Ee,le)}catch(Ce){if(Ce.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+$e(Ce.message+"",!0)+"</pre>";throw Ce}}Re.options=Re.setOptions=function(se){return Qe(Re.defaults,se),qe(Re.defaults),Re},Re.getDefaults=Ae,Re.defaults=Je,Re.use=function(se){var le=Qe({},se);if(se.renderer&&function(){var $=Re.defaults.renderer||new De,Q=function(Ee){var Ce=$[Ee];$[Ee]=function(){for(var Ie=arguments.length,tt=new Array(Ie),dt=0;dt<Ie;dt++)tt[dt]=arguments[dt];var it=se.renderer[Ee].apply($,tt);return it===!1&&(it=Ce.apply($,tt)),it}};for(var te in se.renderer)Q(te);le.renderer=$}(),se.tokenizer&&function(){var $=Re.defaults.tokenizer||new fe,Q=function(Ee){var Ce=$[Ee];$[Ee]=function(){for(var Ie=arguments.length,tt=new Array(Ie),dt=0;dt<Ie;dt++)tt[dt]=arguments[dt];var it=se.tokenizer[Ee].apply($,tt);return it===!1&&(it=Ce.apply($,tt)),it}};for(var te in se.tokenizer)Q(te);le.tokenizer=$}(),se.walkTokens){var ue=Re.defaults.walkTokens;le.walkTokens=function($){se.walkTokens($),ue&&ue($)}}Re.setOptions(le)},Re.walkTokens=function(se,le){for(var ue=U(se),$;!($=ue()).done;){var Q=$.value;le(Q);switch(Q.type){case"table":{for(var te=U(Q.tokens.header),ie;!(ie=te()).done;){var Ee=ie.value;Re.walkTokens(Ee,le)}for(var Ce=U(Q.tokens.cells),Ie;!(Ie=Ce()).done;)for(var tt=Ie.value,dt=U(tt),it;!(it=dt()).done;){var Lt=it.value;Re.walkTokens(Lt,le)}break}case"list":{Re.walkTokens(Q.items,le);break}default:Q.tokens&&Re.walkTokens(Q.tokens,le)}}},Re.Parser=Be,Re.parser=Be.parse,Re.Renderer=De,Re.TextRenderer=Le,Re.Lexer=we,Re.lexer=we.lex,Re.Tokenizer=fe,Re.Slugger=We,Re.parse=Re;var Fe=Re;return Fe})},ELLl:function(ot,He,ee){(function(ne){ne(ee("VrN/"))})(function(ne){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(T,b,d){d&&d!=ne.Init&&(T.removeKeyMap(U),T.state.closeBrackets=null),b&&(R(G(b,"pairs")),T.state.closeBrackets=b,T.addKeyMap(U))});function G(T,b){return b=="pairs"&&typeof T=="string"?T:typeof T=="object"&&T[b]!=null?T[b]:V[b]}var U={Backspace:D,Enter:L};function R(T){for(var b=0;b<T.length;b++){var d=T.charAt(b),o="'"+d+"'";U[o]||(U[o]=B(d))}}R(V.pairs+"`");function B(T){return function(b){return _(b,T)}}function I(T){var b=T.state.closeBrackets;if(!b||b.override)return b;var d=T.getModeAt(T.getCursor());return d.closeBrackets||b}function D(T){var b=I(T);if(!b||T.getOption("disableInput"))return ne.Pass;for(var d=G(b,"pairs"),o=T.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ne.Pass;var u=M(T,o[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}for(var s=o.length-1;s>=0;s--){var S=o[s].head;T.replaceRange("",A(S.line,S.ch-1),A(S.line,S.ch+1),"+delete")}}function L(T){var b=I(T),d=b&&G(b,"explode");if(!d||T.getOption("disableInput"))return ne.Pass;for(var o=T.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ne.Pass;var u=M(T,o[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}T.operation(function(){var S=T.lineSeparator()||`
|
|
`;T.replaceSelection(S+S,null),T.execCommand("goCharLeft"),o=T.listSelections();for(var f=0;f<o.length;f++){var m=o[f].head.line;T.indentLine(m,null,!0),T.indentLine(m+1,null,!0)}})}function E(T){var b=ne.cmpPos(T.anchor,T.head)>0;return{anchor:new A(T.anchor.line,T.anchor.ch+(b?-1:1)),head:new A(T.head.line,T.head.ch+(b?1:-1))}}function _(T,b){var d=I(T);if(!d||T.getOption("disableInput"))return ne.Pass;var o=G(d,"pairs"),s=o.indexOf(b);if(s==-1)return ne.Pass;for(var u=G(d,"closeBefore"),S=G(d,"triples"),f=o.charAt(s+1)==b,m=T.listSelections(),w=s%2==0,p,h=0;h<m.length;h++){var c=m[h],l=c.head,a,v=T.getRange(l,A(l.line,l.ch+1));if(w&&!c.empty())a="surround";else if((f||!w)&&v==b)f&&C(T,l)?a="both":S.indexOf(b)>=0&&T.getRange(l,A(l.line,l.ch+3))==b+b+b?a="skipThree":a="skip";else if(f&&l.ch>1&&S.indexOf(b)>=0&&T.getRange(A(l.line,l.ch-2),l)==b+b){if(l.ch>2&&/\bstring/.test(T.getTokenTypeAt(A(l.line,l.ch-2))))return ne.Pass;a="addFour"}else if(f){var g=l.ch==0?" ":T.getRange(A(l.line,l.ch-1),l);if(!ne.isWordChar(v)&&g!=b&&!ne.isWordChar(g))a="both";else return ne.Pass}else if(w&&(v.length===0||/\s/.test(v)||u.indexOf(v)>-1))a="both";else return ne.Pass;if(!p)p=a;else if(p!=a)return ne.Pass}var y=s%2?o.charAt(s-1):b,k=s%2?b:o.charAt(s+1);T.operation(function(){if(p=="skip")T.execCommand("goCharRight");else if(p=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(p=="surround"){for(var j=T.getSelections(),F=0;F<j.length;F++)j[F]=y+j[F]+k;T.replaceSelections(j,"around"),j=T.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=E(j[F]);T.setSelections(j)}else p=="both"?(T.replaceSelection(y+k,null),T.triggerElectric(y+k),T.execCommand("goCharLeft")):p=="addFour"&&(T.replaceSelection(y+y+y+y,"before"),T.execCommand("goCharRight"))})}function M(T,b){var d=T.getRange(A(b.line,b.ch-1),A(b.line,b.ch+1));return d.length==2?d:null}function C(T,b){var d=T.getTokenAt(A(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(T.getTokenTypeAt(b)))}})},GfqC:function(ot,He,ee){"use strict";var ne=ee("cDcd"),V=ee.n(ne),A=ee("TSYQ"),G=ee.n(A);function U(W,O){var P="cannot "+W.method+" "+W.action+" "+O.status+"'",H=new Error(P);return H.status=O.status,H.method=W.method,H.url=W.action,H}function R(W){var O=W.responseText||W.response;if(!O)return O;try{return JSON.parse(O)}catch(P){return O}}function B(W){var O=new XMLHttpRequest;W.onProgress&&O.upload&&(O.upload.onprogress=function(Z){Z.total>0&&(Z.percent=Z.loaded/Z.total*100),W.onProgress(Z)});var P=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var Z=W.data[X];if(Array.isArray(Z)){Z.forEach(function(re){P.append(X+"[]",re)});return}P.append(X,W.data[X])}),W.file instanceof Blob?P.append(W.filename,W.file,W.file.name):P.append(W.filename,W.file),O.onerror=function(Z){W.onError(Z)},O.onload=function(){return O.status<200||O.status>=300?W.onError(U(W,O),R(O)):W.onSuccess(R(O),O)},O.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&O.setRequestHeader(X,H[X])}),O.send(P),{abort:function(){O.abort()}}}var I=+new Date,D=0;function L(){return"rc-upload-"+I+"-"+ ++D}function E(W,O){return W.indexOf(O,W.length-O.length)!==-1}var _=function(W,O){if(W&&O){var P=Array.isArray(O)?O:O.split(","),H=W.name||"",X=W.type||"",Z=X.replace(/\/.*$/,"");return P.some(function(re){var be=re.trim();return be.charAt(0)==="."?E(H.toLowerCase(),be.toLowerCase()):/\/\*$/.test(be)?Z===be.replace(/\/.*$/,""):X===be})}return!0};function M(W,O){var P=W.createReader(),H=[];function X(){P.readEntries(function(Z){var re=Array.prototype.slice.apply(Z);H=H.concat(re);var be=!re.length;be?O(H):X()})}X()}var C=function(O,P,H){var X=function Z(re,be){be=be||"",re.isFile?re.file(function(fe){H(fe)&&(re.fullPath&&!fe.webkitRelativePath&&(Object.defineProperties(fe,{webkitRelativePath:{writable:!0}}),fe.webkitRelativePath=re.fullPath.replace(/^\//,""),Object.defineProperties(fe,{webkitRelativePath:{writable:!1}})),P([fe]))}):re.isDirectory&&M(re,function(fe){fe.forEach(function(Te){Z(Te,""+be+re.name+"/")})})};O.forEach(function(Z){X(Z.webkitGetAsEntry())})},T=C,b=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},d=function(){function W(O,P){var H=[],X=!0,Z=!1,re=void 0;try{for(var be=O[Symbol.iterator](),fe;!(X=(fe=be.next()).done)&&!(H.push(fe.value),P&&H.length===P);X=!0);}catch(Te){Z=!0,re=Te}finally{try{!X&&be.return&&be.return()}finally{if(Z)throw re}}return H}return function(O,P){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return W(O,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(O,P){for(var H=0;H<P.length;H++){var X=P[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,P,H){return P&&W(O.prototype,P),H&&W(O,H),O}}();function s(W,O,P){return O in W?Object.defineProperty(W,O,{value:P,enumerable:!0,configurable:!0,writable:!0}):W[O]=P,W}function u(W,O){var P={};for(var H in W){if(O.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;P[H]=W[H]}return P}function S(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function f(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function m(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}var w=function(O){return Object.keys(O).reduce(function(P,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(P[H]=O[H]),P},{})},p=function(W){m(O,W);function O(){var P,H,X,Z;S(this,O);for(var re=arguments.length,be=Array(re),fe=0;fe<re;fe++)be[fe]=arguments[fe];return Z=(H=(X=f(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(be))),X),X.state={uid:L()},X.reqs={},X.onChange=function(Te){var pe=Te.target.files;X.uploadFiles(pe),X.reset()},X.onClick=function(Te){var pe=X.fileInput;if(!pe)return;var ge=X.props,ce=ge.children,he=ge.onClick;ce&&ce.type==="button"&&(pe.parentNode.focus(),pe.parentNode.querySelector("button").blur()),pe.click(),he&&he(Te)},X.onKeyDown=function(Te){Te.key==="Enter"&&X.onClick()},X.onFileDrop=function(Te){var pe=X.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(X.props.directory)T(Array.prototype.slice.call(Te.dataTransfer.items),X.uploadFiles,function(ce){return _(ce,X.props.accept)});else{var ge=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(ce){return _(ce,X.props.accept)});pe===!1&&(ge=ge.slice(0,1)),X.uploadFiles(ge)}},X.uploadFiles=function(Te){var pe=Array.prototype.slice.call(Te);pe.map(function(ge){return ge.uid=L(),ge}).forEach(function(ge){X.upload(ge,pe)})},X.saveFileInput=function(Te){X.fileInput=Te},H),f(X,Z)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var Z=this,re=this.props;if(!re.beforeUpload)return setTimeout(function(){return Z.post(H)},0);var be=re.beforeUpload(H,X);be&&be.then?be.then(function(fe){var Te=Object.prototype.toString.call(fe);return Te==="[object File]"||Te==="[object Blob]"?Z.post(fe):Z.post(H)}).catch(function(fe){console.log(fe)}):be!==!1&&setTimeout(function(){return Z.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var Z=this.props,re=Z.onStart,be=Z.onProgress,fe=Z.transformFile,Te=fe===void 0?function(pe){return pe}:fe;new Promise(function(pe){var ge=Z.action;return typeof ge=="function"&&(ge=ge(H)),pe(ge)}).then(function(pe){var ge=H.uid,ce=Z.customRequest||B,he=Promise.resolve(Te(H)).then(function(J){var oe=Z.data;return typeof oe=="function"&&(oe=oe(J)),Promise.all([J,oe])}).catch(function(J){console.error(J)});he.then(function(J){var oe=d(J,2),q=oe[0],ye=oe[1],Se={action:pe,filename:Z.name,data:ye,file:q,headers:Z.headers,withCredentials:Z.withCredentials,method:Z.method||"post",onProgress:be?function(me){be(me,H)}:null,onSuccess:function(we,_e){delete X.reqs[ge],Z.onSuccess(we,H,_e)},onError:function(we,_e){delete X.reqs[ge],Z.onError(we,_e,H)}};re(H),X.reqs[ge]=ce(Se)})})}},{key:"reset",value:function(){this.setState({uid:L()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var Z=H;H&&H.uid&&(Z=H.uid),X[Z]&&X[Z].abort&&X[Z].abort(),delete X[Z]}else Object.keys(X).forEach(function(re){X[re]&&X[re].abort&&X[re].abort(),delete X[re]})}},{key:"render",value:function(){var H,X=this.props,Z=X.component,re=X.prefixCls,be=X.className,fe=X.disabled,Te=X.id,pe=X.style,ge=X.multiple,ce=X.accept,he=X.children,J=X.directory,oe=X.openFileDialogOnClick,q=X.onMouseEnter,ye=X.onMouseLeave,Se=u(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),me=G()((H={},s(H,re,!0),s(H,re+"-disabled",fe),s(H,be,be),H)),we=fe?{}:{onClick:oe?this.onClick:function(){},onKeyDown:oe?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:ye,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(Z,b({},we,{className:me,role:"button",style:pe}),V.a.createElement("input",b({},w(Se),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(Oe){return Oe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ce,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:ge,onChange:this.onChange})),he)}}]),O}(ne.Component),h=p,c=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},l=function(){function W(O,P){for(var H=0;H<P.length;H++){var X=P[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,P,H){return P&&W(O.prototype,P),H&&W(O,H),O}}();function a(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function v(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function g(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}function y(){}var k=function(W){g(O,W);function O(){var P,H,X,Z;a(this,O);for(var re=arguments.length,be=Array(re),fe=0;fe<re;fe++)be[fe]=arguments[fe];return Z=(H=(X=v(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(be))),X),X.saveUploader=function(Te){X.uploader=Te},H),v(X,Z)}return l(O,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return V.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),O}(ne.Component);k.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:y,onError:y,onSuccess:y,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=k,j=He.a=F},HmJG:function(ot,He,ee){},LdHM:function(ot,He,ee){"use strict";ee.d(He,"b",function(){return u}),ee.d(He,"a",function(){return f});var ne=ee("1OyB"),V=ee("vuIU"),A=ee("Ji7U"),G=ee("LK+K"),U=ee("cDcd"),R=ee("rePB"),B=ee("Ff2n"),I=ee("ODXe"),D=ee("4IlW"),L=ee("bX4T"),E=ee("YrtM"),_=ee("TSYQ"),M=ee.n(_),C=ee("+nKL"),T=ee("8OUc"),b=function(H,X){var Z=H.prefixCls,re=H.id,be=H.flattenOptions,fe=H.childrenAsData,Te=H.values,pe=H.searchValue,ge=H.multiple,ce=H.defaultActiveFirstOption,he=H.height,J=H.itemHeight,oe=H.notFoundContent,q=H.open,ye=H.menuItemSelectedIcon,Se=H.virtual,me=H.onSelect,we=H.onToggleOpen,_e=H.onActiveValue,Oe=H.onScroll,Me=H.onMouseEnter,De="".concat(Z,"-item"),Le=Object(E.a)(function(){return be},[q,be],function(Fe,se){return se[0]&&Fe[1]!==se[1]}),We=U.useRef(null),Ve=function(se){se.preventDefault()},Xe=function(se){We.current&&We.current.scrollTo({index:se})},Be=function(se){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Le.length,$=0;$<ue;$+=1){var Q=(se+$*le+ue)%ue,te=Le[Q],ie=te.group,Ee=te.data;if(!ie&&!Ee.disabled)return Q}return-1},Qe=U.useState(function(){return Be(0)}),Ke=Object(I.a)(Qe,2),$e=Ke[0],Ae=Ke[1],qe=function(se){Ae(se);var le=Le[se];if(!le){_e(null,-1);return}_e(le.data.value,se)};U.useEffect(function(){qe(ce!==!1?Be(0):-1)},[Le.length,pe]),U.useEffect(function(){var Fe=setTimeout(function(){if(!ge&&q&&Te.size===1){var se=Array.from(Te)[0],le=Le.findIndex(function(ue){var $=ue.data;return $.value===se});qe(le),Xe(le)}});return function(){return clearTimeout(Fe)}},[q]);var Je=function(se){se!==void 0&&me(se,{selected:!Te.has(se)}),ge||we(!1)};if(U.useImperativeHandle(X,function(){return{onKeyDown:function(se){var le=se.which;switch(le){case D.a.UP:case D.a.DOWN:{var ue=0;if(le===D.a.UP?ue=-1:le===D.a.DOWN&&(ue=1),ue!==0){var $=Be($e+ue,ue);Xe($),qe($)}break}case D.a.ENTER:{var Q=Le[$e];Q&&!Q.data.disabled?Je(Q.data.value):Je(void 0),q&&se.preventDefault();break}case D.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(se){Xe(se)}}}),Le.length===0)return U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),className:"".concat(De,"-empty"),onMouseDown:Ve},oe);function Re(Fe){var se=Le[Fe];if(!se)return null;var le=se.data||{},ue=le.value,$=le.label,Q=le.children,te=Object(L.a)(le,!0),ie=fe?Q:$;return se?U.createElement("div",Object.assign({"aria-label":typeof ie=="string"?ie:null},te,{key:Fe,role:"option",id:"".concat(re,"_list_").concat(Fe),"aria-selected":Te.has(ue)}),ue):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re($e-1),Re($e),Re($e+1)),U.createElement(C.a,{itemKey:"key",ref:We,data:Le,height:he,itemHeight:J,fullHeight:!1,onMouseDown:Ve,onScroll:Oe,virtual:Se,onMouseEnter:Me},function(Fe,se){var le,ue=Fe.group,$=Fe.groupOption,Q=Fe.data,te=Q.label,ie=Q.key;if(ue)return U.createElement("div",{className:M()(De,"".concat(De,"-group"))},te!==void 0?te:ie);var Ee=Q.disabled,Ce=Q.value,Ie=Q.title,tt=Q.children,dt=Q.style,it=Q.className,Lt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),mt=Te.has(Ce),st="".concat(De,"-option"),It=M()(De,st,it,(le={},Object(R.a)(le,"".concat(st,"-grouped"),$),Object(R.a)(le,"".concat(st,"-active"),$e===se&&!Ee),Object(R.a)(le,"".concat(st,"-disabled"),Ee),Object(R.a)(le,"".concat(st,"-selected"),mt),le)),yt=fe?tt:te,Yt=!ye||typeof ye=="function"||mt;return U.createElement("div",Object.assign({},Lt,{"aria-selected":mt,className:It,title:Ie,onMouseMove:function(){if($e===se||Ee)return;qe(se)},onClick:function(){Ee||Je(Ce)},style:dt}),U.createElement("div",{className:"".concat(st,"-content")},yt||Ce),U.isValidElement(ye)||mt,Yt&&U.createElement(T.a,{className:"".concat(De,"-option-state"),customizeIcon:ye,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=U.forwardRef(b);d.displayName="OptionList";var o=d,s=function(){return null};s.isSelectOption=!0;var u=s,S=function(){return null};S.isSelectOptGroup=!0;var f=S,m=ee("VTBJ"),w=ee("Zm9Q");function p(P){var H=P.key,X=P.props,Z=X.children,re=X.value,be=Object(B.a)(X,["children","value"]);return Object(m.a)({key:H,value:re!==void 0?re:H,children:Z},be)}function h(P){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(P).map(function(X,Z){if(!U.isValidElement(X)||!X.type)return null;var re=X.type.isSelectOptGroup,be=X.key,fe=X.props,Te=fe.children,pe=Object(B.a)(fe,["children"]);return H||!re?p(X):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(be===null?Z:be,"__"),label:be},pe),{},{options:h(Te)})}).filter(function(X){return X})}var c=ee("2Qr1"),l=ee("qNPg"),a=ee("U8pU"),v=ee("Kwbf"),g=ee("WKfj");function y(P){var H=P.mode,X=P.options,Z=P.children,re=P.backfill,be=P.allowClear,fe=P.placeholder,Te=P.getInputElement,pe=P.showSearch,ge=P.onSearch,ce=P.defaultOpen,he=P.autoFocus,J=P.labelInValue,oe=P.value,q=P.inputValue,ye=P.optionLabelProp,Se=H==="multiple"||H==="tags",me=pe!==void 0?pe:Se||H==="combobox",we=X||h(Z);if(Object(v.a)(H!=="tags"||we.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var _e=we.some(function(De){return De.options?De.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(v.a)(!_e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!ye,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!re,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!Te||!be||!fe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ge&&!me&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ce||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),oe!=null){var Oe=Object(g.d)(oe);Object(v.a)(!J||Oe.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Se||Array.isArray(oe),"`value` should be array when `mode` is `multiple` or `tags`")}if(Z){var Me=null;Object(w.a)(Z).some(function(De){if(!U.isValidElement(De)||!De.type)return!1;var Le=De.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var We=Object(w.a)(De.props.children).every(function(Ve){return!U.isValidElement(Ve)||!De.type||Ve.type.isSelectOption?!0:(Me=Ve.type,!1)});return!We}return Me=Le,!0}),Me&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Me.displayName||Me.name||Me,"`.")),Object(v.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=y,F=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:k,fillOptionsWithMissingValue:c.a}),j=function(P){Object(A.a)(X,P);var H=Object(G.a)(X);function X(){var Z;return Object(ne.a)(this,X),Z=H.apply(this,arguments),Z.selectRef=U.createRef(),Z.focus=function(){Z.selectRef.current.focus()},Z.blur=function(){Z.selectRef.current.blur()},Z}return Object(V.a)(X,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),X}(U.Component);j.Option=u,j.OptGroup=f;var W=j,O=He.c=W},M8RZ:function(ot,He,ee){"use strict";ee.d(He,"a",function(){return D});var ne=ee("fWQN"),V=ee("mtLc"),A=ee("yKVA"),G=ee("879j"),U=ee("cDcd"),R=ee.n(U),B=ee("faye"),I=ee.n(B),D=function(L){Object(A.a)(_,L);var E=Object(G.a)(_);function _(M){var C;Object(ne.a)(this,_),C=E.call(this,M);var T=window.document;return C.node=T.createElement("div"),T.body.appendChild(C.node),C}return Object(V.a)(_,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),_}(R.a.Component)},Ot1p:function(ot,He,ee){"use strict";var ne=ee("2qtc"),V=ee("kLXV"),A=ee("rAM+"),G=ee("miYZ"),U=ee("tsqr"),R=ee("tJVT"),B=ee("jrin"),I=ee("cDcd"),D=ee.n(I),L=ee("VrN/"),E=ee.n(L),_=ee("bdgK"),M=ee("p77/"),C=ee("Bd2K"),T=ee("ELLl"),b=ee("19Vz"),d=ee("lZu9"),o=ee("+NIl"),s=ee("kSUc"),u=ee("9Bee"),S=function(se){var le=se.value,ue=le===void 0?"":le,$=se.className,Q=se.showTextOnly,te=se.showLines,ie=se.style,Ee=ie===void 0?{}:ie,Ce=Object(I.useMemo)(function(){return""},[ue]);return D.a.createElement(D.a.Fragment,null,D.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ce}}))},f=ee("0Owb"),m=ee("dejd"),w=ee("C+DQ"),p=[{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 h(se){var le=se.onActionCallback,ue=se.title,$=se.icon,Q=se.actionName,te=se.className,ie=te===void 0?"":te,Ee=se.children;function Ce(){le(Q)}return D.a.createElement("a",{title:ue,className:ie,onClick:Ce},D.a.createElement("i",{className:"md-iconfont ".concat($)}),Ee)}var c=function(se){var le=se.watch,ue=se.showNullButton,$=se.onActionCallback,Q=se.fullScreen,te=se.insertTemp,ie=se.hidetoolBar,Ee=[].concat(p,[{title:"".concat(le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return D.a.createElement("ul",{className:"markdown-toolbar-container"},!ie&&Ee.map(function(Ce,Ie){return D.a.createElement("li",{key:Ie},Ce.actionName?D.a.createElement(h,Object(f.a)({},Ce,{onActionCallback:$})):D.a.createElement("span",{className:"v-line"}))}),ue?D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$},D.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,te&&D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(te),onActionCallback:$},D.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),D.a.createElement("li",{className:"btn-full-screen"},D.a.createElement(h,{icon:"".concat(Q?"icon-shrink":"icon-enlarge"),title:Q?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$})))},l=ee("M8RZ"),a=ee("+L6B"),v=ee("2/Rp"),g=ee("y8nQ"),y=ee("Vl3Y"),k=ee("5NDa"),F=ee("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},W=function(se){var le=se.callback,ue=se.onCancel;function $(Q){le(Q)}return D.a.createElement(y.a,Object(f.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$}),D.a.createElement(y.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},D.a.createElement(F.a,null)),D.a.createElement(y.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},D.a.createElement(F.a,null)),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(v.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},O=ee("7ahc"),P=ee("HmJG"),H=ee("BjJ7"),X=y.a.useForm,Z={width:280,marginRight:10},re={labelCol:{span:5},wrapperCol:{span:19}},be=function(se){var le=se.callback,ue=se.onCancel,$=X(),Q=Object(R.a)($,1),te=Q[0];function ie(Ie){le(Ie)}function Ee(Ie,tt){te.setFieldsValue({src:"/api/attachments/".concat(Ie.id),type:tt.type})}function Ce(Ie){var tt=Ie.target.files[0];Te(tt,Ee)}return D.a.createElement(y.a,Object(f.a)({form:te},re,{className:"upload-image-panel",onFinish:ie}),D.a.createElement(y.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},D.a.createElement("div",{className:"flex-container"},D.a.createElement(y.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},D.a.createElement(F.a,{style:Z})),D.a.createElement(fe,{onFileChange:Ce}))),D.a.createElement(y.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},D.a.createElement(F.a,{style:{width:264}})),D.a.createElement(y.a.Item,{style:{textAlign:"right"}},D.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(v.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))};function fe(se){var le=se.onFileChange;return D.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",D.a.createElement("input",{type:"file",onChange:le}))}function Te(se,le){if(!se)throw new String("\u6CA1\u6709\u6587\u4EF6");var ue=new FormData;ue.append("editormd-image-file",se),ue.append("file_param_name","editormd-image-file"),ue.append("byxhr","true");var $=new window.XMLHttpRequest;$.withCredentials=!0,$.addEventListener("load",function(Q){le(JSON.parse(Q.target.responseText),se)},!1),$.addEventListener("error",function(Q){console.error(Q)},!1),$.open("POST","".concat(H.a,"/api/attachments.json")),$.send(ue)}var pe=ee("giR+"),ge=ee("fyUT"),ce=ee("7Kak"),he=ee("9yH6"),J=he.a.Group,oe={margin:"0 8px"},q=function(se){var le=se.callback,ue=se.onCancel;function $(Q){le(Q)}return D.a.createElement(y.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$},D.a.createElement("div",{className:"flex-container"},D.a.createElement("span",{style:oe},"\u5355\u5143\u683C\u6570\uFF1A"),D.a.createElement("span",{style:oe},"\u884C\u6570"),D.a.createElement(y.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},D.a.createElement(ge.a,null)),D.a.createElement("span",{style:oe},"\u5217\u6570"),D.a.createElement(y.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},D.a.createElement(ge.a,null))),D.a.createElement("div",{className:"flex-container",style:{marginTop:12}},D.a.createElement("span",{style:oe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),D.a.createElement(y.a.Item,{name:"align"},D.a.createElement(J,null,D.a.createElement(he.a,{value:"default"},D.a.createElement("i",{className:"fa fa-align-justify"})),D.a.createElement(he.a,{value:"left"},D.a.createElement("i",{className:"fa fa-align-left"})),D.a.createElement(he.a,{value:"center"},D.a.createElement("i",{className:"fa fa-align-center"})),D.a.createElement(he.a,{value:"right"},D.a.createElement("i",{className:"fa fa-align-right"}))))),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(v.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},ye=ee("m3rI"),Se="link",me="upload-image",we="code-block",_e="add-table",Oe="------------",Me={default:Oe,left:":".concat(Oe),center:":".concat(Oe,":"),right:"".concat(Oe,":")},De=ee("9VGf"),Le,We;function Ve(){}var Xe=0,Be=1e4,Qe="\u2581",Ke=`
|
|
**\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 $e(se){return/^\d+$/.test(se)?"".concat(se,"px"):se}var Ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,qe=Ae?"Cmd":"Ctrl",Je=(Le={},Object(B.a)(Le,qe+"-B","bold"),Object(B.a)(Le,qe+"-I","italic"),Le),Re=(We={},Object(B.a)(We,Se,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(We,we,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(We,me,"\u6DFB\u52A0\u56FE\u7247"),Object(B.a)(We,_e,"\u6DFB\u52A0\u8868\u683C"),We),Fe=He.a=function(se){var le=se.defaultValue,ue=le===void 0?"":le,$=se.onChange,Q=se.width,te=Q===void 0?"100%":Q,ie=se.height,Ee=ie===void 0?400:ie,Ce=se.miniToolbar,Ie=Ce===void 0?!1:Ce,tt=se.isFocus,dt=tt===void 0?!1:tt,it=se.watch,Lt=se.insertTemp,mt=se.mode,st=mt===void 0?"markdown":mt,It=se.id,yt=It===void 0?"markdown-editor-id":It,Yt=se.showResizeBar,Wt=Yt===void 0?!1:Yt,pt=se.noStorage,Tr=pt===void 0?!1:pt,zr=se.showNullButton,lr=zr===void 0?!1:zr,Sr=se.hidetoolBar,hr=Sr===void 0?!1:Sr,yi=se.fullScreen,ur=yi===void 0?!1:yi,Vr=se.onBlur,cn=se.onCMBeforeChange,Ct=se.onFullScreen,et=se.className,wr=et===void 0?"":et,fn=se.disablePaste,dr=fn===void 0?!1:fn,gt=se.placeholder,Cr=gt===void 0?"":gt,Rr=se.values,Xr=Rr===void 0?"":Rr,Ue=Object(I.useState)(null),ut=Object(R.a)(Ue,2),je=ut[0],Fn=ut[1],hn=Object(I.useState)(ue),Yr=Object(R.a)(hn,2),$r=Yr[0],lt=Yr[1],Qi=Object(I.useState)(it),Nn=Object(R.a)(Qi,2),cr=Nn[0],ar=Nn[1],bi=Object(I.useState)(ur),Bn=Object(R.a)(bi,2),rr=Bn[0],mn=Bn[1],Ei=Object(I.useState)(""),pn=Object(R.a)(Ei,2),_r=pn[0],Ar=pn[1],xi=Object(I.useState)(0),jn=Object(R.a)(xi,2),Jr=jn[0],Wn=jn[1],Ti=Object(I.useState)(Ee),fr=Object(R.a)(Ti,2),Si=fr[0],wi=fr[1],gn=Object(I.useState)(!1),Pr=Object(R.a)(gn,2),Fa=Pr[0],Hn=Pr[1],Qr=Object(I.useRef)(),Kn=Object(I.useRef)(),Mr=Object(I.useRef)(),Zr=Object(I.useRef)();Object(I.useEffect)(function(){lt(Xr),je==null||je.setValue(Xr)},[Xr]),Object(I.useEffect)(function(){Ct==null||Ct(rr)},[rr]),Object(I.useEffect)(function(){if(Qr.current){var rt=E.a.fromTextArea(Qr.current,{mode:st,lineNumbers:!Ie,lineWrapping:!0,value:ue,autoCloseTags:!0,autoCloseBrackets:!0});dt&&rt.focus();function ct(ft,Et){if(dr){Et.preventDefault();return}var xt=Et.clipboardData;if(xt){var St=xt.types.toString(),Rt=xt.items,_t=["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"];if(St==="Files"||xt.types.indexOf("Files")>-1){if(Et.preventDefault(),st=="stex")return;try{var Gt,mr=Rt[1];((Gt=Rt[0])===null||Gt===void 0?void 0:Gt.kind)==="file"&&(mr=Rt[0]);var wt=mr.getAsFile(),kr=wt.name.split(".").pop();Te(wt,function(zt){if(zt.id){var Ir,Ur,yn;(wt==null||((Ir=wt.type)===null||Ir===void 0)?void 0:Ir.indexOf("image"))>-1?rt.replaceSelection(".concat(zt.content_type,")")):(wt==null||((Ur=wt.type)===null||Ur===void 0)?void 0:Ur.indexOf("video"))>-1?rt.replaceSelection('<video width="100%" controls src="'.concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(wt==null||((yn=wt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?rt.replaceSelection('<a href="'.concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(wt.type,'&disposition=inline" target="_blank">').concat(wt.name,"</a>")):_t.includes(kr)?rt.replaceSelection('<a href="'.concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(wt.name,"</a>")):rt.replaceSelection("[".concat(wt.name,"](").concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return rt.on("paste",ct),Fn(rt),function(){rt.off("paste",ct)}}},[]);var Ci=Object(I.useCallback)(function(){if(Kn.current)try{}catch(rt){console.log(rt,"---- to set md editor body height")}},[Si,Kn,rr]);Object(I.useEffect)(function(){function rt(){var ft=new _.default(function(Et){var xt=Object(A.a)(Et),St;try{for(xt.s();!(St=xt.n()).done;){var Rt=St.value;(Rt.target.offsetHeight>0||Rt.target.offsetWidth>0)&&(Ci(),je.setSize("100%","100%"),je.refresh())}}catch(_t){xt.e(_t)}finally{xt.f()}});return ft.observe(Qr.current.parentElement),ft}if(je){var ct=rt();return function(){ct.unobserve(Qr.current.parentElement)}}},[je,Ci]),Object(I.useEffect)(function(){if(je){for(var rt=[],ct=function(){var Rt=Et[ft];xt=Object(R.a)(Rt,2);var _t=xt[0],Gt=xt[1],mr=Object(B.a)({},_t,function(){Gn(Gt)});rt.push(mr),je.addKeyMap(mr)},ft=0,Et=Object.entries(Je);ft<Et.length;ft++){var xt;ct()}return function(){var St=Object(A.a)(rt),Rt;try{for(St.s();!(Rt=St.n()).done;){var _t=Rt.value;je.removeKeyMap(_t)}}catch(Gt){St.e(Gt)}finally{St.f()}}}},[je]),Object(I.useEffect)(function(){ur!==rr&&mn(ur)},[ur]),Object(De.a)(function(){if(!Tr&&Jr>0){var rt=new Date().getTime(),ct=window.sessionStorage.getItem(yt);rt>=Jr+Be&&(!ct||ct!==$r)&&(window.sessionStorage.setItem(yt,$r),Hn(!0))}},Be),Object(I.useEffect)(function(){ar(it)},[je,it]),Object(I.useEffect)(function(){je&&(dt&&je.focus())},[je,dt]),Object(I.useEffect)(function(){if(cr&&je){var rt=je.getScrollerElement();function ct(ft){var Et=ft.target;if(Zr.current){var xt=Et.scrollTop/Et.scrollHeight;Zr.current.scrollTop=Zr.current.scrollHeight*xt}}return rt.addEventListener("scroll",ct),function(){rt.removeEventListener("scroll",ct)}}},[je,cr]),Object(I.useEffect)(function(){if(je&&cn){function rt(ct,ft){cn(ct,ft)}return je.on("beforeChange",rt),function(){je.off("beforeChange",rt)}}},[je,cn]),Object(I.useEffect)(function(){if(je&&Vr){function rt(){Vr(je.getValue())}return je.on("blur",rt),function(){je.off("blur",rt)}}},[je,Vr]),Object(I.useEffect)(function(){if(je){function rt(ct){var ft=ct.getValue();lt(ft),Wn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$&&$(ft)}return je.on("change",rt),function(){je.off("change",rt)}}},[je,$]),Object(I.useEffect)(function(){je&&(ue==null?(je.setValue(""),lt("")):ue!==je.getValue()&&(je.setValue(ue),lt(ue),je.setCursor(je.lineCount(),0)))},[je,ue]);var Gn=Object(I.useCallback)(function(rt){var ct=je.getCursor(),ft=je.getSelection(),Et=ft.split(`
|
|
`);switch(rt){case"bold":return je.replaceSelection("**"+ft+"**"),ft===""&&je.setCursor(ct.line,ct.ch+2),je.focus();case"italic":return je.replaceSelection("*"+ft+"*"),ft===""&&je.setCursor(ct.line,ct.ch+1),je.focus();case"code":return je.replaceSelection("`"+ft+"`"),ft===""&&je.setCursor(ct.line,ct.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+ft+"$$`"),ft===""&&je.setCursor(ct.line,ct.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+ft+"\n```"),je.setCursor(ct.line+1,ft.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
|
|
`),je.focus();case"list-ul":return ft===""?je.replaceSelection("- "+ft):je.replaceSelection(Et.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),je.focus();case"list-ol":return ft===""?je.replaceSelection("1. "+ft):je.replaceSelection(Et.map(function(xt,St){return xt===""?"":"".concat(St+1,". ").concat(xt)}).join(`
|
|
`)),je.focus();case"add-null-ch":return ft===""&&je.setCursor(ct.line,ct.ch+1),je.replaceSelection(Qe),je.focus();case"inster-template-1":return ft===""&&je.setCursor(ct.line,ct.ch),je.replaceSelection(Ke),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return ar(!cr),je.focus();case"trigger-full-screen":return mn(!rr),je.focus();case Se:Ar(Se);return;case we:Ar(we);return;case me:Ar(me);return;case _e:Ar(_e);return;default:throw new Error}},[je,cr,rr]),qr=Object(I.useCallback)(function(rt){Ar("");switch(_r){case Se:var ct=rt.title,ft=rt.link;return je.replaceSelection("[".concat(ct,"](").concat(ft,")")),je.focus();case we:var Et=rt.language,xt=rt.content;return je.replaceSelection(["```"+Et,xt,"```"].join(`
|
|
`)),je.focus();case me:var St=rt.src,Rt=rt.alt;return je.replaceSelection(".concat(St,' "').concat(Rt,'" )')),je.focus();case _e:for(var _t=rt.row,Gt=rt.col,mr=rt.align,wt=`
|
|
`,kr=0;kr<_t;kr++){for(var zt=[],Ir=[],Ur=0;Ur<Gt;Ur++)kr===1&&Ir.push(Me[mr]),zt.push(" ");kr===1&&(wt+="| ".concat(Ir.join(" | "),` |
|
|
`)),wt+="| ".concat(zt.join(Gt===1?"":" | "),` |
|
|
`)}return je.replaceSelection(wt+`
|
|
`),je.focus();default:throw new Error}},[je,_r]),vn=Object(I.useMemo)(function(){switch(_r){case Se:return D.a.createElement(W,{callback:qr,onCancel:yr});case we:return D.a.createElement(O.b,{callback:qr,onCancel:yr});case me:return D.a.createElement(be,{callback:qr,onCancel:yr});case _e:return D.a.createElement(q,{callback:qr,onCancel:yr});default:return null}},[_r]);function yr(){Ar("")}Object(I.useEffect)(function(){if(Mr.current){var rt=Mr.current,ct=!1,ft=0;function Et(Rt){ct=!0,ft=Rt.pageY}function xt(){ct=!1}function St(Rt){if(ct){var _t=Rt.pageY-ft;_t<0&&(_t=0),_t>300&&(_t=300);var Gt=Ee+_t+"px";wi(Gt)}}return rt.addEventListener("mousedown",Et),document.addEventListener("mousemove",St),document.addEventListener("mouseup",xt),function(){rt.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",xt)}}},[je,Mr]),Object(I.useEffect)(function(){wi(Ee)},[Ee]);var zn=$e(te),_i=$e(Si),Ai={width:zn,height:_i},Vn=Object(I.useMemo)(function(){if(Jr){var rt=new Date(Jr),ct=rt.getHours(),ft=rt.getMinutes(),Et=rt.getSeconds();return ct=ct<10?"0"+ct:ct,ft=ft<10?"0"+ft:ft,Et=Et<10?"0"+Et:Et,"".concat(ct,":").concat(ft,":").concat(Et)}return 0},[Jr]);function Na(){window.sessionStorage.removeItem(yt),Hn(!1),Wn(0)}function Zi(){Hn(!1),Wn(0),je.setValue(window.sessionStorage.getItem(yt))}return D.a.createElement(I.Fragment,null,D.a.createElement("div",{className:"markdown-editor-wrapper",ref:Kn},D.a.createElement("div",{className:"markdown-editor-container ".concat(wr," ").concat(cr?"on-preview":""," ").concat(Ie?"mini":""," ").concat(rr?"full-screen":""),style:Ai},D.a.createElement(c,{insertTemp:Lt,watch:cr,fullScreen:rr,showNullButton:lr,onActionCallback:Gn,hidetoolBar:hr}),D.a.createElement("div",{className:"markdown-editor-body"},D.a.createElement("div",{className:"codemirror-container"},D.a.createElement("textarea",{ref:Qr,placeholder:Cr})),cr?D.a.createElement("div",{ref:Zr,className:"preview-container"},st==="stex"&&D.a.createElement(S,{value:$r}),st!=="stex"&&D.a.createElement(u.a,{value:$r})):null))),Wt?D.a.createElement("a",{ref:Mr,className:"editor-resize"}):null,D.a.createElement(l.a,null,Re[_r]?D.a.createElement(V.a,{centered:!0,title:Re[_r],visible:!0,onCancel:yr,footer:null},vn):null))}},SJMd:function(ot,He){/**
|
|
* @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 ee,ne,V,A=!1,G,U;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var I=window,D=["break,continue,do,else,for,if,return,while"],L=[D,"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"],E=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],_=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],M=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[E,"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"],T="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=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[D,"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=[D,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[_,C,M,b,d,o,s,u],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",w="kwd",p="com",h="typ",c="lit",l="pun",a="pln",v="tag",g="dec",y="src",k="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(me){for(var we=0,_e=!1,Oe=!1,Me=0,De=me.length;Me<De;++Me){var Le=me[Me];if(Le.ignoreCase)Oe=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){_e=!0,Oe=!1;break}}var We={b:8,t:9,n:10,v:11,f:12,r:13};function Ve($e){var Ae=$e.charCodeAt(0);if(Ae!==92)return Ae;var qe=$e.charAt(1);return Ae=We[qe],Ae||("0"<=qe&&qe<="7"?parseInt($e.substring(1),8):qe==="u"||qe==="x"?parseInt($e.substring(2),16):$e.charCodeAt(1))}function Xe($e){if($e<32)return($e<16?"\\x0":"\\x")+$e.toString(16);var Ae=String.fromCharCode($e);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function Be($e){var Ae=$e.substring(1,$e.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")),qe=[],Je=Ae[0]==="^",Re=["["];Je&&Re.push("^");for(var Fe=Je?1:0,se=Ae.length;Fe<se;++Fe){var le=Ae[Fe];if(/\\[bdsw]/i.test(le))Re.push(le);else{var ue=Ve(le),$;Fe+2<se&&Ae[Fe+1]==="-"?($=Ve(Ae[Fe+2]),Fe+=2):$=ue,qe.push([ue,$]),$<65||ue>122||($<65||ue>90||qe.push([Math.max(65,ue)|32,Math.min($,90)|32]),$<97||ue>122||qe.push([Math.max(97,ue)&~32,Math.min($,122)&~32]))}}qe.sort(function(Ee,Ce){return Ee[0]-Ce[0]||Ce[1]-Ee[1]});for(var Q=[],te=[],Fe=0;Fe<qe.length;++Fe){var ie=qe[Fe];ie[0]<=te[1]+1?te[1]=Math.max(te[1],ie[1]):Q.push(te=ie)}for(var Fe=0;Fe<Q.length;++Fe){var ie=Q[Fe];Re.push(Xe(ie[0])),ie[1]>ie[0]&&(ie[1]+1>ie[0]&&Re.push("-"),Re.push(Xe(ie[1])))}return Re.push("]"),Re.join("")}function Qe($e){for(var Ae=$e.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")),qe=Ae.length,Je=[],Re=0,Fe=0;Re<qe;++Re){var se=Ae[Re];if(se==="(")++Fe;else if(se.charAt(0)==="\\"){var le=+se.substring(1);le&&(le<=Fe?Je[le]=-1:Ae[Re]=Xe(le))}}for(var Re=1;Re<Je.length;++Re)Je[Re]===-1&&(Je[Re]=++we);for(var Re=0,Fe=0;Re<qe;++Re){var se=Ae[Re];if(se==="(")++Fe,Je[Fe]||(Ae[Re]="(?:");else if(se.charAt(0)==="\\"){var le=+se.substring(1);le&&le<=Fe&&(Ae[Re]="\\"+Je[le])}}for(var Re=0;Re<qe;++Re)Ae[Re]==="^"&&Ae[Re+1]!=="^"&&(Ae[Re]="");if($e.ignoreCase&&_e)for(var Re=0;Re<qe;++Re){var se=Ae[Re],ue=se.charAt(0);se.length>=2&&ue==="["?Ae[Re]=Be(se):ue!=="\\"&&(Ae[Re]=se.replace(/[a-zA-Z]/g,function(te){var ie=te.charCodeAt(0);return"["+String.fromCharCode(ie&~32,ie|32)+"]"}))}return Ae.join("")}for(var Ke=[],Me=0,De=me.length;Me<De;++Me){var Le=me[Me];if(Le.global||Le.multiline)throw new Error(""+Le);Ke.push("(?:"+Qe(Le)+")")}return new RegExp(Ke.join("|"),Oe?"gi":"g")}function P(me,we){var _e=/(?:^|\s)nocode(?:\s|$)/,Oe=[],Me=0,De=[],Le=0;function We(Ve){var Xe=Ve.nodeType;if(Xe==1){if(_e.test(Ve.className))return;for(var Be=Ve.firstChild;Be;Be=Be.nextSibling)We(Be);var Qe=Ve.nodeName.toLowerCase();(Qe==="br"||Qe==="li")&&(Oe[Le]=`
|
|
`,De[Le<<1]=Me++,De[Le++<<1|1]=Ve)}else if(Xe==3||Xe==4){var Ke=Ve.nodeValue;Ke.length&&(we?Ke=Ke.replace(/\r\n?/g,`
|
|
`):Ke=Ke.replace(/[ \t\r\n]+/g," "),Oe[Le]=Ke,De[Le<<1]=Me,Me+=Ke.length,De[Le++<<1|1]=Ve)}}return We(me),{sourceCode:Oe.join("").replace(/\n$/,""),spans:De}}function H(me,we,_e,Oe,Me){if(!_e)return;var De={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:_e,spans:null,basePos:we,decorations:null};Oe(De),Me.push.apply(Me,De.decorations)}var X=/\S/;function Z(me){for(var we=void 0,_e=me.firstChild;_e;_e=_e.nextSibling){var Oe=_e.nodeType;we=Oe===1?we?me:_e:Oe===3&&X.test(_e.nodeValue)?me:we}return we===me?void 0:we}function re(me,we){var _e={},Oe;(function(){for(var Le=me.concat(we),We=[],Ve={},Xe=0,Be=Le.length;Xe<Be;++Xe){var Qe=Le[Xe],Ke=Qe[3];if(Ke)for(var $e=Ke.length;--$e>=0;)_e[Ke.charAt($e)]=Qe;var Ae=Qe[1],qe=""+Ae;Ve.hasOwnProperty(qe)||(We.push(Ae),Ve[qe]=null)}We.push(/[\0-\uffff]/),Oe=O(We)})();var Me=we.length,De=function(Le){for(var We=Le.sourceCode,Ve=Le.basePos,Xe=Le.sourceNode,Be=[Ve,a],Qe=0,Ke=We.match(Oe)||[],$e={},Ae=0,qe=Ke.length;Ae<qe;++Ae){var Je=Ke[Ae],Re=$e[Je],Fe=void 0,se;if(typeof Re=="string")se=!1;else{var le=_e[Je.charAt(0)];if(le)Fe=Je.match(le[1]),Re=le[0];else{for(var ue=0;ue<Me;++ue)if(le=we[ue],Fe=Je.match(le[1]),Fe){Re=le[0];break}Fe||(Re=a)}se=Re.length>=5&&Re.substring(0,5)==="lang-",se&&!(Fe&&typeof Fe[1]=="string")&&(se=!1,Re=y),se||($e[Je]=Re)}var $=Qe;if(Qe+=Je.length,!se)Be.push(Ve+$,Re);else{var Q=Fe[1],te=Je.indexOf(Q),ie=te+Q.length;Fe[2]&&(ie=Je.length-Fe[2].length,te=ie-Q.length);var Ee=Re.substring(5);H(Xe,Ve+$,Je.substring(0,te),De,Be),H(Xe,Ve+$+te,Q,he(Ee,Q),Be),H(Xe,Ve+$+ie,Je.substring(ie),De,Be)}}Le.decorations=Be};return De}function be(me){var we=[],_e=[];me.tripleQuotedStrings?we.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?we.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&_e.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=me.hashComments;Oe&&(me.cStyleComments?(Oe>1?we.push([p,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([p,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),_e.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([p,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(_e.push([p,/^\/\/[^\r\n]*/,null]),_e.push([p,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Me=me.regexLiterals;if(Me){var De=Me>1?"":`
|
|
\r`,Le=De?".":"[\\S\\s]",We="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";_e.push(["lang-regex",RegExp("^"+W+"("+We+")")])}var Ve=me.types;Ve&&_e.push([h,Ve]);var Xe=(""+me.keywords).replace(/^ | $/g,"");Xe.length&&_e.push([w,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(Be+="(?!s*/)"),_e.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Be),null]),re(we,_e)}var fe=be({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(me,we,_e){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,Me=/\r\n?|\n/,De=me.ownerDocument,Le=De.createElement("li");me.firstChild;)Le.appendChild(me.firstChild);var We=[Le];function Ve(Ae){var qe=Ae.nodeType;if(qe==1&&!Oe.test(Ae.className))if(Ae.nodeName==="br")Xe(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Je=Ae.firstChild;Je;Je=Je.nextSibling)Ve(Je);else if((qe==3||qe==4)&&_e){var Re=Ae.nodeValue,Fe=Re.match(Me);if(Fe){var se=Re.substring(0,Fe.index);Ae.nodeValue=se;var le=Re.substring(Fe.index+Fe[0].length);if(le){var ue=Ae.parentNode;ue.insertBefore(De.createTextNode(le),Ae.nextSibling)}Xe(Ae),se||Ae.parentNode.removeChild(Ae)}}}function Xe(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function qe(Fe,se){var le=se?Fe.cloneNode(!1):Fe,ue=Fe.parentNode;if(ue){var $=qe(ue,1),Q=Fe.nextSibling;$.appendChild(le);for(var te=Q;te;te=Q)Q=te.nextSibling,$.appendChild(te)}return le}for(var Je=qe(Ae.nextSibling,0),Re;(Re=Je.parentNode)&&Re.nodeType===1;)Je=Re;We.push(Je)}for(var Be=0;Be<We.length;++Be)Ve(We[Be]);we===(we|0)&&We[0].setAttribute("value",we);var Qe=De.createElement("ol");Qe.className="linenums";for(var Ke=Math.max(0,we-1|0)||0,Be=0,$e=We.length;Be<$e;++Be)Le=We[Be],Le.className="L"+(Be+Ke)%10,Le.firstChild||Le.appendChild(De.createTextNode("\xA0")),Qe.appendChild(Le);me.appendChild(Qe)}function pe(me){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var _e=/\n/g,Oe=me.sourceCode,Me=Oe.length,De=0,Le=me.spans,We=Le.length,Ve=0,Xe=me.decorations,Be=Xe.length,Qe=0;Xe[Be]=Me;var Ke,$e;for($e=Ke=0;$e<Be;)Xe[$e]!==Xe[$e+2]?(Xe[Ke++]=Xe[$e++],Xe[Ke++]=Xe[$e++]):$e+=2;for(Be=Ke,$e=Ke=0;$e<Be;){for(var Ae=Xe[$e],qe=Xe[$e+1],Je=$e+2;Je+2<=Be&&Xe[Je+1]===qe;)Je+=2;Xe[Ke++]=Ae,Xe[Ke++]=qe,$e=Je}Be=Xe.length=Ke;var Re=me.sourceNode,Fe="";Re&&(Fe=Re.style.display,Re.style.display="none");try{for(var se=null;Ve<We;){var le=Le[Ve],ue=Le[Ve+2]||Me,$=Xe[Qe+2]||Me,Je=Math.min(ue,$),Q=Le[Ve+1],te;if(Q.nodeType!==1&&(te=Oe.substring(De,Je))){we&&(te=te.replace(_e,"\r")),Q.nodeValue=te;var ie=Q.ownerDocument,Ee=ie.createElement("span");Ee.className=Xe[Qe+1];var Ce=Q.parentNode;Ce.replaceChild(Ee,Q),Ee.appendChild(Q),De<ue&&(Le[Ve+1]=Q=ie.createTextNode(Oe.substring(Je,ue)),Ce.insertBefore(Q,Ee.nextSibling))}De=Je,De>=ue&&(Ve+=2),De>=$&&(Qe+=2)}}finally{Re&&(Re.style.display=Fe)}}var ge={};function ce(me,we){for(var _e=we.length;--_e>=0;){var Oe=we[_e];ge.hasOwnProperty(Oe)?I.console&&console.warn("cannot override language handler %s",Oe):ge[Oe]=me}}function he(me,we){return me&&ge.hasOwnProperty(me)||(me=/^\s*</.test(we)?"default-markup":"default-code"),ge[me]}ce(fe,["default-code"]),ce(re([],[[a,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[p,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["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"]),ce(re([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["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"]),ce(re([],[[F,/^[\s\S]+/]]),["uq.val"]),ce(be({keywords:_,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),ce(be({keywords:"null,true,false"}),["json"]),ce(be({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),ce(be({keywords:M,cStyleComments:!0}),["java"]),ce(be({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(be({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(be({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(be({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(be({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(be({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(re([],[[m,/^[\s\S]+/]]),["regex"]);function J(me){var we=me.langExtension;try{var _e=P(me.sourceNode,me.pre),Oe=_e.sourceCode;me.sourceCode=Oe,me.spans=_e.spans,me.basePos=0,he(we,Oe)(me),pe(me)}catch(Me){I.console&&console.log(Me&&Me.stack||Me)}}function oe(me,we,_e){var Oe=_e||!1,Me=we||null,De=document.createElement("div");De.innerHTML="<pre>"+me+"</pre>",De=De.firstChild,Oe&&Te(De,Oe,!0);var Le={langExtension:Me,numberLines:Oe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Le),De.innerHTML}function q(me,we){var _e=we||document.body,Oe=_e.ownerDocument||document;function Me(le){return _e.getElementsByTagName(le)}for(var De=[Me("pre"),Me("code"),Me("xmp")],Le=[],We=0;We<De.length;++We)for(var Ve=0,Xe=De[We].length;Ve<Xe;++Ve)Le.push(De[We][Ve]);De=null;var Be=Date;Be.now||(Be={now:function(){return+new Date}});var Qe=0,Ke=/\blang(?:uage)?-([\w.]+)(?!\S)/,$e=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,qe=/pre|xmp/i,Je=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Fe={};function se(){for(var le=I.PR_SHOULD_USE_CONTINUATION?Be.now()+250:Infinity;Qe<Le.length&&Be.now()<le;Qe++){for(var ue=Le[Qe],$=Fe,Q=ue;Q=Q.previousSibling;){var te=Q.nodeType,ie=(te===7||te===8)&&Q.nodeValue;if(ie?!/^\??prettify\b/.test(ie):te!==3||/\S/.test(Q.nodeValue))break;if(ie){$={},ie.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,pt,Tr){$[pt]=Tr});break}}var Ee=ue.className;if(($!==Fe||$e.test(Ee))&&!Ae.test(Ee)){for(var Ce=!1,Ie=ue.parentNode;Ie;Ie=Ie.parentNode){var tt=Ie.tagName;if(Re.test(tt)&&Ie.className&&$e.test(Ie.className)){Ce=!0;break}}if(!Ce){ue.className+=" prettyprinted";var dt=$.lang;if(!dt){dt=Ee.match(Ke);var it;!dt&&(it=Z(ue))&&Je.test(it.tagName)&&(dt=it.className.match(Ke)),dt&&(dt=dt[1])}var Lt;if(qe.test(ue.tagName))Lt=1;else{var mt=ue.currentStyle,st=Oe.defaultView,It=mt?mt.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Lt=It&&It.substring(0,3)==="pre"}var yt=$.linenums;(yt=yt==="true"||+yt)||(yt=Ee.match(/\blinenums\b(?::(\d+))?/),yt=yt?yt[1]&&yt[1].length?+yt[1]:!0:!1),yt&&Te(ue,yt,Lt);var Yt={langExtension:dt,sourceNode:ue,numberLines:yt,pre:Lt,sourceCode:null,basePos:null,spans:null,decorations:null};J(Yt)}}}Qe<Le.length?I.setTimeout(se,250):typeof me=="function"&&me()}se()}var ye=I.PR={createSimpleLexer:re,registerLangHandler:ce,sourceDecorator:be,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:F,PR_COMMENT:p,PR_DECLARATION:g,PR_KEYWORD:w,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:y,PR_STRING:m,PR_TAG:v,PR_TYPE:h,prettyPrintOne:A?I.prettyPrintOne=oe:R=oe,prettyPrint:B=A?I.prettyPrint=q:B=q},Se=I.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return ye})})()},"VrN/":function(ot,He,ee){(function(ne,V){ot.exports=V()})(this,function(){"use strict";var ne=navigator.userAgent,V=navigator.platform,A=/gecko\/\d/i.test(ne),G=/MSIE \d/.test(ne),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),R=/Edge\/(\d+)/.exec(ne),B=G||U||R,I=B&&(G?document.documentMode||6:+(R||U)[1]),D=!R&&/WebKit\//.test(ne),L=D&&/Qt\/\d+\.\d+/.test(ne),E=!R&&/Chrome\//.test(ne),_=/Opera\//.test(ne),M=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),T=/PhantomJS/.test(ne),b=!R&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),d=/Android/.test(ne),o=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=b||/Mac/.test(V),u=/\bCrOS\b/.test(ne),S=/win/i.test(V),f=_&&ne.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(_=!1,D=!0);var m=s&&(L||_&&(f==null||f<12.11)),w=A||B&&I>=9;function p(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=p(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var x=0;x<t.length;++x)i.appendChild(t[x]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var g;document.createRange?g=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:g=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function y(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 k(){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;p(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!p(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};b?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(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 H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var x=r||0,N=i||0;;){var K=e.indexOf(" ",x);if(K<0||K>=t)return N+(t-x);N+=K-x,N+=n-N%n,x=K+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.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 Z(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var re=50,be={toString:function(){return"CodeMirror.Pass"}},fe={scroll:!1},Te={origin:"*mouse"},pe={origin:"+move"};function ge(e,t,n){for(var r=0,i=0;;){var x=e.indexOf(" ",r);x==-1&&(x=e.length);var N=x-r;if(x==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=x-r,i+=n-i%n,r=x+1,i>=t)return r}}var ce=[""];function he(e){for(;ce.length<=e;)ce.push(J(ce)+" ");return ce[e]}function J(e){return e[e.length-1]}function oe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function q(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ye(){}function Se(e,t){var n;return Object.create?n=Object.create(e):(ye.prototype=e,n=new ye),t&&P(t,n),n}var me=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||me.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Me=/[\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 De(e){return e.charCodeAt(0)>=768&&Me.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function We(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,x=r<0?Math.ceil(i):Math.floor(i);if(x==t)return e(x)?t:n;e(x)?n=x:t=x+r}}function Ve(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,x=0;x<e.length;++x){var N=e[x];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",x),i=!0)}i||r(t,n,"ltr")}var Xe=null;function Be(e,t,n){var r;Xe=null;for(var i=0;i<e.length;++i){var x=e[i];if(x.from<t&&x.to>t)return i;x.to==t&&(x.from!=x.to&&n=="before"?r=i:Xe=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:Xe=i)}return r!=null?r:Xe}var Qe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(Y){return Y<=247?e.charAt(Y):1424<=Y&&Y<=1524?"R":1536<=Y&&Y<=1785?t.charAt(Y-1536):1774<=Y&&Y<=2220?"r":8192<=Y&&Y<=8203?"w":Y==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,x=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function z(Y,ae,de){this.level=Y,this.from=ae,this.to=de}return function(Y,ae){var de=ae=="ltr"?"L":"R";if(Y.length==0||ae=="ltr"&&!r.test(Y))return!1;for(var xe=Y.length,ve=[],Pe=0;Pe<xe;++Pe)ve.push(n(Y.charCodeAt(Pe)));for(var ke=0,Ne=de;ke<xe;++ke){var Ge=ve[ke];Ge=="m"?ve[ke]=Ne:Ne=Ge}for(var Ye=0,ze=de;Ye<xe;++Ye){var Ze=ve[Ye];Ze=="1"&&ze=="r"?ve[Ye]="n":x.test(Ze)&&(ze=Ze,Ze=="r"&&(ve[Ye]="R"))}for(var at=1,nt=ve[0];at<xe-1;++at){var ht=ve[at];ht=="+"&&nt=="1"&&ve[at+1]=="1"?ve[at]="1":ht==","&&nt==ve[at+1]&&(nt=="1"||nt=="n")&&(ve[at]=nt),nt=ht}for(var Tt=0;Tt<xe;++Tt){var Bt=ve[Tt];if(Bt==",")ve[Tt]="N";else if(Bt=="%"){var Dt=void 0;for(Dt=Tt+1;Dt<xe&&ve[Dt]=="%";++Dt);for(var ir=Tt&&ve[Tt-1]=="!"||Dt<xe&&ve[Dt]=="1"?"1":"N",qt=Tt;qt<Dt;++qt)ve[qt]=ir;Tt=Dt-1}}for(var Mt=0,er=de;Mt<xe;++Mt){var Kt=ve[Mt];er=="L"&&Kt=="1"?ve[Mt]="L":x.test(Kt)&&(er=Kt)}for(var Ut=0;Ut<xe;++Ut)if(i.test(ve[Ut])){var kt=void 0;for(kt=Ut+1;kt<xe&&i.test(ve[kt]);++kt);for(var Ot=(Ut?ve[Ut-1]:de)=="L",tr=(kt<xe?ve[kt]:de)=="L",In=Ot==tr?Ot?"L":"R":de,Gr=Ut;Gr<kt;++Gr)ve[Gr]=In;Ut=kt-1}for(var Xt=[],xr,jt=0;jt<xe;)if(N.test(ve[jt])){var Ia=jt;for(++jt;jt<xe&&N.test(ve[jt]);++jt);Xt.push(new z(0,Ia,jt))}else{var Or=jt,un=Xt.length,dn=ae=="rtl"?1:0;for(++jt;jt<xe&&ve[jt]!="L";++jt);for(var Jt=Or;Jt<jt;)if(K.test(ve[Jt])){Or<Jt&&(Xt.splice(un,0,new z(1,Or,Jt)),un+=dn);var Un=Jt;for(++Jt;Jt<jt&&K.test(ve[Jt]);++Jt);Xt.splice(un,0,new z(2,Un,Jt)),un+=dn,Or=Jt}else++Jt;Or<jt&&Xt.splice(un,0,new z(1,Or,jt))}return ae=="ltr"&&(Xt[0].level==1&&(xr=Y.match(/^\s+/))&&(Xt[0].from=xr[0].length,Xt.unshift(new z(0,0,xr[0].length))),J(Xt).level==1&&(xr=Y.match(/\s+$/))&&(J(Xt).to-=xr[0].length,Xt.push(new z(0,xe-xr[0].length,xe)))),ae=="rtl"?Xt.reverse():Xt}}();function Ke(e,t){var n=e.order;return n==null&&(n=e.order=Qe(e.text,t)),n}var $e=[],Ae=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]||$e).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||$e}function Je(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,i=r&&r[t];if(i){var x=Z(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function Re(e,t){var n=qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function se(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)Z(n,t[r])==-1&&n.push(t[r])}function le(e,t){return qe(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ie(e){$(e),Q(e)}function Ee(e){return e.target||e.srcElement}function Ce(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 Ie=function(){if(B&&I<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function dt(e){if(tt==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&I<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var it;function Lt(e){if(it!=null)return it;var t=l(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:it=r.right-n.right<3}var mt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var x=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=x.indexOf("\r");N!=-1?(n.push(x.slice(0,N)),t+=N+1):(n.push(x),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=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},It=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),yt=null;function Yt(e){if(yt!=null)return yt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return yt=Math.abs(n.left-r.left)>1}var Wt={},pt={};function Tr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function zr(e,t){pt[e]=t}function lr(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=Se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Sr(e,t){t=lr(t);var n=Wt[t.name];if(!n)return Sr(e,"text/plain");var r=n(e,t);if(hr.hasOwnProperty(t.name)){var i=hr[t.name];for(var x in i){if(!i.hasOwnProperty(x))continue;r.hasOwnProperty(x)&&(r["_"+x]=r[x]),r[x]=i[x]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var hr={};function yi(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};P(t,n)}function ur(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Vr(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 cn(e,t,n){return e.startState?e.startState(t,n):!0}var Ct=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};Ct.prototype.eol=function(){return this.pos>=this.string.length},Ct.prototype.sol=function(){return this.pos==this.lineStart},Ct.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ct.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ct.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},Ct.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ct.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ct.prototype.skipToEnd=function(){this.pos=this.string.length},Ct.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ct.prototype.backUp=function(e){this.pos-=e},Ct.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},Ct.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ct.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ct.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ct.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function et(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 i=n.children[r],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function wr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(x){var N=x.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function fn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function dr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function gt(e){if(e.parent==null)return null;for(var t=e.parent,n=Z(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Cr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],x=i.height;if(t<x){e=i;continue e}t-=x,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],z=K.height;if(t<z)break;t-=z}return n+N}function Rr(e,t){return t>=e.first&&t<e.first+e.size}function Xr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ue(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ue))return new Ue(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ut(e,t){return e.line-t.line||e.ch-t.ch}function je(e,t){return e.sticky==t.sticky&&ut(e,t)==0}function Fn(e){return Ue(e.line,e.ch)}function hn(e,t){return ut(e,t)<0?t:e}function Yr(e,t){return ut(e,t)<0?e:t}function $r(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return Ue(e.first,0);var n=e.first+e.size-1;return t.line>n?Ue(n,et(e,n).text.length):Qi(t,et(e,t.line).text.length)}function Qi(e,t){var n=e.ch;return n==null||n>t?Ue(e.line,t):n<0?Ue(e.line,0):e}function Nn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}var cr=function(e,t){this.state=e,this.lookAhead=t},ar=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ar.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ar.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}},ar.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ar.fromSaved=function(e,t,n){return t instanceof cr?new ar(e,ur(e.mode,t.state),n,t.lookAhead):new ar(e,ur(e.mode,t),n)},ar.prototype.save=function(e){var t=e!==!1?ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new cr(t,this.maxLookAhead):t};function bi(e,t,n,r){var i=[e.state.modeGen],x={};jn(e,t.text,e.doc.mode,n,function(Y,ae){return i.push(Y,ae)},x,r);for(var N=n.state,K=function(Y){n.baseTokens=i;var ae=e.state.overlays[Y],de=1,xe=0;n.state=!0,jn(e,t.text,ae.mode,n,function(ve,Pe){for(var ke=de;xe<ve;){var Ne=i[de];Ne>ve&&i.splice(de,1,ve,i[de+1],Ne),de+=2,xe=Math.min(ve,Ne)}if(!Pe)return;if(ae.opaque)i.splice(ke,de-ke,ve,"overlay "+Pe),de=ke+2;else for(;ke<de;ke+=2){var Ge=i[ke+1];i[ke+1]=(Ge?Ge+" ":"")+"overlay "+Pe}},x),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)K(z);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function Bn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=rr(e,gt(t)),i=t.text.length>e.options.maxHighlightLength&&ur(e.doc.mode,r.state),x=bi(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=x.styles,x.classes?t.styleClasses=x.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 rr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ar(r,!0,t);var x=Jr(e,t,n),N=x>r.first&&et(r,x-1).stateAfter,K=N?ar.fromSaved(r,N,x):new ar(r,cn(r.mode),x);return r.iter(x,t,function(z){mn(e,z.text,K);var Y=K.line;z.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function mn(e,t,n,r){var i=e.doc.mode,x=new Ct(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&Ei(i,n.state);!x.eol();)pn(i,x,n.state),x.start=x.pos}function Ei(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Vr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Vr(e,n).mode);var x=e.token(t,n);if(t.pos>t.start)return x}throw new Error("Mode "+e.name+" failed to advance stream.")}var _r=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ar(e,t,n,r){var i=e.doc,x=i.mode,N;t=lt(i,t);var K=et(i,t.line),z=rr(e,t.line,n),Y=new Ct(K.text,e.options.tabSize,z),ae;for(r&&(ae=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,N=pn(x,Y,z.state),r&&ae.push(new _r(Y,N,ur(i.mode,z.state)));return r?ae:new _r(Y,N,z.state)}function xi(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 jn(e,t,n,r,i,x,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var z=0,Y=null,ae=new Ct(t,e.options.tabSize,r),de,xe=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),x);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(K=!1,N&&mn(e,t,r,ae.pos),ae.pos=t.length,de=null):de=xi(pn(n,ae,r.state,xe),x),xe){var ve=xe[0].name;ve&&(de="m-"+(de?ve+" "+de:ve))}if(!K||Y!=de){for(;z<ae.start;)z=Math.min(ae.start,z+5e3),i(z,Y);Y=de}ae.start=ae.pos}for(;z<ae.pos;){var Pe=Math.min(ae.pos,z+5e3);i(Pe,Y),z=Pe}}function Jr(e,t,n){for(var r,i,x=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=x.first)return x.first;var z=et(x,K-1),Y=z.stateAfter;if(Y&&(!n||K+(Y instanceof cr?Y.lookAhead:0)<=x.modeFrontier))return K;var ae=H(z.text,null,e.options.tabSize);(i==null||r>ae)&&(i=K-1,r=ae)}return i}function Wn(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 i=et(e,r).stateAfter;if(i&&(!(i instanceof cr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ti=!1,fr=!1;function Si(){Ti=!0}function wi(){fr=!0}function gn(e,t,n){this.marker=e,this.from=t,this.to=n}function Pr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Fa(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Hn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Qr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,K=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);if(K||x.from==t&&N.type=="bookmark"&&(!n||!x.marker.insertLeft)){var z=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);(r||(r=[])).push(new gn(N,x.from,z?null:x.to))}}return r}function Kn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,K=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);if(K||x.from==t&&N.type=="bookmark"&&(!n||x.marker.insertLeft)){var z=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);(r||(r=[])).push(new gn(N,z?null:x.from-t,x.to==null?null:x.to-t))}}return r}function Mr(e,t){if(t.full)return null;var n=Rr(e,t.from.line)&&et(e,t.from.line).markedSpans,r=Rr(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,N=ut(t.from,t.to)==0,K=Qr(n,i,N),z=Kn(r,x,N),Y=t.text.length==1,ae=J(t.text).length+(Y?i:0);if(K)for(var de=0;de<K.length;++de){var xe=K[de];if(xe.to==null){var ve=Pr(z,xe.marker);ve?Y&&(xe.to=ve.to==null?null:ve.to+ae):xe.to=i}}if(z)for(var Pe=0;Pe<z.length;++Pe){var ke=z[Pe];if(ke.to!=null&&(ke.to+=ae),ke.from==null){var Ne=Pr(K,ke.marker);Ne||(ke.from=ae,Y&&(K||(K=[])).push(ke))}else ke.from+=ae,Y&&(K||(K=[])).push(ke)}K&&(K=Zr(K)),z&&z!=K&&(z=Zr(z));var Ge=[K];if(!Y){var Ye=t.text.length-2,ze;if(Ye>0&&K)for(var Ze=0;Ze<K.length;++Ze)K[Ze].to==null&&(ze||(ze=[])).push(new gn(K[Ze].marker,null,null));for(var at=0;at<Ye;++at)Ge.push(ze);Ge.push(z)}return Ge}function Zr(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 Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ve){if(ve.markedSpans)for(var Pe=0;Pe<ve.markedSpans.length;++Pe){var ke=ve.markedSpans[Pe].marker;ke.readOnly&&(!r||Z(r,ke)==-1)&&(r||(r=[])).push(ke)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var N=r[x],K=N.find(0),z=0;z<i.length;++z){var Y=i[z];if(ut(Y.to,K.from)<0||ut(Y.from,K.to)>0)continue;var ae=[z,1],de=ut(Y.from,K.from),xe=ut(Y.to,K.to);(de<0||!N.inclusiveLeft&&!de)&&ae.push({from:Y.from,to:K.from}),(xe>0||!N.inclusiveRight&&!xe)&&ae.push({from:K.to,to:Y.to}),i.splice.apply(i,ae),z+=ae.length-3}return i}function Gn(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 qr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function vn(e){return e.inclusiveLeft?-1:0}function yr(e){return e.inclusiveRight?1:0}function zn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=ut(r.from,i.from)||vn(e)-vn(t);if(x)return-x;var N=ut(r.to,i.to)||yr(e)-yr(t);return N||t.id-e.id}function _i(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=void 0,x=0;x<n.length;++x)i=n[x],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||zn(r,i.marker)<0)&&(r=i.marker);return r}function Ai(e){return _i(e,!0)}function Vn(e){return _i(e,!1)}function Na(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var x=n[i];x.marker.collapsed&&(x.from==null||x.from<t)&&(x.to==null||x.to>t)&&(!r||zn(r,x.marker)<0)&&(r=x.marker)}return r}function Zi(e,t,n,r,i){var x=et(e,t),N=fr&&x.markedSpans;if(N)for(var K=0;K<N.length;++K){var z=N[K];if(!z.marker.collapsed)continue;var Y=z.marker.find(0),ae=ut(Y.from,n)||vn(z.marker)-vn(i),de=ut(Y.to,r)||yr(z.marker)-yr(i);if(ae>=0&&de<=0||ae<=0&&de>=0)continue;if(ae<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.to,n)>=0:ut(Y.to,n)>0)||ae>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.from,r)<=0:ut(Y.from,r)<0))return!0}}function rt(e){for(var t;t=Ai(e);)e=t.find(-1,!0).line;return e}function ct(e){for(var t;t=Vn(e);)e=t.find(1,!0).line;return e}function ft(e){for(var t,n;t=Vn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Et(e,t){var n=et(e,t),r=rt(n);return n==r?t:gt(r)}function xt(e,t){if(t>e.lastLine())return t;var n=et(e,t),r;if(!St(e,n))return t;for(;r=Vn(n);)n=r.find(1,!0).line;return gt(n)+1}function St(e,t){var n=fr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Rt(e,t,r))return!0}}function Rt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Rt(e,r.line,Pr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,x=0;x<t.markedSpans.length;++x)if(i=t.markedSpans[x],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Rt(e,t,i))return!0}function _t(e){e=rt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var x=n.parent;x;n=x,x=n.parent)for(var N=0;N<x.children.length;++N){var K=x.children[N];if(K==n)break;t+=K.height}return t}function Gt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ai(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Vn(r);){var x=n.find(0,!0);t-=r.text.length-x.from.ch,r=x.to.line,t+=r.text.length-x.to.ch}return t}function mr(e){var t=e.display,n=e.doc;t.maxLine=et(n,n.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Gt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var wt=function(e,t,n){this.text=e,qr(this,t),this.height=n?n(this):1};wt.prototype.lineNo=function(){return gt(this)},ue(wt);function kr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Gn(e),qr(e,n);var i=r?r(e):1;i!=e.height&&dr(e,i)}function zt(e){e.parent=null,Gn(e)}var Ir={},Ur={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ur:Ir;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(e,t){var n=v("span",null,null,D?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var x=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=Cs,Lt(e.display.measure)&&(N=Ke(x,e.doc.direction))&&(r.addToken=As(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&>(x);Ls(x,r,Bn(e,x,K)),x.styleClasses&&(x.styleClasses.bgClass&&(r.bgClass=j(x.styleClasses.bgClass,r.bgClass||"")),x.styleClasses.textClass&&(r.textClass=j(x.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(dt(e.display.measure))),i==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(D){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function ws(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,x,N){if(!t)return;var K=e.splitSpaces?_s(t,e.trailingSpace):t,z=e.cm.state.specialChars,Y=!1,ae;if(!z.test(t))e.col+=t.length,ae=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ae),B&&I<9&&(Y=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var de=0;;){z.lastIndex=de;var xe=z.exec(t),ve=xe?xe.index-de:t.length-de;if(ve){var Pe=document.createTextNode(K.slice(de,de+ve));B&&I<9?ae.appendChild(a("span",[Pe])):ae.appendChild(Pe),e.map.push(e.pos,e.pos+ve,Pe),e.col+=ve,e.pos+=ve}if(!xe)break;de+=ve+1;var ke=void 0;if(xe[0]==" "){var Ne=e.cm.options.tabSize,Ge=Ne-e.col%Ne;ke=ae.appendChild(a("span",he(Ge),"cm-tab")),ke.setAttribute("role","presentation"),ke.setAttribute("cm-text"," "),e.col+=Ge}else xe[0]=="\r"||xe[0]==`
|
|
`?(ke=ae.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ke.setAttribute("cm-text",xe[0]),e.col+=1):(ke=e.cm.options.specialCharPlaceholder(xe[0]),ke.setAttribute("cm-text",xe[0]),B&&I<9?ae.appendChild(a("span",[ke])):ae.appendChild(ke),e.col+=1);e.map.push(e.pos,e.pos+1,ke),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||Y||x||N){var Ye=n||"";r&&(Ye+=r),i&&(Ye+=i);var ze=a("span",[ae],Ye,x);if(N)for(var Ze in N)N.hasOwnProperty(Ze)&&Ze!="style"&&Ze!="class"&&ze.setAttribute(Ze,N[Ze]);return e.content.appendChild(ze)}e.content.appendChild(ae)}function _s(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var x=e.charAt(i);x==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(x="\xA0"),r+=x,n=x==" "}return r}function As(e,t){return function(n,r,i,x,N,K,z){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,ae=Y+r.length;;){for(var de=void 0,xe=0;xe<t.length&&!(de=t[xe],de.to>Y&&de.from<=Y);xe++);if(de.to>=ae)return e(n,r,i,x,N,K,z);e(n,r.slice(0,de.to-Y),i,x,null,K,z),x=null,r=r.slice(de.to-Y),Y=de.to}}}function ja(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,x=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(x,x=n[N]),yn(n[N+1],t.cm.options));return}for(var K=i.length,z=0,Y=1,ae="",de,xe,ve=0,Pe,ke,Ne,Ge,Ye;;){if(ve==z){Pe=ke=Ne=xe="",Ye=null,Ge=null,ve=Infinity;for(var ze=[],Ze=void 0,at=0;at<r.length;++at){var nt=r[at],ht=nt.marker;if(ht.type=="bookmark"&&nt.from==z&&ht.widgetNode)ze.push(ht);else if(nt.from<=z&&(nt.to==null||nt.to>z||ht.collapsed&&nt.to==z&&nt.from==z)){if(nt.to!=null&&nt.to!=z&&ve>nt.to&&(ve=nt.to,ke=""),ht.className&&(Pe+=" "+ht.className),ht.css&&(xe=(xe?xe+";":"")+ht.css),ht.startStyle&&nt.from==z&&(Ne+=" "+ht.startStyle),ht.endStyle&&nt.to==ve&&(Ze||(Ze=[])).push(ht.endStyle,nt.to),ht.title&&((Ye||(Ye={})).title=ht.title),ht.attributes)for(var Tt in ht.attributes)(Ye||(Ye={}))[Tt]=ht.attributes[Tt];ht.collapsed&&(!Ge||zn(Ge.marker,ht)<0)&&(Ge=nt)}else nt.from>z&&ve>nt.from&&(ve=nt.from)}if(Ze)for(var Bt=0;Bt<Ze.length;Bt+=2)Ze[Bt+1]==ve&&(ke+=" "+Ze[Bt]);if(!Ge||Ge.from==z)for(var Dt=0;Dt<ze.length;++Dt)ja(t,0,ze[Dt]);if(Ge&&(Ge.from||0)==z){if(ja(t,(Ge.to==null?K+1:Ge.to)-z,Ge.marker,Ge.from==null),Ge.to==null)return;Ge.to==z&&(Ge=!1)}}if(z>=K)break;for(var ir=Math.min(K,ve);;){if(ae){var qt=z+ae.length;if(!Ge){var Mt=qt>ir?ae.slice(0,ir-z):ae;t.addToken(t,Mt,de?de+Pe:Pe,Ne,z+Mt.length==ve?ke:"",xe,Ye)}if(qt>=ir){ae=ae.slice(ir-z),z=ir;break}z=qt,Ne=""}ae=i.slice(x,x=n[Y++]),de=yn(n[Y++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=ft(t),this.size=this.rest?gt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=St(e,t)}function Li(e,t,n){for(var r=[],i,x=t;x<n;x=i){var N=new Wa(e.doc,et(e.doc,x),x);i=x+N.size,r.push(N)}return r}var bn=null;function Ds(e){bn?bn.ops.push(e):e.ownsGroup=bn={ops:[e],delayedCallbacks:[]}}function Os(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 i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{bn=null,t(n)}}var Xn=null;function Ht(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;bn?i=bn.delayedCallbacks:Xn?i=Xn:(i=Xn=[],setTimeout(Ps,0));for(var x=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)x(N)}function Ps(){var e=Xn;Xn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?ks(e,t):x=="gutter"?Ga(e,t,n,r):x=="class"?qi(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function Yn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&I<8&&(e.node.style.zIndex=2)),e.node}function Ms(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=Yn(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ka(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function ks(e,t){var n=t.text.className,r=Ka(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,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){Ms(e,t),t.line.wrapClass?Yn(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 Ga(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 i=Yn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var N=Yn(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",Xr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),x)for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=e.display.gutterSpecs[z].className,ae=x.hasOwnProperty(Y)&&x[Y];ae&&K.appendChild(a("div",[ae],"CodeMirror-gutter-elt","left: "+r.gutterLeft[Y]+"px; width: "+r.gutterWidth[Y]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=p("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Us(e,t,n,r){var i=Ka(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),Ga(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var x=Yn(n),N=0,K=t.widgets;N<K.length;++N){var z=K[N],Y=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Fs(z,Y,n,r),e.display.input.setUneditable(Y),i&&z.above?x.insertBefore(Y,n.gutter||n.text):x.appendChild(Y),Ht(z,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function $n(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(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;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Lr(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Di(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("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 br(e){return re-e.display.nativeBarWidth}function en(e){return e.display.scroller.clientWidth-br(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-br(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&en(e);if(!t.measure.heights||r&&t.measure.width!=i){var x=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var z=N[K],Y=N[K+1];Math.abs(z.bottom-Y.bottom)>2&&x.push((z.bottom+Y.top)/2-n.top)}}x.push(n.bottom-n.top)}}function Ya(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 i=0;i<e.rest.length;i++)if(gt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=rt(t);var n=gt(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function $a(e,t,n,r){return Er(e,En(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function En(e,t){var n=gt(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ha(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Er(e,t,n,r,i){t.before&&(n=-1);var x=n+(r||""),N;return t.cache.hasOwnProperty(x)?N=t.cache[x]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[x]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var Ja={left:0,right:0,top:0,bottom:0};function Qa(e,t,n){for(var r,i,x,N,K,z,Y=0;Y<e.length;Y+=3)if(K=e[Y],z=e[Y+1],t<K?(i=0,x=1,N="left"):t<z?(i=t-K,x=i+1):(Y==e.length-3||t==z&&e[Y+3]>t)&&(x=z-K,i=x-1,t>=z&&(N="right")),i!=null){if(r=e[Y+2],K==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],N="left";if(n=="right"&&i==z-K)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],N="right";break}return{node:r,start:i,end:x,collapse:N,coverStart:K,coverEnd:z}}function js(e,t){var n=Ja;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=Qa(t.map,n,r),x=i.node,N=i.start,K=i.end,z=i.collapse,Y;if(x.nodeType==3){for(var ae=0;ae<4;ae++){for(;N&&De(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&De(t.line.text.charAt(i.coverStart+K));)++K;if(B&&I<9&&N==0&&K==i.coverEnd-i.coverStart?Y=x.parentNode.getBoundingClientRect():Y=js(g(x,N,K).getClientRects(),r),Y.left||Y.right||N==0)break;K=N,N=N-1,z="right"}B&&I<11&&(Y=Hs(e.display.measure,Y))}else{N>0&&(z=r="right");var de;e.options.lineWrapping&&(de=x.getClientRects()).length>1?Y=de[r=="right"?de.length-1:0]:Y=x.getBoundingClientRect()}if(B&&I<9&&!N&&(!Y||!Y.left&&!Y.right)){var xe=x.parentNode.getClientRects()[0];xe?Y={left:xe.left,right:xe.left+Tn(e.display),top:xe.top,bottom:xe.bottom}:Y=Ja}for(var ve=Y.top-t.rect.top,Pe=Y.bottom-t.rect.top,ke=(ve+Pe)/2,Ne=t.view.measure.heights,Ge=0;Ge<Ne.length-1&&!(ke<Ne[Ge]);Ge++);var Ye=Ge?Ne[Ge-1]:0,ze=Ne[Ge],Ze={left:(z=="right"?Y.right:Y.left)-t.rect.left,right:(z=="left"?Y.left:Y.right)-t.rect.left,top:Ye,bottom:ze};return!Y.left&&!Y.right&&(Ze.bogus=!0),e.options.singleCursorHeightPerLine||(Ze.rtop=ve,Ze.rbottom=Pe),Ze}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yt(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 Za(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 qa(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Za(e.display.view[t])}function Jn(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return E&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return E&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=$n(e.widgets[n]));return t}function Oi(e,t,n,r,i){if(!i){var x=na(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var N=_t(t);if(r=="local"?N+=Di(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:to());var z=K.left+(r=="window"?0:eo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();else if(n=="local"||!n){var x=e.display.sizer.getBoundingClientRect();r+=x.left,i+=x.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ia(e,t,n,r,i){return r||(r=et(e.doc,t.line)),Oi(e,r,$a(e,r,t.ch,i),n)}function pr(e,t,n,r,i,x){r=r||et(e.doc,t.line),i||(i=En(e,r));function N(Pe,ke){var Ne=Er(e,i,Pe,ke?"right":"left",x);return ke?Ne.left=Ne.right:Ne.right=Ne.left,Oi(e,r,Ne,n)}var K=Ke(r,e.doc.direction),z=t.ch,Y=t.sticky;if(z>=r.text.length?(z=r.text.length,Y="before"):z<=0&&(z=0,Y="after"),!K)return N(Y=="before"?z-1:z,Y=="before");function ae(Pe,ke,Ne){var Ge=K[ke],Ye=Ge.level==1;return N(Ne?Pe-1:Pe,Ye!=Ne)}var de=Be(K,z,Y),xe=Xe,ve=ae(z,de,Y=="before");return xe!=null&&(ve.other=ae(z,xe,Y!="before")),ve}function no(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=et(e.doc,t.line),i=_t(r)+Di(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var x=Ue(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=Cr(r,n),x=r.first+r.size-1;if(i>x)return aa(r.first+r.size-1,et(r,x).text.length,null,1,1);t<0&&(t=0);for(var N=et(r,i);;){var K=Ks(e,N,i,t,n),z=Na(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var Y=z.find(1);if(Y.line==i)return Y;N=et(r,i=Y.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,x=We(function(N){return Er(e,n,N-1).bottom<=r},i,0);return i=We(function(N){return Er(e,n,N).top>r},x,i),{begin:x,end:i}}function ao(e,t,n,r){n||(n=En(e,t));var i=Oi(e,t,Er(e,n,r),"line").top;return io(e,t,n,i)}function sa(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=_t(t);var x=En(e,t),N=na(t),K=0,z=t.text.length,Y=!0,ae=Ke(t,e.doc.direction);if(ae){var de=(e.options.lineWrapping?zs:Gs)(e,t,n,x,ae,r,i);Y=de.level!=1,K=Y?de.from:de.to-1,z=Y?de.to:de.from-1}var xe=null,ve=null,Pe=We(function(at){var nt=Er(e,x,at);return nt.top+=N,nt.bottom+=N,sa(nt,r,i,!1)?(nt.top<=i&&nt.left<=r&&(xe=at,ve=nt),!0):!1},K,z),ke,Ne,Ge=!1;if(ve){var Ye=r-ve.left<ve.right-r,ze=Ye==Y;Pe=xe+(ze?0:1),Ne=ze?"after":"before",ke=Ye?ve.left:ve.right}else{!Y&&(Pe==z||Pe==K)&&Pe++,Ne=Pe==0?"after":Pe==t.text.length?"before":Er(e,x,Pe-(Y?1:0)).bottom+N<=i==Y?"after":"before";var Ze=pr(e,Ue(n,Pe,Ne),"line",t,x);ke=Ze.left,Ge=i<Ze.top?-1:i>=Ze.bottom?1:0}return Pe=Le(t.text,Pe,1),aa(n,Pe,Ne,Ge,r-ke)}function Gs(e,t,n,r,i,x,N){var K=We(function(de){var xe=i[de],ve=xe.level!=1;return sa(pr(e,Ue(n,ve?xe.to:xe.from,ve?"before":"after"),"line",t,r),x,N,!0)},0,i.length-1),z=i[K];if(K>0){var Y=z.level!=1,ae=pr(e,Ue(n,Y?z.from:z.to,Y?"after":"before"),"line",t,r);sa(ae,x,N,!0)&&ae.top>N&&(z=i[K-1])}return z}function zs(e,t,n,r,i,x,N){var K=io(e,t,r,N),z=K.begin,Y=K.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var ae=null,de=null,xe=0;xe<i.length;xe++){var ve=i[xe];if(ve.from>=Y||ve.to<=z)continue;var Pe=ve.level!=1,ke=Er(e,r,Pe?Math.min(Y,ve.to)-1:Math.max(z,ve.from)).right,Ne=ke<x?x-ke+1e9:ke-x;(!ae||de>Ne)&&(ae=ve,de=Ne)}return ae||(ae=i[i.length-1]),ae.from<z&&(ae={from:z,to:ae.to,level:ae.level}),ae.to>Y&&(ae={from:ae.from,to:Y,level:ae.level}),ae}var tn;function xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(tn==null){tn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)tn.appendChild(document.createTextNode("x")),tn.appendChild(a("br"));tn.appendChild(document.createTextNode("x"))}l(e.measure,tn);var n=tn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function la(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,N=0;x;x=x.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=x.offsetLeft+x.clientLeft+i,r[K]=x.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Tn(e.display)-3);return function(i){if(St(e.doc,i))return 0;var x=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(x+=i.widgets[N].height);return n?x+(Math.ceil(i.text.length/r)||1)*t:x+t}}function da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&dr(r,i)})}function rn(e,t,n,r){var i=e.display;if(!n&&Ee(t).getAttribute("cm-not-content")=="true")return null;var x,N,K=i.lineSpace.getBoundingClientRect();try{x=t.clientX-K.left,N=t.clientY-K.top}catch(de){return null}var z=oa(e,x,N),Y;if(r&&z.xRel>0&&(Y=et(e.doc,z.line).text).length==z.ch){var ae=H(Y,Y.length,e.options.tabSize)-Y.length;z=Ue(z.line,Math.max(0,Math.round((x-Xa(e.display).left)/Tn(e.display))-ae))}return z}function nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Qt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)fr&&Et(e.doc,t)<i.viewTo&&Nr(e);else if(n<=i.viewFrom)fr&&xt(e.doc,n+r)>i.viewFrom?Nr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Nr(e);else if(t<=i.viewFrom){var x=Ri(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):Nr(e)}else if(n>=i.viewTo){var N=Ri(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Nr(e)}else{var K=Ri(e,t,t,-1),z=Ri(e,n,n+r,1);K&&z?(i.view=i.view.slice(0,K.index).concat(Li(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Nr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Fr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var x=r.view[nn(e,t)];if(x.node==null)return;var N=x.changes||(x.changes=[]);Z(N,n)==-1&&N.push(n)}function Nr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ri(e,t,n,r){var i=nn(e,t),x,N=e.display.view;if(!fr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,z=0;z<i;z++)K+=N[z].size;if(K!=t){if(r>0){if(i==N.length-1)return null;x=K+N[i].size-t,i++}else x=K-t;t+=x,n+=x}for(;Et(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Li(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Li(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Li(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,nn(e,n)))),r.viewTo=n}function so(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Qn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),x=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var z=K.empty();(z||e.options.showCursorWhenSelecting)&&uo(e,K.head,i),z||Xs(e,K,x)}return r}function uo(e,t,n){var r=pr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var x=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));x.style.display="",x.style.left=r.other.left+"px",x.style.top=r.other.top+"px",x.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,x=document.createDocumentFragment(),N=Xa(e.display),K=N.left,z=Math.max(r.sizerWidth,en(e)-r.sizer.offsetLeft)-N.right,Y=i.direction=="ltr";function ae(ze,Ze,at,nt){Ze<0&&(Ze=0),Ze=Math.round(Ze),nt=Math.round(nt),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+ze+`px;
|
|
top: `+Ze+"px; width: "+(at==null?z-ze:at)+`px;
|
|
height: `+(nt-Ze)+"px"))}function de(ze,Ze,at){var nt=et(i,ze),ht=nt.text.length,Tt,Bt;function Dt(Mt,er){return ia(e,Ue(ze,Mt),"div",nt,er)}function ir(Mt,er,Kt){var Ut=ao(e,nt,null,Mt),kt=er=="ltr"==(Kt=="after")?"left":"right",Ot=Kt=="after"?Ut.begin:Ut.end-(/\s/.test(nt.text.charAt(Ut.end-1))?2:1);return Dt(Ot,kt)[kt]}var qt=Ke(nt,i.direction);return Ve(qt,Ze||0,at==null?ht:at,function(Mt,er,Kt,Ut){var kt=Kt=="ltr",Ot=Dt(Mt,kt?"left":"right"),tr=Dt(er-1,kt?"right":"left"),In=Ze==null&&Mt==0,Gr=at==null&&er==ht,Xt=Ut==0,xr=!qt||Ut==qt.length-1;if(tr.top-Ot.top<=3){var jt=(Y?In:Gr)&&Xt,Ia=(Y?Gr:In)&&xr,Or=jt?K:(kt?Ot:tr).left,un=Ia?z:(kt?tr:Ot).right;ae(Or,Ot.top,un-Or,Ot.bottom)}else{var dn,Jt,Un,Ua;kt?(dn=Y&&In&&Xt?K:Ot.left,Jt=Y?z:ir(Mt,Kt,"before"),Un=Y?K:ir(er,Kt,"after"),Ua=Y&&Gr&&xr?z:tr.right):(dn=Y?ir(Mt,Kt,"before"):K,Jt=!Y&&In&&Xt?z:Ot.right,Un=!Y&&Gr&&xr?K:tr.left,Ua=Y?ir(er,Kt,"after"):z),ae(dn,Ot.top,Jt-dn,Ot.bottom),Ot.bottom<tr.top&&ae(K,Ot.bottom,null,tr.top),ae(Un,tr.top,Ua-Un,tr.bottom)}(!Tt||Pi(Ot,Tt)<0)&&(Tt=Ot),Pi(tr,Tt)<0&&(Tt=tr),(!Bt||Pi(Ot,Bt)<0)&&(Bt=Ot),Pi(tr,Bt)<0&&(Bt=tr)}),{start:Tt,end:Bt}}var xe=t.from(),ve=t.to();if(xe.line==ve.line)de(xe.line,xe.ch,ve.ch);else{var Pe=et(i,xe.line),ke=et(i,ve.line),Ne=rt(Pe)==rt(ke),Ge=de(xe.line,xe.ch,Ne?Pe.text.length+1:null).end,Ye=de(ve.line,Ne?0:null,ve.ch).start;Ne&&(Ge.top<Ye.top-2?(ae(Ge.right,Ge.top,null,Ge.bottom),ae(K,Ye.top,Ye.left,Ye.bottom)):ae(Ge.right,Ge.top,Ye.left-Ge.right,Ge.bottom)),Ge.bottom<Ye.top&&ae(K,Ge.bottom,null,Ye.top)}n.appendChild(x)}function ca(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()||Sn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Sn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(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(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ca(e)}function Sn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Mi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],x=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&I<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var Y=i.node.getBoundingClientRect();N=Y.bottom-Y.top,!x&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var ae=i.line.height-N;if((ae>.005||ae<-.005)&&(dr(i.line,N),ho(i.line),i.rest))for(var de=0;de<i.rest.length;de++)ho(i.rest[de]);if(K>e.display.sizerWidth){var xe=Math.ceil(K/Tn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(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 ki(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Di(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=Cr(t,r),N=Cr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,z=n.ensure.to.line;K<x?(x=K,N=Cr(t,_t(et(t,K))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(x=Cr(t,_t(et(t,z))-e.wrapper.clientHeight),N=z)}return{from:x,to:Math.max(N,x+1)}}function Ys(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!T){var x=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Di(e.display))+`px;
|
|
height: `+(t.bottom-t.top+br(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(x),x.scrollIntoView(i),e.display.lineSpace.removeChild(x)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ue(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ue(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var N=!1,K=pr(e,t),z=!n||n==t?K:pr(e,n);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-r,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+r};var Y=ha(e,i),ae=e.doc.scrollTop,de=e.doc.scrollLeft;if(Y.scrollTop!=null&&(qn(e,Y.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(N=!0)),Y.scrollLeft!=null&&(an(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=ha(e,t);n.scrollTop!=null&&qn(e,n.scrollTop),n.scrollLeft!=null&&an(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=ta(e),N={};t.bottom-t.top>x&&(t.bottom=t.top+x);var K=e.doc.height+ea(n),z=t.top<r,Y=t.bottom>K-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+x){var ae=Math.min(t.top,(Y?K:t.bottom)-x);ae!=i&&(N.scrollTop=ae)}var de=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-de,ve=en(e)-n.gutters.offsetWidth,Pe=t.right-t.left>ve;return Pe&&(t.right=t.left+ve),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+de-(Pe?0:10)):t.right>ve+xe-3&&(N.scrollLeft=t.right+(Pe?0:10)-ve),N}function ma(e,t){if(t==null)return;Ii(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function wn(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Zn(e,t,n){(t!=null||n!=null)&&Ii(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ii(e),e.curOp.scrollToPos=t}function Ii(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(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});Zn(e,i.scrollLeft,i.scrollTop)}function qn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||ga(e,{top:t}),po(e,t,!0),A&&ga(e),ri(e,100)}function po(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 an(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,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(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+br(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var on=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};on.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 i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"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 x=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+x)+"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}},on.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},on.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},on.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},on.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),x=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);x!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},on.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ti=function(){};ti.prototype.update=function(){return{bottom:0,right:0}},ti.prototype.setScrollLeft=function(){},ti.prototype.setScrollTop=function(){},ti.prototype.clear=function(){};function Cn(e,t){t||(t=ei(e));var n=e.display.barWidth,r=e.display.barHeight;go(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Mi(e),go(e,ei(e)),n=e.display.barWidth,r=e.display.barHeight}function go(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 vo={native:on,null:ti};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(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"?an(e,t):qn(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function sn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},Ds(e.curOp)}function ln(e){var t=e.curOp;t&&Rs(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 i=0;i<t.length;i++)rl(t[i]);for(var x=0;x<t.length;x++)nl(t[x]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&mr(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 Ui(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Mi(t),e.barMeasure=ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$a(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+br(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-en(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&&an(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==k();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Cn(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&an(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var x=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(x)for(var K=0;K<x.length;++K)x[K].lines.length||Re(x[K],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Re(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function nr(e,t){if(e.curOp)return t();sn(e);try{return t()}finally{ln(e)}}function Ft(e,t){return function(){if(e.curOp)return t.apply(e,arguments);sn(e);try{return t.apply(e,arguments)}finally{ln(e)}}}function $t(e){return function(){if(this.curOp)return e.apply(this,arguments);sn(this);try{return e.apply(this,arguments)}finally{ln(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);sn(t);try{return e.apply(this,arguments)}finally{ln(t)}}}function ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=rr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(x){if(r.line>=e.display.viewFrom){var N=x.styles,K=x.text.length>e.options.maxHighlightLength?ur(t.mode,r.state):null,z=bi(e,x,r,!0);K&&(r.state=K),x.styles=z.styles;var Y=x.styleClasses,ae=z.classes;ae?x.styleClasses=ae:Y&&(x.styleClasses=null);for(var de=!N||N.length!=x.styles.length||Y!=ae&&(!Y||!ae||Y.bgClass!=ae.bgClass||Y.textClass!=ae.textClass),xe=0;!de&&xe<N.length;++xe)de=N[xe]!=x.styles[xe];de&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&mn(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ri(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&nr(e,function(){for(var x=0;x<i.length;x++)Fr(e,i[x],"text")})}var Ui=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ki(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=en(e),this.force=n,this.dims=la(e),this.events=[]};Ui.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.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=br(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=br(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=k();if(!t||!y(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&y(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==k())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(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 pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Nr(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&&so(e)==0)return!1;xo(e)&&(Nr(e),t.dims=la(e));var i=r.first+r.size,x=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<x&&x-n.viewFrom<20&&(x=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),fr&&(x=Et(e.doc,x),N=xt(e.doc,N));var K=x!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,x,N),n.viewOffset=_t(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=so(e);if(!K&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(Y),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==en(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(e),n.top)}),t.visible=ki(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ki(e.display,e.doc,n));if(!pa(e,t))break;Mi(e);var i=ei(e);Qn(e),Cn(e,i),ya(e,i),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 ga(e,t){var n=new Ui(e,t);if(pa(e,n)){Mi(e),bo(e,n);var r=ei(e);Qn(e),Cn(e,r),ya(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,N=x.firstChild;function K(Pe){var ke=Pe.nextSibling;return D&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),ke}for(var z=r.view,Y=r.viewFrom,ae=0;ae<z.length;ae++){var de=z[ae];if(!de.hidden)if(!de.node||de.node.parentNode!=x){var xe=Us(e,de,Y,n);x.insertBefore(xe,N)}else{for(;N!=de.node;)N=K(N);var ve=i&&t!=null&&t<=Y&&de.lineNumber;de.changes&&(Z(de.changes,"gutter")>-1&&(ve=!1),Ha(e,de,Y,n)),ve&&(c(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(Xr(e.options,Y)))),N=de.node.nextSibling}Y+=de.size}for(;N;)N=K(N)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(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+br(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,x=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=x),n[N].gutterBackground&&(n[N].gutterBackground.style.left=x));var K=n[N].alignable;if(K)for(var z=0;z<K.length;z++)K[z].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Xr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),x=i.firstChild.offsetWidth,N=i.offsetWidth-x;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(x,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",va(e.display),!0}return!1}function ba(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var x=e[i],N=null;if(typeof x!="string"&&(N=x.style,x=x.className),x=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:x,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function To(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],x=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+x));N&&(K.style.cssText=N),x=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",va(e)}function ni(e){To(e.display),Qt(e),Eo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[x],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+re+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(A&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Fi=0,or=null;B?or=-.53:A?or=15:E?or=-.7:M&&(or=-1/3);function So(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=So(e);return t.x*=or,t.y*=or,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,x=e.display,N=x.scroller,K=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&z))return;if(i&&s&&D){e:for(var Y=t.target,ae=x.view;Y!=N;Y=Y.parentNode)for(var de=0;de<ae.length;de++)if(ae[de].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!A&&!_&&or!=null){i&&z&&qn(e,Math.max(0,N.scrollTop+i*or)),an(e,Math.max(0,N.scrollLeft+r*or)),(!i||i&&z)&&$(t),x.wheelStartX=null;return}if(i&&or!=null){var xe=i*or,ve=e.doc.scrollTop,Pe=ve+x.wrapper.clientHeight;xe<0?ve=Math.max(0,ve+xe-50):Pe=Math.min(e.doc.height,Pe+xe+50),ga(e,{top:ve,bottom:Pe})}Fi<20&&(x.wheelStartX==null?(x.wheelStartX=N.scrollLeft,x.wheelStartY=N.scrollTop,x.wheelDX=r,x.wheelDY=i,setTimeout(function(){if(x.wheelStartX==null)return;var ke=N.scrollLeft-x.wheelStartX,Ne=N.scrollTop-x.wheelStartY,Ge=Ne&&x.wheelDY&&Ne/x.wheelDY||ke&&x.wheelDX&&ke/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!Ge)return;or=(or*Fi+Ge)/(Fi+1),++Fi},200)):(x.wheelDX+=r,x.wheelDY+=i))}var sr=function(e,t){this.ranges=e,this.primIndex=t};sr.prototype.primary=function(){return this.ranges[this.primIndex]},sr.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(!je(n.anchor,r.anchor)||!je(n.head,r.head))return!1}return!0},sr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vt(Fn(this.ranges[t].anchor),Fn(this.ranges[t].head));return new sr(e,this.primIndex)},sr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},sr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ut(t,r.from())>=0&&ut(e,r.to())<=0)return n}return-1};var vt=function(e,t){this.anchor=e,this.head=t};vt.prototype.from=function(){return Yr(this.anchor,this.head)},vt.prototype.to=function(){return hn(this.anchor,this.head)},vt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function gr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ve){return ut(xe.from(),ve.from())}),n=Z(t,i);for(var x=1;x<t.length;x++){var N=t[x],K=t[x-1],z=ut(K.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var Y=Yr(K.from(),N.from()),ae=hn(K.to(),N.to()),de=K.empty()?N.from()==N.head:K.from()==K.head;x<=n&&--n,t.splice(--x,2,new vt(de?ae:Y,de?Y:ae))}}return new sr(t,n)}function Br(e,t){return new sr([new vt(e,t||e)],0)}function jr(e){return e.text?Ue(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(ut(e,t.from)<0)return e;if(ut(e,t.to)<=0)return jr(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+=jr(t).ch-t.to.ch),Ue(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new vt(Co(i.anchor,t),Co(i.head,t)))}return gr(e.cm,n,e.sel.primIndex)}function _o(e,t,n){return e.line==t.line?Ue(n.line,e.ch-t.ch+n.ch):Ue(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ue(e.first,0),x=i,N=0;N<t.length;N++){var K=t[N],z=_o(K.from,i,x),Y=_o(jr(K),i,x);if(i=K.to,x=Y,n=="around"){var ae=e.sel.ranges[N],de=ut(ae.head,ae.anchor)<0;r[N]=new vt(de?Y:z,de?z:Y)}else r[N]=new vt(z,z)}return new sr(r,e.sel.primIndex)}function xa(e){e.doc.mode=Sr(e.options,e.doc.modeOption),ii(e)}function ii(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,ri(e,100),e.state.modeGen++,e.curOp&&Qt(e)}function Ao(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i(Ye){return n?n[Ye]:null}function x(Ye,ze,Ze){kr(Ye,ze,Ze,r),Ht(Ye,"change",Ye,t)}function N(Ye,ze){for(var Ze=[],at=Ye;at<ze;++at)Ze.push(new wt(Y[at],i(at),r));return Ze}var K=t.from,z=t.to,Y=t.text,ae=et(e,K.line),de=et(e,z.line),xe=J(Y),ve=i(Y.length-1),Pe=z.line-K.line;if(t.full)e.insert(0,N(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Ao(e,t)){var ke=N(0,Y.length-1);x(de,de.text,ve),Pe&&e.remove(K.line,Pe),ke.length&&e.insert(K.line,ke)}else if(ae==de)if(Y.length==1)x(ae,ae.text.slice(0,K.ch)+xe+ae.text.slice(z.ch),ve);else{var Ne=N(1,Y.length-1);Ne.push(new wt(xe+ae.text.slice(z.ch),ve,r)),x(ae,ae.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,Ne)}else if(Y.length==1)x(ae,ae.text.slice(0,K.ch)+Y[0]+de.text.slice(z.ch),i(0)),e.remove(K.line+1,Pe);else{x(ae,ae.text.slice(0,K.ch)+Y[0],i(0)),x(de,xe+de.text.slice(z.ch),ve);var Ge=N(1,Y.length-1);Pe>1&&e.remove(K.line+1,Pe-1),e.insert(K.line+1,Ge)}Ht(e,"change",e,t)}function Wr(e,t,n){function r(i,x,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var z=i.linked[K];if(z.doc==x)continue;var Y=N&&z.sharedHist;if(n&&!Y)continue;t(z.doc,Y),r(z.doc,i,Y)}}r(e,null,!0)}function Lo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),Do(e),e.options.lineWrapping||mr(e),e.options.mode=t.modeOption,Qt(e)}function Do(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){nr(e,function(){Do(e),Qt(e)})}function Ni(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 Sa(e,t){var n={from:Fn(t.from),to:jr(t),text:wr(e,t.from,t.to)};return Po(e,n,t.from.line,t.to.line+1),Wr(e,function(r){return Po(r,n,t.from.line,t.to.line+1)},!0),n}function Oo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Oo(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Ro(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>x-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=J(N.changes),ut(t.from,t.to)==0&&ut(t.from,K.to)==0?K.to=jr(t):N.changes.push(Sa(e,t));else{var z=J(i.done);for((!z||!z.ranges)&&Bi(e.sel,i.done),N={changes:[Sa(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=x,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Re(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&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 i=e.history,x=r&&r.origin;n==i.lastSelOp||x&&i.lastSelOrigin==x&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==x||pl(e,x,J(i.done),t))?i.done[i.done.length-1]=t:Bi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&Oo(i.undone)}function Bi(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Po(e,t,n,r){var i=t["spans_"+e.id],x=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[x]=N.markedSpans),++x})}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=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Mo(e,t){var n=yl(e,t),r=Mr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var x=n[i],N=r[i];if(x&&N){e:for(var K=0;K<N.length;++K){for(var z=N[K],Y=0;Y<x.length;++Y)if(x[Y].marker==z.marker)continue e;x.push(z)}}else N&&(n[i]=N)}return n}function _n(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?sr.prototype.deepCopy.call(x):x);continue}var N=x.changes,K=[];r.push({changes:K});for(var z=0;z<N.length;++z){var Y=N[z],ae=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var de in Y)(ae=de.match(/^spans_(\d+)$/))&&(Z(t,Number(ae[1]))>-1&&(J(K)[de]=Y[de],delete Y[de]))}}return r}function wa(e,t,n,r){if(r){var i=e.anchor;if(n){var x=ut(t,i)<0;x!=ut(n,i)<0?(i=t,t=n):x!=ut(t,n)<0&&(t=n)}return new vt(i,t)}else return new vt(n||t,t)}function ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vt(e,new sr([wa(e.sel.primary(),t,n,i)],0),r)}function ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=wa(e.sel.ranges[x],t[x],null,i);var N=gr(e.cm,r,e.sel.primIndex);Vt(e,N,n)}function Ca(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Vt(e,gr(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){Vt(e,Br(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new vt(lt(e,i[x].anchor),lt(e,i[x].head))},origin:n&&n.origin};return Re(e,"beforeSelectionChange",e,r),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?gr(e.cm,r.ranges,r.ranges.length-1):t}function Uo(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,Wi(e,t,n)):Vt(e,t,n)}function Vt(e,t,n){Wi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Wi(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ut(t.primary().head,e.sel.primary().head)<0?-1:1);Fo(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&wn(e.cm)}function Fo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,se(e.cm)),Ht(e,"cursorActivity",e)}function No(e){Fo(e,Bo(e,e.sel,null,!1))}function Bo(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var N=t.ranges[x],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],z=Hi(e,N.anchor,K&&K.anchor,n,r),Y=Hi(e,N.head,K&&K.head,n,r);(i||z!=N.anchor||Y!=N.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new vt(z,Y))}return i?gr(e.cm,i,t.primIndex):t}function An(e,t,n,r,i){var x=et(e,t.line);if(x.markedSpans)for(var N=0;N<x.markedSpans.length;++N){var K=x.markedSpans[N],z=K.marker,Y="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ae="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ae?K.to>=t.ch:K.to>t.ch))){if(i&&(Re(z,"beforeCursorEnter"),z.explicitlyCleared))if(x.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var de=z.find(r<0?1:-1),xe=void 0;if((r<0?ae:Y)&&(de=jo(e,de,-r,de&&de.line==t.line?x:null)),de&&de.line==t.line&&(xe=ut(de,n))&&(r<0?xe<0:xe>0))return An(e,de,t,r,i)}var ve=z.find(r<0?-1:1);return(r<0?Y:ae)&&(ve=jo(e,ve,r,ve.line==t.line?x:null)),ve?An(e,ve,t,r,i):null}}return t}function Hi(e,t,n,r,i){var x=r||1,N=An(e,t,n,x,i)||!i&&An(e,t,n,x,!0)||An(e,t,n,-x,i)||!i&&An(e,t,n,-x,!0);return N||(e.cantEdit=!0,Ue(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?lt(e,Ue(t.line-1)):null:n>0&&t.ch==(r||et(e,t.line)).text.length?t.line<e.first+e.size-1?Ue(t.line+1,0):null:new Ue(t.line,t.ch+n)}function Wo(e){e.setSelection(Ue(e.firstLine(),0),Ue(e.lastLine()),fe)}function Ho(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(i,x,N,K){i&&(r.from=lt(e,i)),x&&(r.to=lt(e,x)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Re(e,"beforeChange",e,r),e.cm&&Re(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 Ln(e,t,n){if(e.cm){if(!e.cm.curOp)return Ft(e.cm,Ln)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var r=Ti&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ko(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ko(e,t)}function Ko(e,t){if(t.text.length==1&&t.text[0]==""&&ut(t.from,t.to)==0)return;var n=Ea(e,t);Ro(e,t,n,e.cm?e.cm.curOp.id:NaN),ai(e,t,n,Mr(e,t));var r=[];Wr(e,function(i,x){!x&&Z(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),ai(i,t,null,Mr(i,t))})}function Ki(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,N=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,Y=0;Y<K.length&&!(x=K[Y],n?x.ranges&&!x.equals(e.sel):!x.ranges);Y++);if(Y==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=K.pop(),x.ranges){if(Bi(x,z),n&&!x.equals(e.sel)){Vt(e,x,{clearRedo:!1});return}N=x}else if(r){K.push(x);return}else break;var ae=[];Bi(N,z),z.push({changes:ae,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var de=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),xe=function(ke){var Ne=x.changes[ke];if(Ne.origin=t,de&&!Ho(e,Ne,!1))return K.length=0,{};ae.push(Sa(e,Ne));var Ge=ke?Ea(e,Ne):J(K);ai(e,Ne,Ge,Mo(e,Ne)),!ke&&e.cm&&e.cm.scrollIntoView({from:Ne.from,to:jr(Ne)});var Ye=[];Wr(e,function(ze,Ze){!Ze&&Z(Ye,ze.history)==-1&&(Xo(ze.history,Ne),Ye.push(ze.history)),ai(ze,Ne,null,Mo(ze,Ne))})},ve=x.changes.length-1;ve>=0;--ve){var Pe=xe(ve);if(Pe)return Pe.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new sr(oe(e.sel.ranges,function(i){return new vt(Ue(i.anchor.line+t,i.anchor.ch),Ue(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Qt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Fr(e.cm,r,"gutter")}}function ai(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ft(e.cm,ai)(e,t,n,r);if(t.to.line<e.first){Go(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 i=t.text.length-1-(e.first-t.from.line);Go(e,i),t={from:Ue(e.first,0),to:Ue(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Ue(x,et(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wr(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Wi(e,n,fe),e.cantEdit&&Hi(e,Ue(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,x=t.from,N=t.to,K=!1,z=x.line;e.options.lineWrapping||(z=gt(rt(et(r,x.line))),r.iter(z,N.line+1,function(ve){if(ve==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&se(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(z,x.line+t.text.length,function(ve){var Pe=Gt(ve);Pe>i.maxLineLength&&(i.maxLine=ve,i.maxLineLength=Pe,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Wn(r,x.line),ri(e,400);var Y=t.text.length-(N.line-x.line)-1;t.full?Qt(e):x.line==N.line&&t.text.length==1&&!Ao(e.doc,t)?Fr(e,x.line,"text"):Qt(e,x.line,N.line+1,Y);var ae=le(e,"changes"),de=le(e,"change");if(de||ae){var xe={from:x,to:N,text:t.text,removed:t.removed,origin:t.origin};de&&Ht(e,"change",e,xe),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Dn(e,t,n,r,i){var x;r||(r=n),ut(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),Ln(e,{from:n,to:r,text:t,origin:i})}function zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(e,t,n,r){for(var i=0;i<e.length;++i){var x=e[i],N=!0;if(x.ranges){x.copied||(x=e[i]=x.deepCopy(),x.copied=!0);for(var K=0;K<x.ranges.length;K++)zo(x.ranges[K].anchor,t,n,r),zo(x.ranges[K].head,t,n,r);continue}for(var z=0;z<x.changes.length;++z){var Y=x.changes[z];if(n<Y.from.line)Y.from=Ue(Y.from.line+r,Y.from.ch),Y.to=Ue(Y.to.line+r,Y.to.ch);else if(t<=Y.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function oi(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=et(e,$r(e,t)):i=gt(t),i==null?null:(r(x,i)&&e.cm&&Fr(e.cm,i,n),x)}function si(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}si.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,zt(i),Ht(i,"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 li(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}li.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],i=r.chunkSize();if(e<i){var x=Math.min(t,i-e),N=r.height;if(r.removeInner(e,x),this.height-=N-r.height,i==x&&(this.children.splice(n--,1),r.parent=null),(t-=x)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof si))){var K=[];this.collapse(K),this.children=[new si(K)],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 i=this.children[r],x=i.chunkSize();if(e<=x){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var z=new si(i.lines.slice(K,K+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=x}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new li(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Z(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new li(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 i=this.children[r],x=i.chunkSize();if(e<x){var N=Math.min(t,x-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=x}}};var ui=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};ui.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=gt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var x=$n(this);dr(n,Math.max(0,n.height-x)),e&&(nr(e,function(){Yo(e,n,-x),Fr(e,r,"widget")}),Ht(e,"lineWidgetCleared",e,this,r))},ui.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=$n(this)-t;if(!i)return;St(this.doc,r)||dr(r,r.height+i),n&&nr(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Ht(n,"lineWidgetChanged",n,e,gt(r))})},ue(ui);function Yo(e,t,n){_t(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new ui(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),oi(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,x&&!St(e,N)){var z=_t(N)<e.scrollTop;dr(N,N.height+$n(i)),z&&ma(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&Ht(x,"lineWidgetAdded",x,i,typeof t=="number"?t:gt(t)),i}var $o=0,Hr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++$o};Hr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&sn(e),le(this,"clear")){var n=this.find();n&&Ht(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var N=this.lines[x],K=Pr(N.markedSpans,this);e&&!this.collapsed?Fr(e,gt(N),"text"):e&&(K.to!=null&&(i=gt(N)),K.from!=null&&(r=gt(N))),N.markedSpans=Fa(N.markedSpans,K),K.from==null&&this.collapsed&&!St(this.doc,N)&&e&&dr(N,xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var Y=rt(this.lines[z]),ae=Gt(Y);ae>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Qt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&No(e.doc)),e&&Ht(e,"markerCleared",e,this,r,i),t&&ln(e),this.parent&&this.parent.clear()},Hr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],N=Pr(x.markedSpans,this);if(N.from!=null&&(n=Ue(t?x:gt(x),N.from),e==-1))return n;if(N.to!=null&&(r=Ue(t?x:gt(x),N.to),e==1))return r}return n&&{from:n,to:r}},Hr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;nr(r,function(){var i=t.line,x=gt(t.line),N=ra(r,x);if(N&&(Za(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!St(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var z=$n(n)-K;z&&dr(i,i.height+z)}Ht(r,"markerChanged",r,e)})},Hr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Z(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Hr.prototype.detachLine=function(e){if(this.lines.splice(Z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Hr);function On(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ft(e.cm,On)(e,t,n,r,i);var x=new Hr(e,i),N=ut(t,n);if(r&&P(r,x,!1),N>0||N==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=v("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(Zi(e,t.line,t,n,x)||t.line!=n.line&&Zi(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}x.addToHistory&&Ro(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,Y;if(e.iter(K,n.line+1,function(de){z&&x.collapsed&&!z.options.lineWrapping&&rt(de)==z.display.maxLine&&(Y=!0),x.collapsed&&K!=t.line&&dr(de,0),Hn(de,new gn(x,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),x.collapsed&&e.iter(t.line,n.line+1,function(de){St(e,de)&&dr(de,0)}),x.clearOnEnter&&Ae(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++$o,x.atomic=!0),z){if(Y&&(z.curOp.updateMaxLine=!0),x.collapsed)Qt(z,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var ae=t.line;ae<=n.line;ae++)Fr(z,ae,"text");x.atomic&&No(z.doc),Ht(z,"markerAdded",z,x)}return x}var di=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ht(this,"clear")},di.prototype.find=function(e,t){return this.primary.find(e,t)},ue(di);function Tl(e,t,n,r,i){r=P(r),r.shared=!1;var x=[On(e,t,n,r,i)],N=x[0],K=r.widgetNode;return Wr(e,function(z){K&&(r.widgetNode=K.cloneNode(!0)),x.push(On(z,lt(z,t),lt(z,n),r,i));for(var Y=0;Y<z.linked.length;++Y)if(z.linked[Y].isParent)return;N=J(x)}),new di(x,N)}function Jo(e){return e.findMarks(Ue(e.first,0),e.clipPos(Ue(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),x=e.clipPos(i.from),N=e.clipPos(i.to);if(ut(x,N)){var K=On(e,x,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];Wr(i.primary.doc,function(z){return x.push(z)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];Z(x,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,Zt=function(e,t,n,r,i){if(!(this instanceof Zt))return new Zt(e,t,n,r,i);n==null&&(n=0),li.call(this,[new si([new wt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Ue(n,0);this.sel=Br(x),this.history=new Ni(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ta(this,{from:x,to:x,text:e}),Vt(this,Br(x),fe)};Zt.prototype=Se(li.prototype,{constructor:Zt,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=fn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Nt(function(e){var t=Ue(this.first,0),n=this.first+this.size-1;Ln(this,{from:t,to:Ue(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Zn(this.cm,0,0),Vt(this,Br(t),fe)}),replaceRange:function(e,t,n,r){t=lt(this,t),n=n?lt(this,n):t,Dn(this,e,t,n,r)},getRange:function(e,t,n){var r=wr(this,lt(this,e),lt(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(Rr(this,e))return et(this,e)},getLineNumber:function(e){return gt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=et(this,e)),rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(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:Nt(function(e,t,n){Io(this,lt(this,typeof e=="number"?Ue(e,t||0):e),null,n)}),setSelection:Nt(function(e,t,n){Io(this,lt(this,e),lt(this,t||e),n)}),extendSelection:Nt(function(e,t,n){ji(this,lt(this,e),t&<(this,t),n)}),extendSelections:Nt(function(e,t){ko(this,Nn(this,e),t)}),extendSelectionsBy:Nt(function(e,t){var n=oe(this.sel.ranges,e);ko(this,Nn(this,n),t)}),setSelections:Nt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new vt(lt(this,e[i].anchor),lt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Vt(this,gr(this.cm,r,t),n)}),addSelection:Nt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new vt(lt(this,e),lt(this,t||e))),Vt(this,gr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=wr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}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 i=wr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Nt(function(e,t,n){for(var r=[],i=this.sel,x=0;x<i.ranges.length;x++){var N=i.ranges[x];r[x]={from:N.from(),to:N.to(),text:this.splitLines(e[x]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Ln(this,r[z]);K?Uo(this,K):this.cm&&wn(this.cm)}),undo:Nt(function(){Ki(this,"undo")}),redo:Nt(function(){Ki(this,"redo")}),undoSelection:Nt(function(){Ki(this,"undo",!0)}),redoSelection:Nt(function(){Ki(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 i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Ni(this.history.maxGeneration),Wr(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:_n(this.history.done),undone:_n(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=_n(e.done.slice(0),null,!0),t.undone=_n(e.undone.slice(0),null,!0)},setGutterMarker:Nt(function(e,t,n){return oi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Oe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Nt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&oi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Oe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Rr(this,e))return null;if(t=e,e=et(this,e),!e)return null}else if(t=gt(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:Nt(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(p(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Nt(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",x=r[i];if(x)if(n==null)r[i]=null;else{var N=x.match(p(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=x.slice(0,N.index)+(!N.index||K==x.length?"":" ")+x.slice(K)||null}else return!1;return!0})}),addLineWidget:Nt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return On(this,lt(this,e),lt(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=lt(this,e),On(this,e,e,n,"bookmark")},findMarksAt:function(e){e=lt(this,e);var t=[],n=et(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(x){var N=x.markedSpans;if(N)for(var K=0;K<N.length;K++){var z=N[K];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),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(i){var x=i.text.length+r;if(x>e)return t=e,!0;e-=x,++n}),lt(this,Ue(n,t))},indexFromPos:function(e){e=lt(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 Zt(fn(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 Zt(fn(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,Jo(this)),r},unlinkDoc:function(e){if(e instanceof At&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(Jo(this));break}if(e.history==this.history){var r=[e.id];Wr(e,function(i){return r.push(i.id)},!0),e.history=new Ni(null),e.history.done=_n(this.history.done,r),e.history.undone=_n(this.history.undone,r)}},iterLinkedDocs:function(e){Wr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Nt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),Zt.prototype.eachLine=Zt.prototype.iter;var Qo=0;function _l(e){var t=this;if(Zo(t),Fe(t,e)||Lr(t.display,e))return;$(e),B&&(Qo=+new Date);var n=rn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,x=Array(i),N=0,K=function(){++N==i&&Ft(t,function(){n=lt(t.doc,n);var ve={from:n,to:n,text:t.doc.splitLines(x.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ln(t.doc,ve),Uo(t.doc,Br(lt(t.doc,n),lt(t.doc,jr(ve))))})()},z=function(ve,Pe){if(t.options.allowDropFileTypes&&Z(t.options.allowDropFileTypes,ve.type)==-1){K();return}var ke=new FileReader;ke.onerror=function(){return K()},ke.onload=function(){var Ne=ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ne)){K();return}x[Pe]=Ne,K()},ke.readAsText(ve)},Y=0;Y<r.length;Y++)z(r[Y],Y);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 ae=e.dataTransfer.getData("Text");if(ae){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),Wi(t.doc,Br(n,n)),de)for(var xe=0;xe<de.length;++xe)Dn(t.doc,"",de[xe].anchor,de[xe].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(ve){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-Qo<100)){ie(t);return}if(Fe(e,t)||Lr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",_&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),_&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=rn(e,t);if(!n)return;var r=document.createDocumentFragment();uo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function Zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var x=0;x<n.length;x++)e(n[x])})}var es=!1;function Dl(){if(es)return;Ol(),es=!0}function Ol(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Rl)},100))}),Ae(window,"blur",function(){return qo(Sn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Kr={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"},ci=0;ci<10;ci++)Kr[ci+48]=Kr[ci+96]=String(ci);for(var Gi=65;Gi<=90;Gi++)Kr[Gi]=String.fromCharCode(Gi);for(var fi=1;fi<=12;fi++)Kr[fi+111]=Kr[fi+63235]="F"+fi;var Dr={};Dr.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"},Dr.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"},Dr.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"},Dr.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"]},Dr.default=s?Dr.macDefault:Dr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))x=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(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 i=oe(n.split(" "),Pl),x=0;x<i.length;x++){var N=void 0,K=void 0;x==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,x+1).join(" "),N="...");var z=t[K];if(!z)t[K]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function Rn(e,t,n,r){t=zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Rn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var N=Rn(e,t.fallthrough[x],n,r);if(N)return N}}}function ts(e){var t=typeof e=="string"?e:Kr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ns(e,t){if(_&&e.keyCode==34&&e.char)return!1;var n=Kr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function zi(e){return typeof e=="string"?Dr[e]:e}function Pn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&ut(x.from,J(r).to)<=0;){var N=r.pop();if(ut(N.from,x.from)<0){x.from=N.from;break}}r.push(x)}nr(e,function(){for(var K=r.length-1;K>=0;K--)Dn(e.doc,"",r[K].from,r[K].to,"+delete");wn(e)})}function _a(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Aa(e,t,n){var r=_a(e,t.ch,n);return r==null?null:new Ue(t.line,r,n<0?"after":"before")}function La(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=Ke(n,t.doc.direction);if(x){var N=i<0?J(x):x[0],K=i<0==(N.level==1),z=K?"after":"before",Y;if(N.level>0||t.doc.direction=="rtl"){var ae=En(t,n);Y=i<0?n.text.length-1:0;var de=Er(t,ae,Y).top;Y=We(function(xe){return Er(t,ae,xe).top==de},i<0==(N.level==1)?N.from:N.to-1,Y),z=="before"&&(Y=_a(n,Y,1))}else Y=i<0?N.to:N.from;return new Ue(r,Y,z)}}return new Ue(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Ke(t,e.doc.direction);if(!i)return Aa(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 x=Be(i,n.ch,n.sticky),N=i[x];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Aa(t,n,r);var K=function(Ge,Ye){return _a(t,Ge instanceof Ue?Ge.ch:Ge,Ye)},z,Y=function(Ge){return e.options.lineWrapping?(z=z||En(e,t),ao(e,t,z,Ge)):{begin:0,end:t.text.length}},ae=Y(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var de=N.level==1==r<0,xe=K(n,de?1:-1);if(xe!=null&&(de?xe<=N.to&&xe<=ae.end:xe>=N.from&&xe>=ae.begin)){var ve=de?"before":"after";return new Ue(n.line,xe,ve)}}var Pe=function(Ge,Ye,ze){for(var Ze=function(Tt,Bt){return Bt?new Ue(n.line,K(Tt,1),"before"):new Ue(n.line,Tt,"after")};Ge>=0&&Ge<i.length;Ge+=Ye){var at=i[Ge],nt=Ye>0==(at.level!=1),ht=nt?ze.begin:K(ze.end,-1);if(at.from<=ht&&ht<at.to)return Ze(ht,nt);if(ht=nt?at.from:K(at.to,-1),ze.begin<=ht&&ht<ze.end)return Ze(ht,nt)}},ke=Pe(x+r,r,ae);if(ke)return ke;var Ne=r>0?ae.end:K(ae.begin,-1);return Ne!=null&&!(r>0&&Ne==t.text.length)&&(ke=Pe(r>0?0:i.length-1,r,Y(Ne)),ke)?ke:null}var hi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),fe)},killLine:function(e){return Pn(e,function(t){if(t.empty()){var n=et(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ue(t.head.line+1,0)}:{from:t.head,to:Ue(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Pn(e,function(t){return{from:Ue(t.from().line,0),to:lt(e.doc,Ue(t.to().line+1,0))}})},delLineLeft:function(e){return Pn(e,function(t){return{from:Ue(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Pn(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 Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ue(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ue(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(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")},pe)},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")},pe)},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/)?as(e,t.head):r},pe)},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,i=0;i<n.length;i++){var x=n[i].from(),N=H(e.getLine(x.line),x.ch,r);t.push(he(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return nr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,x=et(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Ue(i.line,i.ch-1)),i.ch>0)i=new Ue(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Ue(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=et(e.doc,i.line-1).text;N&&(i=new Ue(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ue(i.line-1,N.length-1),i,"+transpose"))}}n.push(new vt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return nr(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);wn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=et(e.doc,t),r=rt(n);return r!=n&&(t=gt(r)),La(!0,e,r,t,1)}function Il(e,t){var n=et(e.doc,t),r=ct(n);return r!=n&&(t=gt(r)),La(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=et(e.doc,n.line),i=Ke(r,e.doc.direction);if(!i||i[0].level==0){var x=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=x&&t.ch;return Ue(n.line,N?0:x,n.sticky)}return n}function Vi(e,t,n){if(typeof t=="string"&&(t=hi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=be}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Rn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Rn(t,e.options.extraKeys,n,e)||Rn(t,e.options.keyMap,n,e)}var Fl=new X;function mi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ht(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?mi(e,"Shift-"+n,t,function(r){return Vi(e,r,!0)})||mi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vi(e,r)}):mi(e,n,t,function(r){return Vi(e,r)}):!1}function Nl(e,t,n){return mi(e,"'"+n+"'",t,function(r){return Vi(e,r,!0)})}var Da=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=k(),Fe(t,e))return;B&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);_&&(Da=r?n:null,!r&&n==88&&!It&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!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)&&(h(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Lr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(_&&n==Da){Da=null,$(e);return}if(_&&(!e.which||e.which<10)&&ss(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Oa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Oa.prototype.compare=function(e,t,n){return this.time+jl>e&&ut(t,this.pos)==0&&n==this.button};var pi,gi;function Wl(e,t){var n=+new Date;return gi&&gi.compare(n,e,t)?(pi=gi=null,"triple"):pi&&pi.compare(n,e,t)?(gi=new Oa(n,e,t),pi=null,"double"):(pi=new Oa(n,e,t),gi=null,"single")}function cs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Lr(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ra(t,e))return;var r=rn(t,e),i=Ce(e),x=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,x,e))return;i==1?r?Gl(t,r,x,e):Ee(e)==n.scroller&&$(e):i==2?(r&&ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):fo(t))}function Hl(e,t,n,r,i){var x="Click";return r=="double"?x="Double"+x:r=="triple"&&(x="Triple"+x),x=(t==1?"Left":t==2?"Middle":"Right")+x,mi(e,rs(x,i),i,function(N){if(typeof N=="string"&&(N=hi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=be}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var x=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=x?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(O(co,e),0):e.curOp.focus=k();var i=Kl(e,n,r),x=e.doc.sel,N;e.options.dragDrop&&Ie&&!e.isReadOnly()&&n=="single"&&(N=x.contains(t))>-1&&(ut((N=x.ranges[N]).from(),t)<0||t.xRel>0)&&(ut(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,x=!1,N=Ft(e,function(Y){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,Je(i.wrapper.ownerDocument,"mouseup",N),Je(i.wrapper.ownerDocument,"mousemove",K),Je(i.scroller,"dragstart",z),Je(i.scroller,"drop",N),x||($(Y),r.addNew||ji(e.doc,n,null,null,r.extend),D&&!M||B&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Y){x=x||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},z=function(){return x=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ae(i.wrapper.ownerDocument,"mouseup",N),Ae(i.wrapper.ownerDocument,"mousemove",K),Ae(i.scroller,"dragstart",z),Ae(i.scroller,"drop",N),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new vt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new vt(Ue(t.line,0),lt(e.doc,Ue(t.line+1,0)));var r=n(e,t);return new vt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,x=e.doc;$(t);var N,K,z=x.sel,Y=z.ranges;if(r.addNew&&!r.extend?(K=x.sel.contains(n),K>-1?N=Y[K]:N=new vt(n,n)):(N=x.sel.primary(),K=x.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new vt(n,n)),n=rn(e,t,!0,!0),K=-1;else{var ae=fs(e,n,r.unit);r.extend?N=wa(N,ae.anchor,ae.head,r.extend):N=ae}r.addNew?K==-1?(K=Y.length,Vt(x,gr(e,Y.concat([N]),K),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[K].empty()&&r.unit=="char"&&!r.extend?(Vt(x,gr(e,Y.slice(0,K).concat(Y.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=x.sel):Ca(x,K,N,Te):(K=0,Vt(x,new sr([N],0),Te),z=x.sel);var de=n;function xe(ze){if(ut(de,ze)==0)return;if(de=ze,r.unit=="rectangle"){for(var Ze=[],at=e.options.tabSize,nt=H(et(x,n.line).text,n.ch,at),ht=H(et(x,ze.line).text,ze.ch,at),Tt=Math.min(nt,ht),Bt=Math.max(nt,ht),Dt=Math.min(n.line,ze.line),ir=Math.min(e.lastLine(),Math.max(n.line,ze.line));Dt<=ir;Dt++){var qt=et(x,Dt).text,Mt=ge(qt,Tt,at);Tt==Bt?Ze.push(new vt(Ue(Dt,Mt),Ue(Dt,Mt))):qt.length>Mt&&Ze.push(new vt(Ue(Dt,Mt),Ue(Dt,ge(qt,Bt,at))))}Ze.length||Ze.push(new vt(n,n)),Vt(x,gr(e,z.ranges.slice(0,K).concat(Ze),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ze)}else{var er=N,Kt=fs(e,ze,r.unit),Ut=er.anchor,kt;ut(Kt.anchor,Ut)>0?(kt=Kt.head,Ut=Yr(er.from(),Kt.anchor)):(kt=Kt.anchor,Ut=hn(er.to(),Kt.head));var Ot=z.ranges.slice(0);Ot[K]=Xl(e,new vt(lt(x,Ut),kt)),Vt(x,gr(e,Ot,K),Te)}}var ve=i.wrapper.getBoundingClientRect(),Pe=0;function ke(ze){var Ze=++Pe,at=rn(e,ze,!0,r.unit=="rectangle");if(!at)return;if(ut(at,de)!=0){e.curOp.focus=k(),xe(at);var nt=ki(i,x);(at.line>=nt.to||at.line<nt.from)&&setTimeout(Ft(e,function(){Pe==Ze&&ke(ze)}),150)}else{var ht=ze.clientY<ve.top?-20:ze.clientY>ve.bottom?20:0;ht&&setTimeout(Ft(e,function(){if(Pe!=Ze)return;i.scroller.scrollTop+=ht,ke(ze)}),50)}}function Ne(ze){e.state.selectingText=!1,Pe=Infinity,ze&&($(ze),i.input.focus()),Je(i.wrapper.ownerDocument,"mousemove",Ge),Je(i.wrapper.ownerDocument,"mouseup",Ye),x.history.lastSelOrigin=null}var Ge=Ft(e,function(ze){ze.buttons===0||!Ce(ze)?Ne(ze):ke(ze)}),Ye=Ft(e,Ne);e.state.selectingText=Ye,Ae(i.wrapper.ownerDocument,"mousemove",Ge),Ae(i.wrapper.ownerDocument,"mouseup",Ye)}function Xl(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(ut(n,r)==0&&n.sticky==r.sticky)return t;var x=Ke(i);if(!x)return t;var N=Be(x,n.ch,n.sticky),K=x[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var z=N+(K.from==n.ch==(K.level!=1)?0:1);if(z==0||z==x.length)return t;var Y;if(r.line!=n.line)Y=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=Be(x,r.ch,r.sticky),de=ae-N||(r.ch-n.ch)*(K.level==1?-1:1);ae==z-1||ae==z?Y=de<0:Y=de>0}var xe=x[z+(Y?-1:0)],ve=Y==(xe.level==1),Pe=ve?xe.from:xe.to,ke=ve?"after":"before";return n.ch==Pe&&n.sticky==ke?t:new vt(new Ue(n.line,Pe,ke),r)}function hs(e,t,n,r){var i,x;if(t.touches)i=t.touches[0].clientX,x=t.touches[0].clientY;else try{i=t.clientX,x=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(x>K.bottom||!le(e,n))return te(t);x-=K.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=N.gutters.childNodes[z];if(Y&&Y.getBoundingClientRect().right>=i){var ae=Cr(e.doc,x),de=e.display.gutterSpecs[z];return Re(e,n,e,ae,de.className,t),te(t)}}}function Ra(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Lr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Jn(e)}var Mn={toString:function(){return"CodeMirror.Init"}},gs={},Xi={};function $l(e){var t=e.optionHandlers;function n(r,i,x,N){e.defaults[r]=i,x&&(t[r]=N?function(K,z,Y){Y!=Mn&&x(K,z,Y)}:x)}e.defineOption=n,e.Init=Mn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ii(r),Jn(r),Qt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],N=r.doc.first;r.doc.iter(function(z){for(var Y=0;;){var ae=z.text.indexOf(i,Y);if(ae==-1)break;Y=ae+i.length,x.push(Ue(N,ae))}N++});for(var K=x.length-1;K>=0;K--)Dn(r.doc,i,x[K],Ue(x[K].line,x[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=Mn&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),ni(r)},!0),n("keyMap","default",function(r,i,x){var N=zi(i),K=x!=Mn&&zi(x);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ba(i,r.options.lineNumbers),ni(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Cn(r)},!0),n("scrollbarStyle","native",function(r){yo(r),Cn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ba(r.options.gutters,i),ni(r)},!0),n("firstLineNumber",1,ni,!0),n("lineNumberFormatter",function(r){return r},ni,!0),n("showCursorWhenSelecting",!1,Qn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Sn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Qn,!0),n("singleCursorHeightPerLine",!0,Qn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ii,!0),n("addModeClass",!1,ii,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,ii,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Mn;if(!t!=!r){var i=e.display.dragFunctions,x=t?Ae:Je;x(e.display.scroller,"dragstart",i.start),x(e.display.scroller,"dragenter",i.enter),x(e.display.scroller,"dragover",i.over),x(e.display.scroller,"dragleave",i.leave),x(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),mr(e)),da(e),Qt(e),Jn(e),setTimeout(function(){return Cn(e)},100)}function At(e,t){var n=this;if(!(this instanceof At))return new At(e,t);this.options=t=t?P(t):{},P(gs,t,!1);var r=t.value;typeof r=="string"?r=new Zt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new At.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(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 X,keySeq:null,specialChars:null},t.autofocus&&!o&&x.input.focus(),B&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),sn(this),this.curOp.forceUpdate=!0,Lo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):Sn(this);for(var N in Xi)Xi.hasOwnProperty(N)&&Xi[N](this,t[N],Mn);xo(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Pa.length;++K)Pa[K](this);ln(this),D&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}At.defaults=gs,At.optionHandlers=Xi;function Zl(e){var t=e.display;Ae(t.scroller,"mousedown",Ft(e,cs)),B&&I<11?Ae(t.scroller,"dblclick",Ft(e,function(z){if(Fe(e,z))return;var Y=rn(e,z);if(!Y||Ra(e,z)||Lr(e.display,z))return;$(z);var ae=e.findWordAt(Y);ji(e.doc,ae.anchor,ae.head)})):Ae(t.scroller,"dblclick",function(z){return Fe(e,z)||$(z)}),Ae(t.scroller,"contextmenu",function(z){return ms(e,z)}),Ae(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||ms(e,z)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function x(z){if(z.touches.length!=1)return!1;var Y=z.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function N(z,Y){if(Y.left==null)return!0;var ae=Y.left-z.left,de=Y.top-z.top;return ae*ae+de*de>20*20}Ae(t.scroller,"touchstart",function(z){if(!Fe(e,z)&&!x(z)&&!Ra(e,z)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(z){var Y=t.activeTouch;if(Y&&!Lr(t,z)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var ae=e.coordsChar(t.activeTouch,"page"),de;!Y.prev||N(Y,Y.prev)?de=new vt(ae,ae):!Y.prev.prev||N(Y,Y.prev.prev)?de=e.findWordAt(ae):de=new vt(Ue(ae.line,0),lt(e.doc,Ue(ae.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),$(z)}i()}),Ae(t.scroller,"touchcancel",i),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qn(e,t.scroller.scrollTop),an(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(z){return wo(e,z)}),Ae(t.scroller,"DOMMouseScroll",function(z){return wo(e,z)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Fe(e,z)||ie(z)},over:function(z){Fe(e,z)||(Ll(e,z),ie(z))},start:function(z){return Al(e,z)},drop:Ft(e,_l),leave:function(z){Fe(e,z)||Zo(e)}};var K=t.input.getField();Ae(K,"keyup",function(z){return us.call(e,z)}),Ae(K,"keydown",Ft(e,ls)),Ae(K,"keypress",Ft(e,ds)),Ae(K,"focus",function(z){return fa(e,z)}),Ae(K,"blur",function(z){return Sn(e,z)})}var Pa=[];At.defineInitHook=function(e){return Pa.push(e)};function vi(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=rr(e,t).state:n="prev");var N=e.options.tabSize,K=et(i,t),z=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var Y=K.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(K.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(x,K.text.slice(Y.length),K.text),ae==be||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=H(et(i,t-1).text,null,N):ae=0:n=="add"?ae=z+e.options.indentUnit:n=="subtract"?ae=z-e.options.indentUnit:typeof n=="number"&&(ae=z+n),ae=Math.max(0,ae);var de="",xe=0;if(e.options.indentWithTabs)for(var ve=Math.floor(ae/N);ve;--ve)xe+=N,de+=" ";if(xe<ae&&(de+=he(ae-xe)),de!=Y)return Dn(i,de,Ue(t,0),Ue(t,Y.length),"+input"),K.stateAfter=null,!0;for(var Pe=0;Pe<i.sel.ranges.length;Pe++){var ke=i.sel.ranges[Pe];if(ke.head.line==t&&ke.head.ch<Y.length){var Ne=Ue(t,Y.length);Ca(i,Pe,new vt(Ne,Ne));break}}}var vr=null;function Yi(e){vr=e}function Ma(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,z=mt(t),Y=null;if(K&&r.ranges.length>1)if(vr&&vr.text.join(`
|
|
`)==t){if(r.ranges.length%vr.text.length==0){Y=[];for(var ae=0;ae<vr.text.length;ae++)Y.push(x.splitLines(vr.text[ae]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=oe(z,function(Ge){return[Ge]}));for(var de=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ve=r.ranges[xe],Pe=ve.from(),ke=ve.to();ve.empty()&&(n&&n>0?Pe=Ue(Pe.line,Pe.ch-n):e.state.overwrite&&!K?ke=Ue(ke.line,Math.min(et(x,ke.line).text.length,ke.ch+J(z).length)):K&&vr&&vr.lineWise&&vr.text.join(`
|
|
`)==z.join(`
|
|
`)&&(Pe=ke=Ue(Pe.line,0)));var Ne={from:Pe,to:ke,text:Y?Y[xe%Y.length]:z,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Ln(e.doc,Ne),Ht(e,"inputRead",e,Ne)}t&&!K&&ys(e,t),wn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&nr(t,function(){return Ma(t,n,0,null,"paste")}),!0}function ys(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 i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var x=e.getModeAt(i.head),N=!1;if(x.electricChars){for(var K=0;K<x.electricChars.length;K++)if(t.indexOf(x.electricChars.charAt(K))>-1){N=vi(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=vi(e,i.head.line,"smart")));N&&Ht(e,"electricInput",e,i.head.line)}}function bs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:Ue(i,0),head:Ue(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Es(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,i){var x=this.options,N=x[r];if(x[r]==i&&r!="mode")return;x[r]=i,t.hasOwnProperty(r)&&Ft(this,t[r])(this,i,N),Re(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,x=0;x<i.length;++x)if(i[x]==r||i[x].name==r)return i.splice(x,1),!0},addOverlay:$t(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");q(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,Qt(this)}),removeOverlay:$t(function(r){for(var i=this.state.overlays,x=0;x<i.length;++x){var N=i[x].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(x,1),this.state.modeGen++,Qt(this);return}}}),indentLine:$t(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Rr(this.doc,r)&&vi(this,r,i,x)}),indentSelection:$t(function(r){for(var i=this.doc.sel.ranges,x=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>x&&(vi(this,K.head.line,r,!0),x=K.head.line,N==this.doc.sel.primIndex&&wn(this));else{var z=K.from(),Y=K.to(),ae=Math.max(x,z.line);x=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var de=ae;de<x;++de)vi(this,de,r);var xe=this.doc.sel.ranges;z.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Ca(this.doc,N,new vt(z,xe[N].to()),fe)}}}),getTokenAt:function(r,i){return Ar(this,r,i)},getLineTokens:function(r,i){return Ar(this,Ue(r),i,!0)},getTokenTypeAt:function(r){r=lt(this.doc,r);var i=Bn(this,et(this.doc,r.line)),x=0,N=(i.length-1)/2,K=r.ch,z;if(K==0)z=i[2];else for(;;){var Y=x+N>>1;if((Y?i[Y*2-1]:0)>=K)N=Y;else if(i[Y*2+1]<K)x=Y+1;else{z=i[Y*2+2];break}}var ae=z?z.indexOf("overlay "):-1;return ae<0?z:ae==0?null:z.slice(0,ae-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var x=[];if(!n.hasOwnProperty(i))return x;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&x.push(N[K[i]]);else if(K[i])for(var z=0;z<K[i].length;z++){var Y=N[K[i][z]];Y&&x.push(Y)}else K.helperType&&N[K.helperType]?x.push(N[K.helperType]):N[K.name]&&x.push(N[K.name]);for(var ae=0;ae<N._global.length;ae++){var de=N._global[ae];de.pred(K,this)&&Z(x,de.val)==-1&&x.push(de.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=$r(x,r==null?x.first+x.size-1:r),rr(this,r+1,i).state},cursorCoords:function(r,i){var x,N=this.doc.sel.primary();return r==null?x=N.head:typeof r=="object"?x=lt(this.doc,r):x=r?N.from():N.to(),pr(this,x,i||"page")},charCoords:function(r,i){return ia(this,lt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,Cr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var N=!1,K;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,N=!0),K=et(this.doc,r)}else K=r;return Oi(this,K,{top:0,left:0},i||"page",x||N).top+(N?this.doc.height-_t(K):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Tn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,N,K){var z=this.display;r=pr(this,lt(this.doc,r));var Y=r.bottom,ae=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")Y=r.top;else if(N=="above"||N=="near"){var de=Math.max(z.wrapper.clientHeight,this.doc.height),xe=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>de)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=de&&(Y=r.bottom),ae+i.offsetWidth>xe&&(ae=xe-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(ae=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ae=0:K=="middle"&&(ae=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),x&&Js(this,{left:ae,top:Y,right:ae+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:$t(ls),triggerOnKeyPress:$t(ds),triggerOnKeyUp:us,triggerOnMouseDown:$t(cs),execCommand:function(r){if(hi.hasOwnProperty(r))return hi[r].call(null,this)},triggerElectric:$t(function(r){ys(this,r)}),findPosH:function(r,i,x,N){var K=1;i<0&&(K=-1,i=-i);for(var z=lt(this.doc,r),Y=0;Y<i&&!(z=ka(this.doc,z,K,x,N),z.hitSide);++Y);return z},moveH:$t(function(r,i){var x=this;this.extendSelectionsBy(function(N){return x.display.shift||x.doc.extend||N.empty()?ka(x.doc,N.head,r,i,x.options.rtlMoveVisually):r<0?N.from():N.to()},pe)}),deleteH:$t(function(r,i){var x=this.doc.sel,N=this.doc;x.somethingSelected()?N.replaceSelection("",null,"+delete"):Pn(this,function(K){var z=ka(N,K.head,r,i,!1);return r<0?{from:z,to:K.head}:{from:K.head,to:z}})}),findPosV:function(r,i,x,N){var K=1,z=N;i<0&&(K=-1,i=-i);for(var Y=lt(this.doc,r),ae=0;ae<i;++ae){var de=pr(this,Y,"div");if(z==null?z=de.left:de.left=z,Y=Ts(this,de,K,x),Y.hitSide)break}return Y},moveV:$t(function(r,i){var x=this,N=this.doc,K=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ae){if(z)return r<0?ae.from():ae.to();var de=pr(x,ae.head,"div");ae.goalColumn!=null&&(de.left=ae.goalColumn),K.push(de.left);var xe=Ts(x,de,r,i);return i=="page"&&ae==N.sel.primary()&&ma(x,ia(x,xe,"div").top-de.top),xe},pe),K.length)for(var Y=0;Y<N.sel.ranges.length;Y++)N.sel.ranges[Y].goalColumn=K[Y]}),findWordAt:function(r){var i=this.doc,x=et(i,r.line).text,N=r.ch,K=r.ch;if(x){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||K==x.length)&&N?--N:++K;for(var Y=x.charAt(N),ae=_e(Y,z)?function(de){return _e(de,z)}:/\s/.test(Y)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!_e(de)};N>0&&ae(x.charAt(N-1));)--N;for(;K<x.length&&ae(x.charAt(K));)++K}return new vt(Ue(r.line,N),Ue(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==k()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$t(function(r,i){Zn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-br(this)-this.display.barHeight,width:r.scrollWidth-br(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:en(this)}},scrollIntoView:$t(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ue(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):mo(this,r.from,r.to,r.margin)}),setSize:$t(function(r,i){var x=this,N=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&qa(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(z){if(z.widgets){for(var Y=0;Y<z.widgets.length;Y++)if(z.widgets[Y].noHScroll){Fr(x,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(r){return nr(this,r)},startOperation:function(){return sn(this)},endOperation:function(){return ln(this)},refresh:$t(function(){var r=this.display.cachedTextHeight;Qt(this),this.curOp.forceUpdate=!0,Jn(this),Zn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-xn(this.display))>.5||this.options.lineWrapping)&&da(this),Re(this,"refresh",this)}),swapDoc:$t(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Lo(this,r),Jn(this),this.display.input.reset(),Zn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ht(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[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}},ue(e),e.registerHelper=function(r,i,x){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=x},e.registerGlobalHelper=function(r,i,x,N){e.registerHelper(r,i,N),n[r]._global.push({pred:x,val:N})}}function ka(e,t,n,r,i){var x=t,N=n,K=et(e,t.line),z=i&&e.direction=="rtl"?-n:n;function Y(){var Ye=t.line+z;return Ye<e.first||Ye>=e.first+e.size?!1:(t=new Ue(Ye,t.ch,t.sticky),K=et(e,Ye))}function ae(Ye){var ze;if(r=="codepoint"){var Ze=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Ze)?ze=null:ze=new Ue(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(Ze>=55296&&Ze<56320?2:1))),-n)}else i?ze=kl(e.cm,K,t,n):ze=Aa(K,t,n);if(ze==null)if(!Ye&&Y())t=La(i,e.cm,K,t.line,z);else return!1;else t=ze;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var de=null,xe=r=="group",ve=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!ae(!Pe));Pe=!1){var ke=K.text.charAt(t.ch)||`
|
|
`,Ne=_e(ke,ve)?"w":xe&&ke==`
|
|
`?"n":!xe||/\s/.test(ke)?null:"p";if(xe&&!Pe&&!Ne&&(Ne="s"),de&&de!=Ne){n<0&&(n=1,ae(),t.sticky="after");break}if(Ne&&(de=Ne),n>0&&!ae(!Pe))break}var Ge=Hi(e,t,x,N,!0);return je(x,Ge)&&(Ge.hitSide=!0),Ge}function Ts(e,t,n,r){var i=e.doc,x=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*xn(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var Y;!(Y=oa(e,x,N),!Y.outside);){if(n<0?N<=0:N>=i.height){Y.hitSide=!0;break}N+=n*5}return Y}var bt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};bt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Ae(i,"paste",function(K){if(!x(K)||Fe(r,K)||vs(K,r))return;I<=11&&setTimeout(Ft(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Ae(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Ae(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(i,"touchstart",function(){return n.forceCompositionEnd()}),Ae(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!x(K)||Fe(r,K))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=bs(r);Yi({lineWise:!0,text:z.text}),K.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,fe),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Y=vr.text.join(`
|
|
`);if(K.clipboardData.setData("Text",Y),K.clipboardData.getData("Text")==Y){K.preventDefault();return}}var ae=xs(),de=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),de.value=vr.text.join(`
|
|
`);var xe=document.activeElement;W(de),setTimeout(function(){r.display.lineSpace.removeChild(ae),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Ae(i,"copy",N),Ae(i,"cut",N)},bt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},bt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},bt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},bt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},bt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var x=$i(t,e.anchorNode,e.anchorOffset),N=$i(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&N&&!N.bad&&ut(Yr(x,N),r)==0&&ut(hn(x,N),i)==0)return;var K=t.display.view,z=r.line>=t.display.viewFrom&&Ss(t,r)||{node:K[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Ss(t,i);if(!Y){var ae=K[K.length-1].measure,de=ae.maps?ae.maps[ae.maps.length-1]:ae.map;Y={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!z||!Y){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),ve;try{ve=g(z.node,z.offset,Y.offset,Y.node)}catch(Pe){}ve&&(!A&&t.state.focused?(e.collapse(z.node,z.offset),ve.collapsed||(e.removeAllRanges(),e.addRange(ve))):(e.removeAllRanges(),e.addRange(ve)),xe&&e.anchorNode==null?e.addRange(xe):A&&this.startGracePeriod()),this.rememberSelection()},bt.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)},bt.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},bt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},bt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},bt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},bt.prototype.blur=function(){this.div.blur()},bt.prototype.getField=function(){return this.div},bt.prototype.supportsTouch=function(){return!0},bt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():nr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},bt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},bt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&E&&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=$i(t,e.anchorNode,e.anchorOffset),r=$i(t,e.focusNode,e.focusOffset);n&&r&&nr(t,function(){Vt(t.doc,Br(n,r),fe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},bt.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(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ue(r.line-1,et(e.doc,r.line-1).length)),i.ch==et(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ue(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,N,K;r.line==t.viewFrom||(x=nn(e,r.line))==0?(N=gt(t.view[0].line),K=t.view[0].node):(N=gt(t.view[x].line),K=t.view[x-1].node.nextSibling);var z=nn(e,i.line),Y,ae;if(z==t.view.length-1?(Y=t.viewTo-1,ae=t.lineDiv.lastChild):(Y=gt(t.view[z+1].line)-1,ae=t.view[z+1].node.previousSibling),!K)return!1;for(var de=e.doc.splitLines(tu(e,K,ae,N,Y)),xe=wr(e.doc,Ue(N,0),Ue(Y,et(e.doc,Y).text.length));de.length>1&&xe.length>1;)if(J(de)==J(xe))de.pop(),xe.pop(),Y--;else if(de[0]==xe[0])de.shift(),xe.shift(),N++;else break;for(var ve=0,Pe=0,ke=de[0],Ne=xe[0],Ge=Math.min(ke.length,Ne.length);ve<Ge&&ke.charCodeAt(ve)==Ne.charCodeAt(ve);)++ve;for(var Ye=J(de),ze=J(xe),Ze=Math.min(Ye.length-(de.length==1?ve:0),ze.length-(xe.length==1?ve:0));Pe<Ze&&Ye.charCodeAt(Ye.length-Pe-1)==ze.charCodeAt(ze.length-Pe-1);)++Pe;if(de.length==1&&xe.length==1&&N==r.line)for(;ve&&ve>r.ch&&Ye.charCodeAt(Ye.length-Pe-1)==ze.charCodeAt(ze.length-Pe-1);)ve--,Pe++;de[de.length-1]=Ye.slice(0,Ye.length-Pe).replace(/^\u200b+/,""),de[0]=de[0].slice(ve).replace(/\u200b+$/,"");var at=Ue(N,ve),nt=Ue(Y,xe.length?J(xe).length-Pe:0);if(de.length>1||de[0]||ut(at,nt))return Dn(e.doc,de,at,nt,"+input"),!0},bt.prototype.ensurePolled=function(){this.forceCompositionEnd()},bt.prototype.reset=function(){this.forceCompositionEnd()},bt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},bt.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)},bt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&nr(this.cm,function(){return Qt(e.cm)})},bt.prototype.setUneditable=function(e){e.contentEditable="false"},bt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Ft(this.cm,Ma)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},bt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},bt.prototype.onContextMenu=function(){},bt.prototype.resetPosition=function(){},bt.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Ya(n,r,t.line),x=Ke(r,e.doc.direction),N="left";if(x){var K=Be(x,t.ch);N=K%2?"right":"left"}var z=Qa(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",N=!1,K=e.doc.lineSeparator(),z=!1;function Y(ve){return function(Pe){return Pe.id==ve}}function ae(){N&&(x+=K,z&&(x+=K),N=z=!1)}function de(ve){ve&&(ae(),x+=ve)}function xe(ve){if(ve.nodeType==1){var Pe=ve.getAttribute("cm-text");if(Pe){de(Pe);return}var ke=ve.getAttribute("cm-marker"),Ne;if(ke){var Ge=e.findMarks(Ue(r,0),Ue(i+1,0),Y(+ke));Ge.length&&(Ne=Ge[0].find(0))&&de(wr(e.doc,Ne.from,Ne.to).join(K));return}if(ve.getAttribute("contenteditable")=="false")return;var Ye=/^(pre|div|p|li|table|br)$/i.test(ve.nodeName);if(!/^br$/i.test(ve.nodeName)&&ve.textContent.length==0)return;Ye&&ae();for(var ze=0;ze<ve.childNodes.length;ze++)xe(ve.childNodes[ze]);/^(pre|p)$/i.test(ve.nodeName)&&(z=!0),Ye&&(N=!0)}else ve.nodeType==3&&de(ve.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,z=!1;return x}function $i(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return kn(e.clipPos(Ue(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var x=e.display.view[i];if(x.node==r)return ru(x,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!y(r,t))return kn(Ue(gt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?J(e.rest):e.line;return kn(Ue(gt(x),x.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var z=e.measure,Y=z.maps;function ae(Ne,Ge,Ye){for(var ze=-1;ze<(Y?Y.length:0);ze++)for(var Ze=ze<0?z.map:Y[ze],at=0;at<Ze.length;at+=3){var nt=Ze[at+2];if(nt==Ne||nt==Ge){var ht=gt(ze<0?e.line:e.rest[ze]),Tt=Ze[at]+Ye;return(Ye<0||nt!=Ne)&&(Tt=Ze[at+(Ye?1:0)]),Ue(ht,Tt)}}}var de=ae(N,K,n);if(de)return kn(de,i);for(var xe=K.nextSibling,ve=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(de=ae(xe,xe.firstChild,0),de)return kn(Ue(de.line,de.ch-ve),i);ve+=xe.textContent.length}for(var Pe=K.previousSibling,ke=n;Pe;Pe=Pe.previousSibling){if(de=ae(Pe,Pe.firstChild,-1),de)return kn(Ue(de.line,de.ch+ke),i);ke+=Pe.textContent.length}}var Pt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Pt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(i.style.width="0px"),Ae(i,"input",function(){B&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(N){if(Fe(r,N)||vs(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(N){if(Fe(r,N))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=bs(r);Yi({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,fe):(n.prevInput="",i.value=K.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",x),Ae(i,"copy",x),Ae(e.scroller,"paste",function(N){if(Lr(e,N)||Fe(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Ae(e.lineSpace,"selectstart",function(N){Lr(e,N)||$(N)}),Ae(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Pt.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},Pt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Pt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=pr(e,n.sel.primary().head,"div"),x=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-x.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-x.left))}return r},Pt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Pt.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&&W(this.textarea),B&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&I>=9&&(this.hasSelection=null))},Pt.prototype.getField=function(){return this.textarea},Pt.prototype.supportsTouch=function(){return!1},Pt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},Pt.prototype.blur=function(){this.textarea.blur()},Pt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Pt.prototype.receivedFocus=function(){this.slowPoll()},Pt.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()})},Pt.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)},Pt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&I>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var x=i.charCodeAt(0);if(x==8203&&!r&&(r="\u200B"),x==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return nr(t,function(){Ma(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Pt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Pt.prototype.onKeyPress=function(){B&&I>=9&&(this.hasSelection=null),this.fastPoll()},Pt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=rn(n,e),N=r.scroller.scrollTop;if(!x||_)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(x)==-1&&Ft(n,Vt)(n.doc,Br(x),fe);var z=i.style.cssText,Y=t.wrapper.style.cssText,ae=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ae.top-5)+"px; left: "+(e.clientX-ae.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var de;D&&(de=window.scrollY),r.input.focus(),D&&window.scrollTo(null,de),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ve,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var ke=n.somethingSelected(),Ne="\u200B"+(ke?i.value:"");i.value="\u21DA",i.value=Ne,t.prevInput=ke?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ne.length,r.selForContextMenu=n.doc.sel}}function ve(){if(t.contextMenuPending!=ve)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=z,B&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&I<9)&&xe();var ke=0,Ne=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ft(n,Wo)(n):ke++<10?r.detectingSelectAll=setTimeout(Ne,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ne,200)}}if(B&&I>=9&&xe(),w){ie(e);var Pe=function(){Je(window,"mouseup",Pe),setTimeout(ve,20)};Ae(window,"mouseup",Pe)}else setTimeout(ve,50)},Pt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Pt.prototype.setUneditable=function(){},Pt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?P(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=k();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var x=e.form;i=x.submit;try{var N=x.submit=function(){r(),x.submit=i,x.submit(),x.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=At(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=Je,e.on=Ae,e.wheelEventPixels=cl,e.Doc=Zt,e.splitLines=mt,e.countColumn=H,e.findColumn=ge,e.isWordChar=we,e.Pass=be,e.signal=Re,e.Line=wt,e.changeEnd=jr,e.scrollbarModel=vo,e.Pos=Ue,e.cmpPos=ut,e.modes=Wt,e.mimeModes=pt,e.resolveMode=lr,e.getMode=Sr,e.modeExtensions=hr,e.extendMode=yi,e.copyState=ur,e.startState=cn,e.innerMode=Vr,e.commands=hi,e.keyMap=Dr,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=Rn,e.normalizeKeyMap=Ml,e.StringStream=Ct,e.SharedTextMarker=di,e.TextMarker=Hr,e.LineWidget=ui,e.e_preventDefault=$,e.e_stopPropagation=Q,e.e_stop=ie,e.addClass=F,e.contains=y,e.rmClass=h,e.keyNames=Kr}$l(At),ql(At);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in Zt.prototype)Zt.prototype.hasOwnProperty(Ji)&&Z(au,Ji)<0&&(At.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(Zt.prototype[Ji]));return ue(Zt),At.inputStyles={textarea:Pt,contenteditable:bt},At.defineMode=function(e){!At.defaults.mode&&e!="null"&&(At.defaults.mode=e),Tr.apply(this,arguments)},At.defineMIME=zr,At.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),At.defineMIME("text/plain","null"),At.defineExtension=function(e,t){At.prototype[e]=t},At.defineDocExtension=function(e,t){Zt.prototype[e]=t},At.fromTextArea=nu,iu(At),At.version="5.58.2",At})},Y1PL:function(ot,He,ee){"use strict";ee.r(He),ee.d(He,"ResizableTextArea",function(){return Z});var ne=ee("wx14"),V=ee("1OyB"),A=ee("vuIU"),G=ee("Ji7U"),U=ee("LK+K"),R=ee("cDcd"),B=ee("VTBJ"),I=ee("rePB"),D=ee("Zm9Q"),L=ee("Kwbf"),E=ee("c+Xe"),_=ee("m+aA"),M=ee("bdgK"),C=new Map;function T(fe){fe.forEach(function(Te){var pe,ge=Te.target;(pe=C.get(ge))===null||pe===void 0||pe.forEach(function(ce){return ce(ge)})})}var b=new M.default(T),d=null,o=null;function s(fe,Te){C.has(fe)||(C.set(fe,new Set),b.observe(fe)),C.get(fe).add(Te)}function u(fe,Te){C.has(fe)&&(C.get(fe).delete(Te),C.get(fe).size||(b.unobserve(fe),C.delete(fe)))}var S=function(fe){Object(G.a)(pe,fe);var Te=Object(U.a)(pe);function pe(){return Object(V.a)(this,pe),Te.apply(this,arguments)}return Object(A.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(R.Component),f=R.createContext(null);function m(fe){var Te=fe.children,pe=fe.onBatchResize,ge=R.useRef(0),ce=R.useRef([]),he=R.useContext(f),J=R.useCallback(function(oe,q,ye){ge.current+=1;var Se=ge.current;ce.current.push({size:oe,element:q,data:ye}),Promise.resolve().then(function(){Se===ge.current&&(pe==null||pe(ce.current),ce.current=[])}),he==null||he(oe,q,ye)},[pe,he]);return R.createElement(f.Provider,{value:J},Te)}function w(fe){var Te=fe.children,pe=fe.disabled,ge=R.useRef(null),ce=R.useRef(null),he=R.useContext(f),J=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),oe=R.isValidElement(Te)&&Object(E.c)(Te),q=oe?Te.ref:null,ye=R.useMemo(function(){return Object(E.a)(q,ge)},[q,ge]),Se=R.useRef(fe);Se.current=fe;var me=R.useCallback(function(we){var _e=Se.current,Oe=_e.onResize,Me=_e.data,De=we.getBoundingClientRect(),Le=De.width,We=De.height,Ve=we.offsetWidth,Xe=we.offsetHeight,Be=Math.floor(Le),Qe=Math.floor(We);if(J.current.width!==Be||J.current.height!==Qe||J.current.offsetWidth!==Ve||J.current.offsetHeight!==Xe){var Ke={width:Be,height:Qe,offsetWidth:Ve,offsetHeight:Xe};J.current=Ke;var $e=Ve===Math.round(Le)?Le:Ve,Ae=Xe===Math.round(We)?We:Xe,qe=Object(B.a)(Object(B.a)({},Ke),{},{offsetWidth:$e,offsetHeight:Ae});he==null||he(qe,we,Me),Oe&&Promise.resolve().then(function(){Oe(qe,we)})}},[]);return R.useEffect(function(){var we=Object(_.a)(ge.current)||Object(_.a)(ce.current);return we&&!pe&&s(we,me),function(){return u(we,me)}},[ge.current,pe]),R.createElement(S,{ref:ce},oe?R.cloneElement(Te,{ref:ye}):Te)}var p="rc-observer-key";function h(fe){var Te=fe.children,pe=Object(D.a)(Te);return pe.map(function(ge,ce){var he=(ge==null?void 0:ge.key)||"".concat(p,"-").concat(ce);return R.createElement(w,Object(ne.a)({},fe,{key:he}),ge)})}h.Collection=m;var c=h,l=ee("bT9E"),a=ee("TSYQ"),v=ee.n(a),g=`
|
|
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
|
|
`,y=["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"],k={},F;function j(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=fe.getAttribute("id")||fe.getAttribute("data-reactid")||fe.getAttribute("name");if(Te&&k[pe])return k[pe];var ge=window.getComputedStyle(fe),ce=ge.getPropertyValue("box-sizing")||ge.getPropertyValue("-moz-box-sizing")||ge.getPropertyValue("-webkit-box-sizing"),he=parseFloat(ge.getPropertyValue("padding-bottom"))+parseFloat(ge.getPropertyValue("padding-top")),J=parseFloat(ge.getPropertyValue("border-bottom-width"))+parseFloat(ge.getPropertyValue("border-top-width")),oe=y.map(function(ye){return"".concat(ye,":").concat(ge.getPropertyValue(ye))}).join(";"),q={sizingStyle:oe,paddingSize:he,borderSize:J,boxSizing:ce};return Te&&pe&&(k[pe]=q),q}function W(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ge=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)),fe.getAttribute("wrap")?F.setAttribute("wrap",fe.getAttribute("wrap")):F.removeAttribute("wrap");var ce=j(fe,Te),he=ce.paddingSize,J=ce.borderSize,oe=ce.boxSizing,q=ce.sizingStyle;F.setAttribute("style","".concat(q,";").concat(g)),F.value=fe.value||fe.placeholder||"";var ye=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,me=F.scrollHeight,we;if(oe==="border-box"?me+=J:oe==="content-box"&&(me-=he),pe!==null||ge!==null){F.value=" ";var _e=F.scrollHeight-he;pe!==null&&(ye=_e*pe,oe==="border-box"&&(ye=ye+he+J),me=Math.max(ye,me)),ge!==null&&(Se=_e*ge,oe==="border-box"&&(Se=Se+he+J),we=me>Se?"":"hidden",me=Math.min(Se,me))}return{height:me,minHeight:ye,maxHeight:Se,overflowY:we,resize:"none"}}var O=ee("Gytx"),P=ee.n(O),H;(function(fe){fe[fe.NONE=0]="NONE",fe[fe.RESIZING=1]="RESIZING",fe[fe.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(fe){Object(G.a)(pe,fe);var Te=Object(U.a)(pe);function pe(ge){var ce;return Object(V.a)(this,pe),ce=Te.call(this,ge),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(he){ce.textArea=he},ce.handleResize=function(he){var J=ce.state.resizeStatus,oe=ce.props,q=oe.autoSize,ye=oe.onResize;if(J!==H.NONE)return;typeof ye=="function"&&ye(he),q&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var he=ce.props.autoSize;if(!he||!ce.textArea)return;var J=he.minRows,oe=he.maxRows,q=W(ce.textArea,!1,J,oe);ce.setState({textareaStyles:q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:H.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:H.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var he=ce.props,J=he.prefixCls,oe=J===void 0?"rc-textarea":J,q=he.autoSize,ye=he.onResize,Se=he.className,me=he.disabled,we=ce.state,_e=we.textareaStyles,Oe=we.resizeStatus,Me=Object(l.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=v()(oe,Se,Object(I.a)({},"".concat(oe,"-disabled"),me));"value"in Me&&(Me.value=Me.value||"");var Le=Object(B.a)(Object(B.a)(Object(B.a)({},ce.props.style),_e),Oe===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ce.handleResize,disabled:!(q||ye)},R.createElement("textarea",Object(ne.a)({},Me,{className:De,style:Le,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:H.NONE},ce}return Object(A.a)(pe,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!P()(ce.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 ce=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,he)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(R.Component),Z=X,re=function(fe){Object(G.a)(pe,fe);var Te=Object(U.a)(pe);function pe(ge){var ce;Object(V.a)(this,pe),ce=Te.call(this,ge),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(J){ce.resizableTextArea=J},ce.handleChange=function(J){var oe=ce.props.onChange;ce.setValue(J.target.value,function(){ce.resizableTextArea.resizeTextarea()}),oe&&oe(J)},ce.handleKeyDown=function(J){var oe=ce.props,q=oe.onPressEnter,ye=oe.onKeyDown;J.keyCode===13&&q&&q(J),ye&&ye(J)};var he=typeof ge.value=="undefined"||ge.value===null?ge.defaultValue:ge.value;return ce.state={value:he},ce}return Object(A.a)(pe,[{key:"setValue",value:function(ce,he){"value"in this.props||this.setState({value:ce},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(Z,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),pe}(R.Component),be=He.default=re},ZW9T:function(ot,He,ee){"use strict";ee.d(He,"a",function(){return S});var ne=ee("k1fw"),V=ee("miYZ"),A=ee("tsqr"),G=ee("rAM+"),U=ee("tJVT"),R=ee("PpiC"),B=ee("cDcd"),I=ee.n(B),D=ee("bdgK");function L(f,m,w,p,h){var c=m.getWordUntilPosition(w),l={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=p.map(function(v){return{label:v,kind:f.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:l}});return h.map(function(v){a.push(Object(ne.a)(Object(ne.a)({},v),{},{range:l}))}),a}var E=function(f){var m={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["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"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(l,a){var v=L(f,l,a,w,[m]);return{suggestions:v}}});var p=["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"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(l,a){var v=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=L(f,l,a,p,v);return{suggestions:g}}});var h=["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"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(l,a){var v=[m,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=L(f,l,a,h,v);return{suggestions:g}}})},_="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=ee("LvDl");function C(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function T(){}var b=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=f;if(Array.isArray(f)){for(var w=0;w<f.length;w++){var p=d[f[w]];if(p)return p}return m[0]}return d[m]||m}var s=null,u=He.b=function(f){var m=f.width,w=m===void 0?"100%":m,p=f.height,h=p===void 0?"100%":p,c=f.value,l=f.language,a=l===void 0?"javascript":l,v=f.style,g=v===void 0?{}:v,y=f.options,k=y===void 0?{}:y,F=f.overrideServices,j=F===void 0?{}:F,W=f.theme,O=W===void 0?"vs-dark":W,P=f.onEditBlur,H=f.onSave,X=f.autoHeight,Z=X===void 0?!1:X,re=f.forbidCopy,be=re===void 0?!1:re,fe=f.onChange,Te=fe===void 0?T:fe,pe=f.editorDidMount,ge=pe===void 0?T:pe,ce=f.onFocus,he=ce===void 0?T:ce,J=f.filename,oe=J===void 0?"educoder.txt":J,q=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ye=Object(B.useRef)(),Se=Object(B.useRef)({}),me=Object(B.useRef)(),we=Object(B.useRef)(!1),_e=Object(B.useRef)(),Oe=Object(B.useState)(!1),Me=Object(U.a)(Oe,2),De=Me[0],Le=Me[1];function We(){var te;return ye.current&&(te=new D.default(function(ie){var Ee=Object(G.a)(ie),Ce;try{for(Ee.s();!(Ce=Ee.n()).done;){var Ie=Ce.value;(Ie.target.offsetHeight>0||Ie.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(tt){Ee.e(tt)}finally{Ee.f()}}),te.observe(ye.current)),te}function Ve(){A.b.warn(decodeURIComponent(_))}var Xe=function(){var ie=Se.current.instance;if(c!=null&&ie&&De){var Ee=ie.getModel();Ee&&c!==Ee.getValue()&&(b=!0,Ee.setValue(c),ie.layout(),b=!1)}};Object(B.useEffect)(function(){me.current&&clearTimeout(me.current),me.current=setTimeout(function(){Xe()},500)},[c,De,Se.current]);function Be(){var te=Se.current.instance;if(te){var ie=te.getSelection(),Ee=Se.current.pastePos||{},Ce=new s.Range(Ee.startLineNumber||ie.endLineNumber,Ee.startColumn||ie.endColumn,Ee.endLineNumber||ie.endLineNumber,Ee.endColumn||ie.endColumn);setTimeout(function(){te.executeEdits("",[{range:Ce,text:""}])},300)}}function Qe(te){(window.navigator.platform.match("Mac")?te.metaKey:te.ctrlKey)&&te.keyCode==83&&(te.preventDefault(),H())}var Ke=function(){if(Z&&Se.current.instance){var ie=Se.current.instance.getContentHeight();$(ie<h?h:ie)}else $(h)};function $e(te){var ie=document.createEvent("MouseEvents");ie.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),te.dispatchEvent(ie)}function Ae(te,ie){var Ee=window.URL||window.webkitURL||window,Ce=new Blob([ie]),Ie=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ie.href=Ee.createObjectURL(Ce),Ie.download=te,$e(Ie)}Object(B.useEffect)(function(){Ke()},[Ke]),Object(B.useEffect)(function(){ye.current&&!De&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(te){try{s=te,Se.current.instance=s.editor.create(ye.current,{value:c,language:o(a),theme:O,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var ie=Se.current.instance;if(ge(ie,s),setTimeout(function(){Ke(),Se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ae(oe||"educoder.txt",ie.getValue())}})},500),Se.current.subscription=ie.onDidChangeModelContent(function(Ce){we.current?clearTimeout(_e.current):(Ke(),Te(ie.getValue(),Ce)),_e.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||E(s),be&&(ie.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ve(),null}),ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ve(),null})),window.Monaco=s,P&&ie.onDidBlurEditorWidget(function(){P(ie.getValue())}),he&&ie.onDidFocusEditorText(function(){he(ie.getValue())}),be){ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ve(),null}),ie.onDidPaste(function(Ce){Se.current.pastePos=Ce});try{window.addEventListener("paste",Be)}catch(Ce){}}var Ee=We();return Le(!0),function(){var Ce=Se.current.instance;Ce.dispose();var Ie=Ce.getModel();Ie&&Ie.dispose(),Se.current.subscription&&Se.current.subscription.dispose(),be&&window.removeEventListener("paste",Be),Ee.unobserve(ye.current)}}catch(Ce){}})},[]),Object(B.useEffect)(function(){var te=Se.current.instance;if(te&&De)return document.addEventListener("keydown",Qe,!1),function(){document.removeEventListener("keydown",Qe)}},[H,De]),Object(B.useEffect)(function(){var te=Se.current.instance;if(te&&De){var ie=o(a);s.editor.setModelLanguage(te.getModel(),ie),console.log("language:",a,te.getModel(),ie)}},[a,De]),Object(B.useEffect)(function(){var te=Se.current.instance;te&&De&&s.editor.setTheme(O)},[O,De]),Object(B.useEffect)(function(){var te=Se.current.instance;te&&De&&(te.updateOptions(Object(ne.a)({},k)),setTimeout(function(){te.getModel().updateOptions(Object(ne.a)({},k))},200))},[JSON.stringify(k),De]),Object(B.useEffect)(function(){var te=Se.current.instance;te&&De&&te.layout()},[w,h,De]);var qe=Object(B.useState)(C(w)),Je=Object(U.a)(qe,2),Re=Je[0],Fe=Je[1],se=Object(B.useState)(C(h)),le=Object(U.a)(se,2),ue=le[0],$=le[1],Q=Object(ne.a)(Object(ne.a)({},g),{},{width:Re,height:ue});return I.a.createElement("div",{className:"my-monaco-editor",ref:ye,style:Q})};function S(f){var m=f.width,w=m===void 0?"100%":m,p=f.height,h=p===void 0?"100%":p,c=f.original,l=f.modified,a=f.language,v=f.options,g=v===void 0?{}:v,y=Object(B.useRef)(),k=Object(B.useState)(null),F=Object(U.a)(k,2),j=F[0],W=F[1];function O(Z){var re;return y.current&&(re=new D.default(function(be){var fe=Object(G.a)(be),Te;try{for(fe.s();!(Te=fe.n()).done;){var pe=Te.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&Z.layout()}}catch(ge){fe.e(ge)}finally{fe.f()}}),re.observe(y.current)),re}Object(B.useEffect)(function(){y.current&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(Z){s=Z;var re=s.editor.createDiffEditor(y.current,Object(ne.a)(Object(ne.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},g),{},{wordWrap:!0}));W(re);var be=O(re);return function(){re.dispose();var fe=re.getModel();fe&&fe.dispose(),be.unobserve(y.current)}})},[]),Object(B.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(l,a)})},[c,l,a,j]);var P=C(w),H=C(h),X={width:P,height:H};return I.a.createElement("div",{className:"my-diff-editor",ref:y,style:X})}},ZpRC:function(ot,He,ee){"use strict";function ne(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function V(E,_){return(!_||E!=="hidden")&&E!=="visible"&&E!=="clip"}function A(E,_){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var M=getComputedStyle(E,null);return V(M.overflowY,_)||V(M.overflowX,_)||function(C){var T=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!T&&(T.clientHeight<C.scrollHeight||T.clientWidth<C.scrollWidth)}(E)}return!1}function G(E,_,M,C,T,b,d,o){return b<E&&d>_||b>E&&d<_?0:b<=E&&o<=M||d>=_&&o>=M?b-E-C:d>_&&o<M||b<E&&o>M?d-_+T:0}var U=function(E,_){var M=window,C=_.scrollMode,T=_.block,b=_.inline,d=_.boundary,o=_.skipOverflowHiddenElements,s=typeof d=="function"?d:function(_e){return _e!==d};if(!ne(E))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,S=[],f=E;ne(f)&&s(f);){if((f=f.parentElement)===u){S.push(f);break}f!=null&&f===document.body&&A(f)&&!A(document.documentElement)||f!=null&&A(f,o)&&S.push(f)}for(var m=M.visualViewport?M.visualViewport.width:innerWidth,w=M.visualViewport?M.visualViewport.height:innerHeight,p=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=E.getBoundingClientRect(),l=c.height,a=c.width,v=c.top,g=c.right,y=c.bottom,k=c.left,F=T==="start"||T==="nearest"?v:T==="end"?y:v+l/2,j=b==="center"?k+a/2:b==="end"?g:k,W=[],O=0;O<S.length;O++){var P=S[O],H=P.getBoundingClientRect(),X=H.height,Z=H.width,re=H.top,be=H.right,fe=H.bottom,Te=H.left;if(C==="if-needed"&&v>=0&&k>=0&&y<=w&&g<=m&&v>=re&&y<=fe&&k>=Te&&g<=be)return W;var pe=getComputedStyle(P),ge=parseInt(pe.borderLeftWidth,10),ce=parseInt(pe.borderTopWidth,10),he=parseInt(pe.borderRightWidth,10),J=parseInt(pe.borderBottomWidth,10),oe=0,q=0,ye="offsetWidth"in P?P.offsetWidth-P.clientWidth-ge-he:0,Se="offsetHeight"in P?P.offsetHeight-P.clientHeight-ce-J:0;if(u===P)oe=T==="start"?F:T==="end"?F-w:T==="nearest"?G(h,h+w,w,ce,J,h+F,h+F+l,l):F-w/2,q=b==="start"?j:b==="center"?j-m/2:b==="end"?j-m:G(p,p+m,m,ge,he,p+j,p+j+a,a),oe=Math.max(0,oe+h),q=Math.max(0,q+p);else{oe=T==="start"?F-re-ce:T==="end"?F-fe+J+Se:T==="nearest"?G(re,fe,X,ce,J+Se,F,F+l,l):F-(re+X/2)+Se/2,q=b==="start"?j-Te-ge:b==="center"?j-(Te+Z/2)+ye/2:b==="end"?j-be+he+ye:G(Te,be,Z,ge,he+ye,j,j+a,a);var me=P.scrollLeft,we=P.scrollTop;F+=we-(oe=Math.max(0,Math.min(we+oe,P.scrollHeight-X+Se))),j+=me-(q=Math.max(0,Math.min(me+q,P.scrollWidth-Z+ye)))}W.push({el:P,top:oe,left:q})}return W};function R(E){return E===Object(E)&&Object.keys(E).length!==0}function B(E,_){_===void 0&&(_="auto");var M="scrollBehavior"in document.body.style;E.forEach(function(C){var T=C.el,b=C.top,d=C.left;T.scroll&&M?T.scroll({top:b,left:d,behavior:_}):(T.scrollTop=b,T.scrollLeft=d)})}function I(E){return E===!1?{block:"end",inline:"nearest"}:R(E)?E:{block:"start",inline:"nearest"}}function D(E,_){var M=!E.ownerDocument.documentElement.contains(E);if(R(_)&&typeof _.behavior=="function")return _.behavior(M?[]:U(E,_));if(M)return;var C=I(_);return B(U(E,C),C.behavior)}var L=He.a=D},Zss7:function(ot,He,ee){var ne;(function(V){var A=/^\s+/,G=/\s+$/,U=0,R=V.round,B=V.min,I=V.max,D=V.random;function L(J,oe){if(J=J||"",oe=oe||{},J instanceof L)return J;if(!(this instanceof L))return new L(J,oe);var q=E(J);this._originalInput=J,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=R(100*this._a)/100,this._format=oe.format||q.format,this._gradientType=oe.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=q.ok,this._tc_id=U++}L.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 J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),oe,q,ye,Se,me,we;return oe=J.r/255,q=J.g/255,ye=J.b/255,oe<=.03928?Se=oe/12.92:Se=V.pow((oe+.055)/1.055,2.4),q<=.03928?me=q/12.92:me=V.pow((q+.055)/1.055,2.4),ye<=.03928?we=ye/12.92:we=V.pow((ye+.055)/1.055,2.4),.2126*Se+.7152*me+.0722*we},setAlpha:function(J){return this._a=W(J),this._roundA=R(100*this._a)/100,this},toHsv:function(){var J=T(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=T(this._r,this._g,this._b),oe=R(J.h*360),q=R(J.s*100),ye=R(J.v*100);return this._a==1?"hsv("+oe+", "+q+"%, "+ye+"%)":"hsva("+oe+", "+q+"%, "+ye+"%, "+this._roundA+")"},toHsl:function(){var J=M(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=M(this._r,this._g,this._b),oe=R(J.h*360),q=R(J.s*100),ye=R(J.l*100);return this._a==1?"hsl("+oe+", "+q+"%, "+ye+"%)":"hsla("+oe+", "+q+"%, "+ye+"%, "+this._roundA+")"},toHex:function(J){return d(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(O(this._r,255)*100)+"%",g:R(O(this._g,255)*100)+"%",b:R(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%)":"rgba("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var oe="#"+s(this._r,this._g,this._b,this._a),q=oe,ye=this._gradientType?"GradientType = 1, ":"";if(J){var Se=L(J);q="#"+s(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+ye+"startColorstr="+oe+",endColorstr="+q+")"},toString:function(J){var oe=!!J;J=J||this._format;var q=!1,ye=this._a<1&&this._a>=0,Se=!oe&&ye&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Se?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(q=this.toRgbString()),J==="prgb"&&(q=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(q=this.toHexString()),J==="hex3"&&(q=this.toHexString(!0)),J==="hex4"&&(q=this.toHex8String(!0)),J==="hex8"&&(q=this.toHex8String()),J==="name"&&(q=this.toName()),J==="hsl"&&(q=this.toHslString()),J==="hsv"&&(q=this.toHsvString()),q||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function(J,oe){var q=J.apply(null,[this].concat([].slice.call(oe)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(p,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function(J,oe){return J.apply(null,[this].concat([].slice.call(oe)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},L.fromRatio=function(J,oe){if(typeof J=="object"){var q={};for(var ye in J)J.hasOwnProperty(ye)&&(ye==="a"?q[ye]=J[ye]:q[ye]=be(J[ye]));J=q}return L(J,oe)};function E(J){var oe={r:0,g:0,b:0},q=1,ye=null,Se=null,me=null,we=!1,_e=!1;return typeof J=="string"&&(J=ce(J)),typeof J=="object"&&(ge(J.r)&&ge(J.g)&&ge(J.b)?(oe=_(J.r,J.g,J.b),we=!0,_e=String(J.r).substr(-1)==="%"?"prgb":"rgb"):ge(J.h)&&ge(J.s)&&ge(J.v)?(ye=be(J.s),Se=be(J.v),oe=b(J.h,ye,Se),we=!0,_e="hsv"):ge(J.h)&&ge(J.s)&&ge(J.l)&&(ye=be(J.s),me=be(J.l),oe=C(J.h,ye,me),we=!0,_e="hsl"),J.hasOwnProperty("a")&&(q=J.a)),q=W(q),{ok:we,format:J.format||_e,r:B(255,I(oe.r,0)),g:B(255,I(oe.g,0)),b:B(255,I(oe.b,0)),a:q}}function _(J,oe,q){return{r:O(J,255)*255,g:O(oe,255)*255,b:O(q,255)*255}}function M(J,oe,q){J=O(J,255),oe=O(oe,255),q=O(q,255);var ye=I(J,oe,q),Se=B(J,oe,q),me,we,_e=(ye+Se)/2;if(ye==Se)me=we=0;else{var Oe=ye-Se;we=_e>.5?Oe/(2-ye-Se):Oe/(ye+Se);switch(ye){case J:me=(oe-q)/Oe+(oe<q?6:0);break;case oe:me=(q-J)/Oe+2;break;case q:me=(J-oe)/Oe+4;break}me/=6}return{h:me,s:we,l:_e}}function C(J,oe,q){var ye,Se,me;J=O(J,360),oe=O(oe,100),q=O(q,100);function we(Me,De,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?Me+(De-Me)*6*Le:Le<1/2?De:Le<2/3?Me+(De-Me)*(2/3-Le)*6:Me}if(oe===0)ye=Se=me=q;else{var _e=q<.5?q*(1+oe):q+oe-q*oe,Oe=2*q-_e;ye=we(Oe,_e,J+1/3),Se=we(Oe,_e,J),me=we(Oe,_e,J-1/3)}return{r:ye*255,g:Se*255,b:me*255}}function T(J,oe,q){J=O(J,255),oe=O(oe,255),q=O(q,255);var ye=I(J,oe,q),Se=B(J,oe,q),me,we,_e=ye,Oe=ye-Se;if(we=ye===0?0:Oe/ye,ye==Se)me=0;else{switch(ye){case J:me=(oe-q)/Oe+(oe<q?6:0);break;case oe:me=(q-J)/Oe+2;break;case q:me=(J-oe)/Oe+4;break}me/=6}return{h:me,s:we,v:_e}}function b(J,oe,q){J=O(J,360)*6,oe=O(oe,100),q=O(q,100);var ye=V.floor(J),Se=J-ye,me=q*(1-oe),we=q*(1-Se*oe),_e=q*(1-(1-Se)*oe),Oe=ye%6,Me=[q,we,me,me,_e,q][Oe],De=[_e,q,q,we,me,me][Oe],Le=[me,me,_e,q,q,we][Oe];return{r:Me*255,g:De*255,b:Le*255}}function d(J,oe,q,ye){var Se=[re(R(J).toString(16)),re(R(oe).toString(16)),re(R(q).toString(16))];return ye&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0):Se.join("")}function o(J,oe,q,ye,Se){var me=[re(R(J).toString(16)),re(R(oe).toString(16)),re(R(q).toString(16)),re(fe(ye))];return Se&&me[0].charAt(0)==me[0].charAt(1)&&me[1].charAt(0)==me[1].charAt(1)&&me[2].charAt(0)==me[2].charAt(1)&&me[3].charAt(0)==me[3].charAt(1)?me[0].charAt(0)+me[1].charAt(0)+me[2].charAt(0)+me[3].charAt(0):me.join("")}function s(J,oe,q,ye){var Se=[re(fe(ye)),re(R(J).toString(16)),re(R(oe).toString(16)),re(R(q).toString(16))];return Se.join("")}L.equals=function(J,oe){return!J||!oe?!1:L(J).toRgbString()==L(oe).toRgbString()},L.random=function(){return L.fromRatio({r:D(),g:D(),b:D()})};function u(J,oe){oe=oe===0?0:oe||10;var q=L(J).toHsl();return q.s-=oe/100,q.s=P(q.s),L(q)}function S(J,oe){oe=oe===0?0:oe||10;var q=L(J).toHsl();return q.s+=oe/100,q.s=P(q.s),L(q)}function f(J){return L(J).desaturate(100)}function m(J,oe){oe=oe===0?0:oe||10;var q=L(J).toHsl();return q.l+=oe/100,q.l=P(q.l),L(q)}function w(J,oe){oe=oe===0?0:oe||10;var q=L(J).toRgb();return q.r=I(0,B(255,q.r-R(255*-(oe/100)))),q.g=I(0,B(255,q.g-R(255*-(oe/100)))),q.b=I(0,B(255,q.b-R(255*-(oe/100)))),L(q)}function p(J,oe){oe=oe===0?0:oe||10;var q=L(J).toHsl();return q.l-=oe/100,q.l=P(q.l),L(q)}function h(J,oe){var q=L(J).toHsl(),ye=(q.h+oe)%360;return q.h=ye<0?360+ye:ye,L(q)}function c(J){var oe=L(J).toHsl();return oe.h=(oe.h+180)%360,L(oe)}function l(J){var oe=L(J).toHsl(),q=oe.h;return[L(J),L({h:(q+120)%360,s:oe.s,l:oe.l}),L({h:(q+240)%360,s:oe.s,l:oe.l})]}function a(J){var oe=L(J).toHsl(),q=oe.h;return[L(J),L({h:(q+90)%360,s:oe.s,l:oe.l}),L({h:(q+180)%360,s:oe.s,l:oe.l}),L({h:(q+270)%360,s:oe.s,l:oe.l})]}function v(J){var oe=L(J).toHsl(),q=oe.h;return[L(J),L({h:(q+72)%360,s:oe.s,l:oe.l}),L({h:(q+216)%360,s:oe.s,l:oe.l})]}function g(J,oe,q){oe=oe||6,q=q||30;var ye=L(J).toHsl(),Se=360/q,me=[L(J)];for(ye.h=(ye.h-(Se*oe>>1)+720)%360;--oe;)ye.h=(ye.h+Se)%360,me.push(L(ye));return me}function y(J,oe){oe=oe||6;for(var q=L(J).toHsv(),ye=q.h,Se=q.s,me=q.v,we=[],_e=1/oe;oe--;)we.push(L({h:ye,s:Se,v:me})),me=(me+_e)%1;return we}L.mix=function(J,oe,q){q=q===0?0:q||50;var ye=L(J).toRgb(),Se=L(oe).toRgb(),me=q/100,we={r:(Se.r-ye.r)*me+ye.r,g:(Se.g-ye.g)*me+ye.g,b:(Se.b-ye.b)*me+ye.b,a:(Se.a-ye.a)*me+ye.a};return L(we)},L.readability=function(J,oe){var q=L(J),ye=L(oe);return(V.max(q.getLuminance(),ye.getLuminance())+.05)/(V.min(q.getLuminance(),ye.getLuminance())+.05)},L.isReadable=function(J,oe,q){var ye=L.readability(J,oe),Se,me;me=!1,Se=he(q);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":me=ye>=4.5;break;case"AAlarge":me=ye>=3;break;case"AAAsmall":me=ye>=7;break}return me},L.mostReadable=function(J,oe,q){var ye=null,Se=0,me,we,_e,Oe;q=q||{},we=q.includeFallbackColors,_e=q.level,Oe=q.size;for(var Me=0;Me<oe.length;Me++)me=L.readability(J,oe[Me]),me>Se&&(Se=me,ye=L(oe[Me]));return L.isReadable(J,ye,{level:_e,size:Oe})||!we?ye:(q.includeFallbackColors=!1,L.mostReadable(J,["#fff","#000"],q))};var k=L.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=L.hexNames=j(k);function j(J){var oe={};for(var q in J)J.hasOwnProperty(q)&&(oe[J[q]]=q);return oe}function W(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function O(J,oe){X(J)&&(J="100%");var q=Z(J);return J=B(oe,I(0,parseFloat(J))),q&&(J=parseInt(J*oe,10)/100),V.abs(J-oe)<1e-6?1:J%oe/parseFloat(oe)}function P(J){return B(1,I(0,J))}function H(J){return parseInt(J,16)}function X(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function Z(J){return typeof J=="string"&&J.indexOf("%")!=-1}function re(J){return J.length==1?"0"+J:""+J}function be(J){return J<=1&&(J=J*100+"%"),J}function fe(J){return V.round(parseFloat(J)*255).toString(16)}function Te(J){return H(J)/255}var pe=function(){var J="[-\\+]?\\d+%?",oe="[-\\+]?\\d*\\.\\d+%?",q="(?:"+oe+")|(?:"+J+")",ye="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Se="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+ye),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+ye),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+ye),hsva:new RegExp("hsva"+Se),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 ge(J){return!!pe.CSS_UNIT.exec(J)}function ce(J){J=J.replace(A,"").replace(G,"").toLowerCase();var oe=!1;if(k[J])J=k[J],oe=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;return(q=pe.rgb.exec(J))?{r:q[1],g:q[2],b:q[3]}:(q=pe.rgba.exec(J))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=pe.hsl.exec(J))?{h:q[1],s:q[2],l:q[3]}:(q=pe.hsla.exec(J))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=pe.hsv.exec(J))?{h:q[1],s:q[2],v:q[3]}:(q=pe.hsva.exec(J))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=pe.hex8.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),a:Te(q[4]),format:oe?"name":"hex8"}:(q=pe.hex6.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),format:oe?"name":"hex"}:(q=pe.hex4.exec(J))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),a:Te(q[4]+""+q[4]),format:oe?"name":"hex8"}:(q=pe.hex3.exec(J))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),format:oe?"name":"hex"}:!1}function he(J){var oe,q;return J=J||{level:"AA",size:"small"},oe=(J.level||"AA").toUpperCase(),q=(J.size||"small").toLowerCase(),oe!=="AA"&&oe!=="AAA"&&(oe="AA"),q!=="small"&&q!=="large"&&(q="small"),{level:oe,size:q}}ot.exports?ot.exports=L:!(ne=function(){return L}.call(He,ee,He,ot),ne!==void 0&&(ot.exports=ne))})(Math)},bT9E:function(ot,He,ee){"use strict";ee.d(He,"a",function(){return V});var ne=ee("VTBJ");function V(A,G){var U=Object(ne.a)({},A);return Array.isArray(G)&&G.forEach(function(R){delete U[R]}),U}},c5Ni:function(ot,He,ee){},dejd:function(ot,He,ee){},dmUQ:function(ot,He,ee){"use strict";var ne=ee("Ff2n"),V=ee("rePB"),A=ee("1OyB"),G=ee("vuIU"),U=ee("Ji7U"),R=ee("md7G"),B=ee("foSv"),I=ee("cDcd"),D=ee.n(I),L=ee("TSYQ"),E=ee.n(L),_=ee("4IlW");function M(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(l);a&&(g=g.filter(function(y){return Object.getOwnPropertyDescriptor(l,y).enumerable})),v.push.apply(v,g)}return v}function C(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?M(Object(v),!0).forEach(function(g){Object(V.a)(l,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):M(Object(v)).forEach(function(g){Object.defineProperty(l,g,Object.getOwnPropertyDescriptor(v,g))})}return l}function T(l){var a=b();return function(){var g=Object(B.a)(l),y;if(a){var k=Object(B.a)(this).constructor;y=Reflect.construct(g,arguments,k)}else y=g.apply(this,arguments);return Object(R.a)(this,y)}}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(l){return!1}}function d(){}function o(l){l.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,S=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},w=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},p=function(l){Object(U.a)(v,l);var a=T(v);function v(g){var y;Object(A.a)(this,v),y=a.call(this,g),y.onKeyDown=function(j){var W=y.props,O=W.onKeyDown,P=W.onPressEnter;if(j.keyCode===_.a.UP){var H=y.getRatio(j);y.up(j,H,null),y.stop()}else if(j.keyCode===_.a.DOWN){var X=y.getRatio(j);y.down(j,X,null),y.stop()}else j.keyCode===_.a.ENTER&&P&&P(j);if(y.recordCursorPosition(),y.lastKeyCode=j.keyCode,O){for(var Z=arguments.length,re=new Array(Z>1?Z-1:0),be=1;be<Z;be++)re[be-1]=arguments[be];O.apply(void 0,[j].concat(re))}},y.onKeyUp=function(j){var W=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),W){for(var O=arguments.length,P=new Array(O>1?O-1:0),H=1;H<O;H++)P[H-1]=arguments[H];W.apply(void 0,[j].concat(P))}},y.onChange=function(j){var W=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(j)),y.setState({inputValue:y.rawInput}),W(y.toNumber(y.rawInput))},y.onMouseUp=function(){var j=y.props.onMouseUp;y.recordCursorPosition(),j&&j.apply(void 0,arguments)},y.onFocus=function(){var j;y.setState({focused:!0}),(j=y.props).onFocus.apply(j,arguments)},y.onBlur=function(){var j=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var W=y.getCurrentValidValue(y.state.inputValue),O=y.setValue(W,d);if(j){var P=y.input.value,H=y.getInputDisplayValue({focus:!1,value:O});y.input.value=H&&Number(H),j.apply(void 0,arguments),y.input.value=P}},y.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},y.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},y.getPrecision=function(j){if(m(y.props.precision))return y.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var O=0;return W.indexOf(".")>=0&&(O=W.length-W.indexOf(".")-1),O},y.getInputDisplayValue=function(j){var W=j||y.state,O=W.focused,P=W.inputValue,H=W.value,X;O?X=P:X=y.toPrecisionAsStep(H),X==null&&(X="");var Z=y.formatWrapper(X);return m(y.props.decimalSeparator)&&(Z=Z.toString().replace(".",y.props.decimalSeparator)),Z},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(j){}},y.restoreByAfter=function(j){if(j===void 0)return!1;var W=y.input.value,O=W.lastIndexOf(j);if(O===-1)return!1;var P=y.cursorBefore.length;return y.lastKeyCode===_.a.DELETE&&y.cursorBefore.charAt(P-1)===j[0]?(y.fixCaret(P,P),!0):O+j.length===W.length?(y.fixCaret(O,O),!0):!1},y.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,O){var P=j.substring(O);return y.restoreByAfter(P)})},y.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(j,W,O){y.pressingUpOrDown=!0,y.step("down",j,W,O)},y.up=function(j,W,O){y.pressingUpOrDown=!0,y.step("up",j,W,O)},y.saveInput=function(j){y.input=j};var k=g.value;k===void 0&&(k=g.defaultValue),y.state={focused:g.autoFocus};var F=y.getValidValue(y.toNumber(k));return y.state=C(C({},y.state),{},{inputValue:y.toPrecisionAsStep(F),value:F}),y}return Object(G.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var k=this.props,F=k.value,j=k.onChange,W=k.max,O=k.min,P=this.state.focused;if(y){if(!w(y.value,F)||!w(y.max,W)||!w(y.min,O)){var H=P?F:this.getValidValue(F),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var Z="value"in this.props?F:this.state.value;"max"in this.props&&y.max!==W&&typeof Z=="number"&&Z>W&&j&&j(W),"min"in this.props&&y.min!==O&&typeof Z=="number"&&Z<O&&j&&j(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var re=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===_.a.BACKSPACE?re=this.cursorStart-1:this.lastKeyCode===_.a.DELETE&&(re=this.cursorStart):re=this.input.value.length,this.fixCaret(re,re)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case _.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case _.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(be){}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(y){var k=y;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(y){var k=y.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(y){var k=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(y);return isNaN(j)?y:(j<k&&(j=k),j>F&&(j=F),j)}},{key:"setValue",value:function(y,k){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),W=this.state.value,O=W===void 0?null:W,P=this.state.inputValue,H=P===void 0?null:P,X=typeof j=="number"?j.toFixed(F):"".concat(j),Z=j!==O||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},k)):this.setState({value:j,inputValue:this.toPrecisionAsStep(y)},k),Z&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(y){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(m(j))return j;var O=this.getPrecision(k),P=this.getPrecision(W),H=this.getPrecision(y);return y?Math.max(H,O+P):O+P}},{key:"getPrecisionFactor",value:function(y){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(y,k);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(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var k=Math.abs(this.getMaxPrecision(y));return isNaN(k)?y.toString():Number(y).toFixed(k)}},{key:"toNumber",value:function(y){var k=this.props.precision,F=this.state.focused,j=y&&y.length>16&&F;return this.isNotCompleteNumber(y)||j?y:m(k)?Math.round(y*Math.pow(10,k))/Math.pow(10,k):Number(y)}},{key:"upStep",value:function(y,k){var F=this.props.step,j=this.getPrecisionFactor(y,k),W=Math.abs(this.getMaxPrecision(y,k)),O=((j*y+j*F*k)/j).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(y,k){var F=this.props.step,j=this.getPrecisionFactor(y,k),W=Math.abs(this.getMaxPrecision(y,k)),O=((j*y-j*F*k)/j).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(y,k){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var O=this.props;if(O.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var H=this["".concat(y,"Step")](P,j),X=H>O.max||H<O.min;if(H>O.max?H=O.max:H<O.min&&(H=O.min),this.setValue(H,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){F[y](k,j,!0)},W?u:S)}},{key:"fixCaret",value:function(y,k){if(y===void 0||k===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(y!==F||k!==j)&&this.input.setSelectionRange(y,k)}catch(W){}}},{key:"render",value:function(){var y,k=this.props,F=k.prefixCls,j=k.disabled,W=k.readOnly,O=k.useTouch,P=k.autoComplete,H=k.upHandler,X=k.downHandler,Z=k.className,re=k.max,be=k.min,fe=k.style,Te=k.title,pe=k.onMouseEnter,ge=k.onMouseLeave,ce=k.onMouseOver,he=k.onMouseOut,J=k.required,oe=k.onClick,q=k.tabIndex,ye=k.type,Se=k.placeholder,me=k.id,we=k.inputMode,_e=k.pattern,Oe=k.step,Me=k.maxLength,De=k.autoFocus,Le=k.name,We=k.onPaste,Ve=k.onInput,Xe=Object(ne.a)(k,["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"]),Be=this.state,Qe=Be.value,Ke=Be.focused,$e=E()(F,(y={},Object(V.a)(y,Z,!!Z),Object(V.a)(y,"".concat(F,"-disabled"),j),Object(V.a)(y,"".concat(F,"-focused"),Ke),y)),Ae={};Object.keys(Xe).forEach(function(ie){(ie.substr(0,5)==="data-"||ie.substr(0,5)==="aria-"||ie==="role")&&(Ae[ie]=Xe[ie])});var qe=!W&&!j,Je=this.getInputDisplayValue(null),Re=(Qe||Qe===0)&&(isNaN(Qe)||Number(Qe)>=re),Fe=(Qe||Qe===0)&&(isNaN(Qe)||Number(Qe)<=be),se=Re||j||W,le=Fe||j||W,ue=E()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),se)),$=E()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),le)),Q=O?{onTouchStart:se?d:this.up,onTouchEnd:this.stop}:{onMouseDown:se?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=O?{onTouchStart:le?d:this.down,onTouchEnd:this.stop}:{onMouseDown:le?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:$e,style:fe,title:Te,onMouseEnter:pe,onMouseLeave:ge,onMouseOver:ce,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(F,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":se,className:ue}),H||D.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),D.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:$}),X||D.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),D.a.createElement("div",{className:"".concat(F,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":be,"aria-valuemax":re,"aria-valuenow":Qe,required:J,type:ye,placeholder:Se,onPaste:We,onClick:oe,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:q,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:d,onKeyUp:qe?this.onKeyUp:d,autoFocus:De,maxLength:Me,readOnly:W,disabled:j,max:re,min:be,step:Oe,name:Le,title:Te,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:_e,inputMode:we,onInput:Ve},Ae))))}}]),v}(D.a.Component);p.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var h=p,c=He.a=h},h78n:function(ot,He,ee){"use strict";ee.d(He,"a",function(){return y});var ne=ee("cDcd"),V=ee.n(ne),A=ee("TSYQ"),G=ee.n(A),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(ne.useRef)()}),O=Object(ne.useRef)();return Object(ne.useEffect)(function(){var P=Date.now(),H=!1;Object.keys(W).forEach(function(X){var Z=W[X].current;if(!Z)return;H=!0;var re=Z.style;re.transitionDuration=".3s, .3s, .3s, .06s",O.current&&P-O.current<100&&(re.transitionDuration="0s, 0s")}),H&&(O.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},B.apply(this,arguments)}function I(F,j){return M(F)||_(F,j)||L(F,j)||D()}function D(){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 L(F,j){if(!F)return;if(typeof F=="string")return E(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return E(F,j)}function E(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function _(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,P=!1,H=void 0;try{for(var X=F[Symbol.iterator](),Z;!(O=(Z=X.next()).done)&&!(W.push(Z.value),j&&W.length===j);O=!0);}catch(re){P=!0,H=re}finally{try{!O&&X.return!=null&&X.return()}finally{if(P)throw H}}return W}function M(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=T(F,j),O,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(O=H[P],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function T(F,j){if(F==null)return{};var W={},O=Object.keys(F),P,H;for(H=0;H<O.length;H++){if(P=O[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var b=function(j){var W=j.className,O=j.percent,P=j.prefixCls,H=j.strokeColor,X=j.strokeLinecap,Z=j.strokeWidth,re=j.style,be=j.trailColor,fe=j.trailWidth,Te=j.transition,pe=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete pe.gapPosition;var ge=Array.isArray(O)?O:[O],ce=Array.isArray(H)?H:[H],he=R(ge),J=I(he,1),oe=J[0],q=Z/2,ye=100-Z/2,Se="M ".concat(X==="round"?q:0,",").concat(q,`
|
|
L `).concat(X==="round"?ye:100,",").concat(q),me="0 0 100 ".concat(Z),we=0;return V.a.createElement("svg",B({className:G()("".concat(P,"-line"),W),viewBox:me,preserveAspectRatio:"none",style:re},pe),V.a.createElement("path",{className:"".concat(P,"-line-trail"),d:Se,strokeLinecap:X,stroke:be,strokeWidth:fe||Z,fillOpacity:"0"}),ge.map(function(_e,Oe){var Me={strokeDasharray:"".concat(_e,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=ce[Oe]||ce[ce.length-1];return we+=_e,V.a.createElement("path",{key:Oe,className:"".concat(P,"-line-path"),d:Se,strokeLinecap:X,stroke:De,strokeWidth:Z,fillOpacity:"0",ref:oe[Oe],style:Me})}))};b.defaultProps=U;var d=b;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},o.apply(this,arguments)}function s(F,j){return w(F)||m(F,j)||S(F,j)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(F,j){if(!F)return;if(typeof F=="string")return f(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return f(F,j)}function f(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function m(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,P=!1,H=void 0;try{for(var X=F[Symbol.iterator](),Z;!(O=(Z=X.next()).done)&&!(W.push(Z.value),j&&W.length===j);O=!0);}catch(re){P=!0,H=re}finally{try{!O&&X.return!=null&&X.return()}finally{if(P)throw H}}return W}function w(F){if(Array.isArray(F))return F}function p(F,j){if(F==null)return{};var W=h(F,j),O,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(O=H[P],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function h(F,j){if(F==null)return{};var W={},O=Object.keys(F),P,H;for(H=0;H<O.length;H++){if(P=O[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function v(F,j,W,O){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-O/2,Z=0,re=-X,be=0,fe=-2*X;switch(H){case"left":Z=-X,re=0,be=2*X,fe=0;break;case"right":Z=X,re=0,be=-2*X,fe=0;break;case"bottom":re=X,fe=2*X;break;default:}var Te="M 50,50 m ".concat(Z,",").concat(re,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(be,",").concat(-fe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-be,",").concat(fe),pe=Math.PI*2*X,ge={stroke:W,strokeDasharray:"".concat(j/100*(pe-P),"px ").concat(pe,"px"),strokeDashoffset:"-".concat(P/2+F/100*(pe-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:ge}}var g=function(j){var W=j.prefixCls,O=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,X=j.gapPosition,Z=j.trailColor,re=j.strokeLinecap,be=j.style,fe=j.className,Te=j.strokeColor,pe=j.percent,ge=p(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ce=Object(ne.useMemo)(function(){return c+=1,c},[]),he=v(0,100,Z,O,H,X),J=he.pathString,oe=he.pathStyle,q=a(pe),ye=a(Te),Se=ye.find(function(Me){return Object.prototype.toString.call(Me)==="[object Object]"}),me=R(q),we=s(me,1),_e=we[0],Oe=function(){var De=0;return q.map(function(Le,We){var Ve=ye[We]||ye[ye.length-1],Xe=Object.prototype.toString.call(Ve)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ce,")"):"",Be=v(De,Le,Ve,O,H,X);return De+=Le,V.a.createElement("path",{key:We,className:"".concat(W,"-circle-path"),d:Be.pathString,stroke:Xe,strokeLinecap:re,strokeWidth:O,opacity:Le===0?0:1,fillOpacity:"0",style:Be.pathStyle,ref:_e[We]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),fe),viewBox:"0 0 100 100",style:be},ge),Se&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ce),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(Me,De){return l(Me)-l(De)}).map(function(Me,De){return V.a.createElement("stop",{key:De,offset:Me,stopColor:Se[Me]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:Z,strokeLinecap:re,strokeWidth:P||O,fillOpacity:"0",style:oe}),Oe().reverse())};g.defaultProps=U;var y=g,k={Line:d,Circle:y}},kSUc:function(ot,He,ee){},lLeG:function(ot,He,ee){ot.exports={bg:"bg___f0e4_",flexRow:"flexRow___1-S6r",flexJustifyCenter:"flexJustifyCenter___3KkrV",flexAlignEnd:"flexAlignEnd___146T7",flexAlignCenter:"flexAlignCenter___2UVve",flexColumn:"flexColumn___nj9sg",formWrap:"formWrap___2eqbH",titleWrap:"titleWrap___1gkN2",fieldWrap:"fieldWrap___2l5q8",mdWrap:"mdWrap___38Ffu",backgroundFa:"backgroundFa___2gBUv",button:"button___3jgMh"}},lZu9:function(ot,He,ee){(function(ne){ne(ee("VrN/"),ee("1eCo"),ee("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function(V,A){var G=ne.getMode(V,"text/html"),U=G.name=="null";function R(O){if(ne.findModeByName){var P=ne.findModeByName(O);P&&(O=P.mime||P.mimes[0])}var H=ne.getMode(V,O);return H.name=="null"?null:H}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var B={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 I in B)B.hasOwnProperty(I)&&A.tokenTypeOverrides[I]&&(B[I]=A.tokenTypeOverrides[I]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,_=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(O,P,H){return P.f=P.inline=H,H(O,P)}function u(O,P,H){return P.f=P.block=H,H(O,P)}function S(O){return!O||!/\S/.test(O.string)}function f(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==w){var P=U;if(!P){var H=ne.innerMode(G,O.htmlState);P=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}P&&(O.f=l,O.block=m,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function m(O,P){var H=O.column()===P.indentation,X=S(P.prevLine.stream),Z=P.indentedCode,re=P.prevLine.hr,be=P.list!==!1,fe=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var Te=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,be)){for(P.list=null;Te<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=Te-P.listStack[P.listStack.length-1])}var pe=!X&&!re&&!P.prevLine.header&&(!be||!Z)&&!P.prevLine.fencedCodeEnd,ge=(P.list===!1||re||X)&&P.indentation<=fe&&O.match(D),ce=null;if(P.indentationDiff>=4&&(Z||P.prevLine.fencedCodeEnd||P.prevLine.header||X))return O.skipToEnd(),P.indentedCode=!0,B.code;if(O.eatSpace())return null;if(H&&P.indentation<=fe&&(ce=O.match(_))&&ce[1].length<=6)return P.quote=0,P.header=ce[1].length,P.thisLine.header=!0,A.highlightFormatting&&(P.formatting="header"),P.f=P.inline,h(P);if(P.indentation<=fe&&O.eat(">"))return P.quote=H?1:P.quote+1,A.highlightFormatting&&(P.formatting="quote"),O.eatSpace(),h(P);if(!ge&&!P.setext&&H&&P.indentation<=fe&&(ce=O.match(L))){var he=ce[1]?"ol":"ul";return P.indentation=Te+O.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,A.taskLists&&O.match(E,!1)&&(P.taskList=!0),P.f=P.inline,A.highlightFormatting&&(P.formatting=["list","list-"+he]),h(P)}else{if(H&&P.indentation<=fe&&(ce=O.match(T,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ce[1]+"+ *$"),P.localMode=A.fencedCodeBlockHighlighting&&R(ce[2]||A.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=ne.startState(P.localMode)),P.f=P.block=p,A.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!pe||!be)&&!P.quote&&P.list===!1&&!P.code&&!ge&&!b.test(O.string)&&(ce=O.lookAhead(1))&&(ce=ce.match(M)))return P.setext?(P.header=P.setext,P.setext=0,O.skipToEnd(),A.highlightFormatting&&(P.formatting="header")):(P.header=ce[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,h(P);if(ge)return O.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,B.hr;if(O.peek()==="[")return s(O,P,k)}return s(O,P,P.inline)}function w(O,P){var H=G.token(O,P.htmlState);if(!U){var X=ne.innerMode(G,P.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||P.md_inside&&O.current().indexOf(">")>-1)&&(P.f=l,P.block=m,P.htmlState=null)}return H}function p(O,P){var H=P.listStack[P.listStack.length-1]||0,X=P.indentation<H,Z=H+3;if(P.fencedEndRE&&P.indentation<=Z&&(X||O.match(P.fencedEndRE))){A.highlightFormatting&&(P.formatting="code-block");var re;return X||(re=h(P)),P.localMode=P.localState=null,P.block=m,P.f=l,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,X?u(O,P,P.block):re}else return P.localMode?P.localMode.token(O,P.localState):(O.skipToEnd(),B.code)}function h(O){var P=[];if(O.formatting){P.push(B.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var H=0;H<O.formatting.length;H++)P.push(B.formatting+"-"+O.formatting[H]),O.formatting[H]==="header"&&P.push(B.formatting+"-"+O.formatting[H]+"-"+O.header),O.formatting[H]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=O.quote?P.push(B.formatting+"-"+O.formatting[H]+"-"+O.quote):P.push("error"))}if(O.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(O.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(O.linkHref?P.push(B.linkHref,"url"):(O.strong&&P.push(B.strong),O.em&&P.push(B.em),O.strikethrough&&P.push(B.strikethrough),O.emoji&&P.push(B.emoji),O.linkText&&P.push(B.linkText),O.code&&P.push(B.code),O.image&&P.push(B.image),O.imageAltText&&P.push(B.imageAltText,"link"),O.imageMarker&&P.push(B.imageMarker)),O.header&&P.push(B.header,B.header+"-"+O.header),O.quote&&(P.push(B.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=O.quote?P.push(B.quote+"-"+O.quote):P.push(B.quote+"-"+A.maxBlockquoteDepth)),O.list!==!1){var X=(O.listStack.length-1)%3;X?X===1?P.push(B.list2):P.push(B.list3):P.push(B.list1)}return O.trailingSpaceNewLine?P.push("trailing-space-new-line"):O.trailingSpace&&P.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function c(O,P){return O.match(C,!0)?h(P):void 0}function l(O,P){var H=P.text(O,P);if(typeof H!="undefined")return H;if(P.list)return P.list=null,h(P);if(P.taskList){var X=O.match(E,!0)[1]===" ";return X?P.taskOpen=!0:P.taskClosed=!0,A.highlightFormatting&&(P.formatting="task"),P.taskList=!1,h(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&O.match(/^#+$/,!0))return A.highlightFormatting&&(P.formatting="header"),h(P);var Z=O.next();if(P.linkTitle){P.linkTitle=!1;var re=Z;Z==="("&&(re=")"),re=(re+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var be="^\\s*(?:[^"+re+"\\\\]+|\\\\\\\\|\\\\.)"+re;if(O.match(new RegExp(be),!0))return B.linkHref}if(Z==="`"){var fe=P.formatting;A.highlightFormatting&&(P.formatting="code"),O.eatWhile("`");var Te=O.current().length;if(P.code==0&&(!P.quote||Te==1))return P.code=Te,h(P);if(Te==P.code){var pe=h(P);return P.code=0,pe}else return P.formatting=fe,h(P)}else if(P.code)return h(P);if(Z==="\\"&&(O.next(),A.highlightFormatting)){var ge=h(P),ce=B.formatting+"-escape";return ge?ge+" "+ce:ce}if(Z==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(Z==="["&&P.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(Z==="]"&&P.imageAltText){A.highlightFormatting&&(P.formatting="image");var ge=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=v,ge}if(Z==="["&&!P.image)return P.linkText&&O.match(/^.*?\]/)||(P.linkText=!0,A.highlightFormatting&&(P.formatting="link")),h(P);if(Z==="]"&&P.linkText){A.highlightFormatting&&(P.formatting="link");var ge=h(P);return P.linkText=!1,P.inline=P.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?v:l,ge}if(Z==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var ge=h(P);return ge?ge+=" ":ge="",ge+B.linkInline}if(Z==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var ge=h(P);return ge?ge+=" ":ge="",ge+B.linkEmail}if(A.xml&&Z==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=O.string.indexOf(">",O.pos);if(he!=-1){var J=O.string.substring(O.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(P.md_inside=!0)}return O.backUp(1),P.htmlState=ne.startState(G),u(O,P,w)}if(A.xml&&Z==="<"&&O.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var oe=1,q=O.pos==1?" ":O.string.charAt(O.pos-2);oe<3&&O.eat(Z);)oe++;var ye=O.peek()||" ",Se=!/\s/.test(ye)&&(!d.test(ye)||/\s/.test(q)||d.test(q)),me=!/\s/.test(q)&&(!d.test(q)||/\s/.test(ye)||d.test(ye)),we=null,_e=null;if(oe%2&&(!P.em&&Se&&(Z==="*"||!me||d.test(q))?we=!0:P.em==Z&&me&&(Z==="*"||!Se||d.test(ye))&&(we=!1)),oe>1&&(!P.strong&&Se&&(Z==="*"||!me||d.test(q))?_e=!0:P.strong==Z&&me&&(Z==="*"||!Se||d.test(ye))&&(_e=!1)),_e!=null||we!=null){A.highlightFormatting&&(P.formatting=we==null?"strong":_e==null?"em":"strong em"),we===!0&&(P.em=Z),_e===!0&&(P.strong=Z);var pe=h(P);return we===!1&&(P.em=!1),_e===!1&&(P.strong=!1),pe}}else if(Z===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return h(P);O.backUp(1)}if(A.strikethrough){if(Z==="~"&&O.eatWhile(Z)){if(P.strikethrough){A.highlightFormatting&&(P.formatting="strikethrough");var pe=h(P);return P.strikethrough=!1,pe}else if(O.match(/^[^\s]/,!1))return P.strikethrough=!0,A.highlightFormatting&&(P.formatting="strikethrough"),h(P)}else if(Z===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return h(P);O.backUp(2)}}if(A.emoji&&Z===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,A.highlightFormatting&&(P.formatting="emoji");var Oe=h(P);return P.emoji=!1,Oe}return Z===" "&&(O.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),h(P)}function a(O,P){var H=O.next();if(H===">"){P.f=P.inline=l,A.highlightFormatting&&(P.formatting="link");var X=h(P);return X?X+=" ":X="",X+B.linkInline}return O.match(/^[^>]+/,!0),B.linkInline}function v(O,P){if(O.eatSpace())return null;var H=O.next();return H==="("||H==="["?(P.f=P.inline=y(H==="("?")":"]"),A.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(O){return function(P,H){var X=P.next();if(X===O){H.f=H.inline=l,A.highlightFormatting&&(H.formatting="link-string");var Z=h(H);return H.linkHref=!1,Z}return P.match(g[O]),H.linkHref=!0,h(H)}}function k(O,P){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=F,O.next(),A.highlightFormatting&&(P.formatting="link"),P.linkText=!0,h(P)):s(O,P,l)}function F(O,P){if(O.match(/^\]:/,!0)){P.f=P.inline=j,A.highlightFormatting&&(P.formatting="link");var H=h(P);return P.linkText=!1,H}return O.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(O,P){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?P.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=l,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&ne.copyState(G,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?ne.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,P){if(P.formatting=!1,O!=P.thisLine.stream){if(P.header=0,P.hr=!1,O.match(/^\s*$/,!0))return f(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:O},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=w)){var H=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=H,P.indentationDiff=null,H>0)return null}}return P.f(O,P)},innerMode:function(O){return O.block==w?{state:O.htmlState,mode:G}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:W}},indent:function(O,P,H){return O.block==w&&G.indent?G.indent(O.htmlState,P,H):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,P,H):ne.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},osHv:function(ot,He,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";var V=ne.Pos;function A(d,o){return d.line-o.line||d.ch-o.ch}var G="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=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+U+"]*)","g");function B(d,o,s,u){this.line=o,this.ch=s,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function I(d,o){var s=d.cm.getTokenTypeAt(V(d.line,o));return s&&/\btag\b/.test(s)}function D(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function L(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function E(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(D(d))continue;return}if(!I(d,o+1)){d.ch=o+1;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function _(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!I(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var s=R.exec(d.text);if(s&&s.index==o)return s}}function M(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(D(d))continue;return}if(!I(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!I(d,o+1)){d.ch=o;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function T(d,o){for(var s=[];;){var u=M(d),S,f=d.line,m=d.ch-(u?u[0].length:0);if(!u||!(S=E(d)))return;if(S=="selfClose")continue;if(u[1]){for(var w=s.length-1;w>=0;--w)if(s[w]==u[2]){s.length=w;break}if(w<0&&(!o||o==u[2]))return{tag:u[2],from:V(f,m),to:V(d.line,d.ch)}}else s.push(u[2])}}function b(d,o){for(var s=[];;){var u=C(d);if(!u)return;if(u=="selfClose"){_(d);continue}var S=d.line,f=d.ch,m=_(d);if(!m)return;if(m[1])s.push(m[2]);else{for(var w=s.length-1;w>=0;--w)if(s[w]==m[2]){s.length=w;break}if(w<0&&(!o||o==m[2]))return{tag:m[2],from:V(d.line,d.ch),to:V(S,f)}}}}ne.registerHelper("fold","xml",function(d,o){for(var s=new B(d,o.line,0);;){var u=M(s);if(!u||s.line!=o.line)return;var S=E(s);if(!S)return;if(!u[1]&&S!="selfClose"){var f=V(s.line,s.ch),m=T(s,u[2]);return m&&A(m.from,f)>0?{from:f,to:m.from}:null}}}),ne.findMatchingTag=function(d,o,s){var u=new B(d,o.line,o.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var S=E(u),f=S&&V(u.line,u.ch),m=S&&_(u);if(!S||!m||A(u,o)>0)return;var w={from:V(u.line,u.ch),to:f,tag:m[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:m[1]?{open:b(u,m[2]),close:w,at:"close"}:(u=new B(d,f.line,f.ch,s),{open:w,close:T(u,m[2]),at:"open"})},ne.findEnclosingTag=function(d,o,s,u){for(var S=new B(d,o.line,o.ch,s);;){var f=b(S,u);if(!f)break;var m=new B(d,o.line,o.ch,s),w=T(m,f.tag);if(w)return{open:f,close:w}}},ne.scanForClosingTag=function(d,o,s,u){var S=new B(d,o.line,o.ch,u?{from:0,to:u}:null);return T(S,s)}})},p5ED:function(ot,He,ee){"use strict";var ne=ee("+L6B"),V=ee("2/Rp"),A=ee("5Dmo"),G=ee("3S7+"),U=ee("k1fw"),R=ee("tJVT"),B=ee("cDcd"),I=ee.n(B),D=ee("vHTk"),L=ee.n(D),E=ee("yEEn"),_=ee("ZW9T"),M=ee("1vsH");He.a=function(C){var T=C.name,b=C.data,d=C.theme,o=C.type,s=C.filename,u=C.monacoEditor,S=C.className,f=C.style,m=C.close,w=C.onClose,p=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],v=Object(B.useState)(""),g=Object(R.a)(v,2),y=g[0],k=g[1],F=Object(B.useRef)();s&&(u.filename=s),Object(B.useEffect)(function(){var O,P,H=(O=document.cookie)===null||O===void 0||((P=O.replace(/\s/g,""))===null||P===void 0)?void 0:P.split(";");H==null||H.map(function(X){var Z=X.split("=");Z[0]==="_educoder_session"&&k(Z[1])})},[]);var j=function(){if(b.startsWith("http")||b.startsWith("/")){W();return}Object(M.x)(s||"educoder",b,s)},W=function(){Object(M.v)(s||T,b)};return console.log("data:",b,"fileanme:",s," name:",T),I.a.createElement("div",{style:Object(U.a)({},f||{}),className:"".concat(p&&L.a.bgBlack," ").concat(o?L.a.wrp:"hide")},m&&I.a.createElement("div",{className:L.a.close,ref:F},I.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.current}},I.a.createElement("span",{onClick:W},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return F.current}},I.a.createElement("span",{className:"",onClick:w},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(L.a[S]," ").concat(S," ").concat(L.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&I.a.createElement(_.b,u)),o==="audio"&&I.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),o==="video"&&I.a.createElement(I.a.Fragment,null,b!=null&&b.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),o==="pdf"&&I.a.createElement("embed",{className:L.a.embed,src:b}),o==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),o==="other"&&I.a.createElement("div",null,I.a.createElement(V.a,{type:"primary",size:"large",onClick:j},I.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&I.a.createElement(V.a,{type:"primary",size:"large",onClick:j},I.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ot,He,ee){},"rAM+":function(ot,He,ee){"use strict";ee.d(He,"a",function(){return V});var ne=ee("Qw5x");function V(A,G){var U;if(typeof Symbol=="undefined"||A[Symbol.iterator]==null){if(Array.isArray(A)||(U=Object(ne.a)(A))||G&&A&&typeof A.length=="number"){U&&(A=U);var R=0,B=function(){};return{s:B,n:function(){return R>=A.length?{done:!0}:{done:!1,value:A[R++]}},e:function(_){throw _},f:B}}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 I=!0,D=!1,L;return{s:function(){U=A[Symbol.iterator]()},n:function(){var _=U.next();return I=_.done,_},e:function(_){D=!0,L=_},f:function(){try{!I&&U.return!=null&&U.return()}finally{if(D)throw L}}}}},rUJ1:function(ot,He){const ee=/[&<>"']/,ne=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},U=p=>G[p];function R(p,h){if(h){if(ee.test(p))return p.replace(ne,U)}else if(V.test(p))return p.replace(A,U);return p}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(p){return p.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const D=/(^|[^\[])\^/g;function L(p,h){p=p.source||p,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(D,"$1"),p=p.replace(l,a),c),getRegex:()=>new RegExp(p,h)};return c}const E=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(p,h,c){if(p){let l;try{l=decodeURIComponent(I(c)).replace(E,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!_.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},T=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(p,h){C[" "+p]||(T.test(p)?C[" "+p]=p+"/":C[" "+p]=f(p,"/",!0)),p=C[" "+p];const c=p.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:p.replace(b,"$1")+h:h.charAt(0)==="/"?c?h:p.replace(d,"$1")+h:p+h}const s={exec:function(){}};function u(p){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(p[l]=c[l])}return p}function S(p,h){const c=p.replace(/\|/g,(v,g,y)=>{let k=!1,F=g;for(;--F>=0&&y[F]==="\\";)k=!k;return k?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function f(p,h,c){const l=p.length;if(l===0)return"";let a=0;for(;a<l;){const v=p.charAt(l-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return p.substr(0,l-a)}function m(p,h){if(p.indexOf(h[1])===-1)return-1;const c=p.length;let l=0,a=0;for(;a<c;a++)if(p[a]==="\\")a++;else if(p[a]===h[0])l++;else if(p[a]===h[1]&&(l--,l<0))return a;return-1}function w(p){p&&p.sanitize&&!p.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")}ot.exports={escape:R,unescape:I,edit:L,cleanUrl:M,resolveUrl:o,noopTest:s,merge:u,splitCells:S,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:w}},tt94:function(ot,He,ee){"use strict";ee.r(He);var ne=ee("+L6B"),V=ee("2/Rp"),A=ee("sRBo"),G=ee("kaz8"),U=ee("14J3"),R=ee("BMrR"),B=ee("jCWc"),I=ee("kPKH"),D=ee("giR+"),L=ee("fyUT"),E=ee("5NDa"),_=ee("5rEg"),M=ee("sPJy"),C=ee("bE4q"),T=ee("k1fw"),b=ee("miYZ"),d=ee("tsqr"),o=ee("9og8"),s=ee("y8nQ"),u=ee("Vl3Y"),S=ee("tJVT"),f=ee("WmNS"),m=ee.n(f),w=ee("cDcd"),p=ee.n(w),h=ee("9kvl"),c=ee("55Ip"),l=ee("1vsH"),a=ee("Ot1p"),v=ee("XYT7"),g=ee("lLeG"),y=ee.n(g),k=ee("500L"),F=function(W){var O,P=W.shixunHomeworks,H=W.newCourse,X=W.globalSetting,Z=W.loading,re=W.dispatch,be=W.match,fe=u.a.useForm(),Te=Object(S.a)(fe,1),pe=Te[0],ge=Object(w.useState)({}),ce=Object(S.a)(ge,2),he=ce[0],J=ce[1],oe=Object(w.useRef)(),q=P.commonHomeWorkAddDefaultData;Object(w.useEffect)(function(){setTimeout(function(){document.body.scrollIntoView()},300);var Se=be.params,me=Se.coursesId,we=Se.categoryId;re({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:we,coursesId:me,type:3}})},[]);var ye=function(){var Se=Object(o.a)(m.a.mark(function me(we){var _e,Oe,Me,De,Le,We,Ve;return m.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(!(he.min_num>he.max_num)){Be.next=3;break}return d.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),Be.abrupt("return");case 3:return _e=Object(T.a)({},he),_e.attachment_ids&&(_e.attachment_ids=_e==null||((Oe=_e.attachment_ids)===null||Oe===void 0)?void 0:Oe.map(function(Qe){return Qe.response.id})),_e.reference_attachment_ids&&(_e.reference_attachment_ids=_e==null||((Me=_e.reference_attachment_ids)===null||Me===void 0)?void 0:Me.map(function(Qe){return Qe.response.id})),De=be.params,Le=De.coursesId,We=De.categoryId,Be.next=9,Object(v.a)(Object(T.a)(Object(T.a)({coursesId:Le,category:We},_e),{},{type:3}));case 9:Ve=Be.sent,Ve.status===0&&(Object(l.ab)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),h.d.push("/classrooms/".concat(Le,"/group_homework/").concat(Ve.homework_id,"/detail")));case 11:case"end":return Be.stop()}},me)}));return function(we){return Se.apply(this,arguments)}}();return p.a.createElement("section",{className:y.a.bg},q.course_name&&p.a.createElement("section",{className:"animated fadeIn"},p.a.createElement("aside",{className:"mt10"},q.category&&p.a.createElement(C.a,{separator:">"},p.a.createElement(C.a.Item,null,p.a.createElement(c.a,{to:"/classrooms/".concat(q.course_id,"/group_homework")},q.course_name)),p.a.createElement(C.a.Item,null,p.a.createElement(c.a,{to:"/classrooms/".concat(q.course_id,"/group_homework")},q.category.category_name)),p.a.createElement(C.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),p.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),p.a.createElement(u.a,{form:pe,className:y.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){J(Object(T.a)({},pe.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:ye},p.a.createElement("div",{className:y.a.fieldWrap},p.a.createElement(u.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},p.a.createElement(_.a,{maxLength:60,suffix:"".concat(((O=he.name)===null||O===void 0?void 0:O.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),p.a.createElement("div",{className:y.a.mdWrap},p.a.createElement(u.a.Item,{name:"description",label:"\u5185\u5BB9:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},p.a.createElement(a.a,{watch:!0,defaultValue:he.intro})),p.a.createElement("div",null,p.a.createElement(u.a.Item,{name:"attachment_ids"},p.a.createElement(k.b,null))),p.a.createElement(R.a,{gutter:[20,20]},p.a.createElement(I.a,{flex:"230px"},p.a.createElement(u.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},p.a.createElement(L.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),p.a.createElement(I.a,{flex:"230px"},p.a.createElement(u.a.Item,{name:"max_num",label:p.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},p.a.createElement(L.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),p.a.createElement(I.a,null,p.a.createElement("div",{className:"mt30"},"\uFF08\u5B66\u751F\u63D0\u4EA4\u4F5C\u54C1\u65F6\u9700\u8981\u5173\u8054\u540C\u7EC4\u6210\u5458\uFF0C\u7EC4\u5185\u6210\u5458\u4F5C\u54C1\u5171\u4EAB\uFF09"))),p.a.createElement(R.a,null,p.a.createElement(I.a,null,p.a.createElement(u.a.Item,{name:"base_on_project",valuePropName:"checked"},p.a.createElement(G.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),p.a.createElement("span",{className:"c-light-black"},"\uFF08\u9009\u4E2D\uFF0C\u5219\u5FC5\u987B\u5728\u672C\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u9879\u76EE\u7BA1\u7406\u5458\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF1B\u4E0D\u9009\u4E2D\uFF0C\u65E0\u9700\u5728\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u4EFB\u610F\u5C0F\u7EC4\u6210\u5458\u5747\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF09")))),p.a.createElement("div",{className:y.a.mdWrap},p.a.createElement(u.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},p.a.createElement(a.a,{watch:!0,defaultValue:he.notice})),p.a.createElement("div",null,p.a.createElement(u.a.Item,{name:"reference_attachment_ids"},p.a.createElement(k.b,null)))),p.a.createElement("div",{className:y.a.backgroundFa},p.a.createElement("div",{className:"pt40 mb30"},p.a.createElement(u.a.Item,null,p.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(y.a.button," mr20"),htmlType:"submit",loading:Z["newCourse/editCourse"]||Z["newCourse/submitCourse"]},"\u63D0\u4EA4"),p.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:y.a.button,onClick:function(){return h.d.push("/classrooms/".concat(be.params.coursesId,"/group_homework"))}},"\u53D6\u6D88"))))))};He.default=Object(h.a)(function(j){var W=j.shixunHomeworks,O=j.newCourse,P=j.loading,H=j.globalSetting;return{shixunHomeworks:W,newCourse:O,globalSetting:H,loading:P.effects}})(F)},ulZh:function(ot,He,ee){typeof window!="undefined"&&function(V,A){ot.exports=A()}(this,function(){return function(ne){var V={};function A(G){if(V[G])return V[G].exports;var U=V[G]={i:G,l:!1,exports:{}};return ne[G].call(U.exports,U,U.exports,A),U.l=!0,U.exports}return A.m=ne,A.c=V,A.d=function(G,U,R){A.o(G,U)||Object.defineProperty(G,U,{enumerable:!0,get:R})},A.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},A.t=function(G,U){if(U&1&&(G=A(G)),U&8)return G;if(U&4&&typeof G=="object"&&G&&G.__esModule)return G;var R=Object.create(null);if(A.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:G}),U&2&&typeof G!="string")for(var B in G)A.d(R,B,function(I){return G[I]}.bind(null,B));return R},A.n=function(G){var U=G&&G.__esModule?function(){return G.default}:function(){return G};return A.d(U,"a",U),U},A.o=function(G,U){return Object.prototype.hasOwnProperty.call(G,U)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,V,A){"use strict";var G=Object.prototype.hasOwnProperty,U="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(U=!1));function B(E,_,M){this.fn=E,this.context=_,this.once=M||!1}function I(E,_,M,C,T){if(typeof M!="function")throw new TypeError("The listener must be a function");var b=new B(M,C||E,T),d=U?U+_:_;return E._events[d]?E._events[d].fn?E._events[d]=[E._events[d],b]:E._events[d].push(b):(E._events[d]=b,E._eventsCount++),E}function D(E,_){--E._eventsCount===0?E._events=new R:delete E._events[_]}function L(){this._events=new R,this._eventsCount=0}L.prototype.eventNames=function(){var _=[],M,C;if(this._eventsCount===0)return _;for(C in M=this._events)G.call(M,C)&&_.push(U?C.slice(1):C);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(M)):_},L.prototype.listeners=function(_){var M=U?U+_:_,C=this._events[M];if(!C)return[];if(C.fn)return[C.fn];for(var T=0,b=C.length,d=new Array(b);T<b;T++)d[T]=C[T].fn;return d},L.prototype.listenerCount=function(_){var M=U?U+_:_,C=this._events[M];return C?C.fn?1:C.length:0},L.prototype.emit=function(_,M,C,T,b,d){var o=U?U+_:_;if(!this._events[o])return!1;var s=this._events[o],u=arguments.length,S,f;if(s.fn){s.once&&this.removeListener(_,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,M),!0;case 3:return s.fn.call(s.context,M,C),!0;case 4:return s.fn.call(s.context,M,C,T),!0;case 5:return s.fn.call(s.context,M,C,T,b),!0;case 6:return s.fn.call(s.context,M,C,T,b,d),!0}for(f=1,S=new Array(u-1);f<u;f++)S[f-1]=arguments[f];s.fn.apply(s.context,S)}else{var m=s.length,w;for(f=0;f<m;f++){s[f].once&&this.removeListener(_,s[f].fn,void 0,!0);switch(u){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,M);break;case 3:s[f].fn.call(s[f].context,M,C);break;case 4:s[f].fn.call(s[f].context,M,C,T);break;default:if(!S)for(w=1,S=new Array(u-1);w<u;w++)S[w-1]=arguments[w];s[f].fn.apply(s[f].context,S)}}}return!0},L.prototype.on=function(_,M,C){return I(this,_,M,C,!1)},L.prototype.once=function(_,M,C){return I(this,_,M,C,!0)},L.prototype.removeListener=function(_,M,C,T){var b=U?U+_:_;if(!this._events[b])return this;if(!M)return D(this,b),this;var d=this._events[b];if(d.fn)d.fn===M&&(!T||d.once)&&(!C||d.context===C)&&D(this,b);else{for(var o=0,s=[],u=d.length;o<u;o++)(d[o].fn!==M||T&&!d[o].once||C&&d[o].context!==C)&&s.push(d[o]);s.length?this._events[b]=s.length===1?s[0]:s:D(this,b)}return this},L.prototype.removeAllListeners=function(_){var M;return _?(M=U?U+_:_,this._events[M]&&D(this,M)):(this._events=new R,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=U,L.EventEmitter=L,ne.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,V,A){(function(G){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(L,E,_){if(_=_||{},L=L.trim(),E=E.trim(),!E){if(!_.alwaysNormalize)return L;var M=D.parseURL(L);if(!M)throw new Error("Error trying to parse base URL.");return M.path=D.normalizePath(M.path),D.buildURLFromParts(M)}var C=D.parseURL(E);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return _.alwaysNormalize?(C.path=D.normalizePath(C.path),D.buildURLFromParts(C)):E;var T=D.parseURL(L);if(!T)throw new Error("Error trying to parse base URL.");if(!T.netLoc&&T.path&&T.path[0]!=="/"){var b=R.exec(T.path);T.netLoc=b[1],T.path=b[2]}T.netLoc&&!T.path&&(T.path="/");var d={scheme:T.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=T.netLoc,C.path[0]!=="/"))if(!C.path)d.path=T.path,C.params||(d.params=T.params,C.query||(d.query=T.query));else{var o=T.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=D.normalizePath(s)}return d.path===null&&(d.path=_.alwaysNormalize?D.normalizePath(C.path):C.path),D.buildURLFromParts(d)},parseURL:function(L){var E=U.exec(L);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(B,"");L.length!==(L=L.replace(I,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};ne.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,V,A){function G(_){var M={};function C(b){if(M[b])return M[b].exports;var d=M[b]={i:b,l:!1,exports:{}};return _[b].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=_,C.c=M,C.i=function(b){return b},C.d=function(b,d,o){C.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},C.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return C.d(d,"a",d),d},C.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},C.p="/",C.oe=function(b){throw console.error(b),b};var T=C(C.s=ENTRY_MODULE);return T.default||T}var U="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function B(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(_){return!isNaN(1*_)}function D(_,M,C){var T={};T[C]=[];var b=M.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return T;for(var o=d[1],s=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),u;u=s.exec(b);){if(u[3]==="dll-reference")continue;T[C].push(u[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+R,"g");u=s.exec(b);)_[u[2]]||(T[C].push(u[1]),_[u[2]]=A(u[1]).m),T[u[2]]=T[u[2]]||[],T[u[2]].push(u[4]);for(var S=Object.keys(T),f=0;f<S.length;f++)for(var m=0;m<T[S[f]].length;m++)I(T[S[f]][m])&&(T[S[f]][m]=1*T[S[f]][m]);return T}function L(_){var M=Object.keys(_);return M.reduce(function(C,T){return C||_[T].length>0},!1)}function E(_,M){for(var C={main:[M]},T={main:[]},b={main:{}};L(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var s=d[o],u=C[s],S=u.pop();if(b[s]=b[s]||{},b[s][S]||!_[s][S])continue;b[s][S]=!0,T[s]=T[s]||[],T[s].push(S);for(var f=D(_,_[s][S],s),m=Object.keys(f),w=0;w<m.length;w++)C[m[w]]=C[m[w]]||[],C[m[w]]=C[m[w]].concat(f[m[w]])}return T}ne.exports=function(_,M){M=M||{};var C={main:A.m},T=M.all?{main:Object.keys(C.main)}:E(C,_),b="";Object.keys(T).filter(function(S){return S!=="main"}).forEach(function(S){for(var f=0;T[S][f];)f++;T[S].push(f),C[S][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+S+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+T[S].map(function(m){return""+JSON.stringify(m)+": "+C[S][m].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(_))+")({"+T.main.map(function(S){return""+JSON.stringify(S)+": "+C.main[S].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(M.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"hlsDefaultConfig",function(){return w}),A.d(V,"mergeConfig",function(){return h}),A.d(V,"enableStreamingMode",function(){return c});var G=A("./src/controller/abr-controller.ts"),U=A("./src/controller/audio-stream-controller.ts"),R=A("./src/controller/audio-track-controller.ts"),B=A("./src/controller/subtitle-stream-controller.ts"),I=A("./src/controller/subtitle-track-controller.ts"),D=A("./src/controller/buffer-controller.ts"),L=A("./src/controller/timeline-controller.ts"),E=A("./src/controller/cap-level-controller.ts"),_=A("./src/controller/fps-controller.ts"),M=A("./src/controller/eme-controller.ts"),C=A("./src/controller/cmcd-controller.ts"),T=A("./src/utils/xhr-loader.ts"),b=A("./src/utils/fetch-loader.ts"),d=A("./src/utils/cues.ts"),o=A("./src/utils/mediakeys-helper.ts"),s=A("./src/utils/logger.ts");function u(){return u=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(l[g]=v[g])}return l},u.apply(this,arguments)}function S(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(l);a&&(g=g.filter(function(y){return Object.getOwnPropertyDescriptor(l,y).enumerable})),v.push.apply(v,g)}return v}function f(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?S(Object(v),!0).forEach(function(g){m(l,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):S(Object(v)).forEach(function(g){Object.defineProperty(l,g,Object.getOwnPropertyDescriptor(v,g))})}return l}function m(l,a,v){return a in l?Object.defineProperty(l,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[a]=v,l}var w=f(f({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:T.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:D.default,capLevelController:E.default,fpsController:_.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},p()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:I.default,timelineController:L.TimelineController,audioStreamController:U.default,audioTrackController:R.default,emeController:M.default,cmcdController:C.default});function p(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},l,a)}function c(l){var a=l.loader;if(a!==b.default&&a!==T.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var v=Object(b.fetchSupported)();v&&(l.loader=b.default,l.progressive=!0,l.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),U=A("./src/utils/ewma-bandwidth-estimator.ts"),R=A("./src/events.ts"),B=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),D=A("./src/types/loader.ts"),L=A("./src/utils/logger.ts");function E(C,T){for(var b=0;b<T.length;b++){var d=T[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function _(C,T,b){return T&&E(C.prototype,T),b&&E(C,b),C}var M=function(){function C(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 d=b.config;this.bwEstimator=new U.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var T=C.prototype;return T.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},T.onFragLoading=function(d,o){var s=o.frag;if(s.type===D.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},T.onLevelLoaded=function(d,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},T._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,S=s.config,f=s.media;if(!d||!f)return;var m=o?o.stats:d.stats,w=o?o.duration:d.duration;if(m.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||f.paused||!f.playbackRate||!f.readyState)return;var p=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(p<=500*w/h)return;var c=s.levels,l=s.minAutoLevel,a=c[d.level],v=m.total||Math.max(m.loaded,Math.round(w*a.maxBitrate/8)),g=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/p),y=(v-m.loaded)/g,k=f.currentTime,F=(B.BufferHelper.bufferInfo(f,k,S.maxBufferHole).end-k)/h;if(F>=2*w/h||y<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var O=c[W].maxBitrate;if(j=w*O/(8*.8*g),j<F)break}if(j>=y)return;var P=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(G.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(p,m.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:m})},T.onFragLoaded=function(d,o){var s=o.frag,u=o.part;if(s.type===D.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(s.sn)){var S=u?u.stats:s.stats,f=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],w=(m.loaded?m.loaded.bytes:0)+S.loaded,p=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:w,duration:p},m.realBitrate=Math.round(8*w/p)}if(s.bitrateTest){var h={stats:S,frag:s,part:u,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},T.onFragBuffered=function(d,o){var s=o.frag,u=o.part,S=u?u.stats:s.stats;if(S.aborted)return;if(s.type!==D.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=S.parsing.end-S.loading.start;this.bwEstimator.sample(f,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},T.onError=function(d,o){switch(o.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},T.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},T.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.maxAutoLevel,S=s.config,f=s.minAutoLevel,m=s.media,w=o?o.duration:d?d.duration:0,p=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(m,p,S.maxBufferHole).end-p)/h,a=this.findBestLevel(c,f,u,l,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,g=S.abrBandWidthFactor,y=S.abrBandWidthUpFactor;if(!l){var k=this.bitrateTestDelay;if(k){var F=w?Math.min(w,S.maxLoadingDelay):S.maxLoadingDelay;v=F-k,L.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),g=y=1}}return a=this.findBestLevel(c,f,u,l+v,g,y),Math.max(a,0)},T.findBestLevel=function(d,o,s,u,S,f){for(var m,w=this.fragCurrent,p=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(m=l.details)!==null&&m!==void 0&&m.live),v=l==null?void 0:l.codecSet,g=p?p.duration:w?w.duration:0,y=s;y>=o;y--){var k=c[y];if(!k||v&&k.codecSet!==v)continue;var F=k.details,j=(p?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||g,W=void 0;y<=h?W=S*d:W=f*d;var O=c[y].maxBitrate,P=O*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(W)+"/"+O+"/"+j+"/"+u+"/"+P),W>O&&(!P||a&&!this.bitrateTestDelay||P<u))return y}return-1},_(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),C}();V.default=M},"./src/controller/audio-stream-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),U=A("./src/controller/base-stream-controller.ts"),R=A("./src/events.ts"),B=A("./src/utils/buffer-helper.ts"),I=A("./src/controller/fragment-tracker.ts"),D=A("./src/types/level.ts"),L=A("./src/types/loader.ts"),E=A("./src/loader/fragment.ts"),_=A("./src/demux/chunk-cache.ts"),M=A("./src/demux/transmuxer-interface.ts"),C=A("./src/types/transmuxer.ts"),T=A("./src/controller/fragment-finders.ts"),b=A("./src/utils/discontinuities.ts"),d=A("./src/errors.ts"),o=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(w){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},s.apply(this,arguments)}function u(w,p){w.prototype=Object.create(p.prototype),w.prototype.constructor=w,S(w,p)}function S(w,p){return S=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},S(w,p)}var f=100,m=function(w){u(p,w);function p(c,l){var a;return a=w.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=p.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(R.Events.ERROR,this.onError,this),l.on(R.Events.BUFFER_RESET,this.onBufferReset,this),l.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(R.Events.ERROR,this.onError,this),l.off(R.Events.BUFFER_RESET,this.onBufferReset,this),l.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var v=a.frag,g=a.id,y=a.initPTS;if(g==="main"){var k=v.cc;this.initPTS[v.cc]=y,this.log("InitPTS for cc: "+k+" found from main: "+y),this.videoTrackCC=k,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var l,a=this.levels,v=this.trackId,g=a==null||((l=a[v])===null||l===void 0)?void 0:l.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var y,k=performance.now(),F=this.retryDate;(!F||k>=F||(y=this.media)!==null&&y!==void 0&&y.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 W=j.frag,O=j.part,P=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var X=P.flush(),Z={frag:W,part:O,payload:X,networkDetails:null};this._handleFragmentLoadProgress(Z),H&&w.prototype._handleFragmentLoadComplete.call(this,Z)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var re=this.getLoadPosition(),be=B.BufferHelper.bufferInfo(this.mediaBuffer,re,this.config.maxBufferHole),fe=Object(T.fragmentWithinToleranceTest)(be.end,this.config.maxFragLookUpTolerance,W);fe<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+be.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,v=this.hls,g=this.levels,y=this.media,k=this.trackId,F=v.config;if(!g||!g[k])return;if(!y&&(this.startFragRequested||!F.startFragPrefetch))return;var j=g[k],W=j.details;if(!W||W.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(W)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(O===null)return;var P=O.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(P>=H&&!X)return;if(!X&&this._streamEnded(O,W)){v.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var Z=W.fragments,re=Z[0].start,be=O.end;if(X){var fe=this.getLoadPosition();be=fe,W.PTSKnown&&fe<re&&((O.end>re||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=re+.05))}var Te=this.getNextFragment(be,W);if(!Te){this.bufferFlushed=!0;return}((l=Te.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=Te.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Te,W):this.loadFragment(Te,W,be)},h.getMaxBufferLength=function(){var l=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(g){return new D.Level(g)})},h.onAudioTrackSwitching=function(l,a){var v=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(f):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var v,g=this.levels,y=a.details,k=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var F=g[k],j=0;if(y.live||(v=F.details)!==null&&v!==void 0&&v.live){var W=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!W)return;!F.details&&y.hasProgramDateTime&&W.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(y,W),j=y.fragments[0].start):j=this.alignPlaylists(y,F.details)}F.details=y,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(F.details,j),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=U.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,v=l.frag,g=l.part,y=l.payload,k=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var O=W.details;console.assert(O,"Audio track details are defined on fragment load progress");var P=k.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new M.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[v.cc],Z=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var re=!1,be=g?g.index:-1,fe=be!==-1,Te=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,y.byteLength,be,fe);H.push(y,Z,P,"",v,g,O.totalduration,re,Te,X)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+F);var pe=this.waitingData=this.waitingData||{frag:v,part:g,cache:new _.default,complete:!1},ge=pe.cache;ge.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var v=a.frag,g=a.part;if(v.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(g?" p: "+g.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,g)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var v=!0,g=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);g&&g.len>.5&&(v=!this.reduceMaxBufferLength(g.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var v=a.type;v===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,v="audio",g=this.hls,y=l.remuxResult,k=l.chunkMeta,F=this.getCurrentContext(k);if(!F){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var j=F.frag,W=F.part,O=y.audio,P=y.text,H=y.id3,X=y.initSegment;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,j,k),g.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:X.tracks})),O){var Z=O.startPTS,re=O.endPTS,be=O.startDTS,fe=O.endDTS;W&&(W.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:re,startDTS:be,endDTS:fe}),j.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,Z,re,be,fe),this.bufferFragmentData(O,j,W,k)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var Te=s({frag:j,id:v},H);g.trigger(R.Events.FRAG_PARSING_METADATA,Te)}if(P){var pe=s({frag:j,id:v},P);g.trigger(R.Events.FRAG_PARSING_USERDATA,pe)}},h._bufferInitSegment=function(l,a,v){if(this.state!==U.State.PARSING)return;l.video&&delete l.video;var g=l.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,l);var y=g.initSegment;if(y!=null&&y.byteLength){var k={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:y};this.hls.trigger(R.Events.BUFFER_APPENDING,k)}this.tick()},h.loadFragment=function(l,a,v){var g=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||g===I.FragmentState.NOT_LOADED||g===I.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,l,a,v)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:v})},p}(U.default);V.default=m},"./src/controller/audio-track-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),U=A("./src/errors.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function I(M,C){for(var T=0;T<C.length;T++){var b=C[T];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(M,b.key,b)}}function D(M,C,T){return C&&I(M.prototype,C),T&&I(M,T),M}function L(M,C){M.prototype=Object.create(C.prototype),M.prototype.constructor=M,E(M,C)}function E(M,C){return E=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},E(M,C)}var _=function(M){L(C,M);function C(b){var d;return d=M.call(this,b,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var T=C.prototype;return T.registerListeners=function(){var d=this.hls;d.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},T.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},T.onAudioTrackLoaded=function(d,o){var s=o.id,u=o.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var f=S.details;S.details=o.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,f))},T.onLevelLoading=function(d,o){this.switchLevel(o.level)},T.onLevelSwitching=function(d,o){this.switchLevel(o.level)},T.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!u.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var S={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},T.onError=function(d,o){if(M.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},T.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],S=u.id,f=u.groupId,m=f===void 0?"":f,w=u.name,p=u.type,h=u.url;if(this.trackId=d,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:m,name:w,type:p,url:h}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},T.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},T.findTrackId=function(d){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var u=o[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},T.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,u=o.groupId,S=o.url;if(d)try{S=d.addDirectives(S)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:u,deliveryDirectives:d||null})}},D(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),C}(R.default);V.default=_},"./src/controller/base-playlist-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return D});var G=A("./src/polyfills/number.ts"),U=A("./src/types/level.ts"),R=A("./src/controller/level-helper.ts"),B=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),D=function(){function L(_,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,M+":"),this.warn=B.logger.warn.bind(B.logger,M+":"),this.hls=_}var E=L.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(M,C){C.fatal&&C.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(M,C){var T=C==null?void 0:C.renditionReports;if(T)for(var b=0;b<T.length;b++){var d=T[b],o=""+d.URI;if(o===M.substr(-o.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);u!==void 0&&S>C.partTarget&&(u+=1)}if(Object(G.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(G.isFiniteNumber)(u)?u:void 0,U.HlsSkip.No)}}},E.loadPlaylist=function(M){},E.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},E.playlistLoaded=function(M,C,T){var b=this,d=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||T!=null&&T.live){if(d.reloaded(T),T&&this.log("live playlist "+M+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),T&&d.fragments.length>0&&Object(R.mergeDetails)(T,d),!this.canLoad||!d.live)return;var u,S=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,w=d.lastPartSn,p=d.endSN,h=d.lastPartIndex,c=h!==-1,l=w===p,a=m?0:h;c?(S=l?p+1:w,f=l?a:h+1):S=p+1;var v=d.age,g=v+d.ageHeader,y=Math.min(g-d.partTarget,d.targetduration*1.5);if(y>0){if(T&&y>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+y+" with playlist age: "+d.age),y=0;else{var k=Math.floor(y/d.targetduration);if(S+=k,f!==void 0){var F=Math.round(y%d.targetduration/d.partTarget);f+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+y+" skip sn "+k+" to part "+f)}d.tuneInGoal=y}if(u=this.getDeliveryDirectives(d,C.deliveryDirectives,S,f),m||!l){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,C.deliveryDirectives,S,f);var j=Object(R.computeReloadInterval)(d,o);S!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(u)},j)}else this.clearTimer()},E.getDeliveryDirectives=function(M,C,T,b){var d=Object(U.getSkipValue)(M,T);return C!=null&&C.skip&&M.deltaUpdateFailed&&(T=C.msn,b=C.part,d=U.HlsSkip.No),new U.HlsUrlParameters(T,b,d)},E.retryLoadingOrFail=function(M){var C=this,T=this.hls.config,b=this.retryCount<T.levelLoadingMaxRetry;if(b){var d;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(d=M.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*T.levelLoadingRetryDelay,T.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return b},L}()},"./src/controller/base-stream-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"State",function(){return p}),A.d(V,"default",function(){return h});var G=A("./src/polyfills/number.ts"),U=A("./src/task-loop.ts"),R=A("./src/controller/fragment-tracker.ts"),B=A("./src/utils/buffer-helper.ts"),I=A("./src/utils/logger.ts"),D=A("./src/events.ts"),L=A("./src/errors.ts"),E=A("./src/types/transmuxer.ts"),_=A("./src/utils/mp4-tools.ts"),M=A("./src/utils/discontinuities.ts"),C=A("./src/controller/fragment-finders.ts"),T=A("./src/controller/level-helper.ts"),b=A("./src/loader/fragment-loader.ts"),d=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),s=A("./src/types/loader.ts");function u(c,l){for(var a=0;a<l.length;a++){var v=l[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function S(c,l,a){return l&&u(c.prototype,l),a&&u(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,w(c,l)}function w(c,l){return w=Object.setPrototypeOf||function(v,g){return v.__proto__=g,v},w(c,l)}var p={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"},h=function(c){m(l,c);function l(v,g,y){var k;return k=c.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=p.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=y,k.log=I.logger.log.bind(I.logger,y+":"),k.warn=I.logger.warn.bind(I.logger,y+":"),k.hls=v,k.fragmentLoader=new b.default(v.config),k.fragmentTracker=g,k.config=v.config,k.decrypter=new d.default(v,v.config),v.on(D.Events.KEY_LOADED,k.onKeyLoaded,f(k)),k}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=p.STOPPED},a._streamEnded=function(g,y){var k=this.fragCurrent,F=this.fragmentTracker;if(!y.live&&k&&k.sn===y.endSN&&!g.nextStart){var j=F.getState(k);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(g,y){var k=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===p.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var g=this.config,y=this.fragCurrent,k=this.media,F=this.mediaBuffer,j=this.state,W=k?k.currentTime:0,O=B.BufferHelper.bufferInfo(F||k,W,g.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===p.ENDED)this.resetLoadingState();else if(y&&!O.len){var P=g.maxFragLookUpTolerance,H=y.start-P,X=y.start+y.duration+P,Z=W>X;(W<H||Z)&&(Z&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=W),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,y){if(this.state!==p.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=p.IDLE;var k=this.levels[y.frag.level].details;k&&this.loadFragment(y.frag,k,y.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=p.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,y){this.log("Loading key for "+g.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=p.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(D.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,y,k){this._loadFragForPlayback(g,y,k)},a._loadFragForPlayback=function(g,y,k){var F=this,j=function(O){if(F.fragContextChanged(g)){F.warn("Fragment "+g.sn+(O.part?" p: "+O.part.index:"")+" of level "+g.level+" was dropped during download."),F.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,F._handleFragmentLoadProgress(O)};this._doFragLoad(g,y,k,j).then(function(W){if(!W)return;F.fragLoadError=0;var O=F.state;if(F.fragContextChanged(g)){(O===p.FRAG_LOADING||O===p.BACKTRACKING||!F.fragCurrent&&O===p.PARSING)&&(F.fragmentTracker.removeFragment(g),F.state=p.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+g.sn+" of level "+g.level),F.hls.trigger(D.Events.FRAG_LOADED,W),F.state===p.BACKTRACKING)){F.fragmentTracker.backtrack(g,W),F.resetFragmentLoading(g);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,y,k){if(k===void 0&&(k=null),!(g-y))return;var F={startOffset:g,endOffset:y,type:k};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(g){var y=this;this._doFragLoad(g).then(function(k){if(!k||y.fragContextChanged(g)||!y.levels)throw new Error("init load aborted");return k}).then(function(k){var F=y.hls,j=k.payload,W=g.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(P){var H=self.performance.now();return F.trigger(D.Events.FRAG_DECRYPTED,{frag:g,payload:P,stats:{tstart:O,tdecrypt:H}}),k.payload=P,k})}return k}).then(function(k){var F=y.fragCurrent,j=y.hls,W=y.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[g.level].details;console.assert(O,"Level details are defined when init segment is loaded");var P=g.stats;y.state=p.IDLE,y.fragLoadError=0,g.data=new Uint8Array(k.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),k.frag===F&&j.trigger(D.Events.FRAG_BUFFERED,{stats:P,frag:F,part:null,id:g.type}),y.tick()}).catch(function(k){y.warn(k),y.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var y=this.fragCurrent;return!g||!y||g.level!==y.level||g.sn!==y.sn||g.urlId!==y.urlId},a.fragBufferedComplete=function(g,y){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(B.BufferHelper.getBuffered(k))),this.state=p.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var y=this.transmuxer;if(!y)return;var k=g.frag,F=g.part,j=g.partsLoaded,W=!j||j.length===0||j.some(function(P){return!P}),O=new E.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,F?F.index:-1,!W);y.flush(O)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,y,k,F){var j=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(g.start,k||0),this.config.lowLatencyMode&&y){var W=y.partList;if(W&&F){k>g.end&&y.fragmentHint&&(g=y.fragmentHint);var O=this.getNextPart(W,g,k);if(O>-1){var P=W[O];return this.log("Loading part sn: "+g.sn+" p: "+P.index+" cc: "+g.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=p.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:g,part:W[O],targetBufferTime:k}),this.doFragPartsLoad(g,W,O,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!g.url||this.loadedEndOfParts(W,k))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(k.toFixed(3))),Object(G.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=p.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:g,targetBufferTime:k}),this.fragmentLoader.load(g,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(g,y,k,F){var j=this;return new Promise(function(W,O){var P=[],H=function X(Z){var re=y[Z];j.fragmentLoader.loadPart(g,re,F).then(function(be){P[re.index]=be;var fe=be.part;j.hls.trigger(D.Events.FRAG_LOADED,be);var Te=y[Z+1];if(Te&&Te.fragment===g)X(Z+1);else return W({frag:g,part:fe,partsLoaded:P})}).catch(O)};H(k)})},a.handleFragLoadError=function(g){var y=g.data;return y&&y.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(D.Events.ERROR,y),null},a._handleTransmuxerFlush=function(g){var y=this.getCurrentContext(g);if(!y||this.state!==p.PARSING){this.fragCurrent||(this.state=p.IDLE);return}var k=y.frag,F=y.part,j=y.level,W=self.performance.now();k.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(k,F,j,g.partial)},a.getCurrentContext=function(g){var y=this.levels,k=g.level,F=g.sn,j=g.part;if(!y||!y[k])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+k+". The current chunk will not be buffered."),null;var W=y[k],O=j>-1?Object(T.getPartWith)(W,F,j):null,P=O?O.fragment:Object(T.getFragmentWithSN)(W,F,this.fragCurrent);return P?{frag:P,part:O,level:W}:null},a.bufferFragmentData=function(g,y,k,F){if(!g||this.state!==p.PARSING)return;var j=g.data1,W=g.data2,O=j;if(j&&W&&(O=Object(_.appendUint8Array)(j,W)),!O||!O.length)return;var P={type:g.type,frag:y,part:k,chunkMeta:F,parent:y.type,data:O};this.hls.trigger(D.Events.BUFFER_APPENDING,P),g.dropped&&g.independent&&!k&&this.flushBufferGap(y)},a.flushBufferGap=function(g){var y=this.media;if(!y)return;if(!B.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,g.start);return}var k=y.currentTime,F=B.BufferHelper.bufferInfo(y,k,0),j=g.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),O=Math.max(Math.min(g.start-W,F.end-W),k+W);g.start-O>W&&this.flushMainBuffer(O,g.start)},a.getFwdBufferInfo=function(g,y){var k=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(g,F,k.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,y);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(g,F,Math.max(j.nextStart,k.maxBufferHole))}return j},a.getMaxBufferLength=function(g){var y=this.config,k;return g?k=Math.max(8*y.maxBufferSize/g,y.maxBufferLength):k=y.maxBufferLength,Math.min(k,y.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var y=this.config,k=g||y.maxBufferLength;return y.maxMaxBufferLength>=k?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,y){var k,F,j=y.fragments,W=j.length;if(!W)return null;var O=this.config,P=j[0].start,H;if(y.live){var X=O.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(y,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:g)}else g<=P&&(H=j[0]);if(!H){var Z=O.lowLatencyMode?y.partEnd:y.fragmentEnd;H=this.getFragmentAtPosition(g,Z,y)}return(k=H)!==null&&k!==void 0&&k.initSegment&&!((F=H)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(g,y,k){for(var F=-1,j=!1,W=!0,O=0,P=g.length;O<P;O++){var H=g[O];if(W=W&&!H.independent,F>-1&&k<H.start)break;var X=H.loaded;!X&&(j||H.independent||W)&&H.fragment===y&&(F=O),j=X}return F},a.loadedEndOfParts=function(g,y){var k=g[g.length-1];return k&&y>k.start&&k.loaded},a.getInitialLiveFragment=function(g,y){var k=this.fragPrevious,F=null;if(k){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),F=Object(C.findFragmentByPDT)(y,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=k.sn+1;if(j>=g.startSN&&j<=g.endSN){var W=y[j-g.startSN];k.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(y,k.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(F=this.getFragmentAtPosition(O,this.bitrateTest?g.fragmentEnd:g.edge,g))}return F},a.getFragmentAtPosition=function(g,y,k){var F=this.config,j=this.fragPrevious,W=k.fragments,O=k.endSN,P=k.fragmentHint,H=F.maxFragLookUpTolerance,X=!!(F.lowLatencyMode&&k.partList&&P);X&&P&&!this.bitrateTest&&(W=W.concat(P),O=P.sn);var Z;if(g<y){var re=g>y-H?0:H;Z=Object(C.findFragmentByPTS)(j,W,g,re)}else Z=W[W.length-1];if(Z){var be=Z.sn-k.startSN,fe=j&&Z.level===j.level,Te=W[be+1],pe=this.fragmentTracker.getState(Z);if(pe===R.FragmentState.BACKTRACKED){Z=null;for(var ge=be;W[ge]&&this.fragmentTracker.getState(W[ge])===R.FragmentState.BACKTRACKED;)j?Z=W[ge--]:Z=W[--ge];Z||(Z=Te)}else j&&Z.sn===j.sn&&!X&&(fe&&(Z.sn<O&&this.fragmentTracker.getState(Te)!==R.FragmentState.OK?(this.log("SN "+Z.sn+" just loaded, load next one: "+Te.sn),Z=Te):Z=null))}return Z},a.synchronizeToLiveEdge=function(g){var y=this.config,k=this.media;if(!k)return;var F=this.hls.liveSyncPosition,j=k.currentTime,W=g.fragments[0].start,O=g.edge,P=j>=W-y.maxFragLookUpTolerance&&j<=O;if(F!==null&&k.duration>F&&(j<F||!P)){var H=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*g.targetduration;(!P&&k.readyState<4||j<O-H)&&(this.loadedmetadata||(this.nextLoadPosition=F),k.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+F.toFixed(3)),k.currentTime=F))}},a.alignPlaylists=function(g,y){var k=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?k[F]:null,O=g.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var P=g.fragments[0].start,H=!y,X=g.alignedSliding&&Object(G.isFiniteNumber)(P);if(H||!X&&!P){Object(M.alignStream)(j,W,g);var Z=g.fragments[0].start;return this.log("Live playlist sliding: "+Z.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+g.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+O),Z}return P},a.waitForCdnTuneIn=function(g){var y=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*y)},a.setStartPosition=function(g,y){var k=this.startPosition;if(k<y&&(k=-1),k===-1||this.lastCurrentTime===-1){var F=g.startTimeOffset;Object(G.isFiniteNumber)(F)?(k=y+F,F<0&&(k+=g.totalduration),k=Math.min(Math.max(y,k),y+g.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+k),this.startPosition=k):g.live?k=this.hls.liveSyncPosition||y:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},a.getLoadPosition=function(){var g=this.media,y=0;return this.loadedmetadata&&g?y=g.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},a.handleFragLoadAborted=function(g,y){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(y?" part"+y.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=p.IDLE)},a.onFragmentOrKeyLoadError=function(g,y){if(y.fatal)return;var k=y.frag;if(!k||k.type!==g)return;var F=this.fragCurrent;console.assert(F&&k.sn===F.sn&&k.level===F.level&&k.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(k.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+g+" "+k.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=p.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(g===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=p.IDLE):(I.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=p.ERROR)},a.afterBufferFlushed=function(g,y,k){if(!g)return;var F=B.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(y,F,k),this.state===p.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=p.IDLE},a.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[g].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(g,y,k,F){var j=this,W=k.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(g.elementaryStreams).reduce(function(P,H){var X=g.elementaryStreams[H];if(X){var Z=X.endPTS-X.startPTS;if(Z<=0)return j.warn("Could not parse fragment "+g.sn+" "+H+" duration reliably ("+Z+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),P||!1;var re=F?0:Object(T.updateFragPTSDTS)(W,g,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return j.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:W,level:k,drift:re,type:H,frag:g,start:X.startPTS,end:X.endPTS}),!0}return P},!1);O?(this.state=p.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:g,part:y})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(l,[{key:"state",get:function(){return this._state},set:function(g){var y=this._state;y!==g&&(this._state=g,this.log(y+"->"+g))}}]),l}(U.default)},"./src/controller/buffer-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/polyfills/number.ts"),U=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./src/errors.ts"),I=A("./src/utils/buffer-helper.ts"),D=A("./src/utils/mediasource-helper.ts"),L=A("./src/loader/fragment.ts"),E=A("./src/controller/buffer-operation-queue.ts"),_=Object(D.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function T(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,u=o.media,S=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:u})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=T.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 o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(o,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(o,s){var u=this.media=s.media;if(u&&_){var S=this.mediaSource=new _;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(S),this._objectUrl=u.src}},b.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){R.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),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):R.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 o=this;this.getSourceBufferTypes().forEach(function(s){var u=o.sourceBuffer[s];try{u&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[s]=void 0)}catch(S){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},b.onBufferCodecs=function(o,s){var u=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(S){var m=u.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var w=s[f],p=w.codec,h=w.levelCodec,c=w.container,l=(m.levelCodec||m.codec).replace(M,"$1"),a=(h||p).replace(M,"$1");if(l!==a){var v=c+";codecs="+(h||p);u.appendChangeType(f,v)}}}else u.pendingTracks[f]=s[f]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(o,s){var u=this,S=this.operationQueue,f={execute:function(){var w=u.sourceBuffer[o];w&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),w.changeType(s)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};S.append(f,o)},b.onBufferAppending=function(o,s){var u=this,S=this.hls,f=this.operationQueue,m=this.tracks,w=s.data,p=s.type,h=s.frag,c=s.part,l=s.chunkMeta,a=l.buffering[p],v=self.performance.now();a.start=v;var g=h.stats.buffering,y=c?c.stats.buffering:null;g.start===0&&(g.start=v),y&&y.start===0&&(y.start=v);var k=m.audio,F=p==="audio"&&l.id===1&&(k==null?void 0:k.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var O=u.sourceBuffer[p];if(O){var P=h.start-O.timestampOffset;Math.abs(P)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+P+") sn: "+h.sn+")"),O.timestampOffset=h.start)}}u.appendExecutor(w,p)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,g.first===0&&(g.first=O),y&&y.first===0&&(y.first=O);var P=u.sourceBuffer,H={};for(var X in P)H[X]=I.BufferHelper.getBuffered(P[X]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:p,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(O){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+p+" SourceBuffer",O);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>S.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),S.trigger(U.Events.ERROR,P)}};f.append(j,p)},b.onBufferFlushing=function(o,s){var u=this,S=this.operationQueue,f=function(w){return{execute:u.removeExecutor.bind(u,w,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:w})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",h)}}};s.type?S.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){S.append(f(m),m)})},b.onFragParsed=function(o,s){var u=this,S=s.frag,f=s.part,m=[],w=f?f.elementaryStreams:S.elementaryStreams;w[L.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(w[L.ElementaryStreamTypes.AUDIO]&&m.push("audio"),w[L.ElementaryStreamTypes.VIDEO]&&m.push("video"));var p=function(){var c=self.performance.now();S.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var l=f?f.stats:S.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:S,part:f,stats:l,id:S.type})};m.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(p,m)},b.onFragChanged=function(o,s){this.flushBackBuffer()},b.onBufferEos=function(o,s){var u=this,S=this.getSourceBufferTypes().reduce(function(f,m){var w=u.sourceBuffer[m];return(!s.type||s.type===m)&&(w&&!w.ended&&(w.ended=!0,R.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),f&&!!(!w||w.ended)},!0);S&&this.blockBuffers(function(){var f=u.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},b.onLevelUpdated=function(o,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var o=this.hls,s=this.details,u=this.media,S=this.sourceBuffer;if(!u||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(m)||m<0)return;var w=u.currentTime,p=s.levelTargetDuration,h=Math.max(m,p),c=Math.floor(w/p)*p-h;f.forEach(function(l){var a=S[l];if(a){var v=I.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,u=this.media,S=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=u.duration,w=Object(G.isFiniteNumber)(S.duration)?S.duration:0;o.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(f>w&&f>m||!Object(G.isFiniteNumber)(m))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),S.duration=f)},b.updateSeekableRange=function(o){var s=this.mediaSource,u=o.fragments,S=u.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,u[0].start),m=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,m)}},b.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,S=Object.keys(u).length;if(S&&!o||S===2){this.createSourceBuffers(u),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(m){s.executeNext(m)})}},b.createSourceBuffers=function(o){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var f in o)if(!s[f]){var m=o[f];if(!m)throw Error("source buffer exists for track "+f+", however track does not");var w=m.levelCodec||m.codec,p=m.container+";codecs="+w;R.logger.log("[buffer-controller]: creating sourceBuffer("+p+")");try{var h=s[f]=u.addSourceBuffer(p),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:w,container:m.container,levelCodec:m.levelCodec,id:m.id},S++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:p})}}S&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(o){var s=this.operationQueue,u=s.current(o);u.onStart()},b._onSBUpdateEnd=function(o){var s=this.operationQueue,u=s.current(o);u.onComplete(),s.shiftAndExecuteNext(o)},b._onSBUpdateError=function(o,s){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(s)},b.removeExecutor=function(o,s,u){var S=this.media,f=this.mediaSource,m=this.operationQueue,w=this.sourceBuffer,p=w[o];if(!S||!f||!p){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(S.duration)?S.duration:Infinity,c=Object(G.isFiniteNumber)(f.duration)?f.duration:Infinity,l=Math.max(0,s),a=Math.min(u,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!p.updating,o+" sourceBuffer must not be updating"),p.remove(l,a)):m.shiftAndExecuteNext(o)},b.appendExecutor=function(o,s){var u=this.operationQueue,S=this.sourceBuffer,f=S[s];if(!f){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(o)},b.blockBuffers=function(o,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,f=s.map(function(m){return S.appendBlocker(m)});Promise.all(f).then(function(){o(),s.forEach(function(m){var w=u.sourceBuffer[m];(!w||!w.updating)&&S.shiftAndExecuteNext(m)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(o,s,u){var S=this.sourceBuffer[o];if(!S)return;var f=u.bind(this,o);this.listeners[o].push({event:s,listener:f}),S.addEventListener(s,f)},b.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(u){s.removeEventListener(u.event,u.listener)})},T}()},"./src/controller/buffer-operation-queue.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return U});var G=A("./src/utils/logger.ts"),U=function(){function R(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var B=R.prototype;return B.append=function(D,L){var E=this.queues[L];E.push(D),E.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(D,L){var E=this.queues[L];E.unshift(D),this.executeNext(L)},B.appendBlocker=function(D){var L,E=new Promise(function(M){L=M}),_={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(_,D),E},B.executeNext=function(D){var L=this.buffers,E=this.queues,_=L[D],M=E[D];if(M.length){var C=M[0];try{C.execute()}catch(T){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(T),(!_||!_.updating)&&(M.shift(),this.executeNext(D))}}},B.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},B.current=function(D){return this.queues[D][0]},R}()},"./src/controller/cap-level-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/events.ts");function U(I,D){for(var L=0;L<D.length;L++){var E=D[L];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(I,E.key,E)}}function R(I,D,L){return D&&U(I.prototype,D),L&&U(I,L),I}var B=function(){function I(L){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=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=I.prototype;return D.setStreamController=function(E){this.streamController=E},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var E=this.hls;E.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var E=this.hls;E.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(E,_){I.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},D.onMediaAttaching=function(E,_){this.media=_.media instanceof HTMLVideoElement?_.media:null},D.onManifestParsed=function(E,_){var M=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,M.config.capLevelToPlayerSize&&_.video&&this.startCapping()},D.onBufferCodecs=function(E,_){var M=this.hls;M.config.capLevelToPlayerSize&&_.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var _=this.hls;_.autoLevelCapping=this.getMaxLevel(E.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},D.getMaxLevel=function(E){var _=this,M=this.hls.levels;if(!M.length)return-1;var C=M.filter(function(T,b){return I.isLevelAllowed(b,_.restrictedLevels)&&b<=E});return this.clientRect=null,I.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},D.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()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,_={width:0,height:0};if(E){var M=E.getBoundingClientRect();_.width=M.width,_.height=M.height,!_.width&&!_.height&&(_.width=M.right-M.left||E.width||0,_.height=M.bottom-M.top||E.height||0)}return this.clientRect=_,_},I.isLevelAllowed=function(E,_){return _===void 0&&(_=[]),_.indexOf(E)===-1},I.getMaxLevelByMediaSize=function(E,_,M){if(!E||!E.length)return-1;for(var C=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},T=E.length-1,b=0;b<E.length;b+=1){var d=E[b];if((d.width>=_||d.height>=M)&&C(d,E[b+1])){T=b;break}}return T},R(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(_){}return E}}]),I}();V.default=B},"./src/controller/cmcd-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/events.ts"),U=A("./src/types/cmcd.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/utils/logger.ts");function I(T,b){for(var d=0;d<b.length;d++){var o=b[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(T,o.key,o)}}function D(T,b,d){return b&&I(T.prototype,b),d&&I(T,d),T}function L(T,b){var d=typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(d)return(d=d.call(T)).next.bind(d);if(Array.isArray(T)||(d=E(T))||b&&T&&typeof T.length=="number"){d&&(T=d);var o=0;return function(){return o>=T.length?{done:!0}:{done:!1,value:T[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(T,b){if(!T)return;if(typeof T=="string")return _(T,b);var d=Object.prototype.toString.call(T).slice(8,-1);if(d==="Object"&&T.constructor&&(d=T.constructor.name),d==="Map"||d==="Set")return Array.from(T);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return _(T,b)}function _(T,b){(b==null||b>T.length)&&(b=T.length);for(var d=0,o=new Array(b);d<b;d++)o[d]=T[d];return o}function M(){return M=Object.assign||function(T){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(T[o]=d[o])}return T},M.apply(this,arguments)}var C=function(){function T(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){B.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(S){try{var f=S.frag,m=o.hls.levels[f.level],w=o.getObjectType(f),p={d:f.duration*1e3,ot:w};(w===U.CMCDObjectType.VIDEO||w===U.CMCDObjectType.AUDIO||w==U.CMCDObjectType.MUXED)&&(p.br=m.bitrate/1e3,p.tb=o.getTopBandwidth(w),p.bl=o.getBufferLength(w)),o.apply(S,p)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||T.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var b=T.prototype;return b.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.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(o,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(o,s){var u,S;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},b.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(o,s){s===void 0&&(s={}),M(s,this.createData());var u=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=T.toHeaders(s);if(!Object.keys(S).length)return;o.headers||(o.headers={}),M(o.headers,S)}else{var f=T.toQuery(s);if(!f)return;o.url=T.appendQueryToUri(o.url,f)}},b.getObjectType=function(o){var s=o.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.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(o){for(var s=0,u=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=L(u),f;!(f=S()).done;){var m=f.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},b.getBufferLength=function(o){var s=this.hls.media,u=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var S=R.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return S.len*1e3},b.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,u=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new u(m)}var f=S.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,p,h){s(w),this.loader.load(w,p,h)},D(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},b.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,u=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new u(m)}var f=S.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,p,h){s(w),this.loader.load(w,p,h)},D(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},T.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},T.serialize=function(o){for(var s=[],u=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},S=function(F){return Math.round(F)},f=function(F){return S(F/100)*100},m=function(F){return encodeURIComponent(F)},w={br:S,d:S,bl:f,dl:f,mtp:f,nor:m,rtp:f,tb:S},p=Object.keys(o||{}).sort(),h=L(p),c;!(c=h()).done;){var l=c.value,a=o[l];if(!u(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var v=w[l];v&&(a=v(a));var g=typeof a,y=void 0;l==="ot"||l==="sf"||l==="st"?y=l+"="+a:g==="boolean"?y=l:g==="number"?y=l+"="+a:y=l+"="+JSON.stringify(a),s.push(y)}return s.join(",")},T.toHeaders=function(o){for(var s=Object.keys(o),u={},S=["Object","Request","Session","Status"],f=[{},{},{},{}],m={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},w=0,p=s;w<p.length;w++){var h=p[w],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var l=0;l<f.length;l++){var a=T.serialize(f[l]);a&&(u["CMCD-"+S[l]]=a)}return u},T.toQuery=function(o){return"CMCD="+encodeURIComponent(T.serialize(o))},T.appendQueryToUri=function(o,s){if(!s)return o;var u=o.includes("?")?"&":"?";return""+o+u+s},T}()},"./src/controller/eme-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),U=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=A("./src/utils/mediakeys-helper.ts");function I(C,T){for(var b=0;b<T.length;b++){var d=T[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function D(C,T,b){return T&&I(C.prototype,T),b&&I(C,b),C}var L=3,E=function(T,b,d){var o={audioCapabilities:[],videoCapabilities:[]};return T.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),b.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[o]},_=function(T,b,d,o){switch(T){case B.KeySystems.WIDEVINE:return E(b,d,o);default:throw new Error("Unknown key-system: "+T)}},M=function(){function C(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 T=C.prototype;return T.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},T._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},T._attemptKeySystemAccess=function(d,o,s){var u=this,S=_(d,o,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,S);this.mediaKeysPromise=f.then(function(m){return u._onMediaKeySystemAccessObtained(d,m)}),f.catch(function(m){R.logger.error('Failed to obtain key-system "'+d+'" access:',m)})},T._onMediaKeySystemAccessObtained=function(d,o){var s=this;R.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return u.mediaKeys=f,R.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),f});return S.catch(function(f){R.logger.error("Failed to create media-keys:",f)}),S},T._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},T._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){o._onKeySessionMessage(d,s.message)},!1)},T._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},T.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},T._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},T._generateRequestWithPreferredKeySession=function(d,o){var s=this,u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var S=u.mediaKeysSession;if(!S){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,S.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(f){R.logger.error("Error generating key-session request:",f),s.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},T._createLicenseXhr=function(d,o,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,u,d),S=void 0}catch(f){R.logger.error(f)}try{u.readyState||u.open("POST",d,!0),S&&S.call(this.hls,u,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return u},T._onLicenseRequestReadyStageChange=function(d,o,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var S=d.response,f=this._licenseResponseCallback;if(f)try{S=f.call(this.hls,d,o)}catch(w){R.logger.error(w)}u(S)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=L-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,u)}break}},T._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},T._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(u,d,o);R.logger.log("Sending license request to URL: "+u);var f=this._generateLicenseRequestChallenge(s,d);S.send(f)}catch(m){R.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},T.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},T.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},T.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var s=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),u=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,u)},D(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=M},"./src/controller/fps-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),U=A("./src/utils/logger.ts"),R=function(){function B(D){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=D,this.registerListeners()}var I=B.prototype;return I.setStreamController=function(L){this.streamController=L},I.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(L,E){var _=this.hls.config;if(_.capLevelOnFPSDrop){var M=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),_.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(L,E,_){var M=performance.now();if(E){if(this.lastTime){var C=M-this.lastTime,T=_-this.lastDroppedFrames,b=E-this.lastDecodedFrames,d=1e3*T/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:T,currentDecoded:b,totalDroppedFrames:_}),d>0&&T>o.config.fpsDroppedMonitoringThreshold*b){var s=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=_,this.lastDecodedFrames=E}},I.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var E=L.getVideoPlaybackQuality();this.checkFPS(L,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"findFragmentByPDT",function(){return R}),A.d(V,"findFragmentByPTS",function(){return B}),A.d(V,"fragmentWithinToleranceTest",function(){return I}),A.d(V,"pdtWithinToleranceTest",function(){return D}),A.d(V,"findFragWithCC",function(){return L});var G=A("./src/polyfills/number.ts"),U=A("./src/utils/binary-search.ts");function R(E,_,M){if(_===null||!Array.isArray(E)||!E.length||!Object(G.isFiniteNumber)(_))return null;var C=E[0].programDateTime;if(_<(C||0))return null;var T=E[E.length-1].endProgramDateTime;if(_>=(T||0))return null;M=M||0;for(var b=0;b<E.length;++b){var d=E[b];if(D(_,M,d))return d}return null}function B(E,_,M,C){M===void 0&&(M=0),C===void 0&&(C=0);var T=null;if(E?T=_[E.sn-_[0].sn+1]||null:M===0&&_[0].start===0&&(T=_[0]),T&&I(M,C,T)===0)return T;var b=U.default.search(_,I.bind(null,M,C));return b||T}function I(E,_,M){E===void 0&&(E=0),_===void 0&&(_=0);var C=Math.min(_,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-C<=E?1:M.start-C>E&&M.start?-1:0}function D(E,_,M){var C=Math.min(_,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,T=M.endProgramDateTime||0;return T-C>E}function L(E,_){return U.default.search(E,function(M){return M.cc<_?1:M.cc>_?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"FragmentState",function(){return R}),A.d(V,"FragmentTracker",function(){return B});var G=A("./src/events.ts"),U=A("./src/types/loader.ts"),R;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(R||(R={}));var B=function(){function L(_){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=_,this._registerListeners()}var E=L.prototype;return E._registerListeners=function(){var M=this.hls;M.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var M=this.hls;M.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(M,C){if(C===U.PlaylistLevelType.MAIN){var T=this.activeFragment,b=this.activeParts;if(!T)return null;if(b)for(var d=b.length;d--;){var o=b[d],s=o?o.end:T.appendedPTS;if(o.start<=M&&s!==void 0&&M<=s)return d>9&&(this.activeParts=b.slice(d-9)),o}else if(T.start<=M&&T.appendedPTS!==void 0&&M<=T.appendedPTS)return T}return this.getBufferedFrag(M,C)},E.getBufferedFrag=function(M,C){for(var T=this.fragments,b=Object.keys(T),d=b.length;d--;){var o=T[b[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=M&&M<=s.end)return s}}return null},E.detectEvictedFragments=function(M,C,T){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(!o.buffered){o.body.type===T&&b.removeFragment(o.body);return}var s=o.range[M];if(!s)return;s.time.some(function(u){var S=!b.isTimeBuffered(u.startPTS,u.endPTS,C);return S&&b.removeFragment(o.body),S})})},E.detectPartialFragments=function(M){var C=this,T=this.timeRanges,b=M.frag,d=M.part;if(!T||b.sn==="initSegment")return;var o=D(b),s=this.fragments[o];if(!s)return;Object.keys(T).forEach(function(u){var S=b.elementaryStreams[u];if(!S)return;var f=T[u],m=d!==null||S.partial===!0;s.range[u]=C.getBufferedTimes(b,d,m,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},E.fragBuffered=function(M){var C=D(M),T=this.fragments[C];T&&(T.backtrack=T.loaded=null,T.buffered=!0)},E.getBufferedTimes=function(M,C,T,b){for(var d={time:[],partial:T},o=C?C.start:M.start,s=C?C.end:M.end,u=M.minEndPTS||s,S=M.maxStartPTS||o,f=0;f<b.length;f++){var m=b.start(f)-this.bufferPadding,w=b.end(f)+this.bufferPadding;if(S>=m&&u<=w){d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});break}else if(o<w&&s>m)d.partial=!0,d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});else if(s<=m)break}return d},E.getPartialFragment=function(M){var C=null,T,b,d,o=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(S){var f=u[S];if(!f)return;I(f)&&(b=f.body.start-s,d=f.body.end+s,M>=b&&M<=d&&(T=Math.min(M-b,d-M),o<=T&&(C=f.body,o=T)))}),C},E.getState=function(M){var C=D(M),T=this.fragments[C];return T?T.buffered?I(T)?R.PARTIAL:R.OK:T.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},E.backtrack=function(M,C){var T=D(M),b=this.fragments[T];if(!b||b.backtrack)return null;var d=b.backtrack=C||b.loaded;return b.loaded=null,d},E.getBacktrackData=function(M){var C=D(M),T=this.fragments[C];if(T){var b,d=T.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(M)}return null},E.isTimeBuffered=function(M,C,T){for(var b,d,o=0;o<T.length;o++){if(b=T.start(o)-this.bufferPadding,d=T.end(o)+this.bufferPadding,M>=b&&C<=d)return!0;if(C<=b)return!1}return!1},E.onFragLoaded=function(M,C){var T=C.frag,b=C.part;if(T.sn==="initSegment"||T.bitrateTest||b)return;var d=D(T);this.fragments[d]={body:T,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(M,C){var T=this,b=C.frag,d=C.part,o=C.timeRanges;if(b.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var S=o[u];if(T.detectEvictedFragments(u,S),!d)for(var f=0;f<S.length;f++)b.appendedPTS=Math.max(S.end(f),b.appendedPTS||0)})},E.onFragBuffered=function(M,C){this.detectPartialFragments(C)},E.hasFragment=function(M){var C=D(M);return!!this.fragments[C]},E.removeFragmentsInRange=function(M,C,T){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(o.buffered){var s=o.body;s.type===T&&s.start<C&&s.end>M&&b.removeFragment(s)}})},E.removeFragment=function(M){var C=D(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[C]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function I(L){var E,_;return L.buffered&&(((E=L.range.video)===null||E===void 0?void 0:E.partial)||((_=L.range.audio)===null||_===void 0?void 0:_.partial))}function D(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"STALL_MINIMUM_DURATION_MS",function(){return I}),A.d(V,"MAX_START_GAP_JUMP",function(){return D}),A.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),A.d(V,"SKIP_BUFFER_RANGE_START",function(){return E}),A.d(V,"default",function(){return _});var G=A("./src/utils/buffer-helper.ts"),U=A("./src/errors.ts"),R=A("./src/events.ts"),B=A("./src/utils/logger.ts"),I=250,D=2,L=.1,E=.05,_=function(){function M(T,b,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=T,this.media=b,this.fragmentTracker=d,this.hls=o}var C=M.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(b){var d=this.config,o=this.media,s=this.stalled,u=o.currentTime,S=o.seeking,f=this.seeking&&!S,m=!this.seeking&&S;if(this.seeking=S,u!==b){if(this.moved=!0,s!==null){if(this.stallReported){var w=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var p=G.BufferHelper.bufferInfo(o,u,0),h=p.len>0,c=p.nextStart||0;if(!h&&!c)return;if(S){var l=p.len>D,a=!c||c-u>D&&!this.fragmentTracker.getPartialFragment(u);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,g=Math.max(c,p.start||0)-u,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=y==null||((v=y.details)===null||v===void 0)?void 0:v.live,F=k?y.details.targetduration*2:D;if(g>0&&g<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!S&&W>=I&&this._reportStall(p.len);var O=G.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(O,W)},C._tryFixBufferStall=function(b,d){var o=this.config,s=this.fragmentTracker,u=this.media,S=u.currentTime,f=s.getPartialFragment(S);if(f){var m=this._trySkipBufferHole(f);if(m)return}b.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(b){var d=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},C._trySkipBufferHole=function(b){for(var d=this.config,o=this.hls,s=this.media,u=s.currentTime,S=0,f=G.BufferHelper.getBuffered(s),m=0;m<f.length;m++){var w=f.start(m);if(u+d.maxBufferHole>=S&&u<w){var p=Math.max(w+E,s.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+p),this.moved=!0,this.stalled=null,s.currentTime=p,b&&o.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+p,frag:b}),p}S=f.end(m)}return 0},C._tryNudgeBuffer=function(){var b=this.config,d=this.hls,o=this.media,s=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<b.nudgeMaxRetry){var S=s+u*b.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+S),o.currentTime=S,d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),U=A("./src/utils/texttrack-utils.ts"),R=A("./src/demux/id3.ts"),B=.25,I=function(){function D(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var L=D.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var _=this.hls;_.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var _=this.hls;_.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(_,M){this.media=M.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(_){if(!this.media)return;for(var M=0;M<_.length;M++){var C=_[M];if(C.kind==="metadata"&&C.label==="id3")return Object(U.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(_,M){if(!this.media)return;var C=M.frag,T=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<T.length;d++){var o=R.getID3Frames(T[d].data);if(o){var s=T[d].pts,u=d<T.length-1?T[d+1].pts:C.end,S=u-s;S<=0&&(u=s+B);for(var f=0;f<o.length;f++){var m=o[f];if(!R.isTimeStampFrame(m)){var w=new b(s,u,"");w.value=m,this.id3Track.addCue(w)}}}}},L.onBufferFlushing=function(_,M){var C=M.startOffset,T=M.endOffset,b=M.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(U.removeCuesInRange)(d,C,T)}},D}();V.default=I},"./src/controller/latency-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return D});var G=A("./src/errors.ts"),U=A("./src/events.ts"),R=A("./src/utils/logger.ts");function B(L,E){for(var _=0;_<E.length;_++){var M=E[_];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(L,M.key,M)}}function I(L,E,_){return E&&B(L.prototype,E),_&&B(L,_),L}var D=function(){function L(_){var M=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return M.timeupdate()},this.hls=_,this.config=_.config,this.registerListeners()}var E=L.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.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)},E.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)},E.onMediaAttached=function(M,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(M,C){var T=C.details;this.levelDetails=T,T.advanced&&this.timeupdate(),!T.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(M,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var M=this.media,C=this.levelDetails;if(!M||!C)return;this.currentTime=M.currentTime;var T=this.computeLatency();if(T===null)return;this._latency=T;var b=this.config,d=b.lowLatencyMode,o=b.maxLiveSyncPlaybackRate;if(!d||o===1)return;var s=this.targetLatency;if(s===null)return;var u=T-s,S=Math.min(this.maxLatency,s+C.targetduration),f=u<S;if(C.live&&f&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;M.playbackRate=Math.min(m,Math.max(1,w))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},E.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},E.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},I(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,C=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:C?M.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var C=M.holdBack,T=M.partHoldBack,b=M.targetduration,d=this.config,o=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,S=this.hls.userConfig,f=u&&T||C;(S.liveSyncDuration||S.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:s*b);var m=b,w=1;return f+Math.min(this.stallCount*w,m)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),C=this.targetLatency,T=this.levelDetails;if(M===null||C===null||T===null)return null;var b=T.edge,d=M-C-this.edgeStalled,o=b-T.totalduration,s=b-(this.config.lowLatencyMode&&T.partTarget||T.targetduration);return Math.min(Math.max(o,d),s)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var C=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-C,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,C=this.levelDetails;if(!M||!C)return 0;var T=M.buffered.length;return T?M.buffered.end(T-1):C.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return d});var G=A("./src/types/level.ts"),U=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/codecs.ts"),I=A("./src/controller/level-helper.ts"),D=A("./src/controller/base-playlist-controller.ts"),L=A("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var S in u)Object.prototype.hasOwnProperty.call(u,S)&&(o[S]=u[S])}return o},E.apply(this,arguments)}function _(o,s){for(var u=0;u<s.length;u++){var S=s[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function M(o,s,u){return s&&_(o.prototype,s),u&&_(o,u),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,T(o,s)}function T(o,s){return T=Object.setPrototypeOf||function(S,f){return S.__proto__=f,S},T(o,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(s,o);function s(S){var f;return f=o.call(this,S,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var u=s.prototype;return u._registerListeners=function(){var f=this.hls;f.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(U.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var f=this.hls;f.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(U.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(f,m){var w=[],p=[],h=[],c,l={},a,v=!1,g=!1,y=!1;if(m.levels.forEach(function(W){var O=W.attrs;v=v||!!(W.width&&W.height),g=g||!!W.videoCodec,y=y||!!W.audioCodec,b&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var P=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[P],a?a.url.push(W.url):(a=new G.Level(W),l[P]=a,w.push(a)),O&&(O.AUDIO&&Object(I.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(I.addGroupId)(a,"text",O.SUBTITLES))}),(v||g)&&y&&(w=w.filter(function(W){var O=W.videoCodec,P=W.width,H=W.height;return!!O||!!(P&&H)})),w=w.filter(function(W){var O=W.audioCodec,P=W.videoCodec;return(!O||Object(B.isCodecSupportedInMp4)(O,"audio"))&&(!P||Object(B.isCodecSupportedInMp4)(P,"video"))}),m.audioTracks&&(p=m.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(p)),m.subtitles&&(h=m.subtitles,Object(I.assignTrackIdsByGroup)(h)),w.length>0){c=w[0].bitrate,w.sort(function(W,O){return W.bitrate-O.bitrate}),this._levels=w;for(var k=0;k<w.length;k++)if(w[k].bitrate===c){this._firstLevel=k,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+c);break}var F=y&&!g,j={levels:w,audioTracks:p,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:y,video:g,altAudio:!F&&p.some(function(W){return!!W.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:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var w=m.context,p=this._levels[this.currentLevelIndex];if(w&&(w.type===L.PlaylistContextType.AUDIO_TRACK&&p.audioGroupIds&&w.groupId===p.audioGroupIds[p.urlId]||w.type===L.PlaylistContextType.SUBTITLE_TRACK&&p.textGroupIds&&w.groupId===p.textGroupIds[p.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(m.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=m.frag.level)):l=m.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(c=!1),l=w.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=m.level,h=!0;break}l!==void 0&&this.recoverLevel(m,l,h,c)},u.recoverLevel=function(f,m,w,p){var h=f.details,c=this._levels[m];if(c.loadError++,w){var l=this.retryLoadingOrFail(f);if(l)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(p){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var v=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),f.levelRetry=!0,this.hls.nextAutoLevel=v)}}},u.redundantFailover=function(f){var m=this._levels[f],w=m.url.length;if(w>1){var p=(m.urlId+1)%w;this.warn("Switching to redundant URL-id "+p),this._levels.forEach(function(h){h.urlId=p}),this.level=f}},u.onFragLoaded=function(f,m){var w=m.frag;if(w!==void 0&&w.type===L.PlaylistLevelType.MAIN){var p=this._levels[w.level];p!==void 0&&(p.fragmentError=0,p.loadError=0)}},u.onLevelLoaded=function(f,m){var w,p=m.level,h=m.details,c=this._levels[p];if(!c){var l;this.warn("Invalid level index "+p),(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}p===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(p,m,c.details)):(w=m.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(h.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(f,m){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var p=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<w.audioGroupIds.length;c++)if(w.audioGroupIds[c]===h){p=c;break}p!==w.urlId&&(w.urlId=p,this.startLoad())}},u.loadPlaylist=function(f){var m=this.currentLevelIndex,w=this._levels[m];if(this.canLoad&&w&&w.url.length>0){var p=w.urlId,h=w.url[p];if(f)try{h=f.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+p+" "+h),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:h,level:m,id:p,deliveryDirectives:f||null})}},u.removeLevel=function(f,m){var w=function(c,l){return l!==m},p=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(w),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(w)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(w)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=p,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:p})},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var m,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===f&&(m=w[f])!==null&&m!==void 0&&m.details)return;if(f<0||f>=w.length){var p=f<0;if(this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:p,reason:"invalid level idx"}),p)return;f=Math.min(f,w.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=w[h],l=w[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=E({},l,{level:f,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var v=l.details;if(!v||v.live){var g=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),s}(D.default)},"./src/controller/level-helper.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"addGroupId",function(){return R}),A.d(V,"assignTrackIdsByGroup",function(){return B}),A.d(V,"updatePTS",function(){return I}),A.d(V,"updateFragPTSDTS",function(){return L}),A.d(V,"mergeDetails",function(){return E}),A.d(V,"mapPartIntersection",function(){return _}),A.d(V,"mapFragmentIntersection",function(){return M}),A.d(V,"adjustSliding",function(){return C}),A.d(V,"addSliding",function(){return T}),A.d(V,"computeReloadInterval",function(){return b}),A.d(V,"getFragmentWithSN",function(){return d}),A.d(V,"getPartWith",function(){return o});var G=A("./src/polyfills/number.ts"),U=A("./src/utils/logger.ts");function R(s,u,S){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function B(s){var u={};s.forEach(function(S){var f=S.groupId||"";S.id=u[f]=u[f]||0,u[f]++})}function I(s,u,S){var f=s[u],m=s[S];D(f,m)}function D(s,u){var S=u.startPTS;if(Object(G.isFiniteNumber)(S)){var f=0,m;u.sn>s.sn?(f=S-s.start,m=s):(f=s.start-S,m=u),m.duration!==f&&(m.duration=f)}else if(u.sn>s.sn){var w=s.cc===u.cc;w&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function L(s,u,S,f,m,w){var p=f-S;p<=0&&(U.logger.warn("Fragment should have a positive duration",u),f=S+u.duration,w=m+u.duration);var h=S,c=f,l=u.startPTS,a=u.endPTS;if(Object(G.isFiniteNumber)(l)){var v=Math.abs(l-S);Object(G.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(v,u.deltaPTS):u.deltaPTS=v,h=Math.max(S,l),S=Math.min(S,l),m=Math.min(m,u.startDTS),c=Math.min(f,a),f=Math.max(f,a),w=Math.max(w,u.endDTS)}u.duration=f-S;var g=S-u.start;u.appendedPTS=f,u.start=u.startPTS=S,u.maxStartPTS=h,u.startDTS=m,u.endPTS=f,u.minEndPTS=c,u.endDTS=w;var y=u.sn;if(!s||y<s.startSN||y>s.endSN)return 0;var k,F=y-s.startSN,j=s.fragments;for(j[F]=u,k=F;k>0;k--)D(j[k],j[k-1]);for(k=F;k<j.length-1;k++)D(j[k],j[k+1]);return s.fragmentHint&&D(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function E(s,u){for(var S=null,f=s.fragments,m=f.length-1;m>=0;m--){var w=f[m].initSegment;if(w){S=w;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var p=0,h;if(M(s,u,function(k,F){k.relurl&&(p=k.cc-F.cc),Object(G.isFiniteNumber)(k.startPTS)&&Object(G.isFiniteNumber)(k.endPTS)&&(F.start=F.startPTS=k.startPTS,F.startDTS=k.startDTS,F.appendedPTS=k.appendedPTS,F.maxStartPTS=k.maxStartPTS,F.endPTS=k.endPTS,F.endDTS=k.endDTS,F.minEndPTS=k.minEndPTS,F.duration=k.endPTS-k.startPTS,F.duration&&(h=F),u.PTSKnown=u.alignedSliding=!0),F.elementaryStreams=k.elementaryStreams,F.loader=k.loader,F.stats=k.stats,F.urlId=k.urlId,k.initSegment&&(F.initSegment=k.initSegment,S=k.initSegment)}),S){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(k){var F;(!k.initSegment||k.initSegment.relurl===((F=S)===null||F===void 0?void 0:F.relurl))&&(k.initSegment=S)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(k){return!k}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=u.skippedSegments;l--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(p){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=p}u.skippedSegments&&(u.startCC=u.fragments[0].cc),_(s.partList,u.partList,function(k,F){F.elementaryStreams=k.elementaryStreams,F.stats=k.stats}),h?L(u,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(s,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var g=u.advancedDateTime;if(u.advanced&&g){var y=u.edge;u.driftStart||(u.driftStartTime=g,u.driftStart=y),u.driftEndTime=g,u.driftEnd=y}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function _(s,u,S){if(s&&u)for(var f=0,m=0,w=s.length;m<=w;m++){var p=s[m],h=u[m+f];p&&h&&p.index===h.index&&p.fragment.sn===h.fragment.sn?S(p,h):f--}}function M(s,u,S){for(var f=u.skippedSegments,m=Math.max(s.startSN,u.startSN)-u.startSN,w=(s.fragmentHint?1:0)+(f?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,p=u.startSN-s.startSN,h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,l=m;l<=w;l++){var a=c[p+l],v=h[l];f&&!v&&l<f&&(v=u.fragments[l]=a),a&&v&&S(a,v)}}function C(s,u){var S=u.startSN+u.skippedSegments-s.startSN,f=s.fragments;if(S<0||S>=f.length)return;T(u,f[S].start)}function T(s,u){if(u){for(var S=s.fragments,f=s.skippedSegments;f<S.length;f++)S[f].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function b(s,u){var S=1e3*s.levelTargetDuration,f=S/2,m=s.age,w=m>0&&m<S*3,p=u.loading.end-u.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(w){var l=333*s.misses;h=Math.max(Math.min(f,p*2),l),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=f;else w?(c=Math.min(c||S/2,m),s.availabilityDelay=c,h=c+S-m):h=S-p;return Math.round(h)}function d(s,u,S){if(!s||!s.details)return null;var f=s.details,m=f.fragments[u-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===u?m:u<f.startSN&&S&&S.sn===u?S:null)}function o(s,u,S){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var m=f.length;m--;){var w=f[m];if(w.index===S&&w.fragment.sn===u)return w}return null}},"./src/controller/stream-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return f});var G=A("./src/polyfills/number.ts"),U=A("./src/controller/base-stream-controller.ts"),R=A("./src/is-supported.ts"),B=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),D=A("./src/controller/fragment-tracker.ts"),L=A("./src/types/loader.ts"),E=A("./src/loader/fragment.ts"),_=A("./src/demux/transmuxer-interface.ts"),M=A("./src/types/transmuxer.ts"),C=A("./src/controller/gap-controller.ts"),T=A("./src/errors.ts"),b=A("./src/utils/logger.ts");function d(m,w){for(var p=0;p<w.length;p++){var h=w[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,w,p){return w&&d(m.prototype,w),p&&d(m,p),m}function s(m,w){m.prototype=Object.create(w.prototype),m.prototype.constructor=m,u(m,w)}function u(m,w){return u=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},u(m,w)}var S=100,f=function(m){s(w,m);function w(h,c){var l;return l=m.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var p=w.prototype;return p._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},p.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},p.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},p.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,v=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,y=self.performance.now(),k=this.retryDate;(!k||y>=k||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},p.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},p.doTickIdle=function(){var c,l,a=this.hls,v=this.levelLastLoaded,g=this.levels,y=this.media,k=a.config,F=a.nextLoadLevel;if(v===null||!y&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[F])return;var j=g[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===U.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,L.PlaylistLevelType.MAIN);if(O===null)return;var P=O.len,H=this.getMaxBufferLength(j.maxBitrate);if(P>=H)return;if(this._streamEnded(O,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,X),this.state=U.State.ENDED;return}var Z=O.end,re=this.getNextFragment(Z,W);if(this.couldBacktrack&&!this.fragPrevious&&re&&re.sn!=="initSegment"){var be=re.sn-W.startSN;be>1&&(re=W.fragments[be-1],this.fragmentTracker.removeFragment(re))}if(re&&this.fragmentTracker.getState(re)===D.FragmentState.OK&&this.nextLoadPosition>Z){var fe=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,fe,L.PlaylistLevelType.MAIN),re=this.getNextFragment(this.nextLoadPosition,W)}if(!re)return;re.initSegment&&!re.initSegment.data&&!this.bitrateTest&&(re=re.initSegment),((c=re.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=re.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(re,W):this.loadFragment(re,W,Z)},p.loadFragment=function(c,l,a){var v,g=this.fragmentTracker.getState(c);if(this.fragCurrent=c,g===D.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(c);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else g=D.FragmentState.NOT_LOADED}g===D.FragmentState.NOT_LOADED||g===D.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,l,a)):g===D.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},p.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},p.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},p.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},p.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},p.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,v=this.getAppendedFrag(l.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!l.paused&&c){var g=this.hls.nextLoadLevel,y=c[g],k=this.fragLastKbps;k&&this.fragCurrent?a=this.fragCurrent.duration*y.maxBitrate/(1e3*k)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,O=j.duration,P=Math.max(F.end,W+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},p.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},p.flushMainBuffer=function(c,l){m.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},p.onMediaAttached=function(c,l){m.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},p.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},p.onMediaPlaying=function(){this.tick()},p.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},p.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},p.onManifestParsed=function(c,l){var a=!1,v=!1,g;l.levels.forEach(function(y){g=y.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},p.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var v=a[l.level];(!v.details||v.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(v.details))&&(this.state=U.State.WAITING_LEVEL)},p.onLevelLoaded=function(c,l){var a,v=this.levels,g=l.level,y=l.details,k=y.totalduration;if(!v){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+k);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==l.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var j=v[g],W=0;if(y.live||(a=j.details)!==null&&a!==void 0&&a.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;W=this.alignPlaylists(y,j.details)}if(j.details=y,this.levelLastLoaded=g,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:y,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=U.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,W),this.tick()},p._handleFragmentLoadProgress=function(c){var l,a=c.frag,v=c.part,g=c.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var k=y[a.level],F=k.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=k.videoCodec,W=F.PTSKnown||!F.live,O=(l=a.initSegment)===null||l===void 0?void 0:l.data,P=this._getAudioCodec(k),H=this.transmuxer=this.transmuxer||new _.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=v?v.index:-1,Z=X!==-1,re=new M.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,X,Z),be=this.initPTS[a.cc];H.push(g,O,P,j,a,v,F.totalduration,W,re,be)},p.onAudioTrackSwitching=function(c,l){var a=this.altAudio,v=!!l.url,g=l.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;a&&k.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:g})}},p.onAudioTrackSwitched=function(c,l){var a=l.id,v=!!this.hls.audioTracks[a].url;if(v){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=v,this.tick()},p.onBufferCreated=function(c,l){var a=l.tracks,v,g,y=!1;for(var k in a){var F=a[k];if(F.id==="main"){if(g=k,v=F,k==="video"){var j=a[k];j&&(this.videoBuffer=j.buffer)}}else y=!0}y&&v?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},p.onFragBuffered=function(c,l){var a=l.frag,v=l.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},p.onError=function(c,l){switch(l.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,l);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=U.State.ERROR):!l.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},p.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=I.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},p.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},p.onBufferFlushed=function(c,l){var a=l.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,L.PlaylistLevelType.MAIN)}},p.onLevelsUpdated=function(c,l){this.levels=l.levels},p.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},p.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+l);return}var v=I.BufferHelper.getBuffered(c),g=v.length?v.start(0):0,y=g-a;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+y+" to match buffer start"),a+=y,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},p._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},p._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var v=l.hls;if(!a||v.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=U.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var g=c.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),v.trigger(B.Events.FRAG_LOADED,a)})},p._handleTransmuxComplete=function(c){var l,a="main",v=this.hls,g=c.remuxResult,y=c.chunkMeta,k=this.getCurrentContext(y);if(!k){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var F=k.frag,j=k.part,W=k.level,O=g.video,P=g.text,H=g.id3,X=g.initSegment,Z=this.altAudio?void 0:g.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,F,y),v.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:X.tracks}));var re=X.initPTS,be=X.timescale;Object(G.isFiniteNumber)(re)&&(this.initPTS[F.cc]=re,v.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:re,timescale:be}))}if(O&&g.independent!==!1){if(W.details){var fe=O.startPTS,Te=O.endPTS,pe=O.startDTS,ge=O.endDTS;if(j)j.elementaryStreams[O.type]={startPTS:fe,endPTS:Te,startDTS:pe,endDTS:ge};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<fe){this.backtrack(F);return}F.setElementaryStreamInfo(O.type,F.start,Te,F.start,ge,!0)}F.setElementaryStreamInfo(O.type,fe,Te,pe,ge),this.bufferFragmentData(O,F,j,y)}}else if(g.independent===!1){this.backtrack(F);return}if(Z){var he=Z.startPTS,J=Z.endPTS,oe=Z.startDTS,q=Z.endDTS;j&&(j.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:J,startDTS:oe,endDTS:q}),F.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,he,J,oe,q),this.bufferFragmentData(Z,F,j,y)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var ye={frag:F,id:a,samples:H.samples};v.trigger(B.Events.FRAG_PARSING_METADATA,ye)}if(P){var Se={frag:F,id:a,samples:P.samples};v.trigger(B.Events.FRAG_PARSING_USERDATA,Se)}},p._bufferInitSegment=function(c,l,a,v){var g=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var y=l.audio,k=l.video,F=l.audiovideo;if(y){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),y.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),y.levelCodec=j,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+y.codec+"]")}k&&(k.levelCodec=c.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+k.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(O){var P=l[O],H=P.initSegment;H!=null&&H.byteLength&&g.hls.trigger(B.Events.BUFFER_APPENDING,{type:O,data:H,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},p.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=U.State.BACKTRACKING},p.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(I.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):I.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var v=this.fragPlaying,g=l.level;(!v||l.sn!==v.sn||v.level!==g||l.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!v||v.level!==g)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=l)}}},o(w,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"SubtitleStreamController",function(){return s});var G=A("./src/events.ts"),U=A("./src/utils/logger.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/controller/fragment-finders.ts"),I=A("./src/utils/discontinuities.ts"),D=A("./src/controller/level-helper.ts"),L=A("./src/controller/fragment-tracker.ts"),E=A("./src/controller/base-stream-controller.ts"),_=A("./src/types/loader.ts"),M=A("./src/types/level.ts");function C(u,S){for(var f=0;f<S.length;f++){var m=S[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function T(u,S,f){return S&&C(u.prototype,S),f&&C(u,f),u}function b(u,S){u.prototype=Object.create(S.prototype),u.prototype.constructor=u,d(u,S)}function d(u,S){return d=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},d(u,S)}var o=500,s=function(u){b(S,u);function S(m,w){var p;return p=u.call(this,m,w,"[subtitle-stream-controller]")||this,p.levels=[],p.currentTrackId=-1,p.tracksBuffered=[],p.mainDetails=null,p._registerListeners(),p}var f=S.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var w=this.hls;w.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(G.Events.ERROR,this.onError,this),w.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var w=this.hls;w.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(G.Events.ERROR,this.onError,this),w.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(w,p){this.mainDetails=p.details},f.onSubtitleFragProcessed=function(w,p){var h=p.frag,c=p.success;if(this.fragPrevious=h,this.state=E.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,v=h.start,g=0;g<l.length;g++)if(v>=l[g].start&&v<=l[g].end){a=l[g];break}var y=h.start+h.duration;a?a.end=y:(a={start:v,end:y},l.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(w,p){var h=p.startOffset,c=p.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var v=a[l].details,g=v.targetduration,y=c-g;if(y<=0)return;p.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(k){for(var F=0;F<k.length;){if(k[F].end<=y){k.shift();continue}else if(k[F].start<y)k[F].start=y;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,y,_.PlaylistLevelType.SUBTITLE)}},f.onError=function(w,p){var h,c=p.frag;if(!c||c.type!==_.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},f.onSubtitleTracksUpdated=function(w,p){var h=this,c=p.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new M.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(w,p){if(this.currentTrackId=p.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(w,p){var h,c=p.details,l=p.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var g=v[a];if(l>=v.length||l!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=g.details)!==null&&h!==void 0&&h.live){var y=this.mainDetails;if(c.deltaUpdateFailed||!y)return;var k=y.fragments[0];if(!g.details)c.hasProgramDateTime&&y.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(c,y):k&&Object(D.addSliding)(c,k.start);else{var F=this.alignPlaylists(c,g.details);F===0&&k&&Object(D.addSliding)(c,k.start)}}if(g.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},f._handleFragmentLoadComplete=function(w){var p=w.frag,h=w.payload,c=p.decryptdata,l=this.hls;if(this.fragContextChanged(p))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(v){var g=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:p,payload:v,stats:{tstart:a,tdecrypt:g}})})}},f.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var w,p=this.currentTrackId,h=this.levels;if(!h.length||!h[p]||!h[p].details)return;var c=h[p].details,l=c.targetduration,a=this.config,v=this.media,g=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-l,a.maxBufferHole),y=g.end,k=g.len,F=this.getMaxBufferLength()+l;if(k>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,O=c.edge,P,H=this.fragPrevious;if(y<O){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,X)),P||(P=Object(B.findFragmentByPTS)(H,j,y,X),!P&&H&&H.start<j[0].start&&(P=j[0]))}else P=j[W-1];(w=P)!==null&&w!==void 0&&w.encrypted?(U.logger.log("Loading key for "+P.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===L.FragmentState.NOT_LOADED&&this.loadFragment(P,c,y)}},f.loadFragment=function(w,p,h){this.fragCurrent=w,u.prototype.loadFragment.call(this,w,p,h)},T(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(E.default)},"./src/controller/subtitle-track-controller.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),U=A("./src/utils/texttrack-utils.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function I(C,T){for(var b=0;b<T.length;b++){var d=T[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function D(C,T,b){return T&&I(C.prototype,T),b&&I(C,b),C}function L(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,E(C,T)}function E(C,T){return E=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},E(C,T)}var _=function(C){L(T,C);function T(d){var o;return o=C.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var b=T.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},b.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},b.onMediaAttached=function(o,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(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},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 o=M(this.media.textTracks);o.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(o,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(o,s){var u=s.id,S=s.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+u);return}var w=m.details;m.details=s.details,this.log("subtitle track "+u+" loaded ["+S.startSN+"-"+S.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,w))},b.onLevelLoading=function(o,s){this.switchLevel(s.level)},b.onLevelSwitching=function(o,s){this.switchLevel(s.level)},b.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(p){return!u||p.groupId===u});this.tracksInGroup=f;var m=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=u;var w={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,w),m!==-1&&this.setSubtitleTrack(m,S)}},b.findTrackId=function(o){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var S=s[u];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},b.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,S=s.groupId,f=s.url;if(o)try{f=o.addDirectives(f)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:f,id:u,groupId:S,deliveryDirectives:o||null})}},b.toggleTrackModes=function(o){var s=this,u=this.media,S=this.subtitleDisplay,f=this.trackId;if(!u)return;var m=M(u.textTracks),w=m.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var p=w[f];p&&(p.mode="disabled")}var h=w[o];h&&(h.mode=S?"showing":"hidden")},b.setSubtitleTrack=function(o,s){var u,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=S[o])!==null&&u!==void 0&&u.details)||o<-1||o>=S.length)return;this.clearTimer();var f=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var m=f.id,w=f.groupId,p=w===void 0?"":w,h=f.name,c=f.type,l=f.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:p,name:h,type:c,url:l});var a=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=M(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")o=u;else if(s[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},D(T,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),T}(R.default);function M(C){for(var T=[],b=0;b<C.length;b++){var d=C[b];d.kind==="subtitles"&&d.label&&T.push(C[b])}return T}V.default=_},"./src/controller/timeline-controller.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"TimelineController",function(){return M});var G=A("./src/polyfills/number.ts"),U=A("./src/events.ts"),R=A("./src/utils/cea-608-parser.ts"),B=A("./src/utils/output-filter.ts"),I=A("./src/utils/webvtt-parser.ts"),D=A("./src/utils/texttrack-utils.ts"),L=A("./src/utils/imsc1-ttml-parser.ts"),E=A("./src/types/loader.ts"),_=A("./src/utils/logger.ts"),M=function(){function d(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=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 u=new B.default(this,"textTrack1"),S=new B.default(this,"textTrack2"),f=new B.default(this,"textTrack3"),m=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,u,S),this.cea608Parser2=new R.default(3,f,m)}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 o=d.prototype;return o.destroy=function(){var u=this.hls;u.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(U.Events.FRAG_LOADING,this.onFragLoading,this),u.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,S,f,m,w){for(var p=!1,h=w.length;h--;){var c=w[h],l=T(c[0],c[1],S,f);if(l>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],f),p=!0,l/(f-S)>.5))return}if(p||w.push([S,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,S,f,m)}else{var v=this.Cues.newCue(null,S,f,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:v,track:u})}},o.onInitPtsFound=function(u,S){var f=this,m=S.frag,w=S.id,p=S.initPTS,h=S.timescale,c=this.unparsedVttFrags;w==="main"&&(this.initPTS[m.cc]=p,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){f.onFragLoaded(U.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(u){var S=this.media;if(S)for(var f=0;f<S.textTracks.length;f++){var m=S.textTracks[f];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var S=this.captionsProperties,f=this.captionsTracks,m=this.media,w=S[u],p=w.label,h=w.languageCode,c=this.getExistingTrack(u);if(c)f[u]=c,Object(D.clearCurrentCues)(f[u]),Object(D.sendAddTrackEvent)(f[u],m);else{var l=this.createTextTrack("captions",p,h);l&&(l[u]=!0,f[u]=l)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var S=this.captionsProperties[u];if(!S)return;var f=S.label,m={_id:u,label:f,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,S,f){var m=this.media;return m?m.addTextTrack(u,S,f):void 0},o.onMediaAttaching=function(u,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(S){Object(D.clearCurrentCues)(u[S]),delete u[S]}),this.nonNativeCaptionsTracks={}},o.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())},o._cleanTracks=function(){var u=this.media;if(!u)return;var S=u.textTracks;if(S)for(var f=0;f<S.length;f++)Object(D.clearCurrentCues)(S[f])},o.onSubtitleTracksUpdated=function(u,S){var f=this;this.textTracks=[];var m=S.subtitleTracks||[],w=m.some(function(l){return l.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var p=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var v;if(a<h.length){for(var g=null,y=0;y<h.length;y++)if(C(h[y],l)){g=h[y];break}g&&(v=g)}v?Object(D.clearCurrentCues)(v):(v=f.createTextTrack("subtitles",l.name,l.lang),v&&(v.mode="disabled")),v&&(v.groupId=l.groupId,f.textTracks.push(v))})}else if(!p&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,S){var f=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(m){var w=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!w)return;var p="textTrack"+w[1],h=f.captionsProperties[p];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(u,S){var f=this.cea608Parser1,m=this.cea608Parser2,w=this.lastSn,p=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(S.frag.type===E.PlaylistLevelType.MAIN){var h,c,l=S.frag.sn,a=(h=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===w+1||l===w&&a===p+1||(f.reset(),m.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(u,S){var f=S.frag,m=S.payload,w=this.initPTS,p=this.unparsedVttFrags;if(f.type===E.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(G.isFiniteNumber)(w[f.cc])){p.push(S),w.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],l=this.vttCCs;l[f.cc]||(l[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===L.IMSC1_CODEC?this._parseIMSC1(f,m):this._parseVTTs(f,m,l)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,S){var f=this,m=this.hls;Object(L.parseIMSC1)(S,this.initPTS[u.cc],this.timescale[u.cc],function(w){f._appendCues(w,u.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(w){_.logger.log("Failed to parse IMSC1: "+w),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:w})})},o._parseVTTs=function(u,S,f){var m=this,w=this.hls;Object(I.parseWebVTT)(S,this.initPTS[u.cc],this.timescale[u.cc],f,u.cc,u.start,function(p){m._appendCues(p,u.level),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(p){m._fallbackToIMSC1(u,S),_.logger.log("Failed to parse VTT cue: "+p),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:p})})},o._fallbackToIMSC1=function(u,S){var f=this,m=this.tracks[u.level];m.textCodec||Object(L.parseIMSC1)(S,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=L.IMSC1_CODEC,f._parseIMSC1(u,S)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,S){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[S];if(m.mode==="disabled")return;u.forEach(function(h){return Object(D.addCueToTrack)(m,h)})}else{var w=this.tracks[S],p=w.default?"default":"subtitles"+S;f.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:u,track:p})}},o.onFragDecrypted=function(u,S){var f=S.frag;if(f.type===E.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(U.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,S){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var w=0;w<S.samples.length;w++){var p=S.samples[w].bytes;if(p){var h=this.extractCea608Data(p);f.addData(S.samples[w].pts,h[0]),m.addData(S.samples[w].pts,h[1])}}},o.onBufferFlushing=function(u,S){var f=S.startOffset,m=S.endOffset,w=S.endOffsetSubtitles,p=S.type,h=this.media;if(!h||h.currentTime<m)return;if(!p||p==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(D.removeCuesInRange)(c[a],f,m)})}if(this.config.renderTextTracksNatively&&(f===0&&w!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(D.removeCuesInRange)(l[a],f,w)})}},o.extractCea608Data=function(u){for(var S=u[0]&31,f=2,m=[[],[]],w=0;w<S;w++){var p=u[f++],h=127&u[f++],c=127&u[f++],l=(4&p)!==0,a=3&p;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function T(d,o,s,u){return Math.min(o,u)-Math.max(d,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function U(B,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=I}var R=U.prototype;return R.decrypt=function(I,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,I)},U}()},"./src/crypt/aes-decryptor.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"removePadding",function(){return U}),A.d(V,"default",function(){return R});var G=A("./src/utils/typed-array.ts");function U(B){var I=B.byteLength,D=I&&new DataView(B.buffer).getUint8(I-1);return D?Object(G.sliceUint8)(B,0,I-D):B}var R=function(){function B(){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 I=B.prototype;return I.uint8ArrayToUint32Array_=function(L){for(var E=new DataView(L),_=new Uint32Array(4),M=0;M<4;M++)_[M]=E.getUint32(M*4);return _},I.initTable=function(){var L=this.sBox,E=this.invSBox,_=this.subMix,M=_[0],C=_[1],T=_[2],b=_[3],d=this.invSubMix,o=d[0],s=d[1],u=d[2],S=d[3],f=new Uint32Array(256),m=0,w=0,p=0;for(p=0;p<256;p++)p<128?f[p]=p<<1:f[p]=p<<1^283;for(p=0;p<256;p++){var h=w^w<<1^w<<2^w<<3^w<<4;h=h>>>8^h&255^99,L[m]=h,E[h]=m;var c=f[m],l=f[c],a=f[l],v=f[h]*257^h*16843008;M[m]=v<<24|v>>>8,C[m]=v<<16|v>>>16,T[m]=v<<8|v>>>24,b[m]=v,v=a*16843009^l*65537^c*257^m*16843008,o[h]=v<<24|v>>>8,s[h]=v<<16|v>>>16,u[h]=v<<8|v>>>24,S[h]=v,m?(m=c^f[f[f[a^c]]],w^=f[f[w]]):m=w=1}},I.expandKey=function(L){for(var E=this.uint8ArrayToUint32Array_(L),_=!0,M=0;M<E.length&&_;)_=E[M]===this.key[M],M++;if(_)return;this.key=E;var C=this.keySize=E.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var T=this.ksRows=(C+6+1)*4,b,d,o=this.keySchedule=new Uint32Array(T),s=this.invKeySchedule=new Uint32Array(T),u=this.sBox,S=this.rcon,f=this.invSubMix,m=f[0],w=f[1],p=f[2],h=f[3],c,l;for(b=0;b<T;b++){if(b<C){c=o[b]=E[b];continue}l=c,b%C===0?(l=l<<8|l>>>24,l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255],l^=S[b/C|0]<<24):C>6&&b%C===4&&(l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255]),o[b]=c=(o[b-C]^l)>>>0}for(d=0;d<T;d++)b=T-d,d&3?l=o[b]:l=o[b-4],d<4||b<=4?s[d]=l:s[d]=m[u[l>>>24]]^w[u[l>>>16&255]]^p[u[l>>>8&255]]^h[u[l&255]],s[d]=s[d]>>>0},I.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},I.decrypt=function(L,E,_){for(var M=this.keySize+6,C=this.invKeySchedule,T=this.invSBox,b=this.invSubMix,d=b[0],o=b[1],s=b[2],u=b[3],S=this.uint8ArrayToUint32Array_(_),f=S[0],m=S[1],w=S[2],p=S[3],h=new Int32Array(L),c=new Int32Array(h.length),l,a,v,g,y,k,F,j,W,O,P,H,X,Z,re=this.networkToHostOrderSwap;E<h.length;){for(W=re(h[E]),O=re(h[E+1]),P=re(h[E+2]),H=re(h[E+3]),y=W^C[0],k=H^C[1],F=P^C[2],j=O^C[3],X=4,Z=1;Z<M;Z++)l=d[y>>>24]^o[k>>16&255]^s[F>>8&255]^u[j&255]^C[X],a=d[k>>>24]^o[F>>16&255]^s[j>>8&255]^u[y&255]^C[X+1],v=d[F>>>24]^o[j>>16&255]^s[y>>8&255]^u[k&255]^C[X+2],g=d[j>>>24]^o[y>>16&255]^s[k>>8&255]^u[F&255]^C[X+3],y=l,k=a,F=v,j=g,X=X+4;l=T[y>>>24]<<24^T[k>>16&255]<<16^T[F>>8&255]<<8^T[j&255]^C[X],a=T[k>>>24]<<24^T[F>>16&255]<<16^T[j>>8&255]<<8^T[y&255]^C[X+1],v=T[F>>>24]<<24^T[j>>16&255]<<16^T[y>>8&255]<<8^T[k&255]^C[X+2],g=T[j>>>24]<<24^T[y>>16&255]<<16^T[k>>8&255]<<8^T[F&255]^C[X+3],c[E]=re(l^f),c[E+1]=re(g^m),c[E+2]=re(v^w),c[E+3]=re(a^p),f=W,m=O,w=P,p=H,E=E+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return E});var G=A("./src/crypt/aes-crypto.ts"),U=A("./src/crypt/fast-aes-key.ts"),R=A("./src/crypt/aes-decryptor.ts"),B=A("./src/utils/logger.ts"),I=A("./src/utils/mp4-tools.ts"),D=A("./src/utils/typed-array.ts"),L=16,E=function(){function _(C,T,b){var d=b===void 0?{}:b,o=d.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=T,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=_.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var T=this.currentResult;if(!T){this.reset();return}var b=new Uint8Array(T);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(b):b},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(T,b,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(T),b,d);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(T),b,d).then(o)},M.softwareDecrypt=function(T,b,d){var o=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(T=Object(I.appendUint8Array)(u,T),this.remainderData=null);var S=this.getValidChunk(T);if(!S.length)return null;o&&(d=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new R.default),f.expandKey(b);var m=s;return this.currentResult=f.decrypt(S.buffer,0,d),this.currentIV=Object(D.sliceUint8)(S,-16).buffer,m||null},M.webCryptoDecrypt=function(T,b,d){var o=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(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new G.default(s,d);return S.decrypt(T.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,T,b,d)})},M.onWebCryptoError=function(T,b,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",T),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,o)},M.getValidChunk=function(T){var b=T,d=T.length-T.length%L;return d!==T.length&&(b=Object(D.sliceUint8)(T,0,d),this.remainderData=Object(D.sliceUint8)(T,d)),b},M.logOnce=function(T){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+T),this.logEnabled=!1},_}()},"./src/crypt/fast-aes-key.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function U(B,I){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=I}var R=U.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),U=A("./src/demux/adts.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/id3.ts");function I(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,D(E,_)}function D(E,_){return D=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},D(E,_)}var L=function(E){I(_,E);function _(C,T){var b;return b=E.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=C,b.config=T,b}var M=_.prototype;return M.resetInitSegment=function(T,b,d){E.prototype.resetInitSegment.call(this,T,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:T,duration:d,inputTimeScale:9e4,dropped:0}},_.probe=function(T){if(!T)return!1;for(var b=B.getID3Data(T,0)||[],d=b.length,o=T.length;d<o;d++)if(U.probe(T,d))return R.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(T,b){return U.canParse(T,b)},M.appendFrame=function(T,b,d){U.initTrackConfig(T,this.observer,b,d,T.manifestCodec);var o=U.appendFrame(T,b,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},_}(G.default);L.minProbeByteLength=9,V.default=L},"./src/demux/adts.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"getAudioConfig",function(){return B}),A.d(V,"isHeaderPattern",function(){return I}),A.d(V,"getHeaderLength",function(){return D}),A.d(V,"getFullFrameLength",function(){return L}),A.d(V,"canGetFrameLength",function(){return E}),A.d(V,"isHeader",function(){return _}),A.d(V,"canParse",function(){return M}),A.d(V,"probe",function(){return C}),A.d(V,"initTrackConfig",function(){return T}),A.d(V,"getFrameDuration",function(){return b}),A.d(V,"parseFrameHeader",function(){return d}),A.d(V,"appendFrame",function(){return o});var G=A("./src/utils/logger.ts"),U=A("./src/errors.ts"),R=A("./src/events.ts");function B(s,u,S,f){var m,w,p,h,c=navigator.userAgent.toLowerCase(),l=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[S+2]&192)>>>6)+1;var v=(u[S+2]&60)>>>2;if(v>a.length-1){s.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return p=(u[S+2]&1)<<2,p|=(u[S+3]&192)>>>6,G.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(m=5,h=new Array(4),w=v-3):(m=2,h=new Array(2),w=v):c.indexOf("android")!==-1?(m=2,h=new Array(2),w=v):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&v>=6?w=v-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(v>=6&&p===1||/vivaldi/i.test(c))||!f&&p===1)&&(m=2,h=new Array(2)),w=v)),h[0]=m<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=p<<3,m===5&&(h[1]|=(w&14)>>1,h[2]=(w&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:p,codec:"mp4a.40."+m,manifestCodec:l}}function I(s,u){return s[u]===255&&(s[u+1]&246)===240}function D(s,u){return s[u+1]&1?7:9}function L(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function E(s,u){return u+5<s.length}function _(s,u){return u+1<s.length&&I(s,u)}function M(s,u){return E(s,u)&&I(s,u)&&L(s,u)<=s.length-u}function C(s,u){if(_(s,u)){var S=D(s,u);if(u+S>=s.length)return!1;var f=L(s,u);if(f<=S)return!1;var m=u+f;return m===s.length||_(s,m)}return!1}function T(s,u,S,f,m){if(!s.samplerate){var w=B(u,S,f,m);if(!w)return;s.config=w.config,s.samplerate=w.samplerate,s.channelCount=w.channelCount,s.codec=w.codec,s.manifestCodec=w.manifestCodec,G.logger.log("parsed codec:"+s.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function b(s){return 1024*9e4/s}function d(s,u,S,f,m){var w=D(s,u),p=L(s,u);if(p-=w,p>0){var h=S+f*m;return{headerLength:w,frameLength:p,stamp:h}}}function o(s,u,S,f,m){var w=b(s.samplerate),p=d(u,S,f,m,w);if(p){var h=p.frameLength,c=p.headerLength,l=p.stamp,a=c+h,v=Math.max(0,S+a-u.length),g;v?(g=new Uint8Array(a-c),g.set(u.subarray(S+c,u.length),0)):g=u.subarray(S+c,S+a);var y={unit:g,pts:l};return v||s.samples.push(y),{sample:y,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"initPTSFn",function(){return L});var G=A("./src/polyfills/number.ts"),U=A("./src/demux/id3.ts"),R=A("./src/demux/dummy-demuxed-track.ts"),B=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/typed-array.ts"),D=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var _=E.prototype;return _.resetInitSegment=function(C,T,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},_.resetTimeStamp=function(){},_.resetContiguity=function(){},_.canParse=function(C,T){return!1},_.appendFrame=function(C,T,b){},_.demux=function(C,T){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var b=U.getID3Data(C,0),d=b?b.length:0,o,s,u=this._audioTrack,S=this._id3Track,f=b?U.getTimeStamp(b):void 0,m=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(f,T)),b&&b.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;d<m;){if(this.canParse(C,d)){var w=this.appendFrame(u,C,d);w?(this.frameIndex++,s=w.sample.pts,d+=w.length,o=d):d=m}else U.canParse(C,d)?(b=U.getID3Data(C,d),S.samples.push({pts:s,dts:s,data:b}),d+=b.length,o=d):d++;if(d===m&&o!==m){var p=Object(I.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,p):this.cachedData=p}}return{audioTrack:u,avcTrack:Object(R.dummyTrack)(),id3Track:S,textTrack:Object(R.dummyTrack)()}},_.demuxSampleAes=function(C,T,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},_.flush=function(C){var T=this.cachedData;return T&&(this.cachedData=null,this.demux(T,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},_.destroy=function(){},E}(),L=function(_,M){return Object(G.isFiniteNumber)(_)?_*90:M*9e4};V.default=D},"./src/demux/chunk-cache.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(D){this.chunks.push(D),this.dataLength+=D.length},B.flush=function(){var D=this.chunks,L=this.dataLength,E;if(D.length)D.length===1?E=D[0]:E=U(D,L);else return new Uint8Array(0);return this.reset(),E},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function U(R,B){for(var I=new Uint8Array(B),D=0,L=0;L<R.length;L++){var E=R[L];I.set(E,D),D+=E.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),U=function(){function R(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var D=this.data,L=this.bytesAvailable,E=D.byteLength-L,_=new Uint8Array(4),M=Math.min(4,L);if(M===0)throw new Error("no bytes available");_.set(D.subarray(E,E+M)),this.word=new DataView(_.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},B.skipBits=function(D){var L;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,L=D>>3,D-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},B.readBits=function(D){var L=Math.min(this.bitsAvailable,D),E=this.word>>>32-L;return D>32&&G.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=D-L,L>0&&this.bitsAvailable?E<<L|this.readBits(L):E},B.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},B.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(D){for(var L=8,E=8,_,M=0;M<D;M++)E!==0&&(_=this.readEG(),E=(L+_+256)%256),L=E===0?L:E},B.readSPS=function(){var D=0,L=0,E=0,_=0,M,C,T,b=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),S=this.skipEG.bind(this),f=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);b();var w=b();if(d(5),u(3),b(),f(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var p=o();if(p===3&&u(1),f(),f(),u(1),s())for(C=p!==3?8:12,T=0;T<C;T++)s()&&(T<6?m(16):m(64))}f();var h=o();if(h===0)o();else if(h===1)for(u(1),S(),S(),M=o(),T=0;T<M;T++)S();f(),u(1);var c=o(),l=o(),a=d(1);a===0&&u(1),u(1),s()&&(D=o(),L=o(),E=o(),_=o());var v=[1,1];if(s()&&s()){var g=b();switch(g){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-D*2-L*2),height:(2-a)*(l+1)*16-(a?2:4)*(E+_),pixelRatio:v}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=U},"./src/demux/id3.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"isHeader",function(){return G}),A.d(V,"isFooter",function(){return U}),A.d(V,"getID3Data",function(){return R}),A.d(V,"canParse",function(){return I}),A.d(V,"getTimeStamp",function(){return D}),A.d(V,"isTimeStampFrame",function(){return L}),A.d(V,"getID3Frames",function(){return _}),A.d(V,"decodeFrame",function(){return M}),A.d(V,"utf8ArrayToStr",function(){return o}),A.d(V,"testables",function(){return s});var G=function(m,w){return w+10<=m.length&&(m[w]===73&&m[w+1]===68&&m[w+2]===51&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},U=function(m,w){return w+10<=m.length&&(m[w]===51&&m[w+1]===68&&m[w+2]===73&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},R=function(m,w){for(var p=w,h=0;G(m,w);){h+=10;var c=B(m,w+6);h+=c,U(m,w+10)&&(h+=10),w+=h}return h>0?m.subarray(p,p+h):void 0},B=function(m,w){var p=0;return p=(m[w]&127)<<21,p|=(m[w+1]&127)<<14,p|=(m[w+2]&127)<<7,p|=m[w+3]&127,p},I=function(m,w){return G(m,w)&&B(m,w+6)+10<=m.length-w},D=function(m){for(var w=_(m),p=0;p<w.length;p++){var h=w[p];if(L(h))return d(h)}return},L=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},E=function(m){var w=String.fromCharCode(m[0],m[1],m[2],m[3]),p=B(m,4),h=10;return{type:w,size:p,data:m.subarray(h,h+p)}},_=function(m){for(var w=0,p=[];G(m,w);){var h=B(m,w+6);w+=10;for(var c=w+h;w+8<c;){var l=E(m.subarray(w)),a=M(l);a&&p.push(a),w+=l.size+10}U(m,w)&&(w+=10)}return p},M=function(m){return m.type==="PRIV"?C(m):m.type[0]==="W"?b(m):T(m)},C=function(m){if(m.size<2)return;var w=o(m.data,!0),p=new Uint8Array(m.data.subarray(w.length+1));return{key:m.type,info:w,data:p.buffer}},T=function(m){if(m.size<2)return;if(m.type==="TXXX"){var w=1,p=o(m.data.subarray(w),!0);w+=p.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:p,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},b=function(m){if(m.type==="WXXX"){if(m.size<2)return;var w=1,p=o(m.data.subarray(w),!0);w+=p.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:p,data:h}}var c=o(m.data);return{key:m.type,data:c}},d=function(m){if(m.data.byteLength===8){var w=new Uint8Array(m.data),p=w[3]&1,h=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return h/=45,p&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,w){w===void 0&&(w=!1);var p=S();if(p){var h=p.decode(m);if(w){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=m.length,a,v,g,y="",k=0;k<l;){if(a=m[k++],a===0&&w)return y;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(a);break;case 12:case 13:v=m[k++],y+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=m[k++],g=m[k++],y+=String.fromCharCode((a&15)<<12|(v&63)<<6|(g&63)<<0);break;default:}}return y},s={decodeTextFrame:T},u;function S(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),U=A("./src/demux/id3.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/mpegaudio.ts");function I(E,_){E.prototype=Object.create(_.prototype),E.prototype.constructor=E,D(E,_)}function D(E,_){return D=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},D(E,_)}var L=function(E){I(_,E);function _(){return E.apply(this,arguments)||this}var M=_.prototype;return M.resetInitSegment=function(T,b,d){E.prototype.resetInitSegment.call(this,T,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:T,duration:d,inputTimeScale:9e4,dropped:0}},_.probe=function(T){if(!T)return!1;for(var b=U.getID3Data(T,0)||[],d=b.length,o=T.length;d<o;d++)if(B.probe(T,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(T,b){return B.canParse(T,b)},M.appendFrame=function(T,b,d){return this.initPTS===null?void 0:B.appendFrame(T,b,d,this.initPTS,this.frameIndex)},_}(G.default);L.minProbeByteLength=4,V.default=L},"./src/demux/mp4demuxer.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/utils/mp4-tools.ts"),U=A("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(D,L){this.remainderData=null,this.config=void 0,this.config=L}var I=B.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},B.probe=function(L){return Object(G.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},I.demux=function(L){var E=L,_=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(G.appendUint8Array)(this.remainderData,L));var M=Object(G.segmentValidRange)(E);this.remainderData=M.remainder,_.samples=M.valid||new Uint8Array}else _.samples=E;return{audioTrack:Object(U.dummyTrack)(),avcTrack:_,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.flush=function(){var L=Object(U.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:L,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.demuxSampleAes=function(L,E,_){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"appendFrame",function(){return D}),A.d(V,"parseHeader",function(){return L}),A.d(V,"isHeaderPattern",function(){return E}),A.d(V,"isHeader",function(){return _}),A.d(V,"canParse",function(){return M}),A.d(V,"probe",function(){return C});var G=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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function D(T,b,d,o,s){if(d+24>b.length)return;var u=L(b,d);if(u&&d+u.frameLength<=b.length){var S=u.samplesPerFrame*9e4/u.sampleRate,f=o+s*S,m={unit:b.subarray(d,d+u.frameLength),pts:f,dts:f};return T.config=[],T.channelCount=u.channelCount,T.samplerate=u.sampleRate,T.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function L(T,b){var d=T[b+1]>>3&3,o=T[b+1]>>1&3,s=T[b+2]>>4&15,u=T[b+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var S=T[b+2]>>1&1,f=T[b+3]>>6,m=d===3?3-o:o===3?3:4,w=U[m*14+s-1]*1e3,p=d===3?0:d===2?1:2,h=R[p*3+u],c=f===3?1:2,l=B[d][o],a=I[o],v=l*8*a,g=Math.floor(l*w/h+S)*a;if(G===null){var y=navigator.userAgent||"",k=y.match(/Chrome\/(\d+)/i);G=k?parseInt(k[1]):0}var F=!!G&&G<=87;return F&&o===2&&w>=224e3&&f===0&&(T[b+3]=T[b+3]|128),{sampleRate:h,channelCount:c,frameLength:g,samplesPerFrame:v}}}function E(T,b){return T[b]===255&&(T[b+1]&224)===224&&(T[b+1]&6)!==0}function _(T,b){return b+1<T.length&&E(T,b)}function M(T,b){var d=4;return E(T,b)&&d<=T.length-b}function C(T,b){if(b+1<T.length&&E(T,b)){var d=4,o=L(T,b),s=d;o!=null&&o.frameLength&&(s=o.frameLength);var u=b+s;return u===T.length||_(T,u)}return!1}},"./src/demux/sample-aes.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/crypt/decrypter.ts"),U=A("./src/demux/tsdemuxer.ts"),R=function(){function B(D,L,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new G.default(D,L,{removePKCS7Padding:!1})}var I=B.prototype;return I.decryptBuffer=function(L,E){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,E)},I.decryptAacSample=function(L,E,_,M){var C=L[E].unit,T=C.subarray(16,C.length-C.length%16),b=T.buffer.slice(T.byteOffset,T.byteOffset+T.length),d=this;this.decryptBuffer(b,function(o){var s=new Uint8Array(o);C.set(s,16),M||d.decryptAacSamples(L,E+1,_)})},I.decryptAacSamples=function(L,E,_){for(;;E++){if(E>=L.length){_();return}if(L[E].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(L,E,_,M),!M)return}},I.getAvcEncryptedData=function(L){for(var E=Math.floor((L.length-48)/160)*16+16,_=new Int8Array(E),M=0,C=32;C<=L.length-16;C+=160,M+=16)_.set(L.subarray(C,C+16),M);return _},I.getAvcDecryptedUnit=function(L,E){for(var _=new Uint8Array(E),M=0,C=32;C<=L.length-16;C+=160,M+=16)L.set(_.subarray(M,M+16),C);return L},I.decryptAvcSample=function(L,E,_,M,C,T){var b=Object(U.discardEPB)(C.data),d=this.getAvcEncryptedData(b),o=this;this.decryptBuffer(d.buffer,function(s){C.data=o.getAvcDecryptedUnit(b,s),T||o.decryptAvcSamples(L,E,_+1,M)})},I.decryptAvcSamples=function(L,E,_,M){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,_=0){if(E>=L.length){M();return}for(var C=L[E].units;!(_>=C.length);_++){var T=C[_];if(T.data.length<=48||T.type!==1&&T.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(L,E,_,M,T,b),!b)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./node_modules/webworkify-webpack/index.js"),U=A.n(G),R=A("./src/events.ts"),B=A("./src/demux/transmuxer.ts"),I=A("./src/utils/logger.ts"),D=A("./src/errors.ts"),L=A("./src/utils/mediasource-helper.ts"),E=A("./node_modules/eventemitter3/index.js"),_=A.n(E),M=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function T(d,o,s,u){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=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=u;var f=d.config,m=function(l,a){a=a||{},a.frag=S.frag,a.id=S.id,d.trigger(l,a)};this.observer=new E.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,m),this.observer.on(R.Events.ERROR,m);var w={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},p=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:w,vendor:p,id:o,config:JSON.stringify(f)})}catch(c){I.logger.warn("Error in worker:",c),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,w,f,p,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,w,f,p,o)}var b=T.prototype;return b.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},b.push=function(o,s,u,S,f,m,w,p,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,g=m?m.start:f.start,y=f.decryptdata,k=this.frag,F=!(k&&f.cc===k.cc),j=!(k&&h.level===k.level),W=k?h.sn-k.sn:-1,O=this.part?h.part-this.part.index:1,P=!j&&(W===1||W===0&&O===1),H=self.performance.now();(j||W||f.stats.parsing.start===0)&&(f.stats.parsing.start=H),m&&(O||!P)&&(m.stats.parsing.start=H);var X=new B.TransmuxState(F,P,p,j,g);if(!P||F){I.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+P+`
|
|
accurateTimeOffset: `+p+`
|
|
timeOffset: `+g);var Z=new B.TransmuxConfig(u,S,s,w,c);this.configureTransmuxer(Z)}if(this.frag=f,this.part=m,v)v.postMessage({cmd:"demux",data:o,decryptdata:y,chunkMeta:h,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var re=a.push(o,y,h,X);Object(B.isPromise)(re)?re.then(function(be){l.handleTransmuxComplete(be)}):this.handleTransmuxComplete(re)}},b.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(u){var f=u.flush(o);Object(B.isPromise)(f)?f.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},b.handleFlushResult=function(o,s){var u=this;o.forEach(function(S){u.handleTransmuxComplete(S)}),this.onFlush(s)},b.onWorkerMessage=function(o){var s=o.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(o){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},b.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},T}()},"./src/demux/transmuxer-worker.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return D});var G=A("./src/demux/transmuxer.ts"),U=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./node_modules/eventemitter3/index.js"),I=A.n(B);function D(C){var T=new B.EventEmitter,b=function(o,s){C.postMessage({event:o,data:s})};T.on(U.Events.FRAG_DECRYPTED,b),T.on(U.Events.ERROR,b),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new G.default(T,o.typeSupported,s,o.vendor,o.id),Object(R.enableLogs)(s.debug),b("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var u=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(u)?u.then(function(m){L(C,m)}):L(C,u);break}case"flush":{var S=o.chunkMeta,f=C.transmuxer.flush(S);Object(G.isPromise)(f)?f.then(function(m){_(C,m,S)}):_(C,f,S);break}default:break}})}function L(C,T){if(M(T.remuxResult))return;var b=[],d=T.remuxResult,o=d.audio,s=d.video;o&&E(b,o),s&&E(b,s),C.postMessage({event:"transmuxComplete",data:T},b)}function E(C,T){T.data1&&C.push(T.data1.buffer),T.data2&&C.push(T.data2.buffer)}function _(C,T,b){T.forEach(function(d){L(C,d)}),C.postMessage({event:"flush",data:b})}function M(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return s}),A.d(V,"isPromise",function(){return f}),A.d(V,"TransmuxConfig",function(){return m}),A.d(V,"TransmuxState",function(){return w});var G=A("./src/events.ts"),U=A("./src/errors.ts"),R=A("./src/crypt/decrypter.ts"),B=A("./src/demux/aacdemuxer.ts"),I=A("./src/demux/mp4demuxer.ts"),D=A("./src/demux/tsdemuxer.ts"),L=A("./src/demux/mp3demuxer.ts"),E=A("./src/remux/mp4-remuxer.ts"),_=A("./src/remux/passthrough-remuxer.ts"),M=A("./src/demux/chunk-cache.ts"),C=A("./src/utils/mp4-tools.ts"),T=A("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(p){T.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:D.default,remux:E.default},{demux:I.default,remux:_.default},{demux:B.default,remux:E.default},{demux:L.default,remux:E.default}],o=1024;d.forEach(function(p){var h=p.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function p(c,l,a,v,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new M.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=v,this.id=g}var h=p.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,v,g){var y=this,k=v.transmuxing;k.executeStart=b();var F=new Uint8Array(l),j=this.cache,W=this.config,O=this.currentTransmuxState,P=this.transmuxConfig;g&&(this.currentTransmuxState=g);var H=u(F,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var Z=X.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!Z)return k.executeEnd=b(),S(v);F=new Uint8Array(Z)}else return this.decryptionPromise=X.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(we){var _e=y.push(we,null,v);return y.decryptionPromise=null,_e}),this.decryptionPromise}var re=g||O,be=re.contiguous,fe=re.discontinuity,Te=re.trackSwitch,pe=re.accurateTimeOffset,ge=re.timeOffset,ce=P.audioCodec,he=P.videoCodec,J=P.defaultInitPts,oe=P.duration,q=P.initSegmentData;if((fe||Te)&&this.resetInitSegment(q,ce,he,oe),fe&&this.resetInitialTimestamp(J),be||this.resetContiguity(),this.needsProbing(F,fe,Te)){if(j.dataLength){var ye=j.flush();F=Object(C.appendUint8Array)(ye,F)}this.configureTransmuxer(F,P)}var Se=this.transmux(F,H,ge,pe,v),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,k.executeEnd=b(),Se},h.flush=function(l){var a=this,v=l.transmuxing;v.executeStart=b();var g=this.decrypter,y=this.cache,k=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=k.timeOffset;if(g){var O=g.flush();O&&j.push(this.push(O,null,l))}var P=y.dataLength;y.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return P>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=b(),[S(l)];var Z=H.flush(W);return f(Z)?Z.then(function(re){return a.flushRemux(j,re,l),j}):(this.flushRemux(j,Z,l),j)},h.flushRemux=function(l,a,v){var g=a.audioTrack,y=a.avcTrack,k=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,O=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var P=this.remuxer.remux(g,y,k,F,O,W,!0,this.id);l.push({remuxResult:P,chunkMeta:v}),v.transmuxing.executeEnd=b()},h.resetInitialTimestamp=function(l){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(l),v.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,v,g){var y=this.demuxer,k=this.remuxer;if(!y||!k)return;y.resetInitSegment(a,v,g),k.resetInitSegment(l,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,v,g,y){var k;return a&&a.method==="SAMPLE-AES"?k=this.transmuxSampleAes(l,a,v,g,y):k=this.transmuxUnencrypted(l,v,g,y),k},h.transmuxUnencrypted=function(l,a,v,g){var y=this.demuxer.demux(l,a,!1,!this.config.progressive),k=y.audioTrack,F=y.avcTrack,j=y.id3Track,W=y.textTrack,O=this.remuxer.remux(k,F,j,W,a,v,!1,this.id);return{remuxResult:O,chunkMeta:g}},h.transmuxSampleAes=function(l,a,v,g,y){var k=this;return this.demuxer.demuxSampleAes(l,a,v).then(function(F){var j=k.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,g,!1,k.id);return{remuxResult:j,chunkMeta:y}})},h.configureTransmuxer=function(l,a){for(var v=this.config,g=this.observer,y=this.typeSupported,k=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,O=a.initSegmentData,P=a.videoCodec,H,X=0,Z=d.length;X<Z;X++)if(d[X].demux.probe(l)){H=d[X];break}H||(T.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:I.default,remux:_.default});var re=this.demuxer,be=this.remuxer,fe=H.remux,Te=H.demux;(!be||!(be instanceof fe))&&(this.remuxer=new fe(g,v,y,k)),(!re||!(re instanceof Te))&&(this.demuxer=new Te(g,v,y),this.probe=Te.probe),this.resetInitSegment(O,F,P,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,v){return!this.demuxer||!this.remuxer||a||v},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new R.default(this.observer,this.config)),l},p}();function u(p,h){var c=null;return p.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var S=function(h){return{remuxResult:{},chunkMeta:h}};function f(p){return"then"in p&&p.then instanceof Function}var m=function(h,c,l,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=v},w=function(h,c,l,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"discardEPB",function(){return S});var G=A("./src/demux/adts.ts"),U=A("./src/demux/mpegaudio.ts"),R=A("./src/demux/exp-golomb.ts"),B=A("./src/demux/id3.ts"),I=A("./src/demux/sample-aes.ts"),D=A("./src/events.ts"),L=A("./src/utils/mp4-tools.ts"),E=A("./src/utils/logger.ts"),_=A("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},C=function(){function f(w,p,h){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=w,this.config=p,this.typeSupported=h}f.probe=function(p){var h=f.syncOffset(p);return h<0?!1:(h&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(p){for(var h=Math.min(1e3,p.length-3*188),c=0;c<h;){if(p[c]===71&&p[c+188]===71&&p[c+2*188]===71)return c;c++}return-1},f.createTrack=function(p,h){return{container:p==="video"||p==="audio"?"video/mp2t":void 0,type:p,id:M[p],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:p==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(p,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=p,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var p=this._audioTrack,h=this._avcTrack,c=this._id3Track;p&&(p.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(p,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,g=this._audioTrack,y=this._id3Track,k=v.pid,F=v.pesData,j=g.pid,W=y.pid,O=g.pesData,P=y.pesData,H=!1,X=this.pmtParsed,Z=this._pmtId,re=p.length;if(this.remainderData&&(p=Object(L.appendUint8Array)(this.remainderData,p),re=p.length,this.remainderData=null),re<188&&!l)return this.remainderData=p,{audioTrack:g,avcTrack:v,id3Track:y,textTrack:this._txtTrack};var be=Math.max(0,f.syncOffset(p));re-=(re+be)%188,re<p.byteLength&&!l&&(this.remainderData=new Uint8Array(p.buffer,re,p.buffer.byteLength-re));for(var fe=be;fe<re;fe+=188)if(p[fe]===71){var Te=!!(p[fe+1]&64),pe=((p[fe+1]&31)<<8)+p[fe+2],ge=(p[fe+3]&48)>>4,ce=void 0;if(ge>1){if(ce=fe+5+p[fe+4],ce===fe+188)continue}else ce=fe+4;switch(pe){case k:Te&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(p.subarray(ce,fe+188)),F.size+=fe+188-ce);break;case j:Te&&(O&&(a=o(O))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(p.subarray(ce,fe+188)),O.size+=fe+188-ce);break;case W:Te&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(p.subarray(ce,fe+188)),P.size+=fe+188-ce);break;case 0:Te&&(ce+=p[ce]+1),Z=this._pmtId=b(p,ce);break;case Z:{Te&&(ce+=p[ce]+1);var he=d(p,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);k=he.avc,k>0&&(v.pid=k),j=he.audio,j>0&&(g.pid=j,g.isAAC=he.isAAC),W=he.id3,W>0&&(y.pid=W),H&&!X&&(E.logger.log("reparse from beginning"),H=!1,fe=be-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,g.pesData=O,y.pesData=P;var J={audioTrack:g,avcTrack:v,id3Track:y,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},m.flush=function(){var p=this.remainderData;this.remainderData=null;var h;return p?h=this.demux(p,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(p){var h=p.audioTrack,c=p.avcTrack,l=p.id3Track,a=c.pesData,v=h.pesData,g=l.pesData,y;a&&(y=o(a))?(this.parseAVCPES(y,!0),c.pesData=null):c.pesData=a,v&&(y=o(v))?(h.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),h.pesData=null):(v!=null&&v.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),g&&(y=o(g))?(this.parseID3PES(y),l.pesData=null):l.pesData=g},m.demuxSampleAes=function(p,h,c){var l=this.demux(p,c,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,h);return this.decrypt(l,a)},m.decrypt=function(p,h){return new Promise(function(c){var l=p.audioTrack,a=p.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(p)}):c(p)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(p)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(p,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(p.data),v=!1,g=this.avcSample,y,k=!1;p.data=null,g&&a.length&&!l.audFound&&(s(g,l),g=this.avcSample=T(!1,p.pts,p.dts,"")),a.forEach(function(F){switch(F.type){case 1:{y=!0,g||(g=c.avcSample=T(!0,p.pts,p.dts,"")),v&&(g.debug+="NDR "),g.frame=!0;var j=F.data;if(k&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(g.key=!0)}break}case 5:y=!0,g||(g=c.avcSample=T(!0,p.pts,p.dts,"")),v&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{y=!0,v&&g&&(g.debug+="SEI ");var O=new R.default(S(F.data));O.readUByte();for(var P=0,H=0,X=!1,Z=0;!X&&O.bytesAvailable>1;){P=0;do Z=O.readUByte(),P+=Z;while(Z===255);H=0;do Z=O.readUByte(),H+=Z;while(Z===255);if(P===4&&O.bytesAvailable!==0){X=!0;var re=O.readUByte();if(re===181){var be=O.readUShort();if(be===49){var fe=O.readUInt();if(fe===1195456820){var Te=O.readUByte();if(Te===3){for(var pe=O.readUByte(),ge=O.readUByte(),ce=31&pe,he=[pe,ge],J=0;J<ce;J++)he.push(O.readUByte()),he.push(O.readUByte()),he.push(O.readUByte());u(c._txtTrack.samples,{type:3,pts:p.pts,bytes:he})}}}}}else if(P===5&&O.bytesAvailable!==0){if(X=!0,H>16){for(var oe=[],q=0;q<16;q++)oe.push(O.readUByte().toString(16)),(q===3||q===5||q===7||q===9)&&oe.push("-");for(var ye=H-16,Se=new Uint8Array(ye),me=0;me<ye;me++)Se[me]=O.readUByte();u(c._txtTrack.samples,{pts:p.pts,payloadType:P,uuid:oe.join(""),userData:Object(B.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(H<O.bytesAvailable)for(var we=0;we<H;we++)O.readUByte()}break}case 7:if(y=!0,k=!0,v&&g&&(g.debug+="SPS "),!l.sps){var _e=new R.default(F.data),Oe=_e.readSPS();l.width=Oe.width,l.height=Oe.height,l.pixelRatio=Oe.pixelRatio,l.sps=[F.data],l.duration=c._duration;for(var Me=F.data.subarray(1,4),De="avc1.",Le=0;Le<3;Le++){var We=Me[Le].toString(16);We.length<2&&(We="0"+We),De+=We}l.codec=De}break;case 8:y=!0,v&&g&&(g.debug+="PPS "),l.pps||(l.pps=[F.data]);break;case 9:y=!1,l.audFound=!0,g&&s(g,l),g=c.avcSample=T(!1,p.pts,p.dts,v?"AUD ":"");break;case 12:y=!1;break;default:y=!1,g&&(g.debug+="unknown NAL "+F.type+" ");break}if(g&&y){var Ve=g.units;Ve.push(F)}}),h&&g&&(s(g,l),this.avcSample=null)},m.getLastNalUnit=function(){var p,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((p=h)!==null&&p!==void 0&&p.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(p){var h=p.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,v=[],g=0,y,k,F,j=-1,W=0;for(l===-1&&(j=0,W=p[0]&31,l=0,g=1);g<h;){if(y=p[g++],!l){l=y?0:1;continue}if(l===1){l=y?0:2;continue}if(!y)l=3;else if(y===1){if(j>=0){var O={data:p.subarray(j,g-l-1),type:W};v.push(O)}else{var P=this.getLastNalUnit();if(P&&(a&&g<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),k=g-l-1,k>0)){var H=new Uint8Array(P.data.byteLength+k);H.set(P.data,0),H.set(p.subarray(0,k),P.data.byteLength),P.data=H,P.state=0}}g<h?(F=p[g]&31,j=g,W=F,l=0):l=-1}else l=0}if(j>=0&&l>=0){var X={data:p.subarray(j,h),type:W,state:l};v.push(X)}if(v.length===0){var Z=this.getLastNalUnit();if(Z){var re=new Uint8Array(Z.data.byteLength+p.byteLength);re.set(Z.data,0),re.set(p,Z.data.byteLength),Z.data=re}}return c.naluState=l,v},m.parseAACPES=function(p){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=p.data;if(l){this.aacOverFlow=null;var v=l.sample.unit.byteLength,g=Math.min(l.missing,v),y=v-g;l.sample.unit.set(a.subarray(0,g),y),c.samples.push(l.sample),h=l.missing}var k,F;for(k=h,F=a.length;k<F-1&&!G.isHeader(a,k);k++);if(k!==h){var j,W;if(k<F-1?(j="AAC PES did not start with ADTS header,offset:"+k,W=!1):(j="no ADTS header found in AAC PES",W=!0),E.logger.warn("parsing error:"+j),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,k,this.audioCodec);var O;if(p.pts!==void 0)O=p.pts;else if(l){var P=G.getFrameDuration(c.samplerate);O=l.sample.pts+P}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;k<F;)if(G.isHeader(a,k)){if(k+5<F){var X=G.appendFrame(c,a,k,O,H);if(X)if(X.missing)this.aacOverFlow=X;else{k+=X.length,H++;continue}}break}else k++},m.parseMPEGPES=function(p){var h=p.data,c=h.length,l=0,a=0,v=p.pts;if(v===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(U.isHeader(h,a)){var g=U.appendFrame(this._audioTrack,h,a,v,l);if(g)a+=g.length,l++;else break}else a++},m.parseID3PES=function(p){if(p.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(p)},f}();C.minProbeByteLength=188;function T(f,m,w,p){return{key:f,frame:!1,pts:m,dts:w,units:[],debug:p,length:0}}function b(f,m){return(f[m+10]&31)<<8|f[m+11]}function d(f,m,w,p){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],l=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<l;){var v=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!p){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=v);break;case 21:h.id3===-1&&(h.id3=v);break;case 219:if(!p){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:w?h.audio===-1&&(h.audio=v,h.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((f[m+3]&15)<<8|f[m+4])+5}return h}function o(f){var m=0,w,p,h,c,l,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}w=a[0];var g=(w[0]<<16)+(w[1]<<8)+w[2];if(g===1){if(p=(w[4]<<8)+w[5],p&&p>f.size-6)return null;var y=w[7];y&192&&(c=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,y&64?(l=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,c-l>60*9e4&&(E.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=w[8];var k=h+9;if(f.size<=k)return null;f.size-=k;for(var F=new Uint8Array(f.size),j=0,W=a.length;j<W;j++){w=a[j];var O=w.byteLength;if(k)if(k>O){k-=O;continue}else w=w.subarray(k),O-=k,k=0;F.set(w,m),m+=O}return p&&(p-=h+3),{data:F,pts:c,dts:l,len:p}}return null}function s(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var w=m.samples,p=w.length;if(p){var h=w[p-1];f.pts=h.pts,f.dts=h.dts}else{m.dropped++;return}}m.samples.push(f)}f.debug.length&&E.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function u(f,m){var w=f.length;if(w>0){if(m.pts>=f[w-1].pts)f.push(m);else for(var p=w-1;p>=0;p--)if(m.pts<f[p].pts){f.splice(p,0,m);break}}else f.push(m)}function S(f){for(var m=f.byteLength,w=[],p=1;p<m-2;)f[p]===0&&f[p+1]===0&&f[p+2]===3?(w.push(p+2),p+=2):p++;if(w.length===0)return f;var h=m-w.length,c=new Uint8Array(h),l=0;for(p=0;p<h;l++,p++)l===w[0]&&(l++,w.shift()),c[p]=f[l];return c}V.default=C},"./src/errors.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"ErrorTypes",function(){return G}),A.d(V,"ErrorDetails",function(){return U});var G;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(G||(G={}));var U;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"Events",function(){return G});var G;(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"})(G||(G={}))},"./src/hls.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return f});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),U=A.n(G),R=A("./src/loader/playlist-loader.ts"),B=A("./src/loader/key-loader.ts"),I=A("./src/controller/id3-track-controller.ts"),D=A("./src/controller/latency-controller.ts"),L=A("./src/controller/level-controller.ts"),E=A("./src/controller/fragment-tracker.ts"),_=A("./src/controller/stream-controller.ts"),M=A("./src/is-supported.ts"),C=A("./src/utils/logger.ts"),T=A("./src/config.ts"),b=A("./node_modules/eventemitter3/index.js"),d=A.n(b),o=A("./src/events.ts"),s=A("./src/errors.ts");function u(m,w){for(var p=0;p<w.length;p++){var h=w[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function S(m,w,p){return w&&u(m.prototype,w),p&&u(m,p),m}var f=function(){m.isSupported=function(){return Object(M.isSupported)()};function m(p){p===void 0&&(p={}),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 h=this.config=Object(T.mergeConfig)(m.DefaultConfig,p);this.userConfig=p,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(T.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,v=h.fpsController,g=this.abrController=new c(this),y=this.bufferController=new l(this),k=this.capLevelController=new a(this),F=new v(this),j=new R.default(this),W=new B.default(this),O=new I.default(this),P=this.levelController=new L.default(this),H=new E.FragmentTracker(this),X=this.streamController=new _.default(this,H);k.setStreamController(X),F.setStreamController(X);var Z=[P,X];this.networkControllers=Z;var re=[j,W,g,y,k,F,O,H];this.audioTrackController=this.createController(h.audioTrackController,null,Z),this.createController(h.audioStreamController,H,Z),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,Z),this.createController(h.subtitleStreamController,H,Z),this.createController(h.timelineController,null,re),this.emeController=this.createController(h.emeController,null,re),this.cmcdController=this.createController(h.cmcdController,null,re),this.latencyController=this.createController(D.default,null,re),this.coreComponents=re}var w=m.prototype;return w.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},w.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},w.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},w.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},w.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},w.listeners=function(h){return this._emitter.listeners(h)},w.emit=function(h,c,l){return this._emitter.emit(h,c,l)},w.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},w.listenerCount=function(h){return this._emitter.listenerCount(h)},w.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},w.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},w.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},w.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},w.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},w.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},w.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},S(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:T.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"isSupported",function(){return R}),A.d(V,"changeTypeSupported",function(){return B});var G=A("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var I=Object(G.getMediaSource)();if(!I)return!1;var D=U(),L=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!L&&!!E}function B(){var I,D=U();return typeof(D==null||((I=D.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C}),A.d(V,"LoadError",function(){return b});var G=A("./src/polyfills/number.ts"),U=A("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,E(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(u){if(u===null||!L(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,S)}function S(){return I(u,arguments,_(this).constructor)}return S.prototype=Object.create(u.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),E(S,u)},B(d)}function I(d,o,s){return D()?I=Reflect.construct:I=function(S,f,m){var w=[null];w.push.apply(w,f);var p=Function.bind.apply(S,w),h=new p;return m&&E(h,m.prototype),h},I.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function L(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function E(d,o){return E=Object.setPrototypeOf||function(u,S){return u.__proto__=S,u},E(d,o)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},_(d)}var M=Math.pow(2,17),C=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,S){var f=this,m=u.url;if(!m)return Promise.reject(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var w=this.config,p=w.fLoader,h=w.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=u.loader=p?new p(w):new h(w),v=T(u),g={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:M};u.stats=a.stats,a.load(v,g,{onSuccess:function(k,F,j,W){f.resetLoader(u,a),c({frag:u,part:null,payload:k.data,networkDetails:W})},onError:function(k,F,j){f.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:k,networkDetails:j}))},onAbort:function(k,F,j){f.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(k,F,j){f.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(k,F,j,W){S&&S({frag:u,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(u,S,f){var m=this;this.abort();var w=this.config,p=w.fLoader,h=w.loader;return new Promise(function(c,l){m.loader&&m.loader.destroy();var a=m.loader=u.loader=p?new p(w):new h(w),v=T(u,S),g={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:M};S.stats=a.stats,a.load(v,g,{onSuccess:function(k,F,j,W){m.resetLoader(u,a),m.updateStatsFromPart(u,S);var O={frag:u,part:S,payload:k.data,networkDetails:W};f(O),c(O)},onError:function(k,F,j){m.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:S,response:k,networkDetails:j}))},onAbort:function(k,F,j){u.stats.aborted=S.stats.aborted,m.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:S,networkDetails:j}))},onTimeout:function(k,F,j){m.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(u,S){var f=u.stats,m=S.stats,w=m.total;if(f.loaded+=m.loaded,w){var p=Math.round(u.duration/S.duration),h=Math.min(Math.round(f.loaded/w),p),c=p-h,l=c*Math.round(f.loaded/h);f.total=f.loaded+l}else f.total=Math.max(f.loaded,f.total);var a=f.loading,v=m.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(u,S){u.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},d}();function T(d,o){o===void 0&&(o=null);var s=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(G.isFiniteNumber)(S)&&Object(G.isFiniteNumber)(f)&&(u.rangeStart=S,u.rangeEnd=f),u}var b=function(d){R(o,d);function o(s){for(var u,S=arguments.length,f=new Array(S>1?S-1:0),m=1;m<S;m++)f[m-1]=arguments[m];return u=d.call.apply(d,[this].concat(f))||this,u.data=void 0,u.data=s,u}return o}(B(Error))},"./src/loader/fragment.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"ElementaryStreamTypes",function(){return C}),A.d(V,"BaseSegment",function(){return T}),A.d(V,"Fragment",function(){return b}),A.d(V,"Part",function(){return d});var G=A("./src/polyfills/number.ts"),U=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(U),B=A("./src/utils/logger.ts"),I=A("./src/loader/level-key.ts"),D=A("./src/loader/load-stats.ts");function L(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,E(o,s)}function E(o,s){return E=Object.setPrototypeOf||function(S,f){return S.__proto__=f,S},E(o,s)}function _(o,s){for(var u=0;u<s.length;u++){var S=s[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function M(o,s,u){return s&&_(o.prototype,s),u&&_(o,u),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var T=function(){function o(u){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[C.AUDIO]=null,S[C.VIDEO]=null,S[C.AUDIOVIDEO]=null,S),this.baseurl=u}var s=o.prototype;return s.setByteRange=function(S,f){var m=S.split("@",2),w=[];m.length===1?w[0]=f?f.byteRangeEndOffset:0:w[0]=parseInt(m[1]),w[1]=parseInt(m[0])+w[0],this._byteRange=w},M(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),b=function(o){L(s,o);function s(S,f){var m;return m=o.call(this,f)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new D.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=S,m}var u=s.prototype;return u.createInitializationVector=function(f){for(var m=new Uint8Array(16),w=12;w<16;w++)m[w]=f>>8*(15-w)&255;return m},u.setDecryptDataFromLevelKey=function(f,m){var w=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(w=I.LevelKey.fromURI(f.uri),w.method=f.method,w.iv=this.createInitializationVector(m),w.keyFormat="identity"),w},u.setElementaryStreamInfo=function(f,m,w,p,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[f];if(!a){l[f]={startPTS:m,endPTS:w,startDTS:p,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,p),a.endDTS=Math.max(a.endDTS,h)},u.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var f=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(T),d=function(o){L(s,o);function s(u,S,f,m,w){var p;p=o.call(this,f)||this,p.fragOffset=0,p.duration=0,p.gap=!1,p.independent=!1,p.relurl=void 0,p.fragment=void 0,p.index=void 0,p.stats=new D.LoadStats,p.duration=u.decimalFloatingPoint("DURATION"),p.gap=u.bool("GAP"),p.independent=u.bool("INDEPENDENT"),p.relurl=u.enumeratedString("URI"),p.fragment=S,p.index=m;var h=u.enumeratedString("BYTERANGE");return h&&p.setByteRange(h,w),w&&(p.fragOffset=w.fragOffset+w.duration),p}return M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(T)},"./src/loader/key-loader.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return B});var G=A("./src/events.ts"),U=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=function(){function I(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var D=I.prototype;return D._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var _=this.loaders[E];_&&_.destroy()}this.loaders={}},D.onKeyLoading=function(E,_){var M=_.frag,C=M.type,T=this.loaders[C];if(!M.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=M.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(T&&(R.logger.warn("abort previous key loader for type:"+C),T.abort()),!b){R.logger.warn("key uri is falsy");return}var o=d.loader,s=M.loader=this.loaders[C]=new o(d);this.decrypturl=b,this.decryptkey=null;var u={url:b,frag:M,responseType:"arraybuffer"},S={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,S,f)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:M}))},D.loadsuccess=function(E,_,M){var C=M.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(E.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},D.loaderror=function(E,_){var M=_.frag,C=M.loader;C&&C.abort(),delete this.loaders[M.type],this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:E})},D.loadtimeout=function(E,_){var M=_.frag,C=M.loader;C&&C.abort(),delete this.loaders[M.type],this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},I}()},"./src/loader/level-details.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"LevelDetails",function(){return I});var G=A("./src/polyfills/number.ts");function U(D,L){for(var E=0;E<L.length;E++){var _=L[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(D,_.key,_)}}function R(D,L,E){return L&&U(D.prototype,L),E&&U(D,E),D}var B=10,I=function(){function D(E){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=E}var L=D.prototype;return L.reloaded=function(_){if(!_){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-_.lastPartSn,C=this.lastPartIndex-_.lastPartIndex;this.updated=this.endSN!==_.endSN||!!C||!!M,this.advanced=this.endSN>_.endSN||M>0||M===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(_.misses*.6):this.misses=_.misses+1,this.availabilityDelay=_.availabilityDelay},R(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var _=this.driftEndTime-this.driftStartTime;if(_>0){var M=this.driftEnd-this.driftStart;return M*1e3/_}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var _;return(_=this.fragments)!==null&&_!==void 0&&_.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 _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),D}()},"./src/loader/level-key.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"LevelKey",function(){return I});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),U=A.n(G);function R(D,L){for(var E=0;E<L.length;E++){var _=L[E];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(D,_.key,_)}}function B(D,L,E){return L&&R(D.prototype,L),E&&R(D,E),D}var I=function(){D.fromURL=function(E,_){return new D(E,_)},D.fromURI=function(E){return new D(E)};function D(L,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(G.buildAbsoluteURL)(L,E,{alwaysNormalize:!0}):this._uri=L}return B(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"LoadStats",function(){return G});var G=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return s});var G=A("./src/polyfills/number.ts"),U=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(U),B=A("./src/loader/fragment.ts"),I=A("./src/loader/level-details.ts"),D=A("./src/loader/level-key.ts"),L=A("./src/utils/attr-list.ts"),E=A("./src/utils/logger.ts"),_=A("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,T=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var p,h;return d.test((p=(h=U.parseURL(w))===null||h===void 0?void 0:h.path)!=null?p:"")}var s=function(){function w(){}return w.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},w.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},w.resolve=function(h,c){return U.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(h,c){var l=[],a={},v=!1;M.lastIndex=0;for(var g;(g=M.exec(h))!=null;)if(g[1]){var y=new L.AttrList(g[1]),k={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:w.resolve(g[2],c)},F=y.decimalResolution("RESOLUTION");F&&(k.width=F.width,k.height=F.height),u((y.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=w.convertAVC1ToAVCOTI(k.videoCodec)),l.push(k)}else if(g[3]){var j=new L.AttrList(g[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:v?a:null}},w.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var v,g=[],y=0;for(C.lastIndex=0;(v=C.exec(h))!==null;){var k=new L.AttrList(v[1]);if(k.TYPE===l){var F={attrs:k,bitrate:0,id:y++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:l,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?w.resolve(k.URI,c):""};if(a.length){var j=w.findGroup(a,F.groupId)||a[0];S(F,j,"audioCodec"),S(F,j,"textCodec")}g.push(F)}}return g},w.parseLevelPlaylist=function(h,c,l,a,v){var g=new I.LevelDetails(c),y=g.fragments,k=null,F=0,j=0,W=0,O=0,P=null,H=new B.Fragment(a,c),X,Z,re,be=-1,fe=!1;for(T.lastIndex=0,g.m3u8=h;(X=T.exec(h))!==null;){fe&&(fe=!1,H=new B.Fragment(a,c),H.start=W,H.sn=F,H.cc=O,H.level=l,k&&(H.initSegment=k,H.rawProgramDateTime=k.rawProgramDateTime));var Te=X[1];if(Te){H.duration=parseFloat(Te);var pe=(" "+X[2]).slice(1);H.title=pe||null,H.tagList.push(pe?["INF",Te,pe]:["INF",Te])}else if(X[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,re&&(H.levelkey=re),H.sn=F,H.level=l,H.cc=O,H.urlId=v,y.push(H),H.relurl=(" "+X[3]).slice(1),m(H,P),P=H,W+=H.duration,F++,j=0,fe=!0);else if(X[4]){var ge=(" "+X[4]).slice(1);P?H.setByteRange(ge,P):H.setByteRange(ge)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),be===-1&&(be=y.length);else{if(X=X[0].match(b),!X){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z<X.length&&!(typeof X[Z]!="undefined");Z++);var ce=(" "+X[Z]).slice(1),he=(" "+X[Z+1]).slice(1),J=X[Z+2]?(" "+X[Z+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":g.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":F=g.startSN=parseInt(he);break;case"SKIP":{var oe=new L.AttrList(he),q=oe.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(q)){g.skippedSegments=q;for(var ye=q;ye--;)y.unshift(null);F+=q}var Se=oe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(g.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(he);break;case"VERSION":g.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(he||J)&&H.tagList.push(J?[he,J]:[he]);break;case"DIS":O++;case"GAP":H.tagList.push([ce]);break;case"BITRATE":H.tagList.push([ce,he]);break;case"DISCONTINUITY-SEQ":O=parseInt(he);break;case"KEY":{var me,we=new L.AttrList(he),_e=we.enumeratedString("METHOD"),Oe=we.URI,Me=we.hexadecimalInteger("IV"),De=we.enumeratedString("KEYFORMATVERSIONS"),Le=we.enumeratedString("KEYID"),We=(me=we.enumeratedString("KEYFORMAT"))!=null?me:"identity",Ve=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ve.indexOf(We)>-1){E.logger.warn("Keyformat "+We+" is not supported from the manifest");continue}else if(We!=="identity")continue;_e&&(re=D.LevelKey.fromURL(c,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(_e)>=0&&(re.method=_e,re.keyFormat=We,Le&&(re.keyID=Le),De&&(re.keyFormatVersions=De),re.iv=Me));break}case"START":{var Xe=new L.AttrList(he),Be=Xe.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(Be)&&(g.startTimeOffset=Be);break}case"MAP":{var Qe=new L.AttrList(he);H.relurl=Qe.URI,Qe.BYTERANGE&&H.setByteRange(Qe.BYTERANGE),H.level=l,H.sn="initSegment",re&&(H.levelkey=re),H.initSegment=null,k=H,fe=!0;break}case"SERVER-CONTROL":{var Ke=new L.AttrList(he);g.canBlockReload=Ke.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Ke.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Ke.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Ke.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Ke.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var $e=new L.AttrList(he);g.partTarget=$e.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=g.partList;Ae||(Ae=g.partList=[]);var qe=j>0?Ae[Ae.length-1]:void 0,Je=j++,Re=new B.Part(new L.AttrList(he),H,c,Je,qe);Ae.push(Re),H.duration+=Re.duration;break}case"PRELOAD-HINT":{var Fe=new L.AttrList(he);g.preloadHint=Fe;break}case"RENDITION-REPORT":{var se=new L.AttrList(he);g.renditionReports=g.renditionReports||[],g.renditionReports.push(se);break}default:E.logger.warn("line parsed but not handled: "+X);break}}}P&&!P.relurl?(y.pop(),W-=P.duration,g.partList&&(g.fragmentHint=P)):g.partList&&(m(H,P),H.cc=O,g.fragmentHint=H);var le=y.length,ue=y[0],$=y[le-1];if(W+=g.skippedSegments*g.targetduration,W>0&&le&&$){g.averagetargetduration=W/le;var Q=$.sn;g.endSN=Q!=="initSegment"?Q:0,ue&&(g.startCC=ue.cc,ue.initSegment||g.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=$.relurl,H.level=l,H.sn="initSegment",ue.initSegment=H,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(W+=g.fragmentHint.duration),g.totalduration=W,g.endCC=O,be>0&&f(y,be),g},w}();function u(w,p){["video","audio","text"].forEach(function(h){var c=w.filter(function(a){return Object(_.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});p[h+"Codec"]=l.length>0?l[0]:c[0],w=w.filter(function(a){return c.indexOf(a)===-1})}}),p.unknownCodecs=w}function S(w,p,h){var c=p[h];c&&(w[h]=c)}function f(w,p){for(var h=w[p],c=p;c--;){var l=w[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function m(w,p){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):p!=null&&p.programDateTime&&(w.programDateTime=p.endProgramDateTime),Object(G.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),U=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/logger.ts"),I=A("./src/utils/mp4-tools.ts"),D=A("./src/loader/m3u8-parser.ts"),L=A("./src/types/loader.ts"),E=A("./src/utils/attr-list.ts");function _(T){var b=T.type;switch(b){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function M(T,b){var d=T.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var C=function(){function T(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=T.prototype;return b.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(o){var s=this.hls.config,u=s.pLoader,S=s.loader,f=u||S,m=new f(s);return o.loader=m,this.loaders[o.type]=m,m},b.getInternalLoader=function(o){return this.loaders[o.type]},b.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},b.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(o,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},b.onLevelLoading=function(o,s){var u=s.id,S=s.level,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:null,level:S,responseType:"text",type:L.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},b.onAudioTrackLoading=function(o,s){var u=s.id,S=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:S,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},b.onSubtitleTrackLoading=function(o,s){var u=s.id,S=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:S,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},b.load=function(o){var s,u=this.hls.config,S=this.getInternalLoader(o);if(S){var f=S.context;if(f&&f.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var m,w,p,h;switch(o.type){case L.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,w=u.manifestLoadingTimeOut,p=u.manifestLoadingRetryDelay,h=u.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:m=0,w=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,w=u.levelLoadingTimeOut,p=u.levelLoadingRetryDelay,h=u.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===L.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===L.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(w=Math.min(Math.max(l*3,a*.8)*1e3,w))}}var v={timeout:w,maxRetry:m,retryDelay:p,maxRetryDelay:h,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,v,g)},b.loadsuccess=function(o,s,u,S){if(S===void 0&&(S=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,s,u,S);return}this.resetInternalLoader(u.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,u,S):this.handleMasterPlaylist(o,s,u,S)},b.loaderror=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,o)},b.loadtimeout=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},b.handleMasterPlaylist=function(o,s,u,S){var f=this.hls,m=o.data,w=M(o,u),p=D.default.parseMasterPlaylist(m,w),h=p.levels,c=p.sessionData;if(!h.length){this.handleManifestParsingError(o,u,"no level found in manifest",S);return}var l=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),v=D.default.parseMasterPlaylistMedia(m,w,"AUDIO",l),g=D.default.parseMasterPlaylistMedia(m,w,"SUBTITLES",a),y=D.default.parseMasterPlaylistMedia(m,w,"CLOSED-CAPTIONS");if(v.length){var k=v.some(function(F){return!F.url});!k&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}f.trigger(U.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:g,captions:y,url:w,stats:s,networkDetails:S,sessionData:c})},b.handleTrackOrLevelPlaylist=function(o,s,u,S){var f=this.hls,m=u.id,w=u.level,p=u.type,h=M(o,u),c=Object(G.isFiniteNumber)(m)?m:0,l=Object(G.isFiniteNumber)(w)?w:c,a=_(u),v=D.default.parseLevelPlaylist(o.data,h,l,a,c);if(!v.fragments.length){f.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(p===L.PlaylistContextType.MANIFEST){var g={attrs:new E.AttrList({}),bitrate:0,details:v,name:"",url:h};f.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:h,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),v.needSidxRanges){var y,k=(y=v.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:k,isSidxRequest:!0,type:p,level:w,levelDetails:v,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=v,this.handlePlaylistLoaded(o,s,u,S)},b.handleSidxRequest=function(o,s){var u=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var S=u.references,f=s.levelDetails;S.forEach(function(m,w){var p=m.info,h=f.fragments[w];h.byteRange.length===0&&h.setByteRange(String(1+p.end-p.start)+"@"+String(p.start)),h.initSegment&&h.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(o,s,u,S){this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:s,networkDetails:S})},b.handleNetworkError=function(o,s,u,S){u===void 0&&(u=!1),B.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=R.ErrorDetails.UNKNOWN,m=!1,w=this.getInternalLoader(o);switch(o.type){case L.PlaylistContextType.MANIFEST:f=u?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:f=u?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:f=u?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:f=u?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}w&&this.resetInternalLoader(o.type);var p={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:w,context:o,networkDetails:s};S&&(p.response=S),this.hls.trigger(U.Events.ERROR,p)},b.handlePlaylistLoaded=function(o,s,u,S){var f=u.type,m=u.level,w=u.id,p=u.groupId,h=u.loader,c=u.levelDetails,l=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",S);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:c,level:m||0,id:w||0,stats:s,networkDetails:S,deliveryDirectives:l});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:w||0,groupId:p||"",stats:s,networkDetails:S,deliveryDirectives:l});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:w||0,groupId:p||"",stats:s,networkDetails:S,deliveryDirectives:l});break}},T}();V.default=C},"./src/polyfills/number.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"isFiniteNumber",function(){return G}),A.d(V,"MAX_SAFE_INTEGER",function(){return U});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,V,A){"use strict";A.r(V);var G=function(){function U(){}return U.getSilentFrame=function(B,I){switch(B){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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}();V.default=G},"./src/remux/mp4-generator.ts":function(ne,V,A){"use strict";A.r(V);var G=Math.pow(2,32)-1,U=function(){function R(){}return R.init=function(){R.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 I;for(I in R.types)R.types.hasOwnProperty(I)&&(R.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var D=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]),L=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]);R.HDLR_TYPES={video:D,audio:L};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=_,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),T=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,M,T,M,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,E))},R.box=function(I){for(var D=8,L=arguments.length,E=new Array(L>1?L-1:0),_=1;_<L;_++)E[_-1]=arguments[_];for(var M=E.length,C=M;M--;)D+=E[M].byteLength;var T=new Uint8Array(D);for(T[0]=D>>24&255,T[1]=D>>16&255,T[2]=D>>8&255,T[3]=D&255,T.set(I,4),M=0,D=8;M<C;M++)T.set(E[M],D),D+=E[M].byteLength;return T},R.hdlr=function(I){return R.box(R.types.hdlr,R.HDLR_TYPES[I])},R.mdat=function(I){return R.box(R.types.mdat,I)},R.mdhd=function(I,D){D*=I;var L=Math.floor(D/(G+1)),E=Math.floor(D%(G+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},R.mdia=function(I){return R.box(R.types.mdia,R.mdhd(I.timescale,I.duration),R.hdlr(I.type),R.minf(I))},R.mfhd=function(I){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},R.minf=function(I){return I.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(I)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(I))},R.moof=function(I,D,L){return R.box(R.types.moof,R.mfhd(I),R.traf(L,D))},R.moov=function(I){for(var D=I.length,L=[];D--;)L[D]=R.trak(I[D]);return R.box.apply(null,[R.types.moov,R.mvhd(I[0].timescale,I[0].duration)].concat(L).concat(R.mvex(I)))},R.mvex=function(I){for(var D=I.length,L=[];D--;)L[D]=R.trex(I[D]);return R.box.apply(null,[R.types.mvex].concat(L))},R.mvhd=function(I,D){D*=I;var L=Math.floor(D/(G+1)),E=Math.floor(D%(G+1)),_=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,E>>24,E>>16&255,E>>8&255,E&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 R.box(R.types.mvhd,_)},R.sdtp=function(I){var D=I.samples||[],L=new Uint8Array(4+D.length),E,_;for(E=0;E<D.length;E++)_=D[E].flags,L[E+4]=_.dependsOn<<4|_.isDependedOn<<2|_.hasRedundancy;return R.box(R.types.sdtp,L)},R.stbl=function(I){return R.box(R.types.stbl,R.stsd(I),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(I){var D=[],L=[],E,_,M;for(E=0;E<I.sps.length;E++)_=I.sps[E],M=_.byteLength,D.push(M>>>8&255),D.push(M&255),D=D.concat(Array.prototype.slice.call(_));for(E=0;E<I.pps.length;E++)_=I.pps[E],M=_.byteLength,L.push(M>>>8&255),L.push(M&255),L=L.concat(Array.prototype.slice.call(_));var C=R.box(R.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|I.sps.length].concat(D).concat([I.pps.length]).concat(L))),T=I.width,b=I.height,d=I.pixelRatio[0],o=I.pixelRatio[1];return R.box(R.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,T>>8&255,T&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]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(I){var D=I.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(I.config).concat([6,1,2]))},R.mp4a=function(I){var D=I.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),R.box(R.types.esds,R.esds(I)))},R.mp3=function(I){var D=I.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},R.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(I)):R.box(R.types.stsd,R.STSD,R.mp4a(I)):R.box(R.types.stsd,R.STSD,R.avc1(I))},R.tkhd=function(I){var D=I.id,L=I.duration*I.timescale,E=I.width,_=I.height,M=Math.floor(L/(G+1)),C=Math.floor(L%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,C>>24,C>>16&255,C>>8&255,C&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,E>>8&255,E&255,0,0,_>>8&255,_&255,0,0]))},R.traf=function(I,D){var L=R.sdtp(I),E=I.id,_=Math.floor(D/(G+1)),M=Math.floor(D%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,M>>24,M>>16&255,M>>8&255,M&255])),R.trun(I,L.length+16+20+8+16+8+8),L)},R.trak=function(I){return I.duration=I.duration||4294967295,R.box(R.types.trak,R.tkhd(I),R.mdia(I))},R.trex=function(I){var D=I.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(I,D){var L=I.samples||[],E=L.length,_=12+16*E,M=new Uint8Array(_),C,T,b,d,o,s;for(D+=8+_,M.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),C=0;C<E;C++)T=L[C],b=T.duration,d=T.size,o=T.flags,s=T.cts,M.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return R.box(R.types.trun,M)},R.initSegment=function(I){R.types||R.init();var D=R.moov(I),L=new Uint8Array(R.FTYP.byteLength+D.byteLength);return L.set(R.FTYP),L.set(D,R.FTYP.byteLength),L},R}();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,V.default=U},"./src/remux/mp4-remuxer.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return s}),A.d(V,"normalizePts",function(){return u});var G=A("./src/polyfills/number.ts"),U=A("./src/remux/aac-helper.ts"),R=A("./src/remux/mp4-generator.ts"),B=A("./src/events.ts"),I=A("./src/errors.ts"),D=A("./src/utils/logger.ts"),L=A("./src/types/loader.ts"),E=A("./src/utils/timescale-conversion.ts");function _(){return _=Object.assign||function(w){for(var p=1;p<arguments.length;p++){var h=arguments[p];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},_.apply(this,arguments)}var M=10*1e3,C=1024,T=1152,b=null,d=null,o=!1,s=function(){function w(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,b===null){var v=navigator.userAgent||"",g=v.match(/Chrome\/(\d+)/i);b=g?parseInt(g[1]):0}if(d===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);d=y?parseInt(y[1]):0}o=!!b&&b<75||!!d&&d<600}var p=w.prototype;return p.destroy=function(){},p.resetTimeStamp=function(c){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},p.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},p.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},p.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(v,g){var y=g.pts-v;return y<-4294967296?(l=!0,u(v,g.pts)):y>0?v:g.pts},c[0].pts);return l&&D.logger.debug("PTS rollover detected"),a},p.remux=function(c,l,a,v,g,y,k,F){var j,W,O,P,H,X,Z=g,re=g,be=c.pid>-1,fe=l.pid>-1,Te=l.samples.length,pe=c.samples.length>0,ge=Te>1,ce=(!be||pe)&&(!fe||ge)||this.ISGenerated||k;if(ce){this.ISGenerated||(O=this.generateIS(c,l,g));var he=this.isVideoContiguous,J=-1;if(ge&&(J=S(l.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,J>0){D.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+Te+" video samples due to a missing keyframe");var oe=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,re+=(l.samples[0].pts-oe)/(l.timescale||9e4)}else J===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),X=!1);if(this.ISGenerated){if(pe&&ge){var q=this.getVideoStartPts(l.samples),ye=u(c.samples[0].pts,q)-q,Se=ye/l.inputTimeScale;Z+=Math.max(0,Se),re+=Math.max(0,-Se)}if(pe){if(c.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(c,l,g)),W=this.remuxAudio(c,Z,this.isAudioContiguous,y,fe||ge||F===L.PlaylistLevelType.AUDIO?re:void 0),ge){var me=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(c,l,g)),j=this.remuxVideo(l,re,he,me)}}else ge&&(j=this.remuxVideo(l,re,he,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,g)),v.samples.length&&(P=this.remuxText(v,g))),{audio:W,video:j,initSegment:O,independent:X,text:P,id3:H}},p.generateIS=function(c,l,a){var v=c.samples,g=l.samples,y=this.typeSupported,k={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,O,P;if(F&&(W=O=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(y.mpeg?(j="audio/mpeg",c.codec=""):y.mp3&&(c.codec="mp3")),k.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&y.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=O=v[0].pts-Math.round(P*a))),l.sps&&l.pps&&g.length&&(l.timescale=l.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){P=l.inputTimeScale;var H=this.getVideoStartPts(g),X=Math.round(P*a);O=Math.min(O,u(g[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(k).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=O),{tracks:k,initPTS:W,timescale:P}},p.remuxVideo=function(c,l,a,v){var g=c.inputTimeScale,y=c.samples,k=[],F=y.length,j=this._initPTS,W=this.nextAvcDts,O=8,P,H,X,Z=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY,be=0,fe=!1;if(!a||W===null){var Te=l*g,pe=y[0].pts-u(y[0].dts,y[0].pts);W=Te-pe}for(var ge=0;ge<F;ge++){var ce=y[ge];if(ce.pts=u(ce.pts-j,W),ce.dts=u(ce.dts-j,W),ce.dts>ce.pts){var he=9e4*.2;be=Math.max(Math.min(be,ce.pts-ce.dts),-1*he)}ce.dts<y[ge>0?ge-1:ge].dts&&(fe=!0)}fe&&y.sort(function(Lt,mt){var st=Lt.dts-mt.dts,It=Lt.pts-mt.pts;return st||It}),H=y[0].dts,X=y[y.length-1].dts;var J=Math.round((X-H)/(F-1));if(be<0){if(be<J*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-J,!0)+" ms");for(var oe=be,q=0;q<F;q++)y[q].dts=oe=Math.max(oe,y[q].pts-J),y[q].pts=Math.max(oe,y[q].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(be,!0)+" ms to overcome this issue");for(var ye=0;ye<F;ye++)y[ye].dts=y[ye].dts+be}H=y[0].dts}if(a){var Se=H-W,me=Se>J,we=Se<-1;if(me||we){me?D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),H=W;var _e=y[0].pts-Se;y[0].dts=H,y[0].pts=_e,D.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(_e,!0)+"/"+Object(E.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Se,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Oe=0,Me=0,De=0;De<F;De++){for(var Le=y[De],We=Le.units,Ve=We.length,Xe=0,Be=0;Be<Ve;Be++)Xe+=We[Be].data.length;Me+=Xe,Oe+=Ve,Le.length=Xe,Le.dts=Math.max(Le.dts,H),Le.pts=Math.max(Le.pts,Le.dts,0),Z=Math.min(Le.pts,Z),re=Math.max(Le.pts,re)}X=y[F-1].dts;var Qe=Me+4*Oe+8,Ke;try{Ke=new Uint8Array(Qe)}catch(Lt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Qe,reason:"fail allocating video mdat "+Qe});return}var $e=new DataView(Ke.buffer);$e.setUint32(0,Qe),Ke.set(R.default.types.mdat,4);for(var Ae=0;Ae<F;Ae++){for(var qe=y[Ae],Je=qe.units,Re=0,Fe=0,se=Je.length;Fe<se;Fe++){var le=Je[Fe],ue=le.data,$=le.data.byteLength;$e.setUint32(O,$),O+=4,Ke.set(ue,O),O+=$,Re+=4+$}if(Ae<F-1)P=y[Ae+1].dts-qe.dts;else{var Q=this.config,te=qe.dts-y[Ae>0?Ae-1:Ae].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var ie=Math.floor(Q.maxBufferHole*g),Ee=(v?Z+v*g:this.nextAudioPts)-qe.pts;Ee>ie?(P=Ee-te,P<0&&(P=te),D.logger.log("[mp4-remuxer]: It is approximately "+Ee/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=te}else P=te}var Ce=Math.round(qe.pts-qe.dts);k.push(new f(qe.key,P,Re,Ce))}if(k.length&&b&&b<70){var Ie=k[0].flags;Ie.dependsOn=2,Ie.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+P,this.isVideoContiguous=!0;var tt=R.default.moof(c.sequenceNumber++,H,_({},c,{samples:k})),dt="video",it={data1:tt,data2:Ke,startPTS:Z/g,endPTS:(re+P)/g,startDTS:H/g,endDTS:W/g,type:dt,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ke.length,"MDAT length must not be zero"),it},p.remuxAudio=function(c,l,a,v,g){var y=c.inputTimeScale,k=c.samplerate?c.samplerate:y,F=y/k,j=c.isAAC?C:T,W=j*F,O=this._initPTS,P=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,Z=P?0:8,re=this.nextAudioPts||-1,be=l*y;if(this.isAudioContiguous=a=a||X.length&&re>0&&(v&&Math.abs(be-re)<9e3||Math.abs(u(X[0].pts-O,be)-re)<20*W),X.forEach(function(ue){ue.pts=u(ue.pts-O,be)}),!a||re<0){if(X=X.filter(function(ue){return ue.pts>=0}),!X.length)return;g===0?re=0:v?re=Math.max(0,be):re=X[0].pts}if(c.isAAC)for(var fe=g!==void 0,Te=this.config.maxAudioFramesDrift,pe=0,ge=re;pe<X.length;pe++){var ce=X[pe],he=ce.pts,J=he-ge,oe=Math.abs(1e3*J/y);if(J<=-Te*W&&fe)pe===0&&(D.logger.warn("Audio frame @ "+(he/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/y)+" ms."),this.nextAudioPts=re=ge=he);else if(J>=Te*W&&oe<M&&fe){var q=Math.round(J/W);ge=he-q*W,ge<0&&(q--,ge+=W),pe===0&&(this.nextAudioPts=re=ge),D.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(ge/y).toFixed(3)+"s due to "+Math.round(1e3*J/y)+" ms gap.");for(var ye=0;ye<q;ye++){var Se=Math.max(ge,0),me=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);me||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),me=ce.unit.subarray()),X.splice(pe,0,{unit:me,pts:Se}),ge+=W,pe++}}ce.pts=ge,ge+=W}for(var we=null,_e=null,Oe,Me=0,De=X.length;De--;)Me+=X[De].unit.byteLength;for(var Le=0,We=X.length;Le<We;Le++){var Ve=X[Le],Xe=Ve.unit,Be=Ve.pts;if(_e!==null){var Qe=H[Le-1];Qe.duration=Math.round((Be-_e)/F)}else if(a&&c.isAAC&&(Be=re),we=Be,Me>0){Me+=Z;try{Oe=new Uint8Array(Me)}catch(ue){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Me,reason:"fail allocating audio mdat "+Me});return}if(!P){var Ke=new DataView(Oe.buffer);Ke.setUint32(0,Me),Oe.set(R.default.types.mdat,4)}}else return;Oe.set(Xe,Z);var $e=Xe.byteLength;Z+=$e,H.push(new f(!0,j,$e,0)),_e=Be}var Ae=H.length;if(!Ae)return;var qe=H[H.length-1];this.nextAudioPts=re=_e+F*qe.duration;var Je=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,we/F,_({},c,{samples:H}));c.samples=[];var Re=we/y,Fe=re/y,se="audio",le={data1:Je,data2:Oe,startPTS:Re,endPTS:Fe,startDTS:Re,endDTS:Fe,type:se,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),le},p.remuxEmptyAudio=function(c,l,a,v){var g=c.inputTimeScale,y=c.samplerate?c.samplerate:g,k=g/y,F=this.nextAudioPts,j=(F!==null?F:v.startDTS*g)+this._initDTS,W=v.endDTS*g+this._initDTS,O=k*C,P=Math.ceil((W-j)/O),H=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],Z=0;Z<P;Z++){var re=j+Z*O;X.push({unit:H,pts:re,dts:re})}return c.samples=X,this.remuxAudio(c,l,a,!1)},p.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,g=this._initPTS,y=this._initDTS,k=0;k<a;k++){var F=c.samples[k];F.pts=u(F.pts-g,l*v)/v,F.dts=u(F.dts-y,l*v)/v}var j=c.samples;return c.samples=[],{samples:j}},p.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,g=this._initPTS,y=0;y<a;y++){var k=c.samples[y];k.pts=u(k.pts-g,l*v)/v}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},w}();function u(w,p){var h;if(p===null)return w;for(p<w?h=-8589934592:h=8589934592;Math.abs(w-p)>4294967296;)w+=h;return w}function S(w){for(var p=0;p<w.length;p++)if(w[p].key)return p;return-1}var f=function(p,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new m(p)},m=function(p){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=p?2:1,this.isNonSync=p?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),U=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/fragment.ts"),B=A("./src/utils/logger.ts"),I=function(){function E(){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 _=E.prototype;return _.destroy=function(){},_.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},_.resetNextTimestamp=function(){this.lastEndDTS=null},_.resetInitSegment=function(C,T,b){this.audioCodec=T,this.videoCodec=b,this.generateInitSegment(C),this.emitInitSegment=!0},_.generateInitSegment=function(C){var T=this.audioCodec,b=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(U.parseInitSegment)(C);T||(T=L(d.audio,R.ElementaryStreamTypes.AUDIO)),b||(b=L(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:T+","+b,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:T,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:b,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},_.remux=function(C,T,b,d,o){var s=this.initPTS,u=this.lastEndDTS,S={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(G.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var f=T.samples;if(!f||!f.length)return S;var m={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(f),w=this.initData),!w||!w.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=D(w,f,u));var p=Object(U.getDuration)(f,w),h=u,c=p+h;Object(U.offsetStartDTS)(w,f,s),p>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!w.audio,a=!!w.video,v="";l&&(v+="audio"),a&&(v+="video");var g={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:l,hasVideo:a,nb:1,dropped:0};return S.audio=g.type==="audio"?g:void 0,S.video=g.type!=="audio"?g:void 0,S.text=d,S.id3=b,S.initSegment=m,S},E}(),D=function(_,M,C){return Object(U.getStartDTS)(_,M)-C};function L(E,_){var M=E==null?void 0:E.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||_===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=I},"./src/task-loop.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=U.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"CMCDVersion",function(){return G}),A.d(V,"CMCDObjectType",function(){return U}),A.d(V,"CMCDStreamingFormat",function(){return R}),A.d(V,"CMCDStreamType",function(){return B});var G=1,U;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(U||(U={}));var R;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(R||(R={}));var B;(function(I){I.VOD="v",I.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"HlsSkip",function(){return R}),A.d(V,"getSkipValue",function(){return B}),A.d(V,"HlsUrlParameters",function(){return I}),A.d(V,"Level",function(){return D});function G(L,E){for(var _=0;_<E.length;_++){var M=E[_];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(L,M.key,M)}}function U(L,E,_){return E&&G(L.prototype,E),_&&G(L,_),L}var R;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(R||(R={}));function B(L,E){var _=L.canSkipUntil,M=L.canSkipDateRanges,C=L.endSN,T=E!==void 0?E-C:0;return _&&T<_?M?R.v2:R.Yes:R.No}var I=function(){function L(_,M,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=M,this.skip=C}var E=L.prototype;return E.addDirectives=function(M){var C=new self.URL(M);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},L}(),D=function(){function L(E){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=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return U(L,[{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(_){var M=_%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),L}()},"./src/types/loader.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"PlaylistContextType",function(){return G}),A.d(V,"PlaylistLevelType",function(){return U});var G;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var U;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"ChunkMetadata",function(){return G});var G=function(B,I,D,L,E,_){L===void 0&&(L=0),E===void 0&&(E=-1),_===void 0&&(_=!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=B,this.sn=I,this.id=D,this.size=L,this.part=E,this.partial=_};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"AttrList",function(){return R});var G=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(D){typeof D=="string"&&(D=B.parseAttrList(D));for(var L in D)D.hasOwnProperty(L)&&(this[L]=D[L])}var I=B.prototype;return I.decimalInteger=function(L){var E=parseInt(this[L],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},I.hexadecimalInteger=function(L){if(this[L]){var E=(this[L]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var _=new Uint8Array(E.length/2),M=0;M<E.length/2;M++)_[M]=parseInt(E.slice(M*2,M*2+2),16);return _}else return null},I.hexadecimalIntegerAsNumber=function(L){var E=parseInt(this[L],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},I.decimalFloatingPoint=function(L){return parseFloat(this[L])},I.optionalFloat=function(L,E){var _=this[L];return _?parseFloat(_):E},I.enumeratedString=function(L){return this[L]},I.bool=function(L){return this[L]==="YES"},I.decimalResolution=function(L){var E=G.exec(this[L]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},B.parseAttrList=function(L){var E,_={},M='"';for(U.lastIndex=0;(E=U.exec(L))!==null;){var C=E[2];C.indexOf(M)===0&&C.lastIndexOf(M)===C.length-1&&(C=C.slice(1,-1)),_[E[1]]=C}return _},B}()},"./src/utils/binary-search.ts":function(ne,V,A){"use strict";A.r(V);var G={search:function(R,B){for(var I=0,D=R.length-1,L=null,E=null;I<=D;){L=(I+D)/2|0,E=R[L];var _=B(E);if(_>0)I=L+1;else if(_<0)D=L-1;else return E}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"BufferHelper",function(){return R});var G=A("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(D,L){try{if(D){for(var E=B.getBuffered(D),_=0;_<E.length;_++)if(L>=E.start(_)&&L<=E.end(_))return!0}}catch(M){}return!1},B.bufferInfo=function(D,L,E){try{if(D){var _=B.getBuffered(D),M=[],C;for(C=0;C<_.length;C++)M.push({start:_.start(C),end:_.end(C)});return this.bufferedInfo(M,L,E)}}catch(T){}return{len:0,start:L,end:L,nextStart:void 0}},B.bufferedInfo=function(D,L,E){L=Math.max(0,L),D.sort(function(m,w){var p=m.start-w.start;return p||w.end-m.end});var _=[];if(E)for(var M=0;M<D.length;M++){var C=_.length;if(C){var T=_[C-1].end;D[M].start-T<E?D[M].end>T&&(_[C-1].end=D[M].end):_.push(D[M])}else _.push(D[M])}else _=D;for(var b=0,d,o=L,s=L,u=0;u<_.length;u++){var S=_[u].start,f=_[u].end;if(L+E>=S&&L<f)o=S,s=f,b=s-L;else if(L+E<S){d=S;break}}return{len:b,start:o||0,end:s||0,nextStart:d}},B.getBuffered=function(D){try{return D.buffered}catch(L){return G.logger.log("failed to get media.buffered",L),U}},B}()},"./src/utils/cea-608-parser.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"Row",function(){return s}),A.d(V,"CaptionScreen",function(){return u});var G=A("./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},R=function(c){var l=c;return U.hasOwnProperty(c)&&(l=U[c]),String.fromCharCode(l)},B=15,I=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var T=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,v){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+v)},h}(),b=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,v,g,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=v||!1,this.background=g||"black",this.flash=y||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],g=0;g<v.length;g++){var y=v[g];a.hasOwnProperty(y)&&(this[y]=a[y])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,v,g,y,k){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,v,g,y,k)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<I;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var v=!0,g=0;g<I;g++)if(!this.chars[g].equals(a.chars[g])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<I;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<I;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var g=this.pos+1;g<v+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=R(a);if(this.pos>=I){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v<I;v++)this.chars[v].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],v=!0,g=0;g<I;g++){var y=this.chars[g].uchar;y!==" "&&(v=!1),a.push(y)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},h}(),u=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var v=!0,g=0;g<B;g++)if(!this.rows[g].equals(a.rows[g])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<B;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<B;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var g=0;g<B;g++)this.rows[g].clear();var y=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var F=k.rows[y].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[v-this.nrRollUpRows+W+1].copy(k.rows[y+W])}}this.currRow=v;var O=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,H=Math.max(P-1,0);O.setCursor(a.indent),a.color=O.chars[H].penState.foreground}var X={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(X)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],g="",y=-1,k=0;k<B;k++){var F=this.rows[k].getTextString();F&&(y=k+1,a?v.push("Row "+y+": '"+F+"'"):v.push(F.trim()))}return v.length>0&&(a?g="["+v.join(" | ")+"]":g=v.join(`
|
|
`)),g},c.getTextAndFormat=function(){return this.rows},h}(),S=function(){function h(l,a,v){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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(v),this.nonDisplayedMemory=new u(v),this.lastOutputScreen=new u(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var g=Math.floor(a/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=y[g]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),f=function(){function h(l,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new T;this.channels=[null,new S(l,a,g),new S(l+1,v,g)],this.cmdHistory=p(),this.logger=g}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var g,y,k,F=!1;this.logger.time=a;for(var j=0;j<v.length;j+=2){if(y=v[j]&127,k=v[j+1]&127,y===0&&k===0)continue;if(this.logger.log(C.DATA,"["+b([v[j],v[j+1]])+"] -> ("+b([y,k])+")"),g=this.parseCmd(y,k),g||(g=this.parseMidrow(y,k)),g||(g=this.parsePAC(y,k)),g||(g=this.parseBackgroundAttributes(y,k)),!g&&(F=this.parseChars(y,k),F)){var W=this.currentChannel;if(W&&W>0){var O=this.channels[W];O.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+b([y,k])+" orig: "+b([v[j],v[j+1]]))}},c.parseCmd=function(a,v){var g=this.cmdHistory,y=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,k=(a===23||a===31)&&v>=33&&v<=35;if(!(y||k))return!1;if(w(a,v,g))return m(null,null,g),this.logger.log(C.DEBUG,"Repeated command ("+b([a,v])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?v===32?j.ccRCL():v===33?j.ccBS():v===34?j.ccAOF():v===35?j.ccAON():v===36?j.ccDER():v===37?j.ccRU(2):v===38?j.ccRU(3):v===39?j.ccRU(4):v===40?j.ccFON():v===41?j.ccRDC():v===42?j.ccTR():v===43?j.ccRTD():v===44?j.ccEDM():v===45?j.ccCR():v===46?j.ccENM():v===47&&j.ccEOC():j.ccTO(v-32),m(a,v,g),this.currentChannel=F,!0},c.parseMidrow=function(a,v){var g=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[g];return y?(y.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+b([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var g,y=this.cmdHistory,k=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(k||F))return!1;if(w(a,v,y))return m(null,null,y),!0;var j=a<=23?1:2;v>=64&&v<=95?g=j===1?D[a]:E[a]:g=j===1?L[a]:_[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(g,v)),m(a,v,y),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,v){var g,y={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?g=v-96:g=v-64,y.underline=(g&1)===1,g<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((g-16)/2)*4,y},c.parseChars=function(a,v){var g,y=null,k=null;if(a>=25?(g=2,k=a-8):(g=1,k=a),k>=17&&k<=19){var F;k===17?F=v+80:k===18?F=v+112:F=v+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+g),y=[F]}else a>=32&&a<=127&&(y=v===0?[a]:[a,v]);if(y){var j=b(y);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),m(a,v,this.cmdHistory)}return y},c.parseBackgroundAttributes=function(a,v){var g=(a===16||a===24)&&v>=32&&v<=47,y=(a===23||a===31)&&v>=45&&v<=47;if(!(g||y))return!1;var k,F={};a===16||a===24?(k=Math.floor((v-32)/2),F.background=M[k],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),m(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=p()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var g=this.channels[v];g&&g.cueSplitAtTime(a)}},h}();function m(h,c,l){l.a=h,l.b=c}function w(h,c,l){return l.a===h&&l.b===c}function p(){return{a:null,b:null}}V.default=f},"./src/utils/codecs.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"isCodecType",function(){return U}),A.d(V,"isCodecSupportedInMp4",function(){return R});var G={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(B,I){var D=G[I];return!!D&&D[B.slice(0,4)]===!0}function R(B,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/utils/vttparser.ts"),U=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),B=/\s/,I={newCue:function(L,E,_,M){for(var C=[],T,b,d,o,s,u=self.VTTCue||self.TextTrackCue,S=0;S<M.rows.length;S++)if(T=M.rows[S],d=!0,o=0,s="",!T.isEmpty()){for(var f=0;f<T.chars.length;f++)B.test(T.chars[f].uchar)&&d?o++:(s+=T.chars[f].uchar,d=!1);T.cueStartTime=E,E===_&&(_+=1e-4),o>=16?o--:o++;var m=Object(G.fixLineBreaks)(s.trim()),w=Object(U.generateCueId)(E,_,m);(!L||!L.cues||!L.cues.getCueById(w))&&(b=new u(E,_,m),b.id=w,b.line=S+1,b.align="left",b.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(b))}return L&&C.length&&(C.sort(function(p,h){return p.line==="auto"||h.line==="auto"?0:p.line>8&&h.line>8?h.line-p.line:p.line-h.line}),C.forEach(function(p){return Object(R.addCueToTrack)(L,p)})),C}};V.default=I},"./src/utils/discontinuities.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"findFirstFragWithCC",function(){return B}),A.d(V,"shouldAlignOnDiscontinuities",function(){return I}),A.d(V,"findDiscontinuousReferenceFrag",function(){return D}),A.d(V,"adjustSlidingStart",function(){return E}),A.d(V,"alignStream",function(){return _}),A.d(V,"alignPDT",function(){return C}),A.d(V,"alignFragmentByPDTDelta",function(){return T}),A.d(V,"alignMediaPlaylistByPDT",function(){return b});var G=A("./src/polyfills/number.ts"),U=A("./src/utils/logger.ts"),R=A("./src/controller/level-helper.ts");function B(d,o){for(var s=null,u=0,S=d.length;u<S;u++){var f=d[u];if(f&&f.cc===o){s=f;break}}return s}function I(d,o,s){return!!(o.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function D(d,o){var s=d.fragments,u=o.fragments;if(!u.length||!s.length){U.logger.log("No fragments to align");return}var S=B(s,u[0].cc);if(!S||S&&!S.startPTS){U.logger.log("No frag in previous level to align on");return}return S}function L(d,o){if(d){var s=d.start+o;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function E(d,o){for(var s=o.fragments,u=0,S=s.length;u<S;u++)L(s[u],d);o.fragmentHint&&L(o.fragmentHint,d),o.alignedSliding=!0}function _(d,o,s){if(!o)return;M(d,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(R.adjustSliding)(o.details,s)}function M(d,o,s){if(I(d,s,o)){var u=D(s.details,o);u&&Object(G.isFiniteNumber)(u.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(u.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,S=(u-s)/1e3+o.fragments[0].start;S&&Object(G.isFiniteNumber)(S)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+S.toFixed(3)+" "+d.url+" "),E(S,d))}function T(d,o){var s=d.programDateTime;if(!s)return;var u=(s-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function b(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=o.fragments[0].start,S=s-u*1e3;d.fragments.forEach(function(f){T(f,S)}),d.fragmentHint&&T(d.fragmentHint,S),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/utils/ewma.ts"),U=function(){function R(I,D,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new G.default(I),this.fast_=new G.default(D)}var B=R.prototype;return B.update=function(D,L){var E=this.slow_,_=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new G.default(D,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new G.default(L,_.getEstimate(),_.getTotalWeight()))},B.sample=function(D,L){D=Math.max(D,this.minDelayMs_);var E=8*L,_=D/1e3,M=E/_;this.fast_.sample(_,M),this.slow_.sample(_,M)},B.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=U},"./src/utils/ewma.ts":function(ne,V,A){"use strict";A.r(V);var G=function(){function U(B,I,D){I===void 0&&(I=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=I,this.totalWeight_=D}var R=U.prototype;return R.sample=function(I,D){var L=Math.pow(this.alpha_,I);this.estimate_=D*(1-L)+L*this.estimate_,this.totalWeight_+=I},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},U}();V.default=G},"./src/utils/fetch-loader.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"fetchSupported",function(){return T});var G=A("./src/polyfills/number.ts"),U=A("./src/loader/load-stats.ts"),R=A("./src/demux/chunk-cache.ts");function B(u,S){u.prototype=Object.create(S.prototype),u.prototype.constructor=u,_(u,S)}function I(u){var S=typeof Map=="function"?new Map:void 0;return I=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(m))return S.get(m);S.set(m,w)}function w(){return D(m,arguments,M(this).constructor)}return w.prototype=Object.create(m.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),_(w,m)},I(u)}function D(u,S,f){return L()?D=Reflect.construct:D=function(w,p,h){var c=[null];c.push.apply(c,p);var l=Function.bind.apply(w,c),a=new l;return h&&_(a,h.prototype),a},D.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function E(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function _(u,S){return _=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},_(u,S)}function M(u){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},M(u)}function C(){return C=Object.assign||function(u){for(var S=1;S<arguments.length;S++){var f=arguments[S];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])}return u},C.apply(this,arguments)}function T(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var b=function(){function u(f){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=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var S=u.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(m,w,p){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(m,this.controller.signal),a=p.onProgress,v=m.responseType==="arraybuffer",g=v?"byteLength":"length";this.context=m,this.config=w,this.callbacks=p,this.request=this.fetchSetup(m,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),p.onTimeout(c,m,h.response)},w.timeout),self.fetch(this.request).then(function(y){if(h.response=h.loader=y,!y.ok){var k=y.status,F=y.statusText;throw new s(F||"fetch, bad network response",k,y)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(y.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(w.highWaterMark)?h.loadProgressively(y,c,m,w.highWaterMark,a):v?y.arrayBuffer():y.text()}).then(function(y){var k=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=y[g];var F={url:k.url,data:y};a&&!Object(G.isFiniteNumber)(w.highWaterMark)&&a(c,m,y,k),p.onSuccess(F,c,m,k)}).catch(function(y){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var k=y.code||0;p.onError({code:k,text:y.message},m,y.details)})},S.getCacheAge=function(){var m=null;if(this.response){var w=this.response.headers.get("age");m=w?parseFloat(w):null}return m},S.loadProgressively=function(m,w,p,h,c){h===void 0&&(h=0);var l=new R.default,a=m.body.getReader(),v=function g(){return a.read().then(function(y){if(y.done)return l.dataLength&&c(w,p,l.flush(),m),Promise.resolve(new ArrayBuffer(0));var k=y.value,F=k.length;return w.loaded+=F,F<h||l.dataLength?(l.push(k),l.dataLength>=h&&c(w,p,l.flush(),m)):c(w,p,k,m),g()}).catch(function(){return Promise.reject()})};return v()},u}();function d(u,S){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},u.headers))};return u.rangeEnd&&f.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),f}function o(u,S){return new self.Request(u.url,S)}var s=function(u){B(S,u);function S(f,m,w){var p;return p=u.call(this,f)||this,p.code=void 0,p.details=void 0,p.code=m,p.details=w,p}return S}(I(Error));V.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"IMSC1_CODEC",function(){return E}),A.d(V,"parseIMSC1",function(){return T});var G=A("./src/utils/mp4-tools.ts"),U=A("./src/utils/vttparser.ts"),R=A("./src/utils/vttcue.ts"),B=A("./src/demux/id3.ts"),I=A("./src/utils/timescale-conversion.ts"),D=A("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},L.apply(this,arguments)}var E="stpp.ttml.im1t",_=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function T(h,c,l,a,v){var g=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(g.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var y=g[0],k=Object(B.utf8ArrayToStr)(new Uint8Array(h,y.start,y.end-y.start)),F=Object(I.toTimescaleFromScale)(c,1,l);try{a(b(k,F))}catch(j){v(j)}}function b(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(g).reduce(function(O,P){return O[P]=v.getAttribute("ttp:"+P)||g[P],O},{}),k=v.getAttribute("xml:space")!=="preserve",F=o(d(v,"styling","style")),j=o(d(v,"layout","region")),W=d(v,"body","[begin]");return[].map.call(W,function(O){var P=s(O,k);if(!P||!O.hasAttribute("begin"))return null;var H=m(O.getAttribute("begin"),y),X=m(O.getAttribute("dur"),y),Z=m(O.getAttribute("end"),y);if(H===null)throw f(O);if(Z===null){if(X===null)throw f(O);Z=H+X}var re=new R.default(H-c,Z-c,P);re.id=Object(D.generateCueId)(re.startTime,re.endTime,re.text);var be=j[O.getAttribute("region")],fe=F[O.getAttribute("style")];re.position=10,re.size=80;var Te=u(be,fe),pe=Te.textAlign;if(pe){var ge=C[pe];ge&&(re.lineAlign=ge),re.align=pe}return L(re,Te),re}).filter(function(O){return O!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,v){var g;return a.nodeName==="br"&&v?l+`
|
|
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?s(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function u(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,g){var y=S(c,l,g)||S(h,l,g);return y&&(v[g]=y),v},{})}function S(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var l=Object(U.parseTimeStamp)(h);return l===null&&(_.test(h)?l=w(h,c):M.test(h)&&(l=p(h,c))),l}function w(h,c){var l=_.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function p(h,c){var l=M.exec(h),a=Number(l[1]),v=l[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"enableLogs",function(){return D}),A.d(V,"logger",function(){return L});var G=function(){},U={trace:G,debug:G,log:G,warn:G,info:G,error:G},R=U;function B(E){var _=self.console[E];return _?_.bind(self.console,"["+E+"] >"):G}function I(E){for(var _=arguments.length,M=new Array(_>1?_-1:0),C=1;C<_;C++)M[C-1]=arguments[C];M.forEach(function(T){R[T]=E[T]?E[T].bind(E):B(T)})}function D(E){if(self.console&&E===!0||typeof E=="object"){I(E,"debug","log","info","warn","error");try{R.log()}catch(_){R=U}}else R=U}var L=R},"./src/utils/mediakeys-helper.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"KeySystems",function(){return G}),A.d(V,"requestMediaKeySystemAccess",function(){return U});var G;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(G||(G={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"bin2str",function(){return I}),A.d(V,"readUint16",function(){return D}),A.d(V,"readUint32",function(){return L}),A.d(V,"writeUint32",function(){return E}),A.d(V,"findBox",function(){return _}),A.d(V,"parseSegmentIndex",function(){return M}),A.d(V,"parseInitSegment",function(){return C}),A.d(V,"getStartDTS",function(){return T}),A.d(V,"getDuration",function(){return b}),A.d(V,"computeRawDurationFromSamples",function(){return d}),A.d(V,"offsetStartDTS",function(){return o}),A.d(V,"segmentValidRange",function(){return s}),A.d(V,"appendUint8Array",function(){return u});var G=A("./src/utils/typed-array.ts"),U=A("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function I(S){return String.fromCharCode.apply(null,S)}function D(S,f){"data"in S&&(f+=S.start,S=S.data);var m=S[f]<<8|S[f+1];return m<0?65536+m:m}function L(S,f){"data"in S&&(f+=S.start,S=S.data);var m=S[f]<<24|S[f+1]<<16|S[f+2]<<8|S[f+3];return m<0?4294967296+m:m}function E(S,f,m){"data"in S&&(f+=S.start,S=S.data),S[f]=m>>24,S[f+1]=m>>16&255,S[f+2]=m>>8&255,S[f+3]=m&255}function _(S,f){var m=[];if(!f.length)return m;var w,p,h;"data"in S?(w=S.data,p=S.start,h=S.end):(w=S,p=0,h=w.byteLength);for(var c=p;c<h;){var l=L(w,c),a=I(w.subarray(c+4,c+8)),v=l>1?c+l:h;if(a===f[0])if(f.length===1)m.push({data:w,start:c+8,end:v});else{var g=_({data:w,start:c+8,end:v},f.slice(1));g.length&&B.apply(m,g)}c=v}return m}function M(S){var f=_(S,["moov"]),m=f[0],w=m?m.end:null,p=_(S,["sidx"]);if(!p||!p[0])return null;var h=[],c=p[0],l=c.data[0],a=l===0?8:16,v=L(c,a);a+=4;var g=0,y=0;l===0?a+=8:a+=16,a+=2;var k=c.end+y,F=D(c,a);a+=2;for(var j=0;j<F;j++){var W=a,O=L(c,W);W+=4;var P=O&2147483647,H=(O&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=L(c,W);W+=4,h.push({referenceSize:P,subsegmentDuration:X,info:{duration:X/v,start:k,end:k+P-1}}),k+=P,W+=4,a=W}return{earliestPresentationTime:g,timescale:v,version:l,referencesCount:F,references:h,moovEndOffset:w}}function C(S){for(var f=[],m=_(S,["moov","trak"]),w=0;w<m.length;w++){var p=m[w],h=_(p,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=L(h,l),v=_(p,["mdia","mdhd"])[0];if(v){c=v.data[v.start],l=c===0?12:20;var g=L(v,l),y=_(p,["mdia","hdlr"])[0];if(y){var k=I(y.data.subarray(y.start+8,y.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[k];if(F){var j=_(p,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=I(j.data.subarray(j.start+12,j.start+16))),f[a]={timescale:g,type:F},f[F]={timescale:g,id:a,codec:W}}}}}}var O=_(S,["moov","mvex","trex"]);return O.forEach(function(P){var H=L(P,4),X=f[H];X&&(X.default={duration:L(P,12),flags:L(P,20)})}),f}function T(S,f){return _(f,["moof","traf"]).reduce(function(m,w){var p=_(w,["tfdt"])[0],h=p.data[p.start],c=_(w,["tfhd"]).reduce(function(l,a){var v=L(a,4),g=S[v];if(g){var y=L(p,4);h===1&&(y*=Math.pow(2,32),y+=L(p,8));var k=g.timescale||9e4,F=y/k;if(isFinite(F)&&(l===null||F<l))return F}return l},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function b(S,f){for(var m=0,w=0,p=0,h=_(S,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=_(l,["tfhd"])[0],v=L(a,4),g=f[v];if(!g)continue;var y=g.default,k=L(a,0)|(y==null?void 0:y.flags),F=y==null?void 0:y.duration;k&8&&(k&2?F=L(a,12):F=L(a,8));for(var j=g.timescale||9e4,W=_(l,["trun"]),O=0;O<W.length;O++){if(F){var P=L(W[O],4);m=F*P}else m=d(W[O]);g.type===U.ElementaryStreamTypes.VIDEO?w+=m/j:g.type===U.ElementaryStreamTypes.AUDIO&&(p+=m/j)}}if(w===0&&p===0){var H=M(S);if(H!=null&&H.references)return H.references.reduce(function(X,Z){return X+Z.info.duration||0},0)}return w||p}function d(S){var f=L(S,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var w=0,p=L(S,4),h=0;h<p;h++){if(f&256){var c=L(S,m);w+=c,m+=4}f&512&&(m+=4),f&1024&&(m+=4),f&2048&&(m+=4)}return w}function o(S,f,m){_(f,["moof","traf"]).forEach(function(w){_(w,["tfhd"]).forEach(function(p){var h=L(p,4),c=S[h];if(!c)return;var l=c.timescale||9e4;_(w,["tfdt"]).forEach(function(a){var v=a.data[a.start],g=L(a,4);if(v===0)E(a,4,g-m*l);else{g*=Math.pow(2,32),g+=L(a,8),g-=m*l,g=Math.max(g,0);var y=Math.floor(g/(R+1)),k=Math.floor(g%(R+1));E(a,4,y),E(a,8,k)}})})})}function s(S){var f={valid:null,remainder:null},m=_(S,["moof"]);if(m){if(m.length<2)return f.remainder=S,f}else return f;var w=m[m.length-1];return f.valid=Object(G.sliceUint8)(S,0,w.start-8),f.remainder=Object(G.sliceUint8)(S,w.start-8),f}function u(S,f){var m=new Uint8Array(S.length+f.length);return m.set(S),m.set(f,S.length),m}},"./src/utils/output-filter.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function U(B,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=I}var R=U.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(I,D,L){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=D,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"sendAddTrackEvent",function(){return U}),A.d(V,"addCueToTrack",function(){return R}),A.d(V,"clearCurrentCues",function(){return B}),A.d(V,"removeCuesInRange",function(){return I}),A.d(V,"getCuesInRange",function(){return L});var G=A("./src/utils/logger.ts");function U(E,_){var M;try{M=new Event("addtrack")}catch(C){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=E,_.dispatchEvent(M)}function R(E,_){var M=E.mode;if(M==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(_.id))try{if(E.addCue(_),!E.cues.getCueById(_.id))throw new Error("addCue is failed for: "+_)}catch(T){G.logger.debug("[texttrack-utils]: "+T);var C=new self.TextTrackCue(_.startTime,_.endTime,_.text);C.id=_.id,E.addCue(C)}M==="disabled"&&(E.mode=M)}function B(E){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues)for(var M=E.cues.length;M--;)E.removeCue(E.cues[M]);_==="disabled"&&(E.mode=_)}function I(E,_,M){var C=E.mode;if(C==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var T=L(E.cues,_,M),b=0;b<T.length;b++)E.removeCue(T[b]);C==="disabled"&&(E.mode=C)}function D(E,_){if(_<E[0].startTime)return 0;var M=E.length-1;if(_>E[M].endTime)return-1;for(var C=0,T=M;C<=T;){var b=Math.floor((T+C)/2);if(_<E[b].startTime)T=b-1;else if(_>E[b].startTime&&C<M)C=b+1;else return b}return E[C].startTime-_<_-E[T].startTime?C:T}function L(E,_,M){var C=[],T=D(E,_);if(T>-1)for(var b=T,d=E.length;b<d;b++){var o=E[b];if(o.startTime>=_&&o.endTime<=M)C.push(o);else if(o.startTime>M)return C}return C}},"./src/utils/time-ranges.ts":function(ne,V,A){"use strict";A.r(V);var G={toString:function(R){for(var B="",I=R.length,D=0;D<I;D++)B+="["+R.start(D).toFixed(3)+","+R.end(D).toFixed(3)+"]";return B}};V.default=G},"./src/utils/timescale-conversion.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"toTimescaleFromBase",function(){return U}),A.d(V,"toTimescaleFromScale",function(){return R}),A.d(V,"toMsFromMpegTsClock",function(){return B}),A.d(V,"toMpegTsClockFromTimescale",function(){return I});var G=9e4;function U(D,L,E,_){E===void 0&&(E=1),_===void 0&&(_=!1);var M=D*L*E;return _?Math.round(M):M}function R(D,L,E,_){return E===void 0&&(E=1),_===void 0&&(_=!1),U(D,L,1/E,_)}function B(D,L){return L===void 0&&(L=!1),U(D,1e3,1/G,L)}function I(D,L){return L===void 0&&(L=1),U(D,G,1/L)}},"./src/utils/typed-array.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"sliceUint8",function(){return G});function G(U,R,B){return Uint8Array.prototype.slice?U.slice(R,B):new Uint8Array(Array.prototype.slice.call(U,R,B))}},"./src/utils/vttcue.ts":function(ne,V,A){"use strict";A.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],U=["start","middle","end","left","right"];function R(E,_){if(typeof _!="string")return!1;if(!Array.isArray(E))return!1;var M=_.toLowerCase();return~E.indexOf(M)?M:!1}function B(E){return R(G,E)}function I(E){return R(U,E)}function D(E){for(var _=arguments.length,M=new Array(_>1?_-1:0),C=1;C<_;C++)M[C-1]=arguments[C];for(var T=1;T<arguments.length;T++){var b=arguments[T];for(var d in b)E[d]=b[d]}return E}function L(E,_,M){var C=this,T={enumerable:!0};C.hasBeenReset=!1;var b="",d=!1,o=E,s=_,u=M,S=null,f="",m=!0,w="auto",p="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",D({},T,{get:function(){return b},set:function(g){b=""+g}})),Object.defineProperty(C,"pauseOnExit",D({},T,{get:function(){return d},set:function(g){d=!!g}})),Object.defineProperty(C,"startTime",D({},T,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",D({},T,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",D({},T,{get:function(){return u},set:function(g){u=""+g,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",D({},T,{get:function(){return S},set:function(g){S=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",D({},T,{get:function(){return f},set:function(g){var y=B(g);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",D({},T,{get:function(){return m},set:function(g){m=!!g,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",D({},T,{get:function(){return w},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",D({},T,{get:function(){return p},set:function(g){var y=I(g);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",D({},T,{get:function(){return h},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");h=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",D({},T,{get:function(){return c},set:function(g){var y=I(g);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");c=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",D({},T,{get:function(){return l},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",D({},T,{get:function(){return a},set:function(g){var y=I(g);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");a=y,this.hasBeenReset=!0}})),C.displayState=void 0}return L.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"parseTimeStamp",function(){return R}),A.d(V,"fixLineBreaks",function(){return _}),A.d(V,"VTTParser",function(){return M});var G=A("./src/utils/vttcue.ts"),U=function(){function C(){}var T=C.prototype;return T.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function T(d,o,s,u){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(u||0)}var b=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?T(b[2],b[3],0,b[4]):T(b[1],b[2],b[3],b[4]):null}var B=function(){function C(){this.values=Object.create(null)}var T=C.prototype;return T.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},T.get=function(d,o,s){return s?this.has(d)?this.values[d]:o[s]:this.has(d)?this.values[d]:o},T.has=function(d){return d in this.values},T.alt=function(d,o,s){for(var u=0;u<s.length;++u)if(o===s[u]){this.set(d,o);break}},T.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},T.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},C}();function I(C,T,b,d){var o=d?C.split(d):[C];for(var s in o){if(typeof o[s]!="string")continue;var u=o[s].split(b);if(u.length!==2)continue;var S=u[0],f=u[1];T(S,f)}}var D=new G.default(0,0,""),L=D.align==="middle"?"middle":"center";function E(C,T,b){var d=C;function o(){var S=R(C);if(S===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,f){var m=new B;I(S,function(h,c){var l;switch(h){case"region":for(var a=b.length-1;a>=0;a--)if(b[a].id===c){m.set(h,b[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),m.integer(h,l[0]),m.percent(h,l[0])&&m.set("snapToLines",!1),m.alt(h,l[0],["auto"]),l.length===2&&m.alt("lineAlign",l[1],["start",L,"end"]);break;case"position":l=c.split(","),m.percent(h,l[0]),l.length===2&&m.alt("positionAlign",l[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",L,"end","left","right"]);break}},/:/,/\s/),f.region=m.get("region",null),f.vertical=m.get("vertical","");var w=m.get("line","auto");w==="auto"&&D.line===-1&&(w=-1),f.line=w,f.lineAlign=m.get("lineAlign","start"),f.snapToLines=m.get("snapToLines",!0),f.size=m.get("size",100),f.align=m.get("align",L);var p=m.get("position","auto");p==="auto"&&D.position===50&&(p=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=p}function u(){C=C.replace(/^\s+/,"")}if(u(),T.startTime=o(),u(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),u(),T.endTime=o(),u(),s(C,T)}function _(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var M=function(){function C(){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 T=C.prototype;return T.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function s(){var p=o.buffer,h=0;for(p=_(p);h<p.length&&p[h]!=="\r"&&p[h]!==`
|
|
`;)++h;var c=p.substr(0,h);return p[h]==="\r"&&++h,p[h]===`
|
|
`&&++h,o.buffer=p.substr(h),c}function u(p){I(p,function(h,c){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=s();var f=S.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:S=s();switch(o.state){case"HEADER":/:/.test(S)?u(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(S,o.cue,o.regionList)}catch(p){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=S.indexOf("-->")!==-1;if(!S||w&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(p){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},T.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(ne,V,A){"use strict";A.r(V),A.d(V,"generateCueId",function(){return M}),A.d(V,"parseWebVTT",function(){return T});var G=A("./src/polyfills/number.ts"),U=A("./src/utils/vttparser.ts"),R=A("./src/demux/id3.ts"),B=A("./src/utils/timescale-conversion.ts"),I=A("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,L=function(d,o,s){return s===void 0&&(s=0),d.substr(s,o.length)===o},E=function(d){var o=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),S=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*u,o+=60*60*1e3*S,o},_=function(d){for(var o=5381,s=d.length;s;)o=o*33^d.charCodeAt(--s);return(o>>>0).toString()};function M(b,d,o){return _(b.toString())+_(d.toString())+_(o)}var C=function(d,o,s){var u=d[o],S=d[u.prevCC];if(!S||!S.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(f=S)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=u.start-S.start,u.new=!1,u=S,S=d[u.prevCC]}d.presentationOffset=s};function T(b,d,o,s,u,S,f,m){var w=new U.VTTParser,p=Object(R.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(D,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,v=0,g,y=!0,k=!1;w.oncue=function(F){var j=s[u],W=s.ccOffset,O=(a-c)/9e4;if(j!=null&&j.new&&(v!==void 0?W=s.ccOffset=j.start:C(s,u,O)),O&&(W=O-s.presentationOffset),k){var P=F.endTime-F.startTime,H=Object(I.normalizePts)((F.startTime+W-v)*9e4,S*9e4)/9e4;F.startTime=H,F.endTime=H+P}var X=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(X)),F.id||(F.id=M(F.startTime,F.endTime,X)),F.endTime>0&&h.push(F)},w.onparsingerror=function(F){g=F},w.onflush=function(){if(g){m(g);return}f(h)},p.forEach(function(F){if(y)if(L(F,"X-TIMESTAMP-MAP=")){y=!1,k=!0,F.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?l=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{v=E(l)/1e3}catch(j){k=!1,g=j}return}else F===""&&(y=!1);w.parse(F+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(ne,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),U=A("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function I(L){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=L?L.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var D=I.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},D.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(E,_,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=_,this.callbacks=M,this.retryDelay=_.retryDelay,this.loadInternal()},D.loadInternal=function(){var E=this.config,_=this.context;if(!E)return;var M=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var T=this.xhrSetup;try{if(T)try{T(M,_.url)}catch(o){M.open("GET",_.url,!0),T(M,_.url)}M.readyState||M.open("GET",_.url,!0);var b=this.context.headers;if(b)for(var d in b)M.setRequestHeader(d,b[d])}catch(o){this.callbacks.onError({code:M.status,text:o.message},_,M);return}_.rangeEnd&&M.setRequestHeader("Range","bytes="+_.rangeStart+"-"+(_.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=_.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),M.send()},D.readystatechange=function(){var E=this.context,_=this.loader,M=this.stats;if(!E||!_)return;var C=_.readyState,T=this.config;if(M.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),C===4){_.onreadystatechange=null,_.onprogress=null;var b=_.status;if(b>=200&&b<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var d,o;if(E.responseType==="arraybuffer"?(d=_.response,o=d.byteLength):(d=_.responseText,o=d.length),M.loaded=M.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(M,E,d,_),!this.callbacks)return;var u={url:_.responseURL,data:d};this.callbacks.onSuccess(u,M,E,_)}else M.retry>=T.maxRetry||b>=400&&b<499?(G.logger.error(b+" while loading "+E.url),this.callbacks.onError({code:b,text:_.statusText},E,_)):(G.logger.warn(b+" while loading "+E.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,T.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout)},D.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(E){var _=this.stats;_.loaded=E.loaded,E.lengthComputable&&(_.total=E.total)},D.getCacheAge=function(){var E=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var _=this.loader.getResponseHeader("age");E=_?parseFloat(_):null}return E},I}();V.default=B}}).default})},vHTk:function(ot,He,ee){ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(ot,He,ee){"use strict";ee.d(He,"c",function(){return U}),ee.d(He,"b",function(){return R}),ee.d(He,"d",function(){return B}),ee.d(He,"a",function(){return D}),ee.d(He,"e",function(){return L});var ne=ee("9og8"),V=ee("WmNS"),A=ee.n(V),G=ee("ErOA");function U(E){return Object(G.c)("libraries/".concat(E,".json"))}function R(){return Object(G.c)("library_tags.json")}function B(E){return I.apply(this,arguments)}function I(){return I=Object(ne.a)(A.a.mark(function E(_){var M;return A.a.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,Object(G.b)("attachments/".concat(_,".json"));case 2:return M=T.sent,T.abrupt("return",M.status===0);case 4:case"end":return T.stop()}},E)})),I.apply(this,arguments)}function D(E){return Object(G.f)("libraries.json",E)}function L(E,_){return Object(G.g)("libraries/".concat(E,".json"),_)}},y5JW:function(ot,He,ee){"use strict";ee.d(He,"c",function(){return b}),ee.d(He,"a",function(){return d});var ne=ee("DZo9"),V=ee("8z0m"),A=ee("+L6B"),G=ee("2/Rp"),U=ee("9og8"),R=ee("k1fw"),B=ee("oBTY"),I=ee("miYZ"),D=ee("tsqr"),L=ee("WmNS"),E=ee.n(L),_=ee("cDcd"),M=ee.n(_),C=ee("m3rI"),T=ee("wzkS"),b="\u3000\u3000";function d(o){var s=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,u)).toFixed(1)+" "+s[u]}He.b=function(o){var s=o.value,u=s===void 0?[]:s,S=o.action,f=o.onChange,m=o.className,w=o.maxSize,p=w===void 0?150:w,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,l=o.accept,a=l===void 0?null:l,v={multiple:!1,fileList:u,accept:a,withCredentials:!0,beforeUpload:function(k){var F=k.size/1024/1024;return F<p?!0:(D.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(p,"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(C.a.API_SERVER,"/api/attachments.json"),onChange:function(k){var F=Object(B.a)(k.fileList);F=F.map(function(j){return j.name.indexOf(b)===-1&&(j.name="".concat(j.name).concat(b).concat(d(j.size))),Object(R.a)({},j)}),f(F)},onRemove:function(){var y=Object(U.a)(E.a.mark(function F(j){var W,O,P;return E.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(W=j.size/1024/1024,!(j.status==="uploading")){X.next=3;break}return X.abrupt("return",!0);case 3:if(W<p){X.next=7;break}return X.abrupt("return",!0);case 7:if(O=j.response?j.response.id:j.uid,!O){X.next=15;break}return X.next=11,Object(T.d)(j.response?j.response.id:j.id);case 11:return P=X.sent,X.abrupt("return",P);case 15:return X.abrupt("return",!0);case 16:case"end":return X.stop()}},F)}));function k(F){return y.apply(this,arguments)}return k}()};function g(y){y.preventDefault(),y.stopPropagation()}return M.a.createElement("div",{className:"single-upload ".concat(m||"")},M.a.createElement(V.a,v,M.a.createElement(G.a,{type:"primary",title:u.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:u.length>0,ghost:!0},c),M.a.createElement("span",{onClick:g,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",p,"M) ")))}}}]);
|