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
748 KiB
144 lines
748 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[146,5,6,7],{"+NIl":function(ot,Ge,te){(function(ne){ne(te("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,l){return _(s,l,"\\]")}),"keyword";if(C.match("\\("))return L(T,function(s,l){return _(s,l,"\\)")}),"keyword";if(C.match("$$"))return L(T,function(s,l){return _(s,l,"$$")}),"keyword";if(C.match("$"))return L(T,function(s,l){return _(s,l,"$")}),"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,Ge,te){(function(ne){ne(te("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,Ge,te){(function(ne){ne(te("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,g){function p(F){return g.tokenize=F,F(a,g)}var v=a.next();if(v=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(T("atom","]]>")):null:a.match("--")?p(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=T("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",g.tokenize=M,"tag bracket");if(v=="&"){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,g){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return g.tokenize=_,L=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return L="equals",null;if(p=="<"){g.tokenize=_,g.state=l,g.tagName=g.tagStart=null;var v=g.tokenize(a,g);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(p)?(g.tokenize=C(p),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var g=function(p,v){for(;!p.eol();)if(p.next()==a){v.tokenize=M;break}return"string"};return g.isInAttribute=!0,g}function T(a,g){return function(p,v){for(;!p.eol();){if(p.match(g)){v.tokenize=_;break}p.next()}return a}}function b(a){return function(g,p){for(var v;(v=g.next())!=null;){if(v=="<")return p.tokenize=b(a+1),p.tokenize(g,p);if(v==">")if(a==1){p.tokenize=_;break}else return p.tokenize=b(a-1),p.tokenize(g,p)}return"meta"}}function d(a,g,p){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=p,(B.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,g){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!B.contextGrabbers.hasOwnProperty(p)||!B.contextGrabbers[p].hasOwnProperty(g))return;o(a)}}function l(a,g,p){return a=="openTag"?(p.tagStart=g.column(),S):a=="closeTag"?f:l}function S(a,g,p){return a=="word"?(p.tagName=g.current(),E="tag",y):B.allowMissingTagName&&a=="endTag"?(E="tag bracket",y(a,g,p)):(E="error",S)}function f(a,g,p){if(a=="word"){var v=g.current();return p.context&&p.context.tagName!=v&&B.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==v||B.matchClosing===!1?(E="tag",m):(E="tag error",w)}else return B.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,g,p)):(E="error",w)}function m(a,g,p){return a!="endTag"?(E="error",m):(o(p),l)}function w(a,g,p){return E="error",m(a,g,p)}function y(a,g,p){if(a=="word")return E="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var v=p.tagName,k=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(v)?s(p,v):(s(p,v),p.context=new d(p,v,k==p.indented)),l}return E="error",y}function h(a,g,p){return a=="equals"?c:(B.allowMissing||(E="error"),y(a,g,p))}function c(a,g,p){return a=="string"?u:a=="word"&&B.allowUnquoted?(E="string",y):(E="error",y(a,g,p))}function u(a,g,p){return a=="string"?u:y(a,g,p)}return{startState:function(a){var g={tokenize:_,state:l,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;L=null;var p=g.tokenize(a,g);return(p||L)&&p!="comment"&&(E=null,g.state=g.state(L||p,a,g),E&&(p=E=="error"?p+" error":E)),p},indent:function(a,g,p){var v=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(v&&v.noIndent)return ne.Pass;if(a.tokenize!=M&&a.tokenize!=_)return p?p.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(g))return 0;var k=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(k&&k[1])for(;v;)if(v.tagName==k[2]){v=v.prev;break}else if(B.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(k)for(;v;){var F=B.contextGrabbers[v.tagName];if(F&&F.hasOwnProperty(k[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.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=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],p=a.context;p;p=p.prev)p.tagName&&g.push(p.tagName);return g.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,Ge,te){"use strict";te.d(Ge,"a",function(){return f});var ne=te("+L6B"),V=te("2/Rp"),A=te("2qtc"),G=te("kLXV"),U=te("9og8"),R=te("k1fw"),B=te("miYZ"),I=te("tsqr"),D=te("oBTY"),L=te("tJVT"),E=te("DZo9"),_=te("8z0m"),M=te("WmNS"),C=te.n(M),T=te("cDcd"),b=te.n(T),d=te("m3rI"),o=te("wzkS"),s=te("y5JW"),l=te("LtfV"),S=_.a.Dragger;function f(m){var w=[];return m&&m.length>0&&(w=m.map(function(y){return{uid:y.id,id:y.id,name:y.title+s.c+y.filesize,url:y.url,filesize:y.filesize,status:"done",response:{id:y.id}}})),w}Ge.b=function(m){var w=m.value,y=m.onChange,h=m.action,c=m.className,u=m.maxSize,a=u===void 0?150:u,g=m.title,p=g===void 0?"\u4E0A\u4F20\u9644\u4EF6":g,v=m.showRemoveModal,k=v===void 0?!1:v,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,Ee=re===void 0?!0:re,fe=Object(T.useState)(!1),Te=Object(L.a)(fe,2),ge=Te[0],pe=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)&&pe(!0))},[w]);var q=function(){setTimeout(function(){J.pop(),oe(Object(D.a)(J))},500)},ye={multiple:!0,disabled:ge,accept:j,withCredentials:!0,fileList:J,beforeUpload:function(Ce,De){var Re=Ce.size/1024/1024;return J.concat(De).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)):Re<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(Ce){var De=Object(D.a)(Ce.fileList);De.length>=H?pe(!0):pe(!1),oe(Object(D.a)(De)),De=De.map(function(Re){var Me;if(Re!=null&&(Me=Re.response)!==null&&Me!==void 0&&Me.id){var Oe;Re.url="/api/attachments/".concat(Re==null||((Oe=Re.response)===null||Oe===void 0)?void 0:Oe.id)}return Re.name.indexOf(s.c)===-1&&(Re.name="".concat(Re.name).concat(s.c).concat(Object(s.a)(Re.size))),Object(R.a)({},Re)}),console.log("info:",Ce),y(De)},onRemove:function(){var me=Object(U.a)(C.a.mark(function De(Re){var Me;return C.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:if(Me=function(){var We=Object(U.a)(C.a.mark(function Ye(){var Xe,Be;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:if(Xe=Re.response?Re.response.id:Re.id,!Xe){He.next=8;break}return He.next=4,Object(o.d)(Re.response?Re.response.id:Re.uid);case 4:return Be=He.sent,He.abrupt("return",Be);case 8:return He.abrupt("return",!0);case 9:case"end":return He.stop()}},Ye)}));return function(){return We.apply(this,arguments)}}(),!k){Ae.next=5;break}return Ae.abrupt("return",new Promise(function(We,Ye){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 He;return C.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,Me();case 2:He=Se.sent,I.b.success("\u5220\u9664\u6210\u529F"),We(!0);case 5:case"end":return Se.stop()}},qe)}));function Be(){return Xe.apply(this,arguments)}return Be}(),onCancel:function(){return We(!1)}})}));case 5:return Ae.next=7,Me();case 7:return Ae.abrupt("return",Ae.sent);case 8:case"end":return Ae.stop()}},De)}));function Ce(De){return me.apply(this,arguments)}return Ce}()};function we(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(l.a,null)),b.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",b.a.createElement("br",null),b.a.createElement("span",{style:{display:Ee?"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:ge},p),b.a.createElement("span",{onClick:we,style:{marginLeft:10,color:"#FA6400",display:Ee?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB) ")))}},"55Ip":function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return s}),te.d(Ge,"b",function(){return y});var ne=te("Ty5D"),V=te("dI71"),A=te("cDcd"),G=te.n(A),U=te("YS25"),R=te("17x9"),B=te.n(R),I=te("wx14"),D=te("zLVn"),L=te("9R94"),E=function(c){Object(V.a)(u,c);function u(){for(var g,p=arguments.length,v=new Array(p),k=0;k<p;k++)v[k]=arguments[k];return g=c.call.apply(c,[this].concat(v))||this,g.history=Object(U.a)(g.props),g}var a=u.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},u}(G.a.Component),_=function(c){Object(V.a)(u,c);function u(){for(var g,p=arguments.length,v=new Array(p),k=0;k<p;k++)v[k]=arguments[k];return g=c.call.apply(c,[this].concat(v))||this,g.history=Object(U.b)(g.props),g}var a=u.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},u}(G.a.Component),M=function(u,a){return typeof u=="function"?u(a):u},C=function(u,a){return typeof u=="string"?Object(U.c)(u,null,null,a):u},T=function(u){return u},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,u){var a=c.innerRef,g=c.navigate,p=c.onClick,v=Object(D.a)(c,["innerRef","navigate","onClick"]),k=v.target,F=Object(I.a)({},v,{onClick:function(W){try{p&&p(W)}catch(O){throw W.preventDefault(),O}!W.defaultPrevented&&W.button===0&&(!k||k==="_self")&&!d(W)&&(W.preventDefault(),g())}});return T!==b?F.ref=u||a:F.ref=a,G.a.createElement("a",F)}),s=b(function(c,u){var a=c.component,g=a===void 0?o:a,p=c.replace,v=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(v,j.location),j.location),P=O?W.createHref(O):"",H=Object(I.a)({},F,{href:P,navigate:function(){var Z=M(v,j.location),re=p?W.replace:W.push;re(Z)}});return T!==b?H.ref=u||k:H.innerRef=k,G.a.createElement(g,H)})});if(!1)var l,S;var f=function(u){return u},m=G.a.forwardRef;typeof m=="undefined"&&(m=f);function w(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(g){return g}).join(" ")}var y=m(function(c,u){var a=c["aria-current"],g=a===void 0?"page":a,p=c.activeClassName,v=p===void 0?"active":p,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,Ee=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,ge=C(M(Z,Te),Te),pe=ge.pathname,ce=pe&&pe.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,v):F,q=J?Object(I.a)({},X,{},k):X,ye=Object(I.a)({"aria-current":J&&g||null,className:oe,style:q,to:ge},Ee);return f!==m?ye.ref=u||re:ye.innerRef=re,G.a.createElement(s,ye)})});if(!1)var h},"7/Dv":function(ot,Ge,te){ot.exports={bg:"bg___2rJyo",flexRow:"flexRow___2xuIa",flexJustifyCenter:"flexJustifyCenter___Z3bJt",flexAlignEnd:"flexAlignEnd___v7Ww-",flexAlignCenter:"flexAlignCenter___223DA",flexColumn:"flexColumn___3CNqR",formWrap:"formWrap___2b6uL",titleWrap:"titleWrap___1CMQA",fieldWrap:"fieldWrap___2BRrD",mdWrap:"mdWrap___3UYzt",backgroundFa:"backgroundFa___32wpj",button:"button___MHDAn"}},"7ahc":function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return S});var ne=te("k1fw"),V=te("0Owb"),A=te("+L6B"),G=te("2/Rp"),U=te("y8nQ"),R=te("Vl3Y"),B=te("tJVT"),I=te("OaEy"),D=te("2fM7"),L=te("cDcd"),E=te.n(L),_=te("VrN/"),M=te.n(_),C=te("p77/"),T=te.n(C),b=te("c5Ni"),d=te.n(b),o=D.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Ge.b=function(f){var m=f.callback,w=f.onCancel,y=Object(L.useState)("python"),h=Object(B.a)(y,2),c=h[0],u=h[1];function a(p){u(l[p][1])}function g(p){m(p)}return E.a.createElement(R.a,Object(V.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),E.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(D.a,{onChange:a},Object.keys(l).map(function(p){return E.a.createElement(o,{key:p,value:p},l[p][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,y=f.mode,h=f.options,c=h===void 0?{}:h,u=Object(L.useRef)(),a=Object(L.useState)(),g=Object(B.a)(a,2),p=g[0],v=g[1];return Object(L.useEffect)(function(){if(p){function k(F){var j=F.getValue();w&&w(j)}return p.on("change",k),function(){p.off("change",k)}}},[p,w]),Object(L.useEffect)(function(){p&&p.setOption("mode",y)},[p,y]),Object(L.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(L.useEffect)(function(){if(u.current&&!p){var k=M.a.fromTextArea(u.current,Object(ne.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(k)}},[u.current,p]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:u}))}},"8EBN":function(ot,Ge,te){(function(ne){ne(te("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,Ge,te){"use strict";var ne=te("k1fw"),V=te("tJVT"),A=te("cDcd"),G=te.n(A),U=te("vg9a"),R=te("DlQD"),B=te.n(R),I=te("rUJ1");function D(H,X){var Z=H.match(/^(\s+)(?:```)/);if(Z===null)return X;var re=Z[1];return X.split(`
|
|
`).map(function(Ee){var fe=Ee.match(/^\s+/);if(fe===null)return Ee;var Te=Object(V.a)(fe,1),ge=Te[0];return ge.length>=re.length?Ee.slice(re.length):Ee}).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 Ee=H[X];re.push("<li><a href='#"+Ee.anchor+"'>"+Ee.text+"</a>"),X++;var fe=[];return X=b(H,X,Ee.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],Ee=D(re,Z[3]||""),fe=Z[2]?Z[2].trim():Z[2];if(["latex","katex","math"].indexOf(fe)>=0){var Te=S(),ge=Ee;Ee=Te,f[Te]={type:"block",expression:ge}}return{type:"code",raw:re,lang:fe,text:Ee}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,S=function(){return"__special_katext_id_".concat(l++,"__")},f={};function m(){return f}function w(){l=0,f={}}function y(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(y(H))};var c=_.paragraph;_.paragraph=function(H){return c(y(H))};var u=_.tablecell;_.tablecell=function(H,X){return u(y(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,g=te("SJMd"),p=te("ulZh"),v=te.n(p),k=te("m3rI"),F=te("Oy/b"),j=te("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=Ge.a=function(H){var X=H.value,Z=X===void 0?"":X,re=H.className,Ee=H.showTextOnly,fe=H.showLines,Te=H.style,ge=Te===void 0?{}:Te,pe=H.stylesPrev,ce=pe===void 0?{}:pe,he=String(Z),J=Object(A.useState)(""),oe=Object(V.a)(J,2),q=oe[0],ye=oe[1],we=Object(A.useMemo)(function(){try{var Re=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Me=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Oe=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;he=he.replace(Re,"("+k.a.API_SERVER+"/api/attachments/").replace(Me,'"'+k.a.API_SERVER+"/api/attachments/").replace(Oe,'"'+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 Ae=a(he),We=m();if(he.match(/\[TOC\]/)&&(Ae=Ae.replace("<p>[TOC]</p>",d()),C()),Ae=Ae.replace(/(__special_katext_id_\d+__)/g,function(Xe,Be){var qe=We[Be],He=qe.type,Je=qe.expression;return Object(F.renderToString)(O(Je)||"",{displayMode:He==="block",throwOnError:!1,output:"html"})}),Ae=Ae.replace(/▁/g,"\u2581\u2581\u2581"),w(),Ee){var Ye=document.createElement("div");return Ye.innerHTML=Ae,Ye.innerText}return setTimeout(function(){return De()},500),Ae},[he]),me=Object(A.useRef)();T.WebkitLineClamp=fe,fe&&(ge=Object(ne.a)(Object(ne.a)({},ge),T));function Ce(Re){var Me=Re.target;if(Me.tagName.toUpperCase()==="A"){var Oe=Me.getAttribute("href");if(Oe.indexOf("office")>-1)Re.preventDefault(),ye(Oe);else if(Oe.startsWith("#")){Re.preventDefault();var Ae=document.getElementById(Oe.replace("#",""));Ae&&Ae.scrollIntoView(!0)}}}var De=function(){var Me,Oe=(Me=me.current)===null||Me===void 0?void 0:Me.querySelectorAll("video");Oe==null||Oe.forEach(function(Ae){if(Ae.oncontextmenu=function(){return!1},Ae.src.indexOf(".m3u8")>-1&&!Ae.canPlayType("application/vnd.apple.mpegurl")){if(v.a.isSupported()){var We=new v.a;We.loadSource(Ae.src),We.attachMedia(Ae)}}})};return Object(A.useEffect)(function(){if(me.current&&we&&(we.match(W)&&window.PR.prettyPrint()),me.current)return me.current.addEventListener("click",Ce),function(){me.current.removeEventListener("click",Ce),w(),C()}},[we,me.current,Ce]),G.a.createElement(G.a.Fragment,null,G.a.createElement("div",{ref:me,style:Object(ne.a)({},ge),className:"".concat(re||""," markdown-body "),dangerouslySetInnerHTML:{__html:we}}),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,Ge,te){"use strict";te.d(Ge,"a",function(){return A});var ne=te("cDcd"),V=te.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,Ge,te){"use strict";te.d(Ge,"a",function(){return R});var ne=te("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,Ge,te){(function(ne){ne(te("VrN/"),te("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 l=b.mode.configuration=="html",S=typeof _=="object"&&_.dontCloseTags||l&&V,f=typeof _=="object"&&_.indentTags||l&&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 y=f&&B(f,m)>-1;E[M]={indent:y,text:">"+(y?`
|
|
|
|
`:"")+"</"+s+">",newPos:y?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 u=D.listSelections().slice(0);u[M]={head:c.newPos,anchor:c.newPos},D.setSelections(u),!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),l=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(l);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,Ge,te){"use strict";te.d(Ge,"d",function(){return V}),te.d(Ge,"c",function(){return A}),te.d(Ge,"e",function(){return G}),te.d(Ge,"b",function(){return U}),te.d(Ge,"a",function(){return B});var ne=te("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,Ge,te){},CKgm:function(ot,Ge,te){"use strict";te.r(Ge);var ne=te("+L6B"),V=te("2/Rp"),A=te("5NDa"),G=te("5rEg"),U=te("sPJy"),R=te("bE4q"),B=te("miYZ"),I=te("tsqr"),D=te("9og8"),L=te("k1fw"),E=te("y8nQ"),_=te("Vl3Y"),M=te("tJVT"),C=te("PpiC"),T=te("OaEy"),b=te("2fM7"),d=te("WmNS"),o=te.n(d),s=te("cDcd"),l=te.n(s),S=te("Ty5D"),f=te("9kvl"),m=te("55Ip"),w=te("Ot1p"),y=te("500L"),h=te("h+Ho"),c=te("7/Dv"),u=te.n(c),a=b.a.Option,g=function(v){var k,F,j,W=v.forumsDetail,O=v.globalSetting,P=v.loading,H=v.dispatch,X=Object(C.a)(v,["forumsDetail","globalSetting","loading","dispatch"]),Z=Object(S.i)(),re=_.a.useForm(),Ee=Object(M.a)(re,1),fe=Ee[0],Te=Object(s.useState)({}),ge=Object(M.a)(Te,2),pe=ge[0],ce=ge[1],he=Object(s.useState)(0),J=Object(M.a)(he,2),oe=J[0],q=J[1],ye=Object(s.useState)(!1),we=Object(M.a)(ye,2),me=we[0],Ce=we[1],De=Object(s.useState)({}),Re=Object(M.a)(De,2),Me=Re[0],Oe=Re[1],Ae=Object(s.useState)(1),We=Object(M.a)(Ae,2),Ye=We[0],Xe=We[1];Object(s.useEffect)(function(){if(Be(),Z.memoId)Ce(!0),qe();else{Ce(!1);var Se={forum_id:5};ce(Object(L.a)({},Se)),fe.setFieldsValue(Object(L.a)({},Se))}},[Z.memoId]);var Be=function(){var Se=Object(D.a)(o.a.mark(function $e(){var Ke;return o.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return ke.next=2,Object(h.f)({});case 2:Ke=ke.sent,Oe(Ke||{});case 4:case"end":return ke.stop()}},$e)}));return function(){return Se.apply(this,arguments)}}(),qe=function(){var Se=Object(D.a)(o.a.mark(function $e(){var Ke,Le,ke;return o.a.wrap(function(ae){for(;;)switch(ae.prev=ae.next){case 0:return ae.next=2,Object(h.e)({id:Z.memoId});case 2:if(ae.t0=ae.sent,ae.t0){ae.next=5;break}ae.t0={};case 5:Le=ae.t0,ke={subject:Le.subject,content:Le.content,attachments:Object(y.a)(Le.attachments),forum_id:Le.forum_id,memo_tags:(Ke=Le.memo_tags)===null||Ke===void 0?void 0:Ke.map(function(ue){return ue.id})},ce(Object(L.a)({},ke)),fe.setFieldsValue(Object(L.a)({},ke));case 9:case"end":return ae.stop()}},$e)}));return function(){return Se.apply(this,arguments)}}(),He=function(){var Se=Object(D.a)(o.a.mark(function $e(Ke){var Le,ke,le,ae;return o.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:if(le=Object(L.a)(Object(L.a)({id:me?Z.memoId:null},pe),{},{attachment_ids:(Le=pe.attachments)===null||Le===void 0||((ke=Le.filter(function(Q){var ee;return(ee=Q.response)===null||ee===void 0?void 0:ee.id}))===null||ke===void 0)?void 0:ke.map(function(Q){var ee;return(ee=Q.response)===null||ee===void 0?void 0:ee.id}),tags:pe.memo_tags}),!me){$.next=7;break}return $.next=4,Object(h.n)(le);case 4:$.t0=$.sent,$.next=10;break;case 7:return $.next=9,Object(h.j)(le);case 9:$.t0=$.sent;case 10:ae=$.t0,q(0),(ae==null?void 0:ae.status)===0&&(I.b.success(ae==null?void 0:ae.message),Ye===1?f.d.push("/forums/".concat(me?Z==null?void 0:Z.memoId:ae==null?void 0:ae.memo_id)):f.d.push("/forums/".concat(me?Z==null?void 0:Z.memoId:ae==null?void 0:ae.memo_id,"/edit")));case 13:case"end":return $.stop()}},$e)}));return function(Ke){return Se.apply(this,arguments)}}(),Je=function(){document.body.scrollIntoView(),window.location.href.includes("new")?f.d.goBack():f.d.push("/forums/".concat(Z.memoId))};return l.a.createElement("section",{className:u.a.bg},l.a.createElement("section",{className:"animated fadeIn mb10"},l.a.createElement("aside",{className:"mt10"},l.a.createElement(R.a,{separator:"/"},l.a.createElement(R.a.Item,null,l.a.createElement(m.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),l.a.createElement(R.a.Item,null,"\u8BE6\u60C5")))),l.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},me?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),l.a.createElement(_.a,{form:fe,className:u.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function($e,Ke){console.log(Ke,"values"),ce(Object(L.a)(Object(L.a)({},pe),$e))},onFinish:He,onFinishFailed:function(){q(0)}},l.a.createElement("div",{className:u.a.fieldWrap},l.a.createElement(_.a.Item,{name:"subject",label:l.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u540D\u79F0: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u540D\u79F0"}]},l.a.createElement(G.a,{maxLength:50,suffix:"".concat(((k=pe.subject)===null||k===void 0?void 0:k.length)||0,"/50")}))),l.a.createElement("div",{className:u.a.mdWrap},l.a.createElement(_.a.Item,{name:"content",label:l.a.createElement("span",{className:"font16"},"\u5185\u5BB9: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u5185\u5BB9"}]},l.a.createElement(w.a,{height:600,id:"forums-new-content",watch:!0,defaultValue:pe.content})),l.a.createElement("div",null,l.a.createElement(_.a.Item,{name:"attachments",style:{width:350}},l.a.createElement(y.b,{showRemoveModal:!0})))),l.a.createElement("div",{className:u.a.mdWrap},l.a.createElement(_.a.Item,{name:"forum_id",label:l.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u7C7B\u578B: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u8BDD\u9898\u7C7B\u578B"}]},l.a.createElement(b.a,{style:{width:300}},Me==null||((F=Me.forums)===null||F===void 0)?void 0:F.map(function(Se){return l.a.createElement(a,{key:Se.id,value:Se.id},Se.name)})))),pe.forum_id===5&&l.a.createElement("div",{className:u.a.mdWrap},l.a.createElement(_.a.Item,{name:"memo_tags",label:l.a.createElement("span",{className:"font16"},"\u6280\u672F\u6807\u7B7E: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u6280\u672F\u6807\u7B7E"}]},l.a.createElement(b.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function($e,Ke){return Ke.props.children.toLocaleLowerCase().indexOf($e.toLocaleLowerCase())!=-1}},Me==null||((j=Me.tag_list)===null||j===void 0)?void 0:j.map(function(Se){return l.a.createElement(a,{key:Se.id,value:Se.id},Se.name)})))),l.a.createElement("div",{className:u.a.backgroundFa},l.a.createElement("div",{className:"pt40 mb30"},l.a.createElement(_.a.Item,null,l.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(u.a.button," mr20"),htmlType:"submit",loading:oe===1,onClick:function(){Xe(1),q(1)}},"\u63D0\u4EA4"),l.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(u.a.button," mr20"),htmlType:"submit",loading:oe===2,onClick:function(){Xe(2),q(2)}},"\u4FDD\u5B58"),l.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:"".concat(u.a.button," mr20"),onClick:Je},"\u53D6\u6D88"))))))};Ge.default=Object(f.a)(function(p){var v=p.forumsDetail,k=p.loading,F=p.globalSetting;return{forumsDetail:v,globalSetting:F,loading:k.models.forumsDetail}})(g)},DlQD:function(ot,Ge,te){(function(ne,V){ot.exports=V()})(this,function(){"use strict";function ne(le,ae){for(var ue=0;ue<ae.length;ue++){var $=ae[ue];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(le,$.key,$)}}function V(le,ae,ue){return ae&&ne(le.prototype,ae),ue&&ne(le,ue),le}function A(le,ae){if(!le)return;if(typeof le=="string")return G(le,ae);var ue=Object.prototype.toString.call(le).slice(8,-1);if(ue==="Object"&&le.constructor&&(ue=le.constructor.name),ue==="Map"||ue==="Set")return Array.from(le);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return G(le,ae)}function G(le,ae){(ae==null||ae>le.length)&&(ae=le.length);for(var ue=0,$=new Array(ae);ue<ae;ue++)$[ue]=le[ue];return $}function U(le,ae){var ue;if(typeof Symbol=="undefined"||le[Symbol.iterator]==null){if(Array.isArray(le)||(ue=A(le))||ae&&le&&typeof le.length=="number"){ue&&(le=ue);var $=0;return function(){return $>=le.length?{done:!0}:{done:!1,value:le[$++]}}}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=le[Symbol.iterator](),ue.next.bind(ue)}function R(le,ae){return ae={exports:{}},le(ae,ae.exports),ae.exports}var B=R(function(le){function ae(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ue($){le.exports.defaults=$}le.exports={defaults:ae(),getDefaults:ae,changeDefaults:ue}}),I=B.defaults,D=B.getDefaults,L=B.changeDefaults,E=/[&<>"']/,_=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(ae){return T[ae]};function d(le,ae){if(ae){if(E.test(le))return le.replace(_,b)}else if(M.test(le))return le.replace(C,b);return le}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(le){return le.replace(o,function(ae,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 l=/(^|[^\[])\^/g;function S(le,ae){le=le.source||le,ae=ae||"";var ue={replace:function(Q,ee){return ee=ee.source||ee,ee=ee.replace(l,"$1"),le=le.replace(Q,ee),ue},getRegex:function(){return new RegExp(le,ae)}};return ue}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(le,ae,ue){if(le){var $;try{$=decodeURIComponent(s(ue)).replace(f,"").toLowerCase()}catch(Q){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}ae&&!m.test(ue)&&(ue=a(ae,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(Q){return null}return ue}var y={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(le,ae){y[" "+le]||(h.test(le)?y[" "+le]=le+"/":y[" "+le]=k(le,"/",!0)),le=y[" "+le];var ue=le.indexOf(":")===-1;return ae.substring(0,2)==="//"?ue?ae:le.replace(c,"$1")+ae:ae.charAt(0)==="/"?ue?ae:le.replace(u,"$1")+ae:le+ae}var g={exec:function(){}};function p(le){for(var ae=1,ue,$;ae<arguments.length;ae++){ue=arguments[ae];for($ in ue)Object.prototype.hasOwnProperty.call(ue,$)&&(le[$]=ue[$])}return le}function v(le,ae){var ue=le.replace(/\|/g,function(ee,ie,be){for(var _e=!1,Ue=ie;--Ue>=0&&be[Ue]==="\\";)_e=!_e;return _e?"|":" |"}),$=ue.split(/ \|/),Q=0;if($.length>ae)$.splice(ae);else for(;$.length<ae;)$.push("");for(;Q<$.length;Q++)$[Q]=$[Q].trim().replace(/\\\|/g,"|");return $}function k(le,ae,ue){var $=le.length;if($===0)return"";for(var Q=0;Q<$;){var ee=le.charAt($-Q-1);if(ee===ae&&!ue)Q++;else if(ee!==ae&&ue)Q++;else break}return le.substr(0,$-Q)}function F(le,ae){if(le.indexOf(ae[1])===-1)return-1;for(var ue=le.length,$=0,Q=0;Q<ue;Q++)if(le[Q]==="\\")Q++;else if(le[Q]===ae[0])$++;else if(le[Q]===ae[1]&&($--,$<0))return Q;return-1}function j(le){le&&le.sanitize&&!le.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:g,merge:p,splitCells:v,rtrim:k,findClosingBracket:F,checkSanitizeDeprecation:j},O=B.defaults,P=W.rtrim,H=W.splitCells,X=W.escape,Z=W.findClosingBracket;function re(le,ae,ue){var $=ae.href,Q=ae.title?X(ae.title):null,ee=le[1].replace(/\\([\[\]])/g,"$1");return le[0].charAt(0)!=="!"?{type:"link",raw:ue,href:$,title:Q,text:ee}:{type:"image",raw:ue,href:$,title:Q,text:X(ee)}}function Ee(le,ae){var ue=le.match(/^(\s+)(?:```)/);if(ue===null)return ae;var $=ue[1];return ae.split(`
|
|
`).map(function(Q){var ee=Q.match(/^\s+/);if(ee===null)return Q;var ie=ee[0];return ie.length>=$.length?Q.slice($.length):Q}).join(`
|
|
`)}var fe=function(){function le(ue){this.options=ue||O}var ae=le.prototype;return ae.space=function($){var Q=this.rules.block.newline.exec($);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},ae.code=function($,Q){var ee=this.rules.block.code.exec($);if(ee){var ie=Q[Q.length-1];if(ie&&ie.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var be=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?be:P(be,`
|
|
`)}}},ae.fences=function($){var Q=this.rules.block.fences.exec($);if(Q){var ee=Q[0],ie=Ee(ee,Q[3]||"");return{type:"code",raw:ee,lang:Q[2]?Q[2].trim():Q[2],text:ie}}},ae.heading=function($){var Q=this.rules.block.heading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},ae.nptable=function($){var Q=this.rules.block.nptable.exec($);if(Q){var ee={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(ee.header.length===ee.align.length){var ie=ee.align.length,be;for(be=0;be<ie;be++)/^ *-+: *$/.test(ee.align[be])?ee.align[be]="right":/^ *:-+: *$/.test(ee.align[be])?ee.align[be]="center":/^ *:-+ *$/.test(ee.align[be])?ee.align[be]="left":ee.align[be]=null;for(ie=ee.cells.length,be=0;be<ie;be++)ee.cells[be]=H(ee.cells[be],ee.header.length);return ee}}},ae.hr=function($){var Q=this.rules.block.hr.exec($);if(Q)return{type:"hr",raw:Q[0]}},ae.blockquote=function($){var Q=this.rules.block.blockquote.exec($);if(Q){var ee=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:ee}}},ae.list=function($){var Q=this.rules.block.list.exec($);if(Q){for(var ee=Q[0],ie=Q[2],be=ie.length>1,_e=ie[ie.length-1]===")",Ue={type:"list",raw:ee,ordered:be,start:be?+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],ee=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],(be?mt.length===1||!_e&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==ie)&&(st=tt.slice(pt+1).join(`
|
|
`),Ue.raw=Ue.raw.substring(0,Ue.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&&(Ue.loose=!0),yt=/^\[[ xX]\] /.test(it),Yt=void 0,yt&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),Ue.items.push({type:"list_item",raw:ee,task:yt,checked:Yt,loose:It,text:it});return Ue}},ae.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]}},ae.def=function($){var Q=this.rules.block.def.exec($);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var ee=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:ee,raw:Q[0],href:Q[2],title:Q[3]}}},ae.table=function($){var Q=this.rules.block.table.exec($);if(Q){var ee={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ee.header.length===ee.align.length){ee.raw=Q[0];var ie=ee.align.length,be;for(be=0;be<ie;be++)/^ *-+: *$/.test(ee.align[be])?ee.align[be]="right":/^ *:-+: *$/.test(ee.align[be])?ee.align[be]="center":/^ *:-+ *$/.test(ee.align[be])?ee.align[be]="left":ee.align[be]=null;for(ie=ee.cells.length,be=0;be<ie;be++)ee.cells[be]=H(ee.cells[be].replace(/^ *\| *| *\| *$/g,""),ee.header.length);return ee}}},ae.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]}},ae.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]}},ae.text=function($,Q){var ee=this.rules.block.text.exec($);if(ee){var ie=Q[Q.length-1];return ie&&ie.type==="text"?{raw:ee[0],text:ee[0]}:{type:"text",raw:ee[0],text:ee[0]}}},ae.escape=function($){var Q=this.rules.inline.escape.exec($);if(Q)return{type:"escape",raw:Q[0],text:X(Q[1])}},ae.tag=function($,Q,ee){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),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(ie[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ie[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:ie[0],inLink:Q,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):X(ie[0]):ie[0]}},ae.link=function($){var Q=this.rules.inline.link.exec($);if(Q){var ee=Z(Q[2],"()");if(ee>-1){var ie=Q[0].indexOf("!")===0?5:4,be=ie+Q[1].length+ee;Q[2]=Q[2].substring(0,ee),Q[0]=Q[0].substring(0,be).trim(),Q[3]=""}var _e=Q[2],Ue="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(_e);tt?(_e=tt[1],Ue=tt[3]):Ue=""}else Ue=Q[3]?Q[3].slice(1,-1):"";_e=_e.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=re(Q,{href:_e&&_e.replace(this.rules.inline._escapes,"$1"),title:Ue&&Ue.replace(this.rules.inline._escapes,"$1")},Q[0]);return dt}},ae.reflink=function($,Q){var ee;if((ee=this.rules.inline.reflink.exec($))||(ee=this.rules.inline.nolink.exec($))){var ie=(ee[2]||ee[1]).replace(/\s+/g," ");if(ie=Q[ie.toLowerCase()],!ie||!ie.href){var be=ee[0].charAt(0);return{type:"text",raw:be,text:be}}var _e=re(ee,ie,ee[0]);return _e}},ae.strong=function($,Q,ee){ee===void 0&&(ee="");var ie=this.rules.inline.strong.start.exec($);if(ie&&(!ie[1]||ie[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*$.length);var be=ie[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var _e;(ie=be.exec(Q))!=null;)if(_e=this.rules.inline.strong.middle.exec(Q.slice(0,ie.index+3)),_e)return{type:"strong",raw:$.slice(0,_e[0].length),text:$.slice(2,_e[0].length-2)}}},ae.em=function($,Q,ee){ee===void 0&&(ee="");var ie=this.rules.inline.em.start.exec($);if(ie&&(!ie[1]||ie[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*$.length);var be=ie[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var _e;(ie=be.exec(Q))!=null;)if(_e=this.rules.inline.em.middle.exec(Q.slice(0,ie.index+2)),_e)return{type:"em",raw:$.slice(0,_e[0].length),text:$.slice(1,_e[0].length-1)}}},ae.codespan=function($){var Q=this.rules.inline.code.exec($);if(Q){var ee=Q[2].replace(/\n/g," "),ie=/[^ ]/.test(ee),be=ee.startsWith(" ")&&ee.endsWith(" ");return ie&&be&&(ee=ee.substring(1,ee.length-1)),ee=X(ee,!0),{type:"codespan",raw:Q[0],text:ee}}},ae.br=function($){var Q=this.rules.inline.br.exec($);if(Q)return{type:"br",raw:Q[0]}},ae.del=function($){var Q=this.rules.inline.del.exec($);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},ae.autolink=function($,Q){var ee=this.rules.inline.autolink.exec($);if(ee){var ie,be;return ee[2]==="@"?(ie=X(this.options.mangle?Q(ee[1]):ee[1]),be="mailto:"+ie):(ie=X(ee[1]),be=ie),{type:"link",raw:ee[0],text:ie,href:be,tokens:[{type:"text",raw:ie,text:ie}]}}},ae.url=function($,Q){var ee;if(ee=this.rules.inline.url.exec($)){var ie,be;if(ee[2]==="@")ie=X(this.options.mangle?Q(ee[0]):ee[0]),be="mailto:"+ie;else{var _e;do _e=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(_e!==ee[0]);ie=X(ee[0]),ee[1]==="www."?be="http://"+ie:be=ie}return{type:"link",raw:ee[0],text:ie,href:be,tokens:[{type:"text",raw:ie,text:ie}]}}},ae.inlineText=function($,Q,ee){var ie=this.rules.inline.text.exec($);if(ie){var be;return Q?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):X(ie[0]):ie[0]:be=X(this.options.smartypants?ee(ie[0]):ie[0]),{type:"text",raw:ie[0],text:be}}},le}(),Te=W.noopTest,ge=W.edit,pe=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=ge(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=ge(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=ge(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=ge(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=ge(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=ge(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=pe({},ce),ce.gfm=pe({},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=ge(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=ge(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=pe({},ce.normal,{html:ge(`^ *(?: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:ge(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=ge(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=ge(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=ge(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=ge(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=ge(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=ge(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=ge(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=ge(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=ge(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=ge(he._blockSkip,"g").getRegex(),he.overlapSkip=ge(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=ge(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=ge(he.tag).replace("comment",ce._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=ge(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=ge(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=ge(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=pe({},he),he.pedantic=pe({},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:ge(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=pe({},he.normal,{escape:ge(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=ge(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=pe({},he.gfm,{br:ge(he.br).replace("{2,}","*").getRegex(),text:ge(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 we(le){return le.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(le){var ae="",ue,$,Q=le.length;for(ue=0;ue<Q;ue++)$=le.charCodeAt(ue),Math.random()>.5&&($="x"+$.toString(16)),ae+="&#"+$+";";return ae}var Ce=function(){function le(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=$}le.lex=function($,Q){var ee=new le(Q);return ee.lex($)};var ae=le.prototype;return ae.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function($,Q,ee){Q===void 0&&(Q=[]),ee===void 0&&(ee=!0),$=$.replace(/^ +$/gm,"");for(var ie,be,_e,Ue;$;){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):(Ue=Q[Q.length-1],Ue.raw+=`
|
|
`+ie.raw,Ue.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,[],ee),Q.push(ie);continue}if(ie=this.tokenizer.list($)){for($=$.substring(ie.raw.length),_e=ie.items.length,be=0;be<_e;be++)ie.items[be].tokens=this.blockTokens(ie.items[be].text,[],!1);Q.push(ie);continue}if(ie=this.tokenizer.html($)){$=$.substring(ie.raw.length),Q.push(ie);continue}if(ee&&(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(ee&&(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):(Ue=Q[Q.length-1],Ue.raw+=`
|
|
`+ie.raw,Ue.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},ae.inline=function($){var Q,ee,ie,be,_e,Ue,tt=$.length;for(Q=0;Q<tt;Q++){Ue=$[Q];switch(Ue.type){case"paragraph":case"text":case"heading":{Ue.tokens=[],this.inlineTokens(Ue.text,Ue.tokens);break}case"table":{for(Ue.tokens={header:[],cells:[]},be=Ue.header.length,ee=0;ee<be;ee++)Ue.tokens.header[ee]=[],this.inlineTokens(Ue.header[ee],Ue.tokens.header[ee]);for(be=Ue.cells.length,ee=0;ee<be;ee++)for(_e=Ue.cells[ee],Ue.tokens.cells[ee]=[],ie=0;ie<_e.length;ie++)Ue.tokens.cells[ee][ie]=[],this.inlineTokens(_e[ie],Ue.tokens.cells[ee][ie]);break}case"blockquote":{this.inline(Ue.tokens);break}case"list":{for(be=Ue.items.length,ee=0;ee<be;ee++)this.inline(Ue.items[ee].tokens);break}}}return $},ae.inlineTokens=function($,Q,ee,ie,be){Q===void 0&&(Q=[]),ee===void 0&&(ee=!1),ie===void 0&&(ie=!1),be===void 0&&(be="");var _e,Ue=$,tt;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Ue))!=null;)dt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Ue=Ue.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Ue.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Ue))!=null;)Ue=Ue.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Ue.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(_e=this.tokenizer.escape($)){$=$.substring(_e.raw.length),Q.push(_e);continue}if(_e=this.tokenizer.tag($,ee,ie)){$=$.substring(_e.raw.length),ee=_e.inLink,ie=_e.inRawBlock,Q.push(_e);continue}if(_e=this.tokenizer.link($)){$=$.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,ie)),Q.push(_e);continue}if(_e=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,ie)),Q.push(_e);continue}if(_e=this.tokenizer.strong($,Ue,be)){$=$.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ee,ie),Q.push(_e);continue}if(_e=this.tokenizer.em($,Ue,be)){$=$.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ee,ie),Q.push(_e);continue}if(_e=this.tokenizer.codespan($)){$=$.substring(_e.raw.length),Q.push(_e);continue}if(_e=this.tokenizer.br($)){$=$.substring(_e.raw.length),Q.push(_e);continue}if(_e=this.tokenizer.del($)){$=$.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],ee,ie),Q.push(_e);continue}if(_e=this.tokenizer.autolink($,me)){$=$.substring(_e.raw.length),Q.push(_e);continue}if(!ee&&(_e=this.tokenizer.url($,me))){$=$.substring(_e.raw.length),Q.push(_e);continue}if(_e=this.tokenizer.inlineText($,ie,we)){$=$.substring(_e.raw.length),be=_e.raw.slice(-1),Q.push(_e);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(le,null,[{key:"rules",get:function(){return{block:q,inline:ye}}}]),le}(),De=B.defaults,Re=W.cleanUrl,Me=W.escape,Oe=function(){function le(ue){this.options=ue||De}var ae=le.prototype;return ae.code=function($,Q,ee){var ie=(Q||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight($,ie);be!=null&&be!==$&&(ee=!0,$=be)}return ie?'<pre><code class="'+this.options.langPrefix+Me(ie,!0)+'">'+(ee?$:Me($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ee?$:Me($,!0))+`</code></pre>
|
|
`},ae.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},ae.html=function($){return $},ae.heading=function($,Q,ee,ie){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+ie.slug(ee)+'">'+$+"</h"+Q+`>
|
|
`:"<h"+Q+">"+$+"</h"+Q+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function($,Q,ee){var ie=Q?"ol":"ul",be=Q&&ee!==1?' start="'+ee+'"':"";return"<"+ie+be+`>
|
|
`+$+"</"+ie+`>
|
|
`},ae.listitem=function($){return"<li>"+$+`</li>
|
|
`},ae.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function($){return"<p>"+$+`</p>
|
|
`},ae.table=function($,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+Q+`</table>
|
|
`},ae.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},ae.tablecell=function($,Q){var ee=Q.header?"th":"td",ie=Q.align?"<"+ee+' align="'+Q.align+'">':"<"+ee+">";return ie+$+"</"+ee+`>
|
|
`},ae.strong=function($){return"<strong>"+$+"</strong>"},ae.em=function($){return"<em>"+$+"</em>"},ae.codespan=function($){return"<code>"+$+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function($){return"<del>"+$+"</del>"},ae.link=function($,Q,ee){if($=Re(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var ie='<a href="'+Me($)+'"';return Q&&(ie+=' title="'+Q+'"'),ie+=">"+ee+"</a>",ie},ae.image=function($,Q,ee){if($=Re(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var ie='<img src="'+$+'" alt="'+ee+'"';return Q&&(ie+=' title="'+Q+'"'),ie+=this.options.xhtml?"/>":">",ie},ae.text=function($){return $},le}(),Ae=function(){function le(){}var ae=le.prototype;return ae.strong=function($){return $},ae.em=function($){return $},ae.codespan=function($){return $},ae.del=function($){return $},ae.html=function($){return $},ae.text=function($){return $},ae.link=function($,Q,ee){return""+ee},ae.image=function($,Q,ee){return""+ee},ae.br=function(){return""},le}(),We=function(){function le(){this.seen={}}var ae=le.prototype;return ae.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 ee=Q;do this.seen[ee]++,Q=ee+"-"+this.seen[ee];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},le}(),Ye=B.defaults,Xe=W.unescape,Be=function(){function le(ue){this.options=ue||Ye,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new We}le.parse=function($,Q){var ee=new le(Q);return ee.parse($)};var ae=le.prototype;return ae.parse=function($,Q){Q===void 0&&(Q=!0);var ee="",ie,be,_e,Ue,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":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Xe(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Lt="",it="",Ue=st.header.length,be=0;be<Ue;be++)it+=this.renderer.tablecell(this.parseInline(st.tokens.header[be]),{header:!0,align:st.align[be]});for(Lt+=this.renderer.tablerow(it),mt="",Ue=st.cells.length,be=0;be<Ue;be++){for(dt=st.tokens.cells[be],it="",tt=dt.length,_e=0;_e<tt;_e++)it+=this.renderer.tablecell(this.parseInline(dt[_e]),{header:!1,align:st.align[_e]});mt+=this.renderer.tablerow(it)}ee+=this.renderer.table(Lt,mt);continue}case"blockquote":{mt=this.parse(st.tokens),ee+=this.renderer.blockquote(mt);continue}case"list":{for(It=st.ordered,yt=st.start,Yt=st.loose,Ue=st.items.length,mt="",be=0;be<Ue;be++)pt=st.items[be],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);ee+=this.renderer.list(mt,It,yt);continue}case"html":{ee+=this.renderer.html(st.text);continue}case"paragraph":{ee+=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);ee+=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 ee},ae.parseInline=function($,Q){Q=Q||this.renderer;var ee="",ie,be,_e=$.length;for(ie=0;ie<_e;ie++){be=$[ie];switch(be.type){case"escape":{ee+=Q.text(be.text);break}case"html":{ee+=Q.html(be.text);break}case"link":{ee+=Q.link(be.href,be.title,this.parseInline(be.tokens,Q));break}case"image":{ee+=Q.image(be.href,be.title,be.text);break}case"strong":{ee+=Q.strong(this.parseInline(be.tokens,Q));break}case"em":{ee+=Q.em(this.parseInline(be.tokens,Q));break}case"codespan":{ee+=Q.codespan(be.text);break}case"br":{ee+=Q.br();break}case"del":{ee+=Q.del(this.parseInline(be.tokens,Q));break}case"text":{ee+=Q.text(be.text);break}default:{var Ue='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Ue);return}else throw new Error(Ue)}}}return ee},le}(),qe=W.merge,He=W.checkSanitizeDeprecation,Je=W.escape,Se=B.getDefaults,$e=B.changeDefaults,Ke=B.defaults;function Le(le,ae,ue){if(typeof le=="undefined"||le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(le)+", string expected");if(typeof ae=="function"&&(ue=ae,ae=null),ae=qe({},Le.defaults,ae||{}),He(ae),ue){var $=ae.highlight,Q;try{Q=Ce.lex(le,ae)}catch(_e){return ue(_e)}var ee=function(Ue){var tt;if(!Ue)try{tt=Be.parse(Q,ae)}catch(dt){Ue=dt}return ae.highlight=$,Ue?ue(Ue):ue(null,tt)};if(!$||$.length<3)return ee();if(delete ae.highlight,!Q.length)return ee();var ie=0;Le.walkTokens(Q,function(_e){_e.type==="code"&&(ie++,setTimeout(function(){$(_e.text,_e.lang,function(Ue,tt){if(Ue)return ee(Ue);tt!=null&&tt!==_e.text&&(_e.text=tt,_e.escaped=!0),ie--,ie===0&&ee()})},0))}),ie===0&&ee();return}try{var be=Ce.lex(le,ae);return ae.walkTokens&&Le.walkTokens(be,ae.walkTokens),Be.parse(be,ae)}catch(_e){if(_e.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Je(_e.message+"",!0)+"</pre>";throw _e}}Le.options=Le.setOptions=function(le){return qe(Le.defaults,le),$e(Le.defaults),Le},Le.getDefaults=Se,Le.defaults=Ke,Le.use=function(le){var ae=qe({},le);if(le.renderer&&function(){var $=Le.defaults.renderer||new Oe,Q=function(be){var _e=$[be];$[be]=function(){for(var Ue=arguments.length,tt=new Array(Ue),dt=0;dt<Ue;dt++)tt[dt]=arguments[dt];var it=le.renderer[be].apply($,tt);return it===!1&&(it=_e.apply($,tt)),it}};for(var ee in le.renderer)Q(ee);ae.renderer=$}(),le.tokenizer&&function(){var $=Le.defaults.tokenizer||new fe,Q=function(be){var _e=$[be];$[be]=function(){for(var Ue=arguments.length,tt=new Array(Ue),dt=0;dt<Ue;dt++)tt[dt]=arguments[dt];var it=le.tokenizer[be].apply($,tt);return it===!1&&(it=_e.apply($,tt)),it}};for(var ee in le.tokenizer)Q(ee);ae.tokenizer=$}(),le.walkTokens){var ue=Le.defaults.walkTokens;ae.walkTokens=function($){le.walkTokens($),ue&&ue($)}}Le.setOptions(ae)},Le.walkTokens=function(le,ae){for(var ue=U(le),$;!($=ue()).done;){var Q=$.value;ae(Q);switch(Q.type){case"table":{for(var ee=U(Q.tokens.header),ie;!(ie=ee()).done;){var be=ie.value;Le.walkTokens(be,ae)}for(var _e=U(Q.tokens.cells),Ue;!(Ue=_e()).done;)for(var tt=Ue.value,dt=U(tt),it;!(it=dt()).done;){var Lt=it.value;Le.walkTokens(Lt,ae)}break}case"list":{Le.walkTokens(Q.items,ae);break}default:Q.tokens&&Le.walkTokens(Q.tokens,ae)}}},Le.Parser=Be,Le.parser=Be.parse,Le.Renderer=Oe,Le.TextRenderer=Ae,Le.Lexer=Ce,Le.lexer=Ce.lex,Le.Tokenizer=fe,Le.Slugger=We,Le.parse=Le;var ke=Le;return ke})},ELLl:function(ot,Ge,te){(function(ne){ne(te("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 l=M(T,o[s].head);if(!l||d.indexOf(l)%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 l=M(T,o[s].head);if(!l||d.indexOf(l)%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 l=G(d,"closeBefore"),S=G(d,"triples"),f=o.charAt(s+1)==b,m=T.listSelections(),w=s%2==0,y,h=0;h<m.length;h++){var c=m[h],u=c.head,a,g=T.getRange(u,A(u.line,u.ch+1));if(w&&!c.empty())a="surround";else if((f||!w)&&g==b)f&&C(T,u)?a="both":S.indexOf(b)>=0&&T.getRange(u,A(u.line,u.ch+3))==b+b+b?a="skipThree":a="skip";else if(f&&u.ch>1&&S.indexOf(b)>=0&&T.getRange(A(u.line,u.ch-2),u)==b+b){if(u.ch>2&&/\bstring/.test(T.getTokenTypeAt(A(u.line,u.ch-2))))return ne.Pass;a="addFour"}else if(f){var p=u.ch==0?" ":T.getRange(A(u.line,u.ch-1),u);if(!ne.isWordChar(g)&&p!=b&&!ne.isWordChar(p))a="both";else return ne.Pass}else if(w&&(g.length===0||/\s/.test(g)||l.indexOf(g)>-1))a="both";else return ne.Pass;if(!y)y=a;else if(y!=a)return ne.Pass}var v=s%2?o.charAt(s-1):b,k=s%2?b:o.charAt(s+1);T.operation(function(){if(y=="skip")T.execCommand("goCharRight");else if(y=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(y=="surround"){for(var j=T.getSelections(),F=0;F<j.length;F++)j[F]=v+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 y=="both"?(T.replaceSelection(v+k,null),T.triggerElectric(v+k),T.execCommand("goCharLeft")):y=="addFour"&&(T.replaceSelection(v+v+v+v,"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,Ge,te){"use strict";var ne=te("cDcd"),V=te.n(ne),A=te("TSYQ"),G=te.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 Ee=re.trim();return Ee.charAt(0)==="."?E(H.toLowerCase(),Ee.toLowerCase()):/\/\*$/.test(Ee)?Z===Ee.replace(/\/.*$/,""):X===Ee})}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 Ee=!re.length;Ee?O(H):X()})}X()}var C=function(O,P,H){var X=function Z(re,Ee){Ee=Ee||"",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,""+Ee+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 Ee=O[Symbol.iterator](),fe;!(X=(fe=Ee.next()).done)&&!(H.push(fe.value),P&&H.length===P);X=!0);}catch(Te){Z=!0,re=Te}finally{try{!X&&Ee.return&&Ee.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 l(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},{})},y=function(W){m(O,W);function O(){var P,H,X,Z;S(this,O);for(var re=arguments.length,Ee=Array(re),fe=0;fe<re;fe++)Ee[fe]=arguments[fe];return Z=(H=(X=f(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(Ee))),X),X.state={uid:L()},X.reqs={},X.onChange=function(Te){var ge=Te.target.files;X.uploadFiles(ge),X.reset()},X.onClick=function(Te){var ge=X.fileInput;if(!ge)return;var pe=X.props,ce=pe.children,he=pe.onClick;ce&&ce.type==="button"&&(ge.parentNode.focus(),ge.parentNode.querySelector("button").blur()),ge.click(),he&&he(Te)},X.onKeyDown=function(Te){Te.key==="Enter"&&X.onClick()},X.onFileDrop=function(Te){var ge=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 pe=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(ce){return _(ce,X.props.accept)});ge===!1&&(pe=pe.slice(0,1)),X.uploadFiles(pe)}},X.uploadFiles=function(Te){var ge=Array.prototype.slice.call(Te);ge.map(function(pe){return pe.uid=L(),pe}).forEach(function(pe){X.upload(pe,ge)})},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 Ee=re.beforeUpload(H,X);Ee&&Ee.then?Ee.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)}):Ee!==!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,Ee=Z.onProgress,fe=Z.transformFile,Te=fe===void 0?function(ge){return ge}:fe;new Promise(function(ge){var pe=Z.action;return typeof pe=="function"&&(pe=pe(H)),ge(pe)}).then(function(ge){var pe=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],we={action:ge,filename:Z.name,data:ye,file:q,headers:Z.headers,withCredentials:Z.withCredentials,method:Z.method||"post",onProgress:Ee?function(me){Ee(me,H)}:null,onSuccess:function(Ce,De){delete X.reqs[pe],Z.onSuccess(Ce,H,De)},onError:function(Ce,De){delete X.reqs[pe],Z.onError(Ce,De,H)}};re(H),X.reqs[pe]=ce(we)})})}},{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,Ee=X.className,fe=X.disabled,Te=X.id,ge=X.style,pe=X.multiple,ce=X.accept,he=X.children,J=X.directory,oe=X.openFileDialogOnClick,q=X.onMouseEnter,ye=X.onMouseLeave,we=l(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,Ee,Ee),H)),Ce=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({},Ce,{className:me,role:"button",style:ge}),V.a.createElement("input",b({},w(we),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(Re){return Re.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ce,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:pe,onChange:this.onChange})),he)}}]),O}(ne.Component),h=y,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},u=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 g(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 p(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 v(){}var k=function(W){p(O,W);function O(){var P,H,X,Z;a(this,O);for(var re=arguments.length,Ee=Array(re),fe=0;fe<re;fe++)Ee[fe]=arguments[fe];return Z=(H=(X=g(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(Ee))),X),X.saveUploader=function(Te){X.uploader=Te},H),g(X,Z)}return u(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:v,onError:v,onSuccess:v,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=k,j=Ge.a=F},HmJG:function(ot,Ge,te){},LdHM:function(ot,Ge,te){"use strict";te.d(Ge,"b",function(){return l}),te.d(Ge,"a",function(){return f});var ne=te("1OyB"),V=te("vuIU"),A=te("Ji7U"),G=te("LK+K"),U=te("cDcd"),R=te("rePB"),B=te("Ff2n"),I=te("ODXe"),D=te("4IlW"),L=te("bX4T"),E=te("YrtM"),_=te("TSYQ"),M=te.n(_),C=te("+nKL"),T=te("8OUc"),b=function(H,X){var Z=H.prefixCls,re=H.id,Ee=H.flattenOptions,fe=H.childrenAsData,Te=H.values,ge=H.searchValue,pe=H.multiple,ce=H.defaultActiveFirstOption,he=H.height,J=H.itemHeight,oe=H.notFoundContent,q=H.open,ye=H.menuItemSelectedIcon,we=H.virtual,me=H.onSelect,Ce=H.onToggleOpen,De=H.onActiveValue,Re=H.onScroll,Me=H.onMouseEnter,Oe="".concat(Z,"-item"),Ae=Object(E.a)(function(){return Ee},[q,Ee],function(ke,le){return le[0]&&ke[1]!==le[1]}),We=U.useRef(null),Ye=function(le){le.preventDefault()},Xe=function(le){We.current&&We.current.scrollTo({index:le})},Be=function(le){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Ae.length,$=0;$<ue;$+=1){var Q=(le+$*ae+ue)%ue,ee=Ae[Q],ie=ee.group,be=ee.data;if(!ie&&!be.disabled)return Q}return-1},qe=U.useState(function(){return Be(0)}),He=Object(I.a)(qe,2),Je=He[0],Se=He[1],$e=function(le){Se(le);var ae=Ae[le];if(!ae){De(null,-1);return}De(ae.data.value,le)};U.useEffect(function(){$e(ce!==!1?Be(0):-1)},[Ae.length,ge]),U.useEffect(function(){var ke=setTimeout(function(){if(!pe&&q&&Te.size===1){var le=Array.from(Te)[0],ae=Ae.findIndex(function(ue){var $=ue.data;return $.value===le});$e(ae),Xe(ae)}});return function(){return clearTimeout(ke)}},[q]);var Ke=function(le){le!==void 0&&me(le,{selected:!Te.has(le)}),pe||Ce(!1)};if(U.useImperativeHandle(X,function(){return{onKeyDown:function(le){var ae=le.which;switch(ae){case D.a.UP:case D.a.DOWN:{var ue=0;if(ae===D.a.UP?ue=-1:ae===D.a.DOWN&&(ue=1),ue!==0){var $=Be(Je+ue,ue);Xe($),$e($)}break}case D.a.ENTER:{var Q=Ae[Je];Q&&!Q.data.disabled?Ke(Q.data.value):Ke(void 0),q&&le.preventDefault();break}case D.a.ESC:Ce(!1)}},onKeyUp:function(){},scrollTo:function(le){Xe(le)}}}),Ae.length===0)return U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),className:"".concat(Oe,"-empty"),onMouseDown:Ye},oe);function Le(ke){var le=Ae[ke];if(!le)return null;var ae=le.data||{},ue=ae.value,$=ae.label,Q=ae.children,ee=Object(L.a)(ae,!0),ie=fe?Q:$;return le?U.createElement("div",Object.assign({"aria-label":typeof ie=="string"?ie:null},ee,{key:ke,role:"option",id:"".concat(re,"_list_").concat(ke),"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"}},Le(Je-1),Le(Je),Le(Je+1)),U.createElement(C.a,{itemKey:"key",ref:We,data:Ae,height:he,itemHeight:J,fullHeight:!1,onMouseDown:Ye,onScroll:Re,virtual:we,onMouseEnter:Me},function(ke,le){var ae,ue=ke.group,$=ke.groupOption,Q=ke.data,ee=Q.label,ie=Q.key;if(ue)return U.createElement("div",{className:M()(Oe,"".concat(Oe,"-group"))},ee!==void 0?ee:ie);var be=Q.disabled,_e=Q.value,Ue=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(_e),st="".concat(Oe,"-option"),It=M()(Oe,st,it,(ae={},Object(R.a)(ae,"".concat(st,"-grouped"),$),Object(R.a)(ae,"".concat(st,"-active"),Je===le&&!be),Object(R.a)(ae,"".concat(st,"-disabled"),be),Object(R.a)(ae,"".concat(st,"-selected"),mt),ae)),yt=fe?tt:ee,Yt=!ye||typeof ye=="function"||mt;return U.createElement("div",Object.assign({},Lt,{"aria-selected":mt,className:It,title:Ue,onMouseMove:function(){if(Je===le||be)return;$e(le)},onClick:function(){be||Ke(_e)},style:dt}),U.createElement("div",{className:"".concat(st,"-content")},yt||_e),U.isValidElement(ye)||mt,Yt&&U.createElement(T.a,{className:"".concat(Oe,"-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 l=s,S=function(){return null};S.isSelectOptGroup=!0;var f=S,m=te("VTBJ"),w=te("Zm9Q");function y(P){var H=P.key,X=P.props,Z=X.children,re=X.value,Ee=Object(B.a)(X,["children","value"]);return Object(m.a)({key:H,value:re!==void 0?re:H,children:Z},Ee)}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,Ee=X.key,fe=X.props,Te=fe.children,ge=Object(B.a)(fe,["children"]);return H||!re?y(X):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?Z:Ee,"__"),label:Ee},ge),{},{options:h(Te)})}).filter(function(X){return X})}var c=te("2Qr1"),u=te("qNPg"),a=te("U8pU"),g=te("Kwbf"),p=te("WKfj");function v(P){var H=P.mode,X=P.options,Z=P.children,re=P.backfill,Ee=P.allowClear,fe=P.placeholder,Te=P.getInputElement,ge=P.showSearch,pe=P.onSearch,ce=P.defaultOpen,he=P.autoFocus,J=P.labelInValue,oe=P.value,q=P.inputValue,ye=P.optionLabelProp,we=H==="multiple"||H==="tags",me=ge!==void 0?ge:we||H==="combobox",Ce=X||h(Z);if(Object(g.a)(H!=="tags"||Ce.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var De=Ce.some(function(Oe){return Oe.options?Oe.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(g.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(H!=="combobox"||!ye,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(H==="combobox"||!re,"`backfill` only works with `combobox` mode."),Object(g.a)(H==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(g.b)(H!=="combobox"||!Te||!Ee||!fe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!me&&H!=="combobox"&&H!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.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 Re=Object(p.d)(oe);Object(g.a)(!J||Re.every(function(Oe){return Object(a.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!we||Array.isArray(oe),"`value` should be array when `mode` is `multiple` or `tags`")}if(Z){var Me=null;Object(w.a)(Z).some(function(Oe){if(!U.isValidElement(Oe)||!Oe.type)return!1;var Ae=Oe.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var We=Object(w.a)(Oe.props.children).every(function(Ye){return!U.isValidElement(Ye)||!Oe.type||Ye.type.isSelectOption?!0:(Me=Ye.type,!1)});return!We}return Me=Ae,!0}),Me&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Me.displayName||Me.name||Me,"`.")),Object(g.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=v,F=Object(u.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=l,j.OptGroup=f;var W=j,O=Ge.c=W},M8RZ:function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return D});var ne=te("fWQN"),V=te("mtLc"),A=te("yKVA"),G=te("879j"),U=te("cDcd"),R=te.n(U),B=te("faye"),I=te.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,Ge,te){"use strict";var ne=te("2qtc"),V=te("kLXV"),A=te("rAM+"),G=te("miYZ"),U=te("tsqr"),R=te("tJVT"),B=te("jrin"),I=te("cDcd"),D=te.n(I),L=te("VrN/"),E=te.n(L),_=te("bdgK"),M=te("p77/"),C=te("Bd2K"),T=te("ELLl"),b=te("19Vz"),d=te("lZu9"),o=te("+NIl"),s=te("kSUc"),l=te("9Bee"),S=function(le){var ae=le.value,ue=ae===void 0?"":ae,$=le.className,Q=le.showTextOnly,ee=le.showLines,ie=le.style,be=ie===void 0?{}:ie,_e=Object(I.useMemo)(function(){return""},[ue]);return D.a.createElement(D.a.Fragment,null,D.a.createElement("div",{dangerouslySetInnerHTML:{__html:_e}}))},f=te("0Owb"),m=te("dejd"),w=te("C+DQ"),y=[{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(le){var ae=le.onActionCallback,ue=le.title,$=le.icon,Q=le.actionName,ee=le.className,ie=ee===void 0?"":ee,be=le.children;function _e(){ae(Q)}return D.a.createElement("a",{title:ue,className:ie,onClick:_e},D.a.createElement("i",{className:"md-iconfont ".concat($)}),be)}var c=function(le){var ae=le.watch,ue=le.showNullButton,$=le.onActionCallback,Q=le.fullScreen,ee=le.insertTemp,ie=le.hidetoolBar,be=[].concat(y,[{title:"".concat(ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return D.a.createElement("ul",{className:"markdown-toolbar-container"},!ie&&be.map(function(_e,Ue){return D.a.createElement("li",{key:Ue},_e.actionName?D.a.createElement(h,Object(f.a)({},_e,{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,ee&&D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ee),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:$})))},u=te("M8RZ"),a=te("+L6B"),g=te("2/Rp"),p=te("y8nQ"),v=te("Vl3Y"),k=te("5NDa"),F=te("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},W=function(le){var ae=le.callback,ue=le.onCancel;function $(Q){ae(Q)}return D.a.createElement(v.a,Object(f.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$}),D.a.createElement(v.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(v.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(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},O=te("7ahc"),P=te("HmJG"),H=te("BjJ7"),X=v.a.useForm,Z={width:280,marginRight:10},re={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(le){var ae=le.callback,ue=le.onCancel,$=X(),Q=Object(R.a)($,1),ee=Q[0];function ie(Ue){ae(Ue)}function be(Ue,tt){ee.setFieldsValue({src:"/api/attachments/".concat(Ue.id),type:tt.type})}function _e(Ue){var tt=Ue.target.files[0];Te(tt,be)}return D.a.createElement(v.a,Object(f.a)({form:ee},re,{className:"upload-image-panel",onFinish:ie}),D.a.createElement(v.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},D.a.createElement("div",{className:"flex-container"},D.a.createElement(v.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:_e}))),D.a.createElement(v.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(v.a.Item,{style:{textAlign:"right"}},D.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))};function fe(le){var ae=le.onFileChange;return D.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",D.a.createElement("input",{type:"file",onChange:ae}))}function Te(le,ae){if(!le)throw new String("\u6CA1\u6709\u6587\u4EF6");var ue=new FormData;ue.append("editormd-image-file",le),ue.append("file_param_name","editormd-image-file"),ue.append("byxhr","true");var $=new window.XMLHttpRequest;$.withCredentials=!0,$.addEventListener("load",function(Q){ae(JSON.parse(Q.target.responseText),le)},!1),$.addEventListener("error",function(Q){console.error(Q)},!1),$.open("POST","".concat(H.a,"/api/attachments.json")),$.send(ue)}var ge=te("giR+"),pe=te("fyUT"),ce=te("7Kak"),he=te("9yH6"),J=he.a.Group,oe={margin:"0 8px"},q=function(le){var ae=le.callback,ue=le.onCancel;function $(Q){ae(Q)}return D.a.createElement(v.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(v.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},D.a.createElement(pe.a,null)),D.a.createElement("span",{style:oe},"\u5217\u6570"),D.a.createElement(v.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},D.a.createElement(pe.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(v.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(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},ye=te("m3rI"),we="link",me="upload-image",Ce="code-block",De="add-table",Re="------------",Me={default:Re,left:":".concat(Re),center:":".concat(Re,":"),right:"".concat(Re,":")},Oe=te("9VGf"),Ae,We;function Ye(){}var Xe=0,Be=1e4,qe="\u2581",He=`
|
|
**\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 Je(le){return/^\d+$/.test(le)?"".concat(le,"px"):le}var Se=navigator.platform.toUpperCase().indexOf("MAC")>=0,$e=Se?"Cmd":"Ctrl",Ke=(Ae={},Object(B.a)(Ae,$e+"-B","bold"),Object(B.a)(Ae,$e+"-I","italic"),Ae),Le=(We={},Object(B.a)(We,we,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(We,Ce,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(We,me,"\u6DFB\u52A0\u56FE\u7247"),Object(B.a)(We,De,"\u6DFB\u52A0\u8868\u683C"),We),ke=Ge.a=function(le){var ae=le.defaultValue,ue=ae===void 0?"":ae,$=le.onChange,Q=le.width,ee=Q===void 0?"100%":Q,ie=le.height,be=ie===void 0?400:ie,_e=le.miniToolbar,Ue=_e===void 0?!1:_e,tt=le.isFocus,dt=tt===void 0?!1:tt,it=le.watch,Lt=le.insertTemp,mt=le.mode,st=mt===void 0?"markdown":mt,It=le.id,yt=It===void 0?"markdown-editor-id":It,Yt=le.showResizeBar,Wt=Yt===void 0?!1:Yt,pt=le.noStorage,Tr=pt===void 0?!1:pt,zr=le.showNullButton,lr=zr===void 0?!1:zr,Sr=le.hidetoolBar,hr=Sr===void 0?!1:Sr,yi=le.fullScreen,ur=yi===void 0?!1:yi,Vr=le.onBlur,cn=le.onCMBeforeChange,Ct=le.onFullScreen,et=le.className,wr=et===void 0?"":et,fn=le.disablePaste,dr=fn===void 0?!1:fn,gt=le.placeholder,Cr=gt===void 0?"":gt,Rr=le.values,Xr=Rr===void 0?"":Rr,Fe=Object(I.useState)(null),ut=Object(R.a)(Fe,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)(be),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:!Ue,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(Ke);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(Oe.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(He),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 we:Ar(we);return;case Ce:Ar(Ce);return;case me:Ar(me);return;case De:Ar(De);return;default:throw new Error}},[je,cr,rr]),qr=Object(I.useCallback)(function(rt){Ar("");switch(_r){case we:var ct=rt.title,ft=rt.link;return je.replaceSelection("[".concat(ct,"](").concat(ft,")")),je.focus();case Ce: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 De: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 we:return D.a.createElement(W,{callback:qr,onCancel:yr});case Ce:return D.a.createElement(O.b,{callback:qr,onCancel:yr});case me:return D.a.createElement(Ee,{callback:qr,onCancel:yr});case De: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=be+_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(be)},[be]);var zn=Je(ee),_i=Je(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(Ue?"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(l.a,{value:$r})):null))),Wt?D.a.createElement("a",{ref:Mr,className:"editor-resize"}):null,D.a.createElement(u.a,null,Le[_r]?D.a.createElement(V.a,{centered:!0,title:Le[_r],visible:!0,onCancel:yr,footer:null},vn):null))}},SJMd:function(ot,Ge){/**
|
|
* @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 te,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"],l=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[_,C,M,b,d,o,s,l],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",y="com",h="typ",c="lit",u="pun",a="pln",g="tag",p="dec",v="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 Ce=0,De=!1,Re=!1,Me=0,Oe=me.length;Me<Oe;++Me){var Ae=me[Me];if(Ae.ignoreCase)Re=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Re=!1;break}}var We={b:8,t:9,n:10,v:11,f:12,r:13};function Ye(Je){var Se=Je.charCodeAt(0);if(Se!==92)return Se;var $e=Je.charAt(1);return Se=We[$e],Se||("0"<=$e&&$e<="7"?parseInt(Je.substring(1),8):$e==="u"||$e==="x"?parseInt(Je.substring(2),16):Je.charCodeAt(1))}function Xe(Je){if(Je<32)return(Je<16?"\\x0":"\\x")+Je.toString(16);var Se=String.fromCharCode(Je);return Se==="\\"||Se==="-"||Se==="]"||Se==="^"?"\\"+Se:Se}function Be(Je){var Se=Je.substring(1,Je.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")),$e=[],Ke=Se[0]==="^",Le=["["];Ke&&Le.push("^");for(var ke=Ke?1:0,le=Se.length;ke<le;++ke){var ae=Se[ke];if(/\\[bdsw]/i.test(ae))Le.push(ae);else{var ue=Ye(ae),$;ke+2<le&&Se[ke+1]==="-"?($=Ye(Se[ke+2]),ke+=2):$=ue,$e.push([ue,$]),$<65||ue>122||($<65||ue>90||$e.push([Math.max(65,ue)|32,Math.min($,90)|32]),$<97||ue>122||$e.push([Math.max(97,ue)&~32,Math.min($,122)&~32]))}}$e.sort(function(be,_e){return be[0]-_e[0]||_e[1]-be[1]});for(var Q=[],ee=[],ke=0;ke<$e.length;++ke){var ie=$e[ke];ie[0]<=ee[1]+1?ee[1]=Math.max(ee[1],ie[1]):Q.push(ee=ie)}for(var ke=0;ke<Q.length;++ke){var ie=Q[ke];Le.push(Xe(ie[0])),ie[1]>ie[0]&&(ie[1]+1>ie[0]&&Le.push("-"),Le.push(Xe(ie[1])))}return Le.push("]"),Le.join("")}function qe(Je){for(var Se=Je.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")),$e=Se.length,Ke=[],Le=0,ke=0;Le<$e;++Le){var le=Se[Le];if(le==="(")++ke;else if(le.charAt(0)==="\\"){var ae=+le.substring(1);ae&&(ae<=ke?Ke[ae]=-1:Se[Le]=Xe(ae))}}for(var Le=1;Le<Ke.length;++Le)Ke[Le]===-1&&(Ke[Le]=++Ce);for(var Le=0,ke=0;Le<$e;++Le){var le=Se[Le];if(le==="(")++ke,Ke[ke]||(Se[Le]="(?:");else if(le.charAt(0)==="\\"){var ae=+le.substring(1);ae&&ae<=ke&&(Se[Le]="\\"+Ke[ae])}}for(var Le=0;Le<$e;++Le)Se[Le]==="^"&&Se[Le+1]!=="^"&&(Se[Le]="");if(Je.ignoreCase&&De)for(var Le=0;Le<$e;++Le){var le=Se[Le],ue=le.charAt(0);le.length>=2&&ue==="["?Se[Le]=Be(le):ue!=="\\"&&(Se[Le]=le.replace(/[a-zA-Z]/g,function(ee){var ie=ee.charCodeAt(0);return"["+String.fromCharCode(ie&~32,ie|32)+"]"}))}return Se.join("")}for(var He=[],Me=0,Oe=me.length;Me<Oe;++Me){var Ae=me[Me];if(Ae.global||Ae.multiline)throw new Error(""+Ae);He.push("(?:"+qe(Ae)+")")}return new RegExp(He.join("|"),Re?"gi":"g")}function P(me,Ce){var De=/(?:^|\s)nocode(?:\s|$)/,Re=[],Me=0,Oe=[],Ae=0;function We(Ye){var Xe=Ye.nodeType;if(Xe==1){if(De.test(Ye.className))return;for(var Be=Ye.firstChild;Be;Be=Be.nextSibling)We(Be);var qe=Ye.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(Re[Ae]=`
|
|
`,Oe[Ae<<1]=Me++,Oe[Ae++<<1|1]=Ye)}else if(Xe==3||Xe==4){var He=Ye.nodeValue;He.length&&(Ce?He=He.replace(/\r\n?/g,`
|
|
`):He=He.replace(/[ \t\r\n]+/g," "),Re[Ae]=He,Oe[Ae<<1]=Me,Me+=He.length,Oe[Ae++<<1|1]=Ye)}}return We(me),{sourceCode:Re.join("").replace(/\n$/,""),spans:Oe}}function H(me,Ce,De,Re,Me){if(!De)return;var Oe={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:Ce,decorations:null};Re(Oe),Me.push.apply(Me,Oe.decorations)}var X=/\S/;function Z(me){for(var Ce=void 0,De=me.firstChild;De;De=De.nextSibling){var Re=De.nodeType;Ce=Re===1?Ce?me:De:Re===3&&X.test(De.nodeValue)?me:Ce}return Ce===me?void 0:Ce}function re(me,Ce){var De={},Re;(function(){for(var Ae=me.concat(Ce),We=[],Ye={},Xe=0,Be=Ae.length;Xe<Be;++Xe){var qe=Ae[Xe],He=qe[3];if(He)for(var Je=He.length;--Je>=0;)De[He.charAt(Je)]=qe;var Se=qe[1],$e=""+Se;Ye.hasOwnProperty($e)||(We.push(Se),Ye[$e]=null)}We.push(/[\0-\uffff]/),Re=O(We)})();var Me=Ce.length,Oe=function(Ae){for(var We=Ae.sourceCode,Ye=Ae.basePos,Xe=Ae.sourceNode,Be=[Ye,a],qe=0,He=We.match(Re)||[],Je={},Se=0,$e=He.length;Se<$e;++Se){var Ke=He[Se],Le=Je[Ke],ke=void 0,le;if(typeof Le=="string")le=!1;else{var ae=De[Ke.charAt(0)];if(ae)ke=Ke.match(ae[1]),Le=ae[0];else{for(var ue=0;ue<Me;++ue)if(ae=Ce[ue],ke=Ke.match(ae[1]),ke){Le=ae[0];break}ke||(Le=a)}le=Le.length>=5&&Le.substring(0,5)==="lang-",le&&!(ke&&typeof ke[1]=="string")&&(le=!1,Le=v),le||(Je[Ke]=Le)}var $=qe;if(qe+=Ke.length,!le)Be.push(Ye+$,Le);else{var Q=ke[1],ee=Ke.indexOf(Q),ie=ee+Q.length;ke[2]&&(ie=Ke.length-ke[2].length,ee=ie-Q.length);var be=Le.substring(5);H(Xe,Ye+$,Ke.substring(0,ee),Oe,Be),H(Xe,Ye+$+ee,Q,he(be,Q),Be),H(Xe,Ye+$+ie,Ke.substring(ie),Oe,Be)}}Ae.decorations=Be};return Oe}function Ee(me){var Ce=[],De=[];me.tripleQuotedStrings?Ce.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?Ce.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ce.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&De.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Re=me.hashComments;Re&&(me.cStyleComments?(Re>1?Ce.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ce.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ce.push([y,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(De.push([y,/^\/\/[^\r\n]*/,null]),De.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Me=me.regexLiterals;if(Me){var Oe=Me>1?"":`
|
|
\r`,Ae=Oe?".":"[\\S\\s]",We="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+We+")")])}var Ye=me.types;Ye&&De.push([h,Ye]);var Xe=(""+me.keywords).replace(/^ | $/g,"");Xe.length&&De.push([w,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),Ce.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(Be+="(?!s*/)"),De.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],[u,new RegExp(Be),null]),re(Ce,De)}var fe=Ee({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(me,Ce,De){for(var Re=/(?:^|\s)nocode(?:\s|$)/,Me=/\r\n?|\n/,Oe=me.ownerDocument,Ae=Oe.createElement("li");me.firstChild;)Ae.appendChild(me.firstChild);var We=[Ae];function Ye(Se){var $e=Se.nodeType;if($e==1&&!Re.test(Se.className))if(Se.nodeName==="br")Xe(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Ke=Se.firstChild;Ke;Ke=Ke.nextSibling)Ye(Ke);else if(($e==3||$e==4)&&De){var Le=Se.nodeValue,ke=Le.match(Me);if(ke){var le=Le.substring(0,ke.index);Se.nodeValue=le;var ae=Le.substring(ke.index+ke[0].length);if(ae){var ue=Se.parentNode;ue.insertBefore(Oe.createTextNode(ae),Se.nextSibling)}Xe(Se),le||Se.parentNode.removeChild(Se)}}}function Xe(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function $e(ke,le){var ae=le?ke.cloneNode(!1):ke,ue=ke.parentNode;if(ue){var $=$e(ue,1),Q=ke.nextSibling;$.appendChild(ae);for(var ee=Q;ee;ee=Q)Q=ee.nextSibling,$.appendChild(ee)}return ae}for(var Ke=$e(Se.nextSibling,0),Le;(Le=Ke.parentNode)&&Le.nodeType===1;)Ke=Le;We.push(Ke)}for(var Be=0;Be<We.length;++Be)Ye(We[Be]);Ce===(Ce|0)&&We[0].setAttribute("value",Ce);var qe=Oe.createElement("ol");qe.className="linenums";for(var He=Math.max(0,Ce-1|0)||0,Be=0,Je=We.length;Be<Je;++Be)Ae=We[Be],Ae.className="L"+(Be+He)%10,Ae.firstChild||Ae.appendChild(Oe.createTextNode("\xA0")),qe.appendChild(Ae);me.appendChild(qe)}function ge(me){var Ce=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ce=Ce&&+Ce[1]<=8;var De=/\n/g,Re=me.sourceCode,Me=Re.length,Oe=0,Ae=me.spans,We=Ae.length,Ye=0,Xe=me.decorations,Be=Xe.length,qe=0;Xe[Be]=Me;var He,Je;for(Je=He=0;Je<Be;)Xe[Je]!==Xe[Je+2]?(Xe[He++]=Xe[Je++],Xe[He++]=Xe[Je++]):Je+=2;for(Be=He,Je=He=0;Je<Be;){for(var Se=Xe[Je],$e=Xe[Je+1],Ke=Je+2;Ke+2<=Be&&Xe[Ke+1]===$e;)Ke+=2;Xe[He++]=Se,Xe[He++]=$e,Je=Ke}Be=Xe.length=He;var Le=me.sourceNode,ke="";Le&&(ke=Le.style.display,Le.style.display="none");try{for(var le=null;Ye<We;){var ae=Ae[Ye],ue=Ae[Ye+2]||Me,$=Xe[qe+2]||Me,Ke=Math.min(ue,$),Q=Ae[Ye+1],ee;if(Q.nodeType!==1&&(ee=Re.substring(Oe,Ke))){Ce&&(ee=ee.replace(De,"\r")),Q.nodeValue=ee;var ie=Q.ownerDocument,be=ie.createElement("span");be.className=Xe[qe+1];var _e=Q.parentNode;_e.replaceChild(be,Q),be.appendChild(Q),Oe<ue&&(Ae[Ye+1]=Q=ie.createTextNode(Re.substring(Ke,ue)),_e.insertBefore(Q,be.nextSibling))}Oe=Ke,Oe>=ue&&(Ye+=2),Oe>=$&&(qe+=2)}}finally{Le&&(Le.style.display=ke)}}var pe={};function ce(me,Ce){for(var De=Ce.length;--De>=0;){var Re=Ce[De];pe.hasOwnProperty(Re)?I.console&&console.warn("cannot override language handler %s",Re):pe[Re]=me}}function he(me,Ce){return me&&pe.hasOwnProperty(me)||(me=/^\s*</.test(Ce)?"default-markup":"default-code"),pe[me]}ce(fe,["default-code"]),ce(re([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ce(re([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ce(re([],[[F,/^[\s\S]+/]]),["uq.val"]),ce(Ee({keywords:_,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),ce(Ee({keywords:"null,true,false"}),["json"]),ce(Ee({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),ce(Ee({keywords:M,cStyleComments:!0}),["java"]),ce(Ee({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(Ee({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(Ee({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(Ee({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(Ee({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(Ee({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(re([],[[m,/^[\s\S]+/]]),["regex"]);function J(me){var Ce=me.langExtension;try{var De=P(me.sourceNode,me.pre),Re=De.sourceCode;me.sourceCode=Re,me.spans=De.spans,me.basePos=0,he(Ce,Re)(me),ge(me)}catch(Me){I.console&&console.log(Me&&Me.stack||Me)}}function oe(me,Ce,De){var Re=De||!1,Me=Ce||null,Oe=document.createElement("div");Oe.innerHTML="<pre>"+me+"</pre>",Oe=Oe.firstChild,Re&&Te(Oe,Re,!0);var Ae={langExtension:Me,numberLines:Re,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Ae),Oe.innerHTML}function q(me,Ce){var De=Ce||document.body,Re=De.ownerDocument||document;function Me(ae){return De.getElementsByTagName(ae)}for(var Oe=[Me("pre"),Me("code"),Me("xmp")],Ae=[],We=0;We<Oe.length;++We)for(var Ye=0,Xe=Oe[We].length;Ye<Xe;++Ye)Ae.push(Oe[We][Ye]);Oe=null;var Be=Date;Be.now||(Be={now:function(){return+new Date}});var qe=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Je=/\bprettyprint\b/,Se=/\bprettyprinted\b/,$e=/pre|xmp/i,Ke=/^code$/i,Le=/^(?:pre|code|xmp)$/i,ke={};function le(){for(var ae=I.PR_SHOULD_USE_CONTINUATION?Be.now()+250:Infinity;qe<Ae.length&&Be.now()<ae;qe++){for(var ue=Ae[qe],$=ke,Q=ue;Q=Q.previousSibling;){var ee=Q.nodeType,ie=(ee===7||ee===8)&&Q.nodeValue;if(ie?!/^\??prettify\b/.test(ie):ee!==3||/\S/.test(Q.nodeValue))break;if(ie){$={},ie.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,pt,Tr){$[pt]=Tr});break}}var be=ue.className;if(($!==ke||Je.test(be))&&!Se.test(be)){for(var _e=!1,Ue=ue.parentNode;Ue;Ue=Ue.parentNode){var tt=Ue.tagName;if(Le.test(tt)&&Ue.className&&Je.test(Ue.className)){_e=!0;break}}if(!_e){ue.className+=" prettyprinted";var dt=$.lang;if(!dt){dt=be.match(He);var it;!dt&&(it=Z(ue))&&Ke.test(it.tagName)&&(dt=it.className.match(He)),dt&&(dt=dt[1])}var Lt;if($e.test(ue.tagName))Lt=1;else{var mt=ue.currentStyle,st=Re.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=be.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<Ae.length?I.setTimeout(le,250):typeof me=="function"&&me()}le()}var ye=I.PR={createSimpleLexer:re,registerLangHandler:ce,sourceDecorator:Ee,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:F,PR_COMMENT:y,PR_DECLARATION:p,PR_KEYWORD:w,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:v,PR_STRING:m,PR_TAG:g,PR_TYPE:h,prettyPrintOne:A?I.prettyPrintOne=oe:R=oe,prettyPrint:B=A?I.prettyPrint=q:B=q},we=I.define;typeof we=="function"&&we.amd&&we("google-code-prettify",[],function(){return ye})})()},"VrN/":function(ot,Ge,te){(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),l=/\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 y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=y(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 u(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 g(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=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 v(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function 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;y(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(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,Ee={toString:function(){return"CodeMirror.Pass"}},fe={scroll:!1},Te={origin:"*mouse"},ge={origin:"+move"};function pe(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 we(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 Ce(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||me.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&Ce(e)?!0:t.test(e):Ce(e)}function Re(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 Oe(e){return e.charCodeAt(0)>=768&&Me.test(e)}function Ae(e,t,n){for(;(n<0?t>0:t<e.length)&&Oe(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 Ye(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,se,de){this.level=Y,this.from=se,this.to=de}return function(Y,se){var de=se=="ltr"?"L":"R";if(Y.length==0||se=="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 Ie=0,Ne=de;Ie<xe;++Ie){var ze=ve[Ie];ze=="m"?ve[Ie]=Ne:Ne=ze}for(var Qe=0,Ve=de;Qe<xe;++Qe){var Ze=ve[Qe];Ze=="1"&&Ve=="r"?ve[Qe]="n":x.test(Ze)&&(Ve=Ze,Ze=="r"&&(ve[Qe]="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=se=="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 se=="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)))),se=="rtl"?Xt.reverse():Xt}}();function He(e,t){var n=e.order;return n==null&&(n=e.order=qe(e.text,t)),n}var Je=[],Se=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]||Je).concat(n)}};function $e(e,t){return e._handlers&&e._handlers[t]||Je}function Ke(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 Le(e,t){var n=$e(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 ke(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Le(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function le(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 ae(e,t){return $e(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ee(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ie(e){$(e),Q(e)}function be(e){return e.target||e.srcElement}function _e(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 Ue=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");u(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=u(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(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=u(e,a("span","x")),n=t.getBoundingClientRect(),r=p(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=we(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 Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(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 Fe(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 Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(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?Fe(e.line,t):n<0?Fe(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,se){return i.push(Y,se)},x,r);for(var N=n.state,K=function(Y){n.baseTokens=i;var se=e.state.overlays[Y],de=1,xe=0;n.state=!0,jn(e,t.text,se.mode,n,function(ve,Pe){for(var Ie=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(se.opaque)i.splice(Ie,de-Ie,ve,"overlay "+Pe),de=Ie+2;else for(;Ie<de;Ie+=2){var ze=i[Ie+1];i[Ie+1]=(ze?ze+" ":"")+"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),se;for(r&&(se=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,N=pn(x,Y,z.state),r&&se.push(new _r(Y,N,ur(i.mode,z.state)));return r?se: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,se=new Ct(t,e.options.tabSize,r),de,xe=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),x);!se.eol();){if(se.pos>e.options.maxHighlightLength?(K=!1,N&&mn(e,t,r,se.pos),se.pos=t.length,de=null):de=xi(pn(n,se,r.state,xe),x),xe){var ve=xe[0].name;ve&&(de="m-"+(de?ve+" "+de:ve))}if(!K||Y!=de){for(;z<se.start;)z=Math.min(se.start,z+5e3),i(z,Y);Y=de}se.start=se.pos}for(;z<se.pos;){var Pe=Math.min(se.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 se=H(z.text,null,e.options.tabSize);(i==null||r>se)&&(i=K-1,r=se)}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,se=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+se):xe.to=i}}if(z)for(var Pe=0;Pe<z.length;++Pe){var Ie=z[Pe];if(Ie.to!=null&&(Ie.to+=se),Ie.from==null){var Ne=Pr(K,Ie.marker);Ne||(Ie.from=se,Y&&(K||(K=[])).push(Ie))}else Ie.from+=se,Y&&(K||(K=[])).push(Ie)}K&&(K=Zr(K)),z&&z!=K&&(z=Zr(z));var ze=[K];if(!Y){var Qe=t.text.length-2,Ve;if(Qe>0&&K)for(var Ze=0;Ze<K.length;++Ze)K[Ze].to==null&&(Ve||(Ve=[])).push(new gn(K[Ze].marker,null,null));for(var at=0;at<Qe;++at)ze.push(Ve);ze.push(z)}return ze}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 Ie=ve.markedSpans[Pe].marker;Ie.readOnly&&(!r||Z(r,Ie)==-1)&&(r||(r=[])).push(Ie)}}),!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 se=[z,1],de=ut(Y.from,K.from),xe=ut(Y.to,K.to);(de<0||!N.inclusiveLeft&&!de)&&se.push({from:Y.from,to:K.from}),(xe>0||!N.inclusiveRight&&!xe)&&se.push({from:K.to,to:Y.to}),i.splice.apply(i,se),z+=se.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),se=ut(Y.from,n)||vn(z.marker)-vn(i),de=ut(Y.to,r)||yr(z.marker)-yr(i);if(se>=0&&de<=0||se<=0&&de>=0)continue;if(se<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.to,n)>=0:ut(Y.to,n)>0)||se>=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=g("span",null,null,D?"padding-right: .1px":null),r={pre:g("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=He(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 Le(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,se;if(!z.test(t))e.col+=t.length,se=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,se),B&&I<9&&(Y=!0),e.pos+=t.length;else{se=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?se.appendChild(a("span",[Pe])):se.appendChild(Pe),e.map.push(e.pos,e.pos+ve,Pe),e.col+=ve,e.pos+=ve}if(!xe)break;de+=ve+1;var Ie=void 0;if(xe[0]==" "){var Ne=e.cm.options.tabSize,ze=Ne-e.col%Ne;Ie=se.appendChild(a("span",he(ze),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=ze}else xe[0]=="\r"||xe[0]==`
|
|
`?(Ie=se.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",xe[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(xe[0]),Ie.setAttribute("cm-text",xe[0]),B&&I<9?se.appendChild(a("span",[Ie])):se.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||Y||x||N){var Qe=n||"";r&&(Qe+=r),i&&(Qe+=i);var Ve=a("span",[se],Qe,x);if(N)for(var Ze in N)N.hasOwnProperty(Ze)&&Ze!="style"&&Ze!="class"&&Ve.setAttribute(Ze,N[Ze]);return e.content.appendChild(Ve)}e.content.appendChild(se)}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,se=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>=se)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,se="",de,xe,ve=0,Pe,Ie,Ne,ze,Qe;;){if(ve==z){Pe=Ie=Ne=xe="",Qe=null,ze=null,ve=Infinity;for(var Ve=[],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)Ve.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,Ie=""),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&&((Qe||(Qe={})).title=ht.title),ht.attributes)for(var Tt in ht.attributes)(Qe||(Qe={}))[Tt]=ht.attributes[Tt];ht.collapsed&&(!ze||zn(ze.marker,ht)<0)&&(ze=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&&(Ie+=" "+Ze[Bt]);if(!ze||ze.from==z)for(var Dt=0;Dt<Ve.length;++Dt)ja(t,0,Ve[Dt]);if(ze&&(ze.from||0)==z){if(ja(t,(ze.to==null?K+1:ze.to)-z,ze.marker,ze.from==null),ze.to==null)return;ze.to==z&&(ze=!1)}}if(z>=K)break;for(var ir=Math.min(K,ve);;){if(se){var qt=z+se.length;if(!ze){var Mt=qt>ir?se.slice(0,ir-z):se;t.addToken(t,Mt,de?de+Pe:Pe,Ne,z+Mt.length==ve?Ie:"",xe,Qe)}if(qt>=ir){se=se.slice(ir-z),z=ir;break}z=qt,Ne=""}se=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=$e(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,se=x.hasOwnProperty(Y)&&x[Y];se&&K.appendChild(a("div",[se],"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=y("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(!v(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;"),u(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Lr(e,t){for(var n=be(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=u(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,u(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 se=0;se<4;se++){for(;N&&Oe(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&Oe(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(p(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,Ie=(ve+Pe)/2,Ne=t.view.measure.heights,ze=0;ze<Ne.length-1&&!(Ie<Ne[ze]);ze++);var Qe=ze?Ne[ze-1]:0,Ve=Ne[ze],Ze={left:(z=="right"?Y.right:Y.left)-t.rect.left,right:(z=="left"?Y.left:Y.right)-t.rect.left,top:Qe,bottom:Ve};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,Ie){var Ne=Er(e,i,Pe,Ie?"right":"left",x);return Ie?Ne.left=Ne.right:Ne.right=Ne.left,Oi(e,r,Ne,n)}var K=He(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 se(Pe,Ie,Ne){var ze=K[Ie],Qe=ze.level==1;return N(Ne?Pe-1:Pe,Qe!=Ne)}var de=Be(K,z,Y),xe=Xe,ve=se(z,de,Y=="before");return xe!=null&&(ve.other=se(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=Fe(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,se=He(t,e.doc.direction);if(se){var de=(e.options.lineWrapping?zs:Gs)(e,t,n,x,se,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),Ie,Ne,ze=!1;if(ve){var Qe=r-ve.left<ve.right-r,Ve=Qe==Y;Pe=xe+(Ve?0:1),Ne=Ve?"after":"before",Ie=Qe?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,Fe(n,Pe,Ne),"line",t,x);Ie=Ze.left,ze=i<Ze.top?-1:i>=Ze.bottom?1:0}return Pe=Ae(t.text,Pe,1),aa(n,Pe,Ne,ze,r-Ie)}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,Fe(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,se=pr(e,Fe(n,Y?z.from:z.to,Y?"after":"before"),"line",t,r);sa(se,x,N,!0)&&se.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 se=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,Ie=Er(e,r,Pe?Math.min(Y,ve.to)-1:Math.max(z,ve.from)).right,Ne=Ie<x?x-Ie+1e9:Ie-x;(!se||de>Ne)&&(se=ve,de=Ne)}return se||(se=i[i.length-1]),se.from<z&&(se={from:z,to:se.to,level:se.level}),se.to>Y&&(se={from:se.from,to:Y,level:se.level}),se}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"))}u(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");u(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&&be(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 se=H(Y,Y.length,e.options.tabSize)-Y.length;z=Fe(z.line,Math.max(0,Math.round((x-Xa(e.display).left)/Tn(e.display))-se))}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 se(Ve,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: "+Ve+`px;
|
|
top: `+Ze+"px; width: "+(at==null?z-Ve:at)+`px;
|
|
height: `+(nt-Ze)+"px"))}function de(Ve,Ze,at){var nt=et(i,Ve),ht=nt.text.length,Tt,Bt;function Dt(Mt,er){return ia(e,Fe(Ve,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=He(nt,i.direction);return Ye(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;se(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),se(dn,Ot.top,Jt-dn,Ot.bottom),Ot.bottom<tr.top&&se(K,Ot.bottom,null,tr.top),se(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),Ie=et(i,ve.line),Ne=rt(Pe)==rt(Ie),ze=de(xe.line,xe.ch,Ne?Pe.text.length+1:null).end,Qe=de(ve.line,Ne?0:null,ve.ch).start;Ne&&(ze.top<Qe.top-2?(se(ze.right,ze.top,null,ze.bottom),se(K,Qe.top,Qe.left,Qe.bottom)):se(ze.right,ze.top,Qe.left-ze.right,ze.bottom)),ze.bottom<Qe.top&&se(K,ze.bottom,null,Qe.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||(Le(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&&(Le(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 se=i.line.height-N;if((se>.005||se<-.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(ke(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?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(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),se=e.doc.scrollTop,de=e.doc.scrollLeft;if(Y.scrollTop!=null&&(qn(e,Y.scrollTop),Math.abs(e.doc.scrollTop-se)>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 se=Math.min(t.top,(Y?K:t.bottom)-x);se!=i&&(N.scrollTop=se)}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),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(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),Se(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||Le(x[K],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Le(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(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,se=z.classes;se?x.styleClasses=se:Y&&(x.styleClasses=null);for(var de=!N||N.length!=x.styles.length||Y!=se&&(!Y||!se||Y.bgClass!=se.bgClass||Y.textClass!=se.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){ae(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Le.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||!v(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(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&&v(document.body,e.anchorNode)&&v(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 Ie=Pe.nextSibling;return D&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Ie}for(var z=r.view,Y=r.viewFrom,se=0;se<z.length;se++){var de=z[se];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=g("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=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=g("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,se=x.view;Y!=N;Y=Y.parentNode)for(var de=0;de<se.length;de++)if(se[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 Ie=N.scrollLeft-x.wheelStartX,Ne=N.scrollTop-x.wheelStartY,ze=Ne&&x.wheelDY&&Ne/x.wheelDY||Ie&&x.wheelDX&&Ie/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!ze)return;or=(or*Fi+ze)/(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()),se=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?se:Y,de?Y:se))}}return new sr(t,n)}function Br(e,t){return new sr([new vt(e,t||e)],0)}function jr(e){return e.text?Fe(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),Fe(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?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(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 se=e.sel.ranges[N],de=ut(se.head,se.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(Qe){return n?n[Qe]:null}function x(Qe,Ve,Ze){kr(Qe,Ve,Ze,r),Ht(Qe,"change",Qe,t)}function N(Qe,Ve){for(var Ze=[],at=Qe;at<Ve;++at)Ze.push(new wt(Y[at],i(at),r));return Ze}var K=t.from,z=t.to,Y=t.text,se=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 Ie=N(0,Y.length-1);x(de,de.text,ve),Pe&&e.remove(K.line,Pe),Ie.length&&e.insert(K.line,Ie)}else if(se==de)if(Y.length==1)x(se,se.text.slice(0,K.ch)+xe+se.text.slice(z.ch),ve);else{var Ne=N(1,Y.length-1);Ne.push(new wt(xe+se.text.slice(z.ch),ve,r)),x(se,se.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,Ne)}else if(Y.length==1)x(se,se.text.slice(0,K.ch)+Y[0]+de.text.slice(z.ch),i(0)),e.remove(K.line+1,Pe);else{x(se,se.text.slice(0,K.ch)+Y[0],i(0)),x(de,xe+de.text.slice(z.ch),ve);var ze=N(1,Y.length-1);Pe>1&&e.remove(K.line+1,Pe-1),e.insert(K.line+1,ze)}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||Le(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],se=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var de in Y)(se=de.match(/^spans_(\d+)$/))&&(Z(t,Number(se[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 Le(e,"beforeSelectionChange",e,r),e.cm&&Le(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){(ae(e,"beforeSelectionChange")||e.cm&&ae(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,le(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,se="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(se?K.to>=t.ch:K.to>t.ch))){if(i&&(Le(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?se: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:se)&&(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,Fe(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?lt(e,Fe(t.line-1)):null:n>0&&t.ch==(r||et(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Wo(e){e.setSelection(Fe(e.firstLine(),0),Fe(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)}),Le(e,"beforeChange",e,r),e.cm&&Le(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((ae(e,"beforeChange")||e.cm&&ae(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 se=[];Bi(N,z),z.push({changes:se,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var de=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),xe=function(Ie){var Ne=x.changes[Ie];if(Ne.origin=t,de&&!Ho(e,Ne,!1))return K.length=0,{};se.push(Sa(e,Ne));var ze=Ie?Ea(e,Ne):J(K);ai(e,Ne,ze,Mo(e,Ne)),!Ie&&e.cm&&e.cm.scrollIntoView({from:Ne.from,to:jr(Ne)});var Qe=[];Wr(e,function(Ve,Ze){!Ze&&Z(Qe,Ve.history)==-1&&(Xo(Ve.history,Ne),Qe.push(Ve.history)),ai(Ve,Ne,null,Mo(Ve,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(Fe(i.anchor.line+t,i.anchor.ch),Fe(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:Fe(e.first,0),to:Fe(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:Fe(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,Fe(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&&le(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 se=ae(e,"changes"),de=ae(e,"change");if(de||se){var xe={from:x,to:N,text:t.text,removed:t.removed,origin:t.origin};de&&Ht(e,"change",e,xe),se&&(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=Fe(Y.from.line+r,Y.from.ch),Y.to=Fe(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),ae(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]),se=Gt(Y);se>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=se,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=Fe(t?x:gt(x),N.from),e==-1))return n;if(N.to!=null&&(r=Fe(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=g("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&&Se(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 se=t.line;se<=n.line;se++)Fr(z,se,"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(Fe(e.first,0),e.clipPos(Fe(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=Fe(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=we(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=Fe(this.first,0),n=this.first+this.size-1;Ln(this,{from:t,to:Fe(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"?Fe(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&&Re(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,Re(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(y(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(y(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,Fe(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),ke(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 Ie=new FileReader;Ie.onerror=function(){return K()},Ie.onload=function(){var Ne=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ne)){K();return}x[Pe]=Ne,K()},Ie.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 se=e.dataTransfer.getData("Text");if(se){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(se,"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(ke(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)),u(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;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Rl)},100))}),Se(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=Ae(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 Fe(t.line,r,n<0?"after":"before")}function La(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=He(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 se=En(t,n);Y=i<0?n.text.length-1:0;var de=Er(t,se,Y).top;Y=We(function(xe){return Er(t,se,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 Fe(r,Y,z)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=He(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(ze,Qe){return _a(t,ze instanceof Fe?ze.ch:ze,Qe)},z,Y=function(ze){return e.options.lineWrapping?(z=z||En(e,t),ao(e,t,z,ze)):{begin:0,end:t.text.length}},se=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<=se.end:xe>=N.from&&xe>=se.begin)){var ve=de?"before":"after";return new Fe(n.line,xe,ve)}}var Pe=function(ze,Qe,Ve){for(var Ze=function(Tt,Bt){return Bt?new Fe(n.line,K(Tt,1),"before"):new Fe(n.line,Tt,"after")};ze>=0&&ze<i.length;ze+=Qe){var at=i[ze],nt=Qe>0==(at.level!=1),ht=nt?Ve.begin:K(Ve.end,-1);if(at.from<=ht&&ht<at.to)return Ze(ht,nt);if(ht=nt?at.from:K(at.to,-1),Ve.begin<=ht&&ht<Ve.end)return Ze(ht,nt)}},Ie=Pe(x+r,r,se);if(Ie)return Ie;var Ne=r>0?se.end:K(se.begin,-1);return Ne!=null&&!(r>0&&Ne==t.text.length)&&(Ie=Pe(r>0?0:i.length-1,r,Y(Ne)),Ie)?Ie: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:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Pn(e,function(t){return{from:Fe(t.from().line,0),to:lt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Pn(e,function(t){return{from:Fe(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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(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")},ge)},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")},ge)},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},ge)},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 Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Fe(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 Fe(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Fe(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=He(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 Fe(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)!=Ee}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(),ke(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"),Ke(document,"keyup",n),Ke(document,"mouseover",n))}Se(document,"keyup",n),Se(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),ke(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Lr(t.display,e)||ke(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(ke(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=_e(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):be(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)!=Ee}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=l?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&&Ue&&!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,Ke(i.wrapper.ownerDocument,"mouseup",N),Ke(i.wrapper.ownerDocument,"mousemove",K),Ke(i.scroller,"dragstart",z),Ke(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(),Se(i.wrapper.ownerDocument,"mouseup",N),Se(i.wrapper.ownerDocument,"mousemove",K),Se(i.scroller,"dragstart",z),Se(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(Fe(t.line,0),lt(e.doc,Fe(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 se=fs(e,n,r.unit);r.extend?N=wa(N,se.anchor,se.head,r.extend):N=se}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(Ve){if(ut(de,Ve)==0)return;if(de=Ve,r.unit=="rectangle"){for(var Ze=[],at=e.options.tabSize,nt=H(et(x,n.line).text,n.ch,at),ht=H(et(x,Ve.line).text,Ve.ch,at),Tt=Math.min(nt,ht),Bt=Math.max(nt,ht),Dt=Math.min(n.line,Ve.line),ir=Math.min(e.lastLine(),Math.max(n.line,Ve.line));Dt<=ir;Dt++){var qt=et(x,Dt).text,Mt=pe(qt,Tt,at);Tt==Bt?Ze.push(new vt(Fe(Dt,Mt),Fe(Dt,Mt))):qt.length>Mt&&Ze.push(new vt(Fe(Dt,Mt),Fe(Dt,pe(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(Ve)}else{var er=N,Kt=fs(e,Ve,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 Ie(Ve){var Ze=++Pe,at=rn(e,Ve,!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&&Ie(Ve)}),150)}else{var ht=Ve.clientY<ve.top?-20:Ve.clientY>ve.bottom?20:0;ht&&setTimeout(Ft(e,function(){if(Pe!=Ze)return;i.scroller.scrollTop+=ht,Ie(Ve)}),50)}}function Ne(Ve){e.state.selectingText=!1,Pe=Infinity,Ve&&($(Ve),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",ze),Ke(i.wrapper.ownerDocument,"mouseup",Qe),x.history.lastSelOrigin=null}var ze=Ft(e,function(Ve){Ve.buttons===0||!_e(Ve)?Ne(Ve):Ie(Ve)}),Qe=Ft(e,Ne);e.state.selectingText=Qe,Se(i.wrapper.ownerDocument,"mousemove",ze),Se(i.wrapper.ownerDocument,"mouseup",Qe)}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=He(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 se=Be(x,r.ch,r.sticky),de=se-N||(r.ch-n.ch)*(K.level==1?-1:1);se==z-1||se==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,Ie=ve?"after":"before";return n.ch==Pe&&n.sticky==Ie?t:new vt(new Fe(n.line,Pe,Ie),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||!ae(e,n))return ee(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 se=Cr(e.doc,x),de=e.display.gutterSpecs[z];return Le(e,n,e,se,de.className,t),ee(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(ke(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(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 se=z.text.indexOf(i,Y);if(se==-1)break;Y=se+i.length,x.push(Fe(N,se))}N++});for(var K=x.length-1;K>=0;K--)Dn(r.doc,i,x[K],Fe(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?Se:Ke;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;Se(t.scroller,"mousedown",Ft(e,cs)),B&&I<11?Se(t.scroller,"dblclick",Ft(e,function(z){if(ke(e,z))return;var Y=rn(e,z);if(!Y||Ra(e,z)||Lr(e.display,z))return;$(z);var se=e.findWordAt(Y);ji(e.doc,se.anchor,se.head)})):Se(t.scroller,"dblclick",function(z){return ke(e,z)||$(z)}),Se(t.scroller,"contextmenu",function(z){return ms(e,z)}),Se(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 se=Y.left-z.left,de=Y.top-z.top;return se*se+de*de>20*20}Se(t.scroller,"touchstart",function(z){if(!ke(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)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(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 se=e.coordsChar(t.activeTouch,"page"),de;!Y.prev||N(Y,Y.prev)?de=new vt(se,se):!Y.prev.prev||N(Y,Y.prev.prev)?de=e.findWordAt(se):de=new vt(Fe(se.line,0),lt(e.doc,Fe(se.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),$(z)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qn(e,t.scroller.scrollTop),an(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(z){return wo(e,z)}),Se(t.scroller,"DOMMouseScroll",function(z){return wo(e,z)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){ke(e,z)||ie(z)},over:function(z){ke(e,z)||(Ll(e,z),ie(z))},start:function(z){return Al(e,z)},drop:Ft(e,_l),leave:function(z){ke(e,z)||Zo(e)}};var K=t.input.getField();Se(K,"keyup",function(z){return us.call(e,z)}),Se(K,"keydown",Ft(e,ls)),Se(K,"keypress",Ft(e,ds)),Se(K,"focus",function(z){return fa(e,z)}),Se(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],se;if(!r&&!/\S/.test(K.text))se=0,n="not";else if(n=="smart"&&(se=i.mode.indent(x,K.text.slice(Y.length),K.text),se==Ee||se>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?se=H(et(i,t-1).text,null,N):se=0:n=="add"?se=z+e.options.indentUnit:n=="subtract"?se=z-e.options.indentUnit:typeof n=="number"&&(se=z+n),se=Math.max(0,se);var de="",xe=0;if(e.options.indentWithTabs)for(var ve=Math.floor(se/N);ve;--ve)xe+=N,de+=" ";if(xe<se&&(de+=he(se-xe)),de!=Y)return Dn(i,de,Fe(t,0),Fe(t,Y.length),"+input"),K.stateAfter=null,!0;for(var Pe=0;Pe<i.sel.ranges.length;Pe++){var Ie=i.sel.ranges[Pe];if(Ie.head.line==t&&Ie.head.ch<Y.length){var Ne=Fe(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 se=0;se<vr.text.length;se++)Y.push(x.splitLines(vr.text[se]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=oe(z,function(ze){return[ze]}));for(var de=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ve=r.ranges[xe],Pe=ve.from(),Ie=ve.to();ve.empty()&&(n&&n>0?Pe=Fe(Pe.line,Pe.ch-n):e.state.overwrite&&!K?Ie=Fe(Ie.line,Math.min(et(x,Ie.line).text.length,Ie.ch+J(z).length)):K&&vr&&vr.lineWise&&vr.text.join(`
|
|
`)==z.join(`
|
|
`)&&(Pe=Ie=Fe(Pe.line,0)));var Ne={from:Pe,to:Ie,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:Fe(i,0),head:Fe(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),Le(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(),se=Math.max(x,z.line);x=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var de=se;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,Fe(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 se=z?z.indexOf("overlay "):-1;return se<0?z:se==0?null:z.slice(0,se-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 se=0;se<N._global.length;se++){var de=N._global[se];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,se=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),se+i.offsetWidth>xe&&(se=xe-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(se=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?se=0:K=="middle"&&(se=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=se+"px"),x&&Js(this,{left:se,top:Y,right:se+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()},ge)}),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),se=0;se<i;++se){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(se){if(z)return r<0?se.from():se.to();var de=pr(x,se.head,"div");se.goalColumn!=null&&(de.left=se.goalColumn),K.push(de.left);var xe=Ts(x,de,r,i);return i=="page"&&se==N.sel.primary()&&ma(x,ia(x,xe,"div").top-de.top),xe},ge),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),se=De(Y,z)?function(de){return De(de,z)}:/\s/.test(Y)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!De(de)};N>0&&se(x.charAt(N-1));)--N;for(;K<x.length&&se(x.charAt(K));)++K}return new vt(Fe(r.line,N),Fe(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"),Le(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:Fe(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,Le(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),Le(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 Qe=t.line+z;return Qe<e.first||Qe>=e.first+e.size?!1:(t=new Fe(Qe,t.ch,t.sticky),K=et(e,Qe))}function se(Qe){var Ve;if(r=="codepoint"){var Ze=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Ze)?Ve=null:Ve=new Fe(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(Ze>=55296&&Ze<56320?2:1))),-n)}else i?Ve=kl(e.cm,K,t,n):Ve=Aa(K,t,n);if(Ve==null)if(!Qe&&Y())t=La(i,e.cm,K,t.line,z);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")se();else if(r=="column")se(!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&&!se(!Pe));Pe=!1){var Ie=K.text.charAt(t.ch)||`
|
|
`,Ne=De(Ie,ve)?"w":xe&&Ie==`
|
|
`?"n":!xe||/\s/.test(Ie)?null:"p";if(xe&&!Pe&&!Ne&&(Ne="s"),de&&de!=Ne){n<0&&(n=1,se(),t.sticky="after");break}if(Ne&&(de=Ne),n>0&&!se(!Pe))break}var ze=Hi(e,t,x,N,!0);return je(x,ze)&&(ze.hitSide=!0),ze}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}Se(i,"paste",function(K){if(!x(K)||ke(r,K)||vs(K,r))return;I<=11&&setTimeout(Ft(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Se(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Se(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!x(K)||ke(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 se=xs(),de=se.firstChild;r.display.lineSpace.insertBefore(se,r.display.lineSpace.firstChild),de.value=vr.text.join(`
|
|
`);var xe=document.activeElement;W(de),setTimeout(function(){r.display.lineSpace.removeChild(se),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Se(i,"copy",N),Se(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 se=K[K.length-1].measure,de=se.maps?se.maps[se.maps.length-1]:se.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=p(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){u(this.cm.display.cursorDiv,e.cursors),u(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 v(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=Fe(r.line-1,et(e.doc,r.line-1).length)),i.ch==et(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(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,se;if(z==t.view.length-1?(Y=t.viewTo-1,se=t.lineDiv.lastChild):(Y=gt(t.view[z+1].line)-1,se=t.view[z+1].node.previousSibling),!K)return!1;for(var de=e.doc.splitLines(tu(e,K,se,N,Y)),xe=wr(e.doc,Fe(N,0),Fe(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,Ie=de[0],Ne=xe[0],ze=Math.min(Ie.length,Ne.length);ve<ze&&Ie.charCodeAt(ve)==Ne.charCodeAt(ve);)++ve;for(var Qe=J(de),Ve=J(xe),Ze=Math.min(Qe.length-(de.length==1?ve:0),Ve.length-(xe.length==1?ve:0));Pe<Ze&&Qe.charCodeAt(Qe.length-Pe-1)==Ve.charCodeAt(Ve.length-Pe-1);)++Pe;if(de.length==1&&xe.length==1&&N==r.line)for(;ve&&ve>r.ch&&Qe.charCodeAt(Qe.length-Pe-1)==Ve.charCodeAt(Ve.length-Pe-1);)ve--,Pe++;de[de.length-1]=Qe.slice(0,Qe.length-Pe).replace(/^\u200b+/,""),de[0]=de[0].slice(ve).replace(/\u200b+$/,"");var at=Fe(N,ve),nt=Fe(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=He(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 se(){N&&(x+=K,z&&(x+=K),N=z=!1)}function de(ve){ve&&(se(),x+=ve)}function xe(ve){if(ve.nodeType==1){var Pe=ve.getAttribute("cm-text");if(Pe){de(Pe);return}var Ie=ve.getAttribute("cm-marker"),Ne;if(Ie){var ze=e.findMarks(Fe(r,0),Fe(i+1,0),Y(+Ie));ze.length&&(Ne=ze[0].find(0))&&de(wr(e.doc,Ne.from,Ne.to).join(K));return}if(ve.getAttribute("contenteditable")=="false")return;var Qe=/^(pre|div|p|li|table|br)$/i.test(ve.nodeName);if(!/^br$/i.test(ve.nodeName)&&ve.textContent.length==0)return;Qe&&se();for(var Ve=0;Ve<ve.childNodes.length;Ve++)xe(ve.childNodes[Ve]);/^(pre|p)$/i.test(ve.nodeName)&&(z=!0),Qe&&(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(Fe(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||!v(r,t))return kn(Fe(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(Fe(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 se(Ne,ze,Qe){for(var Ve=-1;Ve<(Y?Y.length:0);Ve++)for(var Ze=Ve<0?z.map:Y[Ve],at=0;at<Ze.length;at+=3){var nt=Ze[at+2];if(nt==Ne||nt==ze){var ht=gt(Ve<0?e.line:e.rest[Ve]),Tt=Ze[at]+Qe;return(Qe<0||nt!=Ne)&&(Tt=Ze[at+(Qe?1:0)]),Fe(ht,Tt)}}}var de=se(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=se(xe,xe.firstChild,0),de)return kn(Fe(de.line,de.ch-ve),i);ve+=xe.textContent.length}for(var Pe=K.previousSibling,Ie=n;Pe;Pe=Pe.previousSibling){if(de=se(Pe,Pe.firstChild,-1),de)return kn(Fe(de.line,de.ch+Ie),i);Ie+=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"),Se(i,"input",function(){B&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(N){if(ke(r,N)||vs(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(N){if(ke(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)}Se(i,"cut",x),Se(i,"copy",x),Se(e.scroller,"paste",function(N){if(Lr(e,N)||ke(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)}),Se(e.lineSpace,"selectstart",function(N){Lr(e,N)||$(N)}),Se(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"})}}),Se(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;u(n.cursorDiv,e.cursors),u(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,se=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-se.top-5)+"px; left: "+(e.clientX-se.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 Ie=n.somethingSelected(),Ne="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=Ne,t.prevInput=Ie?"":"\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 Ie=0,Ne=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ft(n,Wo)(n):Ie++<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(){Ke(window,"mouseup",Pe),setTimeout(ve,20)};Se(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&&(Se(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&&(Ke(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=Ke,e.on=Se,e.wheelEventPixels=cl,e.Doc=Zt,e.splitLines=mt,e.countColumn=H,e.findColumn=pe,e.isWordChar=Ce,e.Pass=Ee,e.signal=Le,e.Line=wt,e.changeEnd=jr,e.scrollbarModel=vo,e.Pos=Fe,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=v,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,Ge,te){"use strict";te.r(Ge),te.d(Ge,"ResizableTextArea",function(){return Z});var ne=te("wx14"),V=te("1OyB"),A=te("vuIU"),G=te("Ji7U"),U=te("LK+K"),R=te("cDcd"),B=te("VTBJ"),I=te("rePB"),D=te("Zm9Q"),L=te("Kwbf"),E=te("c+Xe"),_=te("m+aA"),M=te("bdgK"),C=new Map;function T(fe){fe.forEach(function(Te){var ge,pe=Te.target;(ge=C.get(pe))===null||ge===void 0||ge.forEach(function(ce){return ce(pe)})})}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 l(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)(ge,fe);var Te=Object(U.a)(ge);function ge(){return Object(V.a)(this,ge),Te.apply(this,arguments)}return Object(A.a)(ge,[{key:"render",value:function(){return this.props.children}}]),ge}(R.Component),f=R.createContext(null);function m(fe){var Te=fe.children,ge=fe.onBatchResize,pe=R.useRef(0),ce=R.useRef([]),he=R.useContext(f),J=R.useCallback(function(oe,q,ye){pe.current+=1;var we=pe.current;ce.current.push({size:oe,element:q,data:ye}),Promise.resolve().then(function(){we===pe.current&&(ge==null||ge(ce.current),ce.current=[])}),he==null||he(oe,q,ye)},[ge,he]);return R.createElement(f.Provider,{value:J},Te)}function w(fe){var Te=fe.children,ge=fe.disabled,pe=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,pe)},[q,pe]),we=R.useRef(fe);we.current=fe;var me=R.useCallback(function(Ce){var De=we.current,Re=De.onResize,Me=De.data,Oe=Ce.getBoundingClientRect(),Ae=Oe.width,We=Oe.height,Ye=Ce.offsetWidth,Xe=Ce.offsetHeight,Be=Math.floor(Ae),qe=Math.floor(We);if(J.current.width!==Be||J.current.height!==qe||J.current.offsetWidth!==Ye||J.current.offsetHeight!==Xe){var He={width:Be,height:qe,offsetWidth:Ye,offsetHeight:Xe};J.current=He;var Je=Ye===Math.round(Ae)?Ae:Ye,Se=Xe===Math.round(We)?We:Xe,$e=Object(B.a)(Object(B.a)({},He),{},{offsetWidth:Je,offsetHeight:Se});he==null||he($e,Ce,Me),Re&&Promise.resolve().then(function(){Re($e,Ce)})}},[]);return R.useEffect(function(){var Ce=Object(_.a)(pe.current)||Object(_.a)(ce.current);return Ce&&!ge&&s(Ce,me),function(){return l(Ce,me)}},[pe.current,ge]),R.createElement(S,{ref:ce},oe?R.cloneElement(Te,{ref:ye}):Te)}var y="rc-observer-key";function h(fe){var Te=fe.children,ge=Object(D.a)(Te);return ge.map(function(pe,ce){var he=(pe==null?void 0:pe.key)||"".concat(y,"-").concat(ce);return R.createElement(w,Object(ne.a)({},fe,{key:he}),pe)})}h.Collection=m;var c=h,u=te("bT9E"),a=te("TSYQ"),g=te.n(a),p=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,v=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],k={},F;function j(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ge=fe.getAttribute("id")||fe.getAttribute("data-reactid")||fe.getAttribute("name");if(Te&&k[ge])return k[ge];var pe=window.getComputedStyle(fe),ce=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),he=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),J=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),oe=v.map(function(ye){return"".concat(ye,":").concat(pe.getPropertyValue(ye))}).join(";"),q={sizingStyle:oe,paddingSize:he,borderSize:J,boxSizing:ce};return Te&&ge&&(k[ge]=q),q}function W(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=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(p)),F.value=fe.value||fe.placeholder||"";var ye=Number.MIN_SAFE_INTEGER,we=Number.MAX_SAFE_INTEGER,me=F.scrollHeight,Ce;if(oe==="border-box"?me+=J:oe==="content-box"&&(me-=he),ge!==null||pe!==null){F.value=" ";var De=F.scrollHeight-he;ge!==null&&(ye=De*ge,oe==="border-box"&&(ye=ye+he+J),me=Math.max(ye,me)),pe!==null&&(we=De*pe,oe==="border-box"&&(we=we+he+J),Ce=me>we?"":"hidden",me=Math.min(we,me))}return{height:me,minHeight:ye,maxHeight:we,overflowY:Ce,resize:"none"}}var O=te("Gytx"),P=te.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)(ge,fe);var Te=Object(U.a)(ge);function ge(pe){var ce;return Object(V.a)(this,ge),ce=Te.call(this,pe),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,we=he.className,me=he.disabled,Ce=ce.state,De=Ce.textareaStyles,Re=Ce.resizeStatus,Me=Object(u.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Oe=g()(oe,we,Object(I.a)({},"".concat(oe,"-disabled"),me));"value"in Me&&(Me.value=Me.value||"");var Ae=Object(B.a)(Object(B.a)(Object(B.a)({},ce.props.style),De),Re===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:Oe,style:Ae,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:H.NONE},ce}return Object(A.a)(ge,[{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()}}]),ge}(R.Component),Z=X,re=function(fe){Object(G.a)(ge,fe);var Te=Object(U.a)(ge);function ge(pe){var ce;Object(V.a)(this,ge),ce=Te.call(this,pe),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 pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return ce.state={value:he},ce}return Object(A.a)(ge,[{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}}]),ge}(R.Component),Ee=Ge.default=re},ZW9T:function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return S});var ne=te("k1fw"),V=te("miYZ"),A=te("tsqr"),G=te("rAM+"),U=te("tJVT"),R=te("PpiC"),B=te("cDcd"),I=te.n(B),D=te("bdgK");function L(f,m,w,y,h){var c=m.getWordUntilPosition(w),u={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=y.map(function(g){return{label:g,kind:f.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return h.map(function(g){a.push(Object(ne.a)(Object(ne.a)({},g),{},{range:u}))}),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(u,a){var g=L(f,u,a,w,[m]);return{suggestions:g}}});var y=["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(u,a){var g=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=L(f,u,a,y,g);return{suggestions:p}}});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(u,a){var g=[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}],p=L(f,u,a,h,g);return{suggestions:p}}})},_="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=te("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 y=d[f[w]];if(y)return y}return m[0]}return d[m]||m}var s=null,l=Ge.b=function(f){var m=f.width,w=m===void 0?"100%":m,y=f.height,h=y===void 0?"100%":y,c=f.value,u=f.language,a=u===void 0?"javascript":u,g=f.style,p=g===void 0?{}:g,v=f.options,k=v===void 0?{}:v,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,Ee=re===void 0?!1:re,fe=f.onChange,Te=fe===void 0?T:fe,ge=f.editorDidMount,pe=ge===void 0?T:ge,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)(),we=Object(B.useRef)({}),me=Object(B.useRef)(),Ce=Object(B.useRef)(!1),De=Object(B.useRef)(),Re=Object(B.useState)(!1),Me=Object(U.a)(Re,2),Oe=Me[0],Ae=Me[1];function We(){var ee;return ye.current&&(ee=new D.default(function(ie){var be=Object(G.a)(ie),_e;try{for(be.s();!(_e=be.n()).done;){var Ue=_e.value;(Ue.target.offsetHeight>0||Ue.target.offsetWidth>0)&&we.current.instance.layout()}}catch(tt){be.e(tt)}finally{be.f()}}),ee.observe(ye.current)),ee}function Ye(){A.b.warn(decodeURIComponent(_))}var Xe=function(){var ie=we.current.instance;if(c!=null&&ie&&Oe){var be=ie.getModel();be&&c!==be.getValue()&&(b=!0,be.setValue(c),ie.layout(),b=!1)}};Object(B.useEffect)(function(){me.current&&clearTimeout(me.current),me.current=setTimeout(function(){Xe()},500)},[c,Oe,we.current]);function Be(){var ee=we.current.instance;if(ee){var ie=ee.getSelection(),be=we.current.pastePos||{},_e=new s.Range(be.startLineNumber||ie.endLineNumber,be.startColumn||ie.endColumn,be.endLineNumber||ie.endLineNumber,be.endColumn||ie.endColumn);setTimeout(function(){ee.executeEdits("",[{range:_e,text:""}])},300)}}function qe(ee){(window.navigator.platform.match("Mac")?ee.metaKey:ee.ctrlKey)&&ee.keyCode==83&&(ee.preventDefault(),H())}var He=function(){if(Z&&we.current.instance){var ie=we.current.instance.getContentHeight();$(ie<h?h:ie)}else $(h)};function Je(ee){var ie=document.createEvent("MouseEvents");ie.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ee.dispatchEvent(ie)}function Se(ee,ie){var be=window.URL||window.webkitURL||window,_e=new Blob([ie]),Ue=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ue.href=be.createObjectURL(_e),Ue.download=ee,Je(Ue)}Object(B.useEffect)(function(){He()},[He]),Object(B.useEffect)(function(){ye.current&&!Oe&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(ee){try{s=ee,we.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=we.current.instance;if(pe(ie,s),setTimeout(function(){He(),we.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Se(oe||"educoder.txt",ie.getValue())}})},500),we.current.subscription=ie.onDidChangeModelContent(function(_e){Ce.current?clearTimeout(De.current):(He(),Te(ie.getValue(),_e)),De.current=setTimeout(function(){Ce.current=!1},500)}),window.Monaco||E(s),Ee&&(ie.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ye(),null}),ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ye(),null})),window.Monaco=s,P&&ie.onDidBlurEditorWidget(function(){P(ie.getValue())}),he&&ie.onDidFocusEditorText(function(){he(ie.getValue())}),Ee){ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ye(),null}),ie.onDidPaste(function(_e){we.current.pastePos=_e});try{window.addEventListener("paste",Be)}catch(_e){}}var be=We();return Ae(!0),function(){var _e=we.current.instance;_e.dispose();var Ue=_e.getModel();Ue&&Ue.dispose(),we.current.subscription&&we.current.subscription.dispose(),Ee&&window.removeEventListener("paste",Be),be.unobserve(ye.current)}}catch(_e){}})},[]),Object(B.useEffect)(function(){var ee=we.current.instance;if(ee&&Oe)return document.addEventListener("keydown",qe,!1),function(){document.removeEventListener("keydown",qe)}},[H,Oe]),Object(B.useEffect)(function(){var ee=we.current.instance;if(ee&&Oe){var ie=o(a);s.editor.setModelLanguage(ee.getModel(),ie),console.log("language:",a,ee.getModel(),ie)}},[a,Oe]),Object(B.useEffect)(function(){var ee=we.current.instance;ee&&Oe&&s.editor.setTheme(O)},[O,Oe]),Object(B.useEffect)(function(){var ee=we.current.instance;ee&&Oe&&(ee.updateOptions(Object(ne.a)({},k)),setTimeout(function(){ee.getModel().updateOptions(Object(ne.a)({},k))},200))},[JSON.stringify(k),Oe]),Object(B.useEffect)(function(){var ee=we.current.instance;ee&&Oe&&ee.layout()},[w,h,Oe]);var $e=Object(B.useState)(C(w)),Ke=Object(U.a)($e,2),Le=Ke[0],ke=Ke[1],le=Object(B.useState)(C(h)),ae=Object(U.a)(le,2),ue=ae[0],$=ae[1],Q=Object(ne.a)(Object(ne.a)({},p),{},{width:Le,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,y=f.height,h=y===void 0?"100%":y,c=f.original,u=f.modified,a=f.language,g=f.options,p=g===void 0?{}:g,v=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 v.current&&(re=new D.default(function(Ee){var fe=Object(G.a)(Ee),Te;try{for(fe.s();!(Te=fe.n()).done;){var ge=Te.value;(ge.target.offsetHeight>0||ge.target.offsetWidth>0)&&Z.layout()}}catch(pe){fe.e(pe)}finally{fe.f()}}),re.observe(v.current)),re}Object(B.useEffect)(function(){v.current&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(Z){s=Z;var re=s.editor.createDiffEditor(v.current,Object(ne.a)(Object(ne.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},p),{},{wordWrap:!0}));W(re);var Ee=O(re);return function(){re.dispose();var fe=re.getModel();fe&&fe.dispose(),Ee.unobserve(v.current)}})},[]),Object(B.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(u,a)})},[c,u,a,j]);var P=C(w),H=C(h),X={width:P,height:H};return I.a.createElement("div",{className:"my-diff-editor",ref:v,style:X})}},ZpRC:function(ot,Ge,te){"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(De){return De!==d};if(!ne(E))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,S=[],f=E;ne(f)&&s(f);){if((f=f.parentElement)===l){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,y=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=E.getBoundingClientRect(),u=c.height,a=c.width,g=c.top,p=c.right,v=c.bottom,k=c.left,F=T==="start"||T==="nearest"?g:T==="end"?v:g+u/2,j=b==="center"?k+a/2:b==="end"?p:k,W=[],O=0;O<S.length;O++){var P=S[O],H=P.getBoundingClientRect(),X=H.height,Z=H.width,re=H.top,Ee=H.right,fe=H.bottom,Te=H.left;if(C==="if-needed"&&g>=0&&k>=0&&v<=w&&p<=m&&g>=re&&v<=fe&&k>=Te&&p<=Ee)return W;var ge=getComputedStyle(P),pe=parseInt(ge.borderLeftWidth,10),ce=parseInt(ge.borderTopWidth,10),he=parseInt(ge.borderRightWidth,10),J=parseInt(ge.borderBottomWidth,10),oe=0,q=0,ye="offsetWidth"in P?P.offsetWidth-P.clientWidth-pe-he:0,we="offsetHeight"in P?P.offsetHeight-P.clientHeight-ce-J:0;if(l===P)oe=T==="start"?F:T==="end"?F-w:T==="nearest"?G(h,h+w,w,ce,J,h+F,h+F+u,u):F-w/2,q=b==="start"?j:b==="center"?j-m/2:b==="end"?j-m:G(y,y+m,m,pe,he,y+j,y+j+a,a),oe=Math.max(0,oe+h),q=Math.max(0,q+y);else{oe=T==="start"?F-re-ce:T==="end"?F-fe+J+we:T==="nearest"?G(re,fe,X,ce,J+we,F,F+u,u):F-(re+X/2)+we/2,q=b==="start"?j-Te-pe:b==="center"?j-(Te+Z/2)+ye/2:b==="end"?j-Ee+he+ye:G(Te,Ee,Z,pe,he+ye,j,j+a,a);var me=P.scrollLeft,Ce=P.scrollTop;F+=Ce-(oe=Math.max(0,Math.min(Ce+oe,P.scrollHeight-X+we))),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=Ge.a=D},Zss7:function(ot,Ge,te){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,we,me,Ce;return oe=J.r/255,q=J.g/255,ye=J.b/255,oe<=.03928?we=oe/12.92:we=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?Ce=ye/12.92:Ce=V.pow((ye+.055)/1.055,2.4),.2126*we+.7152*me+.0722*Ce},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 we=L(J);q="#"+s(we._r,we._g,we._b,we._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,we=!oe&&ye&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return we?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(y,arguments)},desaturate:function(){return this._applyModification(l,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(p,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(u,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]=Ee(J[ye]));J=q}return L(J,oe)};function E(J){var oe={r:0,g:0,b:0},q=1,ye=null,we=null,me=null,Ce=!1,De=!1;return typeof J=="string"&&(J=ce(J)),typeof J=="object"&&(pe(J.r)&&pe(J.g)&&pe(J.b)?(oe=_(J.r,J.g,J.b),Ce=!0,De=String(J.r).substr(-1)==="%"?"prgb":"rgb"):pe(J.h)&&pe(J.s)&&pe(J.v)?(ye=Ee(J.s),we=Ee(J.v),oe=b(J.h,ye,we),Ce=!0,De="hsv"):pe(J.h)&&pe(J.s)&&pe(J.l)&&(ye=Ee(J.s),me=Ee(J.l),oe=C(J.h,ye,me),Ce=!0,De="hsl"),J.hasOwnProperty("a")&&(q=J.a)),q=W(q),{ok:Ce,format:J.format||De,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),we=B(J,oe,q),me,Ce,De=(ye+we)/2;if(ye==we)me=Ce=0;else{var Re=ye-we;Ce=De>.5?Re/(2-ye-we):Re/(ye+we);switch(ye){case J:me=(oe-q)/Re+(oe<q?6:0);break;case oe:me=(q-J)/Re+2;break;case q:me=(J-oe)/Re+4;break}me/=6}return{h:me,s:Ce,l:De}}function C(J,oe,q){var ye,we,me;J=O(J,360),oe=O(oe,100),q=O(q,100);function Ce(Me,Oe,Ae){return Ae<0&&(Ae+=1),Ae>1&&(Ae-=1),Ae<1/6?Me+(Oe-Me)*6*Ae:Ae<1/2?Oe:Ae<2/3?Me+(Oe-Me)*(2/3-Ae)*6:Me}if(oe===0)ye=we=me=q;else{var De=q<.5?q*(1+oe):q+oe-q*oe,Re=2*q-De;ye=Ce(Re,De,J+1/3),we=Ce(Re,De,J),me=Ce(Re,De,J-1/3)}return{r:ye*255,g:we*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),we=B(J,oe,q),me,Ce,De=ye,Re=ye-we;if(Ce=ye===0?0:Re/ye,ye==we)me=0;else{switch(ye){case J:me=(oe-q)/Re+(oe<q?6:0);break;case oe:me=(q-J)/Re+2;break;case q:me=(J-oe)/Re+4;break}me/=6}return{h:me,s:Ce,v:De}}function b(J,oe,q){J=O(J,360)*6,oe=O(oe,100),q=O(q,100);var ye=V.floor(J),we=J-ye,me=q*(1-oe),Ce=q*(1-we*oe),De=q*(1-(1-we)*oe),Re=ye%6,Me=[q,Ce,me,me,De,q][Re],Oe=[De,q,q,Ce,me,me][Re],Ae=[me,me,De,q,q,Ce][Re];return{r:Me*255,g:Oe*255,b:Ae*255}}function d(J,oe,q,ye){var we=[re(R(J).toString(16)),re(R(oe).toString(16)),re(R(q).toString(16))];return ye&&we[0].charAt(0)==we[0].charAt(1)&&we[1].charAt(0)==we[1].charAt(1)&&we[2].charAt(0)==we[2].charAt(1)?we[0].charAt(0)+we[1].charAt(0)+we[2].charAt(0):we.join("")}function o(J,oe,q,ye,we){var me=[re(R(J).toString(16)),re(R(oe).toString(16)),re(R(q).toString(16)),re(fe(ye))];return we&&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 we=[re(fe(ye)),re(R(J).toString(16)),re(R(oe).toString(16)),re(R(q).toString(16))];return we.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 l(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 y(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 u(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 g(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 p(J,oe,q){oe=oe||6,q=q||30;var ye=L(J).toHsl(),we=360/q,me=[L(J)];for(ye.h=(ye.h-(we*oe>>1)+720)%360;--oe;)ye.h=(ye.h+we)%360,me.push(L(ye));return me}function v(J,oe){oe=oe||6;for(var q=L(J).toHsv(),ye=q.h,we=q.s,me=q.v,Ce=[],De=1/oe;oe--;)Ce.push(L({h:ye,s:we,v:me})),me=(me+De)%1;return Ce}L.mix=function(J,oe,q){q=q===0?0:q||50;var ye=L(J).toRgb(),we=L(oe).toRgb(),me=q/100,Ce={r:(we.r-ye.r)*me+ye.r,g:(we.g-ye.g)*me+ye.g,b:(we.b-ye.b)*me+ye.b,a:(we.a-ye.a)*me+ye.a};return L(Ce)},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),we,me;me=!1,we=he(q);switch(we.level+we.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,we=0,me,Ce,De,Re;q=q||{},Ce=q.includeFallbackColors,De=q.level,Re=q.size;for(var Me=0;Me<oe.length;Me++)me=L.readability(J,oe[Me]),me>we&&(we=me,ye=L(oe[Me]));return L.isReadable(J,ye,{level:De,size:Re})||!Ce?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 Ee(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 ge=function(){var J="[-\\+]?\\d+%?",oe="[-\\+]?\\d*\\.\\d+%?",q="(?:"+oe+")|(?:"+J+")",ye="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",we="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+ye),rgba:new RegExp("rgba"+we),hsl:new RegExp("hsl"+ye),hsla:new RegExp("hsla"+we),hsv:new RegExp("hsv"+ye),hsva:new RegExp("hsva"+we),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 pe(J){return!!ge.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=ge.rgb.exec(J))?{r:q[1],g:q[2],b:q[3]}:(q=ge.rgba.exec(J))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=ge.hsl.exec(J))?{h:q[1],s:q[2],l:q[3]}:(q=ge.hsla.exec(J))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=ge.hsv.exec(J))?{h:q[1],s:q[2],v:q[3]}:(q=ge.hsva.exec(J))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=ge.hex8.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),a:Te(q[4]),format:oe?"name":"hex8"}:(q=ge.hex6.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),format:oe?"name":"hex"}:(q=ge.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=ge.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(Ge,te,Ge,ot),ne!==void 0&&(ot.exports=ne))})(Math)},bT9E:function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return V});var ne=te("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,Ge,te){},dejd:function(ot,Ge,te){},dmUQ:function(ot,Ge,te){"use strict";var ne=te("Ff2n"),V=te("rePB"),A=te("1OyB"),G=te("vuIU"),U=te("Ji7U"),R=te("md7G"),B=te("foSv"),I=te("cDcd"),D=te.n(I),L=te("TSYQ"),E=te.n(L),_=te("4IlW");function M(u,a){var g=Object.keys(u);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(u,v).enumerable})),g.push.apply(g,p)}return g}function C(u){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?M(Object(g),!0).forEach(function(p){Object(V.a)(u,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(g)):M(Object(g)).forEach(function(p){Object.defineProperty(u,p,Object.getOwnPropertyDescriptor(g,p))})}return u}function T(u){var a=b();return function(){var p=Object(B.a)(u),v;if(a){var k=Object(B.a)(this).constructor;v=Reflect.construct(p,arguments,k)}else v=p.apply(this,arguments);return Object(R.a)(this,v)}}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(u){return!1}}function d(){}function o(u){u.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,S=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},w=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},y=function(u){Object(U.a)(g,u);var a=T(g);function g(p){var v;Object(A.a)(this,g),v=a.call(this,p),v.onKeyDown=function(j){var W=v.props,O=W.onKeyDown,P=W.onPressEnter;if(j.keyCode===_.a.UP){var H=v.getRatio(j);v.up(j,H,null),v.stop()}else if(j.keyCode===_.a.DOWN){var X=v.getRatio(j);v.down(j,X,null),v.stop()}else j.keyCode===_.a.ENTER&&P&&P(j);if(v.recordCursorPosition(),v.lastKeyCode=j.keyCode,O){for(var Z=arguments.length,re=new Array(Z>1?Z-1:0),Ee=1;Ee<Z;Ee++)re[Ee-1]=arguments[Ee];O.apply(void 0,[j].concat(re))}},v.onKeyUp=function(j){var W=v.props.onKeyUp;if(v.stop(),v.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))}},v.onChange=function(j){var W=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(j)),v.setState({inputValue:v.rawInput}),W(v.toNumber(v.rawInput))},v.onMouseUp=function(){var j=v.props.onMouseUp;v.recordCursorPosition(),j&&j.apply(void 0,arguments)},v.onFocus=function(){var j;v.setState({focused:!0}),(j=v.props).onFocus.apply(j,arguments)},v.onBlur=function(){var j=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var W=v.getCurrentValidValue(v.state.inputValue),O=v.setValue(W,d);if(j){var P=v.input.value,H=v.getInputDisplayValue({focus:!1,value:O});v.input.value=H&&Number(H),j.apply(void 0,arguments),v.input.value=P}},v.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},v.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},v.getPrecision=function(j){if(m(v.props.precision))return v.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},v.getInputDisplayValue=function(j){var W=j||v.state,O=W.focused,P=W.inputValue,H=W.value,X;O?X=P:X=v.toPrecisionAsStep(H),X==null&&(X="");var Z=v.formatWrapper(X);return m(v.props.decimalSeparator)&&(Z=Z.toString().replace(".",v.props.decimalSeparator)),Z},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(j){}},v.restoreByAfter=function(j){if(j===void 0)return!1;var W=v.input.value,O=W.lastIndexOf(j);if(O===-1)return!1;var P=v.cursorBefore.length;return v.lastKeyCode===_.a.DELETE&&v.cursorBefore.charAt(P-1)===j[0]?(v.fixCaret(P,P),!0):O+j.length===W.length?(v.fixCaret(O,O),!0):!1},v.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,O){var P=j.substring(O);return v.restoreByAfter(P)})},v.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(j,W,O){v.pressingUpOrDown=!0,v.step("down",j,W,O)},v.up=function(j,W,O){v.pressingUpOrDown=!0,v.step("up",j,W,O)},v.saveInput=function(j){v.input=j};var k=p.value;k===void 0&&(k=p.defaultValue),v.state={focused:p.autoFocus};var F=v.getValidValue(v.toNumber(k));return v.state=C(C({},v.state),{},{inputValue:v.toPrecisionAsStep(F),value:F}),v}return Object(G.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var k=this.props,F=k.value,j=k.onChange,W=k.max,O=k.min,P=this.state.focused;if(v){if(!w(v.value,F)||!w(v.max,W)||!w(v.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&&v.max!==W&&typeof Z=="number"&&Z>W&&j&&j(W),"min"in this.props&&v.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(Ee){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(v){var k=v;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(v){var k=v.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(v){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(v);return isNaN(j)?v:(j<k&&(j=k),j>F&&(j=F),j)}},{key:"setValue",value:function(v,k){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),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(v)},k),Z&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(v){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(v);return v?Math.max(H,O+P):O+P}},{key:"getPrecisionFactor",value:function(v){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(v,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(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var k=Math.abs(this.getMaxPrecision(v));return isNaN(k)?v.toString():Number(v).toFixed(k)}},{key:"toNumber",value:function(v){var k=this.props.precision,F=this.state.focused,j=v&&v.length>16&&F;return this.isNotCompleteNumber(v)||j?v:m(k)?Math.round(v*Math.pow(10,k))/Math.pow(10,k):Number(v)}},{key:"upStep",value:function(v,k){var F=this.props.step,j=this.getPrecisionFactor(v,k),W=Math.abs(this.getMaxPrecision(v,k)),O=((j*v+j*F*k)/j).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(v,k){var F=this.props.step,j=this.getPrecisionFactor(v,k),W=Math.abs(this.getMaxPrecision(v,k)),O=((j*v-j*F*k)/j).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(v,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(v,"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[v](k,j,!0)},W?l:S)}},{key:"fixCaret",value:function(v,k){if(v===void 0||k===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(v!==F||k!==j)&&this.input.setSelectionRange(v,k)}catch(W){}}},{key:"render",value:function(){var v,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,Ee=k.min,fe=k.style,Te=k.title,ge=k.onMouseEnter,pe=k.onMouseLeave,ce=k.onMouseOver,he=k.onMouseOut,J=k.required,oe=k.onClick,q=k.tabIndex,ye=k.type,we=k.placeholder,me=k.id,Ce=k.inputMode,De=k.pattern,Re=k.step,Me=k.maxLength,Oe=k.autoFocus,Ae=k.name,We=k.onPaste,Ye=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,He=Be.focused,Je=E()(F,(v={},Object(V.a)(v,Z,!!Z),Object(V.a)(v,"".concat(F,"-disabled"),j),Object(V.a)(v,"".concat(F,"-focused"),He),v)),Se={};Object.keys(Xe).forEach(function(ie){(ie.substr(0,5)==="data-"||ie.substr(0,5)==="aria-"||ie==="role")&&(Se[ie]=Xe[ie])});var $e=!W&&!j,Ke=this.getInputDisplayValue(null),Le=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=re),ke=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=Ee),le=Le||j||W,ae=ke||j||W,ue=E()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),le)),$=E()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),ae)),Q=O?{onTouchStart:le?d:this.up,onTouchEnd:this.stop}:{onMouseDown:le?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=O?{onTouchStart:ae?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:Je,style:fe,title:Te,onMouseEnter:ge,onMouseLeave:pe,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":le,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"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,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":Ee,"aria-valuemax":re,"aria-valuenow":qe,required:J,type:ye,placeholder:we,onPaste:We,onClick:oe,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:q,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:$e?this.onKeyDown:d,onKeyUp:$e?this.onKeyUp:d,autoFocus:Oe,maxLength:Me,readOnly:W,disabled:j,max:re,min:Ee,step:Re,name:Ae,title:Te,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ke),pattern:De,inputMode:Ce,onInput:Ye},Se))))}}]),g}(D.a.Component);y.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=y,c=Ge.a=h},h78n:function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return v});var ne=te("cDcd"),V=te.n(ne),A=te("TSYQ"),G=te.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,Ee=j.trailColor,fe=j.trailWidth,Te=j.transition,ge=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ge.gapPosition;var pe=Array.isArray(O)?O:[O],ce=Array.isArray(H)?H:[H],he=R(pe),J=I(he,1),oe=J[0],q=Z/2,ye=100-Z/2,we="M ".concat(X==="round"?q:0,",").concat(q,`
|
|
L `).concat(X==="round"?ye:100,",").concat(q),me="0 0 100 ".concat(Z),Ce=0;return V.a.createElement("svg",B({className:G()("".concat(P,"-line"),W),viewBox:me,preserveAspectRatio:"none",style:re},ge),V.a.createElement("path",{className:"".concat(P,"-line-trail"),d:we,strokeLinecap:X,stroke:Ee,strokeWidth:fe||Z,fillOpacity:"0"}),pe.map(function(De,Re){var Me={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(Ce,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Oe=ce[Re]||ce[ce.length-1];return Ce+=De,V.a.createElement("path",{key:Re,className:"".concat(P,"-line-path"),d:we,strokeLinecap:X,stroke:Oe,strokeWidth:Z,fillOpacity:"0",ref:oe[Re],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)||l()}function l(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(F,j){if(!F)return;if(typeof F=="string")return 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 y(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 u(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function g(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,Ee=0,fe=-2*X;switch(H){case"left":Z=-X,re=0,Ee=2*X,fe=0;break;case"right":Z=X,re=0,Ee=-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(Ee,",").concat(-fe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-Ee,",").concat(fe),ge=Math.PI*2*X,pe={stroke:W,strokeDasharray:"".concat(j/100*(ge-P),"px ").concat(ge,"px"),strokeDashoffset:"-".concat(P/2+F/100*(ge-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:pe}}var p=function(j){var W=j.prefixCls,O=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,X=j.gapPosition,Z=j.trailColor,re=j.strokeLinecap,Ee=j.style,fe=j.className,Te=j.strokeColor,ge=j.percent,pe=y(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ce=Object(ne.useMemo)(function(){return c+=1,c},[]),he=g(0,100,Z,O,H,X),J=he.pathString,oe=he.pathStyle,q=a(ge),ye=a(Te),we=ye.find(function(Me){return Object.prototype.toString.call(Me)==="[object Object]"}),me=R(q),Ce=s(me,1),De=Ce[0],Re=function(){var Oe=0;return q.map(function(Ae,We){var Ye=ye[We]||ye[ye.length-1],Xe=Object.prototype.toString.call(Ye)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ce,")"):"",Be=g(Oe,Ae,Ye,O,H,X);return Oe+=Ae,V.a.createElement("path",{key:We,className:"".concat(W,"-circle-path"),d:Be.pathString,stroke:Xe,strokeLinecap:re,strokeWidth:O,opacity:Ae===0?0:1,fillOpacity:"0",style:Be.pathStyle,ref:De[We]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),fe),viewBox:"0 0 100 100",style:Ee},pe),we&&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(we).sort(function(Me,Oe){return u(Me)-u(Oe)}).map(function(Me,Oe){return V.a.createElement("stop",{key:Oe,offset:Me,stopColor:we[Me]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:Z,strokeLinecap:re,strokeWidth:P||O,fillOpacity:"0",style:oe}),Re().reverse())};p.defaultProps=U;var v=p,k={Line:d,Circle:v}},kSUc:function(ot,Ge,te){},lZu9:function(ot,Ge,te){(function(ne){ne(te("VrN/"),te("1eCo"),te("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 l(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=u,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,Ee=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,Ee)){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 ge=!X&&!re&&!P.prevLine.header&&(!Ee||!Z)&&!P.prevLine.fencedCodeEnd,pe=(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(!pe&&!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=y,A.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!ge||!Ee)&&!P.quote&&P.list===!1&&!P.code&&!pe&&!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(pe)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=u,P.block=m,P.htmlState=null)}return H}function y(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=u,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,X?l(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 u(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 Ee="^\\s*(?:[^"+re+"\\\\]+|\\\\\\\\|\\\\.)"+re;if(O.match(new RegExp(Ee),!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 ge=h(P);return P.code=0,ge}else return P.formatting=fe,h(P)}else if(P.code)return h(P);if(Z==="\\"&&(O.next(),A.highlightFormatting)){var pe=h(P),ce=B.formatting+"-escape";return pe?pe+" "+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 pe=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=g,pe}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 pe=h(P);return P.linkText=!1,P.inline=P.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?g:u,pe}if(Z==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var pe=h(P);return pe?pe+=" ":pe="",pe+B.linkInline}if(Z==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var pe=h(P);return pe?pe+=" ":pe="",pe+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),l(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()||" ",we=!/\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)),Ce=null,De=null;if(oe%2&&(!P.em&&we&&(Z==="*"||!me||d.test(q))?Ce=!0:P.em==Z&&me&&(Z==="*"||!we||d.test(ye))&&(Ce=!1)),oe>1&&(!P.strong&&we&&(Z==="*"||!me||d.test(q))?De=!0:P.strong==Z&&me&&(Z==="*"||!we||d.test(ye))&&(De=!1)),De!=null||Ce!=null){A.highlightFormatting&&(P.formatting=Ce==null?"strong":De==null?"em":"strong em"),Ce===!0&&(P.em=Z),De===!0&&(P.strong=Z);var ge=h(P);return Ce===!1&&(P.em=!1),De===!1&&(P.strong=!1),ge}}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 ge=h(P);return P.strikethrough=!1,ge}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 Re=h(P);return P.emoji=!1,Re}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=u,A.highlightFormatting&&(P.formatting="link");var X=h(P);return X?X+=" ":X="",X+B.linkInline}return O.match(/^[^>]+/,!0),B.linkInline}function g(O,P){if(O.eatSpace())return null;var H=O.next();return H==="("||H==="["?(P.f=P.inline=v(H==="("?")":"]"),A.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(O){return function(P,H){var X=P.next();if(X===O){H.f=H.inline=u,A.highlightFormatting&&(H.formatting="link-string");var Z=h(H);return H.linkHref=!1,Z}return P.match(p[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,u)}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=u,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:u,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(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,Ge,te){(function(ne){ne(te("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,l){this.line=o,this.ch=s,this.cm=d,this.text=d.getLine(o),this.min=l?Math.max(l.from,d.firstLine()):d.firstLine(),this.max=l?Math.min(l.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),l=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,l?"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),l=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,l?"selfClose":"regular"}}function T(d,o){for(var s=[];;){var l=M(d),S,f=d.line,m=d.ch-(l?l[0].length:0);if(!l||!(S=E(d)))return;if(S=="selfClose")continue;if(l[1]){for(var w=s.length-1;w>=0;--w)if(s[w]==l[2]){s.length=w;break}if(w<0&&(!o||o==l[2]))return{tag:l[2],from:V(f,m),to:V(d.line,d.ch)}}else s.push(l[2])}}function b(d,o){for(var s=[];;){var l=C(d);if(!l)return;if(l=="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 l=M(s);if(!l||s.line!=o.line)return;var S=E(s);if(!S)return;if(!l[1]&&S!="selfClose"){var f=V(s.line,s.ch),m=T(s,l[2]);return m&&A(m.from,f)>0?{from:f,to:m.from}:null}}}),ne.findMatchingTag=function(d,o,s){var l=new B(d,o.line,o.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var S=E(l),f=S&&V(l.line,l.ch),m=S&&_(l);if(!S||!m||A(l,o)>0)return;var w={from:V(l.line,l.ch),to:f,tag:m[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:m[1]?{open:b(l,m[2]),close:w,at:"close"}:(l=new B(d,f.line,f.ch,s),{open:w,close:T(l,m[2]),at:"open"})},ne.findEnclosingTag=function(d,o,s,l){for(var S=new B(d,o.line,o.ch,s);;){var f=b(S,l);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,l){var S=new B(d,o.line,o.ch,l?{from:0,to:l}:null);return T(S,s)}})},p5ED:function(ot,Ge,te){"use strict";var ne=te("+L6B"),V=te("2/Rp"),A=te("5Dmo"),G=te("3S7+"),U=te("k1fw"),R=te("tJVT"),B=te("cDcd"),I=te.n(B),D=te("vHTk"),L=te.n(D),E=te("yEEn"),_=te("ZW9T"),M=te("1vsH");Ge.a=function(C){var T=C.name,b=C.data,d=C.theme,o=C.type,s=C.filename,l=C.monacoEditor,S=C.className,f=C.style,m=C.close,w=C.onClose,y=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),u=c[0],a=c[1],g=Object(B.useState)(""),p=Object(R.a)(g,2),v=p[0],k=p[1],F=Object(B.useRef)();s&&(l.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(y&&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,l)),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,Ge,te){},"rAM+":function(ot,Ge,te){"use strict";te.d(Ge,"a",function(){return V});var ne=te("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,Ge){const te=/[&<>"']/,ne=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},U=y=>G[y];function R(y,h){if(h){if(te.test(y))return y.replace(ne,U)}else if(V.test(y))return y.replace(A,U);return y}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(y){return y.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(y,h){y=y.source||y,h=h||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(D,"$1"),y=y.replace(u,a),c),getRegex:()=>new RegExp(y,h)};return c}const E=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(y,h,c){if(y){let u;try{u=decodeURIComponent(I(c)).replace(E,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}h&&!_.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const C={},T=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,h){C[" "+y]||(T.test(y)?C[" "+y]=y+"/":C[" "+y]=f(y,"/",!0)),y=C[" "+y];const c=y.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:y.replace(b,"$1")+h:h.charAt(0)==="/"?c?h:y.replace(d,"$1")+h:y+h}const s={exec:function(){}};function l(y){let h=1,c,u;for(;h<arguments.length;h++){c=arguments[h];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(y[u]=c[u])}return y}function S(y,h){const c=y.replace(/\|/g,(g,p,v)=>{let k=!1,F=p;for(;--F>=0&&v[F]==="\\";)k=!k;return k?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>h)u.splice(h);else for(;u.length<h;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function f(y,h,c){const u=y.length;if(u===0)return"";let a=0;for(;a<u;){const g=y.charAt(u-a-1);if(g===h&&!c)a++;else if(g!==h&&c)a++;else break}return y.substr(0,u-a)}function m(y,h){if(y.indexOf(h[1])===-1)return-1;const c=y.length;let u=0,a=0;for(;a<c;a++)if(y[a]==="\\")a++;else if(y[a]===h[0])u++;else if(y[a]===h[1]&&(u--,u<0))return a;return-1}function w(y){y&&y.sanitize&&!y.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:l,splitCells:S,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:w}},ulZh:function(ot,Ge,te){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],l=arguments.length,S,f;if(s.fn){s.once&&this.removeListener(_,s.fn,void 0,!0);switch(l){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(l-1);f<l;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(l){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(l-1);w<l;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=[],l=d.length;o<l;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"),l;l=s.exec(b);){if(l[3]==="dll-reference")continue;T[C].push(l[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+R,"g");l=s.exec(b);)_[l[2]]||(T[C].push(l[1]),_[l[2]]=A(l[1]).m),T[l[2]]=T[l[2]]||[],T[l[2]].push(l[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],l=C[s],S=l.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),l=new window.Worker(s);return l.objectURL=s,l}},"./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 l(){return l=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(u[p]=g[p])}return u},l.apply(this,arguments)}function S(u,a){var g=Object.keys(u);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(u,v).enumerable})),g.push.apply(g,p)}return g}function f(u){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?S(Object(g),!0).forEach(function(p){m(u,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(g)):S(Object(g)).forEach(function(p){Object.defineProperty(u,p,Object.getOwnPropertyDescriptor(g,p))})}return u}function m(u,a,g){return a in u?Object.defineProperty(u,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):u[a]=g,u}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},y()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:I.default,timelineController:L.TimelineController,audioStreamController:U.default,audioTrackController:R.default,emeController:M.default,cmcdController:C.default});function y(){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(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},u,a)}function c(u){var a=u.loader;if(a!==b.default&&a!==T.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var g=Object(b.fetchSupported)();g&&(u.loader=b.default,u.progressive=!0,u.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 l;this.fragCurrent=s,this.partCurrent=(l=o.part)!=null?l: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,l=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(!l||f.paused||!f.playbackRate||!f.readyState)return;var y=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(y<=500*w/h)return;var c=s.levels,u=s.minAutoLevel,a=c[d.level],g=m.total||Math.max(m.loaded,Math.round(w*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/y),v=(g-m.loaded)/p,k=f.currentTime,F=(B.BufferHelper.bufferInfo(f,k,S.maxBufferHole).end-k)/h;if(F>=2*w/h||v<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>u;W--){var O=c[W].maxBitrate;if(j=w*O/(8*.8*p),j<F)break}if(j>=v)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: `+v.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(y,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,l=o.part;if(s.type===D.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(s.sn)){var S=l?l.stats:s.stats,f=l?l.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,y=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:w,duration:y},m.realBitrate=Math.round(8*w/y)}if(s.bitrateTest){var h={stats:S,frag:s,part:l,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},T.onFragBuffered=function(d,o){var s=o.frag,l=o.part,S=l?l.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,l=s.maxAutoLevel,S=s.config,f=s.minAutoLevel,m=s.media,w=o?o.duration:d?d.duration:0,y=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,u=(B.BufferHelper.bufferInfo(m,y,S.maxBufferHole).end-y)/h,a=this.findBestLevel(c,f,l,u,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,p=S.abrBandWidthFactor,v=S.abrBandWidthUpFactor;if(!u){var k=this.bitrateTestDelay;if(k){var F=w?Math.min(w,S.maxLoadingDelay):S.maxLoadingDelay;g=F-k,L.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),p=v=1}}return a=this.findBestLevel(c,f,l,u+g,p,v),Math.max(a,0)},T.findBestLevel=function(d,o,s,l,S,f){for(var m,w=this.fragCurrent,y=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,u=c[h],a=!!(u!=null&&(m=u.details)!==null&&m!==void 0&&m.live),g=u==null?void 0:u.codecSet,p=y?y.duration:w?w.duration:0,v=s;v>=o;v--){var k=c[v];if(!k||g&&k.codecSet!==g)continue;var F=k.details,j=(y?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||p,W=void 0;v<=h?W=S*d:W=f*d;var O=c[v].maxBitrate,P=O*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(W)+"/"+O+"/"+j+"/"+l+"/"+P),W>O&&(!P||a&&!this.bitrateTestDelay||P<l))return v}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 y=1;y<arguments.length;y++){var h=arguments[y];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},s.apply(this,arguments)}function l(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,S(w,y)}function S(w,y){return S=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},S(w,y)}var f=100,m=function(w){l(y,w);function y(c,u){var a;return a=w.call(this,c,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=y.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var u=this.hls;u.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(R.Events.ERROR,this.onError,this),u.on(R.Events.BUFFER_RESET,this.onBufferReset,this),u.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var u=this.hls;u.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(R.Events.ERROR,this.onError,this),u.off(R.Events.BUFFER_RESET,this.onBufferReset,this),u.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(u,a){var g=a.frag,p=a.id,v=a.initPTS;if(p==="main"){var k=g.cc;this.initPTS[g.cc]=v,this.log("InitPTS for cc: "+k+" found from main: "+v),this.videoTrackCC=k,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&u===-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=u,this.tick()},h.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var u,a=this.levels,g=this.trackId,p=a==null||((u=a[g])===null||u===void 0)?void 0:u.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var v,k=performance.now(),F=this.retryDate;(!F||k>=F||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var 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(),Ee=B.BufferHelper.bufferInfo(this.mediaBuffer,re,this.config.maxBufferHole),fe=Object(T.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,W);fe<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},h.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},h.doTickIdle=function(){var u,a,g=this.hls,p=this.levels,v=this.media,k=this.trackId,F=g.config;if(!p||!p[k])return;if(!v&&(this.startFragRequested||!F.startFragPrefetch))return;var j=p[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)){g.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var Z=W.fragments,re=Z[0].start,Ee=O.end;if(X){var fe=this.getLoadPosition();Ee=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"),v.currentTime=re+.05))}var Te=this.getNextFragment(Ee,W);if(!Te){this.bufferFlushed=!0;return}((u=Te.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=Te.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Te,W):this.loadFragment(Te,W,Ee)},h.getMaxBufferLength=function(){var u=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(u,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(p){return new D.Level(p)})},h.onAudioTrackSwitching=function(u,a){var g=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(f):this.resetTransmuxer(),g?(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(u,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(u,a){var g,p=this.levels,v=a.details,k=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var F=p[k],j=0;if(v.live||(g=F.details)!==null&&g!==void 0&&g.live){var W=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!W)return;!F.details&&v.hasProgramDateTime&&W.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(v,W),j=v.fragments[0].start):j=this.alignPlaylists(v,F.details)}F.details=v,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(F.details,j),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=U.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(u){var a,g=u.frag,p=u.part,v=u.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 "+g.sn+" of level "+g.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[g.cc],Z=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var re=!1,Ee=p?p.index:-1,fe=Ee!==-1,Te=new C.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,v.byteLength,Ee,fe);H.push(v,Z,P,"",g,p,O.totalduration,re,Te,X)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+F);var ge=this.waitingData=this.waitingData||{frag:g,part:p,cache:new _.default,complete:!1},pe=ge.cache;pe.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,u)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(u,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(u,a){var g=a.frag,p=a.part;if(g.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(p?" p: "+p.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,p)},h.onError=function(u,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(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 g=!0,p=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);p&&p.len>.5&&(g=!this.reduceMaxBufferLength(p.len)),g&&(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(u,a){var g=a.type;g===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(u){var a,g="audio",p=this.hls,v=u.remuxResult,k=u.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=v.audio,P=v.text,H=v.id3,X=v.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),p.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:X.tracks})),O){var Z=O.startPTS,re=O.endPTS,Ee=O.startDTS,fe=O.endDTS;W&&(W.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:re,startDTS:Ee,endDTS:fe}),j.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,Z,re,Ee,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:g},H);p.trigger(R.Events.FRAG_PARSING_METADATA,Te)}if(P){var ge=s({frag:j,id:g},P);p.trigger(R.Events.FRAG_PARSING_USERDATA,ge)}},h._bufferInitSegment=function(u,a,g){if(this.state!==U.State.PARSING)return;u.video&&delete u.video;var p=u.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,u);var v=p.initSegment;if(v!=null&&v.byteLength){var k={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:v};this.hls.trigger(R.Events.BUFFER_APPENDING,k)}this.tick()},h.loadFragment=function(u,a,g){var p=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||p===I.FragmentState.NOT_LOADED||p===I.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(G.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,u,a,g)))},h.completeAudioSwitch=function(){var u=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:g})},y}(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,l=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 ["+l.startSN+"-"+l.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 l=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!l.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var S={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(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 l=o[d],S=l.id,f=l.groupId,m=f===void 0?"":f,w=l.name,y=l.type,h=l.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:y,url:h}),l.details&&!l.details.live)return;var c=this.switchParams(l.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 l=o[s];if((!this.selectDefaultTrack||l.default)&&(!d||d===l.name))return l.id}return-1},T.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,l=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:l,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"]),l=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);l!==void 0&&S>C.partTarget&&(l+=1)}if(Object(G.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(G.isFiniteNumber)(l)?l: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 l,S=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,w=d.lastPartSn,y=d.endSN,h=d.lastPartIndex,c=h!==-1,u=w===y,a=m?0:h;c?(S=u?y+1:w,f=u?a:h+1):S=y+1;var g=d.age,p=g+d.ageHeader,v=Math.min(p-d.partTarget,d.targetduration*1.5);if(v>0){if(T&&v>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var k=Math.floor(v/d.targetduration);if(S+=k,f!==void 0){var F=Math.round(v%d.targetduration/d.partTarget);f+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+v+" skip sn "+k+" to part "+f)}d.tuneInGoal=v}if(l=this.getDeliveryDirectives(d,C.deliveryDirectives,S,f),m||!u){this.loadPlaylist(l);return}}else l=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(l)},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 y}),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 l(c,u){for(var a=0;a<u.length;a++){var g=u[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(c,g.key,g)}}function S(c,u,a){return u&&l(c.prototype,u),a&&l(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,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,w(c,u)}function w(c,u){return w=Object.setPrototypeOf||function(g,p){return g.__proto__=p,g},w(c,u)}var y={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(u,c);function u(g,p,v){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=y.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=v,k.log=I.logger.log.bind(I.logger,v+":"),k.warn=I.logger.warn.bind(I.logger,v+":"),k.hls=g,k.fragmentLoader=new b.default(g.config),k.fragmentTracker=p,k.config=g.config,k.decrypter=new d.default(g,g.config),g.on(D.Events.KEY_LOADED,k.onKeyLoaded,f(k)),k}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(p,v){var k=this.fragCurrent,F=this.fragmentTracker;if(!v.live&&k&&k.sn===v.endSN&&!p.nextStart){var j=F.getState(k);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(p,v){var k=this.media=this.mediaBuffer=v.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===y.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.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 p=this.config,v=this.fragCurrent,k=this.media,F=this.mediaBuffer,j=this.state,W=k?k.currentTime:0,O=B.BufferHelper.bufferInfo(F||k,W,p.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===y.ENDED)this.resetLoadingState();else if(v&&!O.len){var P=p.maxFragLookUpTolerance,H=v.start-P,X=v.start+v.duration+P,Z=W>X;(W<H||Z)&&(Z&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.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(p,v){if(this.state!==y.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var k=this.levels[v.frag.level].details;k&&this.loadFragment(v.frag,k,v.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.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(p,v){this.log("Loading key for "+p.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=y.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(D.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,v,k){this._loadFragForPlayback(p,v,k)},a._loadFragForPlayback=function(p,v,k){var F=this,j=function(O){if(F.fragContextChanged(p)){F.warn("Fragment "+p.sn+(O.part?" p: "+O.part.index:"")+" of level "+p.level+" was dropped during download."),F.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,F._handleFragmentLoadProgress(O)};this._doFragLoad(p,v,k,j).then(function(W){if(!W)return;F.fragLoadError=0;var O=F.state;if(F.fragContextChanged(p)){(O===y.FRAG_LOADING||O===y.BACKTRACKING||!F.fragCurrent&&O===y.PARSING)&&(F.fragmentTracker.removeFragment(p),F.state=y.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+p.sn+" of level "+p.level),F.hls.trigger(D.Events.FRAG_LOADED,W),F.state===y.BACKTRACKING)){F.fragmentTracker.backtrack(p,W),F.resetFragmentLoading(p);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,v,k){if(k===void 0&&(k=null),!(p-v))return;var F={startOffset:p,endOffset:v,type:k};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(p){var v=this;this._doFragLoad(p).then(function(k){if(!k||v.fragContextChanged(p)||!v.levels)throw new Error("init load aborted");return k}).then(function(k){var F=v.hls,j=k.payload,W=p.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return v.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:p,payload:P,stats:{tstart:O,tdecrypt:H}}),k.payload=P,k})}return k}).then(function(k){var F=v.fragCurrent,j=v.hls,W=v.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[p.level].details;console.assert(O,"Level details are defined when init segment is loaded");var P=p.stats;v.state=y.IDLE,v.fragLoadError=0,p.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:p.type}),v.tick()}).catch(function(k){v.warn(k),v.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var v=this.fragCurrent;return!p||!v||p.level!==v.level||p.sn!==v.sn||p.urlId!==v.urlId},a.fragBufferedComplete=function(p,v){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(B.BufferHelper.getBuffered(k))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var v=this.transmuxer;if(!v)return;var k=p.frag,F=p.part,j=p.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);v.flush(O)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,v,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(p.start,k||0),this.config.lowLatencyMode&&v){var W=v.partList;if(W&&F){k>p.end&&v.fragmentHint&&(p=v.fragmentHint);var O=this.getNextPart(W,p,k);if(O>-1){var P=W[O];return this.log("Loading part sn: "+p.sn+" p: "+P.index+" cc: "+p.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=y.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,part:W[O],targetBufferTime:k}),this.doFragPartsLoad(p,W,O,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!p.url||this.loadedEndOfParts(W,k))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(k.toFixed(3))),Object(G.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=y.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,targetBufferTime:k}),this.fragmentLoader.load(p,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(p,v,k,F){var j=this;return new Promise(function(W,O){var P=[],H=function X(Z){var re=v[Z];j.fragmentLoader.loadPart(p,re,F).then(function(Ee){P[re.index]=Ee;var fe=Ee.part;j.hls.trigger(D.Events.FRAG_LOADED,Ee);var Te=v[Z+1];if(Te&&Te.fragment===p)X(Z+1);else return W({frag:p,part:fe,partsLoaded:P})}).catch(O)};H(k)})},a.handleFragLoadError=function(p){var v=p.data;return v&&v.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(D.Events.ERROR,v),null},a._handleTransmuxerFlush=function(p){var v=this.getCurrentContext(p);if(!v||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var k=v.frag,F=v.part,j=v.level,W=self.performance.now();k.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(k,F,j,p.partial)},a.getCurrentContext=function(p){var v=this.levels,k=p.level,F=p.sn,j=p.part;if(!v||!v[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=v[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(p,v,k,F){if(!p||this.state!==y.PARSING)return;var j=p.data1,W=p.data2,O=j;if(j&&W&&(O=Object(_.appendUint8Array)(j,W)),!O||!O.length)return;var P={type:p.type,frag:v,part:k,chunkMeta:F,parent:v.type,data:O};this.hls.trigger(D.Events.BUFFER_APPENDING,P),p.dropped&&p.independent&&!k&&this.flushBufferGap(v)},a.flushBufferGap=function(p){var v=this.media;if(!v)return;if(!B.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,p.start);return}var k=v.currentTime,F=B.BufferHelper.bufferInfo(v,k,0),j=p.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),O=Math.max(Math.min(p.start-W,F.end-W),k+W);p.start-O>W&&this.flushMainBuffer(O,p.start)},a.getFwdBufferInfo=function(p,v){var k=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(p,F,k.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,v);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(p,F,Math.max(j.nextStart,k.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var v=this.config,k;return p?k=Math.max(8*v.maxBufferSize/p,v.maxBufferLength):k=v.maxBufferLength,Math.min(k,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var v=this.config,k=p||v.maxBufferLength;return v.maxMaxBufferLength>=k?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,v){var k,F,j=v.fragments,W=j.length;if(!W)return null;var O=this.config,P=j[0].start,H;if(v.live){var X=O.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(v,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:p)}else p<=P&&(H=j[0]);if(!H){var Z=O.lowLatencyMode?v.partEnd:v.fragmentEnd;H=this.getFragmentAtPosition(p,Z,v)}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(p,v,k){for(var F=-1,j=!1,W=!0,O=0,P=p.length;O<P;O++){var H=p[O];if(W=W&&!H.independent,F>-1&&k<H.start)break;var X=H.loaded;!X&&(j||H.independent||W)&&H.fragment===v&&(F=O),j=X}return F},a.loadedEndOfParts=function(p,v){var k=p[p.length-1];return k&&v>k.start&&k.loaded},a.getInitialLiveFragment=function(p,v){var k=this.fragPrevious,F=null;if(k){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),F=Object(C.findFragmentByPDT)(v,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=k.sn+1;if(j>=p.startSN&&j<=p.endSN){var W=v[j-p.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)(v,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?p.fragmentEnd:p.edge,p))}return F},a.getFragmentAtPosition=function(p,v,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(p<v){var re=p>v-H?0:H;Z=Object(C.findFragmentByPTS)(j,W,p,re)}else Z=W[W.length-1];if(Z){var Ee=Z.sn-k.startSN,fe=j&&Z.level===j.level,Te=W[Ee+1],ge=this.fragmentTracker.getState(Z);if(ge===R.FragmentState.BACKTRACKED){Z=null;for(var pe=Ee;W[pe]&&this.fragmentTracker.getState(W[pe])===R.FragmentState.BACKTRACKED;)j?Z=W[pe--]:Z=W[--pe];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(p){var v=this.config,k=this.media;if(!k)return;var F=this.hls.liveSyncPosition,j=k.currentTime,W=p.fragments[0].start,O=p.edge,P=j>=W-v.maxFragLookUpTolerance&&j<=O;if(F!==null&&k.duration>F&&(j<F||!P)){var H=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*p.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(p,v){var k=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?k[F]:null,O=p.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var P=p.fragments[0].start,H=!v,X=p.alignedSliding&&Object(G.isFiniteNumber)(P);if(H||!X&&!P){Object(M.alignStream)(j,W,p);var Z=p.fragments[0].start;return this.log("Live playlist sliding: "+Z.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+O),Z}return P},a.waitForCdnTuneIn=function(p){var v=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*v)},a.setStartPosition=function(p,v){var k=this.startPosition;if(k<v&&(k=-1),k===-1||this.lastCurrentTime===-1){var F=p.startTimeOffset;Object(G.isFiniteNumber)(F)?(k=v+F,F<0&&(k+=p.totalduration),k=Math.min(Math.max(v,k),v+p.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+k),this.startPosition=k):p.live?k=this.hls.liveSyncPosition||v:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},a.getLoadPosition=function(){var p=this.media,v=0;return this.loadedmetadata&&p?v=p.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},a.handleFragLoadAborted=function(p,v){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(v?" part"+v.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(p,v){if(v.fatal)return;var k=v.frag;if(!k||k.type!==p)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 "+p+" "+k.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(I.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(p,v,k){if(!p)return;var F=B.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(v,F,k),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[p].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,v,k,F){var j=this,W=k.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(p.elementaryStreams).reduce(function(P,H){var X=p.elementaryStreams[H];if(X){var Z=X.endPTS-X.startPTS;if(Z<=0)return j.warn("Could not parse fragment "+p.sn+" "+H+" duration reliably ("+Z+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),P||!1;var re=F?0:Object(T.updateFragPTSDTS)(W,p,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:p,start:X.startPTS,end:X.endPTS}),!0}return P},!1);O?(this.state=y.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:p,part:v})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(u,[{key:"state",get:function(){return this._state},set:function(p){var v=this._state;v!==p&&(this._state=p,this.log(v+"->"+p))}}]),u}(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,l=o.media,S=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:l})),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 l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(o,s){var l=this.media=s.media;if(l&&_){var S=this.mediaSource=new _;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(S),this._objectUrl=l.src}},b.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,l=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&&(l&&self.URL.revokeObjectURL(l),o.src===l?(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 l=o.sourceBuffer[s];try{l&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),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 l=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(S){var m=l.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var w=s[f],y=w.codec,h=w.levelCodec,c=w.container,u=(m.levelCodec||m.codec).replace(M,"$1"),a=(h||y).replace(M,"$1");if(u!==a){var g=c+";codecs="+(h||y);l.appendChangeType(f,g)}}}else l.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 l=this,S=this.operationQueue,f={execute:function(){var w=l.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 l=this,S=this.hls,f=this.operationQueue,m=this.tracks,w=s.data,y=s.type,h=s.frag,c=s.part,u=s.chunkMeta,a=u.buffering[y],g=self.performance.now();a.start=g;var p=h.stats.buffering,v=c?c.stats.buffering:null;p.start===0&&(p.start=g),v&&v.start===0&&(v.start=g);var k=m.audio,F=y==="audio"&&u.id===1&&(k==null?void 0:k.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var O=l.sourceBuffer[y];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)}}l.appendExecutor(w,y)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,p.first===0&&(p.first=O),v&&v.first===0&&(v.first=O);var P=l.sourceBuffer,H={};for(var X in P)H[X]=I.BufferHelper.getBuffered(P[X]);l.appendError=0,l.hls.trigger(U.Events.BUFFER_APPENDED,{type:y,frag:h,part:c,chunkMeta:u,parent:h.type,timeRanges:H})},onError:function(O){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" 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:(l.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,l.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,y)},b.onBufferFlushing=function(o,s){var l=this,S=this.operationQueue,f=function(w){return{execute:l.removeExecutor.bind(l,w,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.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 l=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 y=function(){var c=self.performance.now();S.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var u=f?f.stats:S.stats;l.hls.trigger(U.Events.FRAG_BUFFERED,{frag:S,part:f,stats:u,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(y,m)},b.onFragChanged=function(o,s){this.flushBackBuffer()},b.onBufferEos=function(o,s){var l=this,S=this.getSourceBufferTypes().reduce(function(f,m){var w=l.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=l.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},b.onLevelUpdated=function(o,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var o=this.hls,s=this.details,l=this.media,S=this.sourceBuffer;if(!l||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=l.currentTime,y=s.levelTargetDuration,h=Math.max(m,y),c=Math.floor(w/y)*y-h;f.forEach(function(u){var a=S[u];if(a){var g=I.BufferHelper.getBuffered(a);g.length>0&&c>g.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:u}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,l=this.media,S=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=l.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,l=o.fragments,S=l.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,l[0].start),m=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,m)}},b.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,S=Object.keys(l).length;if(S&&!o||S===2){this.createSourceBuffers(l),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,l=this.mediaSource;if(!l)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,y=m.container+";codecs="+w;R.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var h=s[f]=l.addSourceBuffer(y),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(u){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:y})}}S&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(o){var s=this.operationQueue,l=s.current(o);l.onStart()},b._onSBUpdateEnd=function(o){var s=this.operationQueue,l=s.current(o);l.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 l=this.operationQueue.current(o);l&&l.onError(s)},b.removeExecutor=function(o,s,l){var S=this.media,f=this.mediaSource,m=this.operationQueue,w=this.sourceBuffer,y=w[o];if(!S||!f||!y){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,u=Math.max(0,s),a=Math.min(l,h,c);a>u?(R.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(u,a)):m.shiftAndExecuteNext(o)},b.appendExecutor=function(o,s){var l=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"),l.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 l=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=l.sourceBuffer[m];(!w||!w.updating)&&S.shiftAndExecuteNext(m)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(o,s,l){var S=this.sourceBuffer[o];if(!S)return;var f=l.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(l){s.removeEventListener(l.event,l.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,l){return l?s.width!==l.width||s.height!==l.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),y={d:f.duration*1e3,ot:w};(w===U.CMCDObjectType.VIDEO||w===U.CMCDObjectType.AUDIO||w==U.CMCDObjectType.MUXED)&&(y.br=m.bitrate/1e3,y.tb=o.getTopBandwidth(w),y.bl=o.getBufferLength(w)),o.apply(S,y)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var s=this.config=d.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||T.uuid(),this.cid=l.contentId,this.useHeaders=l.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 l,S;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},b.createData=function(){var 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 l=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=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,l=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=L(l),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,l=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var S=R.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return S.len*1e3},b.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,l=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new l(m)}var f=S.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,y,h){s(w),this.loader.load(w,y,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,l=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new l(m)}var f=S.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,y,h){s(w),this.loader.load(w,y,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=[],l=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},y=Object.keys(o||{}).sort(),h=L(y),c;!(c=h()).done;){var u=c.value,a=o[u];if(!l(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var g=w[u];g&&(a=g(a));var p=typeof a,v=void 0;u==="ot"||u==="sf"||u==="st"?v=u+"="+a:p==="boolean"?v=u:p==="number"?v=u+"="+a:v=u+"="+JSON.stringify(a),s.push(v)}return s.join(",")},T.toHeaders=function(o){for(var s=Object.keys(o),l={},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,y=s;w<y.length;w++){var h=y[w],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var u=0;u<f.length;u++){var a=T.serialize(f[u]);a&&(l["CMCD-"+S[u]]=a)}return l},T.toQuery=function(o){return"CMCD="+encodeURIComponent(T.serialize(o))},T.appendQueryToUri=function(o,s){if(!s)return o;var l=o.includes("?")?"&":"?";return""+o+l+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 l=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 l._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 l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(l);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return l.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,l=this._mediaKeysList[0];if(!l){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(l.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var S=l.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'),l.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 l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,d,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,l,d),S=void 0}catch(f){R.logger.error(f)}try{l.readyState||l.open("POST",d,!0),S&&S.call(this.hls,l,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return l},T._onLicenseRequestReadyStageChange=function(d,o,s,l){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)}l(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,l)}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 l=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(l,d,o);R.logger.log("Sending license request to URL: "+l);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}),l=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,l)},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(l){var S=!b.isTimeBuffered(l.startPTS,l.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(l){var S=b.elementaryStreams[l];if(!S)return;var f=T[l],m=d!==null||S.partial===!0;s.range[l]=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,l=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&&l<=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,l=this.fragments;return Object.keys(l).forEach(function(S){var f=l[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(l){var S=o[l];if(T.detectEvictedFragments(l,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,l=o.currentTime,S=o.seeking,f=this.seeking&&!S,m=!this.seeking&&S;if(this.seeking=S,l!==b){if(this.moved=!0,s!==null){if(this.stallReported){var w=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+l+", 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 y=G.BufferHelper.bufferInfo(o,l,0),h=y.len>0,c=y.nextStart||0;if(!h&&!c)return;if(S){var u=y.len>D,a=!c||c-l>D&&!this.fragmentTracker.getPartialFragment(l);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,p=Math.max(c,y.start||0)-l,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=v==null||((g=v.details)===null||g===void 0)?void 0:g.live,F=k?v.details.targetduration*2:D;if(p>0&&p<=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(y.len);var O=G.BufferHelper.bufferInfo(o,l,d.maxBufferHole);this._tryFixBufferStall(O,W)},C._tryFixBufferStall=function(b,d){var o=this.config,s=this.fragmentTracker,l=this.media,S=l.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,l=s.currentTime,S=0,f=G.BufferHelper.getBuffered(s),m=0;m<f.length;m++){var w=f.start(m);if(l+d.maxBufferHole>=S&&l<w){var y=Math.max(w+E,s.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+y),this.moved=!0,this.stalled=null,s.currentTime=y,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 "+l+" to "+y,frag:b}),y}S=f.end(m)}return 0},C._tryNudgeBuffer=function(){var b=this.config,d=this.hls,o=this.media,s=o.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<b.nudgeMaxRetry){var S=s+l*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,l=d<T.length-1?T[d+1].pts:C.end,S=l-s;S<=0&&(l=s+B);for(var f=0;f<o.length;f++){var m=o[f];if(!R.isTimeStampFrame(m)){var w=new b(s,l,"");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 l=T-s,S=Math.min(this.maxLatency,s+C.targetduration),f=l<S;if(C.live&&f&&l>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*l-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,l=d.lowLatencyMode,S=this.hls.userConfig,f=l&&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 l=arguments[s];for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(o[S]=l[S])}return o},E.apply(this,arguments)}function _(o,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function M(o,s,l){return s&&_(o.prototype,s),l&&_(o,l),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 l=s.prototype;return l._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)},l._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)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},l.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(f,m){var w=[],y=[],h=[],c,u={},a,g=!1,p=!1,v=!1;if(m.levels.forEach(function(W){var O=W.attrs;g=g||!!(W.width&&W.height),p=p||!!W.videoCodec,v=v||!!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=u[P],a?a.url.push(W.url):(a=new G.Level(W),u[P]=a,w.push(a)),O&&(O.AUDIO&&Object(I.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(I.addGroupId)(a,"text",O.SUBTITLES))}),(g||p)&&v&&(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&&(y=m.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(y)),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=v&&!p,j={levels:w,audioTracks:y,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:v,video:p,altAudio:!F&&y.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"})},l.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var w=m.context,y=this._levels[this.currentLevelIndex];if(w&&(w.type===L.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&w.groupId===y.audioGroupIds[y.urlId]||w.type===L.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&w.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,u;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&&(u=m.frag.level)):u=m.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(c=!1),u=w.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:u=m.level,h=!0;break}u!==void 0&&this.recoverLevel(m,u,h,c)},l.recoverLevel=function(f,m,w,y){var h=f.details,c=this._levels[m];if(c.loadError++,w){var u=this.retryLoadingOrFail(f);if(u)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var g=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(h+": switch to "+g),f.levelRetry=!0,this.hls.nextAutoLevel=g)}}},l.redundantFailover=function(f){var m=this._levels[f],w=m.url.length;if(w>1){var y=(m.urlId+1)%w;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(h){h.urlId=y}),this.level=f}},l.onFragLoaded=function(f,m){var w=m.frag;if(w!==void 0&&w.type===L.PlaylistLevelType.MAIN){var y=this._levels[w.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},l.onLevelLoaded=function(f,m){var w,y=m.level,h=m.details,c=this._levels[y];if(!c){var u;this.warn("Invalid level index "+y),(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(h.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,c.details)):(w=m.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(h.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(f,m){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var y=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<w.audioGroupIds.length;c++)if(w.audioGroupIds[c]===h){y=c;break}y!==w.urlId&&(w.urlId=y,this.startLoad())}},l.loadPlaylist=function(f){var m=this.currentLevelIndex,w=this._levels[m];if(this.canLoad&&w&&w.url.length>0){var y=w.urlId,h=w.url[y];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 "+y+" "+h),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:h,level:m,id:y,deliveryDirectives:f||null})}},l.removeLevel=function(f,m){var w=function(c,u){return u!==m},y=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 u=h.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),h});this._levels=y,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:y})},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 y=f<0;if(this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:y,reason:"invalid level idx"}),y)return;f=Math.min(f,w.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=w[h],u=w[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=E({},u,{level:f,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var g=u.details;if(!g||g.live){var p=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{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,l,S){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function B(s){var l={};s.forEach(function(S){var f=S.groupId||"";S.id=l[f]=l[f]||0,l[f]++})}function I(s,l,S){var f=s[l],m=s[S];D(f,m)}function D(s,l){var S=l.startPTS;if(Object(G.isFiniteNumber)(S)){var f=0,m;l.sn>s.sn?(f=S-s.start,m=s):(f=s.start-S,m=l),m.duration!==f&&(m.duration=f)}else if(l.sn>s.sn){var w=s.cc===l.cc;w&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function L(s,l,S,f,m,w){var y=f-S;y<=0&&(U.logger.warn("Fragment should have a positive duration",l),f=S+l.duration,w=m+l.duration);var h=S,c=f,u=l.startPTS,a=l.endPTS;if(Object(G.isFiniteNumber)(u)){var g=Math.abs(u-S);Object(G.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(g,l.deltaPTS):l.deltaPTS=g,h=Math.max(S,u),S=Math.min(S,u),m=Math.min(m,l.startDTS),c=Math.min(f,a),f=Math.max(f,a),w=Math.max(w,l.endDTS)}l.duration=f-S;var p=S-l.start;l.appendedPTS=f,l.start=l.startPTS=S,l.maxStartPTS=h,l.startDTS=m,l.endPTS=f,l.minEndPTS=c,l.endDTS=w;var v=l.sn;if(!s||v<s.startSN||v>s.endSN)return 0;var k,F=v-s.startSN,j=s.fragments;for(j[F]=l,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,p}function E(s,l){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 y=0,h;if(M(s,l,function(k,F){k.relurl&&(y=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),l.PTSKnown=l.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=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.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(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(k){return!k}),l.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=l.skippedSegments;u--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(y){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=y}l.skippedSegments&&(l.startCC=l.fragments[0].cc),_(s.partList,l.partList,function(k,F){F.elementaryStreams=k.elementaryStreams,F.stats=k.stats}),h?L(l,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(s,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var p=l.advancedDateTime;if(l.advanced&&p){var v=l.edge;l.driftStart||(l.driftStartTime=p,l.driftStart=v),l.driftEndTime=p,l.driftEnd=v}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function _(s,l,S){if(s&&l)for(var f=0,m=0,w=s.length;m<=w;m++){var y=s[m],h=l[m+f];y&&h&&y.index===h.index&&y.fragment.sn===h.fragment.sn?S(y,h):f--}}function M(s,l,S){for(var f=l.skippedSegments,m=Math.max(s.startSN,l.startSN)-l.startSN,w=(s.fragmentHint?1:0)+(f?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,y=l.startSN-s.startSN,h=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,u=m;u<=w;u++){var a=c[y+u],g=h[u];f&&!g&&u<f&&(g=l.fragments[u]=a),a&&g&&S(a,g)}}function C(s,l){var S=l.startSN+l.skippedSegments-s.startSN,f=s.fragments;if(S<0||S>=f.length)return;T(l,f[S].start)}function T(s,l){if(l){for(var S=s.fragments,f=s.skippedSegments;f<S.length;f++)S[f].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function b(s,l){var S=1e3*s.levelTargetDuration,f=S/2,m=s.age,w=m>0&&m<S*3,y=l.loading.end-l.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(w){var u=333*s.misses;h=Math.max(Math.min(f,y*2),u),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-y;return Math.round(h)}function d(s,l,S){if(!s||!s.details)return null;var f=s.details,m=f.fragments[l-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===l?m:l<f.startSN&&S&&S.sn===l?S:null)}function o(s,l,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===l)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 y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,w,y){return w&&d(m.prototype,w),y&&d(m,y),m}function s(m,w){m.prototype=Object.create(w.prototype),m.prototype.constructor=m,l(m,w)}function l(m,w){return l=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},l(m,w)}var S=100,f=function(m){s(w,m);function w(h,c){var u;return u=m.call(this,h,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var y=w.prototype;return y._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)},y._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)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,g=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var p,v=self.performance.now(),k=this.retryDate;(!k||v>=k||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var c,u,a=this.hls,g=this.levelLastLoaded,p=this.levels,v=this.media,k=a.config,F=a.nextLoadLevel;if(g===null||!v&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[F])return;var j=p[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:v,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 Ee=re.sn-W.startSN;Ee>1&&(re=W.fragments[Ee-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(v,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"&&!((u=re.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(re,W):this.loadFragment(re,W,Z)},y.loadFragment=function(c,u,a){var g,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===D.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else p=D.FragmentState.NOT_LOADED}p===D.FragmentState.NOT_LOADED||p===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,u,a)):p===D.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},y.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,g=this.getAppendedFrag(u.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!u.paused&&c){var p=this.hls.nextLoadLevel,v=c[p],k=this.fragLastKbps;k&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*k)+1:a=0}else a=0;var F=this.getBufferedFrag(u.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)}}}},y.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()},y.flushMainBuffer=function(c,u){m.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},y.onMediaAttached=function(c,u){m.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},y.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)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(G.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},y.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},y.onManifestParsed=function(c,u){var a=!1,g=!1,p;u.levels.forEach(function(v){p=v.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},y.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var g=a[u.level];(!g.details||g.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(g.details))&&(this.state=U.State.WAITING_LEVEL)},y.onLevelLoaded=function(c,u){var a,g=this.levels,p=u.level,v=u.details,k=v.totalduration;if(!g){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+k);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==u.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var j=g[p],W=0;if(v.live||(a=j.details)!==null&&a!==void 0&&a.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;W=this.alignPlaylists(v,j.details)}if(j.details=v,this.levelLastLoaded=p,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:v,level:p}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=U.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,W),this.tick()},y._handleFragmentLoadProgress=function(c){var u,a=c.frag,g=c.part,p=c.payload,v=this.levels;if(!v){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=v[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=(u=a.initSegment)===null||u===void 0?void 0:u.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=g?g.index:-1,Z=X!==-1,re=new M.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,X,Z),Ee=this.initPTS[a.cc];H.push(p,O,P,j,a,g,F.totalduration,W,re,Ee)},y.onAudioTrackSwitching=function(c,u){var a=this.altAudio,g=!!u.url,p=u.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var 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:p})}},y.onAudioTrackSwitched=function(c,u){var a=u.id,g=!!this.hls.audioTracks[a].url;if(g){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=g,this.tick()},y.onBufferCreated=function(c,u){var a=u.tracks,g,p,v=!1;for(var k in a){var F=a[k];if(F.id==="main"){if(p=k,g=F,k==="video"){var j=a[k];j&&(this.videoBuffer=j.buffer)}}else v=!0}v&&g?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(c,u){var a=u.frag,g=u.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.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 p=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},y.onError=function(c,u){switch(u.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,u);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=U.State.ERROR):!u.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=I.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(c,u){var a=u.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,L.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(c,u){this.levels=u.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+u);return}var g=I.BufferHelper.getBuffered(c),p=g.length?g.start(0):0,v=p-a;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+v+" to match buffer start"),a+=v,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},y._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},y._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var g=u.hls;if(!a||g.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=U.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),g.trigger(B.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(c){var u,a="main",g=this.hls,p=c.remuxResult,v=c.chunkMeta,k=this.getCurrentContext(v);if(!k){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var F=k.frag,j=k.part,W=k.level,O=p.video,P=p.text,H=p.id3,X=p.initSegment,Z=this.altAudio?void 0:p.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,F,v),g.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:X.tracks}));var re=X.initPTS,Ee=X.timescale;Object(G.isFiniteNumber)(re)&&(this.initPTS[F.cc]=re,g.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:re,timescale:Ee}))}if(O&&p.independent!==!1){if(W.details){var fe=O.startPTS,Te=O.endPTS,ge=O.startDTS,pe=O.endDTS;if(j)j.elementaryStreams[O.type]={startPTS:fe,endPTS:Te,startDTS:ge,endDTS:pe};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,pe,!0)}F.setElementaryStreamInfo(O.type,fe,Te,ge,pe),this.bufferFragmentData(O,F,j,v)}}else if(p.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,v)}if(H!=null&&(u=H.samples)!==null&&u!==void 0&&u.length){var ye={frag:F,id:a,samples:H.samples};g.trigger(B.Events.FRAG_PARSING_METADATA,ye)}if(P){var we={frag:F,id:a,samples:P.samples};g.trigger(B.Events.FRAG_PARSING_USERDATA,we)}},y._bufferInitSegment=function(c,u,a,g){var p=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var v=u.audio,k=u.video,F=u.audiovideo;if(v){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"),v.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),v.levelCodec=j,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}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,u),Object.keys(u).forEach(function(O){var P=u[O],H=P.initSegment;H!=null&&H.byteLength&&p.hls.trigger(B.Events.BUFFER_APPENDING,{type:O,data:H,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},y.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=U.State.BACKTRACKING},y.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(I.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):I.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var g=this.fragPlaying,p=u.level;(!g||u.sn!==g.sn||g.level!==p||u.urlId!==g.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:u}),(!g||g.level!==p)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=u)}}},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 u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),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(l,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(l,m.key,m)}}function T(l,S,f){return S&&C(l.prototype,S),f&&C(l,f),l}function b(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,d(l,S)}function d(l,S){return d=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},d(l,S)}var o=500,s=function(l){b(S,l);function S(m,w){var y;return y=l.call(this,m,w,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}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,y){this.mainDetails=y.details},f.onSubtitleFragProcessed=function(w,y){var h=y.frag,c=y.success;if(this.fragPrevious=h,this.state=E.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,g=h.start,p=0;p<u.length;p++)if(g>=u[p].start&&g<=u[p].end){a=u[p];break}var v=h.start+h.duration;a?a.end=v:(a={start:g,end:v},u.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(w,y){var h=y.startOffset,c=y.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var g=a[u].details,p=g.targetduration,v=c-p;if(v<=0)return;y.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(k){for(var F=0;F<k.length;){if(k[F].end<=v){k.shift();continue}else if(k[F].start<v)k[F].start=v;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,v,_.PlaylistLevelType.SUBTITLE)}},f.onError=function(w,y){var h,c=y.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,y){var h=this,c=y.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new M.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){h.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(w,y){if(this.currentTrackId=y.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,y){var h,c=y.details,u=y.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var p=g[a];if(u>=g.length||u!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var k=v.fragments[0];if(!p.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(c,v):k&&Object(D.addSliding)(c,k.start);else{var F=this.alignPlaylists(c,p.details);F===0&&k&&Object(D.addSliding)(c,k.start)}}if(p.details=c,this.levelLastLoaded=u,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"),p.details=void 0)}},f._handleFragmentLoadComplete=function(w){var y=w.frag,h=w.payload,c=y.decryptdata,u=this.hls;if(this.fragContextChanged(y))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(g){var p=performance.now();u.trigger(G.Events.FRAG_DECRYPTED,{frag:y,payload:g,stats:{tstart:a,tdecrypt:p}})})}},f.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var w,y=this.currentTrackId,h=this.levels;if(!h.length||!h[y]||!h[y].details)return;var c=h[y].details,u=c.targetduration,a=this.config,g=this.media,p=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-u,a.maxBufferHole),v=p.end,k=p.len,F=this.getMaxBufferLength()+u;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(v<O){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,X)),P||(P=Object(B.findFragmentByPTS)(H,j,v,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,v)}},f.loadFragment=function(w,y,h){this.fragCurrent=w,l.prototype.loadFragment.call(this,w,y,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 l=s.id,S=s.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+l);return}var w=m.details;m.details=s.details,this.log("subtitle track "+l+" loaded ["+S.startSN+"-"+S.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,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 l=s.textGroupIds[s.urlId];if(this.groupId!==l){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(y){return!l||y.groupId===l});this.tracksInGroup=f;var m=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=l;var w={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+l+'" 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,l=0;l<s.length;l++){var S=s[l];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 l=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 "+l),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:f,id:l,groupId:S,deliveryDirectives:o||null})}},b.toggleTrackModes=function(o){var s=this,l=this.media,S=this.subtitleDisplay,f=this.trackId;if(!l)return;var m=M(l.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 y=w[f];y&&(y.mode="disabled")}var h=w[o];h&&(h.mode=S?"showing":"hidden")},b.setSubtitleTrack=function(o,s){var l,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=S[o])!==null&&l!==void 0&&l.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,y=w===void 0?"":w,h=f.name,c=f.type,u=f.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:h,type:c,url:u});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),l=0;l<s.length;l++)if(s[l].mode==="hidden")o=l;else if(s[l].mode==="showing"){o=l;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 l=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,l,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 l=this.hls;l.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(U.Events.FRAG_LOADING,this.onFragLoading,this),l.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(l,S,f,m,w){for(var y=!1,h=w.length;h--;){var c=w[h],u=T(c[0],c[1],S,f);if(u>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],f),y=!0,u/(f-S)>.5))return}if(y||w.push([S,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,S,f,m)}else{var g=this.Cues.newCue(null,S,f,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:g,track:l})}},o.onInitPtsFound=function(l,S){var f=this,m=S.frag,w=S.id,y=S.initPTS,h=S.timescale,c=this.unparsedVttFrags;w==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){f.onFragLoaded(U.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(l){var S=this.media;if(S)for(var f=0;f<S.textTracks.length;f++){var m=S.textTracks[f];if(m[l])return m}return null},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.createNativeTrack=function(l){if(this.captionsTracks[l])return;var S=this.captionsProperties,f=this.captionsTracks,m=this.media,w=S[l],y=w.label,h=w.languageCode,c=this.getExistingTrack(l);if(c)f[l]=c,Object(D.clearCurrentCues)(f[l]),Object(D.sendAddTrackEvent)(f[l],m);else{var u=this.createTextTrack("captions",y,h);u&&(u[l]=!0,f[l]=u)}},o.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var S=this.captionsProperties[l];if(!S)return;var f=S.label,m={_id:l,label:f,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[l]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(l,S,f){var m=this.media;return m?m.addTextTrack(l,S,f):void 0},o.onMediaAttaching=function(l,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(S){Object(D.clearCurrentCues)(l[S]),delete l[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 l=this.media;if(!l)return;var S=l.textTracks;if(S)for(var f=0;f<S.length;f++)Object(D.clearCurrentCues)(S[f])},o.onSubtitleTracksUpdated=function(l,S){var f=this;this.textTracks=[];var m=S.subtitleTracks||[],w=m.some(function(u){return u.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var y=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(u,a){var g;if(a<h.length){for(var p=null,v=0;v<h.length;v++)if(C(h[v],u)){p=h[v];break}p&&(g=p)}g?Object(D.clearCurrentCues)(g):(g=f.createTextTrack("subtitles",u.name,u.lang),g&&(g.mode="disabled")),g&&(g.groupId=u.groupId,f.textTracks.push(g))})}else if(!y&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(l,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 y="textTrack"+w[1],h=f.captionsProperties[y];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(l,S){var f=this.cea608Parser1,m=this.cea608Parser2,w=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(S.frag.type===E.PlaylistLevelType.MAIN){var h,c,u=S.frag.sn,a=(h=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;u===w+1||u===w&&a===y+1||(f.reset(),m.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(l,S){var f=S.frag,m=S.payload,w=this.initPTS,y=this.unparsedVttFrags;if(f.type===E.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(G.isFiniteNumber)(w[f.cc])){y.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],u=this.vttCCs;u[f.cc]||(u[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,u)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,S){var f=this,m=this.hls;Object(L.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(w){f._appendCues(w,l.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(w){_.logger.log("Failed to parse IMSC1: "+w),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:w})})},o._parseVTTs=function(l,S,f){var m=this,w=this.hls;Object(I.parseWebVTT)(S,this.initPTS[l.cc],this.timescale[l.cc],f,l.cc,l.start,function(y){m._appendCues(y,l.level),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(y){m._fallbackToIMSC1(l,S),_.logger.log("Failed to parse VTT cue: "+y),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:y})})},o._fallbackToIMSC1=function(l,S){var f=this,m=this.tracks[l.level];m.textCodec||Object(L.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(){m.textCodec=L.IMSC1_CODEC,f._parseIMSC1(l,S)},function(){m.textCodec="wvtt"})},o._appendCues=function(l,S){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[S];if(m.mode==="disabled")return;l.forEach(function(h){return Object(D.addCueToTrack)(m,h)})}else{var w=this.tracks[S],y=w.default?"default":"subtitles"+S;f.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:l,track:y})}},o.onFragDecrypted=function(l,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(l,S){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var w=0;w<S.samples.length;w++){var y=S.samples[w].bytes;if(y){var h=this.extractCea608Data(y);f.addData(S.samples[w].pts,h[0]),m.addData(S.samples[w].pts,h[1])}}},o.onBufferFlushing=function(l,S){var f=S.startOffset,m=S.endOffset,w=S.endOffsetSubtitles,y=S.type,h=this.media;if(!h||h.currentTime<m)return;if(!y||y==="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 u=this.textTracks;Object.keys(u).forEach(function(a){return Object(D.removeCuesInRange)(u[a],f,w)})}},o.extractCea608Data=function(l){for(var S=l[0]&31,f=2,m=[[],[]],w=0;w<S;w++){var y=l[f++],h=127&l[f++],c=127&l[f++],u=(4&y)!==0,a=3&y;if(h===0&&c===0)continue;u&&((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,l){return Math.min(o,l)-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],l=d[2],S=d[3],f=new Uint32Array(256),m=0,w=0,y=0;for(y=0;y<256;y++)y<128?f[y]=y<<1:f[y]=y<<1^283;for(y=0;y<256;y++){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],u=f[c],a=f[u],g=f[h]*257^h*16843008;M[m]=g<<24|g>>>8,C[m]=g<<16|g>>>16,T[m]=g<<8|g>>>24,b[m]=g,g=a*16843009^u*65537^c*257^m*16843008,o[h]=g<<24|g>>>8,s[h]=g<<16|g>>>16,l[h]=g<<8|g>>>24,S[h]=g,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),l=this.sBox,S=this.rcon,f=this.invSubMix,m=f[0],w=f[1],y=f[2],h=f[3],c,u;for(b=0;b<T;b++){if(b<C){c=o[b]=E[b];continue}u=c,b%C===0?(u=u<<8|u>>>24,u=l[u>>>24]<<24|l[u>>>16&255]<<16|l[u>>>8&255]<<8|l[u&255],u^=S[b/C|0]<<24):C>6&&b%C===4&&(u=l[u>>>24]<<24|l[u>>>16&255]<<16|l[u>>>8&255]<<8|l[u&255]),o[b]=c=(o[b-C]^u)>>>0}for(d=0;d<T;d++)b=T-d,d&3?u=o[b]:u=o[b-4],d<4||b<=4?s[d]=u:s[d]=m[l[u>>>24]]^w[l[u>>>16&255]]^y[l[u>>>8&255]]^h[l[u&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],l=b[3],S=this.uint8ArrayToUint32Array_(_),f=S[0],m=S[1],w=S[2],y=S[3],h=new Int32Array(L),c=new Int32Array(h.length),u,a,g,p,v,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]),v=W^C[0],k=H^C[1],F=P^C[2],j=O^C[3],X=4,Z=1;Z<M;Z++)u=d[v>>>24]^o[k>>16&255]^s[F>>8&255]^l[j&255]^C[X],a=d[k>>>24]^o[F>>16&255]^s[j>>8&255]^l[v&255]^C[X+1],g=d[F>>>24]^o[j>>16&255]^s[v>>8&255]^l[k&255]^C[X+2],p=d[j>>>24]^o[v>>16&255]^s[k>>8&255]^l[F&255]^C[X+3],v=u,k=a,F=g,j=p,X=X+4;u=T[v>>>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[v&255]^C[X+1],g=T[F>>>24]<<24^T[j>>16&255]<<16^T[v>>8&255]<<8^T[k&255]^C[X+2],p=T[j>>>24]<<24^T[v>>16&255]<<16^T[k>>8&255]<<8^T[F&255]^C[X+3],c[E]=re(u^f),c[E+1]=re(p^m),c[E+2]=re(g^w),c[E+3]=re(a^y),f=W,m=O,w=P,y=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 l=self.crypto;l&&(this.subtle=l.subtle||l.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,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(T=Object(I.appendUint8Array)(l,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(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new G.default(s,d);return S.decrypt(T.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,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,l,S,f){var m,w,y,h,c=navigator.userAgent.toLowerCase(),u=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((l[S+2]&192)>>>6)+1;var g=(l[S+2]&60)>>>2;if(g>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:"+g});return}return y=(l[S+2]&1)<<2,y|=(l[S+3]&192)>>>6,G.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+g),/firefox/i.test(c)?g>=6?(m=5,h=new Array(4),w=g-3):(m=2,h=new Array(2),w=g):c.indexOf("android")!==-1?(m=2,h=new Array(2),w=g):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&g>=6?w=g-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(g>=6&&y===1||/vivaldi/i.test(c))||!f&&y===1)&&(m=2,h=new Array(2)),w=g)),h[0]=m<<3,h[0]|=(g&14)>>1,h[1]|=(g&1)<<7,h[1]|=y<<3,m===5&&(h[1]|=(w&14)>>1,h[2]=(w&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[g],channelCount:y,codec:"mp4a.40."+m,manifestCodec:u}}function I(s,l){return s[l]===255&&(s[l+1]&246)===240}function D(s,l){return s[l+1]&1?7:9}function L(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function E(s,l){return l+5<s.length}function _(s,l){return l+1<s.length&&I(s,l)}function M(s,l){return E(s,l)&&I(s,l)&&L(s,l)<=s.length-l}function C(s,l){if(_(s,l)){var S=D(s,l);if(l+S>=s.length)return!1;var f=L(s,l);if(f<=S)return!1;var m=l+f;return m===s.length||_(s,m)}return!1}function T(s,l,S,f,m){if(!s.samplerate){var w=B(l,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,l,S,f,m){var w=D(s,l),y=L(s,l);if(y-=w,y>0){var h=S+f*m;return{headerLength:w,frameLength:y,stamp:h}}}function o(s,l,S,f,m){var w=b(s.samplerate),y=d(l,S,f,m,w);if(y){var h=y.frameLength,c=y.headerLength,u=y.stamp,a=c+h,g=Math.max(0,S+a-l.length),p;g?(p=new Uint8Array(a-c),p.set(l.subarray(S+c,l.length),0)):p=l.subarray(S+c,S+a);var v={unit:p,pts:u};return g||s.samples.push(v),{sample:v,length:a,missing:g}}}},"./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,l=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(l,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 y=Object(I.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:l,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),l=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),l(3),b(),f(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var y=o();if(y===3&&l(1),f(),f(),l(1),s())for(C=y!==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(l(1),S(),S(),M=o(),T=0;T<M;T++)S();f(),l(1);var c=o(),u=o(),a=d(1);a===0&&l(1),l(1),s()&&(D=o(),L=o(),E=o(),_=o());var g=[1,1];if(s()&&s()){var p=b();switch(p){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-D*2-L*2),height:(2-a)*(u+1)*16-(a?2:4)*(E+_),pixelRatio:g}},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 y=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(y,y+h):void 0},B=function(m,w){var y=0;return y=(m[w]&127)<<21,y|=(m[w+1]&127)<<14,y|=(m[w+2]&127)<<7,y|=m[w+3]&127,y},I=function(m,w){return G(m,w)&&B(m,w+6)+10<=m.length-w},D=function(m){for(var w=_(m),y=0;y<w.length;y++){var h=w[y];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]),y=B(m,4),h=10;return{type:w,size:y,data:m.subarray(h,h+y)}},_=function(m){for(var w=0,y=[];G(m,w);){var h=B(m,w+6);w+=10;for(var c=w+h;w+8<c;){var u=E(m.subarray(w)),a=M(u);a&&y.push(a),w+=u.size+10}U(m,w)&&(w+=10)}return y},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),y=new Uint8Array(m.data.subarray(w.length+1));return{key:m.type,info:w,data:y.buffer}},T=function(m){if(m.size<2)return;if(m.type==="TXXX"){var w=1,y=o(m.data.subarray(w),!0);w+=y.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:y,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,y=o(m.data.subarray(w),!0);w+=y.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:y,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),y=w[3]&1,h=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return h/=45,y&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,w){w===void 0&&(w=!1);var y=S();if(y){var h=y.decode(m);if(w){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var u=m.length,a,g,p,v="",k=0;k<u;){if(a=m[k++],a===0&&w)return v;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:v+=String.fromCharCode(a);break;case 12:case 13:g=m[k++],v+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=m[k++],p=m[k++],v+=String.fromCharCode((a&15)<<12|(g&63)<<6|(p&63)<<0);break;default:}}return v},s={decodeTextFrame:T},l;function S(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./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 l=L(b,d);if(l&&d+l.frameLength<=b.length){var S=l.samplesPerFrame*9e4/l.sampleRate,f=o+s*S,m={unit:b.subarray(d,d+l.frameLength),pts:f,dts:f};return T.config=[],T.channelCount=l.channelCount,T.samplerate=l.sampleRate,T.samples.push(m),{sample:m,length:l.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,l=T[b+2]>>2&3;if(d!==1&&s!==0&&s!==15&&l!==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,y=d===3?0:d===2?1:2,h=R[y*3+l],c=f===3?1:2,u=B[d][o],a=I[o],g=u*8*a,p=Math.floor(u*w/h+S)*a;if(G===null){var v=navigator.userAgent||"",k=v.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:p,samplesPerFrame:g}}}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 l=b+s;return l===T.length||_(T,l)}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,l){var S=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=l;var f=d.config,m=function(u,a){a=a||{},a.frag=S.frag,a.id=S.id,d.trigger(u,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"')},y=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:y,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,y,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,w,f,y,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 l=this.observer;l&&l.removeAllListeners(),this.observer=null},b.push=function(o,s,l,S,f,m,w,y,h,c){var u=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,p=m?m.start:f.start,v=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,y,j,p);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: `+y+`
|
|
timeOffset: `+p);var Z=new B.TransmuxConfig(l,S,s,w,c);this.configureTransmuxer(Z)}if(this.frag=f,this.part=m,g)g.postMessage({cmd:"demux",data:o,decryptdata:v,chunkMeta:h,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var re=a.push(o,v,h,X);Object(B.isPromise)(re)?re.then(function(Ee){u.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(re)}},b.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(l){var f=l.flush(o);Object(B.isPromise)(f)?f.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},b.handleFlushResult=function(o,s){var l=this;o.forEach(function(S){l.handleTransmuxComplete(S)}),this.onFlush(s)},b.onWorkerMessage=function(o){var s=o.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(o){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):l&&l.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 l=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(l)?l.then(function(m){L(C,m)}):L(C,l);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(y){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(y){var h=y.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function y(c,u,a,g,p){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=u,this.config=a,this.vendor=g,this.id=p}var h=y.prototype;return h.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},h.push=function(u,a,g,p){var v=this,k=g.transmuxing;k.executeStart=b();var F=new Uint8Array(u),j=this.cache,W=this.config,O=this.currentTransmuxState,P=this.transmuxConfig;p&&(this.currentTransmuxState=p);var H=l(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(g);F=new Uint8Array(Z)}else return this.decryptionPromise=X.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(Ce){var De=v.push(Ce,null,g);return v.decryptionPromise=null,De}),this.decryptionPromise}var re=p||O,Ee=re.contiguous,fe=re.discontinuity,Te=re.trackSwitch,ge=re.accurateTimeOffset,pe=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),Ee||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 we=this.transmux(F,H,pe,ge,g),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,k.executeEnd=b(),we},h.flush=function(u){var a=this,g=u.transmuxing;g.executeStart=b();var p=this.decrypter,v=this.cache,k=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(u)});var j=[],W=k.timeOffset;if(p){var O=p.flush();O&&j.push(this.push(O,null,u))}var P=v.dataLength;v.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"}),g.executeEnd=b(),[S(u)];var Z=H.flush(W);return f(Z)?Z.then(function(re){return a.flushRemux(j,re,u),j}):(this.flushRemux(j,Z,u),j)},h.flushRemux=function(u,a,g){var p=a.audioTrack,v=a.avcTrack,k=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,O=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var P=this.remuxer.remux(p,v,k,F,O,W,!0,this.id);u.push({remuxResult:P,chunkMeta:g}),g.transmuxing.executeEnd=b()},h.resetInitialTimestamp=function(u){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(u),g.resetTimeStamp(u)},h.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(u,a,g,p){var v=this.demuxer,k=this.remuxer;if(!v||!k)return;v.resetInitSegment(a,g,p),k.resetInitSegment(u,a,g)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(u,a,g,p,v){var k;return a&&a.method==="SAMPLE-AES"?k=this.transmuxSampleAes(u,a,g,p,v):k=this.transmuxUnencrypted(u,g,p,v),k},h.transmuxUnencrypted=function(u,a,g,p){var v=this.demuxer.demux(u,a,!1,!this.config.progressive),k=v.audioTrack,F=v.avcTrack,j=v.id3Track,W=v.textTrack,O=this.remuxer.remux(k,F,j,W,a,g,!1,this.id);return{remuxResult:O,chunkMeta:p}},h.transmuxSampleAes=function(u,a,g,p,v){var k=this;return this.demuxer.demuxSampleAes(u,a,g).then(function(F){var j=k.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,g,p,!1,k.id);return{remuxResult:j,chunkMeta:v}})},h.configureTransmuxer=function(u,a){for(var g=this.config,p=this.observer,v=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(u)){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,Ee=this.remuxer,fe=H.remux,Te=H.demux;(!Ee||!(Ee instanceof fe))&&(this.remuxer=new fe(p,g,v,k)),(!re||!(re instanceof Te))&&(this.demuxer=new Te(p,g,v),this.probe=Te.probe),this.resetInitSegment(O,F,P,W),this.resetInitialTimestamp(j)},h.needsProbing=function(u,a,g){return!this.demuxer||!this.remuxer||a||g},h.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new R.default(this.observer,this.config)),u},y}();function l(y,h){var c=null;return y.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(y){return"then"in y&&y.then instanceof Function}var m=function(h,c,u,a,g){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=u,this.duration=a,this.defaultInitPts=g},w=function(h,c,u,a,g){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=u,this.trackSwitch=a,this.timeOffset=g}},"./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,y,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=y,this.typeSupported=h}f.probe=function(y){var h=f.syncOffset(y);return h<0?!1:(h&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(y){for(var h=Math.min(1e3,y.length-3*188),c=0;c<h;){if(y[c]===71&&y[c+188]===71&&y[c+2*188]===71)return c;c++}return-1},f.createTrack=function(y,h){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:M[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(y,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=y,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var y=this._audioTrack,h=this._avcTrack,c=this._id3Track;y&&(y.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(y,h,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,g=this._avcTrack,p=this._audioTrack,v=this._id3Track,k=g.pid,F=g.pesData,j=p.pid,W=v.pid,O=p.pesData,P=v.pesData,H=!1,X=this.pmtParsed,Z=this._pmtId,re=y.length;if(this.remainderData&&(y=Object(L.appendUint8Array)(this.remainderData,y),re=y.length,this.remainderData=null),re<188&&!u)return this.remainderData=y,{audioTrack:p,avcTrack:g,id3Track:v,textTrack:this._txtTrack};var Ee=Math.max(0,f.syncOffset(y));re-=(re+Ee)%188,re<y.byteLength&&!u&&(this.remainderData=new Uint8Array(y.buffer,re,y.buffer.byteLength-re));for(var fe=Ee;fe<re;fe+=188)if(y[fe]===71){var Te=!!(y[fe+1]&64),ge=((y[fe+1]&31)<<8)+y[fe+2],pe=(y[fe+3]&48)>>4,ce=void 0;if(pe>1){if(ce=fe+5+y[fe+4],ce===fe+188)continue}else ce=fe+4;switch(ge){case k:Te&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(y.subarray(ce,fe+188)),F.size+=fe+188-ce);break;case j:Te&&(O&&(a=o(O))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(y.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(y.subarray(ce,fe+188)),P.size+=fe+188-ce);break;case 0:Te&&(ce+=y[ce]+1),Z=this._pmtId=b(y,ce);break;case Z:{Te&&(ce+=y[ce]+1);var he=d(y,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);k=he.avc,k>0&&(g.pid=k),j=he.audio,j>0&&(p.pid=j,p.isAAC=he.isAAC),W=he.id3,W>0&&(v.pid=W),H&&!X&&(E.logger.log("reparse from beginning"),H=!1,fe=Ee-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"});g.pesData=F,p.pesData=O,v.pesData=P;var J={audioTrack:p,avcTrack:g,id3Track:v,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(J),J},m.flush=function(){var y=this.remainderData;this.remainderData=null;var h;return y?h=this.demux(y,-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(y){var h=y.audioTrack,c=y.avcTrack,u=y.id3Track,a=c.pesData,g=h.pesData,p=u.pesData,v;a&&(v=o(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,g&&(v=o(g))?(h.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),h.pesData=null):(g!=null&&g.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=g),p&&(v=o(p))?(this.parseID3PES(v),u.pesData=null):u.pesData=p},m.demuxSampleAes=function(y,h,c){var u=this.demux(y,c,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,h);return this.decrypt(u,a)},m.decrypt=function(y,h){return new Promise(function(c){var u=y.audioTrack,a=y.avcTrack;u.samples&&u.isAAC?h.decryptAacSamples(u.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(y)}):c(y)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,h){var c=this,u=this._avcTrack,a=this.parseAVCNALu(y.data),g=!1,p=this.avcSample,v,k=!1;y.data=null,p&&a.length&&!u.audFound&&(s(p,u),p=this.avcSample=T(!1,y.pts,y.dts,"")),a.forEach(function(F){switch(F.type){case 1:{v=!0,p||(p=c.avcSample=T(!0,y.pts,y.dts,"")),g&&(p.debug+="NDR "),p.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)&&(p.key=!0)}break}case 5:v=!0,p||(p=c.avcSample=T(!0,y.pts,y.dts,"")),g&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{v=!0,g&&p&&(p.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 Ee=O.readUShort();if(Ee===49){var fe=O.readUInt();if(fe===1195456820){var Te=O.readUByte();if(Te===3){for(var ge=O.readUByte(),pe=O.readUByte(),ce=31&ge,he=[ge,pe],J=0;J<ce;J++)he.push(O.readUByte()),he.push(O.readUByte()),he.push(O.readUByte());l(c._txtTrack.samples,{type:3,pts:y.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,we=new Uint8Array(ye),me=0;me<ye;me++)we[me]=O.readUByte();l(c._txtTrack.samples,{pts:y.pts,payloadType:P,uuid:oe.join(""),userData:Object(B.utf8ArrayToStr)(we),userDataBytes:we})}}else if(H<O.bytesAvailable)for(var Ce=0;Ce<H;Ce++)O.readUByte()}break}case 7:if(v=!0,k=!0,g&&p&&(p.debug+="SPS "),!u.sps){var De=new R.default(F.data),Re=De.readSPS();u.width=Re.width,u.height=Re.height,u.pixelRatio=Re.pixelRatio,u.sps=[F.data],u.duration=c._duration;for(var Me=F.data.subarray(1,4),Oe="avc1.",Ae=0;Ae<3;Ae++){var We=Me[Ae].toString(16);We.length<2&&(We="0"+We),Oe+=We}u.codec=Oe}break;case 8:v=!0,g&&p&&(p.debug+="PPS "),u.pps||(u.pps=[F.data]);break;case 9:v=!1,u.audFound=!0,p&&s(p,u),p=c.avcSample=T(!1,y.pts,y.dts,g?"AUD ":"");break;case 12:v=!1;break;default:v=!1,p&&(p.debug+="unknown NAL "+F.type+" ");break}if(p&&v){var Ye=p.units;Ye.push(F)}}),h&&p&&(s(p,u),this.avcSample=null)},m.getLastNalUnit=function(){var y,h=this.avcSample,c;if(!h||h.units.length===0){var u=this._avcTrack.samples;h=u[u.length-1]}if((y=h)!==null&&y!==void 0&&y.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(y){var h=y.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,g=[],p=0,v,k,F,j=-1,W=0;for(u===-1&&(j=0,W=y[0]&31,u=0,p=1);p<h;){if(v=y[p++],!u){u=v?0:1;continue}if(u===1){u=v?0:2;continue}if(!v)u=3;else if(v===1){if(j>=0){var O={data:y.subarray(j,p-u-1),type:W};g.push(O)}else{var P=this.getLastNalUnit();if(P&&(a&&p<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),k=p-u-1,k>0)){var H=new Uint8Array(P.data.byteLength+k);H.set(P.data,0),H.set(y.subarray(0,k),P.data.byteLength),P.data=H,P.state=0}}p<h?(F=y[p]&31,j=p,W=F,u=0):u=-1}else u=0}if(j>=0&&u>=0){var X={data:y.subarray(j,h),type:W,state:u};g.push(X)}if(g.length===0){var Z=this.getLastNalUnit();if(Z){var re=new Uint8Array(Z.data.byteLength+y.byteLength);re.set(Z.data,0),re.set(y,Z.data.byteLength),Z.data=re}}return c.naluState=u,g},m.parseAACPES=function(y){var h=0,c=this._audioTrack,u=this.aacOverFlow,a=y.data;if(u){this.aacOverFlow=null;var g=u.sample.unit.byteLength,p=Math.min(u.missing,g),v=g-p;u.sample.unit.set(a.subarray(0,p),v),c.samples.push(u.sample),h=u.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(y.pts!==void 0)O=y.pts;else if(u){var P=G.getFrameDuration(c.samplerate);O=u.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(y){var h=y.data,c=h.length,u=0,a=0,g=y.pts;if(g===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(U.isHeader(h,a)){var p=U.appendFrame(this._audioTrack,h,a,g,u);if(p)a+=p.length,u++;else break}else a++},m.parseID3PES=function(y){if(y.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},f}();C.minProbeByteLength=188;function T(f,m,w,y){return{key:f,frame:!1,pts:m,dts:w,units:[],debug:y,length:0}}function b(f,m){return(f[m+10]&31)<<8|f[m+11]}function d(f,m,w,y){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],u=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<u;){var g=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!y){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=g);break;case 21:h.id3===-1&&(h.id3=g);break;case 219:if(!y){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=g);break;case 3:case 4:w?h.audio===-1&&(h.audio=g,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,y,h,c,u,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}w=a[0];var p=(w[0]<<16)+(w[1]<<8)+w[2];if(p===1){if(y=(w[4]<<8)+w[5],y&&y>f.size-6)return null;var v=w[7];v&192&&(c=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,v&64?(u=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,c-u>60*9e4&&(E.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=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 y&&(y-=h+3),{data:F,pts:c,dts:u,len:y}}return null}function s(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var w=m.samples,y=w.length;if(y){var h=w[y-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 l(f,m){var w=f.length;if(w>0){if(m.pts>=f[w-1].pts)f.push(m);else for(var y=w-1;y>=0;y--)if(m.pts<f[y].pts){f.splice(y,0,m);break}}else f.push(m)}function S(f){for(var m=f.byteLength,w=[],y=1;y<m-2;)f[y]===0&&f[y+1]===0&&f[y+2]===3?(w.push(y+2),y+=2):y++;if(w.length===0)return f;var h=m-w.length,c=new Uint8Array(h),u=0;for(y=0;y<h;u++,y++)u===w[0]&&(u++,w.shift()),c[y]=f[u];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 l(m,w){for(var y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function S(m,w,y){return w&&l(m.prototype,w),y&&l(m,y),m}var f=function(){m.isSupported=function(){return Object(M.isSupported)()};function m(y){y===void 0&&(y={}),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,y);this.userConfig=y,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(T.enableStreamingMode)(h);var c=h.abrController,u=h.bufferController,a=h.capLevelController,g=h.fpsController,p=this.abrController=new c(this),v=this.bufferController=new u(this),k=this.capLevelController=new a(this),F=new g(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,p,v,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,u){if(h){var a=c?new h(this,c):new h(this);return u&&u.push(a),a}return null},w.on=function(h,c,u){u===void 0&&(u=this),this._emitter.on(h,c,u)},w.once=function(h,c,u){u===void 0&&(u=this),this._emitter.once(h,c,u)},w.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},w.off=function(h,c,u,a){u===void 0&&(u=this),this._emitter.off(h,c,u,a)},w.listeners=function(h){return this._emitter.listeners(h)},w.emit=function(h,c,u){return this._emitter.emit(h,c,u)},w.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(u){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:u})}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,u=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&u&&u!==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 u=h.length,a=0;a<u;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,u;return c===-1&&h&&h.length?u=h.length-1:u=c,u}},{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(l){if(l===null||!L(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,S)}function S(){return I(l,arguments,_(this).constructor)}return S.prototype=Object.create(l.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),E(S,l)},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 y=Function.bind.apply(S,w),h=new y;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(l,S){return l.__proto__=S,l},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(l,S){var f=this,m=l.url;if(!m)return Promise.reject(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var w=this.config,y=w.fLoader,h=w.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=l.loader=y?new y(w):new h(w),g=T(l),p={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:M};l.stats=a.stats,a.load(g,p,{onSuccess:function(k,F,j,W){f.resetLoader(l,a),c({frag:l,part:null,payload:k.data,networkDetails:W})},onError:function(k,F,j){f.resetLoader(l,a),u(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:k,networkDetails:j}))},onAbort:function(k,F,j){f.resetLoader(l,a),u(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(k,F,j){f.resetLoader(l,a),u(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(k,F,j,W){S&&S({frag:l,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(l,S,f){var m=this;this.abort();var w=this.config,y=w.fLoader,h=w.loader;return new Promise(function(c,u){m.loader&&m.loader.destroy();var a=m.loader=l.loader=y?new y(w):new h(w),g=T(l,S),p={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:M};S.stats=a.stats,a.load(g,p,{onSuccess:function(k,F,j,W){m.resetLoader(l,a),m.updateStatsFromPart(l,S);var O={frag:l,part:S,payload:k.data,networkDetails:W};f(O),c(O)},onError:function(k,F,j){m.resetLoader(l,a),u(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:S,response:k,networkDetails:j}))},onAbort:function(k,F,j){l.stats.aborted=S.stats.aborted,m.resetLoader(l,a),u(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:S,networkDetails:j}))},onTimeout:function(k,F,j){m.resetLoader(l,a),u(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(l,S){var f=l.stats,m=S.stats,w=m.total;if(f.loaded+=m.loaded,w){var y=Math.round(l.duration/S.duration),h=Math.min(Math.round(f.loaded/w),y),c=y-h,u=c*Math.round(f.loaded/h);f.total=f.loaded+u}else f.total=Math.max(f.loaded,f.total);var a=f.loading,g=m.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(l,S){l.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,l={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)&&(l.rangeStart=S,l.rangeEnd=f),l}var b=function(d){R(o,d);function o(s){for(var l,S=arguments.length,f=new Array(S>1?S-1:0),m=1;m<S;m++)f[m-1]=arguments[m];return l=d.call.apply(d,[this].concat(f))||this,l.data=void 0,l.data=s,l}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 l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function M(o,s,l){return s&&_(o.prototype,s),l&&_(o,l),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var T=function(){function o(l){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=l}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 l=s.prototype;return l.createInitializationVector=function(f){for(var m=new Uint8Array(16),w=12;w<16;w++)m[w]=f>>8*(15-w)&255;return m},l.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},l.setElementaryStreamInfo=function(f,m,w,y,h,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[f];if(!a){u[f]={startPTS:m,endPTS:w,startDTS:y,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,y),a.endDTS=Math.max(a.endDTS,h)},l.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(l,S,f,m,w){var y;y=o.call(this,f)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new D.LoadStats,y.duration=l.decimalFloatingPoint("DURATION"),y.gap=l.bool("GAP"),y.independent=l.bool("INDEPENDENT"),y.relurl=l.enumeratedString("URI"),y.fragment=S,y.index=m;var h=l.enumeratedString("BYTERANGE");return h&&y.setByteRange(h,w),w&&(y.fragOffset=w.fragOffset+w.duration),y}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 l={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(l,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 y,h;return d.test((y=(h=U.parseURL(w))===null||h===void 0?void 0:h.path)!=null?y:"")}var s=function(){function w(){}return w.findGroup=function(h,c){for(var u=0;u<h.length;u++){var a=h[u];if(a.id===c)return a}},w.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return h},w.resolve=function(h,c){return U.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(h,c){var u=[],a={},g=!1;M.lastIndex=0;for(var p;(p=M.exec(h))!=null;)if(p[1]){var v=new L.AttrList(p[1]),k={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:w.resolve(p[2],c)},F=v.decimalResolution("RESOLUTION");F&&(k.width=F.width,k.height=F.height),l((v.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=w.convertAVC1ToAVCOTI(k.videoCodec)),u.push(k)}else if(p[3]){var j=new L.AttrList(p[3]);j["DATA-ID"]&&(g=!0,a[j["DATA-ID"]]=j)}return{levels:u,sessionData:g?a:null}},w.parseMasterPlaylistMedia=function(h,c,u,a){a===void 0&&(a=[]);var g,p=[],v=0;for(C.lastIndex=0;(g=C.exec(h))!==null;){var k=new L.AttrList(g[1]);if(k.TYPE===u){var F={attrs:k,bitrate:0,id:v++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:u,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")}p.push(F)}}return p},w.parseLevelPlaylist=function(h,c,u,a,g){var p=new I.LevelDetails(c),v=p.fragments,k=null,F=0,j=0,W=0,O=0,P=null,H=new B.Fragment(a,c),X,Z,re,Ee=-1,fe=!1;for(T.lastIndex=0,p.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=u,k&&(H.initSegment=k,H.rawProgramDateTime=k.rawProgramDateTime));var Te=X[1];if(Te){H.duration=parseFloat(Te);var ge=(" "+X[2]).slice(1);H.title=ge||null,H.tagList.push(ge?["INF",Te,ge]:["INF",Te])}else if(X[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,re&&(H.levelkey=re),H.sn=F,H.level=u,H.cc=O,H.urlId=g,v.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 pe=(" "+X[4]).slice(1);P?H.setByteRange(pe,P):H.setByteRange(pe)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Ee===-1&&(Ee=v.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":p.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":F=p.startSN=parseInt(he);break;case"SKIP":{var oe=new L.AttrList(he),q=oe.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(q)){p.skippedSegments=q;for(var ye=q;ye--;)v.unshift(null);F+=q}var we=oe.enumeratedString("RECENTLY-REMOVED-DATERANGES");we&&(p.recentlyRemovedDateranges=we.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(he);break;case"VERSION":p.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":p.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,Ce=new L.AttrList(he),De=Ce.enumeratedString("METHOD"),Re=Ce.URI,Me=Ce.hexadecimalInteger("IV"),Oe=Ce.enumeratedString("KEYFORMATVERSIONS"),Ae=Ce.enumeratedString("KEYID"),We=(me=Ce.enumeratedString("KEYFORMAT"))!=null?me:"identity",Ye=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ye.indexOf(We)>-1){E.logger.warn("Keyformat "+We+" is not supported from the manifest");continue}else if(We!=="identity")continue;De&&(re=D.LevelKey.fromURL(c,Re),Re&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(re.method=De,re.keyFormat=We,Ae&&(re.keyID=Ae),Oe&&(re.keyFormatVersions=Oe),re.iv=Me));break}case"START":{var Xe=new L.AttrList(he),Be=Xe.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(Be)&&(p.startTimeOffset=Be);break}case"MAP":{var qe=new L.AttrList(he);H.relurl=qe.URI,qe.BYTERANGE&&H.setByteRange(qe.BYTERANGE),H.level=u,H.sn="initSegment",re&&(H.levelkey=re),H.initSegment=null,k=H,fe=!0;break}case"SERVER-CONTROL":{var He=new L.AttrList(he);p.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),p.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Je=new L.AttrList(he);p.partTarget=Je.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=p.partList;Se||(Se=p.partList=[]);var $e=j>0?Se[Se.length-1]:void 0,Ke=j++,Le=new B.Part(new L.AttrList(he),H,c,Ke,$e);Se.push(Le),H.duration+=Le.duration;break}case"PRELOAD-HINT":{var ke=new L.AttrList(he);p.preloadHint=ke;break}case"RENDITION-REPORT":{var le=new L.AttrList(he);p.renditionReports=p.renditionReports||[],p.renditionReports.push(le);break}default:E.logger.warn("line parsed but not handled: "+X);break}}}P&&!P.relurl?(v.pop(),W-=P.duration,p.partList&&(p.fragmentHint=P)):p.partList&&(m(H,P),H.cc=O,p.fragmentHint=H);var ae=v.length,ue=v[0],$=v[ae-1];if(W+=p.skippedSegments*p.targetduration,W>0&&ae&&$){p.averagetargetduration=W/ae;var Q=$.sn;p.endSN=Q!=="initSegment"?Q:0,ue&&(p.startCC=ue.cc,ue.initSegment||p.fragments.every(function(ee){return ee.relurl&&o(ee.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=u,H.sn="initSegment",ue.initSegment=H,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(W+=p.fragmentHint.duration),p.totalduration=W,p.endCC=O,Ee>0&&f(v,Ee),p},w}();function l(w,y){["video","audio","text"].forEach(function(h){var c=w.filter(function(a){return Object(_.isCodecType)(a,h)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[h+"Codec"]=u.length>0?u[0]:c[0],w=w.filter(function(a){return c.indexOf(a)===-1})}}),y.unknownCodecs=w}function S(w,y,h){var c=y[h];c&&(w[h]=c)}function f(w,y){for(var h=w[y],c=y;c--;){var u=w[c];if(!u)return;u.programDateTime=h.programDateTime-u.duration*1e3,h=u}}function m(w,y){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):y!=null&&y.programDateTime&&(w.programDateTime=y.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,l=s.pLoader,S=s.loader,f=l||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 l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},b.onLevelLoading=function(o,s){var l=s.id,S=s.level,f=s.url,m=s.deliveryDirectives;this.load({id:l,groupId:null,level:S,responseType:"text",type:L.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},b.onAudioTrackLoading=function(o,s){var l=s.id,S=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},b.onSubtitleTrackLoading=function(o,s){var l=s.id,S=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},b.load=function(o){var s,l=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,y,h;switch(o.type){case L.PlaylistContextType.MANIFEST:m=l.manifestLoadingMaxRetry,w=l.manifestLoadingTimeOut,y=l.manifestLoadingRetryDelay,h=l.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:m=0,w=l.levelLoadingTimeOut;break;default:m=l.levelLoadingMaxRetry,w=l.levelLoadingTimeOut,y=l.levelLoadingRetryDelay,h=l.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 u=c.partTarget,a=c.targetduration;u&&a&&(w=Math.min(Math.max(u*3,a*.8)*1e3,w))}}var g={timeout:w,maxRetry:m,retryDelay:y,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,g,p)},b.loadsuccess=function(o,s,l,S){if(S===void 0&&(S=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,s,l,S);return}this.resetInternalLoader(l.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,l,S):this.handleMasterPlaylist(o,s,l,S)},b.loaderror=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,o)},b.loadtimeout=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},b.handleMasterPlaylist=function(o,s,l,S){var f=this.hls,m=o.data,w=M(o,l),y=D.default.parseMasterPlaylist(m,w),h=y.levels,c=y.sessionData;if(!h.length){this.handleManifestParsingError(o,l,"no level found in manifest",S);return}var u=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}}),g=D.default.parseMasterPlaylistMedia(m,w,"AUDIO",u),p=D.default.parseMasterPlaylistMedia(m,w,"SUBTITLES",a),v=D.default.parseMasterPlaylistMedia(m,w,"CLOSED-CAPTIONS");if(g.length){var k=g.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"),g.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:g,subtitles:p,captions:v,url:w,stats:s,networkDetails:S,sessionData:c})},b.handleTrackOrLevelPlaylist=function(o,s,l,S){var f=this.hls,m=l.id,w=l.level,y=l.type,h=M(o,l),c=Object(G.isFiniteNumber)(m)?m:0,u=Object(G.isFiniteNumber)(w)?w:c,a=_(l),g=D.default.parseLevelPlaylist(o.data,h,u,a,c);if(!g.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 l.level=="number"?l.level:void 0});return}if(y===L.PlaylistContextType.MANIFEST){var p={attrs:new E.AttrList({}),bitrate:0,details:g,name:"",url:h};f.trigger(U.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),g.needSidxRanges){var v,k=(v=g.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:k,isSidxRequest:!0,type:y,level:w,levelDetails:g,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=g,this.handlePlaylistLoaded(o,s,l,S)},b.handleSidxRequest=function(o,s){var l=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!l)return;var S=l.references,f=s.levelDetails;S.forEach(function(m,w){var y=m.info,h=f.fragments[w];h.byteRange.length===0&&h.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),h.initSegment&&h.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(o,s,l,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:l,response:o,context:s,networkDetails:S})},b.handleNetworkError=function(o,s,l,S){l===void 0&&(l=!1),B.logger.warn("[playlist-loader]: A network "+(l?"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=l?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:f=l?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:f=l?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:f=l?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}w&&this.resetInternalLoader(o.type);var y={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:w,context:o,networkDetails:s};S&&(y.response=S),this.hls.trigger(U.Events.ERROR,y)},b.handlePlaylistLoaded=function(o,s,l,S){var f=l.type,m=l.level,w=l.id,y=l.groupId,h=l.loader,c=l.levelDetails,u=l.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,l,"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:u});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:w||0,groupId:y||"",stats:s,networkDetails:S,deliveryDirectives:u});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:w||0,groupId:y||"",stats:s,networkDetails:S,deliveryDirectives:u});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 l});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 y=1;y<arguments.length;y++){var h=arguments[y];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,u,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=u,this.ISGenerated=!1,b===null){var g=navigator.userAgent||"",p=g.match(/Chrome\/(\d+)/i);b=p?parseInt(p[1]):0}if(d===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);d=v?parseInt(v[1]):0}o=!!b&&b<75||!!d&&d<600}var y=w.prototype;return y.destroy=function(){},y.resetTimeStamp=function(c){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},y.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(g,p){var v=p.pts-g;return v<-4294967296?(u=!0,l(g,p.pts)):v>0?g:p.pts},c[0].pts);return u&&D.logger.debug("PTS rollover detected"),a},y.remux=function(c,u,a,g,p,v,k,F){var j,W,O,P,H,X,Z=p,re=p,Ee=c.pid>-1,fe=u.pid>-1,Te=u.samples.length,ge=c.samples.length>0,pe=Te>1,ce=(!Ee||ge)&&(!fe||pe)||this.ISGenerated||k;if(ce){this.ISGenerated||(O=this.generateIS(c,u,p));var he=this.isVideoContiguous,J=-1;if(pe&&(J=S(u.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(u.samples);u.samples=u.samples.slice(J),u.dropped+=J,re+=(u.samples[0].pts-oe)/(u.timescale||9e4)}else J===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),X=!1);if(this.ISGenerated){if(ge&&pe){var q=this.getVideoStartPts(u.samples),ye=l(c.samples[0].pts,q)-q,we=ye/u.inputTimeScale;Z+=Math.max(0,we),re+=Math.max(0,-we)}if(ge){if(c.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(c,u,p)),W=this.remuxAudio(c,Z,this.isAudioContiguous,v,fe||pe||F===L.PlaylistLevelType.AUDIO?re:void 0),pe){var me=W?W.endPTS-W.startPTS:0;u.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(c,u,p)),j=this.remuxVideo(u,re,he,me)}}else pe&&(j=this.remuxVideo(u,re,he,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,p)),g.samples.length&&(P=this.remuxText(g,p))),{audio:W,video:j,initSegment:O,independent:X,text:P,id3:H}},y.generateIS=function(c,u,a){var g=c.samples,p=u.samples,v=this.typeSupported,k={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,O,P;if(F&&(W=O=Infinity),c.config&&g.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(j="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),k.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=O=g[0].pts-Math.round(P*a))),u.sps&&u.pps&&p.length&&(u.timescale=u.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:R.default.initSegment([u]),metadata:{width:u.width,height:u.height}},F)){P=u.inputTimeScale;var H=this.getVideoStartPts(p),X=Math.round(P*a);O=Math.min(O,l(p[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}},y.remuxVideo=function(c,u,a,g){var p=c.inputTimeScale,v=c.samples,k=[],F=v.length,j=this._initPTS,W=this.nextAvcDts,O=8,P,H,X,Z=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY,Ee=0,fe=!1;if(!a||W===null){var Te=u*p,ge=v[0].pts-l(v[0].dts,v[0].pts);W=Te-ge}for(var pe=0;pe<F;pe++){var ce=v[pe];if(ce.pts=l(ce.pts-j,W),ce.dts=l(ce.dts-j,W),ce.dts>ce.pts){var he=9e4*.2;Ee=Math.max(Math.min(Ee,ce.pts-ce.dts),-1*he)}ce.dts<v[pe>0?pe-1:pe].dts&&(fe=!0)}fe&&v.sort(function(Lt,mt){var st=Lt.dts-mt.dts,It=Lt.pts-mt.pts;return st||It}),H=v[0].dts,X=v[v.length-1].dts;var J=Math.round((X-H)/(F-1));if(Ee<0){if(Ee<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=Ee,q=0;q<F;q++)v[q].dts=oe=Math.max(oe,v[q].pts-J),v[q].pts=Math.max(oe,v[q].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var ye=0;ye<F;ye++)v[ye].dts=v[ye].dts+Ee}H=v[0].dts}if(a){var we=H-W,me=we>J,Ce=we<-1;if(me||Ce){me?D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(we,!0)+" ms ("+we+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-we,!0)+" ms ("+we+"dts) overlapping between fragments detected"),H=W;var De=v[0].pts-we;v[0].dts=H,v[0].pts=De,D.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(De,!0)+"/"+Object(E.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(we,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Re=0,Me=0,Oe=0;Oe<F;Oe++){for(var Ae=v[Oe],We=Ae.units,Ye=We.length,Xe=0,Be=0;Be<Ye;Be++)Xe+=We[Be].data.length;Me+=Xe,Re+=Ye,Ae.length=Xe,Ae.dts=Math.max(Ae.dts,H),Ae.pts=Math.max(Ae.pts,Ae.dts,0),Z=Math.min(Ae.pts,Z),re=Math.max(Ae.pts,re)}X=v[F-1].dts;var qe=Me+4*Re+8,He;try{He=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 Je=new DataView(He.buffer);Je.setUint32(0,qe),He.set(R.default.types.mdat,4);for(var Se=0;Se<F;Se++){for(var $e=v[Se],Ke=$e.units,Le=0,ke=0,le=Ke.length;ke<le;ke++){var ae=Ke[ke],ue=ae.data,$=ae.data.byteLength;Je.setUint32(O,$),O+=4,He.set(ue,O),O+=$,Le+=4+$}if(Se<F-1)P=v[Se+1].dts-$e.dts;else{var Q=this.config,ee=$e.dts-v[Se>0?Se-1:Se].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var ie=Math.floor(Q.maxBufferHole*p),be=(g?Z+g*p:this.nextAudioPts)-$e.pts;be>ie?(P=be-ee,P<0&&(P=ee),D.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=ee}else P=ee}var _e=Math.round($e.pts-$e.dts);k.push(new f($e.key,P,Le,_e))}if(k.length&&b&&b<70){var Ue=k[0].flags;Ue.dependsOn=2,Ue.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:He,startPTS:Z/p,endPTS:(re+P)/p,startDTS:H/p,endDTS:W/p,type:dt,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(He.length,"MDAT length must not be zero"),it},y.remuxAudio=function(c,u,a,g,p){var v=c.inputTimeScale,k=c.samplerate?c.samplerate:v,F=v/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,Ee=u*v;if(this.isAudioContiguous=a=a||X.length&&re>0&&(g&&Math.abs(Ee-re)<9e3||Math.abs(l(X[0].pts-O,Ee)-re)<20*W),X.forEach(function(ue){ue.pts=l(ue.pts-O,Ee)}),!a||re<0){if(X=X.filter(function(ue){return ue.pts>=0}),!X.length)return;p===0?re=0:g?re=Math.max(0,Ee):re=X[0].pts}if(c.isAAC)for(var fe=p!==void 0,Te=this.config.maxAudioFramesDrift,ge=0,pe=re;ge<X.length;ge++){var ce=X[ge],he=ce.pts,J=he-pe,oe=Math.abs(1e3*J/v);if(J<=-Te*W&&fe)ge===0&&(D.logger.warn("Audio frame @ "+(he/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/v)+" ms."),this.nextAudioPts=re=pe=he);else if(J>=Te*W&&oe<M&&fe){var q=Math.round(J/W);pe=he-q*W,pe<0&&(q--,pe+=W),ge===0&&(this.nextAudioPts=re=pe),D.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(pe/v).toFixed(3)+"s due to "+Math.round(1e3*J/v)+" ms gap.");for(var ye=0;ye<q;ye++){var we=Math.max(pe,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(ge,0,{unit:me,pts:we}),pe+=W,ge++}}ce.pts=pe,pe+=W}for(var Ce=null,De=null,Re,Me=0,Oe=X.length;Oe--;)Me+=X[Oe].unit.byteLength;for(var Ae=0,We=X.length;Ae<We;Ae++){var Ye=X[Ae],Xe=Ye.unit,Be=Ye.pts;if(De!==null){var qe=H[Ae-1];qe.duration=Math.round((Be-De)/F)}else if(a&&c.isAAC&&(Be=re),Ce=Be,Me>0){Me+=Z;try{Re=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 He=new DataView(Re.buffer);He.setUint32(0,Me),Re.set(R.default.types.mdat,4)}}else return;Re.set(Xe,Z);var Je=Xe.byteLength;Z+=Je,H.push(new f(!0,j,Je,0)),De=Be}var Se=H.length;if(!Se)return;var $e=H[H.length-1];this.nextAudioPts=re=De+F*$e.duration;var Ke=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,Ce/F,_({},c,{samples:H}));c.samples=[];var Le=Ce/v,ke=re/v,le="audio",ae={data1:Ke,data2:Re,startPTS:Le,endPTS:ke,startDTS:Le,endDTS:ke,type:le,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(Re.length,"MDAT length must not be zero"),ae},y.remuxEmptyAudio=function(c,u,a,g){var p=c.inputTimeScale,v=c.samplerate?c.samplerate:p,k=p/v,F=this.nextAudioPts,j=(F!==null?F:g.startDTS*p)+this._initDTS,W=g.endDTS*p+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,u,a,!1)},y.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,p=this._initPTS,v=this._initDTS,k=0;k<a;k++){var F=c.samples[k];F.pts=l(F.pts-p,u*g)/g,F.dts=l(F.dts-v,u*g)/g}var j=c.samples;return c.samples=[],{samples:j}},y.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,p=this._initPTS,v=0;v<a;v++){var k=c.samples[v];k.pts=l(k.pts-p,u*g)/g}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},w}();function l(w,y){var h;if(y===null)return w;for(y<w?h=-8589934592:h=8589934592;Math.abs(w-y)>4294967296;)w+=h;return w}function S(w){for(var y=0;y<w.length;y++)if(w[y].key)return y;return-1}var f=function(y,h,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=u,this.flags=new m(y)},m=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?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,l=this.lastEndDTS,S={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(G.isFiniteNumber)(l)||(l=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,l));var y=Object(U.getDuration)(f,w),h=l,c=y+h;Object(U.offsetStartDTS)(w,f,s),y>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!w.audio,a=!!w.video,g="";u&&(g+="audio"),a&&(g+="video");var p={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:g,hasAudio:u,hasVideo:a,nb:1,dropped:0};return S.audio=p.type==="audio"?p:void 0,S.video=p.type!=="audio"?p: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 y=m.start-w.start;return y||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,l=0;l<_.length;l++){var S=_[l].start,f=_[l].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 l});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 u=c;return U.hasOwnProperty(c)&&(u=U[c]),String.fromCharCode(u)},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,g){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+g)},h}(),b=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},d=function(){function h(u,a,g,p,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=g||!1,this.background=p||"black",this.flash=v||!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 g=["foreground","underline","italics","background","flash"],p=0;p<g.length;p++){var v=g[p];a.hasOwnProperty(v)&&(this[v]=a[v])}},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(u,a,g,p,v,k){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(a,g,p,v,k)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},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(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<I;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var g=!0,p=0;p<I;p++)if(!this.chars[p].equals(a.chars[p])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<I;g++)this.chars[g].copy(a.chars[g])},c.isEmpty=function(){for(var a=!0,g=0;g<I;g++)if(!this.chars[g].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 g=this.pos+a;if(a>1)for(var p=this.pos+1;p<g+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(g)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var g=R(a);if(this.pos>=I){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var g;for(g=a;g<I;g++)this.chars[g].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=[],g=!0,p=0;p<I;p++){var v=this.chars[p].uchar;v!==" "&&(g=!1),a.push(v)}return g?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},h}(),l=function(){function h(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(u));this.logger=u,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 g=!0,p=0;p<B;p++)if(!this.rows[p].equals(a.rows[p])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<B;g++)this.rows[g].copy(a.rows[g])},c.isEmpty=function(){for(var a=!0,g=0;g<B;g++)if(!this.rows[g].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 g=this.rows[this.currRow];g.insertChar(a)},c.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},c.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var p=0;p<B;p++)this.rows[p].clear();var v=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var F=k.rows[v].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[g-this.nrRollUpRows+W+1].copy(k.rows[v+W])}}this.currRow=g;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,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var g=[],p="",v=-1,k=0;k<B;k++){var F=this.rows[k].getTextString();F&&(v=k+1,a?g.push("Row "+v+": '"+F+"'"):g.push(F.trim()))}return g.length>0&&(a?p="["+g.join(" | ")+"]":p=g.join(`
|
|
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),S=function(){function h(u,a,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new l(g),this.nonDisplayedMemory=new l(g),this.lastOutputScreen=new l(g),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}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 g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,p+": "+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 g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var p=Math.floor(a/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=v[p]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),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(u,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new T;this.channels=[null,new S(u,a,p),new S(u+1,g,p)],this.cmdHistory=y(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,g){this.channels[a].setHandler(g)},c.addData=function(a,g){var p,v,k,F=!1;this.logger.time=a;for(var j=0;j<g.length;j+=2){if(v=g[j]&127,k=g[j+1]&127,v===0&&k===0)continue;if(this.logger.log(C.DATA,"["+b([g[j],g[j+1]])+"] -> ("+b([v,k])+")"),p=this.parseCmd(v,k),p||(p=this.parseMidrow(v,k)),p||(p=this.parsePAC(v,k)),p||(p=this.parseBackgroundAttributes(v,k)),!p&&(F=this.parseChars(v,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?")}!p&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+b([v,k])+" orig: "+b([g[j],g[j+1]]))}},c.parseCmd=function(a,g){var p=this.cmdHistory,v=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,k=(a===23||a===31)&&g>=33&&g<=35;if(!(v||k))return!1;if(w(a,g,p))return m(null,null,p),this.logger.log(C.DEBUG,"Repeated command ("+b([a,g])+") 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?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),m(a,g,p),this.currentChannel=F,!0},c.parseMidrow=function(a,g){var p=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[p];return v?(v.ccMIDROW(g),this.logger.log(C.DEBUG,"MIDROW ("+b([a,g])+")"),!0):!1}return!1},c.parsePAC=function(a,g){var p,v=this.cmdHistory,k=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,F=(a===16||a===24)&&g>=64&&g<=95;if(!(k||F))return!1;if(w(a,g,v))return m(null,null,v),!0;var j=a<=23?1:2;g>=64&&g<=95?p=j===1?D[a]:E[a]:p=j===1?L[a]:_[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(p,g)),m(a,g,v),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,g){var p,v={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?p=g-96:p=g-64,v.underline=(p&1)===1,p<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((p-16)/2)*4,v},c.parseChars=function(a,g){var p,v=null,k=null;if(a>=25?(p=2,k=a-8):(p=1,k=a),k>=17&&k<=19){var F;k===17?F=g+80:k===18?F=g+112:F=g+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+p),v=[F]}else a>=32&&a<=127&&(v=g===0?[a]:[a,g]);if(v){var j=b(v);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),m(a,g,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(a,g){var p=(a===16||a===24)&&g>=32&&g<=47,v=(a===23||a===31)&&g>=45&&g<=47;if(!(p||v))return!1;var k,F={};a===16||a===24?(k=Math.floor((g-32)/2),F.background=M[k],g%2===1&&(F.background=F.background+"_semi")):g===45?F.background="transparent":(F.foreground="black",g===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),m(a,g,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=y()},c.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var p=this.channels[g];p&&p.cueSplitAtTime(a)}},h}();function m(h,c,u){u.a=h,u.b=c}function w(h,c,u){return u.a===h&&u.b===c}function y(){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,l=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 l(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(y,h){return y.line==="auto"||h.line==="auto"?0:y.line>8&&h.line>8?h.line-y.line:y.line-h.line}),C.forEach(function(y){return Object(R.addCueToTrack)(L,y)})),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,l=0,S=d.length;l<S;l++){var f=d[l];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,l=o.fragments;if(!l.length||!s.length){U.logger.log("No fragments to align");return}var S=B(s,l[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,l=0,S=s.length;l<S;l++)L(s[l],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 l=D(s.details,o);l&&Object(G.isFiniteNumber)(l.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(l.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=d.fragments[0].programDateTime,S=(l-s)/1e3+o.fragments[0].start;S&&Object(G.isFiniteNumber)(S)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+S.toFixed(3)+" "+d.url+" "),E(S,d))}function T(d,o){var s=d.programDateTime;if(!s)return;var l=(s-o)/1e3;d.start=d.startPTS=l,d.endPTS=l+d.duration}function b(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=o.fragments[0].start,S=s-l*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(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,_(l,S)}function I(l){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(l)}function D(l,S,f){return L()?D=Reflect.construct:D=function(w,y,h){var c=[null];c.push.apply(c,y);var u=Function.bind.apply(w,c),a=new u;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(l){return!1}}function E(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function _(l,S){return _=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},_(l,S)}function M(l){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},M(l)}function C(){return C=Object.assign||function(l){for(var S=1;S<arguments.length;S++){var f=arguments[S];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(l[m]=f[m])}return l},C.apply(this,arguments)}function T(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var b=function(){function l(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=l.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,y){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 u=d(m,this.controller.signal),a=y.onProgress,g=m.responseType==="arraybuffer",p=g?"byteLength":"length";this.context=m,this.config=w,this.callbacks=y,this.request=this.fetchSetup(m,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),y.onTimeout(c,m,h.response)},w.timeout),self.fetch(this.request).then(function(v){if(h.response=h.loader=v,!v.ok){var k=v.status,F=v.statusText;throw new s(F||"fetch, bad network response",k,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(w.highWaterMark)?h.loadProgressively(v,c,m,w.highWaterMark,a):g?v.arrayBuffer():v.text()}).then(function(v){var k=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[p];var F={url:k.url,data:v};a&&!Object(G.isFiniteNumber)(w.highWaterMark)&&a(c,m,v,k),y.onSuccess(F,c,m,k)}).catch(function(v){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var k=v.code||0;y.onError({code:k,text:v.message},m,v.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,y,h,c){h===void 0&&(h=0);var u=new R.default,a=m.body.getReader(),g=function p(){return a.read().then(function(v){if(v.done)return u.dataLength&&c(w,y,u.flush(),m),Promise.resolve(new ArrayBuffer(0));var k=v.value,F=k.length;return w.loaded+=F,F<h||u.dataLength?(u.push(k),u.dataLength>=h&&c(w,y,u.flush(),m)):c(w,y,k,m),p()}).catch(function(){return Promise.reject()})};return g()},l}();function d(l,S){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},l.headers))};return l.rangeEnd&&f.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),f}function o(l,S){return new self.Request(l.url,S)}var s=function(l){B(S,l);function S(f,m,w){var y;return y=l.call(this,f)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=w,y}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 u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(h[a]=u[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,u,a,g){var p=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var v=p[0],k=Object(B.utf8ArrayToStr)(new Uint8Array(h,v.start,v.end-v.start)),F=Object(I.toTimescaleFromScale)(c,1,u);try{a(b(k,F))}catch(j){g(j)}}function b(h,c){var u=new DOMParser,a=u.parseFromString(h,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(p).reduce(function(O,P){return O[P]=g.getAttribute("ttp:"+P)||p[P],O},{}),k=g.getAttribute("xml:space")!=="preserve",F=o(d(g,"styling","style")),j=o(d(g,"layout","region")),W=d(g,"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"),v),X=m(O.getAttribute("dur"),v),Z=m(O.getAttribute("end"),v);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 Ee=j[O.getAttribute("region")],fe=F[O.getAttribute("style")];re.position=10,re.size=80;var Te=l(Ee,fe),ge=Te.textAlign;if(ge){var pe=C[ge];pe&&(re.lineAlign=pe),re.align=ge}return L(re,Te),re}).filter(function(O){return O!==null})}function d(h,c,u){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(h){return h.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(u,a,g){var p;return a.nodeName==="br"&&g?u+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?s(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function l(h,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,p){var v=S(c,u,p)||S(h,u,p);return v&&(g[p]=v),g},{})}function S(h,c,u){return h.hasAttributeNS(c,u)?h.getAttributeNS(c,u):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var u=Object(U.parseTimeStamp)(h);return u===null&&(_.test(h)?u=w(h,c):M.test(h)&&(u=y(h,c))),u}function w(h,c){var u=_.exec(h),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function y(h,c){var u=M.exec(h),a=Number(u[1]),g=u[2];switch(g){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 l});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,y,h;"data"in S?(w=S.data,y=S.start,h=S.end):(w=S,y=0,h=w.byteLength);for(var c=y;c<h;){var u=L(w,c),a=I(w.subarray(c+4,c+8)),g=u>1?c+u:h;if(a===f[0])if(f.length===1)m.push({data:w,start:c+8,end:g});else{var p=_({data:w,start:c+8,end:g},f.slice(1));p.length&&B.apply(m,p)}c=g}return m}function M(S){var f=_(S,["moov"]),m=f[0],w=m?m.end:null,y=_(S,["sidx"]);if(!y||!y[0])return null;var h=[],c=y[0],u=c.data[0],a=u===0?8:16,g=L(c,a);a+=4;var p=0,v=0;u===0?a+=8:a+=16,a+=2;var k=c.end+v,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/g,start:k,end:k+P-1}}),k+=P,W+=4,a=W}return{earliestPresentationTime:p,timescale:g,version:u,referencesCount:F,references:h,moovEndOffset:w}}function C(S){for(var f=[],m=_(S,["moov","trak"]),w=0;w<m.length;w++){var y=m[w],h=_(y,["tkhd"])[0];if(h){var c=h.data[h.start],u=c===0?12:20,a=L(h,u),g=_(y,["mdia","mdhd"])[0];if(g){c=g.data[g.start],u=c===0?12:20;var p=L(g,u),v=_(y,["mdia","hdlr"])[0];if(v){var k=I(v.data.subarray(v.start+8,v.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[k];if(F){var j=_(y,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=I(j.data.subarray(j.start+12,j.start+16))),f[a]={timescale:p,type:F},f[F]={timescale:p,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 y=_(w,["tfdt"])[0],h=y.data[y.start],c=_(w,["tfhd"]).reduce(function(u,a){var g=L(a,4),p=S[g];if(p){var v=L(y,4);h===1&&(v*=Math.pow(2,32),v+=L(y,8));var k=p.timescale||9e4,F=v/k;if(isFinite(F)&&(u===null||F<u))return F}return u},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function b(S,f){for(var m=0,w=0,y=0,h=_(S,["moof","traf"]),c=0;c<h.length;c++){var u=h[c],a=_(u,["tfhd"])[0],g=L(a,4),p=f[g];if(!p)continue;var v=p.default,k=L(a,0)|(v==null?void 0:v.flags),F=v==null?void 0:v.duration;k&8&&(k&2?F=L(a,12):F=L(a,8));for(var j=p.timescale||9e4,W=_(u,["trun"]),O=0;O<W.length;O++){if(F){var P=L(W[O],4);m=F*P}else m=d(W[O]);p.type===U.ElementaryStreamTypes.VIDEO?w+=m/j:p.type===U.ElementaryStreamTypes.AUDIO&&(y+=m/j)}}if(w===0&&y===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||y}function d(S){var f=L(S,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var w=0,y=L(S,4),h=0;h<y;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(y){var h=L(y,4),c=S[h];if(!c)return;var u=c.timescale||9e4;_(w,["tfdt"]).forEach(function(a){var g=a.data[a.start],p=L(a,4);if(g===0)E(a,4,p-m*u);else{p*=Math.pow(2,32),p+=L(a,8),p-=m*u,p=Math.max(p,0);var v=Math.floor(p/(R+1)),k=Math.floor(p%(R+1));E(a,4,v),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 l(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=_,l=M,S=null,f="",m=!0,w="auto",y="start",h=50,c="middle",u=50,a="middle";Object.defineProperty(C,"id",D({},T,{get:function(){return b},set:function(p){b=""+p}})),Object.defineProperty(C,"pauseOnExit",D({},T,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(C,"startTime",D({},T,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",D({},T,{get:function(){return s},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",D({},T,{get:function(){return l},set:function(p){l=""+p,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",D({},T,{get:function(){return S},set:function(p){S=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",D({},T,{get:function(){return f},set:function(p){var v=B(p);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",D({},T,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",D({},T,{get:function(){return w},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",D({},T,{get:function(){return y},set:function(p){var v=I(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");y=v,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",D({},T,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",D({},T,{get:function(){return c},set:function(p){var v=I(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",D({},T,{get:function(){return u},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");u=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",D({},T,{get:function(){return a},set:function(p){var v=I(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,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,l){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(l||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 l=0;l<s.length;++l)if(o===s[l]){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 l=o[s].split(b);if(l.length!==2)continue;var S=l[0],f=l[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 u;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":u=c.split(","),m.integer(h,u[0]),m.percent(h,u[0])&&m.set("snapToLines",!1),m.alt(h,u[0],["auto"]),u.length===2&&m.alt("lineAlign",u[1],["start",L,"end"]);break;case"position":u=c.split(","),m.percent(h,u[0]),u.length===2&&m.alt("positionAlign",u[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 y=m.get("position","auto");y==="auto"&&D.position===50&&(y=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=y}function l(){C=C.replace(/^\s+/,"")}if(l(),T.startTime=o(),l(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),l(),T.endTime=o(),l(),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 y=o.buffer,h=0;for(y=_(y);h<y.length&&y[h]!=="\r"&&y[h]!==`
|
|
`;)++h;var c=y.substr(0,h);return y[h]==="\r"&&++h,y[h]===`
|
|
`&&++h,o.buffer=y.substr(h),c}function l(y){I(y,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)?l(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(y){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(y){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)),l=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)(l)||!Object(G.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*l,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 l=d[o],S=d[l.prevCC];if(!S||!S.new&&l.new){d.ccOffset=d.presentationOffset=l.start,l.new=!1;return}for(;(f=S)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=l.start-S.start,l.new=!1,l=S,S=d[l.prevCC]}d.presentationOffset=s};function T(b,d,o,s,l,S,f,m){var w=new U.VTTParser,y=Object(R.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(D,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),u="00:00.000",a=0,g=0,p,v=!0,k=!1;w.oncue=function(F){var j=s[l],W=s.ccOffset,O=(a-c)/9e4;if(j!=null&&j.new&&(g!==void 0?W=s.ccOffset=j.start:C(s,l,O)),O&&(W=O-s.presentationOffset),k){var P=F.endTime-F.startTime,H=Object(I.normalizePts)((F.startTime+W-g)*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){p=F},w.onflush=function(){if(p){m(p);return}f(h)},y.forEach(function(F){if(v)if(L(F,"X-TIMESTAMP-MAP=")){v=!1,k=!0,F.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?u=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{g=E(u)/1e3}catch(j){k=!1,p=j}return}else F===""&&(v=!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 l={url:_.responseURL,data:d};this.callbacks.onSuccess(l,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,Ge,te){ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(ot,Ge,te){"use strict";te.d(Ge,"c",function(){return U}),te.d(Ge,"b",function(){return R}),te.d(Ge,"d",function(){return B}),te.d(Ge,"a",function(){return D}),te.d(Ge,"e",function(){return L});var ne=te("9og8"),V=te("WmNS"),A=te.n(V),G=te("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,Ge,te){"use strict";te.d(Ge,"c",function(){return b}),te.d(Ge,"a",function(){return d});var ne=te("DZo9"),V=te("8z0m"),A=te("+L6B"),G=te("2/Rp"),U=te("9og8"),R=te("k1fw"),B=te("oBTY"),I=te("miYZ"),D=te("tsqr"),L=te("WmNS"),E=te.n(L),_=te("cDcd"),M=te.n(_),C=te("m3rI"),T=te("wzkS"),b="\u3000\u3000";function d(o){var s=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var l=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,l)).toFixed(1)+" "+s[l]}Ge.b=function(o){var s=o.value,l=s===void 0?[]:s,S=o.action,f=o.onChange,m=o.className,w=o.maxSize,y=w===void 0?150:w,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,u=o.accept,a=u===void 0?null:u,g={multiple:!1,fileList:l,accept:a,withCredentials:!0,beforeUpload:function(k){var F=k.size/1024/1024;return F<y?!0:(D.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(y,"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 v=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<y){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 v.apply(this,arguments)}return k}()};function p(v){v.preventDefault(),v.stopPropagation()}return M.a.createElement("div",{className:"single-upload ".concat(m||"")},M.a.createElement(V.a,g,M.a.createElement(G.a,{type:"primary",title:l.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:l.length>0,ghost:!0},c),M.a.createElement("span",{onClick:p,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",y,"M) ")))}}}]);
|