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.
143 lines
776 KiB
143 lines
776 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[163,5,6,7,16],{"+NIl":function(et,We,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";Z.defineMode("stex",function(G,L){"use strict";function K(w,E){w.cmdState.push(E)}function N(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var E=w.cmdState.pop();E&&E.closeBracket()}function F(w){for(var E=w.cmdState,v=E.length-1;v>=0;v--){var d=E[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function I(w,E,v){return function(){this.name=w,this.bracketNo=0,this.style=E,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=I("importmodule","tag",["string","builtin"]),R.documentclass=I("documentclass","tag",["","atom"]),R.usepackage=I("usepackage","tag",["atom"]),R.begin=I("begin","tag",["atom"]),R.end=I("end","tag",["atom"]),R.label=I("label","tag",["atom"]),R.ref=I("ref","tag",["atom"]),R.eqref=I("eqref","tag",["atom"]),R.cite=I("cite","tag",["atom"]),R.bibitem=I("bibitem","tag",["atom"]),R.Bibitem=I("Bibitem","tag",["atom"]),R.RBibitem=I("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function S(w,E){w.f=E}function h(w,E){var v;if(w.match(/^\\[a-zA-Z@]+/)){var d=w.current().slice(1);return v=R.hasOwnProperty(d)?R[d]:R.DEFAULT,v=new v,K(E,v),S(E,P),v.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return S(E,function(l,s){return g(l,s,"\\]")}),"keyword";if(w.match("\\("))return S(E,function(l,s){return g(l,s,"\\)")}),"keyword";if(w.match("$$"))return S(E,function(l,s){return g(l,s,"$$")}),"keyword";if(w.match("$"))return S(E,function(l,s){return g(l,s,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(v=N(E),v)v.closeBracket(a),S(E,P);else return"error";return"bracket"}else return a=="{"||a=="["?(v=R.DEFAULT,v=new v,K(E,v),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),v=F(E),v.name=="begin"&&(v.argument=w.current()),v.styleIdentifier())}function g(w,E,v){if(w.eatSpace())return null;if(v&&w.match(v))return S(E,h),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=w.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,E){var v=w.peek(),d;return v=="{"||v=="["?(d=N(E),d.openBracket(v),w.eat(v),S(E,h),"bracket"):/[ \t\r]/.test(v)?(w.eat(v),null):(S(E,h),O(E),h(w,E))}return{startState:function(){var w=L.inMathMode?function(E,v){return g(E,v)}:h;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,E){return E.f(w,E)},blankLine:function(w){w.f=h,w.cmdState.length=0},lineComment:"%"}}),Z.defineMIME("text/x-stex","stex"),Z.defineMIME("text/x-latex","stex")})},"+ua5":function(et,We,J){},"19Vz":function(et,We,J){(function(Z){Z(J("VrN/"))})(function(Z){Z.defineOption("placeholder","",function(I,R,S){var h=S&&S!=Z.Init;if(R&&!h)I.on("blur",N),I.on("change",O),I.on("swapDoc",O),Z.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){K(I)}),O(I);else if(!R&&h){I.off("blur",N),I.off("change",O),I.off("swapDoc",O),Z.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),G(I);var g=I.getWrapperElement();g.className=g.className.replace(" CodeMirror-empty","")}R&&!I.hasFocus()&&N(I)});function G(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function L(I){G(I);var R=I.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=I.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var S=I.getOption("placeholder");typeof S=="string"&&(S=document.createTextNode(S)),R.appendChild(S),I.display.lineSpace.insertBefore(R,I.display.lineSpace.firstChild)}function K(I){setTimeout(function(){var R=!1,S=I.getInputField();S.nodeName=="TEXTAREA"?R=!S.value:I.lineCount()==1&&(R=!/[^\u200b]/.test(S.querySelector(".CodeMirror-line").textContent)),R?L(I):G(I)},20)}function N(I){F(I)&&L(I)}function O(I){var R=I.getWrapperElement(),S=F(I);R.className=R.className.replace(" CodeMirror-empty","")+(S?" CodeMirror-empty":""),S?L(I):G(I)}function F(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(et,We,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";var G={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},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};Z.defineMode("xml",function(K,N){var O=K.indentUnit,F={},I=N.htmlMode?G:L;for(var R in I)F[R]=I[R];for(var R in N)F[R]=N[R];var S,h;function g(o,x){function y(U){return x.tokenize=U,U(o,x)}var p=o.next();if(p=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?y(E("atom","]]>")):null:o.match("--")?y(E("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),y(v(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),x.tokenize=E("meta","?>"),"meta"):(S=o.eat("/")?"closeTag":"openTag",x.tokenize=P,"tag bracket");if(p=="&"){var D;return o.eat("#")?o.eat("x")?D=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):D=o.eatWhile(/[\d]/)&&o.eat(";"):D=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),D?"atom":"error"}else return o.eatWhile(/[^&<]/),null}g.isInText=!0;function P(o,x){var y=o.next();if(y==">"||y=="/"&&o.eat(">"))return x.tokenize=g,S=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return S="equals",null;if(y=="<"){x.tokenize=g,x.state=s,x.tagName=x.tagStart=null;var p=x.tokenize(o,x);return p?p+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=w(y),x.stringStartCol=o.column(),x.tokenize(o,x)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var x=function(y,p){for(;!y.eol();)if(y.next()==o){p.tokenize=P;break}return"string"};return x.isInAttribute=!0,x}function E(o,x){return function(y,p){for(;!y.eol();){if(y.match(x)){p.tokenize=g;break}y.next()}return o}}function v(o){return function(x,y){for(var p;(p=x.next())!=null;){if(p=="<")return y.tokenize=v(o+1),y.tokenize(x,y);if(p==">")if(o==1){y.tokenize=g;break}else return y.tokenize=v(o-1),y.tokenize(x,y)}return"meta"}}function d(o,x,y){this.prev=o.context,this.tagName=x,this.indent=o.indented,this.startOfLine=y,(F.doNotIndent.hasOwnProperty(x)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,x){for(var y;;){if(!o.context)return;if(y=o.context.tagName,!F.contextGrabbers.hasOwnProperty(y)||!F.contextGrabbers[y].hasOwnProperty(x))return;a(o)}}function s(o,x,y){return o=="openTag"?(y.tagStart=x.column(),_):o=="closeTag"?b:s}function _(o,x,y){return o=="word"?(y.tagName=x.current(),h="tag",T):F.allowMissingTagName&&o=="endTag"?(h="tag bracket",T(o,x,y)):(h="error",_)}function b(o,x,y){if(o=="word"){var p=x.current();return y.context&&y.context.tagName!=p&&F.implicitlyClosed.hasOwnProperty(y.context.tagName)&&a(y),y.context&&y.context.tagName==p||F.matchClosing===!1?(h="tag",f):(h="tag error",A)}else return F.allowMissingTagName&&o=="endTag"?(h="tag bracket",f(o,x,y)):(h="error",A)}function f(o,x,y){return o!="endTag"?(h="error",f):(a(y),s)}function A(o,x,y){return h="error",f(o,x,y)}function T(o,x,y){if(o=="word")return h="attribute",m;if(o=="endTag"||o=="selfcloseTag"){var p=y.tagName,D=y.tagStart;return y.tagName=y.tagStart=null,o=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(p)?l(y,p):(l(y,p),y.context=new d(y,p,D==y.indented)),s}return h="error",T}function m(o,x,y){return o=="equals"?c:(F.allowMissing||(h="error"),T(o,x,y))}function c(o,x,y){return o=="string"?u:o=="word"&&F.allowUnquoted?(h="string",T):(h="error",T(o,x,y))}function u(o,x,y){return o=="string"?u:T(o,x,y)}return{startState:function(o){var x={tokenize:g,state:s,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(x.baseIndent=o),x},token:function(o,x){if(!x.tagName&&o.sol()&&(x.indented=o.indentation()),o.eatSpace())return null;S=null;var y=x.tokenize(o,x);return(y||S)&&y!="comment"&&(h=null,x.state=x.state(S||y,o,x),h&&(y=h=="error"?y+" error":h)),y},indent:function(o,x,y){var p=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+O;if(p&&p.noIndent)return Z.Pass;if(o.tokenize!=P&&o.tokenize!=g)return y?y.match(/^(\s*)/)[0].length:0;if(o.tagName)return F.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+O*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var D=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(D&&D[1])for(;p;)if(p.tagName==D[2]){p=p.prev;break}else if(F.implicitlyClosed.hasOwnProperty(p.tagName))p=p.prev;else break;else if(D)for(;p;){var U=F.contextGrabbers[p.tagName];if(U&&U.hasOwnProperty(D[2]))p=p.prev;else break}for(;p&&p.prev&&!p.startOfLine;)p=p.prev;return p?p.indent+O:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(o){o.state==c&&(o.state=T)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var x=[],y=o.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),Z.defineMIME("text/xml","xml"),Z.defineMIME("application/xml","xml"),Z.mimeModes.hasOwnProperty("text/html")||Z.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(et,We,J){"use strict";J.d(We,"a",function(){return b});var Z=J("+L6B"),G=J("2/Rp"),L=J("2qtc"),K=J("kLXV"),N=J("9og8"),O=J("k1fw"),F=J("miYZ"),I=J("tsqr"),R=J("oBTY"),S=J("tJVT"),h=J("DZo9"),g=J("8z0m"),P=J("WmNS"),w=J.n(P),E=J("cDcd"),v=J.n(E),d=J("m3rI"),a=J("wzkS"),l=J("y5JW"),s=J("LtfV"),_=g.a.Dragger;function b(f){var A=[];return f&&f.length>0&&(A=f.map(function(T){return{uid:T.id,id:T.id,name:T.title+l.c+T.filesize,url:T.url,filesize:T.filesize,status:"done",response:{id:T.id}}})),A}We.b=function(f){var A=f.value,T=f.onChange,m=f.action,c=f.className,u=f.maxSize,o=u===void 0?150:u,x=f.title,y=x===void 0?"\u4E0A\u4F20\u9644\u4EF6":x,p=f.showRemoveModal,D=p===void 0?!1:p,U=f.accept,B=U===void 0?"":U,W=f.additionalText,M=f.isDragger,k=f.number,H=k===void 0?1e3:k,X=f.aloneClear,ee=X===void 0?!1:X,ae=Object(E.useState)(!1),ye=Object(S.a)(ae,2),pe=ye[0],he=ye[1],fe=Object(E.useState)(A||[]),de=Object(S.a)(fe,2),ne=de[0],me=de[1];Object(E.useEffect)(function(){A&&(me(Object(R.a)(A)),H===(A==null?void 0:A.length)&&he(!0))},[A]);var $=function(){setTimeout(function(){ne.pop(),me(Object(R.a)(ne))},500)},ie={multiple:!0,disabled:pe,accept:B,withCredentials:!0,fileList:ne,beforeUpload:function(Ce,ve){var we=Ce.size/1024/1024;return ne.concat(ve).length>H?(ne.pop(),me(Object(R.a)(ne)),I.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():($(),!1)):!0},action:m||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Ce){var ve,we,Ae=Object(R.a)(Ce.fileList);if(Ce.file.status==="done"&&((ve=Ce.file)===null||ve===void 0||((we=ve.response)===null||we===void 0)?void 0:we.status)===-1){var De,Ie;I.b.error((De=Ce.file)===null||De===void 0||((Ie=De.response)===null||Ie===void 0)?void 0:Ie.message);return}Ae.length>=H?he(!0):he(!1),me(Object(R.a)(Ae)),Ae=Ae.map(function(Le){var Oe;if(Le!=null&&(Oe=Le.response)!==null&&Oe!==void 0&&Oe.id){var Xe;Le.url="/api/attachments/".concat(Le==null||((Xe=Le.response)===null||Xe===void 0)?void 0:Xe.id)}return Le.name.indexOf(l.c)===-1&&(Le.name="".concat(Le.name).concat(l.c).concat(Object(l.a)(Le.size))),Object(O.a)({},Le)}),console.log("info:",Ce),T(Ae)},onRemove:function(){var Ee=Object(N.a)(w.a.mark(function ve(we){var Ae;return w.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(Ae=function(){var Le=Object(N.a)(w.a.mark(function Oe(){var Xe,Ze;return w.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(Xe=we.response?we.response.id:we.id,!Xe){je.next=8;break}return je.next=4,Object(a.d)(we.response?we.response.id:we.uid);case 4:return Ze=je.sent,je.abrupt("return",Ze);case 8:return je.abrupt("return",!0);case 9:case"end":return je.stop()}},Oe)}));return function(){return Le.apply(this,arguments)}}(),!D){Ie.next=5;break}return Ie.abrupt("return",new Promise(function(Le,Oe){K.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:v.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Xe=Object(N.a)(w.a.mark(function Be(){var je;return w.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return Ye.next=2,Ae();case 2:je=Ye.sent,I.b.success("\u5220\u9664\u6210\u529F"),Le(!0);case 5:case"end":return Ye.stop()}},Be)}));function Ze(){return Xe.apply(this,arguments)}return Ze}(),onCancel:function(){return Le(!1)}})}));case 5:return Ie.next=7,Ae();case 7:return Ie.abrupt("return",Ie.sent);case 8:case"end":return Ie.stop()}},ve)}));function Ce(ve){return Ee.apply(this,arguments)}return Ce}()};function te(Ee){Ee.preventDefault(),Ee.stopPropagation()}return v.a.createElement("div",{className:"multi-upload ".concat(c||"")},M&&v.a.createElement(_,ie,v.a.createElement("p",{className:"ant-upload-drag-icon"},v.a.createElement(s.a,null)),v.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",v.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB)"," "),W),!M&&v.a.createElement(g.a,ie,v.a.createElement(G.a,{disabled:pe},y),v.a.createElement("span",{onClick:te,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB)"," ")))}},"55Ip":function(et,We,J){"use strict";J.d(We,"a",function(){return l});var Z=J("Ty5D"),G=J("dI71"),L=J("cDcd"),K=J.n(L),N=J("YS25"),O=J("17x9"),F=J.n(O),I=J("wx14"),R=J("zLVn"),S=J("9R94"),h=function(c){Object(G.a)(u,c);function u(){for(var x,y=arguments.length,p=new Array(y),D=0;D<y;D++)p[D]=arguments[D];return x=c.call.apply(c,[this].concat(p))||this,x.history=Object(N.a)(x.props),x}var o=u.prototype;return o.render=function(){return K.a.createElement(Z.c,{history:this.history,children:this.props.children})},u}(K.a.Component),g=function(c){Object(G.a)(u,c);function u(){for(var x,y=arguments.length,p=new Array(y),D=0;D<y;D++)p[D]=arguments[D];return x=c.call.apply(c,[this].concat(p))||this,x.history=Object(N.b)(x.props),x}var o=u.prototype;return o.render=function(){return K.a.createElement(Z.c,{history:this.history,children:this.props.children})},u}(K.a.Component),P=function(u,o){return typeof u=="function"?u(o):u},w=function(u,o){return typeof u=="string"?Object(N.c)(u,null,null,o):u},E=function(u){return u},v=K.a.forwardRef;typeof v=="undefined"&&(v=E);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var a=v(function(c,u){var o=c.innerRef,x=c.navigate,y=c.onClick,p=Object(R.a)(c,["innerRef","navigate","onClick"]),D=p.target,U=Object(I.a)({},p,{onClick:function(W){try{y&&y(W)}catch(M){throw W.preventDefault(),M}!W.defaultPrevented&&W.button===0&&(!D||D==="_self")&&!d(W)&&(W.preventDefault(),x())}});return E!==v?U.ref=u||o:U.ref=o,K.a.createElement("a",U)}),l=v(function(c,u){var o=c.component,x=o===void 0?a:o,y=c.replace,p=c.to,D=c.innerRef,U=Object(R.a)(c,["component","replace","to","innerRef"]);return K.a.createElement(Z.e.Consumer,null,function(B){B||Object(S.a)(!1);var W=B.history,M=w(P(p,B.location),B.location),k=M?W.createHref(M):"",H=Object(I.a)({},U,{href:k,navigate:function(){var ee=P(p,B.location),ae=y?W.replace:W.push;ae(ee)}});return E!==v?H.ref=u||D:H.innerRef=D,K.a.createElement(x,H)})});if(!1)var s,_;var b=function(u){return u},f=K.a.forwardRef;typeof f=="undefined"&&(f=b);function A(){for(var c=arguments.length,u=new Array(c),o=0;o<c;o++)u[o]=arguments[o];return u.filter(function(x){return x}).join(" ")}var T=f(function(c,u){var o=c["aria-current"],x=o===void 0?"page":o,y=c.activeClassName,p=y===void 0?"active":y,D=c.activeStyle,U=c.className,B=c.exact,W=c.isActive,M=c.location,k=c.sensitive,H=c.strict,X=c.style,ee=c.to,ae=c.innerRef,ye=Object(R.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(Z.e.Consumer,null,function(pe){pe||Object(S.a)(!1);var he=M||pe.location,fe=w(P(ee,he),he),de=fe.pathname,ne=de&&de.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),me=ne?Object(Z.f)(he.pathname,{path:ne,exact:B,sensitive:k,strict:H}):null,$=!!(W?W(me,he):me),ie=$?A(U,p):U,te=$?Object(I.a)({},X,{},D):X,Ee=Object(I.a)({"aria-current":$&&x||null,className:ie,style:te,to:fe},ye);return b!==f?Ee.ref=u||ae:Ee.innerRef=ae,K.a.createElement(l,Ee)})});if(!1)var m},"7/Dv":function(et,We,J){et.exports={bg:"bg___2rJyo",flexRow:"flexRow___2xuIa",flexJustifyCenter:"flexJustifyCenter___Z3bJt",flexAlignEnd:"flexAlignEnd___v7Ww-",flexAlignCenter:"flexAlignCenter___223DA",flexColumn:"flexColumn___3CNqR",formWrap:"formWrap___2b6uL",titleWrap:"titleWrap___1CMQA",fieldWrap:"fieldWrap___2BRrD",mdWrap:"mdWrap___3UYzt",backgroundFa:"backgroundFa___32wpj",button:"button___MHDAn"}},"7Cbv":function(et,We,J){"use strict";var Z=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function L(){if(!Z)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Z(G)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function N(P){return typeof P=="string"&&K.test(P)}for(var O=N,F=[],I=0;I<256;++I)F.push((I+256).toString(16).substr(1));function R(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,E=(F[P[w+0]]+F[P[w+1]]+F[P[w+2]]+F[P[w+3]]+"-"+F[P[w+4]]+F[P[w+5]]+"-"+F[P[w+6]]+F[P[w+7]]+"-"+F[P[w+8]]+F[P[w+9]]+"-"+F[P[w+10]]+F[P[w+11]]+F[P[w+12]]+F[P[w+13]]+F[P[w+14]]+F[P[w+15]]).toLowerCase();if(!O(E))throw TypeError("Stringified UUID is invalid");return E}var S=R;function h(P,w,E){P=P||{};var v=P.random||(P.rng||L)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,w){E=E||0;for(var d=0;d<16;++d)w[E+d]=v[d];return w}return S(v)}var g=We.a=h},"7ahc":function(et,We,J){"use strict";J.d(We,"a",function(){return _});var Z=J("k1fw"),G=J("0Owb"),L=J("+L6B"),K=J("2/Rp"),N=J("y8nQ"),O=J("Vl3Y"),F=J("tJVT"),I=J("OaEy"),R=J("2fM7"),S=J("cDcd"),h=J.n(S),g=J("VrN/"),P=J.n(g),w=J("p77/"),E=J.n(w),v=J("c5Ni"),d=J.n(v),a=R.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},s={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"]};We.b=function(b){var f=b.callback,A=b.onCancel,T=Object(S.useState)("python"),m=Object(F.a)(T,2),c=m[0],u=m[1];function o(y){u(s[y][1])}function x(y){f(y)}return h.a.createElement(O.a,Object(G.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),h.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},h.a.createElement(R.a,{onChange:o},Object.keys(s).map(function(y){return h.a.createElement(a,{key:y,value:y},s[y][0])}))),h.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},h.a.createElement(_,{mode:c})),h.a.createElement("div",{className:"flex-container flex-end"},h.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(K.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function _(b){var f=b.value,A=b.onChange,T=b.mode,m=b.options,c=m===void 0?{}:m,u=Object(S.useRef)(),o=Object(S.useState)(),x=Object(F.a)(o,2),y=x[0],p=x[1];return Object(S.useEffect)(function(){if(y){function D(U){var B=U.getValue();A&&A(B)}return y.on("change",D),function(){y.off("change",D)}}},[y,A]),Object(S.useEffect)(function(){y&&y.setOption("mode",T)},[y,T]),Object(S.useEffect)(function(){y&&((f!==y.getValue()||f==="")&&setTimeout(function(){y.setValue(f||" ")},300))},[y,f]),Object(S.useEffect)(function(){if(u.current&&!y){var D=P.a.fromTextArea(u.current,Object(Z.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));p(D)}},[u.current,y]),h.a.createElement("div",{className:"my-codemirror-container"},h.a.createElement("textarea",{ref:u}))}},"8EBN":function(et,We,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";Z.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 G=0;G<Z.modeInfo.length;G++){var L=Z.modeInfo[G];L.mimes&&(L.mime=L.mimes[0])}Z.findModeByMIME=function(K){K=K.toLowerCase();for(var N=0;N<Z.modeInfo.length;N++){var O=Z.modeInfo[N];if(O.mime==K)return O;if(O.mimes){for(var F=0;F<O.mimes.length;F++)if(O.mimes[F]==K)return O}}if(/\+xml$/.test(K))return Z.findModeByMIME("application/xml");if(/\+json$/.test(K))return Z.findModeByMIME("application/json")},Z.findModeByExtension=function(K){K=K.toLowerCase();for(var N=0;N<Z.modeInfo.length;N++){var O=Z.modeInfo[N];if(O.ext){for(var F=0;F<O.ext.length;F++)if(O.ext[F]==K)return O}}},Z.findModeByFileName=function(K){for(var N=0;N<Z.modeInfo.length;N++){var O=Z.modeInfo[N];if(O.file&&O.file.test(K))return O}var F=K.lastIndexOf("."),I=F>-1&&K.substring(F+1,K.length);if(I)return Z.findModeByExtension(I)},Z.findModeByName=function(K){K=K.toLowerCase();for(var N=0;N<Z.modeInfo.length;N++){var O=Z.modeInfo[N];if(O.name.toLowerCase()==K)return O;if(O.alias){for(var F=0;F<O.alias.length;F++)if(O.alias[F].toLowerCase()==K)return O}}}})},"8hTe":function(et,We,J){et.exports={button:"button___1wy9m"}},"9Bee":function(et,We,J){"use strict";var Z=J("DYRE"),G=J("zeV3"),L=J("+L6B"),K=J("2/Rp"),N=J("k1fw"),O=J("tJVT"),F=J("cDcd"),I=J.n(F),R=J("vg9a"),S=J("DlQD"),h=J.n(S),g=J("rUJ1");function P(he,fe){var de=he.match(/^(\s+)(?:```)/);if(de===null)return fe;var ne=de[1];return fe.split(`
|
|
`).map(function(me){var $=me.match(/^\s+/);if($===null)return me;var ie=Object(O.a)($,1),te=ie[0];return te.length>=ne.length?me.slice(ne.length):me}).join(`
|
|
`)}var w=[],E=["<ul>"],v=new h.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){w.length=0,E=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(he,fe,de,ne){if(fe>=he.length||he[fe].level<=de)return fe;var me=he[fe];ne.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),fe++;var $=[];return fe=s(he,fe,me.level,$),$.length>0&&(ne.push("<ul>"),$.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),fe=s(he,fe,de,ne),fe}function _(){return s(w,0,0,E),E.push("</ul>"),E.join("")}var b={heading:function(fe){var de=d.exec(fe);if(de)return{type:"heading",raw:de[0],depth:de[1].length,text:de[2]}},fences:function(fe){var de=this.rules.block.fences.exec(fe);if(de){var ne=de[0],me=P(ne,de[3]||""),$=de[2]?de[2].trim():de[2];if(["latex","katex","math"].indexOf($)>=0){var ie=T(),te=me;me=ie,m[ie]={type:"block",expression:te}}return{type:"code",raw:ne,lang:$,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,T=function(){return"__special_katext_id_".concat(A++,"__")},m={};function c(){return m}function u(){A=0,m={}}function o(he){return he=he.replace(f,function(fe,de){var ne=T();return m[ne]={type:"inline",expression:de},ne}),he}var x=v.listitem;v.listitem=function(he){return x(o(he))};var y=v.paragraph;v.paragraph=function(he){return y(o(he))};var p=v.tablecell;v.tablecell=function(he,fe){return p(o(he),fe)},v.code=function(he,fe,de){var ne=(fe||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(de?he:Object(g.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(de?he:Object(g.escape)(he,!0))+"</code></pre>"},v.heading=function(he,fe,de){var ne=this.options.headerPrefix+de.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ne,level:fe,text:he}),"<h"+fe+' id="'+ne+'">'+he+"</h"+fe+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:b,renderer:v});var D=h.a,U=J("SJMd"),B=J("ulZh"),W=J.n(B),M=J("m3rI"),k=J("Oy/b"),H=J("p5ED"),X=J("8hTe"),ee=J.n(X),ae=/<pre[^>]*>/g;function ye(he){var fe=document.createElement("div");return fe.innerHTML=he,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var pe=We.a=function(he){var fe=he.value,de=fe===void 0?"":fe,ne=he.edit,me=ne===void 0?!1:ne,$=he.className,ie=he.showTextOnly,te=he.showLines,Ee=he.replaces,Ce=he.zoomImg,ve=he.hasMask,we=he.style,Ae=we===void 0?{}:we,De=he.stylesPrev,Ie=De===void 0?{}:De,Le=String(de),Oe=Object(F.useRef)(),Xe=Object(F.useRef)(),Ze=Object(F.useState)(""),Be=Object(O.a)(Ze,2),je=Be[0],rt=Be[1],Ye=Object(F.useState)("office"),qe=Object(O.a)(Ye,2),Te=qe[0],$e=qe[1],Ge=Object(F.useMemo)(function(){try{var ce=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Le=Le.replace(ce,"("+M.a.API_SERVER+"/api/attachments/").replace(Q,'"'+M.a.API_SERVER+"/api/attachments/").replace(q,'"'+M.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,`
|
|
`)}catch(Re){}var re=D(Le),le=c();if(Le.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",_()),a()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Re,Pe){var Ve=le[Pe],ke=Ve.type,ze=Ve.expression;return Object(k.renderToString)(ye(ze)||"",{displayMode:ke==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),u(),ie){var Se=document.createElement("div");return Se.innerHTML=re,Se.innerText}return setTimeout(function(){return ge()},500),re},[Le]),_e=Object(F.useRef)();l.WebkitLineClamp=te,te&&(Ae=Object(N.a)(Object(N.a)({},Ae),l));function Ue(ce){var Q=ce.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ce){var q=Q.getAttribute("src");rt(q),$e("image")}}else if(Q.tagName.toUpperCase()==="A"){var re=Q.getAttribute("href");if(re.indexOf("office")>-1)ce.preventDefault(),rt(re),$e("office");else if(re.indexOf("application/pdf")>-1)ce.preventDefault(),rt(re),$e("pdf");else if(re.indexOf("text/html")>-1)ce.preventDefault(),rt(re),$e("html");else if(re.startsWith("#")){ce.preventDefault();var le=document.getElementById(re.replace("#",""));le&&le.scrollIntoView(!0)}}}var ge=function(){var Q,q=(Q=_e.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");q==null||q.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(re.src),le.attachMedia(re)}}})};Object(F.useEffect)(function(){if(_e.current&&Ge&&(Ge.match(ae)&&window.PR.prettyPrint()),_e.current)return _e.current.addEventListener("click",Ue),function(){_e.current.removeEventListener("click",Ue),u(),a()}},[Ge,_e.current,Ue]);var se=function(Q){if(!me)return;Q.target.nodeName==="IMG"?(Oe.current.style.display="flex",Oe.current.style.width=Q.target.clientWidth+"px",Oe.current.style.height=Q.target.clientHeight+"px",Oe.current.style.top=Q.target.offsetTop+"px",Oe.current.style.left=Q.target.offsetLeft+"px",Xe.current.src=Q.target.getAttribute("src")):Oe.current.style.display="none"};return I.a.createElement("div",{style:{position:"relative"}},I.a.createElement("div",{ref:_e,style:Object(N.a)({},Ae),className:"".concat($||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:se,dangerouslySetInnerHTML:{__html:Ge}}),I.a.createElement("div",{ref:Oe,className:ee.a.button},I.a.createElement(G.a,null,I.a.createElement(K.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),I.a.createElement(K.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),I.a.createElement("img",{ref:Xe,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),I.a.createElement(H.a,{close:!0,data:je,type:je!=null&&je.length?Te:"",style:Object(N.a)({},Ie),onClose:function(){return rt("")}}))}},"9VGf":function(et,We,J){"use strict";J.d(We,"a",function(){return L});var Z=J("cDcd"),G=J.n(Z);function L(K,N){var O=Object(Z.useRef)();Object(Z.useEffect)(function(){O.current=K}),Object(Z.useEffect)(function(){function F(){O.current()}if(N!==null){var I=setInterval(F,N);return function(){return clearInterval(I)}}},[N])}},BU3w:function(et,We,J){"use strict";J.d(We,"a",function(){return O});var Z=J("MNnm"),G="rc-util-key";function L(F){if(F.attachTo)return F.attachTo;var I=document.querySelector("head");return I||document.body}function K(F){var I,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(Z.a)())return null;var S=document.createElement("style");if((I=R.csp)===null||I===void 0?void 0:I.nonce){var h;S.nonce=(h=R.csp)===null||h===void 0?void 0:h.nonce}S.innerHTML=F;var g=L(R),P=g.firstChild;return R.prepend&&g.prepend?g.prepend(S):R.prepend&&P?g.insertBefore(S,P):g.appendChild(S),S}var N=new Map;function O(F,I){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=L(R);if(!N.has(S)){var h=K("",R),g=h.parentNode;N.set(S,g),g.removeChild(h)}var P=Array.from(N.get(S).children).find(function(a){return a.tagName==="STYLE"&&a[G]===I});if(P){var w,E;if(((w=R.csp)===null||w===void 0?void 0:w.nonce)&&P.nonce!==((E=R.csp)===null||E===void 0?void 0:E.nonce)){var v;P.nonce=(v=R.csp)===null||v===void 0?void 0:v.nonce}return P.innerHTML!==F&&(P.innerHTML=F),P}var d=K(F,R);return d[G]=I,d}},Bd2K:function(et,We,J){(function(Z){Z(J("VrN/"),J("osHv"))})(function(Z){Z.defineOption("autoCloseTags",!1,function(R,S,h){if(h!=Z.Init&&h&&R.removeKeyMap("autoCloseTags"),!S)return;var g={name:"autoCloseTags"};(typeof S!="object"||S.whenClosing!==!1)&&(g["'/'"]=function(P){return O(P)}),(typeof S!="object"||S.whenOpening!==!1)&&(g["'>'"]=function(P){return K(P)}),R.addKeyMap(g)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["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 K(R){if(R.getOption("disableInput"))return Z.Pass;for(var S=R.listSelections(),h=[],g=R.getOption("autoCloseTags"),P=0;P<S.length;P++){if(!S[P].empty())return Z.Pass;var w=S[P].head,E=R.getTokenAt(w),v=Z.innerMode(R.getMode(),E.state),d=v.state,a=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),l=a&&a.name;if(!l)return Z.Pass;var s=v.mode.configuration=="html",_=typeof g=="object"&&g.dontCloseTags||s&&G,b=typeof g=="object"&&g.indentTags||s&&L;E.end>w.ch&&(l=l.slice(0,l.length-E.end+w.ch));var f=l.toLowerCase();if(!l||E.type=="string"&&(E.end!=w.ch||!/[\"\']/.test(E.string.charAt(E.string.length-1))||E.string.length==1)||E.type=="tag"&&a.close||E.string.indexOf("/")==w.ch-E.start-1||_&&F(_,f)>-1||I(R,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],l,w,!0))return Z.Pass;var A=typeof g=="object"&&g.emptyTags;if(A&&F(A,l)>-1){h[P]={text:"/>",newPos:Z.Pos(w.line,w.ch+2)};continue}var T=b&&F(b,f)>-1;h[P]={indent:T,text:">"+(T?`
|
|
|
|
`:"")+"</"+l+">",newPos:T?Z.Pos(w.line+1,0):Z.Pos(w.line,w.ch+1)}}for(var m=typeof g=="object"&&g.dontIndentOnAutoClose,P=S.length-1;P>=0;P--){var c=h[P];R.replaceRange(c.text,S[P].head,S[P].anchor,"+insert");var u=R.listSelections().slice(0);u[P]={head:c.newPos,anchor:c.newPos},R.setSelections(u),!m&&c.indent&&(R.indentLine(c.newPos.line,null,!0),R.indentLine(c.newPos.line+1,null,!0))}}function N(R,S){for(var h=R.listSelections(),g=[],P=S?"/":"</",w=R.getOption("autoCloseTags"),E=typeof w=="object"&&w.dontIndentOnSlash,v=0;v<h.length;v++){if(!h[v].empty())return Z.Pass;var d=h[v].head,a=R.getTokenAt(d),l=Z.innerMode(R.getMode(),a.state),s=l.state;if(S&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=d.ch-1))return Z.Pass;var _,b=l.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(b&&l.mode.name=="javascript")_=P+"script";else if(b&&l.mode.name=="css")_=P+"style";else{var f=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(s);if(!f||f.length&&I(R,f,f[f.length-1],d))return Z.Pass;_=P+f[f.length-1]}R.getLine(d.line).charAt(a.end)!=">"&&(_+=">"),g[v]=_}if(R.replaceSelections(g),h=R.listSelections(),!E)for(var v=0;v<h.length;v++)(v==h.length-1||h[v].head.line<h[v+1].head.line)&&R.indentLine(h[v].head.line)}function O(R){return R.getOption("disableInput")?Z.Pass:N(R,!0)}Z.commands.closeTag=function(R){return N(R)};function F(R,S){if(R.indexOf)return R.indexOf(S);for(var h=0,g=R.length;h<g;++h)if(R[h]==S)return h;return-1}function I(R,S,h,g,P){if(!Z.scanForClosingTag)return!1;var w=Math.min(R.lastLine()+1,g.line+500),E=Z.scanForClosingTag(R,g,null,w);if(!E||E.tag!=h)return!1;for(var v=P?1:0,d=S.length-1;d>=0&&S[d]==h;d--)++v;g=E.to;for(var d=1;d<v;d++){var a=Z.scanForClosingTag(R,g,null,w);if(!a||a.tag!=h)return!1;g=a.to}return!0}})},BjJ7:function(et,We,J){"use strict";J.d(We,"d",function(){return G}),J.d(We,"c",function(){return L}),J.d(We,"e",function(){return K}),J.d(We,"b",function(){return N}),J.d(We,"a",function(){return F});var Z=J("m3rI");function G(I){var R=!0;if(I.length>0){for(var S=0;S<I.length;S++)if(I[S].compile_success==0||!I[S].compile_success){R=!1;break}}else R=!1;return R}function L(I){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",S=[],h=0;h<I.length;h++){var g=I[h],P=R?"".concat(R,"/").concat(g.name):"".concat(g.name);S.push({title:g.name,isLeaf:!(g.type==="tree"),key:P})}return S}function K(I,R,S){for(var h=0;h<I.length;h++){var g=I[h];if(g.key===R){g.children=S;break}g.children&&K(g.children,R,S)}return I}function N(I,R,S){var h;return function(){var g=this,P=arguments,w=function(){h=null,S||I.apply(g,P)},E=S&&!h;clearTimeout(h),h=setTimeout(w,R),E&&I.apply(g,P)}}var O=!0,F=Z.a.API_SERVER},"C+DQ":function(et,We,J){},CKgm:function(et,We,J){"use strict";J.r(We);var Z=J("+L6B"),G=J("2/Rp"),L=J("5NDa"),K=J("5rEg"),N=J("sPJy"),O=J("bE4q"),F=J("miYZ"),I=J("tsqr"),R=J("9og8"),S=J("k1fw"),h=J("y8nQ"),g=J("Vl3Y"),P=J("tJVT"),w=J("PpiC"),E=J("OaEy"),v=J("2fM7"),d=J("WmNS"),a=J.n(d),l=J("cDcd"),s=J.n(l),_=J("Ty5D"),b=J("9kvl"),f=J("55Ip"),A=J("Ot1p"),T=J("500L"),m=J("h+Ho"),c=J("7/Dv"),u=J.n(c),o=v.a.Option,x=function(p){var D,U,B,W=p.forumsDetail,M=p.globalSetting,k=p.loading,H=p.dispatch,X=Object(w.a)(p,["forumsDetail","globalSetting","loading","dispatch"]),ee=Object(_.i)(),ae=g.a.useForm(),ye=Object(P.a)(ae,1),pe=ye[0],he=Object(l.useState)({}),fe=Object(P.a)(he,2),de=fe[0],ne=fe[1],me=Object(l.useState)(0),$=Object(P.a)(me,2),ie=$[0],te=$[1],Ee=Object(l.useState)(!1),Ce=Object(P.a)(Ee,2),ve=Ce[0],we=Ce[1],Ae=Object(l.useState)({}),De=Object(P.a)(Ae,2),Ie=De[0],Le=De[1],Oe=Object(l.useState)(1),Xe=Object(P.a)(Oe,2),Ze=Xe[0],Be=Xe[1];Object(l.useEffect)(function(){if(je(),ee.memoId)we(!0),rt();else{we(!1);var Te={forum_id:5};ne(Object(S.a)({},Te)),pe.setFieldsValue(Object(S.a)({},Te))}},[ee.memoId]);var je=function(){var Te=Object(R.a)(a.a.mark(function $e(){var Ge;return a.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return Ue.next=2,Object(m.f)({});case 2:Ge=Ue.sent,Le(Ge||{});case 4:case"end":return Ue.stop()}},$e)}));return function(){return Te.apply(this,arguments)}}(),rt=function(){var Te=Object(R.a)(a.a.mark(function $e(){var Ge,_e,Ue;return a.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return se.next=2,Object(m.e)({id:ee.memoId});case 2:if(se.t0=se.sent,se.t0){se.next=5;break}se.t0={};case 5:_e=se.t0,Ue={subject:_e.subject,content:_e.content,attachments:Object(T.a)(_e.attachments),forum_id:_e.forum_id,memo_tags:(Ge=_e.memo_tags)===null||Ge===void 0?void 0:Ge.map(function(ce){return ce.id})},ne(Object(S.a)({},Ue)),pe.setFieldsValue(Object(S.a)({},Ue));case 9:case"end":return se.stop()}},$e)}));return function(){return Te.apply(this,arguments)}}(),Ye=function(){var Te=Object(R.a)(a.a.mark(function $e(Ge){var _e,Ue,ge,se;return a.a.wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(ge=Object(S.a)(Object(S.a)({id:ve?ee.memoId:null},de),{},{attachment_ids:(_e=de.attachments)===null||_e===void 0||((Ue=_e.filter(function(q){var re;return(re=q.response)===null||re===void 0?void 0:re.id}))===null||Ue===void 0)?void 0:Ue.map(function(q){var re;return(re=q.response)===null||re===void 0?void 0:re.id}),tags:de.memo_tags}),!ve){Q.next=7;break}return Q.next=4,Object(m.n)(ge);case 4:Q.t0=Q.sent,Q.next=10;break;case 7:return Q.next=9,Object(m.j)(ge);case 9:Q.t0=Q.sent;case 10:se=Q.t0,te(0),(se==null?void 0:se.status)===0&&(I.b.success(se==null?void 0:se.message),Ze===1?b.d.push("/forums/".concat(ve?ee==null?void 0:ee.memoId:se==null?void 0:se.memo_id)):b.d.push("/forums/".concat(ve?ee==null?void 0:ee.memoId:se==null?void 0:se.memo_id,"/edit")));case 13:case"end":return Q.stop()}},$e)}));return function(Ge){return Te.apply(this,arguments)}}(),qe=function(){document.body.scrollIntoView(),window.location.href.includes("new")?b.d.goBack():b.d.push("/forums/".concat(ee.memoId))};return s.a.createElement("section",{className:u.a.bg},s.a.createElement("section",{className:"animated fadeIn mb10"},s.a.createElement("aside",{className:"mt10"},s.a.createElement(O.a,{separator:"/"},s.a.createElement(O.a.Item,null,s.a.createElement(f.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),s.a.createElement(O.a.Item,null,"\u8BE6\u60C5")))),s.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},ve?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),s.a.createElement(g.a,{form:pe,className:u.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function($e,Ge){console.log(Ge,"values"),ne(Object(S.a)(Object(S.a)({},de),$e))},onFinish:Ye,onFinishFailed:function(){te(0)}},s.a.createElement("div",{className:u.a.fieldWrap},s.a.createElement(g.a.Item,{name:"subject",label:s.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u540D\u79F0: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u540D\u79F0"}]},s.a.createElement(K.a,{maxLength:50,suffix:"".concat(((D=de.subject)===null||D===void 0?void 0:D.length)||0,"/50")}))),s.a.createElement("div",{className:u.a.mdWrap},s.a.createElement(g.a.Item,{name:"content",label:s.a.createElement("span",{className:"font16"},"\u5185\u5BB9: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u5185\u5BB9"}]},s.a.createElement(A.a,{height:600,id:"forums-new-content",watch:!0,defaultValue:de.content})),s.a.createElement("div",null,s.a.createElement(g.a.Item,{name:"attachments",style:{width:350}},s.a.createElement(T.b,{showRemoveModal:!0})))),s.a.createElement("div",{className:u.a.mdWrap},s.a.createElement(g.a.Item,{name:"forum_id",label:s.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u7C7B\u578B: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u8BDD\u9898\u7C7B\u578B"}]},s.a.createElement(v.a,{style:{width:300}},Ie==null||((U=Ie.forums)===null||U===void 0)?void 0:U.map(function(Te){return s.a.createElement(o,{key:Te.id,value:Te.id},Te.name)})))),de.forum_id===5&&s.a.createElement("div",{className:u.a.mdWrap},s.a.createElement(g.a.Item,{name:"memo_tags",label:s.a.createElement("span",{className:"font16"},"\u6280\u672F\u6807\u7B7E: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u6280\u672F\u6807\u7B7E"}]},s.a.createElement(v.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function($e,Ge){return Ge.props.children.toLocaleLowerCase().indexOf($e.toLocaleLowerCase())!=-1}},Ie==null||((B=Ie.tag_list)===null||B===void 0)?void 0:B.map(function(Te){return s.a.createElement(o,{key:Te.id,value:Te.id},Te.name)})))),s.a.createElement("div",{className:u.a.backgroundFa},s.a.createElement("div",{className:"pt40 mb30"},s.a.createElement(g.a.Item,null,s.a.createElement(G.a,{size:"large",type:"primary",className:"".concat(u.a.button," mr20"),htmlType:"submit",loading:ie===1,onClick:function(){Be(1),te(1)}},"\u63D0\u4EA4"),s.a.createElement(G.a,{size:"large",type:"primary",className:"".concat(u.a.button," mr20"),htmlType:"submit",loading:ie===2,onClick:function(){Be(2),te(2)}},"\u4FDD\u5B58"),s.a.createElement(G.a,{size:"large",type:"primary",ghost:!0,className:"".concat(u.a.button," mr20"),onClick:qe},"\u53D6\u6D88"))))))};We.default=Object(b.a)(function(y){var p=y.forumsDetail,D=y.loading,U=y.globalSetting;return{forumsDetail:p,globalSetting:U,loading:D.models.forumsDetail}})(x)},D1Df:function(et,We,J){"use strict";function Z(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Z=function(U){return typeof U}:Z=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},Z(p)}function G(){return G=Object.assign||function(p){for(var D=1;D<arguments.length;D++){var U=arguments[D];for(var B in U)Object.prototype.hasOwnProperty.call(U,B)&&(p[B]=U[B])}return p},G.apply(this,arguments)}function L(p,D){var U=Object.keys(p);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(p);D&&(B=B.filter(function(W){return Object.getOwnPropertyDescriptor(p,W).enumerable})),U.push.apply(U,B)}return U}function K(p){for(var D=1;D<arguments.length;D++){var U=arguments[D]!=null?arguments[D]:{};D%2?L(U,!0).forEach(function(B){E(p,B,U[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(U)):L(U).forEach(function(B){Object.defineProperty(p,B,Object.getOwnPropertyDescriptor(U,B))})}return p}function N(p,D){if(p==null)return{};var U=O(p,D),B,W;if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(p);for(W=0;W<M.length;W++){if(B=M[W],D.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(p,B))continue;U[B]=p[B]}}return U}function O(p,D){if(p==null)return{};var U={},B=Object.keys(p),W,M;for(M=0;M<B.length;M++){if(W=B[M],D.indexOf(W)>=0)continue;U[W]=p[W]}return U}function F(p,D){if(!(p instanceof D))throw new TypeError("Cannot call a class as a function")}function I(p,D){for(var U=0;U<D.length;U++){var B=D[U];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(p,B.key,B)}}function R(p,D,U){return D&&I(p.prototype,D),U&&I(p,U),p}function S(p,D){return D&&(Z(D)==="object"||typeof D=="function")?D:g(p)}function h(p){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},h(p)}function g(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function P(p,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(D&&D.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),D&&w(p,D)}function w(p,D){return w=Object.setPrototypeOf||function(B,W){return B.__proto__=W,B},w(p,D)}function E(p,D,U){return D in p?Object.defineProperty(p,D,{value:U,enumerable:!0,configurable:!0,writable:!0}):p[D]=U,p}var v=J("cDcd"),d=J("17x9"),a=J("H38U"),l=J("aRTE");function s(p){for(var D="",U=0;U<p.length;U++){var B=p.charCodeAt(U);B<128?D+=String.fromCharCode(B):B<2048?(D+=String.fromCharCode(192|B>>6),D+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(D+=String.fromCharCode(224|B>>12),D+=String.fromCharCode(128|B>>6&63),D+=String.fromCharCode(128|B&63)):(U++,B=65536+((B&1023)<<10|p.charCodeAt(U)&1023),D+=String.fromCharCode(240|B>>18),D+=String.fromCharCode(128|B>>12&63),D+=String.fromCharCode(128|B>>6&63),D+=String.fromCharCode(128|B&63))}return D}var _={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},b={},f=4,A=.1;function T(p){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return p.forEach(function(B,W){var M=null;B.forEach(function(k,H){if(!k&&M!==null){U.push("M".concat(M+D," ").concat(W+D,"h").concat(H-M,"v1H").concat(M+D,"z")),M=null;return}if(H===B.length-1){if(!k)return;M===null?U.push("M".concat(H+D,",").concat(W+D," h1v1H").concat(H+D,"z")):U.push("M".concat(M+D,",").concat(W+D," h").concat(H+1-M,"v1H").concat(M+D,"z"));return}k&&M===null&&(M=H)})}),U.join("")}function m(p,D){return p.slice().map(function(U,B){return B<D.y||B>=D.y+D.h?U:U.map(function(W,M){return M<D.x||M>=D.x+D.w?W:!1})})}function c(p,D){var U=p.imageSettings,B=p.size,W=p.includeMargin;if(U==null)return null;var M=W?f:0,k=D.length+M*2,H=Math.floor(B*A),X=k/B,ee=(U.width||H)*X,ae=(U.height||H)*X,ye=U.x==null?D.length/2-ee/2:U.x*X,pe=U.y==null?D.length/2-ae/2:U.y*X,he=null;if(U.excavate){var fe=Math.floor(ye),de=Math.floor(pe),ne=Math.ceil(ee+ye-fe),me=Math.ceil(ae+pe-de);he={x:fe,y:de,w:ne,h:me}}return{x:ye,y:pe,h:ae,w:ee,excavation:he}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(p){return!1}return!0}(),o=function(p){P(D,p);function D(){var U,B;F(this,D);for(var W=arguments.length,M=new Array(W),k=0;k<W;k++)M[k]=arguments[k];return B=S(this,(U=h(D)).call.apply(U,[this].concat(M))),E(g(B),"_canvas",void 0),E(g(B),"_image",void 0),E(g(B),"state",{imgLoaded:!1}),E(g(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return R(D,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,W=B.value,M=B.size,k=B.level,H=B.bgColor,X=B.fgColor,ee=B.includeMargin,ae=B.imageSettings,ye=new a(-1,l[k]);if(ye.addData(s(W)),ye.make(),this._canvas!=null){var pe=this._canvas,he=pe.getContext("2d");if(!he)return;var fe=ye.modules;if(fe===null)return;var de=ee?f:0,ne=fe.length+de*2,me=c(this.props,fe);ae!=null&&me!=null&&(me.excavation!=null&&(fe=m(fe,me.excavation)));var $=window.devicePixelRatio||1;pe.height=pe.width=M*$;var ie=M/ne*$;he.scale(ie,ie),he.fillStyle=H,he.fillRect(0,0,ne,ne),he.fillStyle=X,u?he.fill(new Path2D(T(fe,de))):fe.forEach(function(te,Ee){te.forEach(function(Ce,ve){Ce&&he.fillRect(ve+de,Ee+de,1,1)})}),this.state.imgLoaded&&this._image&&me!=null&&he.drawImage(this._image,me.x+de,me.y+de,me.w,me.h)}}},{key:"render",value:function(){var B=this,W=this.props,M=W.value,k=W.size,H=W.level,X=W.bgColor,ee=W.fgColor,ae=W.style,ye=W.includeMargin,pe=W.imageSettings,he=N(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),fe=K({height:k,width:k},ae),de=null,ne=pe&&pe.src;return pe!=null&&ne!=null&&(de=v.createElement("img",{src:ne,style:{display:"none"},onLoad:this.handleImageLoad,ref:function($){return B._image=$}})),v.createElement(v.Fragment,null,v.createElement("canvas",G({style:fe,height:k,width:k,ref:function($){return B._canvas=$}},he)),de)}}]),D}(v.PureComponent);E(o,"defaultProps",_);var x=function(p){P(D,p);function D(){return F(this,D),S(this,h(D).apply(this,arguments))}return R(D,[{key:"render",value:function(){var B=this.props,W=B.value,M=B.size,k=B.level,H=B.bgColor,X=B.fgColor,ee=B.includeMargin,ae=B.imageSettings,ye=N(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new a(-1,l[k]);pe.addData(s(W)),pe.make();var he=pe.modules;if(he===null)return null;var fe=ee?f:0,de=he.length+fe*2,ne=c(this.props,he),me=null;ae!=null&&ne!=null&&(ne.excavation!=null&&(he=m(he,ne.excavation)),me=v.createElement("image",{xlinkHref:ae.src,height:ne.h,width:ne.w,x:ne.x+fe,y:ne.y+fe,preserveAspectRatio:"none"}));var $=T(he,fe);return v.createElement("svg",G({shapeRendering:"crispEdges",height:M,width:M,viewBox:"0 0 ".concat(de," ").concat(de)},ye),v.createElement("path",{fill:H,d:"M0,0 h".concat(de,"v").concat(de,"H0z")}),v.createElement("path",{fill:X,d:$}),me)}}]),D}(v.PureComponent);E(x,"defaultProps",_);var y=function(D){var U=D.renderAs,B=N(D,["renderAs"]),W=U==="svg"?x:o;return v.createElement(W,B)};y.defaultProps=K({renderAs:"canvas"},_),et.exports=y},DlQD:function(et,We,J){(function(Z,G){et.exports=G()})(this,function(){"use strict";function Z(ge,se){for(var ce=0;ce<se.length;ce++){var Q=se[ce];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(ge,Q.key,Q)}}function G(ge,se,ce){return se&&Z(ge.prototype,se),ce&&Z(ge,ce),ge}function L(ge,se){if(!ge)return;if(typeof ge=="string")return K(ge,se);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return K(ge,se)}function K(ge,se){(se==null||se>ge.length)&&(se=ge.length);for(var ce=0,Q=new Array(se);ce<se;ce++)Q[ce]=ge[ce];return Q}function N(ge,se){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=L(ge))||se&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var Q=0;return function(){return Q>=ge.length?{done:!0}:{done:!1,value:ge[Q++]}}}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 ce=ge[Symbol.iterator](),ce.next.bind(ce)}function O(ge,se){return se={exports:{}},ge(se,se.exports),se.exports}var F=O(function(ge){function se(){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 ce(Q){ge.exports.defaults=Q}ge.exports={defaults:se(),getDefaults:se,changeDefaults:ce}}),I=F.defaults,R=F.getDefaults,S=F.changeDefaults,h=/[&<>"']/,g=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(se){return E[se]};function d(ge,se){if(se){if(h.test(ge))return ge.replace(g,v)}else if(P.test(ge))return ge.replace(w,v);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ge){return ge.replace(a,function(se,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var s=/(^|[^\[])\^/g;function _(ge,se){ge=ge.source||ge,se=se||"";var ce={replace:function(q,re){return re=re.source||re,re=re.replace(s,"$1"),ge=ge.replace(q,re),ce},getRegex:function(){return new RegExp(ge,se)}};return ce}var b=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(ge,se,ce){if(ge){var Q;try{Q=decodeURIComponent(l(ce)).replace(b,"").toLowerCase()}catch(q){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}se&&!f.test(ce)&&(ce=o(se,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(q){return null}return ce}var T={},m=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(ge,se){T[" "+ge]||(m.test(ge)?T[" "+ge]=ge+"/":T[" "+ge]=D(ge,"/",!0)),ge=T[" "+ge];var ce=ge.indexOf(":")===-1;return se.substring(0,2)==="//"?ce?se:ge.replace(c,"$1")+se:se.charAt(0)==="/"?ce?se:ge.replace(u,"$1")+se:ge+se}var x={exec:function(){}};function y(ge){for(var se=1,ce,Q;se<arguments.length;se++){ce=arguments[se];for(Q in ce)Object.prototype.hasOwnProperty.call(ce,Q)&&(ge[Q]=ce[Q])}return ge}function p(ge,se){var ce=ge.replace(/\|/g,function(re,le,Se){for(var Re=!1,Pe=le;--Pe>=0&&Se[Pe]==="\\";)Re=!Re;return Re?"|":" |"}),Q=ce.split(/ \|/),q=0;if(Q.length>se)Q.splice(se);else for(;Q.length<se;)Q.push("");for(;q<Q.length;q++)Q[q]=Q[q].trim().replace(/\\\|/g,"|");return Q}function D(ge,se,ce){var Q=ge.length;if(Q===0)return"";for(var q=0;q<Q;){var re=ge.charAt(Q-q-1);if(re===se&&!ce)q++;else if(re!==se&&ce)q++;else break}return ge.substr(0,Q-q)}function U(ge,se){if(ge.indexOf(se[1])===-1)return-1;for(var ce=ge.length,Q=0,q=0;q<ce;q++)if(ge[q]==="\\")q++;else if(ge[q]===se[0])Q++;else if(ge[q]===se[1]&&(Q--,Q<0))return q;return-1}function B(ge){ge&&ge.sanitize&&!ge.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:l,edit:_,cleanUrl:A,resolveUrl:o,noopTest:x,merge:y,splitCells:p,rtrim:D,findClosingBracket:U,checkSanitizeDeprecation:B},M=F.defaults,k=W.rtrim,H=W.splitCells,X=W.escape,ee=W.findClosingBracket;function ae(ge,se,ce){var Q=se.href,q=se.title?X(se.title):null,re=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:Q,title:q,text:re}:{type:"image",raw:ce,href:Q,title:q,text:X(re)}}function ye(ge,se){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return se;var Q=ce[1];return se.split(`
|
|
`).map(function(q){var re=q.match(/^\s+/);if(re===null)return q;var le=re[0];return le.length>=Q.length?q.slice(Q.length):q}).join(`
|
|
`)}var pe=function(){function ge(ce){this.options=ce||M}var se=ge.prototype;return se.space=function(Q){var q=this.rules.block.newline.exec(Q);if(q)return q[0].length>1?{type:"space",raw:q[0]}:{raw:`
|
|
`}},se.code=function(Q,q){var re=this.rules.block.code.exec(Q);if(re){var le=q[q.length-1];if(le&&le.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Se=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Se:k(Se,`
|
|
`)}}},se.fences=function(Q){var q=this.rules.block.fences.exec(Q);if(q){var re=q[0],le=ye(re,q[3]||"");return{type:"code",raw:re,lang:q[2]?q[2].trim():q[2],text:le}}},se.heading=function(Q){var q=this.rules.block.heading.exec(Q);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},se.nptable=function(Q){var q=this.rules.block.nptable.exec(Q);if(q){var re={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(re.header.length===re.align.length){var le=re.align.length,Se;for(Se=0;Se<le;Se++)/^ *-+: *$/.test(re.align[Se])?re.align[Se]="right":/^ *:-+: *$/.test(re.align[Se])?re.align[Se]="center":/^ *:-+ *$/.test(re.align[Se])?re.align[Se]="left":re.align[Se]=null;for(le=re.cells.length,Se=0;Se<le;Se++)re.cells[Se]=H(re.cells[Se],re.header.length);return re}}},se.hr=function(Q){var q=this.rules.block.hr.exec(Q);if(q)return{type:"hr",raw:q[0]}},se.blockquote=function(Q){var q=this.rules.block.blockquote.exec(Q);if(q){var re=q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:q[0],text:re}}},se.list=function(Q){var q=this.rules.block.list.exec(Q);if(q){for(var re=q[0],le=q[2],Se=le.length>1,Re=le[le.length-1]===")",Pe={type:"list",raw:re,ordered:Se,start:Se?+le.slice(0,-1):"",loose:!1,items:[]},Ve=q[0].match(this.rules.block.item),ke=!1,ze,ut,st,it,_t,bt,Rt,Ot=Ve.length,pt=0;pt<Ot;pt++)ze=Ve[pt],re=ze,ut=ze.length,ze=ze.replace(/^ *([*+-]|\d+[.)]) */,""),~ze.indexOf(`
|
|
`)&&(ut-=ze.length,ze=this.options.pedantic?ze.replace(/^ {1,4}/gm,""):ze.replace(new RegExp("^ {1,"+ut+"}","gm"),"")),pt!==Ot-1&&(st=this.rules.block.bullet.exec(Ve[pt+1])[0],(Se?st.length===1||!Re&&st[st.length-1]===")":st.length>1||this.options.smartLists&&st!==le)&&(it=Ve.slice(pt+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-it.length),pt=Ot-1)),_t=ke||/\n\n(?!\s*$)/.test(ze),pt!==Ot-1&&(ke=ze.charAt(ze.length-1)===`
|
|
`,_t||(_t=ke)),_t&&(Pe.loose=!0),bt=/^\[[ xX]\] /.test(ze),Rt=void 0,bt&&(Rt=ze[1]!==" ",ze=ze.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:re,task:bt,checked:Rt,loose:_t,text:ze});return Pe}},se.html=function(Q){var q=this.rules.block.html.exec(Q);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]}},se.def=function(Q){var q=this.rules.block.def.exec(Q);if(q){q[3]&&(q[3]=q[3].substring(1,q[3].length-1));var re=q[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:q[0],href:q[2],title:q[3]}}},se.table=function(Q){var q=this.rules.block.table.exec(Q);if(q){var re={type:"table",header:H(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=q[0];var le=re.align.length,Se;for(Se=0;Se<le;Se++)/^ *-+: *$/.test(re.align[Se])?re.align[Se]="right":/^ *:-+: *$/.test(re.align[Se])?re.align[Se]="center":/^ *:-+ *$/.test(re.align[Se])?re.align[Se]="left":re.align[Se]=null;for(le=re.cells.length,Se=0;Se<le;Se++)re.cells[Se]=H(re.cells[Se].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},se.lheading=function(Q){var q=this.rules.block.lheading.exec(Q);if(q)return{type:"heading",raw:q[0],depth:q[2].charAt(0)==="="?1:2,text:q[1]}},se.paragraph=function(Q){var q=this.rules.block.paragraph.exec(Q);if(q)return{type:"paragraph",raw:q[0],text:q[1].charAt(q[1].length-1)===`
|
|
`?q[1].slice(0,-1):q[1]}},se.text=function(Q,q){var re=this.rules.block.text.exec(Q);if(re){var le=q[q.length-1];return le&&le.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},se.escape=function(Q){var q=this.rules.inline.escape.exec(Q);if(q)return{type:"escape",raw:q[0],text:X(q[1])}},se.tag=function(Q,q,re){var le=this.rules.inline.tag.exec(Q);if(le)return!q&&/^<a /i.test(le[0])?q=!0:q&&/^<\/a>/i.test(le[0])&&(q=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:q,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]}},se.link=function(Q){var q=this.rules.inline.link.exec(Q);if(q){var re=ee(q[2],"()");if(re>-1){var le=q[0].indexOf("!")===0?5:4,Se=le+q[1].length+re;q[2]=q[2].substring(0,re),q[0]=q[0].substring(0,Se).trim(),q[3]=""}var Re=q[2],Pe="";if(this.options.pedantic){var Ve=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Re);Ve?(Re=Ve[1],Pe=Ve[3]):Pe=""}else Pe=q[3]?q[3].slice(1,-1):"";Re=Re.trim().replace(/^<([\s\S]*)>$/,"$1");var ke=ae(q,{href:Re&&Re.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},q[0]);return ke}},se.reflink=function(Q,q){var re;if((re=this.rules.inline.reflink.exec(Q))||(re=this.rules.inline.nolink.exec(Q))){var le=(re[2]||re[1]).replace(/\s+/g," ");if(le=q[le.toLowerCase()],!le||!le.href){var Se=re[0].charAt(0);return{type:"text",raw:Se,text:Se}}var Re=ae(re,le,re[0]);return Re}},se.strong=function(Q,q,re){re===void 0&&(re="");var le=this.rules.inline.strong.start.exec(Q);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*Q.length);var Se=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Se.lastIndex=0;for(var Re;(le=Se.exec(q))!=null;)if(Re=this.rules.inline.strong.middle.exec(q.slice(0,le.index+3)),Re)return{type:"strong",raw:Q.slice(0,Re[0].length),text:Q.slice(2,Re[0].length-2)}}},se.em=function(Q,q,re){re===void 0&&(re="");var le=this.rules.inline.em.start.exec(Q);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*Q.length);var Se=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Se.lastIndex=0;for(var Re;(le=Se.exec(q))!=null;)if(Re=this.rules.inline.em.middle.exec(q.slice(0,le.index+2)),Re)return{type:"em",raw:Q.slice(0,Re[0].length),text:Q.slice(1,Re[0].length-1)}}},se.codespan=function(Q){var q=this.rules.inline.code.exec(Q);if(q){var re=q[2].replace(/\n/g," "),le=/[^ ]/.test(re),Se=re.startsWith(" ")&&re.endsWith(" ");return le&&Se&&(re=re.substring(1,re.length-1)),re=X(re,!0),{type:"codespan",raw:q[0],text:re}}},se.br=function(Q){var q=this.rules.inline.br.exec(Q);if(q)return{type:"br",raw:q[0]}},se.del=function(Q){var q=this.rules.inline.del.exec(Q);if(q)return{type:"del",raw:q[0],text:q[1]}},se.autolink=function(Q,q){var re=this.rules.inline.autolink.exec(Q);if(re){var le,Se;return re[2]==="@"?(le=X(this.options.mangle?q(re[1]):re[1]),Se="mailto:"+le):(le=X(re[1]),Se=le),{type:"link",raw:re[0],text:le,href:Se,tokens:[{type:"text",raw:le,text:le}]}}},se.url=function(Q,q){var re;if(re=this.rules.inline.url.exec(Q)){var le,Se;if(re[2]==="@")le=X(this.options.mangle?q(re[0]):re[0]),Se="mailto:"+le;else{var Re;do Re=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Re!==re[0]);le=X(re[0]),re[1]==="www."?Se="http://"+le:Se=le}return{type:"link",raw:re[0],text:le,href:Se,tokens:[{type:"text",raw:le,text:le}]}}},se.inlineText=function(Q,q,re){var le=this.rules.inline.text.exec(Q);if(le){var Se;return q?Se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]:Se=X(this.options.smartypants?re(le[0]):le[0]),{type:"text",raw:le[0],text:Se}}},ge}(),he=W.noopTest,fe=W.edit,de=W.merge,ne={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:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=fe(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=fe(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=fe(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=fe(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=fe(ne._paragraph).replace("hr",ne.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",ne._tag).getRegex(),ne.blockquote=fe(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=de({},ne),ne.gfm=de({},ne.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*|$)"}),ne.gfm.nptable=fe(ne.gfm.nptable).replace("hr",ne.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",ne._tag).getRegex(),ne.gfm.table=fe(ne.gfm.table).replace("hr",ne.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",ne._tag).getRegex(),ne.pedantic=de({},ne.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._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:he,paragraph:fe(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=fe(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=fe(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=fe(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=fe(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=fe(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=fe(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=fe(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=fe(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=fe(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=fe(me._blockSkip,"g").getRegex(),me.overlapSkip=fe(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._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])?)+(?![-_])/,me.autolink=fe(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=fe(me.tag).replace("comment",ne._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=fe(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=fe(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=fe(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=de({},me),me.pedantic=de({},me.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:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=de({},me.normal,{escape:fe(me.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=fe(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=de({},me.gfm,{br:fe(me.br).replace("{2,}","*").getRegex(),text:fe(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ne,inline:me},ie=F.defaults,te=$.block,Ee=$.inline;function Ce(ge){return ge.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 ve(ge){var se="",ce,Q,q=ge.length;for(ce=0;ce<q;ce++)Q=ge.charCodeAt(ce),Math.random()>.5&&(Q="x"+Q.toString(16)),se+="&#"+Q+";";return se}var we=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ie,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:te.normal,inline:Ee.normal};this.options.pedantic?(Q.block=te.pedantic,Q.inline=Ee.pedantic):this.options.gfm&&(Q.block=te.gfm,this.options.breaks?Q.inline=Ee.breaks:Q.inline=Ee.gfm),this.tokenizer.rules=Q}ge.lex=function(Q,q){var re=new ge(q);return re.lex(Q)};var se=ge.prototype;return se.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},se.blockTokens=function(Q,q,re){q===void 0&&(q=[]),re===void 0&&(re=!0),Q=Q.replace(/^ +$/gm,"");for(var le,Se,Re,Pe;Q;){if(le=this.tokenizer.space(Q)){Q=Q.substring(le.raw.length),le.type&&q.push(le);continue}if(le=this.tokenizer.code(Q,q)){Q=Q.substring(le.raw.length),le.type?q.push(le):(Pe=q[q.length-1],Pe.raw+=`
|
|
`+le.raw,Pe.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.heading(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.nptable(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.hr(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.blockquote(Q)){Q=Q.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],re),q.push(le);continue}if(le=this.tokenizer.list(Q)){for(Q=Q.substring(le.raw.length),Re=le.items.length,Se=0;Se<Re;Se++)le.items[Se].tokens=this.blockTokens(le.items[Se].text,[],!1);q.push(le);continue}if(le=this.tokenizer.html(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(re&&(le=this.tokenizer.def(Q))){Q=Q.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.lheading(Q)){Q=Q.substring(le.raw.length),q.push(le);continue}if(re&&(le=this.tokenizer.paragraph(Q))){Q=Q.substring(le.raw.length),q.push(le);continue}if(le=this.tokenizer.text(Q,q)){Q=Q.substring(le.raw.length),le.type?q.push(le):(Pe=q[q.length-1],Pe.raw+=`
|
|
`+le.raw,Pe.text+=`
|
|
`+le.text);continue}if(Q){var Ve="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return q},se.inline=function(Q){var q,re,le,Se,Re,Pe,Ve=Q.length;for(q=0;q<Ve;q++){Pe=Q[q];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},Se=Pe.header.length,re=0;re<Se;re++)Pe.tokens.header[re]=[],this.inlineTokens(Pe.header[re],Pe.tokens.header[re]);for(Se=Pe.cells.length,re=0;re<Se;re++)for(Re=Pe.cells[re],Pe.tokens.cells[re]=[],le=0;le<Re.length;le++)Pe.tokens.cells[re][le]=[],this.inlineTokens(Re[le],Pe.tokens.cells[re][le]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(Se=Pe.items.length,re=0;re<Se;re++)this.inline(Pe.items[re].tokens);break}}}return Q},se.inlineTokens=function(Q,q,re,le,Se){q===void 0&&(q=[]),re===void 0&&(re=!1),le===void 0&&(le=!1),Se===void 0&&(Se="");var Re,Pe=Q,Ve;if(this.tokens.links){var ke=Object.keys(this.tokens.links);if(ke.length>0)for(;(Ve=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)ke.includes(Ve[0].slice(Ve[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ve=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Re=this.tokenizer.escape(Q)){Q=Q.substring(Re.raw.length),q.push(Re);continue}if(Re=this.tokenizer.tag(Q,re,le)){Q=Q.substring(Re.raw.length),re=Re.inLink,le=Re.inRawBlock,q.push(Re);continue}if(Re=this.tokenizer.link(Q)){Q=Q.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,le)),q.push(Re);continue}if(Re=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,le)),q.push(Re);continue}if(Re=this.tokenizer.strong(Q,Pe,Se)){Q=Q.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],re,le),q.push(Re);continue}if(Re=this.tokenizer.em(Q,Pe,Se)){Q=Q.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],re,le),q.push(Re);continue}if(Re=this.tokenizer.codespan(Q)){Q=Q.substring(Re.raw.length),q.push(Re);continue}if(Re=this.tokenizer.br(Q)){Q=Q.substring(Re.raw.length),q.push(Re);continue}if(Re=this.tokenizer.del(Q)){Q=Q.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],re,le),q.push(Re);continue}if(Re=this.tokenizer.autolink(Q,ve)){Q=Q.substring(Re.raw.length),q.push(Re);continue}if(!re&&(Re=this.tokenizer.url(Q,ve))){Q=Q.substring(Re.raw.length),q.push(Re);continue}if(Re=this.tokenizer.inlineText(Q,le,Ce)){Q=Q.substring(Re.raw.length),Se=Re.raw.slice(-1),q.push(Re);continue}if(Q){var ze="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return q},G(ge,null,[{key:"rules",get:function(){return{block:te,inline:Ee}}}]),ge}(),Ae=F.defaults,De=W.cleanUrl,Ie=W.escape,Le=function(){function ge(ce){this.options=ce||Ae}var se=ge.prototype;return se.code=function(Q,q,re){var le=(q||"").match(/\S*/)[0];if(this.options.highlight){var Se=this.options.highlight(Q,le);Se!=null&&Se!==Q&&(re=!0,Q=Se)}return le?'<pre><code class="'+this.options.langPrefix+Ie(le,!0)+'">'+(re?Q:Ie(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?Q:Ie(Q,!0))+`</code></pre>
|
|
`},se.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},se.html=function(Q){return Q},se.heading=function(Q,q,re,le){return this.options.headerIds?"<h"+q+' id="'+this.options.headerPrefix+le.slug(re)+'">'+Q+"</h"+q+`>
|
|
`:"<h"+q+">"+Q+"</h"+q+`>
|
|
`},se.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},se.list=function(Q,q,re){var le=q?"ol":"ul",Se=q&&re!==1?' start="'+re+'"':"";return"<"+le+Se+`>
|
|
`+Q+"</"+le+`>
|
|
`},se.listitem=function(Q){return"<li>"+Q+`</li>
|
|
`},se.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},se.paragraph=function(Q){return"<p>"+Q+`</p>
|
|
`},se.table=function(Q,q){return q&&(q="<tbody>"+q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Q+`</thead>
|
|
`+q+`</table>
|
|
`},se.tablerow=function(Q){return`<tr>
|
|
`+Q+`</tr>
|
|
`},se.tablecell=function(Q,q){var re=q.header?"th":"td",le=q.align?"<"+re+' align="'+q.align+'">':"<"+re+">";return le+Q+"</"+re+`>
|
|
`},se.strong=function(Q){return"<strong>"+Q+"</strong>"},se.em=function(Q){return"<em>"+Q+"</em>"},se.codespan=function(Q){return"<code>"+Q+"</code>"},se.br=function(){return this.options.xhtml?"<br/>":"<br>"},se.del=function(Q){return"<del>"+Q+"</del>"},se.link=function(Q,q,re){if(Q=De(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var le='<a href="'+Ie(Q)+'"';return q&&(le+=' title="'+q+'"'),le+=">"+re+"</a>",le},se.image=function(Q,q,re){if(Q=De(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var le='<img src="'+Q+'" alt="'+re+'"';return q&&(le+=' title="'+q+'"'),le+=this.options.xhtml?"/>":">",le},se.text=function(Q){return Q},ge}(),Oe=function(){function ge(){}var se=ge.prototype;return se.strong=function(Q){return Q},se.em=function(Q){return Q},se.codespan=function(Q){return Q},se.del=function(Q){return Q},se.html=function(Q){return Q},se.text=function(Q){return Q},se.link=function(Q,q,re){return""+re},se.image=function(Q,q,re){return""+re},se.br=function(){return""},ge}(),Xe=function(){function ge(){this.seen={}}var se=ge.prototype;return se.slug=function(Q){var q=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(q)){var re=q;do this.seen[re]++,q=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(q))}return this.seen[q]=0,q},ge}(),Ze=F.defaults,Be=W.unescape,je=function(){function ge(ce){this.options=ce||Ze,this.options.renderer=this.options.renderer||new Le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new Xe}ge.parse=function(Q,q){var re=new ge(q);return re.parse(Q)};var se=ge.prototype;return se.parse=function(Q,q){q===void 0&&(q=!0);var re="",le,Se,Re,Pe,Ve,ke,ze,ut,st,it,_t,bt,Rt,Ot,pt,zt,xr,or,Ir=Q.length;for(le=0;le<Ir;le++){it=Q[le];switch(it.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(it.tokens),it.depth,Be(this.parseInline(it.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(it.text,it.lang,it.escaped);continue}case"table":{for(ut="",ze="",Pe=it.header.length,Se=0;Se<Pe;Se++)ze+=this.renderer.tablecell(this.parseInline(it.tokens.header[Se]),{header:!0,align:it.align[Se]});for(ut+=this.renderer.tablerow(ze),st="",Pe=it.cells.length,Se=0;Se<Pe;Se++){for(ke=it.tokens.cells[Se],ze="",Ve=ke.length,Re=0;Re<Ve;Re++)ze+=this.renderer.tablecell(this.parseInline(ke[Re]),{header:!1,align:it.align[Re]});st+=this.renderer.tablerow(ze)}re+=this.renderer.table(ut,st);continue}case"blockquote":{st=this.parse(it.tokens),re+=this.renderer.blockquote(st);continue}case"list":{for(_t=it.ordered,bt=it.start,Rt=it.loose,Pe=it.items.length,st="",Se=0;Se<Pe;Se++)pt=it.items[Se],zt=pt.checked,xr=pt.task,Ot="",pt.task&&(or=this.renderer.checkbox(zt),Rt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=or+" "+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=or+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:or}):Ot+=or),Ot+=this.parse(pt.tokens,Rt),st+=this.renderer.listitem(Ot,xr,zt);re+=this.renderer.list(st,_t,bt);continue}case"html":{re+=this.renderer.html(it.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(it.tokens));continue}case"text":{for(st=it.tokens?this.parseInline(it.tokens):it.text;le+1<Ir&&Q[le+1].type==="text";)it=Q[++le],st+=`
|
|
`+(it.tokens?this.parseInline(it.tokens):it.text);re+=q?this.renderer.paragraph(st):st;continue}default:{var cr='Token with "'+it.type+'" type was not found.';if(this.options.silent){console.error(cr);return}else throw new Error(cr)}}}return re},se.parseInline=function(Q,q){q=q||this.renderer;var re="",le,Se,Re=Q.length;for(le=0;le<Re;le++){Se=Q[le];switch(Se.type){case"escape":{re+=q.text(Se.text);break}case"html":{re+=q.html(Se.text);break}case"link":{re+=q.link(Se.href,Se.title,this.parseInline(Se.tokens,q));break}case"image":{re+=q.image(Se.href,Se.title,Se.text);break}case"strong":{re+=q.strong(this.parseInline(Se.tokens,q));break}case"em":{re+=q.em(this.parseInline(Se.tokens,q));break}case"codespan":{re+=q.codespan(Se.text);break}case"br":{re+=q.br();break}case"del":{re+=q.del(this.parseInline(Se.tokens,q));break}case"text":{re+=q.text(Se.text);break}default:{var Pe='Token with "'+Se.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return re},ge}(),rt=W.merge,Ye=W.checkSanitizeDeprecation,qe=W.escape,Te=F.getDefaults,$e=F.changeDefaults,Ge=F.defaults;function _e(ge,se,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof se=="function"&&(ce=se,se=null),se=rt({},_e.defaults,se||{}),Ye(se),ce){var Q=se.highlight,q;try{q=we.lex(ge,se)}catch(Re){return ce(Re)}var re=function(Pe){var Ve;if(!Pe)try{Ve=je.parse(q,se)}catch(ke){Pe=ke}return se.highlight=Q,Pe?ce(Pe):ce(null,Ve)};if(!Q||Q.length<3)return re();if(delete se.highlight,!q.length)return re();var le=0;_e.walkTokens(q,function(Re){Re.type==="code"&&(le++,setTimeout(function(){Q(Re.text,Re.lang,function(Pe,Ve){if(Pe)return re(Pe);Ve!=null&&Ve!==Re.text&&(Re.text=Ve,Re.escaped=!0),le--,le===0&&re()})},0))}),le===0&&re();return}try{var Se=we.lex(ge,se);return se.walkTokens&&_e.walkTokens(Se,se.walkTokens),je.parse(Se,se)}catch(Re){if(Re.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,se.silent)return"<p>An error occurred:</p><pre>"+qe(Re.message+"",!0)+"</pre>";throw Re}}_e.options=_e.setOptions=function(ge){return rt(_e.defaults,ge),$e(_e.defaults),_e},_e.getDefaults=Te,_e.defaults=Ge,_e.use=function(ge){var se=rt({},ge);if(ge.renderer&&function(){var Q=_e.defaults.renderer||new Le,q=function(Se){var Re=Q[Se];Q[Se]=function(){for(var Pe=arguments.length,Ve=new Array(Pe),ke=0;ke<Pe;ke++)Ve[ke]=arguments[ke];var ze=ge.renderer[Se].apply(Q,Ve);return ze===!1&&(ze=Re.apply(Q,Ve)),ze}};for(var re in ge.renderer)q(re);se.renderer=Q}(),ge.tokenizer&&function(){var Q=_e.defaults.tokenizer||new pe,q=function(Se){var Re=Q[Se];Q[Se]=function(){for(var Pe=arguments.length,Ve=new Array(Pe),ke=0;ke<Pe;ke++)Ve[ke]=arguments[ke];var ze=ge.tokenizer[Se].apply(Q,Ve);return ze===!1&&(ze=Re.apply(Q,Ve)),ze}};for(var re in ge.tokenizer)q(re);se.tokenizer=Q}(),ge.walkTokens){var ce=_e.defaults.walkTokens;se.walkTokens=function(Q){ge.walkTokens(Q),ce&&ce(Q)}}_e.setOptions(se)},_e.walkTokens=function(ge,se){for(var ce=N(ge),Q;!(Q=ce()).done;){var q=Q.value;se(q);switch(q.type){case"table":{for(var re=N(q.tokens.header),le;!(le=re()).done;){var Se=le.value;_e.walkTokens(Se,se)}for(var Re=N(q.tokens.cells),Pe;!(Pe=Re()).done;)for(var Ve=Pe.value,ke=N(Ve),ze;!(ze=ke()).done;){var ut=ze.value;_e.walkTokens(ut,se)}break}case"list":{_e.walkTokens(q.items,se);break}default:q.tokens&&_e.walkTokens(q.tokens,se)}}},_e.Parser=je,_e.parser=je.parse,_e.Renderer=Le,_e.TextRenderer=Oe,_e.Lexer=we,_e.lexer=we.lex,_e.Tokenizer=pe,_e.Slugger=Xe,_e.parse=_e;var Ue=_e;return Ue})},ELLl:function(et,We,J){(function(Z){Z(J("VrN/"))})(function(Z){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=Z.Pos;Z.defineOption("autoCloseBrackets",!1,function(E,v,d){d&&d!=Z.Init&&(E.removeKeyMap(N),E.state.closeBrackets=null),v&&(O(K(v,"pairs")),E.state.closeBrackets=v,E.addKeyMap(N))});function K(E,v){return v=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[v]!=null?E[v]:G[v]}var N={Backspace:R,Enter:S};function O(E){for(var v=0;v<E.length;v++){var d=E.charAt(v),a="'"+d+"'";N[a]||(N[a]=F(d))}}O(G.pairs+"`");function F(E){return function(v){return g(v,E)}}function I(E){var v=E.state.closeBrackets;if(!v||v.override)return v;var d=E.getModeAt(E.getCursor());return d.closeBrackets||v}function R(E){var v=I(E);if(!v||E.getOption("disableInput"))return Z.Pass;for(var d=K(v,"pairs"),a=E.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return Z.Pass;var s=P(E,a[l].head);if(!s||d.indexOf(s)%2!=0)return Z.Pass}for(var l=a.length-1;l>=0;l--){var _=a[l].head;E.replaceRange("",L(_.line,_.ch-1),L(_.line,_.ch+1),"+delete")}}function S(E){var v=I(E),d=v&&K(v,"explode");if(!d||E.getOption("disableInput"))return Z.Pass;for(var a=E.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return Z.Pass;var s=P(E,a[l].head);if(!s||d.indexOf(s)%2!=0)return Z.Pass}E.operation(function(){var _=E.lineSeparator()||`
|
|
`;E.replaceSelection(_+_,null),E.execCommand("goCharLeft"),a=E.listSelections();for(var b=0;b<a.length;b++){var f=a[b].head.line;E.indentLine(f,null,!0),E.indentLine(f+1,null,!0)}})}function h(E){var v=Z.cmpPos(E.anchor,E.head)>0;return{anchor:new L(E.anchor.line,E.anchor.ch+(v?-1:1)),head:new L(E.head.line,E.head.ch+(v?1:-1))}}function g(E,v){var d=I(E);if(!d||E.getOption("disableInput"))return Z.Pass;var a=K(d,"pairs"),l=a.indexOf(v);if(l==-1)return Z.Pass;for(var s=K(d,"closeBefore"),_=K(d,"triples"),b=a.charAt(l+1)==v,f=E.listSelections(),A=l%2==0,T,m=0;m<f.length;m++){var c=f[m],u=c.head,o,x=E.getRange(u,L(u.line,u.ch+1));if(A&&!c.empty())o="surround";else if((b||!A)&&x==v)b&&w(E,u)?o="both":_.indexOf(v)>=0&&E.getRange(u,L(u.line,u.ch+3))==v+v+v?o="skipThree":o="skip";else if(b&&u.ch>1&&_.indexOf(v)>=0&&E.getRange(L(u.line,u.ch-2),u)==v+v){if(u.ch>2&&/\bstring/.test(E.getTokenTypeAt(L(u.line,u.ch-2))))return Z.Pass;o="addFour"}else if(b){var y=u.ch==0?" ":E.getRange(L(u.line,u.ch-1),u);if(!Z.isWordChar(x)&&y!=v&&!Z.isWordChar(y))o="both";else return Z.Pass}else if(A&&(x.length===0||/\s/.test(x)||s.indexOf(x)>-1))o="both";else return Z.Pass;if(!T)T=o;else if(T!=o)return Z.Pass}var p=l%2?a.charAt(l-1):v,D=l%2?v:a.charAt(l+1);E.operation(function(){if(T=="skip")E.execCommand("goCharRight");else if(T=="skipThree")for(var U=0;U<3;U++)E.execCommand("goCharRight");else if(T=="surround"){for(var B=E.getSelections(),U=0;U<B.length;U++)B[U]=p+B[U]+D;E.replaceSelections(B,"around"),B=E.listSelections().slice();for(var U=0;U<B.length;U++)B[U]=h(B[U]);E.setSelections(B)}else T=="both"?(E.replaceSelection(p+D,null),E.triggerElectric(p+D),E.execCommand("goCharLeft")):T=="addFour"&&(E.replaceSelection(p+p+p+p,"before"),E.execCommand("goCharRight"))})}function P(E,v){var d=E.getRange(L(v.line,v.ch-1),L(v.line,v.ch+1));return d.length==2?d:null}function w(E,v){var d=E.getTokenAt(L(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(E.getTokenTypeAt(v)))}})},GfqC:function(et,We,J){"use strict";var Z=J("cDcd"),G=J.n(Z),L=J("TSYQ"),K=J.n(L);function N(W,M){var k="cannot "+W.method+" "+W.action+" "+M.status+"'",H=new Error(k);return H.status=M.status,H.method=W.method,H.url=W.action,H}function O(W){var M=W.responseText||W.response;if(!M)return M;try{return JSON.parse(M)}catch(k){return M}}function F(W){var M=new XMLHttpRequest;W.onProgress&&M.upload&&(M.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var k=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var ee=W.data[X];if(Array.isArray(ee)){ee.forEach(function(ae){k.append(X+"[]",ae)});return}k.append(X,W.data[X])}),W.file instanceof Blob?k.append(W.filename,W.file,W.file.name):k.append(W.filename,W.file),M.onerror=function(ee){W.onError(ee)},M.onload=function(){return M.status<200||M.status>=300?W.onError(N(W,M),O(M)):W.onSuccess(O(M),M)},M.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&M.setRequestHeader(X,H[X])}),M.send(k),{abort:function(){M.abort()}}}var I=+new Date,R=0;function S(){return"rc-upload-"+I+"-"+ ++R}function h(W,M){return W.indexOf(M,W.length-M.length)!==-1}var g=function(W,M){if(W&&M){var k=Array.isArray(M)?M:M.split(","),H=W.name||"",X=W.type||"",ee=X.replace(/\/.*$/,"");return k.some(function(ae){var ye=ae.trim();return ye.charAt(0)==="."?h(H.toLowerCase(),ye.toLowerCase()):/\/\*$/.test(ye)?ee===ye.replace(/\/.*$/,""):X===ye})}return!0};function P(W,M){var k=W.createReader(),H=[];function X(){k.readEntries(function(ee){var ae=Array.prototype.slice.apply(ee);H=H.concat(ae);var ye=!ae.length;ye?M(H):X()})}X()}var w=function(M,k,H){var X=function ee(ae,ye){ye=ye||"",ae.isFile?ae.file(function(pe){H(pe)&&(ae.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=ae.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),k([pe]))}):ae.isDirectory&&P(ae,function(pe){pe.forEach(function(he){ee(he,""+ye+ae.name+"/")})})};M.forEach(function(ee){X(ee.webkitGetAsEntry())})},E=w,v=Object.assign||function(W){for(var M=1;M<arguments.length;M++){var k=arguments[M];for(var H in k)Object.prototype.hasOwnProperty.call(k,H)&&(W[H]=k[H])}return W},d=function(){function W(M,k){var H=[],X=!0,ee=!1,ae=void 0;try{for(var ye=M[Symbol.iterator](),pe;!(X=(pe=ye.next()).done)&&!(H.push(pe.value),k&&H.length===k);X=!0);}catch(he){ee=!0,ae=he}finally{try{!X&&ye.return&&ye.return()}finally{if(ee)throw ae}}return H}return function(M,k){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return W(M,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function W(M,k){for(var H=0;H<k.length;H++){var X=k[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(M,X.key,X)}}return function(M,k,H){return k&&W(M.prototype,k),H&&W(M,H),M}}();function l(W,M,k){return M in W?Object.defineProperty(W,M,{value:k,enumerable:!0,configurable:!0,writable:!0}):W[M]=k,W}function s(W,M){var k={};for(var H in W){if(M.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;k[H]=W[H]}return k}function _(W,M){if(!(W instanceof M))throw new TypeError("Cannot call a class as a function")}function b(W,M){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:W}function f(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);W.prototype=Object.create(M&&M.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(W,M):W.__proto__=M)}var A=function(M){return Object.keys(M).reduce(function(k,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(k[H]=M[H]),k},{})},T=function(W){f(M,W);function M(){var k,H,X,ee;_(this,M);for(var ae=arguments.length,ye=Array(ae),pe=0;pe<ae;pe++)ye[pe]=arguments[pe];return ee=(H=(X=b(this,(k=M.__proto__||Object.getPrototypeOf(M)).call.apply(k,[this].concat(ye))),X),X.state={uid:S()},X.reqs={},X.onChange=function(he){var fe=he.target.files;X.uploadFiles(fe),X.reset()},X.onClick=function(he){var fe=X.fileInput;if(!fe)return;var de=X.props,ne=de.children,me=de.onClick;ne&&ne.type==="button"&&(fe.parentNode.focus(),fe.parentNode.querySelector("button").blur()),fe.click(),me&&me(he)},X.onKeyDown=function(he){he.key==="Enter"&&X.onClick()},X.onFileDrop=function(he){var fe=X.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(X.props.directory)E(Array.prototype.slice.call(he.dataTransfer.items),X.uploadFiles,function(ne){return g(ne,X.props.accept)});else{var de=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ne){return g(ne,X.props.accept)});fe===!1&&(de=de.slice(0,1)),X.uploadFiles(de)}},X.uploadFiles=function(he){var fe=Array.prototype.slice.call(he);fe.map(function(de){return de.uid=S(),de}).forEach(function(de){X.upload(de,fe)})},X.saveFileInput=function(he){X.fileInput=he},H),b(X,ee)}return a(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var ee=this,ae=this.props;if(!ae.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var ye=ae.beforeUpload(H,X);ye&&ye.then?ye.then(function(pe){var he=Object.prototype.toString.call(pe);return he==="[object File]"||he==="[object Blob]"?ee.post(pe):ee.post(H)}).catch(function(pe){console.log(pe)}):ye!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var ee=this.props,ae=ee.onStart,ye=ee.onProgress,pe=ee.transformFile,he=pe===void 0?function(fe){return fe}:pe;new Promise(function(fe){var de=ee.action;return typeof de=="function"&&(de=de(H)),fe(de)}).then(function(fe){var de=H.uid,ne=ee.customRequest||F,me=Promise.resolve(he(H)).then(function($){var ie=ee.data;return typeof ie=="function"&&(ie=ie($)),Promise.all([$,ie])}).catch(function($){console.error($)});me.then(function($){var ie=d($,2),te=ie[0],Ee=ie[1],Ce={action:fe,filename:ee.name,data:Ee,file:te,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:ye?function(ve){ye(ve,H)}:null,onSuccess:function(we,Ae){delete X.reqs[de],ee.onSuccess(we,H,Ae)},onError:function(we,Ae){delete X.reqs[de],ee.onError(we,Ae,H)}};ae(H),X.reqs[de]=ne(Ce)})})}},{key:"reset",value:function(){this.setState({uid:S()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),X[ee]&&X[ee].abort&&X[ee].abort(),delete X[ee]}else Object.keys(X).forEach(function(ae){X[ae]&&X[ae].abort&&X[ae].abort(),delete X[ae]})}},{key:"render",value:function(){var H,X=this.props,ee=X.component,ae=X.prefixCls,ye=X.className,pe=X.disabled,he=X.id,fe=X.style,de=X.multiple,ne=X.accept,me=X.children,$=X.directory,ie=X.openFileDialogOnClick,te=X.onMouseEnter,Ee=X.onMouseLeave,Ce=s(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ve=K()((H={},l(H,ae,!0),l(H,ae+"-disabled",pe),l(H,ye,ye),H)),we=pe?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:te,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return G.a.createElement(ee,v({},we,{className:ve,role:"button",style:fe}),G.a.createElement("input",v({},A(Ce),{id:he,type:"file",ref:this.saveFileInput,onClick:function(De){return De.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:de,onChange:this.onChange})),me)}}]),M}(Z.Component),m=T,c=Object.assign||function(W){for(var M=1;M<arguments.length;M++){var k=arguments[M];for(var H in k)Object.prototype.hasOwnProperty.call(k,H)&&(W[H]=k[H])}return W},u=function(){function W(M,k){for(var H=0;H<k.length;H++){var X=k[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(M,X.key,X)}}return function(M,k,H){return k&&W(M.prototype,k),H&&W(M,H),M}}();function o(W,M){if(!(W instanceof M))throw new TypeError("Cannot call a class as a function")}function x(W,M){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:W}function y(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);W.prototype=Object.create(M&&M.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(W,M):W.__proto__=M)}function p(){}var D=function(W){y(M,W);function M(){var k,H,X,ee;o(this,M);for(var ae=arguments.length,ye=Array(ae),pe=0;pe<ae;pe++)ye[pe]=arguments[pe];return ee=(H=(X=x(this,(k=M.__proto__||Object.getPrototypeOf(M)).call.apply(k,[this].concat(ye))),X),X.saveUploader=function(he){X.uploader=he},H),x(X,ee)}return u(M,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return G.a.createElement(m,c({},this.props,{ref:this.saveUploader}))}}]),M}(Z.Component);D.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:p,onError:p,onSuccess:p,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=D,B=We.a=U},H38U:function(et,We,J){var Z=J("f4xo"),G=J("rcnY"),L=J("wU8J"),K=J("Iq15"),N=J("dWSS");function O(I,R){this.typeNumber=I,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var F=O.prototype;F.addData=function(I){var R=new Z(I);this.dataList.push(R),this.dataCache=null},F.isDark=function(I,R){if(I<0||this.moduleCount<=I||R<0||this.moduleCount<=R)throw new Error(I+","+R);return this.modules[I][R]},F.getModuleCount=function(){return this.moduleCount},F.make=function(){if(this.typeNumber<1){var I=1;for(I=1;I<40;I++){for(var R=G.getRSBlocks(I,this.errorCorrectLevel),S=new L,h=0,g=0;g<R.length;g++)h+=R[g].dataCount;for(var g=0;g<this.dataList.length;g++){var P=this.dataList[g];S.put(P.mode,4),S.put(P.getLength(),K.getLengthInBits(P.mode,I)),P.write(S)}if(S.getLengthInBits()<=h*8)break}this.typeNumber=I}this.makeImpl(!1,this.getBestMaskPattern())},F.makeImpl=function(I,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var S=0;S<this.moduleCount;S++){this.modules[S]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++)this.modules[S][h]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(I,R),this.typeNumber>=7&&this.setupTypeNumber(I),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},F.setupPositionProbePattern=function(I,R){for(var S=-1;S<=7;S++){if(I+S<=-1||this.moduleCount<=I+S)continue;for(var h=-1;h<=7;h++){if(R+h<=-1||this.moduleCount<=R+h)continue;0<=S&&S<=6&&(h==0||h==6)||0<=h&&h<=6&&(S==0||S==6)||2<=S&&S<=4&&2<=h&&h<=4?this.modules[I+S][R+h]=!0:this.modules[I+S][R+h]=!1}}},F.getBestMaskPattern=function(){for(var I=0,R=0,S=0;S<8;S++){this.makeImpl(!0,S);var h=K.getLostPoint(this);(S==0||I>h)&&(I=h,R=S)}return R},F.createMovieClip=function(I,R,S){var h=I.createEmptyMovieClip(R,S),g=1;this.make();for(var P=0;P<this.modules.length;P++)for(var w=P*g,E=0;E<this.modules[P].length;E++){var v=E*g,d=this.modules[P][E];d&&(h.beginFill(0,100),h.moveTo(v,w),h.lineTo(v+g,w),h.lineTo(v+g,w+g),h.lineTo(v,w+g),h.endFill())}return h},F.setupTimingPattern=function(){for(var I=8;I<this.moduleCount-8;I++){if(this.modules[I][6]!=null)continue;this.modules[I][6]=I%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},F.setupPositionAdjustPattern=function(){for(var I=K.getPatternPosition(this.typeNumber),R=0;R<I.length;R++)for(var S=0;S<I.length;S++){var h=I[R],g=I[S];if(this.modules[h][g]!=null)continue;for(var P=-2;P<=2;P++)for(var w=-2;w<=2;w++)P==-2||P==2||w==-2||w==2||P==0&&w==0?this.modules[h+P][g+w]=!0:this.modules[h+P][g+w]=!1}},F.setupTypeNumber=function(I){for(var R=K.getBCHTypeNumber(this.typeNumber),S=0;S<18;S++){var h=!I&&(R>>S&1)==1;this.modules[Math.floor(S/3)][S%3+this.moduleCount-8-3]=h}for(var S=0;S<18;S++){var h=!I&&(R>>S&1)==1;this.modules[S%3+this.moduleCount-8-3][Math.floor(S/3)]=h}},F.setupTypeInfo=function(I,R){for(var S=this.errorCorrectLevel<<3|R,h=K.getBCHTypeInfo(S),g=0;g<15;g++){var P=!I&&(h>>g&1)==1;g<6?this.modules[g][8]=P:g<8?this.modules[g+1][8]=P:this.modules[this.moduleCount-15+g][8]=P}for(var g=0;g<15;g++){var P=!I&&(h>>g&1)==1;g<8?this.modules[8][this.moduleCount-g-1]=P:g<9?this.modules[8][15-g-1+1]=P:this.modules[8][15-g-1]=P}this.modules[this.moduleCount-8][8]=!I},F.mapData=function(I,R){for(var S=-1,h=this.moduleCount-1,g=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var E=0;E<2;E++)if(this.modules[h][w-E]==null){var v=!1;P<I.length&&(v=(I[P]>>>g&1)==1);var d=K.getMask(R,h,w-E);d&&(v=!v),this.modules[h][w-E]=v,g--,g==-1&&(P++,g=7)}if(h+=S,h<0||this.moduleCount<=h){h-=S,S=-S;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(I,R,S){for(var h=G.getRSBlocks(I,R),g=new L,P=0;P<S.length;P++){var w=S[P];g.put(w.mode,4),g.put(w.getLength(),K.getLengthInBits(w.mode,I)),w.write(g)}for(var E=0,P=0;P<h.length;P++)E+=h[P].dataCount;if(g.getLengthInBits()>E*8)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+E*8+")");for(g.getLengthInBits()+4<=E*8&&g.put(0,4);g.getLengthInBits()%8!=0;)g.putBit(!1);for(;!(g.getLengthInBits()>=E*8);){if(g.put(O.PAD0,8),g.getLengthInBits()>=E*8)break;g.put(O.PAD1,8)}return O.createBytes(g,h)},O.createBytes=function(I,R){for(var S=0,h=0,g=0,P=new Array(R.length),w=new Array(R.length),E=0;E<R.length;E++){var v=R[E].dataCount,d=R[E].totalCount-v;h=Math.max(h,v),g=Math.max(g,d),P[E]=new Array(v);for(var a=0;a<P[E].length;a++)P[E][a]=255&I.buffer[a+S];S+=v;var l=K.getErrorCorrectPolynomial(d),s=new N(P[E],l.getLength()-1),_=s.mod(l);w[E]=new Array(l.getLength()-1);for(var a=0;a<w[E].length;a++){var b=a+_.getLength()-w[E].length;w[E][a]=b>=0?_.get(b):0}}for(var f=0,a=0;a<R.length;a++)f+=R[a].totalCount;for(var A=new Array(f),T=0,a=0;a<h;a++)for(var E=0;E<R.length;E++)a<P[E].length&&(A[T++]=P[E][a]);for(var a=0;a<g;a++)for(var E=0;E<R.length;E++)a<w[E].length&&(A[T++]=w[E][a]);return A},et.exports=O},HmJG:function(et,We,J){},Iq15:function(et,We,J){var Z=J("nVVt"),G=J("dWSS"),L=J("dQei"),K={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var F=O<<10;N.getBCHDigit(F)-N.getBCHDigit(N.G15)>=0;)F^=N.G15<<N.getBCHDigit(F)-N.getBCHDigit(N.G15);return(O<<10|F)^N.G15_MASK},getBCHTypeNumber:function(O){for(var F=O<<12;N.getBCHDigit(F)-N.getBCHDigit(N.G18)>=0;)F^=N.G18<<N.getBCHDigit(F)-N.getBCHDigit(N.G18);return O<<12|F},getBCHDigit:function(O){for(var F=0;O!=0;)F++,O>>>=1;return F},getPatternPosition:function(O){return N.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,F,I){switch(O){case K.PATTERN000:return(F+I)%2==0;case K.PATTERN001:return F%2==0;case K.PATTERN010:return I%3==0;case K.PATTERN011:return(F+I)%3==0;case K.PATTERN100:return(Math.floor(F/2)+Math.floor(I/3))%2==0;case K.PATTERN101:return F*I%2+F*I%3==0;case K.PATTERN110:return(F*I%2+F*I%3)%2==0;case K.PATTERN111:return(F*I%3+(F+I)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var F=new G([1],0),I=0;I<O;I++)F=F.multiply(new G([1,L.gexp(I)],0));return F},getLengthInBits:function(O,F){if(1<=F&&F<10)switch(O){case Z.MODE_NUMBER:return 10;case Z.MODE_ALPHA_NUM:return 9;case Z.MODE_8BIT_BYTE:return 8;case Z.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(F<27)switch(O){case Z.MODE_NUMBER:return 12;case Z.MODE_ALPHA_NUM:return 11;case Z.MODE_8BIT_BYTE:return 16;case Z.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(F<41)switch(O){case Z.MODE_NUMBER:return 14;case Z.MODE_ALPHA_NUM:return 13;case Z.MODE_8BIT_BYTE:return 16;case Z.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+F)},getLostPoint:function(O){for(var F=O.getModuleCount(),I=0,R=0;R<F;R++)for(var S=0;S<F;S++){for(var h=0,g=O.isDark(R,S),P=-1;P<=1;P++){if(R+P<0||F<=R+P)continue;for(var w=-1;w<=1;w++){if(S+w<0||F<=S+w)continue;if(P==0&&w==0)continue;g==O.isDark(R+P,S+w)&&h++}}h>5&&(I+=3+h-5)}for(var R=0;R<F-1;R++)for(var S=0;S<F-1;S++){var E=0;O.isDark(R,S)&&E++,O.isDark(R+1,S)&&E++,O.isDark(R,S+1)&&E++,O.isDark(R+1,S+1)&&E++,(E==0||E==4)&&(I+=3)}for(var R=0;R<F;R++)for(var S=0;S<F-6;S++)O.isDark(R,S)&&!O.isDark(R,S+1)&&O.isDark(R,S+2)&&O.isDark(R,S+3)&&O.isDark(R,S+4)&&!O.isDark(R,S+5)&&O.isDark(R,S+6)&&(I+=40);for(var S=0;S<F;S++)for(var R=0;R<F-6;R++)O.isDark(R,S)&&!O.isDark(R+1,S)&&O.isDark(R+2,S)&&O.isDark(R+3,S)&&O.isDark(R+4,S)&&!O.isDark(R+5,S)&&O.isDark(R+6,S)&&(I+=40);for(var v=0,S=0;S<F;S++)for(var R=0;R<F;R++)O.isDark(R,S)&&v++;var d=Math.abs(100*v/F/F-50)/5;return I+=d*10,I}};et.exports=N},LdHM:function(et,We,J){"use strict";J.d(We,"b",function(){return s}),J.d(We,"a",function(){return b});var Z=J("1OyB"),G=J("vuIU"),L=J("Ji7U"),K=J("LK+K"),N=J("cDcd"),O=J("rePB"),F=J("Ff2n"),I=J("ODXe"),R=J("4IlW"),S=J("bX4T"),h=J("YrtM"),g=J("TSYQ"),P=J.n(g),w=J("+nKL"),E=J("8OUc"),v=function(H,X){var ee=H.prefixCls,ae=H.id,ye=H.flattenOptions,pe=H.childrenAsData,he=H.values,fe=H.searchValue,de=H.multiple,ne=H.defaultActiveFirstOption,me=H.height,$=H.itemHeight,ie=H.notFoundContent,te=H.open,Ee=H.menuItemSelectedIcon,Ce=H.virtual,ve=H.onSelect,we=H.onToggleOpen,Ae=H.onActiveValue,De=H.onScroll,Ie=H.onMouseEnter,Le="".concat(ee,"-item"),Oe=Object(h.a)(function(){return ye},[te,ye],function(Ue,ge){return ge[0]&&Ue[1]!==ge[1]}),Xe=N.useRef(null),Ze=function(ge){ge.preventDefault()},Be=function(ge){Xe.current&&Xe.current.scrollTo({index:ge})},je=function(ge){for(var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Oe.length,Q=0;Q<ce;Q+=1){var q=(ge+Q*se+ce)%ce,re=Oe[q],le=re.group,Se=re.data;if(!le&&!Se.disabled)return q}return-1},rt=N.useState(function(){return je(0)}),Ye=Object(I.a)(rt,2),qe=Ye[0],Te=Ye[1],$e=function(ge){Te(ge);var se=Oe[ge];if(!se){Ae(null,-1);return}Ae(se.data.value,ge)};N.useEffect(function(){$e(ne!==!1?je(0):-1)},[Oe.length,fe]),N.useEffect(function(){var Ue=setTimeout(function(){if(!de&&te&&he.size===1){var ge=Array.from(he)[0],se=Oe.findIndex(function(ce){var Q=ce.data;return Q.value===ge});$e(se),Be(se)}});return function(){return clearTimeout(Ue)}},[te]);var Ge=function(ge){ge!==void 0&&ve(ge,{selected:!he.has(ge)}),de||we(!1)};if(N.useImperativeHandle(X,function(){return{onKeyDown:function(ge){var se=ge.which;switch(se){case R.a.UP:case R.a.DOWN:{var ce=0;if(se===R.a.UP?ce=-1:se===R.a.DOWN&&(ce=1),ce!==0){var Q=je(qe+ce,ce);Be(Q),$e(Q)}break}case R.a.ENTER:{var q=Oe[qe];q&&!q.data.disabled?Ge(q.data.value):Ge(void 0),te&&ge.preventDefault();break}case R.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ge){Be(ge)}}}),Oe.length===0)return N.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(Le,"-empty"),onMouseDown:Ze},ie);function _e(Ue){var ge=Oe[Ue];if(!ge)return null;var se=ge.data||{},ce=se.value,Q=se.label,q=se.children,re=Object(S.a)(se,!0),le=pe?q:Q;return ge?N.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},re,{key:Ue,role:"option",id:"".concat(ae,"_list_").concat(Ue),"aria-selected":he.has(ce)}),ce):null}return N.createElement(N.Fragment,null,N.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},_e(qe-1),_e(qe),_e(qe+1)),N.createElement(w.a,{itemKey:"key",ref:Xe,data:Oe,height:me,itemHeight:$,fullHeight:!1,onMouseDown:Ze,onScroll:De,virtual:Ce,onMouseEnter:Ie},function(Ue,ge){var se,ce=Ue.group,Q=Ue.groupOption,q=Ue.data,re=q.label,le=q.key;if(ce)return N.createElement("div",{className:P()(Le,"".concat(Le,"-group"))},re!==void 0?re:le);var Se=q.disabled,Re=q.value,Pe=q.title,Ve=q.children,ke=q.style,ze=q.className,ut=Object(F.a)(q,["disabled","value","title","children","style","className"]),st=he.has(Re),it="".concat(Le,"-option"),_t=P()(Le,it,ze,(se={},Object(O.a)(se,"".concat(it,"-grouped"),Q),Object(O.a)(se,"".concat(it,"-active"),qe===ge&&!Se),Object(O.a)(se,"".concat(it,"-disabled"),Se),Object(O.a)(se,"".concat(it,"-selected"),st),se)),bt=pe?Ve:re,Rt=!Ee||typeof Ee=="function"||st;return N.createElement("div",Object.assign({},ut,{"aria-selected":st,className:_t,title:Pe,onMouseMove:function(){if(qe===ge||Se)return;$e(ge)},onClick:function(){Se||Ge(Re)},style:ke}),N.createElement("div",{className:"".concat(it,"-content")},bt||Re),N.isValidElement(Ee)||st,Rt&&N.createElement(E.a,{className:"".concat(Le,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:st}},st?"\u2713":null))}))},d=N.forwardRef(v);d.displayName="OptionList";var a=d,l=function(){return null};l.isSelectOption=!0;var s=l,_=function(){return null};_.isSelectOptGroup=!0;var b=_,f=J("VTBJ"),A=J("Zm9Q");function T(k){var H=k.key,X=k.props,ee=X.children,ae=X.value,ye=Object(F.a)(X,["children","value"]);return Object(f.a)({key:H,value:ae!==void 0?ae:H,children:ee},ye)}function m(k){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(k).map(function(X,ee){if(!N.isValidElement(X)||!X.type)return null;var ae=X.type.isSelectOptGroup,ye=X.key,pe=X.props,he=pe.children,fe=Object(F.a)(pe,["children"]);return H||!ae?T(X):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(ye===null?ee:ye,"__"),label:ye},fe),{},{options:m(he)})}).filter(function(X){return X})}var c=J("2Qr1"),u=J("qNPg"),o=J("U8pU"),x=J("Kwbf"),y=J("WKfj");function p(k){var H=k.mode,X=k.options,ee=k.children,ae=k.backfill,ye=k.allowClear,pe=k.placeholder,he=k.getInputElement,fe=k.showSearch,de=k.onSearch,ne=k.defaultOpen,me=k.autoFocus,$=k.labelInValue,ie=k.value,te=k.inputValue,Ee=k.optionLabelProp,Ce=H==="multiple"||H==="tags",ve=fe!==void 0?fe:Ce||H==="combobox",we=X||m(ee);if(Object(x.a)(H!=="tags"||we.every(function(Le){return!Le.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Ae=we.some(function(Le){return Le.options?Le.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in Le?Le.value:Le.key)=="number"});Object(x.a)(!Ae,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(H==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(x.a)(H==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(x.b)(H!=="combobox"||!he||!ye||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),de&&!ve&&H!=="combobox"&&H!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ne||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var De=Object(y.d)(ie);Object(x.a)(!$||De.every(function(Le){return Object(o.a)(Le)==="object"&&("key"in Le||"value"in Le)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Ce||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var Ie=null;Object(A.a)(ee).some(function(Le){if(!N.isValidElement(Le)||!Le.type)return!1;var Oe=Le.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var Xe=Object(A.a)(Le.props.children).every(function(Ze){return!N.isValidElement(Ze)||!Le.type||Ze.type.isSelectOption?!0:(Ie=Ze.type,!1)});return!Xe}return Ie=Oe,!0}),Ie&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(x.a)(te===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=p,U=Object(u.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:m,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:D,fillOptionsWithMissingValue:c.a}),B=function(k){Object(L.a)(X,k);var H=Object(K.a)(X);function X(){var ee;return Object(Z.a)(this,X),ee=H.apply(this,arguments),ee.selectRef=N.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(G.a)(X,[{key:"render",value:function(){return N.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),X}(N.Component);B.Option=s,B.OptGroup=b;var W=B,M=We.c=W},M8RZ:function(et,We,J){"use strict";J.d(We,"a",function(){return R});var Z=J("fWQN"),G=J("mtLc"),L=J("yKVA"),K=J("879j"),N=J("cDcd"),O=J.n(N),F=J("faye"),I=J.n(F),R=function(S){Object(L.a)(g,S);var h=Object(K.a)(g);function g(P){var w;Object(Z.a)(this,g),w=h.call(this,P);var E=window.document;return w.node=E.createElement("div"),E.body.appendChild(w.node),w}return Object(G.a)(g,[{key:"render",value:function(){var w=this.props.children;return Object(F.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),g}(O.a.Component)},Ot1p:function(et,We,J){"use strict";var Z=J("2qtc"),G=J("kLXV"),L=J("rAM+"),K=J("miYZ"),N=J("tsqr"),O=J("9og8"),F=J("tJVT"),I=J("jrin"),R=J("WmNS"),S=J.n(R),h=J("cDcd"),g=J.n(h),P=J("VrN/"),w=J.n(P),E=J("bdgK"),v=J("p77/"),d=J("Bd2K"),a=J("ELLl"),l=J("19Vz"),s=J("lZu9"),_=J("+NIl"),b=J("kSUc"),f=J("9Bee"),A=function(ke){var ze=ke.value,ut=ze===void 0?"":ze,st=ke.className,it=ke.showTextOnly,_t=ke.showLines,bt=ke.style,Rt=bt===void 0?{}:bt,Ot=Object(h.useMemo)(function(){return""},[ut]);return g.a.createElement(g.a.Fragment,null,g.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ot}}))},T=J("Q9mQ"),m=J("diRs"),c=J("0Owb"),u=J("dejd"),o=J("C+DQ"),x=J("D1Df"),y=J.n(x),p=J("1vsH"),D=J("m3rI"),U=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function B(ke){var ze=ke.onActionCallback,ut=ke.title,st=ke.icon,it=ke.actionName,_t=ke.className,bt=_t===void 0?"":_t,Rt=ke.children;function Ot(){ze(it)}return g.a.createElement("a",{title:ut,className:bt,onClick:Ot},g.a.createElement("i",{className:"md-iconfont ".concat(st)}),Rt)}var W=function(ke){var ze=ke.watch,ut=ke.showNullButton,st=ke.onActionCallback,it=ke.fullScreen,_t=ke.insertTemp,bt=ke.hidetoolBar,Rt=ke.uuid,Ot=ke.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Rt,"&api=").concat(encodeURIComponent(D.a.PROXY_SERVER)));var pt=[].concat(U,[{title:"".concat(ze?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ze?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return g.a.createElement("ul",{className:"markdown-toolbar-container"},!bt&&pt.map(function(zt,xr){return g.a.createElement("li",{key:xr},zt.actionName?g.a.createElement(B,Object(c.a)({},zt,{onActionCallback:st})):g.a.createElement("span",{className:"v-line"}))}),ut?g.a.createElement("li",null,g.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:st},g.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,_t&&g.a.createElement("li",null,g.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(_t),onActionCallback:st},g.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),g.a.createElement("li",null,g.a.createElement(m.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:g.a.createElement("div",null,g.a.createElement(y.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Rt,"&api=").concat(encodeURIComponent(D.a.PROXY_SERVER))}))},g.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return Ot(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),g.a.createElement("li",{className:"btn-full-screen"},g.a.createElement(B,{icon:"".concat(it?"icon-shrink":"icon-enlarge"),title:it?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:st})))},M=J("M8RZ"),k=J("+L6B"),H=J("2/Rp"),X=J("y8nQ"),ee=J("Vl3Y"),ae=J("5NDa"),ye=J("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},he=function(ke){var ze=ke.callback,ut=ke.onCancel;function st(it){ze(it)}return g.a.createElement(ee.a,Object(c.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:st}),g.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},g.a.createElement(ye.a,null)),g.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},g.a.createElement(ye.a,null)),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(H.a,{type:"ghost",onClick:ut},"\u53D6\u6D88")))},fe=J("7ahc"),de=J("HmJG"),ne=J("BjJ7"),me=ee.a.useForm,$={width:280,marginRight:10},ie={labelCol:{span:5},wrapperCol:{span:19}},te=function(ke){var ze=ke.callback,ut=ke.onCancel,st=me(),it=Object(F.a)(st,1),_t=it[0];function bt(pt){ze(pt)}function Rt(pt,zt){if(pt.status===-1){N.b.error(pt.message);return}_t.setFieldsValue({src:"/api/attachments/".concat(pt.id),type:zt.type})}function Ot(pt){var zt=pt.target.files[0];Ce(zt,Rt)}return g.a.createElement(ee.a,Object(c.a)({form:_t},ie,{className:"upload-image-panel",onFinish:bt}),g.a.createElement(ee.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},g.a.createElement("div",{className:"flex-container"},g.a.createElement(ee.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},g.a.createElement(ye.a,{style:$})),g.a.createElement(Ee,{onFileChange:Ot}))),g.a.createElement(ee.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},g.a.createElement(ye.a,{style:{width:264}})),g.a.createElement(ee.a.Item,{style:{textAlign:"right"}},g.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(H.a,{type:"ghost",onClick:ut},"\u53D6\u6D88")))};function Ee(ke){var ze=ke.onFileChange;return g.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",g.a.createElement("input",{type:"file",onChange:ze}))}function Ce(ke,ze){if(!ke)throw new String("\u6CA1\u6709\u6587\u4EF6");var ut=new FormData;ut.append("editormd-image-file",ke),ut.append("file_param_name","editormd-image-file"),ut.append("byxhr","true");var st=new window.XMLHttpRequest;st.withCredentials=!0,st.addEventListener("load",function(it){ze(JSON.parse(it.target.responseText),ke)},!1),st.addEventListener("error",function(it){console.error(it)},!1),st.open("POST","".concat(ne.a,"/api/attachments.json")),st.send(ut)}var ve=J("giR+"),we=J("fyUT"),Ae=J("7Kak"),De=J("9yH6"),Ie=De.a.Group,Le={margin:"0 8px"},Oe=function(ke){var ze=ke.callback,ut=ke.onCancel;function st(it){ze(it)}return g.a.createElement(ee.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:st},g.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},g.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),g.a.createElement("span",{style:Le},"\u884C\u6570"),g.a.createElement(ee.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},g.a.createElement(we.a,null)),g.a.createElement("span",{style:Le},"\u5217\u6570"),g.a.createElement(ee.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},g.a.createElement(we.a,null))),g.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},g.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),g.a.createElement(ee.a.Item,{name:"align"},g.a.createElement(Ie,null,g.a.createElement(De.a,{value:"default"},g.a.createElement("i",{className:"fa fa-align-justify"})),g.a.createElement(De.a,{value:"left"},g.a.createElement("i",{className:"fa fa-align-left"})),g.a.createElement(De.a,{value:"center"},g.a.createElement("i",{className:"fa fa-align-center"})),g.a.createElement(De.a,{value:"right"},g.a.createElement("i",{className:"fa fa-align-right"}))))),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(H.a,{type:"ghost",onClick:ut},"\u53D6\u6D88")))},Xe=J("ErOA"),Ze=J("7Cbv"),Be="link",je="upload-image",rt="code-block",Ye="add-table",qe="------------",Te={default:qe,left:":".concat(qe),center:":".concat(qe,":"),right:"".concat(qe,":")},$e=J("9VGf"),Ge,_e;function Ue(){}var ge=0,se=1e4,ce="\u2581",Q=`
|
|
**\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 q(ke){return/^\d+$/.test(ke)?"".concat(ke,"px"):ke}var re=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=re?"Cmd":"Ctrl",Se=["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"],Re=(Ge={},Object(I.a)(Ge,le+"-B","bold"),Object(I.a)(Ge,le+"-I","italic"),Ge),Pe=(_e={},Object(I.a)(_e,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(_e,rt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(_e,je,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(_e,Ye,"\u6DFB\u52A0\u8868\u683C"),_e),Ve=We.a=function(ke){var ze=ke.defaultValue,ut=ze===void 0?"":ze,st=ke.onChange,it=ke.width,_t=it===void 0?"100%":it,bt=ke.height,Rt=bt===void 0?400:bt,Ot=ke.miniToolbar,pt=Ot===void 0?!1:Ot,zt=ke.isFocus,xr=zt===void 0?!1:zt,or=ke.watch,Ir=ke.insertTemp,cr=ke.mode,yn=cr===void 0?"markdown":cr,Tr=ke.id,Ur=Tr===void 0?"markdown-editor-id":Tr,Kn=ke.showResizeBar,kt=Kn===void 0?!1:Kn,ot=ke.noStorage,Lr=ot===void 0?!1:ot,bn=ke.showNullButton,fr=bn===void 0?!1:bn,Tt=ke.hidetoolBar,Dr=Tt===void 0?!1:Tt,Nr=ke.fullScreen,Fr=Nr===void 0?!1:Nr,Fe=ke.onBlur,ft=ke.onCMBeforeChange,qr=ke.onFullScreen,En=ke.className,xn=En===void 0?"":En,en=ke.disablePaste,_i=en===void 0?!1:en,ht=ke.placeholder,ia=ht===void 0?"":ht,Gn=ke.values,Br=Gn===void 0?"":Gn,hr=Object(h.useState)(null),zn=Object(F.a)(hr,2),He=zn[0],tn=zn[1],Vn=Object(h.useState)(ut),Xn=Object(F.a)(Vn,2),jr=Xn[0],Wr=Xn[1],Ai=Object(h.useState)(or),Yn=Object(F.a)(Ai,2),Sr=Yn[0],Li=Yn[1],aa=Object(h.useState)(Fr),$n=Object(F.a)(aa,2),Vt=$n[0],Di=$n[1],oa=Object(h.useState)(""),rn=Object(F.a)(oa,2),mr=rn[0],Hr=rn[1],sa=Object(h.useState)(0),Oi=Object(F.a)(sa,2),nn=Oi[0],an=Oi[1],Ri=Object(h.useState)(Rt),Pi=Object(F.a)(Ri,2),Qn=Pi[0],Jn=Pi[1],Tn=Object(h.useState)(!1),on=Object(F.a)(Tn,2),Mi=on[0],Sn=on[1],Zn=Object(h.useRef)(Object(Ze.a)()),sn=Object(h.useRef)(!1),ki=Object(h.useRef)(),Or=Object(h.useRef)(),$t=Object(h.useRef)(),wn=Object(h.useRef)(),Cn=Object(h.useRef)(),qn=function(){var at=Object(O.a)(S.a.mark(function mt(){var dt,yt;return S.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(Xe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Zn.current}});case 2:yt=At.sent,yt!=null&&(dt=yt.attachments)!==null&&dt!==void 0&&dt.length&&(console.log("cm:",He,Or),yt.attachments.map(function(Et){Et.content_type.indexOf("image")>-1?He.replaceSelection(".concat(Et.content_type,")")):Et.content_type.indexOf("video")>-1?He.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Et.content_type.indexOf("pdf")>-1?He.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(Et.id,"?type=").concat(Et.content_type,'&disposition=inline" target="_blank">').concat(Et.name,"</a>")):He.replaceSelection("[".concat(Et.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(Et.id,"?type=").concat(Et.content_type,")"))}));case 4:case"end":return At.stop()}},mt)}));return function(){return at.apply(this,arguments)}}();Object(h.useEffect)(function(){Wr(Br),He==null||He.setValue(Br)},[Br]),Object(h.useEffect)(function(){qr==null||qr(Vt)},[Vt]),Object(h.useEffect)(function(){if(Or.current){var at=w.a.fromTextArea(Or.current,{mode:yn,lineNumbers:!pt,lineWrapping:!0,value:ut,autoCloseTags:!0,autoCloseBrackets:!0});xr&&at.focus();function mt(dt,yt){if(_i){yt.preventDefault();return}var xt=yt.clipboardData;if(xt){var At=xt.types.toString(),Et=xt.items;if(At==="Files"||xt.types.indexOf("Files")>-1){if(yt.preventDefault(),yn=="stex")return;try{var Nt,Xt=Et[1];((Nt=Et[0])===null||Nt===void 0?void 0:Nt.kind)==="file"&&(Xt=Et[0]);var gt=Xt.getAsFile(),Rr=gt.name.split(".").pop();Ce(gt,function(wt){if(wt.id){var pr,Zt,Lt;(gt==null||((pr=gt.type)===null||pr===void 0)?void 0:pr.indexOf("image"))>-1?at.replaceSelection(".concat(wt.content_type,")")):(gt==null||((Zt=gt.type)===null||Zt===void 0)?void 0:Zt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,'"></video>')):(gt==null||((Lt=gt.type)===null||Lt===void 0)?void 0:Lt.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,"?type=").concat(gt.type,'&disposition=inline" target="_blank">').concat(gt.name,"</a>")):Se.includes(Rr)?at.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,'?type=office&disposition=inline" target="_blank">').concat(gt.name,"</a>")):at.replaceSelection("[".concat(gt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,"?type=").concat(wt.content_type,")"))}else(wt==null?void 0:wt.status)===401&&(document.location.href="/user/login")})}catch(wt){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",mt),at.on("dragleave",function(dt,yt){$t.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(dt,yt){$t.current.classList.add("mouse-hover-md")}),at.on("drop",function(dt,yt){$t.current.classList.add("mouse-hover-md");var xt;if(xt=yt.dataTransfer.files,xt.length>0){yt.preventDefault(),yt.stopPropagation();for(var At=function(Xt){var gt=xt[Xt],Rr=gt.name.split(".").pop();Ce(gt,function(wt){if(wt.id){var pr,Zt,Lt;(gt==null||((pr=gt.type)===null||pr===void 0)?void 0:pr.indexOf("image"))>-1?at.replaceSelection(".concat(wt.content_type,")")):(gt==null||((Zt=gt.type)===null||Zt===void 0)?void 0:Zt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,'"></video>')):(gt==null||((Lt=gt.type)===null||Lt===void 0)?void 0:Lt.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,"?type=").concat(gt.type,'&disposition=inline" target="_blank">').concat(gt.name,"</a>")):Se.includes(Rr)?at.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,'?type=office&disposition=inline" target="_blank">').concat(gt.name,"</a>")):at.replaceSelection("[".concat(gt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(wt.id,"?type=").concat(wt.content_type,")"))}else(wt==null?void 0:wt.status)===401&&(document.location.href="/user/login")})},Et=0;Et<xt.length;Et++)At(Et)}}),tn(at),function(){at.off("paste",mt)}}},[]);var ei=Object(h.useCallback)(function(){if($t.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[Qn,$t,Vt]);Object(h.useEffect)(function(){function at(){var dt=new E.default(function(yt){var xt=Object(L.a)(yt),At;try{for(xt.s();!(At=xt.n()).done;){var Et=At.value;(Et.target.offsetHeight>0||Et.target.offsetWidth>0)&&(ei(),He.setSize("100%","100%"),He.refresh())}}catch(Nt){xt.e(Nt)}finally{xt.f()}});return dt.observe(Or.current.parentElement),dt}if(He){var mt=at();return function(){mt.unobserve(Or.current.parentElement)}}},[He,ei]),Object(h.useEffect)(function(){if(He){for(var at=[],mt=function(){var Et=yt[dt];xt=Object(F.a)(Et,2);var Nt=xt[0],Xt=xt[1],gt=Object(I.a)({},Nt,function(){gr(Xt)});at.push(gt),He.addKeyMap(gt)},dt=0,yt=Object.entries(Re);dt<yt.length;dt++){var xt;mt()}return ki.current=setInterval(function(){sn.current&&qn()},4e3),function(){clearInterval(ki.current);var At=Object(L.a)(at),Et;try{for(At.s();!(Et=At.n()).done;){var Nt=Et.value;He.removeKeyMap(Nt)}}catch(Xt){At.e(Xt)}finally{At.f()}}}},[He]),Object(h.useEffect)(function(){Fr!==Vt&&Di(Fr)},[Fr]),Object($e.a)(function(){if(!Lr&&nn>0){var at=new Date().getTime(),mt=window.sessionStorage.getItem(Ur);at>=nn+se&&(!mt||mt!==jr)&&(window.sessionStorage.setItem(Ur,jr),Sn(!0))}},se),Object(h.useEffect)(function(){Li(or)},[He,or]),Object(h.useEffect)(function(){He&&(xr&&He.focus())},[He,xr]),Object(h.useEffect)(function(){if(Sr&&He){var at=He.getScrollerElement();function mt(dt){var yt=dt.target;if(Cn.current){var xt=yt.scrollTop/yt.scrollHeight;Cn.current.scrollTop=Cn.current.scrollHeight*xt}}return at.addEventListener("scroll",mt),function(){at.removeEventListener("scroll",mt)}}},[He,Sr]),Object(h.useEffect)(function(){if(He&&ft){function at(mt,dt){ft(mt,dt)}return He.on("beforeChange",at),function(){He.off("beforeChange",at)}}},[He,ft]),Object(h.useEffect)(function(){if(He&&Fe){function at(){Fe(He.getValue())}return He.on("blur",at),function(){He.off("blur",at)}}},[He,Fe]),Object(h.useEffect)(function(){if(He){function at(mt){var dt=mt.getValue();Wr(dt),an(new Date().getTime()),mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),st&&st(dt)}return He.on("change",at),function(){He.off("change",at)}}},[He,st]),Object(h.useEffect)(function(){He&&(ut==null?(He.setValue(""),Wr("")):ut!==He.getValue()&&(He.setValue(ut),Wr(ut),He.setCursor(He.lineCount(),0)))},[He,ut]);var gr=Object(h.useCallback)(function(at){var mt=He.getCursor(),dt=He.getSelection(),yt=dt.split(`
|
|
`);switch(at){case"bold":return He.replaceSelection("**"+dt+"**"),dt===""&&He.setCursor(mt.line,mt.ch+2),He.focus();case"italic":return He.replaceSelection("*"+dt+"*"),dt===""&&He.setCursor(mt.line,mt.ch+1),He.focus();case"code":return He.replaceSelection("`"+dt+"`"),dt===""&&He.setCursor(mt.line,mt.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+dt+"$$`"),dt===""&&He.setCursor(mt.line,mt.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+dt+"\n```"),He.setCursor(mt.line+1,dt.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
|
|
`),He.focus();case"list-ul":return dt===""?He.replaceSelection("- "+dt):He.replaceSelection(yt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),He.focus();case"list-ol":return dt===""?He.replaceSelection("1. "+dt):He.replaceSelection(yt.map(function(xt,At){return xt===""?"":"".concat(At+1,". ").concat(xt)}).join(`
|
|
`)),He.focus();case"add-null-ch":return dt===""&&He.setCursor(mt.line,mt.ch+1),He.replaceSelection(ce),He.focus();case"inster-template-1":return dt===""&&He.setCursor(mt.line,mt.ch),He.replaceSelection(Q),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return Li(!Sr),He.focus();case"trigger-full-screen":return Di(!Vt),He.focus();case Be:Hr(Be);return;case rt:Hr(rt);return;case je:Hr(je);return;case Ye:Hr(Ye);return;default:throw new Error}},[He,Sr,Vt]),Kr=Object(h.useCallback)(function(at){Hr("");switch(mr){case Be:var mt=at.title,dt=at.link;return He.replaceSelection("[".concat(mt,"](").concat(dt,")")),He.focus();case rt:var yt=at.language,xt=at.content;return He.replaceSelection(["```"+yt,xt,"```"].join(`
|
|
`)),He.focus();case je:var At=at.src,Et=at.alt;return Et?He.replaceSelection(".concat(At,' "').concat(Et,'" )')):He.replaceSelection("")),He.focus();case Ye:for(var Nt=at.row,Xt=at.col,gt=at.align,Rr=`
|
|
`,wt=0;wt<Nt;wt++){for(var pr=[],Zt=[],Lt=0;Lt<Xt;Lt++)wt===1&&Zt.push(Te[gt]),pr.push(" ");wt===1&&(Rr+="| ".concat(Zt.join(" | "),` |
|
|
`)),Rr+="| ".concat(pr.join(Xt===1?"":" | "),` |
|
|
`)}return He.replaceSelection(Rr+`
|
|
`),He.focus();default:throw new Error}},[He,mr]),vr=Object(h.useMemo)(function(){switch(mr){case Be:return g.a.createElement(he,{callback:Kr,onCancel:wr});case rt:return g.a.createElement(fe.b,{callback:Kr,onCancel:wr});case je:return g.a.createElement(te,{callback:Kr,onCancel:wr});case Ye:return g.a.createElement(Oe,{callback:Kr,onCancel:wr});default:return null}},[mr]);function wr(){Hr("")}Object(h.useEffect)(function(){if(wn.current){var at=wn.current,mt=!1,dt=0;function yt(Et){mt=!0,dt=Et.pageY}function xt(){mt=!1}function At(Et){if(mt){var Nt=Et.pageY-dt;Nt<0&&(Nt=0),Nt>300&&(Nt=300);var Xt=Rt+Nt+"px";Jn(Xt)}}return at.addEventListener("mousedown",yt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",xt),function(){at.removeEventListener("mousedown",yt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",xt)}}},[He,wn]),Object(h.useEffect)(function(){Jn(Rt)},[Rt]);var ti=q(_t),Gr=q(Qn),la={width:ti,height:Gr},Xa=Object(h.useMemo)(function(){if(nn){var at=new Date(nn),mt=at.getHours(),dt=at.getMinutes(),yt=at.getSeconds();return mt=mt<10?"0"+mt:mt,dt=dt<10?"0"+dt:dt,yt=yt<10?"0"+yt:yt,"".concat(mt,":").concat(dt,":").concat(yt)}return 0},[nn]);function Ya(){window.sessionStorage.removeItem(Ur),Sn(!1),an(0)}function $a(){Sn(!1),an(0),He.setValue(window.sessionStorage.getItem(Ur))}function Ii(at,mt){var dt=He.getValue();dt=dt.replace(at,mt),Wr(dt),He==null||He.setValue(dt)}return g.a.createElement(h.Fragment,null,g.a.createElement("div",{className:"markdown-editor-wrapper",ref:$t},g.a.createElement("div",{className:"markdown-editor-container ".concat(xn," ").concat(Sr?"on-preview":""," ").concat(pt?"mini":""," ").concat(Vt?"full-screen":""),style:la},g.a.createElement(W,{insertTemp:Ir,watch:Sr,fullScreen:Vt,showNullButton:fr,onActionCallback:gr,hidetoolBar:Dr,uuid:Zn.current,setOpenPhones:function(){sn.current=!0}}),g.a.createElement("div",{className:"markdown-editor-body"},g.a.createElement("div",{className:"codemirror-container"},g.a.createElement("textarea",{ref:Or,placeholder:ia})),Sr?g.a.createElement("div",{ref:Cn,className:"preview-container"},yn==="stex"&&g.a.createElement(A,{value:jr}),yn!=="stex"&&g.a.createElement(f.a,{edit:!0,value:jr,replaces:Ii})):null))),kt?g.a.createElement("a",{ref:wn,className:"editor-resize"}):null,g.a.createElement(M.a,null,Pe[mr]?g.a.createElement(G.a,{centered:!0,title:Pe[mr],visible:!0,onCancel:wr,footer:null,className:"markdown-popup-form"},vr):null))}},SJMd:function(et,We){/**
|
|
* @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 J,Z,G,L=!1,K,N;window.PR_SHOULD_USE_CONTINUATION=!0;var O,F;(function(){var I=window,R=["break,continue,do,else,for,if,return,while"],S=[R,"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"],h=[S,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],g=[h,"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"],P=[h,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[h,"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"],E="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",v=[h,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[R,"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"],s=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],_=[g,w,P,v,d,a,l,s],b=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",A="kwd",T="com",m="typ",c="lit",u="pun",o="pln",x="tag",y="dec",p="src",D="atn",U="atv",B="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(ve){for(var we=0,Ae=!1,De=!1,Ie=0,Le=ve.length;Ie<Le;++Ie){var Oe=ve[Ie];if(Oe.ignoreCase)De=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ae=!0,De=!1;break}}var Xe={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(qe){var Te=qe.charCodeAt(0);if(Te!==92)return Te;var $e=qe.charAt(1);return Te=Xe[$e],Te||("0"<=$e&&$e<="7"?parseInt(qe.substring(1),8):$e==="u"||$e==="x"?parseInt(qe.substring(2),16):qe.charCodeAt(1))}function Be(qe){if(qe<32)return(qe<16?"\\x0":"\\x")+qe.toString(16);var Te=String.fromCharCode(qe);return Te==="\\"||Te==="-"||Te==="]"||Te==="^"?"\\"+Te:Te}function je(qe){var Te=qe.substring(1,qe.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=[],Ge=Te[0]==="^",_e=["["];Ge&&_e.push("^");for(var Ue=Ge?1:0,ge=Te.length;Ue<ge;++Ue){var se=Te[Ue];if(/\\[bdsw]/i.test(se))_e.push(se);else{var ce=Ze(se),Q;Ue+2<ge&&Te[Ue+1]==="-"?(Q=Ze(Te[Ue+2]),Ue+=2):Q=ce,$e.push([ce,Q]),Q<65||ce>122||(Q<65||ce>90||$e.push([Math.max(65,ce)|32,Math.min(Q,90)|32]),Q<97||ce>122||$e.push([Math.max(97,ce)&~32,Math.min(Q,122)&~32]))}}$e.sort(function(Se,Re){return Se[0]-Re[0]||Re[1]-Se[1]});for(var q=[],re=[],Ue=0;Ue<$e.length;++Ue){var le=$e[Ue];le[0]<=re[1]+1?re[1]=Math.max(re[1],le[1]):q.push(re=le)}for(var Ue=0;Ue<q.length;++Ue){var le=q[Ue];_e.push(Be(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&_e.push("-"),_e.push(Be(le[1])))}return _e.push("]"),_e.join("")}function rt(qe){for(var Te=qe.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=Te.length,Ge=[],_e=0,Ue=0;_e<$e;++_e){var ge=Te[_e];if(ge==="(")++Ue;else if(ge.charAt(0)==="\\"){var se=+ge.substring(1);se&&(se<=Ue?Ge[se]=-1:Te[_e]=Be(se))}}for(var _e=1;_e<Ge.length;++_e)Ge[_e]===-1&&(Ge[_e]=++we);for(var _e=0,Ue=0;_e<$e;++_e){var ge=Te[_e];if(ge==="(")++Ue,Ge[Ue]||(Te[_e]="(?:");else if(ge.charAt(0)==="\\"){var se=+ge.substring(1);se&&se<=Ue&&(Te[_e]="\\"+Ge[se])}}for(var _e=0;_e<$e;++_e)Te[_e]==="^"&&Te[_e+1]!=="^"&&(Te[_e]="");if(qe.ignoreCase&&Ae)for(var _e=0;_e<$e;++_e){var ge=Te[_e],ce=ge.charAt(0);ge.length>=2&&ce==="["?Te[_e]=je(ge):ce!=="\\"&&(Te[_e]=ge.replace(/[a-zA-Z]/g,function(re){var le=re.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Te.join("")}for(var Ye=[],Ie=0,Le=ve.length;Ie<Le;++Ie){var Oe=ve[Ie];if(Oe.global||Oe.multiline)throw new Error(""+Oe);Ye.push("(?:"+rt(Oe)+")")}return new RegExp(Ye.join("|"),De?"gi":"g")}function k(ve,we){var Ae=/(?:^|\s)nocode(?:\s|$)/,De=[],Ie=0,Le=[],Oe=0;function Xe(Ze){var Be=Ze.nodeType;if(Be==1){if(Ae.test(Ze.className))return;for(var je=Ze.firstChild;je;je=je.nextSibling)Xe(je);var rt=Ze.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(De[Oe]=`
|
|
`,Le[Oe<<1]=Ie++,Le[Oe++<<1|1]=Ze)}else if(Be==3||Be==4){var Ye=Ze.nodeValue;Ye.length&&(we?Ye=Ye.replace(/\r\n?/g,`
|
|
`):Ye=Ye.replace(/[ \t\r\n]+/g," "),De[Oe]=Ye,Le[Oe<<1]=Ie,Ie+=Ye.length,Le[Oe++<<1|1]=Ze)}}return Xe(ve),{sourceCode:De.join("").replace(/\n$/,""),spans:Le}}function H(ve,we,Ae,De,Ie){if(!Ae)return;var Le={sourceNode:ve,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:we,decorations:null};De(Le),Ie.push.apply(Ie,Le.decorations)}var X=/\S/;function ee(ve){for(var we=void 0,Ae=ve.firstChild;Ae;Ae=Ae.nextSibling){var De=Ae.nodeType;we=De===1?we?ve:Ae:De===3&&X.test(Ae.nodeValue)?ve:we}return we===ve?void 0:we}function ae(ve,we){var Ae={},De;(function(){for(var Oe=ve.concat(we),Xe=[],Ze={},Be=0,je=Oe.length;Be<je;++Be){var rt=Oe[Be],Ye=rt[3];if(Ye)for(var qe=Ye.length;--qe>=0;)Ae[Ye.charAt(qe)]=rt;var Te=rt[1],$e=""+Te;Ze.hasOwnProperty($e)||(Xe.push(Te),Ze[$e]=null)}Xe.push(/[\0-\uffff]/),De=M(Xe)})();var Ie=we.length,Le=function(Oe){for(var Xe=Oe.sourceCode,Ze=Oe.basePos,Be=Oe.sourceNode,je=[Ze,o],rt=0,Ye=Xe.match(De)||[],qe={},Te=0,$e=Ye.length;Te<$e;++Te){var Ge=Ye[Te],_e=qe[Ge],Ue=void 0,ge;if(typeof _e=="string")ge=!1;else{var se=Ae[Ge.charAt(0)];if(se)Ue=Ge.match(se[1]),_e=se[0];else{for(var ce=0;ce<Ie;++ce)if(se=we[ce],Ue=Ge.match(se[1]),Ue){_e=se[0];break}Ue||(_e=o)}ge=_e.length>=5&&_e.substring(0,5)==="lang-",ge&&!(Ue&&typeof Ue[1]=="string")&&(ge=!1,_e=p),ge||(qe[Ge]=_e)}var Q=rt;if(rt+=Ge.length,!ge)je.push(Ze+Q,_e);else{var q=Ue[1],re=Ge.indexOf(q),le=re+q.length;Ue[2]&&(le=Ge.length-Ue[2].length,re=le-q.length);var Se=_e.substring(5);H(Be,Ze+Q,Ge.substring(0,re),Le,je),H(Be,Ze+Q+re,q,me(Se,q),je),H(Be,Ze+Q+le,Ge.substring(le),Le,je)}}Oe.decorations=je};return Le}function ye(ve){var we=[],Ae=[];ve.tripleQuotedStrings?we.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?we.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&Ae.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var De=ve.hashComments;De&&(ve.cStyleComments?(De>1?we.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ae.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([T,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(Ae.push([T,/^\/\/[^\r\n]*/,null]),Ae.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=ve.regexLiterals;if(Ie){var Le=Ie>1?"":`
|
|
\r`,Oe=Le?".":"[\\S\\s]",Xe="/(?=[^/*"+Le+"])(?:[^/\\x5B\\x5C"+Le+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+Le+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";Ae.push(["lang-regex",RegExp("^"+W+"("+Xe+")")])}var Ze=ve.types;Ze&&Ae.push([m,Ze]);var Be=(""+ve.keywords).replace(/^ | $/g,"");Be.length&&Ae.push([A,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(je+="(?!s*/)"),Ae.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[u,new RegExp(je),null]),ae(we,Ae)}var pe=ye({keywords:_,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(ve,we,Ae){for(var De=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Le=ve.ownerDocument,Oe=Le.createElement("li");ve.firstChild;)Oe.appendChild(ve.firstChild);var Xe=[Oe];function Ze(Te){var $e=Te.nodeType;if($e==1&&!De.test(Te.className))if(Te.nodeName==="br")Be(Te),Te.parentNode&&Te.parentNode.removeChild(Te);else for(var Ge=Te.firstChild;Ge;Ge=Ge.nextSibling)Ze(Ge);else if(($e==3||$e==4)&&Ae){var _e=Te.nodeValue,Ue=_e.match(Ie);if(Ue){var ge=_e.substring(0,Ue.index);Te.nodeValue=ge;var se=_e.substring(Ue.index+Ue[0].length);if(se){var ce=Te.parentNode;ce.insertBefore(Le.createTextNode(se),Te.nextSibling)}Be(Te),ge||Te.parentNode.removeChild(Te)}}}function Be(Te){for(;!Te.nextSibling;)if(Te=Te.parentNode,!Te)return;function $e(Ue,ge){var se=ge?Ue.cloneNode(!1):Ue,ce=Ue.parentNode;if(ce){var Q=$e(ce,1),q=Ue.nextSibling;Q.appendChild(se);for(var re=q;re;re=q)q=re.nextSibling,Q.appendChild(re)}return se}for(var Ge=$e(Te.nextSibling,0),_e;(_e=Ge.parentNode)&&_e.nodeType===1;)Ge=_e;Xe.push(Ge)}for(var je=0;je<Xe.length;++je)Ze(Xe[je]);we===(we|0)&&Xe[0].setAttribute("value",we);var rt=Le.createElement("ol");rt.className="linenums";for(var Ye=Math.max(0,we-1|0)||0,je=0,qe=Xe.length;je<qe;++je)Oe=Xe[je],Oe.className="L"+(je+Ye)%10,Oe.firstChild||Oe.appendChild(Le.createTextNode("\xA0")),rt.appendChild(Oe);ve.appendChild(rt)}function fe(ve){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Ae=/\n/g,De=ve.sourceCode,Ie=De.length,Le=0,Oe=ve.spans,Xe=Oe.length,Ze=0,Be=ve.decorations,je=Be.length,rt=0;Be[je]=Ie;var Ye,qe;for(qe=Ye=0;qe<je;)Be[qe]!==Be[qe+2]?(Be[Ye++]=Be[qe++],Be[Ye++]=Be[qe++]):qe+=2;for(je=Ye,qe=Ye=0;qe<je;){for(var Te=Be[qe],$e=Be[qe+1],Ge=qe+2;Ge+2<=je&&Be[Ge+1]===$e;)Ge+=2;Be[Ye++]=Te,Be[Ye++]=$e,qe=Ge}je=Be.length=Ye;var _e=ve.sourceNode,Ue="";_e&&(Ue=_e.style.display,_e.style.display="none");try{for(var ge=null;Ze<Xe;){var se=Oe[Ze],ce=Oe[Ze+2]||Ie,Q=Be[rt+2]||Ie,Ge=Math.min(ce,Q),q=Oe[Ze+1],re;if(q.nodeType!==1&&(re=De.substring(Le,Ge))){we&&(re=re.replace(Ae,"\r")),q.nodeValue=re;var le=q.ownerDocument,Se=le.createElement("span");Se.className=Be[rt+1];var Re=q.parentNode;Re.replaceChild(Se,q),Se.appendChild(q),Le<ce&&(Oe[Ze+1]=q=le.createTextNode(De.substring(Ge,ce)),Re.insertBefore(q,Se.nextSibling))}Le=Ge,Le>=ce&&(Ze+=2),Le>=Q&&(rt+=2)}}finally{_e&&(_e.style.display=Ue)}}var de={};function ne(ve,we){for(var Ae=we.length;--Ae>=0;){var De=we[Ae];de.hasOwnProperty(De)?I.console&&console.warn("cannot override language handler %s",De):de[De]=ve}}function me(ve,we){return ve&&de.hasOwnProperty(ve)||(ve=/^\s*</.test(we)?"default-markup":"default-code"),de[ve]}ne(pe,["default-code"]),ne(ae([],[[o,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\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"]),ne(ae([[o,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!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"]),ne(ae([],[[U,/^[\s\S]+/]]),["uq.val"]),ne(ye({keywords:g,hashComments:!0,cStyleComments:!0,types:b}),["c","cc","cpp","cxx","cyc","m"]),ne(ye({keywords:"null,true,false"}),["json"]),ne(ye({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:b}),["cs"]),ne(ye({keywords:P,cStyleComments:!0}),["java"]),ne(ye({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(ye({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(ye({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(ye({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(ye({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(ye({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(ae([],[[f,/^[\s\S]+/]]),["regex"]);function $(ve){var we=ve.langExtension;try{var Ae=k(ve.sourceNode,ve.pre),De=Ae.sourceCode;ve.sourceCode=De,ve.spans=Ae.spans,ve.basePos=0,me(we,De)(ve),fe(ve)}catch(Ie){I.console&&console.log(Ie&&Ie.stack||Ie)}}function ie(ve,we,Ae){var De=Ae||!1,Ie=we||null,Le=document.createElement("div");Le.innerHTML="<pre>"+ve+"</pre>",Le=Le.firstChild,De&&he(Le,De,!0);var Oe={langExtension:Ie,numberLines:De,sourceNode:Le,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Oe),Le.innerHTML}function te(ve,we){var Ae=we||document.body,De=Ae.ownerDocument||document;function Ie(se){return Ae.getElementsByTagName(se)}for(var Le=[Ie("pre"),Ie("code"),Ie("xmp")],Oe=[],Xe=0;Xe<Le.length;++Xe)for(var Ze=0,Be=Le[Xe].length;Ze<Be;++Ze)Oe.push(Le[Xe][Ze]);Le=null;var je=Date;je.now||(je={now:function(){return+new Date}});var rt=0,Ye=/\blang(?:uage)?-([\w.]+)(?!\S)/,qe=/\bprettyprint\b/,Te=/\bprettyprinted\b/,$e=/pre|xmp/i,Ge=/^code$/i,_e=/^(?:pre|code|xmp)$/i,Ue={};function ge(){for(var se=I.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;rt<Oe.length&&je.now()<se;rt++){for(var ce=Oe[rt],Q=Ue,q=ce;q=q.previousSibling;){var re=q.nodeType,le=(re===7||re===8)&&q.nodeValue;if(le?!/^\??prettify\b/.test(le):re!==3||/\S/.test(q.nodeValue))break;if(le){Q={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ot,pt,zt){Q[pt]=zt});break}}var Se=ce.className;if((Q!==Ue||qe.test(Se))&&!Te.test(Se)){for(var Re=!1,Pe=ce.parentNode;Pe;Pe=Pe.parentNode){var Ve=Pe.tagName;if(_e.test(Ve)&&Pe.className&&qe.test(Pe.className)){Re=!0;break}}if(!Re){ce.className+=" prettyprinted";var ke=Q.lang;if(!ke){ke=Se.match(Ye);var ze;!ke&&(ze=ee(ce))&&Ge.test(ze.tagName)&&(ke=ze.className.match(Ye)),ke&&(ke=ke[1])}var ut;if($e.test(ce.tagName))ut=1;else{var st=ce.currentStyle,it=De.defaultView,_t=st?st.whiteSpace:it&&it.getComputedStyle?it.getComputedStyle(ce,null).getPropertyValue("white-space"):0;ut=_t&&_t.substring(0,3)==="pre"}var bt=Q.linenums;(bt=bt==="true"||+bt)||(bt=Se.match(/\blinenums\b(?::(\d+))?/),bt=bt?bt[1]&&bt[1].length?+bt[1]:!0:!1),bt&&he(ce,bt,ut);var Rt={langExtension:ke,sourceNode:ce,numberLines:bt,pre:ut,sourceCode:null,basePos:null,spans:null,decorations:null};$(Rt)}}}rt<Oe.length?I.setTimeout(ge,250):typeof ve=="function"&&ve()}ge()}var Ee=I.PR={createSimpleLexer:ae,registerLangHandler:ne,sourceDecorator:ye,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:U,PR_COMMENT:T,PR_DECLARATION:y,PR_KEYWORD:A,PR_LITERAL:c,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:u,PR_SOURCE:p,PR_STRING:f,PR_TAG:x,PR_TYPE:m,prettyPrintOne:L?I.prettyPrintOne=ie:O=ie,prettyPrint:F=L?I.prettyPrint=te:F=te},Ce=I.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(et,We,J){(function(Z,G){et.exports=G()})(this,function(){"use strict";var Z=navigator.userAgent,G=navigator.platform,L=/gecko\/\d/i.test(Z),K=/MSIE \d/.test(Z),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Z),O=/Edge\/(\d+)/.exec(Z),F=K||N||O,I=F&&(K?document.documentMode||6:+(O||N)[1]),R=!O&&/WebKit\//.test(Z),S=R&&/Qt\/\d+\.\d+/.test(Z),h=!O&&/Chrome\//.test(Z),g=/Opera\//.test(Z),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Z),E=/PhantomJS/.test(Z),v=!O&&/AppleWebKit/.test(Z)&&/Mobile\/\w+/.test(Z),d=/Android/.test(Z),a=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Z),l=v||/Mac/.test(G),s=/\bCrOS\b/.test(Z),_=/win/i.test(G),b=g&&Z.match(/Version\/(\d*\.\d*)/);b&&(b=Number(b[1])),b&&b>=15&&(g=!1,R=!0);var f=l&&(S||g&&(b==null||b<12.11)),A=L||F&&I>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var n=e.className,r=T(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 o(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 C=0;C<t.length;++C)i.appendChild(t[C]);return i}function x(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=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 p(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 D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:F&&(W=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function k(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 C=r||0,j=i||0;;){var z=e.indexOf(" ",C);if(z<0||z>=t)return j+(t-C);j+=z-C,j+=n-j%n,C=z+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=M(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 ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ae=50,ye={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},he={origin:"*mouse"},fe={origin:"+move"};function de(e,t,n){for(var r=0,i=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var j=C-r;if(C==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=C-r,i+=n-i%n,r=C+1,i>=t)return r}}var ne=[""];function me(e){for(;ne.length<=e;)ne.push($(ne)+" ");return ne[e]}function $(e){return e[e.length-1]}function ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function te(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&k(t,n),n}var ve=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ve.test(e))}function Ae(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function De(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\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 Le(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Oe(e,t,n){for(;(n<0?t>0:t<e.length)&&Le(e.charAt(t));)t+=n;return t}function Xe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,C=r<0?Math.ceil(i):Math.floor(i);if(C==t)return e(C)?t:n;e(C)?n=C:t=C+r}}function Ze(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,C=0;C<e.length;++C){var j=e[C];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",C),i=!0)}i||r(t,n,"ltr")}var Be=null;function je(e,t,n){var r;Be=null;for(var i=0;i<e.length;++i){var C=e[i];if(C.from<t&&C.to>t)return i;C.to==t&&(C.from!=C.to&&n=="before"?r=i:Be=i),C.from==t&&(C.from!=C.to&&n!="before"?r=i:Be=i)}return r!=null?r:Be}var rt=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]/,C=/[LRr]/,j=/[Lb1n]/,z=/[1n]/;function V(Y,oe,ue){this.level=Y,this.from=oe,this.to=ue}return function(Y,oe){var ue=oe=="ltr"?"L":"R";if(Y.length==0||oe=="ltr"&&!r.test(Y))return!1;for(var xe=Y.length,be=[],Me=0;Me<xe;++Me)be.push(n(Y.charCodeAt(Me)));for(var Ne=0,Ke=ue;Ne<xe;++Ne){var Qe=be[Ne];Qe=="m"?be[Ne]=Ke:Ke=Qe}for(var tt=0,Je=ue;tt<xe;++tt){var nt=be[tt];nt=="1"&&Je=="r"?be[tt]="n":C.test(nt)&&(Je=nt,nt=="r"&&(be[tt]="R"))}for(var ct=1,lt=be[0];ct<xe-1;++ct){var vt=be[ct];vt=="+"&<=="1"&&be[ct+1]=="1"?be[ct]="1":vt==","&<==be[ct+1]&&(lt=="1"||lt=="n")&&(be[ct]=lt),lt=vt}for(var Dt=0;Dt<xe;++Dt){var Kt=be[Dt];if(Kt==",")be[Dt]="N";else if(Kt=="%"){var Mt=void 0;for(Mt=Dt+1;Mt<xe&&be[Mt]=="%";++Mt);for(var lr=Dt&&be[Dt-1]=="!"||Mt<xe&&be[Mt]=="1"?"1":"N",nr=Dt;nr<Mt;++nr)be[nr]=lr;Dt=Mt-1}}for(var Ft=0,ir=ue;Ft<xe;++Ft){var Yt=be[Ft];ir=="L"&&Yt=="1"?be[Ft]="L":C.test(Yt)&&(ir=Yt)}for(var jt=0;jt<xe;++jt)if(i.test(be[jt])){var Bt=void 0;for(Bt=jt+1;Bt<xe&&i.test(be[Bt]);++Bt);for(var It=(jt?be[jt-1]:ue)=="L",ar=(Bt<xe?be[Bt]:ue)=="L",Wn=It==ar?It?"L":"R":ue,Zr=jt;Zr<Bt;++Zr)be[Zr]=Wn;jt=Bt-1}for(var Jt=[],Ar,Gt=0;Gt<xe;)if(j.test(be[Gt])){var za=Gt;for(++Gt;Gt<xe&&j.test(be[Gt]);++Gt);Jt.push(new V(0,za,Gt))}else{var kr=Gt,gn=Jt.length,vn=oe=="rtl"?1:0;for(++Gt;Gt<xe&&be[Gt]!="L";++Gt);for(var er=kr;er<Gt;)if(z.test(be[er])){kr<er&&(Jt.splice(gn,0,new V(1,kr,er)),gn+=vn);var Hn=er;for(++er;er<Gt&&z.test(be[er]);++er);Jt.splice(gn,0,new V(2,Hn,er)),gn+=vn,kr=er}else++er;kr<Gt&&Jt.splice(gn,0,new V(1,kr,Gt))}return oe=="ltr"&&(Jt[0].level==1&&(Ar=Y.match(/^\s+/))&&(Jt[0].from=Ar[0].length,Jt.unshift(new V(0,0,Ar[0].length))),$(Jt).level==1&&(Ar=Y.match(/\s+$/))&&($(Jt).to-=Ar[0].length,Jt.push(new V(0,xe-Ar[0].length,xe)))),oe=="rtl"?Jt.reverse():Jt}}();function Ye(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var qe=[],Te=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]||qe).concat(n)}};function $e(e,t){return e._handlers&&e._handlers[t]||qe}function Ge(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 C=ee(i,n);C>-1&&(r[t]=i.slice(0,C).concat(i.slice(C+1)))}}}function _e(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 Ue(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),_e(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ge(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)ee(n,t[r])==-1&&n.push(t[r])}function se(e,t){return $e(e,t).length>0}function ce(e){e.prototype.on=function(t,n){Te(this,t,n)},e.prototype.off=function(t,n){Ge(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){Q(e),q(e)}function Se(e){return e.target||e.srcElement}function Re(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Pe=function(){if(F&&I<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),Ve;function ke(e){if(Ve==null){var t=o("span","\u200B");u(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ve=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&I<8))}var n=Ve?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ze;function ut(e){if(ze!=null)return ze;var t=u(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:ze=r.right-n.right<3}var st=`
|
|
|
|
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 C=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=C.indexOf("\r");j!=-1?(n.push(C.slice(0,j)),t+=j+1):(n.push(C),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},it=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},_t=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function Rt(e){if(bt!=null)return bt;var t=u(e,o("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return bt=Math.abs(n.left-r.left)>1}var Ot={},pt={};function zt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ot[e]=t}function xr(e,t){pt[e]=t}function or(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=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return or("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return or("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ir(e,t){t=or(t);var n=Ot[t.name];if(!n)return Ir(e,"text/plain");var r=n(e,t);if(cr.hasOwnProperty(t.name)){var i=cr[t.name];for(var C in i){if(!i.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=i[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var cr={};function yn(e,t){var n=cr.hasOwnProperty(e)?cr[e]:cr[e]={};k(t,n)}function Tr(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 Ur(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 Kn(e,t,n){return e.startState?e.startState(t,n):!0}var kt=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};kt.prototype.eol=function(){return this.pos>=this.string.length},kt.prototype.sol=function(){return this.pos==this.lineStart},kt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},kt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},kt.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},kt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},kt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},kt.prototype.skipToEnd=function(){this.pos=this.string.length},kt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},kt.prototype.backUp=function(e){this.pos-=e},kt.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)},kt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},kt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},kt.prototype.current=function(){return this.string.slice(this.start,this.pos)},kt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},kt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},kt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ot(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],C=i.chunkSize();if(t<C){n=i;break}t-=C}return n.lines[t]}function Lr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(C){var j=C.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function bn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function fr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,n=ee(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 Dr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],C=i.height;if(t<C){e=i;continue e}t-=C,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var z=e.lines[j],V=z.height;if(t<V)break;t-=V}return n+j}function Nr(e,t){return t>=e.first&&t<e.first+e.size}function Fr(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 ft(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function En(e){return Fe(e.line,e.ch)}function xn(e,t){return ft(e,t)<0?t:e}function en(e,t){return ft(e,t)<0?e:t}function _i(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(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,ot(e,n).text.length):ia(t,ot(e,t.line).text.length)}function ia(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Gn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var Br=function(e,t){this.state=e,this.lookAhead=t},hr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};hr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},hr.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}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof Br?new hr(e,Tr(e.mode,t.state),n,t.lookAhead):new hr(e,Tr(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?Tr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Br(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],C={};Sr(e,t.text,e.doc.mode,n,function(Y,oe){return i.push(Y,oe)},C,r);for(var j=n.state,z=function(Y){n.baseTokens=i;var oe=e.state.overlays[Y],ue=1,xe=0;n.state=!0,Sr(e,t.text,oe.mode,n,function(be,Me){for(var Ne=ue;xe<be;){var Ke=i[ue];Ke>be&&i.splice(ue,1,be,i[ue+1],Ke),ue+=2,xe=Math.min(be,Ke)}if(!Me)return;if(oe.opaque)i.splice(Ne,ue-Ne,be,"overlay "+Me),ue=Ne+2;else for(;Ne<ue;Ne+=2){var Qe=i[Ne+1];i[Ne+1]=(Qe?Qe+" ":"")+"overlay "+Me}},C),n.state=j,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)z(V);return{styles:i,classes:C.bgClass||C.textClass?C:null}}function He(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=tn(e,Tt(t)),i=t.text.length>e.options.maxHighlightLength&&Tr(e.doc.mode,r.state),C=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=C.styles,C.classes?t.styleClasses=C.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 tn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var C=Li(e,t,n),j=C>r.first&&ot(r,C-1).stateAfter,z=j?hr.fromSaved(r,j,C):new hr(r,Kn(r.mode),C);return r.iter(C,t,function(V){Vn(e,V.text,z);var Y=z.line;V.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?z.save():null,z.nextLine()}),n&&(r.modeFrontier=z.line),z}function Vn(e,t,n,r){var i=e.doc.mode,C=new kt(t,e.options.tabSize,n);for(C.start=C.pos=r||0,t==""&&Xn(i,n.state);!C.eol();)jr(i,C,n.state),C.start=C.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Ur(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function jr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ur(e,n).mode);var C=e.token(t,n);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var Wr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ai(e,t,n,r){var i=e.doc,C=i.mode,j;t=ht(i,t);var z=ot(i,t.line),V=tn(e,t.line,n),Y=new kt(z.text,e.options.tabSize,V),oe;for(r&&(oe=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,j=jr(C,Y,V.state),r&&oe.push(new Wr(Y,j,Tr(i.mode,V.state)));return r?oe:new Wr(Y,j,V.state)}function Yn(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 Sr(e,t,n,r,i,C,j){var z=n.flattenSpans;z==null&&(z=e.options.flattenSpans);var V=0,Y=null,oe=new kt(t,e.options.tabSize,r),ue,xe=e.options.addModeClass&&[null];for(t==""&&Yn(Xn(n,r.state),C);!oe.eol();){if(oe.pos>e.options.maxHighlightLength?(z=!1,j&&Vn(e,t,r,oe.pos),oe.pos=t.length,ue=null):ue=Yn(jr(n,oe,r.state,xe),C),xe){var be=xe[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!z||Y!=ue){for(;V<oe.start;)V=Math.min(oe.start,V+5e3),i(V,Y);Y=ue}oe.start=oe.pos}for(;V<oe.pos;){var Me=Math.min(oe.pos,V+5e3);i(Me,Y),V=Me}}function Li(e,t,n){for(var r,i,C=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),z=t;z>j;--z){if(z<=C.first)return C.first;var V=ot(C,z-1),Y=V.stateAfter;if(Y&&(!n||z+(Y instanceof Br?Y.lookAhead:0)<=C.modeFrontier))return z;var oe=H(V.text,null,e.options.tabSize);(i==null||r>oe)&&(i=z-1,r=oe)}return i}function aa(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=ot(e,r).stateAfter;if(i&&(!(i instanceof Br)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var $n=!1,Vt=!1;function Di(){$n=!0}function oa(){Vt=!0}function rn(e,t,n){this.marker=e,this.from=t,this.to=n}function mr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Hr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],j=C.marker,z=C.from==null||(j.inclusiveLeft?C.from<=t:C.from<t);if(z||C.from==t&&j.type=="bookmark"&&(!n||!C.marker.insertLeft)){var V=C.to==null||(j.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new rn(j,C.from,V?null:C.to))}}return r}function nn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],j=C.marker,z=C.to==null||(j.inclusiveRight?C.to>=t:C.to>t);if(z||C.from==t&&j.type=="bookmark"&&(!n||C.marker.insertLeft)){var V=C.from==null||(j.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new rn(j,V?null:C.from-t,C.to==null?null:C.to-t))}}return r}function an(e,t){if(t.full)return null;var n=Nr(e,t.from.line)&&ot(e,t.from.line).markedSpans,r=Nr(e,t.to.line)&&ot(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,C=t.to.ch,j=ft(t.from,t.to)==0,z=Oi(n,i,j),V=nn(r,C,j),Y=t.text.length==1,oe=$(t.text).length+(Y?i:0);if(z)for(var ue=0;ue<z.length;++ue){var xe=z[ue];if(xe.to==null){var be=mr(V,xe.marker);be?Y&&(xe.to=be.to==null?null:be.to+oe):xe.to=i}}if(V)for(var Me=0;Me<V.length;++Me){var Ne=V[Me];if(Ne.to!=null&&(Ne.to+=oe),Ne.from==null){var Ke=mr(z,Ne.marker);Ke||(Ne.from=oe,Y&&(z||(z=[])).push(Ne))}else Ne.from+=oe,Y&&(z||(z=[])).push(Ne)}z&&(z=Ri(z)),V&&V!=z&&(V=Ri(V));var Qe=[z];if(!Y){var tt=t.text.length-2,Je;if(tt>0&&z)for(var nt=0;nt<z.length;++nt)z[nt].to==null&&(Je||(Je=[])).push(new rn(z[nt].marker,null,null));for(var ct=0;ct<tt;++ct)Qe.push(Je);Qe.push(V)}return Qe}function Ri(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 Pi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(be){if(be.markedSpans)for(var Me=0;Me<be.markedSpans.length;++Me){var Ne=be.markedSpans[Me].marker;Ne.readOnly&&(!r||ee(r,Ne)==-1)&&(r||(r=[])).push(Ne)}}),!r)return null;for(var i=[{from:t,to:n}],C=0;C<r.length;++C)for(var j=r[C],z=j.find(0),V=0;V<i.length;++V){var Y=i[V];if(ft(Y.to,z.from)<0||ft(Y.from,z.to)>0)continue;var oe=[V,1],ue=ft(Y.from,z.from),xe=ft(Y.to,z.to);(ue<0||!j.inclusiveLeft&&!ue)&&oe.push({from:Y.from,to:z.from}),(xe>0||!j.inclusiveRight&&!xe)&&oe.push({from:z.to,to:Y.to}),i.splice.apply(i,oe),V+=oe.length-3}return i}function Qn(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 Jn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Tn(e){return e.inclusiveLeft?-1:0}function on(e){return e.inclusiveRight?1:0}function Mi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),C=ft(r.from,i.from)||Tn(e)-Tn(t);if(C)return-C;var j=ft(r.to,i.to)||on(e)-on(t);return j||t.id-e.id}function Sn(e,t){var n=Vt&&e.markedSpans,r;if(n)for(var i=void 0,C=0;C<n.length;++C)i=n[C],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Mi(r,i.marker)<0)&&(r=i.marker);return r}function Zn(e){return Sn(e,!0)}function sn(e){return Sn(e,!1)}function ki(e,t){var n=Vt&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var C=n[i];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||Mi(r,C.marker)<0)&&(r=C.marker)}return r}function Or(e,t,n,r,i){var C=ot(e,t),j=Vt&&C.markedSpans;if(j)for(var z=0;z<j.length;++z){var V=j[z];if(!V.marker.collapsed)continue;var Y=V.marker.find(0),oe=ft(Y.from,n)||Tn(V.marker)-Tn(i),ue=ft(Y.to,r)||on(V.marker)-on(i);if(oe>=0&&ue<=0||oe<=0&&ue>=0)continue;if(oe<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft(Y.to,n)>=0:ft(Y.to,n)>0)||oe>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft(Y.from,r)<=0:ft(Y.from,r)<0))return!0}}function $t(e){for(var t;t=Zn(e);)e=t.find(-1,!0).line;return e}function wn(e){for(var t;t=sn(e);)e=t.find(1,!0).line;return e}function Cn(e){for(var t,n;t=sn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function qn(e,t){var n=ot(e,t),r=$t(n);return n==r?t:Tt(r)}function ei(e,t){if(t>e.lastLine())return t;var n=ot(e,t),r;if(!gr(e,n))return t;for(;r=sn(n);)n=r.find(1,!0).line;return Tt(n)+1}function gr(e,t){var n=Vt&&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&&Kr(e,t,r))return!0}}function Kr(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Kr(e,r.line,mr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,C=0;C<t.markedSpans.length;++C)if(i=t.markedSpans[C],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Kr(e,t,i))return!0}function vr(e){e=$t(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 C=n.parent;C;n=C,C=n.parent)for(var j=0;j<C.children.length;++j){var z=C.children[j];if(z==n)break;t+=z.height}return t}function wr(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Zn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=sn(r);){var C=n.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function ti(e){var t=e.display,n=e.doc;t.maxLine=ot(n,n.first),t.maxLineLength=wr(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=wr(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Gr=function(e,t,n){this.text=e,Jn(this,t),this.height=n?n(this):1};Gr.prototype.lineNo=function(){return Tt(this)},ce(Gr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Qn(e),Jn(e,n);var i=r?r(e):1;i!=e.height&&fr(e,i)}function Xa(e){e.parent=null,Qn(e)}var Ya={},$a={};function Ii(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?$a:Ya;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function at(e,t){var n=x("span",null,null,R?"padding-right: .1px":null),r={pre:x("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 C=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=dt,ut(e.display.measure)&&(j=Ye(C,e.doc.direction))&&(r.addToken=xt(r.addToken,j)),r.map=[];var z=t!=e.display.externalMeasured&&Tt(C);Et(C,r,He(e,C,z)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=B(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=B(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ke(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(R){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return _e(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function mt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function dt(e,t,n,r,i,C,j){if(!t)return;var z=e.splitSpaces?yt(t,e.trailingSpace):t,V=e.cm.state.specialChars,Y=!1,oe;if(!V.test(t))e.col+=t.length,oe=document.createTextNode(z),e.map.push(e.pos,e.pos+t.length,oe),F&&I<9&&(Y=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var ue=0;;){V.lastIndex=ue;var xe=V.exec(t),be=xe?xe.index-ue:t.length-ue;if(be){var Me=document.createTextNode(z.slice(ue,ue+be));F&&I<9?oe.appendChild(o("span",[Me])):oe.appendChild(Me),e.map.push(e.pos,e.pos+be,Me),e.col+=be,e.pos+=be}if(!xe)break;ue+=be+1;var Ne=void 0;if(xe[0]==" "){var Ke=e.cm.options.tabSize,Qe=Ke-e.col%Ke;Ne=oe.appendChild(o("span",me(Qe),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Qe}else xe[0]=="\r"||xe[0]==`
|
|
`?(Ne=oe.appendChild(o("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",xe[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(xe[0]),Ne.setAttribute("cm-text",xe[0]),F&&I<9?oe.appendChild(o("span",[Ne])):oe.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=z.charCodeAt(t.length-1)==32,n||r||i||Y||C||j){var tt=n||"";r&&(tt+=r),i&&(tt+=i);var Je=o("span",[oe],tt,C);if(j)for(var nt in j)j.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&Je.setAttribute(nt,j[nt]);return e.content.appendChild(Je)}e.content.appendChild(oe)}function yt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var C=e.charAt(i);C==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(C="\xA0"),r+=C,n=C==" "}return r}function xt(e,t){return function(n,r,i,C,j,z,V){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,oe=Y+r.length;;){for(var ue=void 0,xe=0;xe<t.length&&!(ue=t[xe],ue.to>Y&&ue.from<=Y);xe++);if(ue.to>=oe)return e(n,r,i,C,j,z,V);e(n,r.slice(0,ue.to-Y),i,C,null,z,V),C=null,r=r.slice(ue.to-Y),Y=ue.to}}}function At(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 Et(e,t,n){var r=e.markedSpans,i=e.text,C=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(C,C=n[j]),Ii(n[j+1],t.cm.options));return}for(var z=i.length,V=0,Y=1,oe="",ue,xe,be=0,Me,Ne,Ke,Qe,tt;;){if(be==V){Me=Ne=Ke=xe="",tt=null,Qe=null,be=Infinity;for(var Je=[],nt=void 0,ct=0;ct<r.length;++ct){var lt=r[ct],vt=lt.marker;if(vt.type=="bookmark"&<.from==V&&vt.widgetNode)Je.push(vt);else if(lt.from<=V&&(lt.to==null||lt.to>V||vt.collapsed&<.to==V&<.from==V)){if(lt.to!=null&<.to!=V&&be>lt.to&&(be=lt.to,Ne=""),vt.className&&(Me+=" "+vt.className),vt.css&&(xe=(xe?xe+";":"")+vt.css),vt.startStyle&<.from==V&&(Ke+=" "+vt.startStyle),vt.endStyle&<.to==be&&(nt||(nt=[])).push(vt.endStyle,lt.to),vt.title&&((tt||(tt={})).title=vt.title),vt.attributes)for(var Dt in vt.attributes)(tt||(tt={}))[Dt]=vt.attributes[Dt];vt.collapsed&&(!Qe||Mi(Qe.marker,vt)<0)&&(Qe=lt)}else lt.from>V&&be>lt.from&&(be=lt.from)}if(nt)for(var Kt=0;Kt<nt.length;Kt+=2)nt[Kt+1]==be&&(Ne+=" "+nt[Kt]);if(!Qe||Qe.from==V)for(var Mt=0;Mt<Je.length;++Mt)At(t,0,Je[Mt]);if(Qe&&(Qe.from||0)==V){if(At(t,(Qe.to==null?z+1:Qe.to)-V,Qe.marker,Qe.from==null),Qe.to==null)return;Qe.to==V&&(Qe=!1)}}if(V>=z)break;for(var lr=Math.min(z,be);;){if(oe){var nr=V+oe.length;if(!Qe){var Ft=nr>lr?oe.slice(0,lr-V):oe;t.addToken(t,Ft,ue?ue+Me:Me,Ke,V+Ft.length==be?Ne:"",xe,tt)}if(nr>=lr){oe=oe.slice(lr-V),V=lr;break}V=nr,Ke=""}oe=i.slice(C,C=n[Y++]),ue=Ii(n[Y++],t.cm.options)}}}function Nt(e,t,n){this.line=t,this.rest=Cn(t),this.size=this.rest?Tt($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=gr(e,t)}function Xt(e,t,n){for(var r=[],i,C=t;C<n;C=i){var j=new Nt(e.doc,ot(e.doc,C),C);i=C+j.size,r.push(j)}return r}var gt=null;function Rr(e){gt?gt.ops.push(e):e.ownsGroup=gt={ops:[e],delayedCallbacks:[]}}function wt(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 pr(e,t){var n=e.ownsGroup;if(!n)return;try{wt(n)}finally{gt=null,t(n)}}var Zt=null;function Lt(e,t){var n=$e(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;gt?i=gt.delayedCallbacks:Zt?i=Zt:(i=Zt=[],setTimeout(Ps,0));for(var C=function(z){i.push(function(){return n[z].apply(null,r)})},j=0;j<n.length;++j)C(j)}function Ps(){var e=Zt;Zt=null;for(var t=0;t<e.length;++t)e[t]()}function Qa(e,t,n,r){for(var i=0;i<t.changes.length;i++){var C=t.changes[i];C=="text"?ks(e,t):C=="gutter"?Za(e,t,n,r):C=="class"?ua(e,t):C=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),F&&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=ri(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ja(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):at(e,t)}function ks(e,t){var n=t.text.className,r=Ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ua(e,t)):n&&(t.text.className=n)}function ua(e,t){Ms(e,t),t.line.wrapClass?ri(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 Za(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=ri(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var j=ri(t),z=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(z),j.insertBefore(z,t.text),t.line.gutterClass&&(z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=z.appendChild(o("div",Fr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var V=0;V<e.display.gutterSpecs.length;++V){var Y=e.display.gutterSpecs[V].className,oe=C.hasOwnProperty(Y)&&C[Y];oe&&z.appendChild(o("div",[oe],"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=T("CodeMirror-linewidget"),i=t.node.firstChild,C=void 0;i;i=C)C=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);qa(e,t,n)}function Us(e,t,n,r){var i=Ja(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ua(e,t),Za(e,t,n,r),qa(e,t,r),t.node}function qa(e,t,n){if(eo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,n,!1)}function eo(e,t,n,r,i){if(!t.widgets)return;for(var C=ri(n),j=0,z=t.widgets;j<z.length;++j){var V=z[j],Y=o("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Ns(V,Y,n,r),e.display.input.setUneditable(Y),i&&V.above?C.insertBefore(Y,n.gutter||n.text):C.appendChild(Y),Lt(V,"redraw")}}function Ns(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 ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!p(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,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Pr(e,t){for(var n=Se(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 Ui(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,o("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 Cr(e){return ae-e.display.nativeBarWidth}function ln(e){return e.display.scroller.clientWidth-Cr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-Cr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&ln(e);if(!t.measure.heights||r&&t.measure.width!=i){var C=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),z=0;z<j.length-1;z++){var V=j[z],Y=j[z+1];Math.abs(V.bottom-Y.bottom)>2&&C.push((V.bottom+Y.top)/2-n.top)}}C.push(n.bottom-n.top)}}function ro(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Tt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=Tt(t),r=e.display.externalMeasured=new Nt(e.doc,t,n);r.lineN=n;var i=r.built=at(e,r);return r.text=i.pre,u(e.display.lineMeasure,i.pre),r}function no(e,t,n,r){return _r(e,_n(e,t),n,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function _n(e,t){var n=Tt(t),r=fa(e,n);r&&!r.text?r=null:r&&r.changes&&(Qa(e,r,n,ya(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=ro(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function _r(e,t,n,r,i){t.before&&(n=-1);var C=n+(r||""),j;return t.cache.hasOwnProperty(C)?j=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[C]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var io={left:0,right:0,top:0,bottom:0};function ao(e,t,n){for(var r,i,C,j,z,V,Y=0;Y<e.length;Y+=3)if(z=e[Y],V=e[Y+1],t<z?(i=0,C=1,j="left"):t<V?(i=t-z,C=i+1):(Y==e.length-3||t==V&&e[Y+3]>t)&&(C=V-z,i=C-1,t>=V&&(j="right")),i!=null){if(r=e[Y+2],z==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],j="left";if(n=="right"&&i==V-z)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],j="right";break}return{node:r,start:i,end:C,collapse:j,coverStart:z,coverEnd:V}}function js(e,t){var n=io;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=ao(t.map,n,r),C=i.node,j=i.start,z=i.end,V=i.collapse,Y;if(C.nodeType==3){for(var oe=0;oe<4;oe++){for(;j&&Le(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+z<i.coverEnd&&Le(t.line.text.charAt(i.coverStart+z));)++z;if(F&&I<9&&j==0&&z==i.coverEnd-i.coverStart?Y=C.parentNode.getBoundingClientRect():Y=js(y(C,j,z).getClientRects(),r),Y.left||Y.right||j==0)break;z=j,j=j-1,V="right"}F&&I<11&&(Y=Hs(e.display.measure,Y))}else{j>0&&(V=r="right");var ue;e.options.lineWrapping&&(ue=C.getClientRects()).length>1?Y=ue[r=="right"?ue.length-1:0]:Y=C.getBoundingClientRect()}if(F&&I<9&&!j&&(!Y||!Y.left&&!Y.right)){var xe=C.parentNode.getClientRects()[0];xe?Y={left:xe.left,right:xe.left+Ln(e.display),top:xe.top,bottom:xe.bottom}:Y=io}for(var be=Y.top-t.rect.top,Me=Y.bottom-t.rect.top,Ne=(be+Me)/2,Ke=t.view.measure.heights,Qe=0;Qe<Ke.length-1&&!(Ne<Ke[Qe]);Qe++);var tt=Qe?Ke[Qe-1]:0,Je=Ke[Qe],nt={left:(V=="right"?Y.right:Y.left)-t.rect.left,right:(V=="left"?Y.left:Y.right)-t.rect.left,top:tt,bottom:Je};return!Y.left&&!Y.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=be,nt.rbottom=Me),nt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function oo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function so(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function ii(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return h&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return h&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ha(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Ni(e,t,n,r,i){if(!i){var C=ha(t);n.top+=C,n.bottom+=C}if(r=="line")return n;r||(r="local");var j=vr(t);if(r=="local"?j+=Ui(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var z=e.display.lineSpace.getBoundingClientRect();j+=z.top+(r=="window"?0:uo());var V=z.left+(r=="window"?0:lo());n.left+=V,n.right+=V}return n.top+=j,n.bottom+=j,n}function co(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=lo(),i-=uo();else if(n=="local"||!n){var C=e.display.sizer.getBoundingClientRect();r+=C.left,i+=C.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ma(e,t,n,r,i){return r||(r=ot(e.doc,t.line)),Ni(e,r,no(e,r,t.ch,i),n)}function yr(e,t,n,r,i,C){r=r||ot(e.doc,t.line),i||(i=_n(e,r));function j(Me,Ne){var Ke=_r(e,i,Me,Ne?"right":"left",C);return Ne?Ke.left=Ke.right:Ke.right=Ke.left,Ni(e,r,Ke,n)}var z=Ye(r,e.doc.direction),V=t.ch,Y=t.sticky;if(V>=r.text.length?(V=r.text.length,Y="before"):V<=0&&(V=0,Y="after"),!z)return j(Y=="before"?V-1:V,Y=="before");function oe(Me,Ne,Ke){var Qe=z[Ne],tt=Qe.level==1;return j(Ke?Me-1:Me,tt!=Ke)}var ue=je(z,V,Y),xe=Be,be=oe(V,ue,Y=="before");return xe!=null&&(be.other=oe(V,xe,Y!="before")),be}function fo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=Ln(e.display)*t.ch);var r=ot(e.doc,t.line),i=vr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function pa(e,t,n,r,i){var C=Fe(e,t,n);return C.xRel=i,r&&(C.outside=r),C}function ga(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return pa(r.first,0,null,-1,-1);var i=Dr(r,n),C=r.first+r.size-1;if(i>C)return pa(r.first+r.size-1,ot(r,C).text.length,null,1,1);t<0&&(t=0);for(var j=ot(r,i);;){var z=Ks(e,j,i,t,n),V=ki(j,z.ch+(z.xRel>0||z.outside>0?1:0));if(!V)return z;var Y=V.find(1);if(Y.line==i)return Y;j=ot(r,i=Y.line)}}function ho(e,t,n,r){r-=ha(t);var i=t.text.length,C=Xe(function(j){return _r(e,n,j-1).bottom<=r},i,0);return i=Xe(function(j){return _r(e,n,j).top>r},C,i),{begin:C,end:i}}function mo(e,t,n,r){n||(n=_n(e,t));var i=Ni(e,t,_r(e,n,r),"line").top;return ho(e,t,n,i)}function va(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-=vr(t);var C=_n(e,t),j=ha(t),z=0,V=t.text.length,Y=!0,oe=Ye(t,e.doc.direction);if(oe){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,C,oe,r,i);Y=ue.level!=1,z=Y?ue.from:ue.to-1,V=Y?ue.to:ue.from-1}var xe=null,be=null,Me=Xe(function(ct){var lt=_r(e,C,ct);return lt.top+=j,lt.bottom+=j,va(lt,r,i,!1)?(lt.top<=i&<.left<=r&&(xe=ct,be=lt),!0):!1},z,V),Ne,Ke,Qe=!1;if(be){var tt=r-be.left<be.right-r,Je=tt==Y;Me=xe+(Je?0:1),Ke=Je?"after":"before",Ne=tt?be.left:be.right}else{!Y&&(Me==V||Me==z)&&Me++,Ke=Me==0?"after":Me==t.text.length?"before":_r(e,C,Me-(Y?1:0)).bottom+j<=i==Y?"after":"before";var nt=yr(e,Fe(n,Me,Ke),"line",t,C);Ne=nt.left,Qe=i<nt.top?-1:i>=nt.bottom?1:0}return Me=Oe(t.text,Me,1),pa(n,Me,Ke,Qe,r-Ne)}function Gs(e,t,n,r,i,C,j){var z=Xe(function(ue){var xe=i[ue],be=xe.level!=1;return va(yr(e,Fe(n,be?xe.to:xe.from,be?"before":"after"),"line",t,r),C,j,!0)},0,i.length-1),V=i[z];if(z>0){var Y=V.level!=1,oe=yr(e,Fe(n,Y?V.from:V.to,Y?"after":"before"),"line",t,r);va(oe,C,j,!0)&&oe.top>j&&(V=i[z-1])}return V}function zs(e,t,n,r,i,C,j){var z=ho(e,t,r,j),V=z.begin,Y=z.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var oe=null,ue=null,xe=0;xe<i.length;xe++){var be=i[xe];if(be.from>=Y||be.to<=V)continue;var Me=be.level!=1,Ne=_r(e,r,Me?Math.min(Y,be.to)-1:Math.max(V,be.from)).right,Ke=Ne<C?C-Ne+1e9:Ne-C;(!oe||ue>Ke)&&(oe=be,ue=Ke)}return oe||(oe=i[i.length-1]),oe.from<V&&(oe={from:V,to:oe.to,level:oe.level}),oe.to>Y&&(oe={from:oe.from,to:Y,level:oe.level}),oe}var un;function An(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(un==null){un=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)un.appendChild(document.createTextNode("x")),un.appendChild(o("br"));un.appendChild(document.createTextNode("x"))}u(e.measure,un);var n=un.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Ln(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("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 ya(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,C=t.gutters.firstChild,j=0;C;C=C.nextSibling,++j){var z=e.display.gutterSpecs[j].className;n[z]=C.offsetLeft+C.clientLeft+i,r[z]=C.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function po(e){var t=An(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ln(e.display)-3);return function(i){if(gr(e.doc,i))return 0;var C=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(C+=i.widgets[j].height);return n?C+(Math.ceil(i.text.length/r)||1)*t:C+t}}function Ea(e){var t=e.doc,n=po(e);t.iter(function(r){var i=n(r);i!=r.height&&fr(r,i)})}function dn(e,t,n,r){var i=e.display;if(!n&&Se(t).getAttribute("cm-not-content")=="true")return null;var C,j,z=i.lineSpace.getBoundingClientRect();try{C=t.clientX-z.left,j=t.clientY-z.top}catch(ue){return null}var V=ga(e,C,j),Y;if(r&&V.xRel>0&&(Y=ot(e.doc,V.line).text).length==V.ch){var oe=H(Y,Y.length,e.options.tabSize)-Y.length;V=Fe(V.line,Math.max(0,Math.round((C-to(e.display).left)/Ln(e.display))-oe))}return V}function cn(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 tr(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)Vt&&qn(e.doc,t)<i.viewTo&&Vr(e);else if(n<=i.viewFrom)Vt&&ei(e.doc,n+r)>i.viewFrom?Vr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Vr(e);else if(t<=i.viewFrom){var C=Fi(e,n,n+r,1);C?(i.view=i.view.slice(C.index),i.viewFrom=C.lineN,i.viewTo+=r):Vr(e)}else if(n>=i.viewTo){var j=Fi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):Vr(e)}else{var z=Fi(e,t,t,-1),V=Fi(e,n,n+r,1);z&&V?(i.view=i.view.slice(0,z.index).concat(Xt(e,z.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):Vr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function zr(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 C=r.view[cn(e,t)];if(C.node==null)return;var j=C.changes||(C.changes=[]);ee(j,n)==-1&&j.push(n)}function Vr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Fi(e,t,n,r){var i=cn(e,t),C,j=e.display.view;if(!Vt||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var z=e.display.viewFrom,V=0;V<i;V++)z+=j[V].size;if(z!=t){if(r>0){if(i==j.length-1)return null;C=z+j[i].size-t,i++}else C=z-t;t+=C,n+=C}for(;qn(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[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=Xt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Xt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(cn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Xt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,cn(e,n)))),r.viewTo=n}function go(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 ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var z=n.sel.ranges[j];if(z.from().line>=e.display.viewTo||z.to().line<e.display.viewFrom)continue;var V=z.empty();(V||e.options.showCursorWhenSelecting)&&yo(e,z.head,i),V||Xs(e,z,C)}return r}function yo(e,t,n){var r=yr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("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 C=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Bi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,C=document.createDocumentFragment(),j=to(e.display),z=j.left,V=Math.max(r.sizerWidth,ln(e)-r.sizer.offsetLeft)-j.right,Y=i.direction=="ltr";function oe(Je,nt,ct,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),C.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
|
|
top: `+nt+"px; width: "+(ct==null?V-Je:ct)+`px;
|
|
height: `+(lt-nt)+"px"))}function ue(Je,nt,ct){var lt=ot(i,Je),vt=lt.text.length,Dt,Kt;function Mt(Ft,ir){return ma(e,Fe(Je,Ft),"div",lt,ir)}function lr(Ft,ir,Yt){var jt=mo(e,lt,null,Ft),Bt=ir=="ltr"==(Yt=="after")?"left":"right",It=Yt=="after"?jt.begin:jt.end-(/\s/.test(lt.text.charAt(jt.end-1))?2:1);return Mt(It,Bt)[Bt]}var nr=Ye(lt,i.direction);return Ze(nr,nt||0,ct==null?vt:ct,function(Ft,ir,Yt,jt){var Bt=Yt=="ltr",It=Mt(Ft,Bt?"left":"right"),ar=Mt(ir-1,Bt?"right":"left"),Wn=nt==null&&Ft==0,Zr=ct==null&&ir==vt,Jt=jt==0,Ar=!nr||jt==nr.length-1;if(ar.top-It.top<=3){var Gt=(Y?Wn:Zr)&&Jt,za=(Y?Zr:Wn)&&Ar,kr=Gt?z:(Bt?It:ar).left,gn=za?V:(Bt?ar:It).right;oe(kr,It.top,gn-kr,It.bottom)}else{var vn,er,Hn,Va;Bt?(vn=Y&&Wn&&Jt?z:It.left,er=Y?V:lr(Ft,Yt,"before"),Hn=Y?z:lr(ir,Yt,"after"),Va=Y&&Zr&&Ar?V:ar.right):(vn=Y?lr(Ft,Yt,"before"):z,er=!Y&&Wn&&Jt?V:It.right,Hn=!Y&&Zr&&Ar?z:ar.left,Va=Y?lr(ir,Yt,"after"):V),oe(vn,It.top,er-vn,It.bottom),It.bottom<ar.top&&oe(z,It.bottom,null,ar.top),oe(Hn,ar.top,Va-Hn,ar.bottom)}(!Dt||Bi(It,Dt)<0)&&(Dt=It),Bi(ar,Dt)<0&&(Dt=ar),(!Kt||Bi(It,Kt)<0)&&(Kt=It),Bi(ar,Kt)<0&&(Kt=ar)}),{start:Dt,end:Kt}}var xe=t.from(),be=t.to();if(xe.line==be.line)ue(xe.line,xe.ch,be.ch);else{var Me=ot(i,xe.line),Ne=ot(i,be.line),Ke=$t(Me)==$t(Ne),Qe=ue(xe.line,xe.ch,Ke?Me.text.length+1:null).end,tt=ue(be.line,Ke?0:null,be.ch).start;Ke&&(Qe.top<tt.top-2?(oe(Qe.right,Qe.top,null,Qe.bottom),oe(z,tt.top,tt.left,tt.bottom)):oe(Qe.right,Qe.top,tt.left-Qe.right,Qe.bottom)),Qe.bottom<tt.top&&oe(z,Qe.bottom,null,tt.top)}n.appendChild(C)}function xa(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()||Dn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(_e(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(_e(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],C=e.options.lineWrapping,j=void 0,z=0;if(i.hidden)continue;if(F&&I<8){var V=i.node.offsetTop+i.node.offsetHeight;j=V-n,n=V}else{var Y=i.node.getBoundingClientRect();j=Y.bottom-Y.top,!C&&i.text.firstChild&&(z=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var oe=i.line.height-j;if((oe>.005||oe<-.005)&&(fr(i.line,j),xo(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)xo(i.rest[ue]);if(z>e.display.sizerWidth){var xe=Math.ceil(z/Ln(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function xo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Wi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ui(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,C=Dr(t,r),j=Dr(t,i);if(n&&n.ensure){var z=n.ensure.from.line,V=n.ensure.to.line;z<C?(C=z,j=Dr(t,vr(ot(t,z))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=j&&(C=Dr(t,vr(ot(t,V))-e.wrapper.clientHeight),j=V)}return{from:C,to:Math.max(j,C+1)}}function Ys(e,t){if(Ue(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&&!E){var C=o("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ui(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Cr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(i),e.display.lineSpace.removeChild(C)}}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 C=0;C<5;C++){var j=!1,z=yr(e,t),V=!n||n==t?z:yr(e,n);i={left:Math.min(z.left,V.left),top:Math.min(z.top,V.top)-r,right:Math.max(z.left,V.left),bottom:Math.max(z.bottom,V.bottom)+r};var Y=Sa(e,i),oe=e.doc.scrollTop,ue=e.doc.scrollLeft;if(Y.scrollTop!=null&&(si(e,Y.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(j=!0)),Y.scrollLeft!=null&&(fn(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Sa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&fn(e,n.scrollLeft)}function Sa(e,t){var n=e.display,r=An(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,C=ca(e),j={};t.bottom-t.top>C&&(t.bottom=t.top+C);var z=e.doc.height+da(n),V=t.top<r,Y=t.bottom>z-r;if(t.top<i)j.scrollTop=V?0:t.top;else if(t.bottom>i+C){var oe=Math.min(t.top,(Y?z:t.bottom)-C);oe!=i&&(j.scrollTop=oe)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,be=ln(e)-n.gutters.offsetWidth,Me=t.right-t.left>be;return Me&&(t.right=t.left+be),t.left<10?j.scrollLeft=0:t.left<xe?j.scrollLeft=Math.max(0,t.left+ue-(Me?0:10)):t.right>be+xe-3&&(j.scrollLeft=t.right+(Me?0:10)-be),j}function wa(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function On(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=fo(e,t.from),r=fo(e,t.to);To(e,n,r,t.margin)}}function To(e,t,n,r){var i=Sa(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});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||_a(e,{top:t}),So(e,t,!0),L&&_a(e),di(e,100)}function So(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function fn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Lo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+da(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+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var hn=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Te(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};hn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var 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 C=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},hn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},hn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},hn.prototype.zeroWidthHack=function(){var e=l&&!w?"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},hn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),C=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},hn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function Rn(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),wo(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function wo(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 Co={native:hn,null:ui};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Te(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"?fn(e,t):si(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function mn(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},Rr(e.curOp)}function pn(e){var t=e.curOp;t&&pr(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 C=0;C<t.length;C++)nl(t[C]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ti(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 Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ln(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&&fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Rn(t,e.barMeasure),e.updatedDisplay&&La(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&bo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ao(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var C=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(C)for(var z=0;z<C.length;++z)C[z].lines.length||_e(C[z],"hide");if(j)for(var V=0;V<j.length;++V)j[V].lines.length&&_e(j[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&_e(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function sr(e,t){if(e.curOp)return t();mn(e);try{return t()}finally{pn(e)}}function Wt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mn(e);try{return t.apply(e,arguments)}finally{pn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);mn(this);try{return e.apply(this,arguments)}finally{pn(this)}}}function Ht(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mn(t);try{return e.apply(this,arguments)}finally{pn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=tn(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var j=C.styles,z=C.text.length>e.options.maxHighlightLength?Tr(t.mode,r.state):null,V=zn(e,C,r,!0);z&&(r.state=z),C.styles=V.styles;var Y=C.styleClasses,oe=V.classes;oe?C.styleClasses=oe:Y&&(C.styleClasses=null);for(var ue=!j||j.length!=C.styles.length||Y!=oe&&(!Y||!oe||Y.bgClass!=oe.bgClass||Y.textClass!=oe.textClass),xe=0;!ue&&xe<j.length;++xe)ue=j[xe]!=C.styles[xe];ue&&i.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&Vn(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&sr(e,function(){for(var C=0;C<i.length;C++)zr(e,i[C],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ln(e),this.force=n,this.dims=ya(e),this.events=[]};Ki.prototype.signal=function(e,t){se(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)_e.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=Cr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Cr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();if(!t||!p(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&p(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==D())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&p(document.body,e.anchorNode)&&p(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 Ca(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Vr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&go(e)==0)return!1;Do(e)&&(Vr(e),t.dims=ya(e));var i=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<C&&C-n.viewFrom<20&&(C=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),Vt&&(C=qn(e.doc,C),j=ei(e.doc,j));var z=C!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,C,j),n.viewOffset=vr(ot(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=go(e);if(!z&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>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,z&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Ao(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ln(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+da(e.display)-ca(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!Ca(e,t))break;ji(e);var i=li(e);ai(e),Rn(e,i),La(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 _a(e,t){var n=new Ki(e,t);if(Ca(e,n)){ji(e),Ao(e,n);var r=li(e);ai(e),Rn(e,r),La(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,C=r.lineDiv,j=C.firstChild;function z(Me){var Ne=Me.nextSibling;return R&&l&&e.display.currentWheelTarget==Me?Me.style.display="none":Me.parentNode.removeChild(Me),Ne}for(var V=r.view,Y=r.viewFrom,oe=0;oe<V.length;oe++){var ue=V[oe];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=C){var xe=Us(e,ue,Y,n);C.insertBefore(xe,j)}else{for(;j!=ue.node;)j=z(j);var be=i&&t!=null&&t<=Y&&ue.lineNumber;ue.changes&&(ee(ue.changes,"gutter")>-1&&(be=!1),Qa(e,ue,Y,n)),be&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(Fr(e.options,Y)))),j=ue.node.nextSibling}Y+=ue.size}for(;j;)j=z(j)}function Aa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function La(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+Cr(e)+"px"}function Lo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,C=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=C),n[j].gutterBackground&&(n[j].gutterBackground.style.left=C));var z=n[j].alignable;if(z)for(var V=0;V<z.length;V++)z[V].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Do(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Fr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=i.firstChild.offsetWidth,j=i.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Aa(e.display),!0}return!1}function Da(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var C=e[i],j=null;if(typeof C!="string"&&(j=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:C,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Oo(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],C=i.className,j=i.style,z=t.appendChild(o("div",null,"CodeMirror-gutter "+C));j&&(z.style.cssText=j),C=="CodeMirror-linenumbers"&&(e.lineGutter=z,z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Aa(e)}function ci(e){Oo(e.display),tr(e),Lo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=x("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=x("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var C=x("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[C],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+ae+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),F&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(L&&a)&&(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=Da(r.gutters,r.lineNumbers),Oo(i),n.init(i)}var Gi=0,ur=null;F?ur=-.53:L?ur=15:h?ur=-.7:P&&(ur=-1/3);function Ro(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=Ro(e);return t.x*=ur,t.y*=ur,t}function Po(e,t){var n=Ro(t),r=n.x,i=n.y,C=e.display,j=C.scroller,z=j.scrollWidth>j.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&z||i&&V))return;if(i&&l&&R){e:for(var Y=t.target,oe=C.view;Y!=j;Y=Y.parentNode)for(var ue=0;ue<oe.length;ue++)if(oe[ue].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!L&&!g&&ur!=null){i&&V&&si(e,Math.max(0,j.scrollTop+i*ur)),fn(e,Math.max(0,j.scrollLeft+r*ur)),(!i||i&&V)&&Q(t),C.wheelStartX=null;return}if(i&&ur!=null){var xe=i*ur,be=e.doc.scrollTop,Me=be+C.wrapper.clientHeight;xe<0?be=Math.max(0,be+xe-50):Me=Math.min(e.doc.height,Me+xe+50),_a(e,{top:be,bottom:Me})}Gi<20&&(C.wheelStartX==null?(C.wheelStartX=j.scrollLeft,C.wheelStartY=j.scrollTop,C.wheelDX=r,C.wheelDY=i,setTimeout(function(){if(C.wheelStartX==null)return;var Ne=j.scrollLeft-C.wheelStartX,Ke=j.scrollTop-C.wheelStartY,Qe=Ke&&C.wheelDY&&Ke/C.wheelDY||Ne&&C.wheelDX&&Ne/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!Qe)return;ur=(ur*Gi+Qe)/(Gi+1),++Gi},200)):(C.wheelDX+=r,C.wheelDY+=i))}var dr=function(e,t){this.ranges=e,this.primIndex=t};dr.prototype.primary=function(){return this.ranges[this.primIndex]},dr.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(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},dr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new St(En(this.ranges[t].anchor),En(this.ranges[t].head));return new dr(e,this.primIndex)},dr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},dr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var St=function(e,t){this.anchor=e,this.head=t};St.prototype.from=function(){return en(this.anchor,this.head)},St.prototype.to=function(){return xn(this.anchor,this.head)},St.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function br(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,be){return ft(xe.from(),be.from())}),n=ee(t,i);for(var C=1;C<t.length;C++){var j=t[C],z=t[C-1],V=ft(z.to(),j.from());if(r&&!j.empty()?V>0:V>=0){var Y=en(z.from(),j.from()),oe=xn(z.to(),j.to()),ue=z.empty()?j.from()==j.head:z.from()==z.head;C<=n&&--n,t.splice(--C,2,new St(ue?oe:Y,ue?Y:oe))}}return new dr(t,n)}function Xr(e,t){return new dr([new St(e,t||e)],0)}function Yr(e){return e.text?Fe(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Yr(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+=Yr(t).ch-t.to.ch),Fe(n,r)}function Oa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new St(Mo(i.anchor,t),Mo(i.head,t)))}return br(e.cm,n,e.sel.primIndex)}function ko(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),C=i,j=0;j<t.length;j++){var z=t[j],V=ko(z.from,i,C),Y=ko(Yr(z),i,C);if(i=z.to,C=Y,n=="around"){var oe=e.sel.ranges[j],ue=ft(oe.head,oe.anchor)<0;r[j]=new St(ue?Y:V,ue?V:Y)}else r[j]=new St(V,V)}return new dr(r,e.sel.primIndex)}function Ra(e){e.doc.mode=Ir(e.options,e.doc.modeOption),fi(e)}function fi(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,di(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function i(tt){return n?n[tt]:null}function C(tt,Je,nt){la(tt,Je,nt,r),Lt(tt,"change",tt,t)}function j(tt,Je){for(var nt=[],ct=tt;ct<Je;++ct)nt.push(new Gr(Y[ct],i(ct),r));return nt}var z=t.from,V=t.to,Y=t.text,oe=ot(e,z.line),ue=ot(e,V.line),xe=$(Y),be=i(Y.length-1),Me=V.line-z.line;if(t.full)e.insert(0,j(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Io(e,t)){var Ne=j(0,Y.length-1);C(ue,ue.text,be),Me&&e.remove(z.line,Me),Ne.length&&e.insert(z.line,Ne)}else if(oe==ue)if(Y.length==1)C(oe,oe.text.slice(0,z.ch)+xe+oe.text.slice(V.ch),be);else{var Ke=j(1,Y.length-1);Ke.push(new Gr(xe+oe.text.slice(V.ch),be,r)),C(oe,oe.text.slice(0,z.ch)+Y[0],i(0)),e.insert(z.line+1,Ke)}else if(Y.length==1)C(oe,oe.text.slice(0,z.ch)+Y[0]+ue.text.slice(V.ch),i(0)),e.remove(z.line+1,Me);else{C(oe,oe.text.slice(0,z.ch)+Y[0],i(0)),C(ue,xe+ue.text.slice(V.ch),be);var Qe=j(1,Y.length-1);Me>1&&e.remove(z.line+1,Me-1),e.insert(z.line+1,Qe)}Lt(e,"change",e,t)}function $r(e,t,n){function r(i,C,j){if(i.linked)for(var z=0;z<i.linked.length;++z){var V=i.linked[z];if(V.doc==C)continue;var Y=j&&V.sharedHist;if(n&&!Y)continue;t(V.doc,Y),r(V.doc,i,Y)}}r(e,null,!0)}function Uo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Ra(e),No(e),e.options.lineWrapping||ti(e),e.options.mode=t.modeOption,tr(e)}function No(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){sr(e,function(){No(e),tr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var n={from:En(t.from),to:Yr(t),text:Lr(e,t.from,t.to)};return jo(e,n,t.from.line,t.to.line+1),$r(e,function(r){return jo(r,n,t.from.line,t.to.line+1)},!0),n}function Fo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Fo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function Bo(e,t,n,r){var i=e.history;i.undone.length=0;var C=+new Date,j,z;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=ml(i,i.lastOp==r)))z=$(j.changes),ft(t.from,t.to)==0&&ft(t.from,z.to)==0?z.to=Yr(t):j.changes.push(Ma(e,t));else{var V=$(i.done);for((!V||!V.ranges)&&Vi(e.sel,i.done),j={changes:[Ma(e,t)],generation:i.generation},i.done.push(j);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=C,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,z||_e(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,C=r&&r.origin;n==i.lastSelOp||C&&i.lastSelOrigin==C&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==C||pl(e,C,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=C,i.lastSelOp=n,r&&r.clearRedo!==!1&&Fo(i.undone)}function Vi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var i=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[C]=j.markedSpans),++C})}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 Wo(e,t){var n=yl(e,t),r=an(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var C=n[i],j=r[i];if(C&&j){e:for(var z=0;z<j.length;++z){for(var V=j[z],Y=0;Y<C.length;++Y)if(C[Y].marker==V.marker)continue e;C.push(V)}}else j&&(n[i]=j)}return n}function Pn(e,t,n){for(var r=[],i=0;i<e.length;++i){var C=e[i];if(C.ranges){r.push(n?dr.prototype.deepCopy.call(C):C);continue}var j=C.changes,z=[];r.push({changes:z});for(var V=0;V<j.length;++V){var Y=j[V],oe=void 0;if(z.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var ue in Y)(oe=ue.match(/^spans_(\d+)$/))&&(ee(t,Number(oe[1]))>-1&&($(z)[ue]=Y[ue],delete Y[ue]))}}return r}function ka(e,t,n,r){if(r){var i=e.anchor;if(n){var C=ft(t,i)<0;C!=ft(n,i)<0?(i=t,t=n):C!=ft(t,n)<0&&(t=n)}return new St(i,t)}else return new St(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new dr([ka(e.sel.primary(),t,n,i)],0),r)}function Ho(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=ka(e.sel.ranges[C],t[C],null,i);var j=br(e.cm,r,e.sel.primIndex);Qt(e,j,n)}function Ia(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qt(e,br(e.cm,i,e.sel.primIndex),r)}function Ko(e,t,n,r){Qt(e,Xr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var C=0;C<i.length;C++)this.ranges[C]=new St(ht(e,i[C].anchor),ht(e,i[C].head))},origin:n&&n.origin};return _e(e,"beforeSelectionChange",e,r),e.cm&&_e(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?br(e.cm,r.ranges,r.ranges.length-1):t}function Go(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Qt(e,t,n)}function Qt(e,t,n){Yi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(se(e,"beforeSelectionChange")||e.cm&&se(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);zo(e,Xo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&On(e.cm)}function zo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Lt(e,"cursorActivity",e)}function Vo(e){zo(e,Xo(e,e.sel,null,!1))}function Xo(e,t,n,r){for(var i,C=0;C<t.ranges.length;C++){var j=t.ranges[C],z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],V=$i(e,j.anchor,z&&z.anchor,n,r),Y=$i(e,j.head,z&&z.head,n,r);(i||V!=j.anchor||Y!=j.head)&&(i||(i=t.ranges.slice(0,C)),i[C]=new St(V,Y))}return i?br(e.cm,i,t.primIndex):t}function Mn(e,t,n,r,i){var C=ot(e,t.line);if(C.markedSpans)for(var j=0;j<C.markedSpans.length;++j){var z=C.markedSpans[j],V=z.marker,Y="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,oe="selectRight"in V?!V.selectRight:V.inclusiveRight;if((z.from==null||(Y?z.from<=t.ch:z.from<t.ch))&&(z.to==null||(oe?z.to>=t.ch:z.to>t.ch))){if(i&&(_e(V,"beforeCursorEnter"),V.explicitlyCleared))if(C.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var ue=V.find(r<0?1:-1),xe=void 0;if((r<0?oe:Y)&&(ue=Yo(e,ue,-r,ue&&ue.line==t.line?C:null)),ue&&ue.line==t.line&&(xe=ft(ue,n))&&(r<0?xe<0:xe>0))return Mn(e,ue,t,r,i)}var be=V.find(r<0?-1:1);return(r<0?Y:oe)&&(be=Yo(e,be,r,be.line==t.line?C:null)),be?Mn(e,be,t,r,i):null}}return t}function $i(e,t,n,r,i){var C=r||1,j=Mn(e,t,n,C,i)||!i&&Mn(e,t,n,C,!0)||Mn(e,t,n,-C,i)||!i&&Mn(e,t,n,-C,!0);return j||(e.cantEdit=!0,Fe(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Fe(t.line-1)):null:n>0&&t.ch==(r||ot(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 $o(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),pe)}function Qo(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,C,j,z){i&&(r.from=ht(e,i)),C&&(r.to=ht(e,C)),j&&(r.text=j),z!==void 0&&(r.origin=z)}),_e(e,"beforeChange",e,r),e.cm&&_e(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 kn(e,t,n){if(e.cm){if(!e.cm.curOp)return Wt(e.cm,kn)(e,t,n);if(e.cm.state.suppressEdits)return}if((se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"))&&(t=Qo(e,t,!0),!t))return;var r=$n&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Jo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Jo(e,t)}function Jo(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Oa(e,t);Bo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,an(e,t));var r=[];$r(e,function(i,C){!C&&ee(r,i.history)==-1&&(ts(i.history,t),r.push(i.history)),hi(i,t,null,an(i,t))})}function Qi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,C,j=e.sel,z=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,Y=0;Y<z.length&&!(C=z[Y],n?C.ranges&&!C.equals(e.sel):!C.ranges);Y++);if(Y==z.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(C=z.pop(),C.ranges){if(Vi(C,V),n&&!C.equals(e.sel)){Qt(e,C,{clearRedo:!1});return}j=C}else if(r){z.push(C);return}else break;var oe=[];Vi(j,V),V.push({changes:oe,generation:i.generation}),i.generation=C.generation||++i.maxGeneration;for(var ue=se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"),xe=function(Ne){var Ke=C.changes[Ne];if(Ke.origin=t,ue&&!Qo(e,Ke,!1))return z.length=0,{};oe.push(Ma(e,Ke));var Qe=Ne?Oa(e,Ke):$(z);hi(e,Ke,Qe,Wo(e,Ke)),!Ne&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Yr(Ke)});var tt=[];$r(e,function(Je,nt){!nt&&ee(tt,Je.history)==-1&&(ts(Je.history,Ke),tt.push(Je.history)),hi(Je,Ke,null,Wo(Je,Ke))})},be=C.changes.length-1;be>=0;--be){var Me=xe(be);if(Me)return Me.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new dr(ie(e.sel.ranges,function(i){return new St(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)zr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Wt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Zo(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);Zo(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Fe(C,ot(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Lr(e,t.from,t.to),n||(n=Oa(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),Yi(e,n,pe),e.cantEdit&&$i(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,C=t.from,j=t.to,z=!1,V=C.line;e.options.lineWrapping||(V=Tt($t(ot(r,C.line))),r.iter(V,j.line+1,function(be){if(be==i.maxLine)return z=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Pa(r,t,n,po(e)),e.options.lineWrapping||(r.iter(V,C.line+t.text.length,function(be){var Me=wr(be);Me>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Me,i.maxLineChanged=!0,z=!1)}),z&&(e.curOp.updateMaxLine=!0)),aa(r,C.line),di(e,400);var Y=t.text.length-(j.line-C.line)-1;t.full?tr(e):C.line==j.line&&t.text.length==1&&!Io(e.doc,t)?zr(e,C.line,"text"):tr(e,C.line,j.line+1,Y);var oe=se(e,"changes"),ue=se(e,"change");if(ue||oe){var xe={from:C,to:j,text:t.text,removed:t.removed,origin:t.origin};ue&&Lt(e,"change",e,xe),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function In(e,t,n,r,i){var C;r||(r=n),ft(r,n)<0&&(C=[r,n],n=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),kn(e,{from:n,to:r,text:t,origin:i})}function qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,n,r){for(var i=0;i<e.length;++i){var C=e[i],j=!0;if(C.ranges){C.copied||(C=e[i]=C.deepCopy(),C.copied=!0);for(var z=0;z<C.ranges.length;z++)qo(C.ranges[z].anchor,t,n,r),qo(C.ranges[z].head,t,n,r);continue}for(var V=0;V<C.changes.length;++V){var Y=C.changes[V];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){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function ts(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;es(e.done,n,r,i),es(e.undone,n,r,i)}function mi(e,t,n,r){var i=t,C=t;return typeof t=="number"?C=ot(e,_i(e,t)):i=Tt(t),i==null?null:(r(C,i)&&e.cm&&zr(e.cm,i,n),C)}function pi(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}pi.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,Xa(i),Lt(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 gi(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}gi.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 C=Math.min(t,i-e),j=r.height;if(r.removeInner(e,C),this.height-=j-r.height,i==C&&(this.children.splice(n--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pi))){var z=[];this.collapse(z),this.children=[new pi(z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],C=i.chunkSize();if(e<=C){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,z=j;z<i.lines.length;){var V=new pi(i.lines.slice(z,z+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=C}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(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],C=i.chunkSize();if(e<C){var j=Math.min(t,C-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=C}}};var vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Tt(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 C=ni(this);fr(n,Math.max(0,n.height-C)),e&&(sr(e,function(){rs(e,n,-C),zr(e,r,"widget")}),Lt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;gr(this.doc,r)||fr(r,r.height+i),n&&sr(n,function(){n.curOp.forceUpdate=!0,rs(n,r,i),Lt(n,"lineWidgetChanged",n,e,Tt(r))})},ce(vi);function rs(e,t,n){vr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),C=e.cm;return C&&i.noHScroll&&(C.display.alignWidgets=!0),mi(e,t,"widget",function(j){var z=j.widgets||(j.widgets=[]);if(i.insertAt==null?z.push(i):z.splice(Math.min(z.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,C&&!gr(e,j)){var V=vr(j)<e.scrollTop;fr(j,j.height+ni(i)),V&&wa(C,i.height),C.curOp.forceUpdate=!0}return!0}),C&&Lt(C,"lineWidgetAdded",C,i,typeof t=="number"?t:Tt(t)),i}var ns=0,Qr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};Qr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mn(e),se(this,"clear")){var n=this.find();n&&Lt(this,"clear",n.from,n.to)}for(var r=null,i=null,C=0;C<this.lines.length;++C){var j=this.lines[C],z=mr(j.markedSpans,this);e&&!this.collapsed?zr(e,Tt(j),"text"):e&&(z.to!=null&&(i=Tt(j)),z.from!=null&&(r=Tt(j))),j.markedSpans=Hr(j.markedSpans,z),z.from==null&&this.collapsed&&!gr(this.doc,j)&&e&&fr(j,An(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var Y=$t(this.lines[V]),oe=wr(Y);oe>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=oe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Lt(e,"markerCleared",e,this,r,i),t&&pn(e),this.parent&&this.parent.clear()},Qr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var C=this.lines[i],j=mr(C.markedSpans,this);if(j.from!=null&&(n=Fe(t?C:Tt(C),j.from),e==-1))return n;if(j.to!=null&&(r=Fe(t?C:Tt(C),j.to),e==1))return r}return n&&{from:n,to:r}},Qr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;sr(r,function(){var i=t.line,C=Tt(t.line),j=fa(r,C);if(j&&(oo(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!gr(n.doc,i)&&n.height!=null){var z=n.height;n.height=null;var V=ni(n)-z;V&&fr(i,i.height+V)}Lt(r,"markerChanged",r,e)})},Qr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ee(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Qr.prototype.detachLine=function(e){if(this.lines.splice(ee(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce(Qr);function Un(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Wt(e.cm,Un)(e,t,n,r,i);var C=new Qr(e,i),j=ft(t,n);if(r&&k(r,C,!1),j>0||j==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=x("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(Or(e,t.line,t,n,C)||t.line!=n.line&&Or(e,n.line,t,n,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}C.addToHistory&&Bo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var z=t.line,V=e.cm,Y;if(e.iter(z,n.line+1,function(ue){V&&C.collapsed&&!V.options.lineWrapping&&$t(ue)==V.display.maxLine&&(Y=!0),C.collapsed&&z!=t.line&&fr(ue,0),sa(ue,new rn(C,z==t.line?t.ch:null,z==n.line?n.ch:null)),++z}),C.collapsed&&e.iter(t.line,n.line+1,function(ue){gr(e,ue)&&fr(ue,0)}),C.clearOnEnter&&Te(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&(Di(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++ns,C.atomic=!0),V){if(Y&&(V.curOp.updateMaxLine=!0),C.collapsed)tr(V,t.line,n.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var oe=t.line;oe<=n.line;oe++)zr(V,oe,"text");C.atomic&&Vo(V.doc),Lt(V,"markerAdded",V,C)}return C}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Lt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(yi);function Tl(e,t,n,r,i){r=k(r),r.shared=!1;var C=[Un(e,t,n,r,i)],j=C[0],z=r.widgetNode;return $r(e,function(V){z&&(r.widgetNode=z.cloneNode(!0)),C.push(Un(V,ht(V,t),ht(V,n),r,i));for(var Y=0;Y<V.linked.length;++Y)if(V.linked[Y].isParent)return;j=$(C)}),new yi(C,j)}function is(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(),C=e.clipPos(i.from),j=e.clipPos(i.to);if(ft(C,j)){var z=Un(e,C,j,r.primary,r.primary.type);r.markers.push(z),z.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],C=[i.primary.doc];$r(i.primary.doc,function(V){return C.push(V)});for(var j=0;j<i.markers.length;j++){var z=i.markers[j];ee(C,z.doc)==-1&&(z.parent=null,i.markers.splice(j--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),gi.call(this,[new pi([new Gr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var C=Fe(n,0);this.sel=Xr(C),this.history=new zi(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)),Pa(this,{from:C,to:C,text:e}),Qt(this,Xr(C),pe)};rr.prototype=Ce(gi.prototype,{constructor:rr,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=bn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ht(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;kn(this,{from:t,to:Fe(n,ot(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Qt(this,Xr(t),pe)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,In(this,e,t,n,r)},getRange:function(e,t,n){var r=Lr(this,ht(this,e),ht(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(Nr(this,e))return ot(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ot(this,e)),$t(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(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:Ht(function(e,t,n){Ko(this,ht(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:Ht(function(e,t,n){Ko(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Ht(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Ht(function(e,t){Ho(this,Gn(this,e),t)}),extendSelectionsBy:Ht(function(e,t){var n=ie(this.sel.ranges,e);Ho(this,Gn(this,n),t)}),setSelections:Ht(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new St(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qt(this,br(this.cm,r,t),n)}),addSelection:Ht(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new St(ht(this,e),ht(this,t||e))),Qt(this,br(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=Lr(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=Lr(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:Ht(function(e,t,n){for(var r=[],i=this.sel,C=0;C<i.ranges.length;C++){var j=i.ranges[C];r[C]={from:j.from(),to:j.to(),text:this.splitLines(e[C]),origin:n}}for(var z=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)kn(this,r[V]);z?Go(this,z):this.cm&&On(this.cm)}),undo:Ht(function(){Qi(this,"undo")}),redo:Ht(function(){Qi(this,"redo")}),undoSelection:Ht(function(){Qi(this,"undo",!0)}),redoSelection:Ht(function(){Qi(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 zi(this.history.maxGeneration),$r(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:Pn(this.history.done),undone:Pn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=Pn(e.done.slice(0),null,!0),t.undone=Pn(e.undone.slice(0),null,!0)},setGutterMarker:Ht(function(e,t,n){return mi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&De(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ht(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&mi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,De(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Nr(this,e))return null;if(t=e,e=ot(this,e),!e)return null}else if(t=Tt(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:Ht(function(e,t,n){return mi(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(T(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Ht(function(e,t,n){return mi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",C=r[i];if(C)if(n==null)r[i]=null;else{var j=C.match(T(n));if(!j)return!1;var z=j.index+j[0].length;r[i]=C.slice(0,j.index)+(!j.index||z==C.length?"":" ")+C.slice(z)||null}else return!1;return!0})}),addLineWidget:Ht(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Un(this,ht(this,e),ht(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=ht(this,e),Un(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=ot(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=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(C){var j=C.markedSpans;if(j)for(var z=0;z<j.length;z++){var V=j[z];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.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 C=i.text.length+r;if(C>e)return t=e,!0;e-=C,++n}),ht(this,Fe(n,t))},indexFromPos:function(e){e=ht(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 rr(bn(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 rr(bn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,is(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(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(is(this));break}if(e.history==this.history){var r=[e.id];$r(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=Pn(this.history.done,r),e.history.undone=Pn(this.history.undone,r)}},iterLinkedDocs:function(e){$r(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):st(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Ht(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)})}),rr.prototype.eachLine=rr.prototype.iter;var as=0;function _l(e){var t=this;if(os(t),Ue(t,e)||Pr(t.display,e))return;Q(e),F&&(as=+new Date);var n=dn(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,C=Array(i),j=0,z=function(){++j==i&&Wt(t,function(){n=ht(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(C.filter(function(Me){return Me!=null}).join(t.doc.lineSeparator())),origin:"paste"};kn(t.doc,be),Go(t.doc,Xr(ht(t.doc,n),ht(t.doc,Yr(be))))})()},V=function(be,Me){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,be.type)==-1){z();return}var Ne=new FileReader;Ne.onerror=function(){return z()},Ne.onload=function(){var Ke=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){z();return}C[Me]=Ke,z()},Ne.readAsText(be)},Y=0;Y<r.length;Y++)V(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 oe=e.dataTransfer.getData("Text");if(oe){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Yi(t.doc,Xr(n,n)),ue)for(var xe=0;xe<ue.length;++xe)In(t.doc,"",ue[xe].anchor,ue[xe].head,"drag");t.replaceSelection(oe,"around","paste"),t.display.input.focus()}}catch(be){}}}function Al(e,t){if(F&&(!e.state.draggingText||+new Date-as<100)){le(t);return}if(Ue(e,t)||Pr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),g&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=dn(e,t);if(!n)return;var r=document.createDocumentFragment();yo(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var C=0;C<n.length;C++)e(n[C])})}var ls=!1;function Dl(){if(ls)return;Ol(),ls=!0}function Ol(){var e;Te(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Rl)},100))}),Te(window,"blur",function(){return ss(Dn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Jr={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"},bi=0;bi<10;bi++)Jr[bi+48]=Jr[bi+96]=String(bi);for(var Ji=65;Ji<=90;Ji++)Jr[Ji]=String.fromCharCode(Ji);for(var Ei=1;Ei<=12;Ei++)Jr[Ei+111]=Jr[Ei+63235]="F"+Ei;var Mr={};Mr.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"},Mr.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"},Mr.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"},Mr.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"]},Mr.default=l?Mr.macDefault:Mr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,C,j=0;j<t.length-1;j++){var z=t[j];if(/^(cmd|meta|m)$/i.test(z))C=!0;else if(/^a(lt)?$/i.test(z))n=!0;else if(/^(c|ctrl|control)$/i.test(z))r=!0;else if(/^s(hift)?$/i.test(z))i=!0;else throw new Error("Unrecognized modifier name: "+z)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),C&&(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=ie(n.split(" "),Pl),C=0;C<i.length;C++){var j=void 0,z=void 0;C==i.length-1?(z=i.join(" "),j=r):(z=i.slice(0,C+1).join(" "),j="...");var V=t[z];if(!V)t[z]=j;else if(V!=j)throw new Error("Inconsistent bindings for "+z)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function Nn(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 Nn(e,t.fallthrough,n,r);for(var C=0;C<t.fallthrough.length;C++){var j=Nn(e,t.fallthrough[C],n,r);if(j)return j}}}function us(e){var t=typeof e=="string"?e:Jr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(g&&e.keyCode==34&&e.char)return!1;var n=Jr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ds(n,e,t))}function Zi(e){return typeof e=="string"?Mr[e]:e}function Fn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var C=t(n[i]);r.length&&ft(C.from,$(r).to)<=0;){var j=r.pop();if(ft(j.from,C.from)<0){C.from=j.from;break}}r.push(C)}sr(e,function(){for(var z=r.length-1;z>=0;z--)In(e.doc,"",r[z].from,r[z].to,"+delete");On(e)})}function Ua(e,t,n){var r=Oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function Fa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var C=Ye(n,t.doc.direction);if(C){var j=i<0?$(C):C[0],z=i<0==(j.level==1),V=z?"after":"before",Y;if(j.level>0||t.doc.direction=="rtl"){var oe=_n(t,n);Y=i<0?n.text.length-1:0;var ue=_r(t,oe,Y).top;Y=Xe(function(xe){return _r(t,oe,xe).top==ue},i<0==(j.level==1)?j.from:j.to-1,Y),V=="before"&&(Y=Ua(n,Y,1))}else Y=i<0?j.to:j.from;return new Fe(r,Y,V)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Ye(t,e.doc.direction);if(!i)return Na(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 C=je(i,n.ch,n.sticky),j=i[C];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Na(t,n,r);var z=function(Qe,tt){return Ua(t,Qe instanceof Fe?Qe.ch:Qe,tt)},V,Y=function(Qe){return e.options.lineWrapping?(V=V||_n(e,t),mo(e,t,V,Qe)):{begin:0,end:t.text.length}},oe=Y(n.sticky=="before"?z(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var ue=j.level==1==r<0,xe=z(n,ue?1:-1);if(xe!=null&&(ue?xe<=j.to&&xe<=oe.end:xe>=j.from&&xe>=oe.begin)){var be=ue?"before":"after";return new Fe(n.line,xe,be)}}var Me=function(Qe,tt,Je){for(var nt=function(Dt,Kt){return Kt?new Fe(n.line,z(Dt,1),"before"):new Fe(n.line,Dt,"after")};Qe>=0&&Qe<i.length;Qe+=tt){var ct=i[Qe],lt=tt>0==(ct.level!=1),vt=lt?Je.begin:z(Je.end,-1);if(ct.from<=vt&&vt<ct.to)return nt(vt,lt);if(vt=lt?ct.from:z(ct.to,-1),Je.begin<=vt&&vt<Je.end)return nt(vt,lt)}},Ne=Me(C+r,r,oe);if(Ne)return Ne;var Ke=r>0?oe.end:z(oe.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Ne=Me(r>0?0:i.length-1,r,Y(Ke)),Ne)?Ne:null}var xi={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Fn(e,function(t){if(t.empty()){var n=ot(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 Fn(e,function(t){return{from:Fe(t.from().line,0),to:ht(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Fn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Fn(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 Fn(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 fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return hs(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")},fe)},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")},fe)},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/)?hs(e,t.head):r},fe)},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 C=n[i].from(),j=H(e.getLine(C.line),C.ch,r);t.push(me(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return sr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,C=ot(e.doc,i.line).text;if(C){if(i.ch==C.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(C.charAt(i.ch-1)+C.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=ot(e.doc,i.line-1).text;j&&(i=new Fe(i.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Fe(i.line-1,j.length-1),i,"+transpose"))}}n.push(new St(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return sr(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);On(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fs(e,t){var n=ot(e.doc,t),r=$t(n);return r!=n&&(t=Tt(r)),Fa(!0,e,r,t,1)}function Il(e,t){var n=ot(e.doc,t),r=wn(n);return r!=n&&(t=Tt(r)),Fa(!0,e,n,t,-1)}function hs(e,t){var n=fs(e,t.line),r=ot(e.doc,n.line),i=Ye(r,e.doc.direction);if(!i||i[0].level==0){var C=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=C&&t.ch;return Fe(n.line,j?0:C,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=xi[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)!=ye}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=Nn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Nn(t,e.options.extraKeys,n,e)||Nn(t,e.options.keyMap,n,e)}var Nl=new X;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ms(e,i+" "+t,n,r))return!0}return ms(e,t,n,r)}function ms(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Lt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),xa(e)),!!i}function ps(e,t){var n=cs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ti(e,"Shift-"+n,t,function(r){return qi(e,r,!0)})||Ti(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return qi(e,r)}):Ti(e,n,t,function(r){return qi(e,r)}):!1}function Fl(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var Ba=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),Ue(t,e))return;F&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ps(t,e);g&&(Ba=r?n:null,!r&&n==88&&!_t&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!l&&!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;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(m(t,"CodeMirror-crosshair"),Ge(document,"keyup",n),Ge(document,"mouseover",n))}Te(document,"keyup",n),Te(document,"mouseover",n)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ue(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Pr(t.display,e)||Ue(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(g&&n==Ba){Ba=null,Q(e);return}if(g&&(!e.which||e.which<10)&&ps(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,ja=function(e,t,n){this.time=e,this.pos=t,this.button=n};ja.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new ja(n,e,t),Si=null,"double"):(Si=new ja(n,e,t),wi=null,"single")}function bs(e){var t=this,n=t.display;if(Ue(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Pr(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var r=dn(t,e),i=Re(e),C=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,C,e))return;i==1?r?Gl(t,r,C,e):Se(e)==n.scroller&&Q(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,n,r,i){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,Ti(e,ds(C,i),i,function(j){if(typeof j=="string"&&(j=xi[j]),!j)return!1;var z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),z=j(e,n)!=ye}finally{e.state.suppressEdits=!1}return z})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var C=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=C?"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=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){F?setTimeout(M(bo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),C=e.doc.sel,j;e.options.dragDrop&&Pe&&!e.isReadOnly()&&n=="single"&&(j=C.contains(t))>-1&&(ft((j=C.ranges[j]).from(),t)<0||t.xRel>0)&&(ft(j.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,C=!1,j=Wt(e,function(Y){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ge(i.wrapper.ownerDocument,"mouseup",j),Ge(i.wrapper.ownerDocument,"mousemove",z),Ge(i.scroller,"dragstart",V),Ge(i.scroller,"drop",j),C||(Q(Y),r.addNew||Xi(e.doc,n,null,null,r.extend),R&&!P||F&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),z=function(Y){C=C||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},V=function(){return C=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Te(i.wrapper.ownerDocument,"mouseup",j),Te(i.wrapper.ownerDocument,"mousemove",z),Te(i.scroller,"dragstart",V),Te(i.scroller,"drop",j),Eo(e),setTimeout(function(){return i.input.focus()},20)}function Es(e,t,n){if(n=="char")return new St(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new St(Fe(t.line,0),ht(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new St(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,C=e.doc;Q(t);var j,z,V=C.sel,Y=V.ranges;if(r.addNew&&!r.extend?(z=C.sel.contains(n),z>-1?j=Y[z]:j=new St(n,n)):(j=C.sel.primary(),z=C.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new St(n,n)),n=dn(e,t,!0,!0),z=-1;else{var oe=Es(e,n,r.unit);r.extend?j=ka(j,oe.anchor,oe.head,r.extend):j=oe}r.addNew?z==-1?(z=Y.length,Qt(C,br(e,Y.concat([j]),z),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[z].empty()&&r.unit=="char"&&!r.extend?(Qt(C,br(e,Y.slice(0,z).concat(Y.slice(z+1)),0),{scroll:!1,origin:"*mouse"}),V=C.sel):Ia(C,z,j,he):(z=0,Qt(C,new dr([j],0),he),V=C.sel);var ue=n;function xe(Je){if(ft(ue,Je)==0)return;if(ue=Je,r.unit=="rectangle"){for(var nt=[],ct=e.options.tabSize,lt=H(ot(C,n.line).text,n.ch,ct),vt=H(ot(C,Je.line).text,Je.ch,ct),Dt=Math.min(lt,vt),Kt=Math.max(lt,vt),Mt=Math.min(n.line,Je.line),lr=Math.min(e.lastLine(),Math.max(n.line,Je.line));Mt<=lr;Mt++){var nr=ot(C,Mt).text,Ft=de(nr,Dt,ct);Dt==Kt?nt.push(new St(Fe(Mt,Ft),Fe(Mt,Ft))):nr.length>Ft&&nt.push(new St(Fe(Mt,Ft),Fe(Mt,de(nr,Kt,ct))))}nt.length||nt.push(new St(n,n)),Qt(C,br(e,V.ranges.slice(0,z).concat(nt),z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var ir=j,Yt=Es(e,Je,r.unit),jt=ir.anchor,Bt;ft(Yt.anchor,jt)>0?(Bt=Yt.head,jt=en(ir.from(),Yt.anchor)):(Bt=Yt.anchor,jt=xn(ir.to(),Yt.head));var It=V.ranges.slice(0);It[z]=Xl(e,new St(ht(C,jt),Bt)),Qt(C,br(e,It,z),he)}}var be=i.wrapper.getBoundingClientRect(),Me=0;function Ne(Je){var nt=++Me,ct=dn(e,Je,!0,r.unit=="rectangle");if(!ct)return;if(ft(ct,ue)!=0){e.curOp.focus=D(),xe(ct);var lt=Wi(i,C);(ct.line>=lt.to||ct.line<lt.from)&&setTimeout(Wt(e,function(){Me==nt&&Ne(Je)}),150)}else{var vt=Je.clientY<be.top?-20:Je.clientY>be.bottom?20:0;vt&&setTimeout(Wt(e,function(){if(Me!=nt)return;i.scroller.scrollTop+=vt,Ne(Je)}),50)}}function Ke(Je){e.state.selectingText=!1,Me=Infinity,Je&&(Q(Je),i.input.focus()),Ge(i.wrapper.ownerDocument,"mousemove",Qe),Ge(i.wrapper.ownerDocument,"mouseup",tt),C.history.lastSelOrigin=null}var Qe=Wt(e,function(Je){Je.buttons===0||!Re(Je)?Ke(Je):Ne(Je)}),tt=Wt(e,Ke);e.state.selectingText=tt,Te(i.wrapper.ownerDocument,"mousemove",Qe),Te(i.wrapper.ownerDocument,"mouseup",tt)}function Xl(e,t){var n=t.anchor,r=t.head,i=ot(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var C=Ye(i);if(!C)return t;var j=je(C,n.ch,n.sticky),z=C[j];if(z.from!=n.ch&&z.to!=n.ch)return t;var V=j+(z.from==n.ch==(z.level!=1)?0:1);if(V==0||V==C.length)return t;var Y;if(r.line!=n.line)Y=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=je(C,r.ch,r.sticky),ue=oe-j||(r.ch-n.ch)*(z.level==1?-1:1);oe==V-1||oe==V?Y=ue<0:Y=ue>0}var xe=C[V+(Y?-1:0)],be=Y==(xe.level==1),Me=be?xe.from:xe.to,Ne=be?"after":"before";return n.ch==Me&&n.sticky==Ne?t:new St(new Fe(n.line,Me,Ne),r)}function xs(e,t,n,r){var i,C;if(t.touches)i=t.touches[0].clientX,C=t.touches[0].clientY;else try{i=t.clientX,C=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var j=e.display,z=j.lineDiv.getBoundingClientRect();if(C>z.bottom||!se(e,n))return re(t);C-=z.top-j.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var Y=j.gutters.childNodes[V];if(Y&&Y.getBoundingClientRect().right>=i){var oe=Dr(e.doc,C),ue=e.display.gutterSpecs[V];return _e(e,n,e,oe,ue.className,t),re(t)}}}function Wa(e,t){return xs(e,t,"gutterClick",!0)}function Ts(e,t){if(Pr(e.display,t)||Yl(e,t))return;if(Ue(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return se(e,"gutterContextMenu")?xs(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Bn={toString:function(){return"CodeMirror.Init"}},ws={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,C,j){e.defaults[r]=i,C&&(t[r]=j?function(z,V,Y){Y!=Bn&&C(z,V,Y)}:C)}e.defineOption=n,e.Init=Bn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ra(r)},!0),n("indentUnit",2,Ra,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var C=[],j=r.doc.first;r.doc.iter(function(V){for(var Y=0;;){var oe=V.text.indexOf(i,Y);if(oe==-1)break;Y=oe+i.length,C.push(Fe(j,oe))}j++});for(var z=C.length-1;z>=0;z--)In(r.doc,i,C[z],Fe(C[z].line,C[z].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,C){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),C!=Bn&&r.refresh()}),n("specialCharPlaceholder",mt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"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",!_),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),ci(r)},!0),n("keyMap","default",function(r,i,C){var j=Zi(i),z=C!=Bn&&Zi(C);z&&z.detach&&z.detach(r,j),j.attach&&j.attach(r,z||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Da(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ba(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rn(r)},!0),n("scrollbarStyle","native",function(r){_o(r),Rn(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=Da(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Dn(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,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!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,fi,!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 Ql(e,t,n){var r=n&&n!=Bn;if(!t!=!r){var i=e.display.dragFunctions,C=t?Te:Ge;C(e.display.scroller,"dragstart",i.start),C(e.display.scroller,"dragenter",i.enter),C(e.display.scroller,"dragover",i.over),C(e.display.scroller,"dragleave",i.leave),C(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(m(e.display.wrapper,"CodeMirror-wrap"),ti(e)),Ea(e),tr(e),ii(e),setTimeout(function(){return Rn(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?k(t):{},k(ws,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Pt.inputStyles[t.inputStyle](this),C=this.display=new dl(e,r,i,t);C.wrapper.CodeMirror=this,Ss(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new X,keySeq:null,specialChars:null},t.autofocus&&!a&&C.input.focus(),F&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),mn(this),this.curOp.forceUpdate=!0,Uo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Dn(this);for(var j in ea)ea.hasOwnProperty(j)&&ea[j](this,t[j],Bn);Do(this),t.finishInit&&t.finishInit(this);for(var z=0;z<Ha.length;++z)Ha[z](this);pn(this),R&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}Pt.defaults=ws,Pt.optionHandlers=ea;function Zl(e){var t=e.display;Te(t.scroller,"mousedown",Wt(e,bs)),F&&I<11?Te(t.scroller,"dblclick",Wt(e,function(V){if(Ue(e,V))return;var Y=dn(e,V);if(!Y||Wa(e,V)||Pr(e.display,V))return;Q(V);var oe=e.findWordAt(Y);Xi(e.doc,oe.anchor,oe.head)})):Te(t.scroller,"dblclick",function(V){return Ue(e,V)||Q(V)}),Te(t.scroller,"contextmenu",function(V){return Ts(e,V)}),Te(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Ts(e,V)});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 C(V){if(V.touches.length!=1)return!1;var Y=V.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function j(V,Y){if(Y.left==null)return!0;var oe=Y.left-V.left,ue=Y.top-V.top;return oe*oe+ue*ue>20*20}Te(t.scroller,"touchstart",function(V){if(!Ue(e,V)&&!C(V)&&!Wa(e,V)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Te(t.scroller,"touchend",function(V){var Y=t.activeTouch;if(Y&&!Pr(t,V)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var oe=e.coordsChar(t.activeTouch,"page"),ue;!Y.prev||j(Y,Y.prev)?ue=new St(oe,oe):!Y.prev.prev||j(Y,Y.prev.prev)?ue=e.findWordAt(oe):ue=new St(Fe(oe.line,0),ht(e.doc,Fe(oe.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),Q(V)}i()}),Te(t.scroller,"touchcancel",i),Te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),fn(e,t.scroller.scrollLeft,!0),_e(e,"scroll",e))}),Te(t.scroller,"mousewheel",function(V){return Po(e,V)}),Te(t.scroller,"DOMMouseScroll",function(V){return Po(e,V)}),Te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Ue(e,V)||le(V)},over:function(V){Ue(e,V)||(Ll(e,V),le(V))},start:function(V){return Al(e,V)},drop:Wt(e,_l),leave:function(V){Ue(e,V)||os(e)}};var z=t.input.getField();Te(z,"keyup",function(V){return vs.call(e,V)}),Te(z,"keydown",Wt(e,gs)),Te(z,"keypress",Wt(e,ys)),Te(z,"focus",function(V){return Ta(e,V)}),Te(z,"blur",function(V){return Dn(e,V)})}var Ha=[];Pt.defineInitHook=function(e){return Ha.push(e)};function Ci(e,t,n,r){var i=e.doc,C;n==null&&(n="add"),n=="smart"&&(i.mode.indent?C=tn(e,t).state:n="prev");var j=e.options.tabSize,z=ot(i,t),V=H(z.text,null,j);z.stateAfter&&(z.stateAfter=null);var Y=z.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(z.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(C,z.text.slice(Y.length),z.text),oe==ye||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=H(ot(i,t-1).text,null,j):oe=0:n=="add"?oe=V+e.options.indentUnit:n=="subtract"?oe=V-e.options.indentUnit:typeof n=="number"&&(oe=V+n),oe=Math.max(0,oe);var ue="",xe=0;if(e.options.indentWithTabs)for(var be=Math.floor(oe/j);be;--be)xe+=j,ue+=" ";if(xe<oe&&(ue+=me(oe-xe)),ue!=Y)return In(i,ue,Fe(t,0),Fe(t,Y.length),"+input"),z.stateAfter=null,!0;for(var Me=0;Me<i.sel.ranges.length;Me++){var Ne=i.sel.ranges[Me];if(Ne.head.line==t&&Ne.head.ch<Y.length){var Ke=Fe(t,Y.length);Ia(i,Me,new St(Ke,Ke));break}}}var Er=null;function ta(e){Er=e}function Ka(e,t,n,r,i){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var j=+new Date-200,z=i=="paste"||e.state.pasteIncoming>j,V=st(t),Y=null;if(z&&r.ranges.length>1)if(Er&&Er.text.join(`
|
|
`)==t){if(r.ranges.length%Er.text.length==0){Y=[];for(var oe=0;oe<Er.text.length;oe++)Y.push(C.splitLines(Er.text[oe]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=ie(V,function(Qe){return[Qe]}));for(var ue=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var be=r.ranges[xe],Me=be.from(),Ne=be.to();be.empty()&&(n&&n>0?Me=Fe(Me.line,Me.ch-n):e.state.overwrite&&!z?Ne=Fe(Ne.line,Math.min(ot(C,Ne.line).text.length,Ne.ch+$(V).length)):z&&Er&&Er.lineWise&&Er.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Me=Ne=Fe(Me.line,0)));var Ke={from:Me,to:Ne,text:Y?Y[xe%Y.length]:V,origin:i||(z?"paste":e.state.cutIncoming>j?"cut":"+input")};kn(e.doc,Ke),Lt(e,"inputRead",e,Ke)}t&&!z&&_s(e,t),On(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&sr(t,function(){return Ka(t,n,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var C=e.getModeAt(i.head),j=!1;if(C.electricChars){for(var z=0;z<C.electricChars.length;z++)if(t.indexOf(C.electricChars.charAt(z))>-1){j=Ci(e,i.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(ot(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Ci(e,i.head.line,"smart")));j&&Lt(e,"electricInput",e,i.head.line)}}function As(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,C={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:n}}function Ls(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ds(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),Ls(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var C=this.options,j=C[r];if(C[r]==i&&r!="mode")return;C[r]=i,t.hasOwnProperty(r)&&Wt(this,t[r])(this,i,j),_e(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,C=0;C<i.length;++C)if(i[C]==r||i[C].name==r)return i.splice(C,1),!0},addOverlay:qt(function(r,i){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");te(this.state.overlays,{mode:C,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,C=0;C<i.length;++C){var j=i[C].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(C,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,C){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Nr(this.doc,r)&&Ci(this,r,i,C)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,C=-1,j=0;j<i.length;j++){var z=i[j];if(z.empty())z.head.line>C&&(Ci(this,z.head.line,r,!0),C=z.head.line,j==this.doc.sel.primIndex&&On(this));else{var V=z.from(),Y=z.to(),oe=Math.max(C,V.line);C=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var ue=oe;ue<C;++ue)Ci(this,ue,r);var xe=this.doc.sel.ranges;V.ch==0&&i.length==xe.length&&xe[j].from().ch>0&&Ia(this.doc,j,new St(V,xe[j].to()),pe)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=He(this,ot(this.doc,r.line)),C=0,j=(i.length-1)/2,z=r.ch,V;if(z==0)V=i[2];else for(;;){var Y=C+j>>1;if((Y?i[Y*2-1]:0)>=z)j=Y;else if(i[Y*2+1]<z)C=Y+1;else{V=i[Y*2+2];break}}var oe=V?V.indexOf("overlay "):-1;return oe<0?V:oe==0?null:V.slice(0,oe-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 C=[];if(!n.hasOwnProperty(i))return C;var j=n[i],z=this.getModeAt(r);if(typeof z[i]=="string")j[z[i]]&&C.push(j[z[i]]);else if(z[i])for(var V=0;V<z[i].length;V++){var Y=j[z[i][V]];Y&&C.push(Y)}else z.helperType&&j[z.helperType]?C.push(j[z.helperType]):j[z.name]&&C.push(j[z.name]);for(var oe=0;oe<j._global.length;oe++){var ue=j._global[oe];ue.pred(z,this)&&ee(C,ue.val)==-1&&C.push(ue.val)}return C},getStateAfter:function(r,i){var C=this.doc;return r=_i(C,r==null?C.first+C.size-1:r),tn(this,r+1,i).state},cursorCoords:function(r,i){var C,j=this.doc.sel.primary();return r==null?C=j.head:typeof r=="object"?C=ht(this.doc,r):C=r?j.from():j.to(),yr(this,C,i||"page")},charCoords:function(r,i){return ma(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=co(this,r,i||"page"),ga(this,r.left,r.top)},lineAtHeight:function(r,i){return r=co(this,{top:r,left:0},i||"page").top,Dr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,C){var j=!1,z;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,j=!0),z=ot(this.doc,r)}else z=r;return Ni(this,z,{top:0,left:0},i||"page",C||j).top+(j?this.doc.height-vr(z):0)},defaultTextHeight:function(){return An(this.display)},defaultCharWidth:function(){return Ln(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,C,j,z){var V=this.display;r=yr(this,ht(this.doc,r));var Y=r.bottom,oe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),j=="over")Y=r.top;else if(j=="above"||j=="near"){var ue=Math.max(V.wrapper.clientHeight,this.doc.height),xe=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(Y=r.bottom),oe+i.offsetWidth>xe&&(oe=xe-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",z=="right"?(oe=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(z=="left"?oe=0:z=="middle"&&(oe=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),C&&Qs(this,{left:oe,top:Y,right:oe+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:qt(gs),triggerOnKeyPress:qt(ys),triggerOnKeyUp:vs,triggerOnMouseDown:qt(bs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:qt(function(r){_s(this,r)}),findPosH:function(r,i,C,j){var z=1;i<0&&(z=-1,i=-i);for(var V=ht(this.doc,r),Y=0;Y<i&&!(V=Ga(this.doc,V,z,C,j),V.hitSide);++Y);return V},moveH:qt(function(r,i){var C=this;this.extendSelectionsBy(function(j){return C.display.shift||C.doc.extend||j.empty()?Ga(C.doc,j.head,r,i,C.options.rtlMoveVisually):r<0?j.from():j.to()},fe)}),deleteH:qt(function(r,i){var C=this.doc.sel,j=this.doc;C.somethingSelected()?j.replaceSelection("",null,"+delete"):Fn(this,function(z){var V=Ga(j,z.head,r,i,!1);return r<0?{from:V,to:z.head}:{from:z.head,to:V}})}),findPosV:function(r,i,C,j){var z=1,V=j;i<0&&(z=-1,i=-i);for(var Y=ht(this.doc,r),oe=0;oe<i;++oe){var ue=yr(this,Y,"div");if(V==null?V=ue.left:ue.left=V,Y=Os(this,ue,z,C),Y.hitSide)break}return Y},moveV:qt(function(r,i){var C=this,j=this.doc,z=[],V=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(oe){if(V)return r<0?oe.from():oe.to();var ue=yr(C,oe.head,"div");oe.goalColumn!=null&&(ue.left=oe.goalColumn),z.push(ue.left);var xe=Os(C,ue,r,i);return i=="page"&&oe==j.sel.primary()&&wa(C,ma(C,xe,"div").top-ue.top),xe},fe),z.length)for(var Y=0;Y<j.sel.ranges.length;Y++)j.sel.ranges[Y].goalColumn=z[Y]}),findWordAt:function(r){var i=this.doc,C=ot(i,r.line).text,j=r.ch,z=r.ch;if(C){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||z==C.length)&&j?--j:++z;for(var Y=C.charAt(j),oe=Ae(Y,V)?function(ue){return Ae(ue,V)}:/\s/.test(Y)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Ae(ue)};j>0&&oe(C.charAt(j-1));)--j;for(;z<C.length&&oe(C.charAt(z));)++z}return new St(Fe(r.line,j),Fe(r.line,z))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),_e(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Cr(this)-this.display.barHeight,width:r.scrollWidth-Cr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:ln(this)}},scrollIntoView:qt(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?Js(this,r):To(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var C=this,j=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&so(this);var z=this.display.viewFrom;this.doc.iter(z,this.display.viewTo,function(V){if(V.widgets){for(var Y=0;Y<V.widgets.length;Y++)if(V.widgets[Y].noHScroll){zr(C,z,"widget");break}}++z}),this.curOp.forceUpdate=!0,_e(this,"refresh",this)}),operation:function(r){return sr(this,r)},startOperation:function(){return mn(this)},endOperation:function(){return pn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(r==null||Math.abs(r-An(this.display))>.5||this.options.lineWrapping)&&Ea(this),_e(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Uo(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Lt(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}},ce(e),e.registerHelper=function(r,i,C){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=C},e.registerGlobalHelper=function(r,i,C,j){e.registerHelper(r,i,j),n[r]._global.push({pred:C,val:j})}}function Ga(e,t,n,r,i){var C=t,j=n,z=ot(e,t.line),V=i&&e.direction=="rtl"?-n:n;function Y(){var tt=t.line+V;return tt<e.first||tt>=e.first+e.size?!1:(t=new Fe(tt,t.ch,t.sticky),z=ot(e,tt))}function oe(tt){var Je;if(r=="codepoint"){var nt=z.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(nt)?Je=null:Je=new Fe(t.line,Math.max(0,Math.min(z.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else i?Je=kl(e.cm,z,t,n):Je=Na(z,t,n);if(Je==null)if(!tt&&Y())t=Fa(i,e.cm,z,t.line,V);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var ue=null,xe=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Me=!0;!(n<0&&!oe(!Me));Me=!1){var Ne=z.text.charAt(t.ch)||`
|
|
`,Ke=Ae(Ne,be)?"w":xe&&Ne==`
|
|
`?"n":!xe||/\s/.test(Ne)?null:"p";if(xe&&!Me&&!Ke&&(Ke="s"),ue&&ue!=Ke){n<0&&(n=1,oe(),t.sticky="after");break}if(Ke&&(ue=Ke),n>0&&!oe(!Me))break}var Qe=$i(e,t,C,j,!0);return qr(C,Qe)&&(Qe.hitSide=!0),Qe}function Os(e,t,n,r){var i=e.doc,C=t.left,j;if(r=="page"){var z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(z-.5*An(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var Y;!(Y=ga(e,C,j),!Y.outside);){if(n<0?j<=0:j>=i.height){Y.hitSide=!0;break}j+=n*5}return Y}var Ct=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};Ct.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Ls(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(z){for(var V=z.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Te(i,"paste",function(z){if(!C(z)||Ue(r,z)||Cs(z,r))return;I<=11&&setTimeout(Wt(r,function(){return t.updateFromDOM()}),20)}),Te(i,"compositionstart",function(z){t.composing={data:z.data,done:!1}}),Te(i,"compositionupdate",function(z){t.composing||(t.composing={data:z.data,done:!1})}),Te(i,"compositionend",function(z){t.composing&&(z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Te(i,"touchstart",function(){return n.forceCompositionEnd()}),Te(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(z){if(!C(z)||Ue(r,z))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),z.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=As(r);ta({lineWise:!0,text:V.text}),z.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(z.clipboardData){z.clipboardData.clearData();var Y=Er.text.join(`
|
|
`);if(z.clipboardData.setData("Text",Y),z.clipboardData.getData("Text")==Y){z.preventDefault();return}}var oe=Ds(),ue=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),ue.value=Er.text.join(`
|
|
`);var xe=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(oe),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Te(i,"copy",j),Te(i,"cut",j)},Ct.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ct.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ct.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ct.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ct.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 C=ra(t,e.anchorNode,e.anchorOffset),j=ra(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&j&&!j.bad&&ft(en(C,j),r)==0&&ft(xn(C,j),i)==0)return;var z=t.display.view,V=r.line>=t.display.viewFrom&&Rs(t,r)||{node:z[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Rs(t,i);if(!Y){var oe=z[z.length-1].measure,ue=oe.maps?oe.maps[oe.maps.length-1]:oe.map;Y={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!V||!Y){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),be;try{be=y(V.node,V.offset,Y.offset,Y.node)}catch(Me){}be&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},Ct.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)},Ct.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Ct.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ct.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return p(this.div,t)},Ct.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ct.prototype.blur=function(){this.div.blur()},Ct.prototype.getField=function(){return this.div},Ct.prototype.supportsTouch=function(){return!0},Ct.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():sr(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)},Ct.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ct.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&h&&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=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&sr(t,function(){Qt(t.doc,Xr(n,r),pe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ct.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,ot(e.doc,r.line-1).length)),i.ch==ot(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 C,j,z;r.line==t.viewFrom||(C=cn(e,r.line))==0?(j=Tt(t.view[0].line),z=t.view[0].node):(j=Tt(t.view[C].line),z=t.view[C-1].node.nextSibling);var V=cn(e,i.line),Y,oe;if(V==t.view.length-1?(Y=t.viewTo-1,oe=t.lineDiv.lastChild):(Y=Tt(t.view[V+1].line)-1,oe=t.view[V+1].node.previousSibling),!z)return!1;for(var ue=e.doc.splitLines(tu(e,z,oe,j,Y)),xe=Lr(e.doc,Fe(j,0),Fe(Y,ot(e.doc,Y).text.length));ue.length>1&&xe.length>1;)if($(ue)==$(xe))ue.pop(),xe.pop(),Y--;else if(ue[0]==xe[0])ue.shift(),xe.shift(),j++;else break;for(var be=0,Me=0,Ne=ue[0],Ke=xe[0],Qe=Math.min(Ne.length,Ke.length);be<Qe&&Ne.charCodeAt(be)==Ke.charCodeAt(be);)++be;for(var tt=$(ue),Je=$(xe),nt=Math.min(tt.length-(ue.length==1?be:0),Je.length-(xe.length==1?be:0));Me<nt&&tt.charCodeAt(tt.length-Me-1)==Je.charCodeAt(Je.length-Me-1);)++Me;if(ue.length==1&&xe.length==1&&j==r.line)for(;be&&be>r.ch&&tt.charCodeAt(tt.length-Me-1)==Je.charCodeAt(Je.length-Me-1);)be--,Me++;ue[ue.length-1]=tt.slice(0,tt.length-Me).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var ct=Fe(j,be),lt=Fe(Y,xe.length?$(xe).length-Me:0);if(ue.length>1||ue[0]||ft(ct,lt))return In(e.doc,ue,ct,lt,"+input"),!0},Ct.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ct.prototype.reset=function(){this.forceCompositionEnd()},Ct.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ct.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)},Ct.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&sr(this.cm,function(){return tr(e.cm)})},Ct.prototype.setUneditable=function(e){e.contentEditable="false"},Ct.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Wt(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ct.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ct.prototype.onContextMenu=function(){},Ct.prototype.resetPosition=function(){},Ct.prototype.needsContentAttribute=!0;function Rs(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var r=ot(e.doc,t.line),i=ro(n,r,t.line),C=Ye(r,e.doc.direction),j="left";if(C){var z=je(C,t.ch);j=z%2?"right":"left"}var V=ao(i.map,t.ch,j);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function jn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var C="",j=!1,z=e.doc.lineSeparator(),V=!1;function Y(be){return function(Me){return Me.id==be}}function oe(){j&&(C+=z,V&&(C+=z),j=V=!1)}function ue(be){be&&(oe(),C+=be)}function xe(be){if(be.nodeType==1){var Me=be.getAttribute("cm-text");if(Me){ue(Me);return}var Ne=be.getAttribute("cm-marker"),Ke;if(Ne){var Qe=e.findMarks(Fe(r,0),Fe(i+1,0),Y(+Ne));Qe.length&&(Ke=Qe[0].find(0))&&ue(Lr(e.doc,Ke.from,Ke.to).join(z));return}if(be.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;tt&&oe();for(var Je=0;Je<be.childNodes.length;Je++)xe(be.childNodes[Je]);/^(pre|p)$/i.test(be.nodeName)&&(V=!0),tt&&(j=!0)}else be.nodeType==3&&ue(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,V=!1;return C}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return jn(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 C=e.display.view[i];if(C.node==r)return ru(C,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!p(r,t))return jn(Fe(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var C=e.rest?$(e.rest):e.line;return jn(Fe(Tt(C),C.text.length),i)}var j=t.nodeType==3?t:null,z=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));z.parentNode!=r;)z=z.parentNode;var V=e.measure,Y=V.maps;function oe(Ke,Qe,tt){for(var Je=-1;Je<(Y?Y.length:0);Je++)for(var nt=Je<0?V.map:Y[Je],ct=0;ct<nt.length;ct+=3){var lt=nt[ct+2];if(lt==Ke||lt==Qe){var vt=Tt(Je<0?e.line:e.rest[Je]),Dt=nt[ct]+tt;return(tt<0||lt!=Ke)&&(Dt=nt[ct+(tt?1:0)]),Fe(vt,Dt)}}}var ue=oe(j,z,n);if(ue)return jn(ue,i);for(var xe=z.nextSibling,be=j?j.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(ue=oe(xe,xe.firstChild,0),ue)return jn(Fe(ue.line,ue.ch-be),i);be+=xe.textContent.length}for(var Me=z.previousSibling,Ne=n;Me;Me=Me.previousSibling){if(ue=oe(Me,Me.firstChild,-1),ue)return jn(Fe(ue.line,ue.ch+Ne),i);Ne+=Me.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Ut.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),v&&(i.style.width="0px"),Te(i,"input",function(){F&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Te(i,"paste",function(j){if(Ue(r,j)||Cs(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function C(j){if(Ue(r,j))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var z=As(r);ta({lineWise:!0,text:z.text}),j.type=="cut"?r.setSelections(z.ranges,null,pe):(n.prevInput="",i.value=z.text.join(`
|
|
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Te(i,"cut",C),Te(i,"copy",C),Te(e.scroller,"paste",function(j){if(Pr(e,j)||Ue(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var z=new Event("paste");z.clipboardData=j.clipboardData,i.dispatchEvent(z)}),Te(e.lineSpace,"selectstart",function(j){Pr(e,j)||Q(j)}),Te(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Te(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Ds(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var i=yr(e,n.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-C.left))}return r},Ut.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")},Ut.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),F&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&I>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.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()})},Ut.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)},Ut.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||it(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(F&&I>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=i.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,z=Math.min(r.length,i.length);j<z&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return sr(t,function(){Ka(t,i.slice(j),r.length-j,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},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){F&&I>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=dn(n,e),j=r.scroller.scrollTop;if(!C||g)return;var z=n.options.resetSelectionOnContextMenu;z&&n.doc.sel.contains(C)==-1&&Wt(n,Qt)(n.doc,Xr(C),pe);var V=i.style.cssText,Y=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.left-5)+`px;
|
|
z-index: 1000; background: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;R&&(ue=window.scrollY),r.input.focus(),R&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ne=n.somethingSelected(),Ke="\u200B"+(Ne?i.value:"");i.value="\u21DA",i.value=Ke,t.prevInput=Ne?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ke.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=V,F&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!F||F&&I<9)&&xe();var Ne=0,Ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Wt(n,$o)(n):Ne++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(F&&I>=9&&xe(),A){le(e);var Me=function(){Ge(window,"mouseup",Me),setTimeout(be,20)};Te(window,"mouseup",Me)}else setTimeout(be,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?k(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=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=z.getValue()}var i;if(e.form&&(Te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var C=e.form;i=C.submit;try{var j=C.submit=function(){r(),C.submit=i,C.submit(),C.submit=j}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&(Ge(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var z=Pt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return z}function iu(e){e.off=Ge,e.on=Te,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=st,e.countColumn=H,e.findColumn=de,e.isWordChar=we,e.Pass=ye,e.signal=_e,e.Line=Gr,e.changeEnd=Yr,e.scrollbarModel=Co,e.Pos=Fe,e.cmpPos=ft,e.modes=Ot,e.mimeModes=pt,e.resolveMode=or,e.getMode=Ir,e.modeExtensions=cr,e.extendMode=yn,e.copyState=Tr,e.startState=Kn,e.innerMode=Ur,e.commands=xi,e.keyMap=Mr,e.keyName=cs,e.isModifierKey=us,e.lookupKey=Nn,e.normalizeKeyMap=Ml,e.StringStream=kt,e.SharedTextMarker=yi,e.TextMarker=Qr,e.LineWidget=vi,e.e_preventDefault=Q,e.e_stopPropagation=q,e.e_stop=le,e.addClass=U,e.contains=p,e.rmClass=m,e.keyNames=Jr}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&ee(au,na)<0&&(Pt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return ce(rr),Pt.inputStyles={textarea:Ut,contenteditable:Ct},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),zt.apply(this,arguments)},Pt.defineMIME=xr,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){rr.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(et,We,J){"use strict";J.r(We),J.d(We,"ResizableTextArea",function(){return ee});var Z=J("wx14"),G=J("1OyB"),L=J("vuIU"),K=J("Ji7U"),N=J("LK+K"),O=J("cDcd"),F=J("VTBJ"),I=J("rePB"),R=J("Zm9Q"),S=J("Kwbf"),h=J("c+Xe"),g=J("m+aA"),P=J("bdgK"),w=new Map;function E(pe){pe.forEach(function(he){var fe,de=he.target;(fe=w.get(de))===null||fe===void 0||fe.forEach(function(ne){return ne(de)})})}var v=new P.default(E),d=null,a=null;function l(pe,he){w.has(pe)||(w.set(pe,new Set),v.observe(pe)),w.get(pe).add(he)}function s(pe,he){w.has(pe)&&(w.get(pe).delete(he),w.get(pe).size||(v.unobserve(pe),w.delete(pe)))}var _=function(pe){Object(K.a)(fe,pe);var he=Object(N.a)(fe);function fe(){return Object(G.a)(this,fe),he.apply(this,arguments)}return Object(L.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(O.Component),b=O.createContext(null);function f(pe){var he=pe.children,fe=pe.onBatchResize,de=O.useRef(0),ne=O.useRef([]),me=O.useContext(b),$=O.useCallback(function(ie,te,Ee){de.current+=1;var Ce=de.current;ne.current.push({size:ie,element:te,data:Ee}),Promise.resolve().then(function(){Ce===de.current&&(fe==null||fe(ne.current),ne.current=[])}),me==null||me(ie,te,Ee)},[fe,me]);return O.createElement(b.Provider,{value:$},he)}function A(pe){var he=pe.children,fe=pe.disabled,de=O.useRef(null),ne=O.useRef(null),me=O.useContext(b),$=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=O.isValidElement(he)&&Object(h.c)(he),te=ie?he.ref:null,Ee=O.useMemo(function(){return Object(h.a)(te,de)},[te,de]),Ce=O.useRef(pe);Ce.current=pe;var ve=O.useCallback(function(we){var Ae=Ce.current,De=Ae.onResize,Ie=Ae.data,Le=we.getBoundingClientRect(),Oe=Le.width,Xe=Le.height,Ze=we.offsetWidth,Be=we.offsetHeight,je=Math.floor(Oe),rt=Math.floor(Xe);if($.current.width!==je||$.current.height!==rt||$.current.offsetWidth!==Ze||$.current.offsetHeight!==Be){var Ye={width:je,height:rt,offsetWidth:Ze,offsetHeight:Be};$.current=Ye;var qe=Ze===Math.round(Oe)?Oe:Ze,Te=Be===Math.round(Xe)?Xe:Be,$e=Object(F.a)(Object(F.a)({},Ye),{},{offsetWidth:qe,offsetHeight:Te});me==null||me($e,we,Ie),De&&Promise.resolve().then(function(){De($e,we)})}},[]);return O.useEffect(function(){var we=Object(g.a)(de.current)||Object(g.a)(ne.current);return we&&!fe&&l(we,ve),function(){return s(we,ve)}},[de.current,fe]),O.createElement(_,{ref:ne},ie?O.cloneElement(he,{ref:Ee}):he)}var T="rc-observer-key";function m(pe){var he=pe.children,fe=Object(R.a)(he);return fe.map(function(de,ne){var me=(de==null?void 0:de.key)||"".concat(T,"-").concat(ne);return O.createElement(A,Object(Z.a)({},pe,{key:me}),de)})}m.Collection=f;var c=m,u=J("bT9E"),o=J("TSYQ"),x=J.n(o),y=`
|
|
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
|
|
`,p=["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"],D={},U;function B(pe){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(he&&D[fe])return D[fe];var de=window.getComputedStyle(pe),ne=de.getPropertyValue("box-sizing")||de.getPropertyValue("-moz-box-sizing")||de.getPropertyValue("-webkit-box-sizing"),me=parseFloat(de.getPropertyValue("padding-bottom"))+parseFloat(de.getPropertyValue("padding-top")),$=parseFloat(de.getPropertyValue("border-bottom-width"))+parseFloat(de.getPropertyValue("border-top-width")),ie=p.map(function(Ee){return"".concat(Ee,":").concat(de.getPropertyValue(Ee))}).join(";"),te={sizingStyle:ie,paddingSize:me,borderSize:$,boxSizing:ne};return he&&fe&&(D[fe]=te),te}function W(pe){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,de=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),pe.getAttribute("wrap")?U.setAttribute("wrap",pe.getAttribute("wrap")):U.removeAttribute("wrap");var ne=B(pe,he),me=ne.paddingSize,$=ne.borderSize,ie=ne.boxSizing,te=ne.sizingStyle;U.setAttribute("style","".concat(te,";").concat(y)),U.value=pe.value||pe.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ve=U.scrollHeight,we;if(ie==="border-box"?ve+=$:ie==="content-box"&&(ve-=me),fe!==null||de!==null){U.value=" ";var Ae=U.scrollHeight-me;fe!==null&&(Ee=Ae*fe,ie==="border-box"&&(Ee=Ee+me+$),ve=Math.max(Ee,ve)),de!==null&&(Ce=Ae*de,ie==="border-box"&&(Ce=Ce+me+$),we=ve>Ce?"":"hidden",ve=Math.min(Ce,ve))}return{height:ve,minHeight:Ee,maxHeight:Ce,overflowY:we,resize:"none"}}var M=J("Gytx"),k=J.n(M),H;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(pe){Object(K.a)(fe,pe);var he=Object(N.a)(fe);function fe(de){var ne;return Object(G.a)(this,fe),ne=he.call(this,de),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(me){ne.textArea=me},ne.handleResize=function(me){var $=ne.state.resizeStatus,ie=ne.props,te=ie.autoSize,Ee=ie.onResize;if($!==H.NONE)return;typeof Ee=="function"&&Ee(me),te&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var me=ne.props.autoSize;if(!me||!ne.textArea)return;var $=me.minRows,ie=me.maxRows,te=W(ne.textArea,!1,$,ie);ne.setState({textareaStyles:te,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var me=ne.props,$=me.prefixCls,ie=$===void 0?"rc-textarea":$,te=me.autoSize,Ee=me.onResize,Ce=me.className,ve=me.disabled,we=ne.state,Ae=we.textareaStyles,De=we.resizeStatus,Ie=Object(u.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Le=x()(ie,Ce,Object(I.a)({},"".concat(ie,"-disabled"),ve));"value"in Ie&&(Ie.value=Ie.value||"");var Oe=Object(F.a)(Object(F.a)(Object(F.a)({},ne.props.style),Ae),De===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:ne.handleResize,disabled:!(te||Ee)},O.createElement("textarea",Object(Z.a)({},Ie,{className:Le,style:Oe,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:H.NONE},ne}return Object(L.a)(fe,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!k()(ne.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 ne=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,me)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(O.Component),ee=X,ae=function(pe){Object(K.a)(fe,pe);var he=Object(N.a)(fe);function fe(de){var ne;Object(G.a)(this,fe),ne=he.call(this,de),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function($){ne.resizableTextArea=$},ne.handleChange=function($){var ie=ne.props.onChange;ne.setValue($.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ie&&ie($)},ne.handleKeyDown=function($){var ie=ne.props,te=ie.onPressEnter,Ee=ie.onKeyDown;$.keyCode===13&&te&&te($),Ee&&Ee($)};var me=typeof de.value=="undefined"||de.value===null?de.defaultValue:de.value;return ne.state={value:me},ne}return Object(L.a)(fe,[{key:"setValue",value:function(ne,me){"value"in this.props||this.setState({value:ne},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(ee,Object(Z.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),fe}(O.Component),ye=We.default=ae},ZW9T:function(et,We,J){"use strict";J.d(We,"a",function(){return b});var Z=J("k1fw"),G=J("miYZ"),L=J("tsqr"),K=J("rAM+"),N=J("tJVT"),O=J("PpiC"),F=J("cDcd"),I=J.n(F),R=J("bdgK");function S(f,A,T,m,c){var u=A.getWordUntilPosition(T),o={startLineNumber:T.lineNumber,endLineNumber:T.lineNumber,startColumn:u.startColumn,endColumn:u.endColumn},x=m.map(function(y){return{label:y,kind:f.languages.CompletionItemKind.Keyword,insertText:y,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return c.map(function(y){x.push(Object(Z.a)(Object(Z.a)({},y),{},{range:o}))}),x}var h=function(f){var A={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},T=["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(o,x){var y=S(f,o,x,T,[A]);return{suggestions:y}}});var m=["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(o,x){var y=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=S(f,o,x,m,y);return{suggestions:p}}});var c=["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(o,x){var y=[A,{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=S(f,o,x,c,y);return{suggestions:p}}})},g="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=J("LvDl"),w=J("+ua5");function E(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function v(){}var d=!1,a={"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 l(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],A=f;if(Array.isArray(f)){for(var T=0;T<f.length;T++){var m=a[f[T]];if(m)return m}return A[0]}return a[A]||A}var s=null,_=We.b=function(f){var A=f.width,T=A===void 0?"100%":A,m=f.height,c=m===void 0?"100%":m,u=f.value,o=f.language,x=o===void 0?"javascript":o,y=f.style,p=y===void 0?{}:y,D=f.options,U=D===void 0?{}:D,B=f.overrideServices,W=B===void 0?{}:B,M=f.theme,k=M===void 0?"vs-dark":M,H=f.onEditBlur,X=f.onSave,ee=f.autoHeight,ae=ee===void 0?!1:ee,ye=f.forbidCopy,pe=ye===void 0?!1:ye,he=f.onChange,fe=he===void 0?v:he,de=f.editorDidMount,ne=de===void 0?v:de,me=f.onFocus,$=me===void 0?v:me,ie=f.filename,te=ie===void 0?"educoder.txt":ie,Ee=f.errorLine,Ce=f.errorContent,ve=Ce===void 0?"":Ce,we=Object(O.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ae=Object(F.useRef)(),De=Object(F.useRef)({}),Ie=Object(F.useRef)(),Le=Object(F.useRef)(!1),Oe=Object(F.useRef)(),Xe=Object(F.useState)(!1),Ze=Object(N.a)(Xe,2),Be=Ze[0],je=Ze[1];function rt(){var Pe;return Ae.current&&(Pe=new R.default(function(Ve){var ke=Object(K.a)(Ve),ze;try{for(ke.s();!(ze=ke.n()).done;){var ut=ze.value;(ut.target.offsetHeight>0||ut.target.offsetWidth>0)&&De.current.instance.layout()}}catch(st){ke.e(st)}finally{ke.f()}}),Pe.observe(Ae.current)),Pe}function Ye(){L.b.warn(decodeURIComponent(g))}var qe=function(){var Ve=De.current.instance;if(u!=null&&Ve&&Be){var ke=Ve.getModel();ke&&u!==ke.getValue()&&(d=!0,ke.setValue(u),Ve.layout(),d=!1)}};Object(F.useEffect)(function(){Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(function(){qe()},500)},[u,Be,De.current]),Object(F.useEffect)(function(){if(Ee&&De.current&&De.current.instance){var Pe=De.current.instance;Pe.changeViewZones(function(ke){var ze=document.createElement("div");ze.style.padding="10px 20px",ze.style.width="calc(100% - 20px)",ze.className="my-error-line-wrp",ze.innerHTML=ve,ke.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:ze})});var Ve={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Pe.addOverlayWidget(Ve),Pe.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,De.current,Be]);function Te(){var Pe=De.current.instance;if(Pe){var Ve=Pe.getSelection(),ke=De.current.pastePos||{},ze=new s.Range(ke.startLineNumber||Ve.endLineNumber,ke.startColumn||Ve.endColumn,ke.endLineNumber||Ve.endLineNumber,ke.endColumn||Ve.endColumn);setTimeout(function(){Pe.executeEdits("",[{range:ze,text:""}])},300)}}function $e(Pe){(window.navigator.platform.match("Mac")?Pe.metaKey:Pe.ctrlKey)&&Pe.keyCode==83&&(Pe.preventDefault(),X())}var Ge=function(){if(ae&&De.current.instance){var Ve=De.current.instance.getContentHeight();Se(Ve<c?c:Ve)}else Se(c)};function _e(Pe){var Ve=document.createEvent("MouseEvents");Ve.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Pe.dispatchEvent(Ve)}function Ue(Pe,Ve){var ke=window.URL||window.webkitURL||window,ze=new Blob([Ve]),ut=document.createElementNS("http://www.w3.org/1999/xhtml","a");ut.href=ke.createObjectURL(ze),ut.download=Pe,_e(ut)}Object(F.useEffect)(function(){Ge()},[Ge]),Object(F.useEffect)(function(){Ae.current&&!Be&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(Pe){try{s=Pe,De.current.instance=s.editor.create(Ae.current,{value:u,language:l(x),theme:k,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ve=De.current.instance;if(ne(Ve,s),setTimeout(function(){Ge(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ue(te||"educoder.txt",Ve.getValue())}})},500),De.current.subscription=Ve.onDidChangeModelContent(function(ze){Le.current?clearTimeout(Oe.current):(Ge(),fe(Ve.getValue(),ze)),Oe.current=setTimeout(function(){Le.current=!1},500)}),window.Monaco||h(s),pe&&(Ve.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ye(),null}),Ve.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ye(),null})),window.Monaco=s,H&&Ve.onDidBlurEditorWidget(function(){H(Ve.getValue())}),$&&Ve.onDidFocusEditorText(function(){$(Ve.getValue())}),pe){Ve.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ye(),null}),Ve.onDidPaste(function(ze){De.current.pastePos=ze});try{window.addEventListener("paste",Te)}catch(ze){}}var ke=rt();return je(!0),function(){var ze=De.current.instance;ze.dispose();var ut=ze.getModel();ut&&ut.dispose(),De.current.subscription&&De.current.subscription.dispose(),pe&&window.removeEventListener("paste",Te),ke.unobserve(Ae.current)}}catch(ze){}})},[]),Object(F.useEffect)(function(){var Pe=De.current.instance;if(Pe&&Be)return document.addEventListener("keydown",$e,!1),function(){document.removeEventListener("keydown",$e)}},[X,Be]),Object(F.useEffect)(function(){var Pe=De.current.instance;if(Pe&&Be){var Ve=l(x);s.editor.setModelLanguage(Pe.getModel(),Ve),console.log("language:",x,Pe.getModel(),Ve)}},[x,Be]),Object(F.useEffect)(function(){var Pe=De.current.instance;Pe&&Be&&s.editor.setTheme(k)},[k,Be]),Object(F.useEffect)(function(){var Pe=De.current.instance;Pe&&Be&&(Pe.updateOptions(Object(Z.a)({},U)),setTimeout(function(){Pe.getModel().updateOptions(Object(Z.a)({},U))},200))},[JSON.stringify(U),Be]),Object(F.useEffect)(function(){var Pe=De.current.instance;Pe&&Be&&Pe.layout()},[T,c,Be]);var ge=Object(F.useState)(E(T)),se=Object(N.a)(ge,2),ce=se[0],Q=se[1],q=Object(F.useState)(E(c)),re=Object(N.a)(q,2),le=re[0],Se=re[1],Re=Object(Z.a)(Object(Z.a)({},p),{},{width:ce,height:le});return I.a.createElement("div",{className:"my-monaco-editor",ref:Ae,style:Re})};function b(f){var A=f.width,T=A===void 0?"100%":A,m=f.height,c=m===void 0?"100%":m,u=f.original,o=f.modified,x=f.language,y=f.options,p=y===void 0?{}:y,D=Object(F.useRef)(),U=Object(F.useState)(null),B=Object(N.a)(U,2),W=B[0],M=B[1];function k(ae){var ye;return D.current&&(ye=new R.default(function(pe){var he=Object(K.a)(pe),fe;try{for(he.s();!(fe=he.n()).done;){var de=fe.value;(de.target.offsetHeight>0||de.target.offsetWidth>0)&&ae.layout()}}catch(ne){he.e(ne)}finally{he.f()}}),ye.observe(D.current)),ye}Object(F.useEffect)(function(){D.current&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ae){s=ae;var ye=s.editor.createDiffEditor(D.current,Object(Z.a)(Object(Z.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}));M(ye);var pe=k(ye);return function(){ye.dispose();var he=ye.getModel();he&&he.dispose(),pe.unobserve(D.current)}})},[]),Object(F.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(u,x),modified:s.editor.createModel(o,x)})},[u,o,x,W]);var H=E(T),X=E(c),ee={width:H,height:X};return I.a.createElement("div",{className:"my-diff-editor",ref:D,style:ee})}},ZpRC:function(et,We,J){"use strict";function Z(h){return typeof h=="object"&&h!=null&&h.nodeType===1}function G(h,g){return(!g||h!=="hidden")&&h!=="visible"&&h!=="clip"}function L(h,g){if(h.clientHeight<h.scrollHeight||h.clientWidth<h.scrollWidth){var P=getComputedStyle(h,null);return G(P.overflowY,g)||G(P.overflowX,g)||function(w){var E=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(w);return!!E&&(E.clientHeight<w.scrollHeight||E.clientWidth<w.scrollWidth)}(h)}return!1}function K(h,g,P,w,E,v,d,a){return v<h&&d>g||v>h&&d<g?0:v<=h&&a<=P||d>=g&&a>=P?v-h-w:d>g&&a<P||v<h&&a>P?d-g+E:0}var N=function(h,g){var P=window,w=g.scrollMode,E=g.block,v=g.inline,d=g.boundary,a=g.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Ae){return Ae!==d};if(!Z(h))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,_=[],b=h;Z(b)&&l(b);){if((b=b.parentElement)===s){_.push(b);break}b!=null&&b===document.body&&L(b)&&!L(document.documentElement)||b!=null&&L(b,a)&&_.push(b)}for(var f=P.visualViewport?P.visualViewport.width:innerWidth,A=P.visualViewport?P.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,c=h.getBoundingClientRect(),u=c.height,o=c.width,x=c.top,y=c.right,p=c.bottom,D=c.left,U=E==="start"||E==="nearest"?x:E==="end"?p:x+u/2,B=v==="center"?D+o/2:v==="end"?y:D,W=[],M=0;M<_.length;M++){var k=_[M],H=k.getBoundingClientRect(),X=H.height,ee=H.width,ae=H.top,ye=H.right,pe=H.bottom,he=H.left;if(w==="if-needed"&&x>=0&&D>=0&&p<=A&&y<=f&&x>=ae&&p<=pe&&D>=he&&y<=ye)return W;var fe=getComputedStyle(k),de=parseInt(fe.borderLeftWidth,10),ne=parseInt(fe.borderTopWidth,10),me=parseInt(fe.borderRightWidth,10),$=parseInt(fe.borderBottomWidth,10),ie=0,te=0,Ee="offsetWidth"in k?k.offsetWidth-k.clientWidth-de-me:0,Ce="offsetHeight"in k?k.offsetHeight-k.clientHeight-ne-$:0;if(s===k)ie=E==="start"?U:E==="end"?U-A:E==="nearest"?K(m,m+A,A,ne,$,m+U,m+U+u,u):U-A/2,te=v==="start"?B:v==="center"?B-f/2:v==="end"?B-f:K(T,T+f,f,de,me,T+B,T+B+o,o),ie=Math.max(0,ie+m),te=Math.max(0,te+T);else{ie=E==="start"?U-ae-ne:E==="end"?U-pe+$+Ce:E==="nearest"?K(ae,pe,X,ne,$+Ce,U,U+u,u):U-(ae+X/2)+Ce/2,te=v==="start"?B-he-de:v==="center"?B-(he+ee/2)+Ee/2:v==="end"?B-ye+me+Ee:K(he,ye,ee,de,me+Ee,B,B+o,o);var ve=k.scrollLeft,we=k.scrollTop;U+=we-(ie=Math.max(0,Math.min(we+ie,k.scrollHeight-X+Ce))),B+=ve-(te=Math.max(0,Math.min(ve+te,k.scrollWidth-ee+Ee)))}W.push({el:k,top:ie,left:te})}return W};function O(h){return h===Object(h)&&Object.keys(h).length!==0}function F(h,g){g===void 0&&(g="auto");var P="scrollBehavior"in document.body.style;h.forEach(function(w){var E=w.el,v=w.top,d=w.left;E.scroll&&P?E.scroll({top:v,left:d,behavior:g}):(E.scrollTop=v,E.scrollLeft=d)})}function I(h){return h===!1?{block:"end",inline:"nearest"}:O(h)?h:{block:"start",inline:"nearest"}}function R(h,g){var P=!h.ownerDocument.documentElement.contains(h);if(O(g)&&typeof g.behavior=="function")return g.behavior(P?[]:N(h,g));if(P)return;var w=I(g);return F(N(h,w),w.behavior)}var S=We.a=R},Zss7:function(et,We,J){var Z;(function(G){var L=/^\s+/,K=/\s+$/,N=0,O=G.round,F=G.min,I=G.max,R=G.random;function S($,ie){if($=$||"",ie=ie||{},$ instanceof S)return $;if(!(this instanceof S))return new S($,ie);var te=h($);this._originalInput=$,this._r=te.r,this._g=te.g,this._b=te.b,this._a=te.a,this._roundA=O(100*this._a)/100,this._format=ie.format||te.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=te.ok,this._tc_id=N++}S.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 $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ie,te,Ee,Ce,ve,we;return ie=$.r/255,te=$.g/255,Ee=$.b/255,ie<=.03928?Ce=ie/12.92:Ce=G.pow((ie+.055)/1.055,2.4),te<=.03928?ve=te/12.92:ve=G.pow((te+.055)/1.055,2.4),Ee<=.03928?we=Ee/12.92:we=G.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ve+.0722*we},setAlpha:function($){return this._a=W($),this._roundA=O(100*this._a)/100,this},toHsv:function(){var $=E(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=E(this._r,this._g,this._b),ie=O($.h*360),te=O($.s*100),Ee=O($.v*100);return this._a==1?"hsv("+ie+", "+te+"%, "+Ee+"%)":"hsva("+ie+", "+te+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=P(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=P(this._r,this._g,this._b),ie=O($.h*360),te=O($.s*100),Ee=O($.l*100);return this._a==1?"hsl("+ie+", "+te+"%, "+Ee+"%)":"hsla("+ie+", "+te+"%, "+Ee+"%, "+this._roundA+")"},toHex:function($){return d(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return a(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(M(this._r,255)*100)+"%",g:O(M(this._g,255)*100)+"%",b:O(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%)":"rgba("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ie="#"+l(this._r,this._g,this._b,this._a),te=ie,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Ce=S($);te="#"+l(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ie+",endColorstr="+te+")"},toString:function($){var ie=!!$;$=$||this._format;var te=!1,Ee=this._a<1&&this._a>=0,Ce=!ie&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ce?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(te=this.toRgbString()),$==="prgb"&&(te=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(te=this.toHexString()),$==="hex3"&&(te=this.toHexString(!0)),$==="hex4"&&(te=this.toHex8String(!0)),$==="hex8"&&(te=this.toHex8String()),$==="name"&&(te=this.toName()),$==="hsl"&&(te=this.toHslString()),$==="hsv"&&(te=this.toHsvString()),te||this.toHexString())},clone:function(){return S(this.toString())},_applyModification:function($,ie){var te=$.apply(null,[this].concat([].slice.call(ie)));return this._r=te._r,this._g=te._g,this._b=te._b,this.setAlpha(te._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(_,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function($,ie){return $.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(p,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},S.fromRatio=function($,ie){if(typeof $=="object"){var te={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?te[Ee]=$[Ee]:te[Ee]=ye($[Ee]));$=te}return S($,ie)};function h($){var ie={r:0,g:0,b:0},te=1,Ee=null,Ce=null,ve=null,we=!1,Ae=!1;return typeof $=="string"&&($=ne($)),typeof $=="object"&&(de($.r)&&de($.g)&&de($.b)?(ie=g($.r,$.g,$.b),we=!0,Ae=String($.r).substr(-1)==="%"?"prgb":"rgb"):de($.h)&&de($.s)&&de($.v)?(Ee=ye($.s),Ce=ye($.v),ie=v($.h,Ee,Ce),we=!0,Ae="hsv"):de($.h)&&de($.s)&&de($.l)&&(Ee=ye($.s),ve=ye($.l),ie=w($.h,Ee,ve),we=!0,Ae="hsl"),$.hasOwnProperty("a")&&(te=$.a)),te=W(te),{ok:we,format:$.format||Ae,r:F(255,I(ie.r,0)),g:F(255,I(ie.g,0)),b:F(255,I(ie.b,0)),a:te}}function g($,ie,te){return{r:M($,255)*255,g:M(ie,255)*255,b:M(te,255)*255}}function P($,ie,te){$=M($,255),ie=M(ie,255),te=M(te,255);var Ee=I($,ie,te),Ce=F($,ie,te),ve,we,Ae=(Ee+Ce)/2;if(Ee==Ce)ve=we=0;else{var De=Ee-Ce;we=Ae>.5?De/(2-Ee-Ce):De/(Ee+Ce);switch(Ee){case $:ve=(ie-te)/De+(ie<te?6:0);break;case ie:ve=(te-$)/De+2;break;case te:ve=($-ie)/De+4;break}ve/=6}return{h:ve,s:we,l:Ae}}function w($,ie,te){var Ee,Ce,ve;$=M($,360),ie=M(ie,100),te=M(te,100);function we(Ie,Le,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?Ie+(Le-Ie)*6*Oe:Oe<1/2?Le:Oe<2/3?Ie+(Le-Ie)*(2/3-Oe)*6:Ie}if(ie===0)Ee=Ce=ve=te;else{var Ae=te<.5?te*(1+ie):te+ie-te*ie,De=2*te-Ae;Ee=we(De,Ae,$+1/3),Ce=we(De,Ae,$),ve=we(De,Ae,$-1/3)}return{r:Ee*255,g:Ce*255,b:ve*255}}function E($,ie,te){$=M($,255),ie=M(ie,255),te=M(te,255);var Ee=I($,ie,te),Ce=F($,ie,te),ve,we,Ae=Ee,De=Ee-Ce;if(we=Ee===0?0:De/Ee,Ee==Ce)ve=0;else{switch(Ee){case $:ve=(ie-te)/De+(ie<te?6:0);break;case ie:ve=(te-$)/De+2;break;case te:ve=($-ie)/De+4;break}ve/=6}return{h:ve,s:we,v:Ae}}function v($,ie,te){$=M($,360)*6,ie=M(ie,100),te=M(te,100);var Ee=G.floor($),Ce=$-Ee,ve=te*(1-ie),we=te*(1-Ce*ie),Ae=te*(1-(1-Ce)*ie),De=Ee%6,Ie=[te,we,ve,ve,Ae,te][De],Le=[Ae,te,te,we,ve,ve][De],Oe=[ve,ve,Ae,te,te,we][De];return{r:Ie*255,g:Le*255,b:Oe*255}}function d($,ie,te,Ee){var Ce=[ae(O($).toString(16)),ae(O(ie).toString(16)),ae(O(te).toString(16))];return Ee&&Ce[0].charAt(0)==Ce[0].charAt(1)&&Ce[1].charAt(0)==Ce[1].charAt(1)&&Ce[2].charAt(0)==Ce[2].charAt(1)?Ce[0].charAt(0)+Ce[1].charAt(0)+Ce[2].charAt(0):Ce.join("")}function a($,ie,te,Ee,Ce){var ve=[ae(O($).toString(16)),ae(O(ie).toString(16)),ae(O(te).toString(16)),ae(pe(Ee))];return Ce&&ve[0].charAt(0)==ve[0].charAt(1)&&ve[1].charAt(0)==ve[1].charAt(1)&&ve[2].charAt(0)==ve[2].charAt(1)&&ve[3].charAt(0)==ve[3].charAt(1)?ve[0].charAt(0)+ve[1].charAt(0)+ve[2].charAt(0)+ve[3].charAt(0):ve.join("")}function l($,ie,te,Ee){var Ce=[ae(pe(Ee)),ae(O($).toString(16)),ae(O(ie).toString(16)),ae(O(te).toString(16))];return Ce.join("")}S.equals=function($,ie){return!$||!ie?!1:S($).toRgbString()==S(ie).toRgbString()},S.random=function(){return S.fromRatio({r:R(),g:R(),b:R()})};function s($,ie){ie=ie===0?0:ie||10;var te=S($).toHsl();return te.s-=ie/100,te.s=k(te.s),S(te)}function _($,ie){ie=ie===0?0:ie||10;var te=S($).toHsl();return te.s+=ie/100,te.s=k(te.s),S(te)}function b($){return S($).desaturate(100)}function f($,ie){ie=ie===0?0:ie||10;var te=S($).toHsl();return te.l+=ie/100,te.l=k(te.l),S(te)}function A($,ie){ie=ie===0?0:ie||10;var te=S($).toRgb();return te.r=I(0,F(255,te.r-O(255*-(ie/100)))),te.g=I(0,F(255,te.g-O(255*-(ie/100)))),te.b=I(0,F(255,te.b-O(255*-(ie/100)))),S(te)}function T($,ie){ie=ie===0?0:ie||10;var te=S($).toHsl();return te.l-=ie/100,te.l=k(te.l),S(te)}function m($,ie){var te=S($).toHsl(),Ee=(te.h+ie)%360;return te.h=Ee<0?360+Ee:Ee,S(te)}function c($){var ie=S($).toHsl();return ie.h=(ie.h+180)%360,S(ie)}function u($){var ie=S($).toHsl(),te=ie.h;return[S($),S({h:(te+120)%360,s:ie.s,l:ie.l}),S({h:(te+240)%360,s:ie.s,l:ie.l})]}function o($){var ie=S($).toHsl(),te=ie.h;return[S($),S({h:(te+90)%360,s:ie.s,l:ie.l}),S({h:(te+180)%360,s:ie.s,l:ie.l}),S({h:(te+270)%360,s:ie.s,l:ie.l})]}function x($){var ie=S($).toHsl(),te=ie.h;return[S($),S({h:(te+72)%360,s:ie.s,l:ie.l}),S({h:(te+216)%360,s:ie.s,l:ie.l})]}function y($,ie,te){ie=ie||6,te=te||30;var Ee=S($).toHsl(),Ce=360/te,ve=[S($)];for(Ee.h=(Ee.h-(Ce*ie>>1)+720)%360;--ie;)Ee.h=(Ee.h+Ce)%360,ve.push(S(Ee));return ve}function p($,ie){ie=ie||6;for(var te=S($).toHsv(),Ee=te.h,Ce=te.s,ve=te.v,we=[],Ae=1/ie;ie--;)we.push(S({h:Ee,s:Ce,v:ve})),ve=(ve+Ae)%1;return we}S.mix=function($,ie,te){te=te===0?0:te||50;var Ee=S($).toRgb(),Ce=S(ie).toRgb(),ve=te/100,we={r:(Ce.r-Ee.r)*ve+Ee.r,g:(Ce.g-Ee.g)*ve+Ee.g,b:(Ce.b-Ee.b)*ve+Ee.b,a:(Ce.a-Ee.a)*ve+Ee.a};return S(we)},S.readability=function($,ie){var te=S($),Ee=S(ie);return(G.max(te.getLuminance(),Ee.getLuminance())+.05)/(G.min(te.getLuminance(),Ee.getLuminance())+.05)},S.isReadable=function($,ie,te){var Ee=S.readability($,ie),Ce,ve;ve=!1,Ce=me(te);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ve=Ee>=4.5;break;case"AAlarge":ve=Ee>=3;break;case"AAAsmall":ve=Ee>=7;break}return ve},S.mostReadable=function($,ie,te){var Ee=null,Ce=0,ve,we,Ae,De;te=te||{},we=te.includeFallbackColors,Ae=te.level,De=te.size;for(var Ie=0;Ie<ie.length;Ie++)ve=S.readability($,ie[Ie]),ve>Ce&&(Ce=ve,Ee=S(ie[Ie]));return S.isReadable($,Ee,{level:Ae,size:De})||!we?Ee:(te.includeFallbackColors=!1,S.mostReadable($,["#fff","#000"],te))};var D=S.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=S.hexNames=B(D);function B($){var ie={};for(var te in $)$.hasOwnProperty(te)&&(ie[$[te]]=te);return ie}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function M($,ie){X($)&&($="100%");var te=ee($);return $=F(ie,I(0,parseFloat($))),te&&($=parseInt($*ie,10)/100),G.abs($-ie)<1e-6?1:$%ie/parseFloat(ie)}function k($){return F(1,I(0,$))}function H($){return parseInt($,16)}function X($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function ee($){return typeof $=="string"&&$.indexOf("%")!=-1}function ae($){return $.length==1?"0"+$:""+$}function ye($){return $<=1&&($=$*100+"%"),$}function pe($){return G.round(parseFloat($)*255).toString(16)}function he($){return H($)/255}var fe=function(){var $="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",te="(?:"+ie+")|(?:"+$+")",Ee="[\\s|\\(]+("+te+")[,|\\s]+("+te+")[,|\\s]+("+te+")\\s*\\)?",Ce="[\\s|\\(]+("+te+")[,|\\s]+("+te+")[,|\\s]+("+te+")[,|\\s]+("+te+")\\s*\\)?";return{CSS_UNIT:new RegExp(te),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ce),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 de($){return!!fe.CSS_UNIT.exec($)}function ne($){$=$.replace(L,"").replace(K,"").toLowerCase();var ie=!1;if(D[$])$=D[$],ie=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var te;return(te=fe.rgb.exec($))?{r:te[1],g:te[2],b:te[3]}:(te=fe.rgba.exec($))?{r:te[1],g:te[2],b:te[3],a:te[4]}:(te=fe.hsl.exec($))?{h:te[1],s:te[2],l:te[3]}:(te=fe.hsla.exec($))?{h:te[1],s:te[2],l:te[3],a:te[4]}:(te=fe.hsv.exec($))?{h:te[1],s:te[2],v:te[3]}:(te=fe.hsva.exec($))?{h:te[1],s:te[2],v:te[3],a:te[4]}:(te=fe.hex8.exec($))?{r:H(te[1]),g:H(te[2]),b:H(te[3]),a:he(te[4]),format:ie?"name":"hex8"}:(te=fe.hex6.exec($))?{r:H(te[1]),g:H(te[2]),b:H(te[3]),format:ie?"name":"hex"}:(te=fe.hex4.exec($))?{r:H(te[1]+""+te[1]),g:H(te[2]+""+te[2]),b:H(te[3]+""+te[3]),a:he(te[4]+""+te[4]),format:ie?"name":"hex8"}:(te=fe.hex3.exec($))?{r:H(te[1]+""+te[1]),g:H(te[2]+""+te[2]),b:H(te[3]+""+te[3]),format:ie?"name":"hex"}:!1}function me($){var ie,te;return $=$||{level:"AA",size:"small"},ie=($.level||"AA").toUpperCase(),te=($.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),te!=="small"&&te!=="large"&&(te="small"),{level:ie,size:te}}et.exports?et.exports=S:!(Z=function(){return S}.call(We,J,We,et),Z!==void 0&&(et.exports=Z))})(Math)},aRTE:function(et,We){et.exports={L:1,M:0,Q:3,H:2}},bT9E:function(et,We,J){"use strict";J.d(We,"a",function(){return G});var Z=J("VTBJ");function G(L,K){var N=Object(Z.a)({},L);return Array.isArray(K)&&K.forEach(function(O){delete N[O]}),N}},c5Ni:function(et,We,J){},dQei:function(et,We){for(var J={glog:function(G){if(G<1)throw new Error("glog("+G+")");return J.LOG_TABLE[G]},gexp:function(G){for(;G<0;)G+=255;for(;G>=256;)G-=255;return J.EXP_TABLE[G]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},Z=0;Z<8;Z++)J.EXP_TABLE[Z]=1<<Z;for(var Z=8;Z<256;Z++)J.EXP_TABLE[Z]=J.EXP_TABLE[Z-4]^J.EXP_TABLE[Z-5]^J.EXP_TABLE[Z-6]^J.EXP_TABLE[Z-8];for(var Z=0;Z<255;Z++)J.LOG_TABLE[J.EXP_TABLE[Z]]=Z;et.exports=J},dWSS:function(et,We,J){var Z=J("dQei");function G(L,K){if(L.length==null)throw new Error(L.length+"/"+K);for(var N=0;N<L.length&&L[N]==0;)N++;this.num=new Array(L.length-N+K);for(var O=0;O<L.length-N;O++)this.num[O]=L[O+N]}G.prototype={get:function(L){return this.num[L]},getLength:function(){return this.num.length},multiply:function(L){for(var K=new Array(this.getLength()+L.getLength()-1),N=0;N<this.getLength();N++)for(var O=0;O<L.getLength();O++)K[N+O]^=Z.gexp(Z.glog(this.get(N))+Z.glog(L.get(O)));return new G(K,0)},mod:function(L){if(this.getLength()-L.getLength()<0)return this;for(var K=Z.glog(this.get(0))-Z.glog(L.get(0)),N=new Array(this.getLength()),O=0;O<this.getLength();O++)N[O]=this.get(O);for(var O=0;O<L.getLength();O++)N[O]^=Z.gexp(Z.glog(L.get(O))+K);return new G(N,0).mod(L)}},et.exports=G},dejd:function(et,We,J){},dmUQ:function(et,We,J){"use strict";var Z=J("Ff2n"),G=J("rePB"),L=J("1OyB"),K=J("vuIU"),N=J("Ji7U"),O=J("md7G"),F=J("foSv"),I=J("cDcd"),R=J.n(I),S=J("TSYQ"),h=J.n(S),g=J("4IlW");function P(u,o){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);o&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),x.push.apply(x,y)}return x}function w(u){for(var o=1;o<arguments.length;o++){var x=arguments[o]!=null?arguments[o]:{};o%2?P(Object(x),!0).forEach(function(y){Object(G.a)(u,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):P(Object(x)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(x,y))})}return u}function E(u){var o=v();return function(){var y=Object(F.a)(u),p;if(o){var D=Object(F.a)(this).constructor;p=Reflect.construct(y,arguments,D)}else p=y.apply(this,arguments);return Object(O.a)(this,p)}}function v(){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 a(u){u.preventDefault()}var l=function(o){return o.replace(/[^\w.-]+/g,"")},s=200,_=600,b=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(o){return o!=null},A=function(o,x){return x===o||typeof x=="number"&&typeof o=="number"&&isNaN(x)&&isNaN(o)},T=function(u){Object(N.a)(x,u);var o=E(x);function x(y){var p;Object(L.a)(this,x),p=o.call(this,y),p.onKeyDown=function(B){var W=p.props,M=W.onKeyDown,k=W.onPressEnter;if(B.keyCode===g.a.UP){var H=p.getRatio(B);p.up(B,H,null),p.stop()}else if(B.keyCode===g.a.DOWN){var X=p.getRatio(B);p.down(B,X,null),p.stop()}else B.keyCode===g.a.ENTER&&k&&k(B);if(p.recordCursorPosition(),p.lastKeyCode=B.keyCode,M){for(var ee=arguments.length,ae=new Array(ee>1?ee-1:0),ye=1;ye<ee;ye++)ae[ye-1]=arguments[ye];M.apply(void 0,[B].concat(ae))}},p.onKeyUp=function(B){var W=p.props.onKeyUp;if(p.stop(),p.recordCursorPosition(),W){for(var M=arguments.length,k=new Array(M>1?M-1:0),H=1;H<M;H++)k[H-1]=arguments[H];W.apply(void 0,[B].concat(k))}},p.onChange=function(B){var W=p.props.onChange;p.state.focused&&(p.inputting=!0),p.rawInput=p.props.parser(p.getValueFromEvent(B)),p.setState({inputValue:p.rawInput}),W(p.toNumber(p.rawInput))},p.onMouseUp=function(){var B=p.props.onMouseUp;p.recordCursorPosition(),B&&B.apply(void 0,arguments)},p.onFocus=function(){var B;p.setState({focused:!0}),(B=p.props).onFocus.apply(B,arguments)},p.onBlur=function(){var B=p.props.onBlur;p.inputting=!1,p.setState({focused:!1});var W=p.getCurrentValidValue(p.state.inputValue),M=p.setValue(W,d);if(B){var k=p.input.value,H=p.getInputDisplayValue({focus:!1,value:M});p.input.value=H&&Number(H),B.apply(void 0,arguments),p.input.value=k}},p.getRatio=function(B){var W=1;return B.metaKey||B.ctrlKey?W=.1:B.shiftKey&&(W=10),W},p.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},p.getPrecision=function(B){if(f(p.props.precision))return p.props.precision;var W=String(B);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var M=0;return W.indexOf(".")>=0&&(M=W.length-W.indexOf(".")-1),M},p.getInputDisplayValue=function(B){var W=B||p.state,M=W.focused,k=W.inputValue,H=W.value,X;M?X=k:X=p.toPrecisionAsStep(H),X==null&&(X="");var ee=p.formatWrapper(X);return f(p.props.decimalSeparator)&&(ee=ee.toString().replace(".",p.props.decimalSeparator)),ee},p.recordCursorPosition=function(){try{p.cursorStart=p.input.selectionStart,p.cursorEnd=p.input.selectionEnd,p.currentValue=p.input.value,p.cursorBefore=p.input.value.substring(0,p.cursorStart),p.cursorAfter=p.input.value.substring(p.cursorEnd)}catch(B){}},p.restoreByAfter=function(B){if(B===void 0)return!1;var W=p.input.value,M=W.lastIndexOf(B);if(M===-1)return!1;var k=p.cursorBefore.length;return p.lastKeyCode===g.a.DELETE&&p.cursorBefore.charAt(k-1)===B[0]?(p.fixCaret(k,k),!0):M+B.length===W.length?(p.fixCaret(M,M),!0):!1},p.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(W,M){var k=B.substring(M);return p.restoreByAfter(k)})},p.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},p.stop=function(){p.autoStepTimer&&clearTimeout(p.autoStepTimer)},p.down=function(B,W,M){p.pressingUpOrDown=!0,p.step("down",B,W,M)},p.up=function(B,W,M){p.pressingUpOrDown=!0,p.step("up",B,W,M)},p.saveInput=function(B){p.input=B};var D=y.value;D===void 0&&(D=y.defaultValue),p.state={focused:y.autoFocus};var U=p.getValidValue(p.toNumber(D));return p.state=w(w({},p.state),{},{inputValue:p.toPrecisionAsStep(U),value:U}),p}return Object(K.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(p){var D=this.props,U=D.value,B=D.onChange,W=D.max,M=D.min,k=this.state.focused;if(p){if(!A(p.value,U)||!A(p.max,W)||!A(p.min,M)){var H=k?U:this.getValidValue(U),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var ee="value"in this.props?U:this.state.value;"max"in this.props&&p.max!==W&&typeof ee=="number"&&ee>W&&B&&B(W),"min"in this.props&&p.min!==M&&typeof ee=="number"&&ee<M&&B&&B(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ae=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===g.a.BACKSPACE?ae=this.cursorStart-1:this.lastKeyCode===g.a.DELETE&&(ae=this.cursorStart):ae=this.input.value.length,this.fixCaret(ae,ae)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case g.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case g.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ye){}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(p){var D=p;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(p){var D=p.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(p){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(p);return isNaN(B)?p:(B<D&&(B=D),B>U&&(B=U),B)}},{key:"setValue",value:function(p,D){var U=this.props.precision,B=this.isNotCompleteNumber(parseFloat(p))?null:parseFloat(p),W=this.state.value,M=W===void 0?null:W,k=this.state.inputValue,H=k===void 0?null:k,X=typeof B=="number"?B.toFixed(U):"".concat(B),ee=B!==M||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},D)):this.setState({value:B,inputValue:this.toPrecisionAsStep(p)},D),ee&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(p){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,B=U.precision,W=U.step;if(f(B))return B;var M=this.getPrecision(D),k=this.getPrecision(W),H=this.getPrecision(p);return p?Math.max(H,M+k):M+k}},{key:"getPrecisionFactor",value:function(p){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(p,D);return Math.pow(10,U)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(p){return this.props.formatter?this.props.formatter(p):p}},{key:"toPrecisionAsStep",value:function(p){if(this.isNotCompleteNumber(p)||p==="")return p;var D=Math.abs(this.getMaxPrecision(p));return isNaN(D)?p.toString():Number(p).toFixed(D)}},{key:"toNumber",value:function(p){var D=this.props.precision,U=this.state.focused,B=p&&p.length>16&&U;return this.isNotCompleteNumber(p)||B?p:f(D)?Math.round(p*Math.pow(10,D))/Math.pow(10,D):Number(p)}},{key:"upStep",value:function(p,D){var U=this.props.step,B=this.getPrecisionFactor(p,D),W=Math.abs(this.getMaxPrecision(p,D)),M=((B*p+B*U*D)/B).toFixed(W);return this.toNumber(M)}},{key:"downStep",value:function(p,D){var U=this.props.step,B=this.getPrecisionFactor(p,D),W=Math.abs(this.getMaxPrecision(p,D)),M=((B*p-B*U*D)/B).toFixed(W);return this.toNumber(M)}},{key:"step",value:function(p,D){var U=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var M=this.props;if(M.disabled)return;var k=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(k))return;var H=this["".concat(p,"Step")](k,B),X=H>M.max||H<M.min;if(H>M.max?H=M.max:H<M.min&&(H=M.min),this.setValue(H,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){U[p](D,B,!0)},W?s:_)}},{key:"fixCaret",value:function(p,D){if(p===void 0||D===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,B=this.input.selectionEnd;(p!==U||D!==B)&&this.input.setSelectionRange(p,D)}catch(W){}}},{key:"render",value:function(){var p,D=this.props,U=D.prefixCls,B=D.disabled,W=D.readOnly,M=D.useTouch,k=D.autoComplete,H=D.upHandler,X=D.downHandler,ee=D.className,ae=D.max,ye=D.min,pe=D.style,he=D.title,fe=D.onMouseEnter,de=D.onMouseLeave,ne=D.onMouseOver,me=D.onMouseOut,$=D.required,ie=D.onClick,te=D.tabIndex,Ee=D.type,Ce=D.placeholder,ve=D.id,we=D.inputMode,Ae=D.pattern,De=D.step,Ie=D.maxLength,Le=D.autoFocus,Oe=D.name,Xe=D.onPaste,Ze=D.onInput,Be=Object(Z.a)(D,["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"]),je=this.state,rt=je.value,Ye=je.focused,qe=h()(U,(p={},Object(G.a)(p,ee,!!ee),Object(G.a)(p,"".concat(U,"-disabled"),B),Object(G.a)(p,"".concat(U,"-focused"),Ye),p)),Te={};Object.keys(Be).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Te[le]=Be[le])});var $e=!W&&!B,Ge=this.getInputDisplayValue(null),_e=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=ae),Ue=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=ye),ge=_e||B||W,se=Ue||B||W,ce=h()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(G.a)({},"".concat(U,"-handler-up-disabled"),ge)),Q=h()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(G.a)({},"".concat(U,"-handler-down-disabled"),se)),q=M?{onTouchStart:ge?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=M?{onTouchStart:se?d:this.down,onTouchEnd:this.stop}:{onMouseDown:se?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:qe,style:pe,title:he,onMouseEnter:fe,onMouseLeave:de,onMouseOver:ne,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(U,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),H||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:a})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":se,className:Q}),X||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:a}))),R.a.createElement("div",{className:"".concat(U,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ye,"aria-valuemax":ae,"aria-valuenow":rt,required:$,type:Ee,placeholder:Ce,onPaste:Xe,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:te,autoComplete:k,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:$e?this.onKeyDown:d,onKeyUp:$e?this.onKeyUp:d,autoFocus:Le,maxLength:Ie,readOnly:W,disabled:B,max:ae,min:ye,step:De,name:Oe,title:he,id:ve,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ge),pattern:Ae,inputMode:we,onInput:Ze},Te))))}}]),x}(R.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:b,min:-b,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var m=T,c=We.a=m},f4xo:function(et,We,J){var Z=J("nVVt");function G(L){this.mode=Z.MODE_8BIT_BYTE,this.data=L}G.prototype={getLength:function(L){return this.data.length},write:function(L){for(var K=0;K<this.data.length;K++)L.put(this.data.charCodeAt(K),8)}},et.exports=G},h78n:function(et,We,J){"use strict";J.d(We,"a",function(){return p});var Z=J("cDcd"),G=J.n(Z),L=J("TSYQ"),K=J.n(L),N={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(B){var W=B.map(function(){return Object(Z.useRef)()}),M=Object(Z.useRef)();return Object(Z.useEffect)(function(){var k=Date.now(),H=!1;Object.keys(W).forEach(function(X){var ee=W[X].current;if(!ee)return;H=!0;var ae=ee.style;ae.transitionDuration=".3s, .3s, .3s, .06s",M.current&&k-M.current<100&&(ae.transitionDuration="0s, 0s")}),H&&(M.current=Date.now())}),[W]};function F(){return F=Object.assign||function(U){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var M in W)Object.prototype.hasOwnProperty.call(W,M)&&(U[M]=W[M])}return U},F.apply(this,arguments)}function I(U,B){return P(U)||g(U,B)||S(U,B)||R()}function R(){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(U,B){if(!U)return;if(typeof U=="string")return h(U,B);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return h(U,B)}function h(U,B){(B==null||B>U.length)&&(B=U.length);for(var W=0,M=new Array(B);W<B;W++)M[W]=U[W];return M}function g(U,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],M=!0,k=!1,H=void 0;try{for(var X=U[Symbol.iterator](),ee;!(M=(ee=X.next()).done)&&!(W.push(ee.value),B&&W.length===B);M=!0);}catch(ae){k=!0,H=ae}finally{try{!M&&X.return!=null&&X.return()}finally{if(k)throw H}}return W}function P(U){if(Array.isArray(U))return U}function w(U,B){if(U==null)return{};var W=E(U,B),M,k;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(k=0;k<H.length;k++){if(M=H[k],B.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,M))continue;W[M]=U[M]}}return W}function E(U,B){if(U==null)return{};var W={},M=Object.keys(U),k,H;for(H=0;H<M.length;H++){if(k=M[H],B.indexOf(k)>=0)continue;W[k]=U[k]}return W}var v=function(B){var W=B.className,M=B.percent,k=B.prefixCls,H=B.strokeColor,X=B.strokeLinecap,ee=B.strokeWidth,ae=B.style,ye=B.trailColor,pe=B.trailWidth,he=B.transition,fe=w(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete fe.gapPosition;var de=Array.isArray(M)?M:[M],ne=Array.isArray(H)?H:[H],me=O(de),$=I(me,1),ie=$[0],te=ee/2,Ee=100-ee/2,Ce="M ".concat(X==="round"?te:0,",").concat(te,`
|
|
L `).concat(X==="round"?Ee:100,",").concat(te),ve="0 0 100 ".concat(ee),we=0;return G.a.createElement("svg",F({className:K()("".concat(k,"-line"),W),viewBox:ve,preserveAspectRatio:"none",style:ae},fe),G.a.createElement("path",{className:"".concat(k,"-line-trail"),d:Ce,strokeLinecap:X,stroke:ye,strokeWidth:pe||ee,fillOpacity:"0"}),de.map(function(Ae,De){var Ie={strokeDasharray:"".concat(Ae,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Le=ne[De]||ne[ne.length-1];return we+=Ae,G.a.createElement("path",{key:De,className:"".concat(k,"-line-path"),d:Ce,strokeLinecap:X,stroke:Le,strokeWidth:ee,fillOpacity:"0",ref:ie[De],style:Ie})}))};v.defaultProps=N;var d=v;function a(){return a=Object.assign||function(U){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var M in W)Object.prototype.hasOwnProperty.call(W,M)&&(U[M]=W[M])}return U},a.apply(this,arguments)}function l(U,B){return A(U)||f(U,B)||_(U,B)||s()}function s(){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 _(U,B){if(!U)return;if(typeof U=="string")return b(U,B);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return b(U,B)}function b(U,B){(B==null||B>U.length)&&(B=U.length);for(var W=0,M=new Array(B);W<B;W++)M[W]=U[W];return M}function f(U,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],M=!0,k=!1,H=void 0;try{for(var X=U[Symbol.iterator](),ee;!(M=(ee=X.next()).done)&&!(W.push(ee.value),B&&W.length===B);M=!0);}catch(ae){k=!0,H=ae}finally{try{!M&&X.return!=null&&X.return()}finally{if(k)throw H}}return W}function A(U){if(Array.isArray(U))return U}function T(U,B){if(U==null)return{};var W=m(U,B),M,k;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(k=0;k<H.length;k++){if(M=H[k],B.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,M))continue;W[M]=U[M]}}return W}function m(U,B){if(U==null)return{};var W={},M=Object.keys(U),k,H;for(H=0;H<M.length;H++){if(k=M[H],B.indexOf(k)>=0)continue;W[k]=U[k]}return W}var c=0;function u(U){return+U.replace("%","")}function o(U){return Array.isArray(U)?U:[U]}function x(U,B,W,M){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-M/2,ee=0,ae=-X,ye=0,pe=-2*X;switch(H){case"left":ee=-X,ae=0,ye=2*X,pe=0;break;case"right":ee=X,ae=0,ye=-2*X,pe=0;break;case"bottom":ae=X,pe=2*X;break;default:}var he="M 50,50 m ".concat(ee,",").concat(ae,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(ye,",").concat(-pe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-ye,",").concat(pe),fe=Math.PI*2*X,de={stroke:W,strokeDasharray:"".concat(B/100*(fe-k),"px ").concat(fe,"px"),strokeDashoffset:"-".concat(k/2+U/100*(fe-k),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:de}}var y=function(B){var W=B.prefixCls,M=B.strokeWidth,k=B.trailWidth,H=B.gapDegree,X=B.gapPosition,ee=B.trailColor,ae=B.strokeLinecap,ye=B.style,pe=B.className,he=B.strokeColor,fe=B.percent,de=T(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(Z.useMemo)(function(){return c+=1,c},[]),me=x(0,100,ee,M,H,X),$=me.pathString,ie=me.pathStyle,te=o(fe),Ee=o(he),Ce=Ee.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),ve=O(te),we=l(ve,1),Ae=we[0],De=function(){var Le=0;return te.map(function(Oe,Xe){var Ze=Ee[Xe]||Ee[Ee.length-1],Be=Object.prototype.toString.call(Ze)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ne,")"):"",je=x(Le,Oe,Ze,M,H,X);return Le+=Oe,G.a.createElement("path",{key:Xe,className:"".concat(W,"-circle-path"),d:je.pathString,stroke:Be,strokeLinecap:ae,strokeWidth:M,opacity:Oe===0?0:1,fillOpacity:"0",style:je.pathStyle,ref:Ae[Xe]})})};return G.a.createElement("svg",a({className:K()("".concat(W,"-circle"),pe),viewBox:"0 0 100 100",style:ye},de),Ce&&G.a.createElement("defs",null,G.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(Ie,Le){return u(Ie)-u(Le)}).map(function(Ie,Le){return G.a.createElement("stop",{key:Le,offset:Ie,stopColor:Ce[Ie]})}))),G.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:ee,strokeLinecap:ae,strokeWidth:k||M,fillOpacity:"0",style:ie}),De().reverse())};y.defaultProps=N;var p=y,D={Line:d,Circle:p}},kSUc:function(et,We,J){},lZu9:function(et,We,J){(function(Z){Z(J("VrN/"),J("1eCo"),J("8EBN"))})(function(Z){"use strict";Z.defineMode("markdown",function(G,L){var K=Z.getMode(G,"text/html"),N=K.name=="null";function O(M){if(Z.findModeByName){var k=Z.findModeByName(M);k&&(M=k.mime||k.mimes[0])}var H=Z.getMode(G,M);return H.name=="null"?null:H}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var F={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 F)F.hasOwnProperty(I)&&L.tokenTypeOverrides[I]&&(F[I]=L.tokenTypeOverrides[I]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,S=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,h=/^\[(x| )\](?=\s)/i,g=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function l(M,k,H){return k.f=k.inline=H,H(M,k)}function s(M,k,H){return k.f=k.block=H,H(M,k)}function _(M){return!M||!/\S/.test(M.string)}function b(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==A){var k=N;if(!k){var H=Z.innerMode(K,M.htmlState);k=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}k&&(M.f=u,M.block=f,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function f(M,k){var H=M.column()===k.indentation,X=_(k.prevLine.stream),ee=k.indentedCode,ae=k.prevLine.hr,ye=k.list!==!1,pe=(k.listStack[k.listStack.length-1]||0)+3;k.indentedCode=!1;var he=k.indentation;if(k.indentationDiff===null&&(k.indentationDiff=k.indentation,ye)){for(k.list=null;he<k.listStack[k.listStack.length-1];)k.listStack.pop(),k.listStack.length?k.indentation=k.listStack[k.listStack.length-1]:k.list=!1;k.list!==!1&&(k.indentationDiff=he-k.listStack[k.listStack.length-1])}var fe=!X&&!ae&&!k.prevLine.header&&(!ye||!ee)&&!k.prevLine.fencedCodeEnd,de=(k.list===!1||ae||X)&&k.indentation<=pe&&M.match(R),ne=null;if(k.indentationDiff>=4&&(ee||k.prevLine.fencedCodeEnd||k.prevLine.header||X))return M.skipToEnd(),k.indentedCode=!0,F.code;if(M.eatSpace())return null;if(H&&k.indentation<=pe&&(ne=M.match(g))&&ne[1].length<=6)return k.quote=0,k.header=ne[1].length,k.thisLine.header=!0,L.highlightFormatting&&(k.formatting="header"),k.f=k.inline,m(k);if(k.indentation<=pe&&M.eat(">"))return k.quote=H?1:k.quote+1,L.highlightFormatting&&(k.formatting="quote"),M.eatSpace(),m(k);if(!de&&!k.setext&&H&&k.indentation<=pe&&(ne=M.match(S))){var me=ne[1]?"ol":"ul";return k.indentation=he+M.current().length,k.list=!0,k.quote=0,k.listStack.push(k.indentation),k.em=!1,k.strong=!1,k.code=!1,k.strikethrough=!1,L.taskLists&&M.match(h,!1)&&(k.taskList=!0),k.f=k.inline,L.highlightFormatting&&(k.formatting=["list","list-"+me]),m(k)}else{if(H&&k.indentation<=pe&&(ne=M.match(E,!0)))return k.quote=0,k.fencedEndRE=new RegExp(ne[1]+"+ *$"),k.localMode=L.fencedCodeBlockHighlighting&&O(ne[2]||L.fencedCodeBlockDefaultMode),k.localMode&&(k.localState=Z.startState(k.localMode)),k.f=k.block=T,L.highlightFormatting&&(k.formatting="code-block"),k.code=-1,m(k);if(k.setext||(!fe||!ye)&&!k.quote&&k.list===!1&&!k.code&&!de&&!v.test(M.string)&&(ne=M.lookAhead(1))&&(ne=ne.match(P)))return k.setext?(k.header=k.setext,k.setext=0,M.skipToEnd(),L.highlightFormatting&&(k.formatting="header")):(k.header=ne[0].charAt(0)=="="?1:2,k.setext=k.header),k.thisLine.header=!0,k.f=k.inline,m(k);if(de)return M.skipToEnd(),k.hr=!0,k.thisLine.hr=!0,F.hr;if(M.peek()==="[")return l(M,k,D)}return l(M,k,k.inline)}function A(M,k){var H=K.token(M,k.htmlState);if(!N){var X=Z.innerMode(K,k.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||k.md_inside&&M.current().indexOf(">")>-1)&&(k.f=u,k.block=f,k.htmlState=null)}return H}function T(M,k){var H=k.listStack[k.listStack.length-1]||0,X=k.indentation<H,ee=H+3;if(k.fencedEndRE&&k.indentation<=ee&&(X||M.match(k.fencedEndRE))){L.highlightFormatting&&(k.formatting="code-block");var ae;return X||(ae=m(k)),k.localMode=k.localState=null,k.block=f,k.f=u,k.fencedEndRE=null,k.code=0,k.thisLine.fencedCodeEnd=!0,X?s(M,k,k.block):ae}else return k.localMode?k.localMode.token(M,k.localState):(M.skipToEnd(),F.code)}function m(M){var k=[];if(M.formatting){k.push(F.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var H=0;H<M.formatting.length;H++)k.push(F.formatting+"-"+M.formatting[H]),M.formatting[H]==="header"&&k.push(F.formatting+"-"+M.formatting[H]+"-"+M.header),M.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=M.quote?k.push(F.formatting+"-"+M.formatting[H]+"-"+M.quote):k.push("error"))}if(M.taskOpen)return k.push("meta"),k.length?k.join(" "):null;if(M.taskClosed)return k.push("property"),k.length?k.join(" "):null;if(M.linkHref?k.push(F.linkHref,"url"):(M.strong&&k.push(F.strong),M.em&&k.push(F.em),M.strikethrough&&k.push(F.strikethrough),M.emoji&&k.push(F.emoji),M.linkText&&k.push(F.linkText),M.code&&k.push(F.code),M.image&&k.push(F.image),M.imageAltText&&k.push(F.imageAltText,"link"),M.imageMarker&&k.push(F.imageMarker)),M.header&&k.push(F.header,F.header+"-"+M.header),M.quote&&(k.push(F.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=M.quote?k.push(F.quote+"-"+M.quote):k.push(F.quote+"-"+L.maxBlockquoteDepth)),M.list!==!1){var X=(M.listStack.length-1)%3;X?X===1?k.push(F.list2):k.push(F.list3):k.push(F.list1)}return M.trailingSpaceNewLine?k.push("trailing-space-new-line"):M.trailingSpace&&k.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),k.length?k.join(" "):null}function c(M,k){return M.match(w,!0)?m(k):void 0}function u(M,k){var H=k.text(M,k);if(typeof H!="undefined")return H;if(k.list)return k.list=null,m(k);if(k.taskList){var X=M.match(h,!0)[1]===" ";return X?k.taskOpen=!0:k.taskClosed=!0,L.highlightFormatting&&(k.formatting="task"),k.taskList=!1,m(k)}if(k.taskOpen=!1,k.taskClosed=!1,k.header&&M.match(/^#+$/,!0))return L.highlightFormatting&&(k.formatting="header"),m(k);var ee=M.next();if(k.linkTitle){k.linkTitle=!1;var ae=ee;ee==="("&&(ae=")"),ae=(ae+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ye="^\\s*(?:[^"+ae+"\\\\]+|\\\\\\\\|\\\\.)"+ae;if(M.match(new RegExp(ye),!0))return F.linkHref}if(ee==="`"){var pe=k.formatting;L.highlightFormatting&&(k.formatting="code"),M.eatWhile("`");var he=M.current().length;if(k.code==0&&(!k.quote||he==1))return k.code=he,m(k);if(he==k.code){var fe=m(k);return k.code=0,fe}else return k.formatting=pe,m(k)}else if(k.code)return m(k);if(ee==="\\"&&(M.next(),L.highlightFormatting)){var de=m(k),ne=F.formatting+"-escape";return de?de+" "+ne:ne}if(ee==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return k.imageMarker=!0,k.image=!0,L.highlightFormatting&&(k.formatting="image"),m(k);if(ee==="["&&k.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return k.imageMarker=!1,k.imageAltText=!0,L.highlightFormatting&&(k.formatting="image"),m(k);if(ee==="]"&&k.imageAltText){L.highlightFormatting&&(k.formatting="image");var de=m(k);return k.imageAltText=!1,k.image=!1,k.inline=k.f=x,de}if(ee==="["&&!k.image)return k.linkText&&M.match(/^.*?\]/)||(k.linkText=!0,L.highlightFormatting&&(k.formatting="link")),m(k);if(ee==="]"&&k.linkText){L.highlightFormatting&&(k.formatting="link");var de=m(k);return k.linkText=!1,k.inline=k.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,de}if(ee==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=o,L.highlightFormatting&&(k.formatting="link");var de=m(k);return de?de+=" ":de="",de+F.linkInline}if(ee==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=o,L.highlightFormatting&&(k.formatting="link");var de=m(k);return de?de+=" ":de="",de+F.linkEmail}if(L.xml&&ee==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=M.string.indexOf(">",M.pos);if(me!=-1){var $=M.string.substring(M.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(k.md_inside=!0)}return M.backUp(1),k.htmlState=Z.startState(K),s(M,k,A)}if(L.xml&&ee==="<"&&M.match(/^\/\w*?>/))return k.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ie=1,te=M.pos==1?" ":M.string.charAt(M.pos-2);ie<3&&M.eat(ee);)ie++;var Ee=M.peek()||" ",Ce=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(te)||d.test(te)),ve=!/\s/.test(te)&&(!d.test(te)||/\s/.test(Ee)||d.test(Ee)),we=null,Ae=null;if(ie%2&&(!k.em&&Ce&&(ee==="*"||!ve||d.test(te))?we=!0:k.em==ee&&ve&&(ee==="*"||!Ce||d.test(Ee))&&(we=!1)),ie>1&&(!k.strong&&Ce&&(ee==="*"||!ve||d.test(te))?Ae=!0:k.strong==ee&&ve&&(ee==="*"||!Ce||d.test(Ee))&&(Ae=!1)),Ae!=null||we!=null){L.highlightFormatting&&(k.formatting=we==null?"strong":Ae==null?"em":"strong em"),we===!0&&(k.em=ee),Ae===!0&&(k.strong=ee);var fe=m(k);return we===!1&&(k.em=!1),Ae===!1&&(k.strong=!1),fe}}else if(ee===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return m(k);M.backUp(1)}if(L.strikethrough){if(ee==="~"&&M.eatWhile(ee)){if(k.strikethrough){L.highlightFormatting&&(k.formatting="strikethrough");var fe=m(k);return k.strikethrough=!1,fe}else if(M.match(/^[^\s]/,!1))return k.strikethrough=!0,L.highlightFormatting&&(k.formatting="strikethrough"),m(k)}else if(ee===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return m(k);M.backUp(2)}}if(L.emoji&&ee===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){k.emoji=!0,L.highlightFormatting&&(k.formatting="emoji");var De=m(k);return k.emoji=!1,De}return ee===" "&&(M.match(/^ +$/,!1)?k.trailingSpace++:k.trailingSpace&&(k.trailingSpaceNewLine=!0)),m(k)}function o(M,k){var H=M.next();if(H===">"){k.f=k.inline=u,L.highlightFormatting&&(k.formatting="link");var X=m(k);return X?X+=" ":X="",X+F.linkInline}return M.match(/^[^>]+/,!0),F.linkInline}function x(M,k){if(M.eatSpace())return null;var H=M.next();return H==="("||H==="["?(k.f=k.inline=p(H==="("?")":"]"),L.highlightFormatting&&(k.formatting="link-string"),k.linkHref=!0,m(k)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function p(M){return function(k,H){var X=k.next();if(X===M){H.f=H.inline=u,L.highlightFormatting&&(H.formatting="link-string");var ee=m(H);return H.linkHref=!1,ee}return k.match(y[M]),H.linkHref=!0,m(H)}}function D(M,k){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(k.f=U,M.next(),L.highlightFormatting&&(k.formatting="link"),k.linkText=!0,m(k)):l(M,k,u)}function U(M,k){if(M.match(/^\]:/,!0)){k.f=k.inline=B,L.highlightFormatting&&(k.formatting="link");var H=m(k);return k.linkText=!1,H}return M.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function B(M,k){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?k.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),k.f=k.inline=u,F.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:u,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&Z.copyState(K,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?Z.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,k){if(k.formatting=!1,M!=k.thisLine.stream){if(k.header=0,k.hr=!1,M.match(/^\s*$/,!0))return b(k),null;if(k.prevLine=k.thisLine,k.thisLine={stream:M},k.taskList=!1,k.trailingSpace=0,k.trailingSpaceNewLine=!1,!k.localState&&(k.f=k.block,k.f!=A)){var H=M.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(k.indentation=H,k.indentationDiff=null,H>0)return null}}return k.f(M,k)},innerMode:function(M){return M.block==A?{state:M.htmlState,mode:K}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:W}},indent:function(M,k,H){return M.block==A&&K.indent?K.indent(M.htmlState,k,H):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,k,H):Z.Pass},blankLine:b,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),Z.defineMIME("text/markdown","markdown"),Z.defineMIME("text/x-markdown","markdown")})},nVVt:function(et,We){et.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(et,We,J){(function(Z){Z(J("VrN/"))})(function(Z){"use strict";var G=Z.Pos;function L(d,a){return d.line-a.line||d.ch-a.ch}var K="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",N=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+K+"]["+N+"]*)","g");function F(d,a,l,s){this.line=a,this.ch=l,this.cm=d,this.text=d.getLine(a),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function I(d,a){var l=d.cm.getTokenTypeAt(G(d.line,a));return l&&/\btag\b/.test(l)}function R(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function S(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function h(d){for(;;){var a=d.text.indexOf(">",d.ch);if(a==-1){if(R(d))continue;return}if(!I(d,a+1)){d.ch=a+1;continue}var l=d.text.lastIndexOf("/",a),s=l>-1&&!/\S/.test(d.text.slice(l+1,a));return d.ch=a+1,s?"selfClose":"regular"}}function g(d){for(;;){var a=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(a==-1){if(S(d))continue;return}if(!I(d,a+1)){d.ch=a;continue}O.lastIndex=a,d.ch=a;var l=O.exec(d.text);if(l&&l.index==a)return l}}function P(d){for(;;){O.lastIndex=d.ch;var a=O.exec(d.text);if(!a){if(R(d))continue;return}if(!I(d,a.index+1)){d.ch=a.index+1;continue}return d.ch=a.index+a[0].length,a}}function w(d){for(;;){var a=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(a==-1){if(S(d))continue;return}if(!I(d,a+1)){d.ch=a;continue}var l=d.text.lastIndexOf("/",a),s=l>-1&&!/\S/.test(d.text.slice(l+1,a));return d.ch=a+1,s?"selfClose":"regular"}}function E(d,a){for(var l=[];;){var s=P(d),_,b=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(_=h(d)))return;if(_=="selfClose")continue;if(s[1]){for(var A=l.length-1;A>=0;--A)if(l[A]==s[2]){l.length=A;break}if(A<0&&(!a||a==s[2]))return{tag:s[2],from:G(b,f),to:G(d.line,d.ch)}}else l.push(s[2])}}function v(d,a){for(var l=[];;){var s=w(d);if(!s)return;if(s=="selfClose"){g(d);continue}var _=d.line,b=d.ch,f=g(d);if(!f)return;if(f[1])l.push(f[2]);else{for(var A=l.length-1;A>=0;--A)if(l[A]==f[2]){l.length=A;break}if(A<0&&(!a||a==f[2]))return{tag:f[2],from:G(d.line,d.ch),to:G(_,b)}}}}Z.registerHelper("fold","xml",function(d,a){for(var l=new F(d,a.line,0);;){var s=P(l);if(!s||l.line!=a.line)return;var _=h(l);if(!_)return;if(!s[1]&&_!="selfClose"){var b=G(l.line,l.ch),f=E(l,s[2]);return f&&L(f.from,b)>0?{from:b,to:f.from}:null}}}),Z.findMatchingTag=function(d,a,l){var s=new F(d,a.line,a.ch,l);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var _=h(s),b=_&&G(s.line,s.ch),f=_&&g(s);if(!_||!f||L(s,a)>0)return;var A={from:G(s.line,s.ch),to:b,tag:f[2]};return _=="selfClose"?{open:A,close:null,at:"open"}:f[1]?{open:v(s,f[2]),close:A,at:"close"}:(s=new F(d,b.line,b.ch,l),{open:A,close:E(s,f[2]),at:"open"})},Z.findEnclosingTag=function(d,a,l,s){for(var _=new F(d,a.line,a.ch,l);;){var b=v(_,s);if(!b)break;var f=new F(d,a.line,a.ch,l),A=E(f,b.tag);if(A)return{open:b,close:A}}},Z.scanForClosingTag=function(d,a,l,s){var _=new F(d,a.line,a.ch,s?{from:0,to:s}:null);return E(_,l)}})},p5ED:function(et,We,J){"use strict";var Z=J("+L6B"),G=J("2/Rp"),L=J("5Dmo"),K=J("3S7+"),N=J("k1fw"),O=J("tJVT"),F=J("cDcd"),I=J.n(F),R=J("vHTk"),S=J.n(R),h=J("yEEn"),g=J("ZW9T"),P=J("1vsH");We.a=function(w){var E=w.name,v=w.data,d=w.theme,a=w.type,l=w.filename,s=w.monacoEditor,_=w.className,b=w.style,f=w.close,A=w.onClose,T=w.hasMask,m=Object(F.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(O.a)(m,2),u=c[0],o=c[1],x=Object(F.useState)(""),y=Object(O.a)(x,2),p=y[0],D=y[1],U,B=1024*1024,W=10*B,M=Object(F.useRef)();a==="office"&&(U=Object(P.V)(v).filesize,U>W&&(a="other")),l&&(s.filename=l),Object(F.useEffect)(function(){var X,ee,ae=(X=document.cookie)===null||X===void 0||((ee=X.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");ae==null||ae.map(function(ye){var pe=ye.split("=");pe[0]==="_educoder_session"&&D(pe[1])})},[]);var k=function(){if(v.startsWith("http")||v.startsWith("blob:")){H();return}Object(P.z)(l||"educoder",v,l)},H=function(){Object(P.x)(l||"educoder",decodeURIComponent(v))};return console.log("data:",v,"fileanme:",l," name:",E),I.a.createElement("div",{style:Object(N.a)({},b||{}),className:"".concat(T&&S.a.bgBlack," ").concat(a?S.a.wrp:"hide")},f&&I.a.createElement("div",{className:S.a.close,ref:M},I.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return M.current}},I.a.createElement("span",{onClick:H},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return M.current}},I.a.createElement("span",{className:"",onClick:A},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(S.a[_]," ").concat(_," ").concat(S.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&I.a.createElement(g.b,s)),a==="audio"&&I.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),a==="video"&&I.a.createElement(I.a.Fragment,null,v!=null&&v.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),a==="html"&&I.a.createElement("iframe",{src:v+"&disposition=inline"}),a==="html"&&I.a.createElement("iframe",{src:v+"&disposition=inline"}),a==="pdf"&&I.a.createElement("embed",{className:S.a.embed,src:v}),a==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),a==="other"&&I.a.createElement("div",null,I.a.createElement(G.a,{type:"primary",size:"large",onClick:k},I.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&I.a.createElement(G.a,{type:"primary",size:"large",onClick:k},I.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(et,We,J){},"rAM+":function(et,We,J){"use strict";J.d(We,"a",function(){return G});var Z=J("Qw5x");function G(L,K){var N;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(N=Object(Z.a)(L))||K&&L&&typeof L.length=="number"){N&&(L=N);var O=0,F=function(){};return{s:F,n:function(){return O>=L.length?{done:!0}:{done:!1,value:L[O++]}},e:function(g){throw g},f:F}}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,R=!1,S;return{s:function(){N=L[Symbol.iterator]()},n:function(){var g=N.next();return I=g.done,g},e:function(g){R=!0,S=g},f:function(){try{!I&&N.return!=null&&N.return()}finally{if(R)throw S}}}}},rUJ1:function(et,We){const J=/[&<>"']/,Z=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},N=T=>K[T];function O(T,m){if(m){if(J.test(T))return T.replace(Z,N)}else if(G.test(T))return T.replace(L,N);return T}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(T){return T.replace(F,(m,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const R=/(^|[^\[])\^/g;function S(T,m){T=T.source||T,m=m||"";const c={replace:(u,o)=>(o=o.source||o,o=o.replace(R,"$1"),T=T.replace(u,o),c),getRegex:()=>new RegExp(T,m)};return c}const h=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(T,m,c){if(T){let u;try{u=decodeURIComponent(I(c)).replace(h,"").toLowerCase()}catch(o){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}m&&!g.test(c)&&(c=a(m,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const w={},E=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(T,m){w[" "+T]||(E.test(T)?w[" "+T]=T+"/":w[" "+T]=b(T,"/",!0)),T=w[" "+T];const c=T.indexOf(":")===-1;return m.substring(0,2)==="//"?c?m:T.replace(v,"$1")+m:m.charAt(0)==="/"?c?m:T.replace(d,"$1")+m:T+m}const l={exec:function(){}};function s(T){let m=1,c,u;for(;m<arguments.length;m++){c=arguments[m];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(T[u]=c[u])}return T}function _(T,m){const c=T.replace(/\|/g,(x,y,p)=>{let D=!1,U=y;for(;--U>=0&&p[U]==="\\";)D=!D;return D?"|":" |"}),u=c.split(/ \|/);let o=0;if(u.length>m)u.splice(m);else for(;u.length<m;)u.push("");for(;o<u.length;o++)u[o]=u[o].trim().replace(/\\\|/g,"|");return u}function b(T,m,c){const u=T.length;if(u===0)return"";let o=0;for(;o<u;){const x=T.charAt(u-o-1);if(x===m&&!c)o++;else if(x!==m&&c)o++;else break}return T.substr(0,u-o)}function f(T,m){if(T.indexOf(m[1])===-1)return-1;const c=T.length;let u=0,o=0;for(;o<c;o++)if(T[o]==="\\")o++;else if(T[o]===m[0])u++;else if(T[o]===m[1]&&(u--,u<0))return o;return-1}function A(T){T&&T.sanitize&&!T.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")}et.exports={escape:O,unescape:I,edit:S,cleanUrl:P,resolveUrl:a,noopTest:l,merge:s,splitCells:_,rtrim:b,findClosingBracket:f,checkSanitizeDeprecation:A}},rcnY:function(et,We,J){var Z=J("aRTE");function G(L,K){this.totalCount=L,this.dataCount=K}G.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],G.getRSBlocks=function(L,K){var N=G.getRsBlockTable(L,K);if(N==null)throw new Error("bad rs block @ typeNumber:"+L+"/errorCorrectLevel:"+K);for(var O=N.length/3,F=new Array,I=0;I<O;I++)for(var R=N[I*3+0],S=N[I*3+1],h=N[I*3+2],g=0;g<R;g++)F.push(new G(S,h));return F},G.getRsBlockTable=function(L,K){switch(K){case Z.L:return G.RS_BLOCK_TABLE[(L-1)*4+0];case Z.M:return G.RS_BLOCK_TABLE[(L-1)*4+1];case Z.Q:return G.RS_BLOCK_TABLE[(L-1)*4+2];case Z.H:return G.RS_BLOCK_TABLE[(L-1)*4+3];default:return}},et.exports=G},ulZh:function(et,We,J){typeof window!="undefined"&&function(G,L){et.exports=L()}(this,function(){return function(Z){var G={};function L(K){if(G[K])return G[K].exports;var N=G[K]={i:K,l:!1,exports:{}};return Z[K].call(N.exports,N,N.exports,L),N.l=!0,N.exports}return L.m=Z,L.c=G,L.d=function(K,N,O){L.o(K,N)||Object.defineProperty(K,N,{enumerable:!0,get:O})},L.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},L.t=function(K,N){if(N&1&&(K=L(K)),N&8)return K;if(N&4&&typeof K=="object"&&K&&K.__esModule)return K;var O=Object.create(null);if(L.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:K}),N&2&&typeof K!="string")for(var F in K)L.d(O,F,function(I){return K[I]}.bind(null,F));return O},L.n=function(K){var N=K&&K.__esModule?function(){return K.default}:function(){return K};return L.d(N,"a",N),N},L.o=function(K,N){return Object.prototype.hasOwnProperty.call(K,N)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Z,G,L){"use strict";var K=Object.prototype.hasOwnProperty,N="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(N=!1));function F(h,g,P){this.fn=h,this.context=g,this.once=P||!1}function I(h,g,P,w,E){if(typeof P!="function")throw new TypeError("The listener must be a function");var v=new F(P,w||h,E),d=N?N+g:g;return h._events[d]?h._events[d].fn?h._events[d]=[h._events[d],v]:h._events[d].push(v):(h._events[d]=v,h._eventsCount++),h}function R(h,g){--h._eventsCount===0?h._events=new O:delete h._events[g]}function S(){this._events=new O,this._eventsCount=0}S.prototype.eventNames=function(){var g=[],P,w;if(this._eventsCount===0)return g;for(w in P=this._events)K.call(P,w)&&g.push(N?w.slice(1):w);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(P)):g},S.prototype.listeners=function(g){var P=N?N+g:g,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var E=0,v=w.length,d=new Array(v);E<v;E++)d[E]=w[E].fn;return d},S.prototype.listenerCount=function(g){var P=N?N+g:g,w=this._events[P];return w?w.fn?1:w.length:0},S.prototype.emit=function(g,P,w,E,v,d){var a=N?N+g:g;if(!this._events[a])return!1;var l=this._events[a],s=arguments.length,_,b;if(l.fn){l.once&&this.removeListener(g,l.fn,void 0,!0);switch(s){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,P),!0;case 3:return l.fn.call(l.context,P,w),!0;case 4:return l.fn.call(l.context,P,w,E),!0;case 5:return l.fn.call(l.context,P,w,E,v),!0;case 6:return l.fn.call(l.context,P,w,E,v,d),!0}for(b=1,_=new Array(s-1);b<s;b++)_[b-1]=arguments[b];l.fn.apply(l.context,_)}else{var f=l.length,A;for(b=0;b<f;b++){l[b].once&&this.removeListener(g,l[b].fn,void 0,!0);switch(s){case 1:l[b].fn.call(l[b].context);break;case 2:l[b].fn.call(l[b].context,P);break;case 3:l[b].fn.call(l[b].context,P,w);break;case 4:l[b].fn.call(l[b].context,P,w,E);break;default:if(!_)for(A=1,_=new Array(s-1);A<s;A++)_[A-1]=arguments[A];l[b].fn.apply(l[b].context,_)}}}return!0},S.prototype.on=function(g,P,w){return I(this,g,P,w,!1)},S.prototype.once=function(g,P,w){return I(this,g,P,w,!0)},S.prototype.removeListener=function(g,P,w,E){var v=N?N+g:g;if(!this._events[v])return this;if(!P)return R(this,v),this;var d=this._events[v];if(d.fn)d.fn===P&&(!E||d.once)&&(!w||d.context===w)&&R(this,v);else{for(var a=0,l=[],s=d.length;a<s;a++)(d[a].fn!==P||E&&!d[a].once||w&&d[a].context!==w)&&l.push(d[a]);l.length?this._events[v]=l.length===1?l[0]:l:R(this,v)}return this},S.prototype.removeAllListeners=function(g){var P;return g?(P=N?N+g:g,this._events[P]&&R(this,P)):(this._events=new O,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=N,S.EventEmitter=S,Z.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(Z,G,L){(function(K){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(S,h,g){if(g=g||{},S=S.trim(),h=h.trim(),!h){if(!g.alwaysNormalize)return S;var P=R.parseURL(S);if(!P)throw new Error("Error trying to parse base URL.");return P.path=R.normalizePath(P.path),R.buildURLFromParts(P)}var w=R.parseURL(h);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return g.alwaysNormalize?(w.path=R.normalizePath(w.path),R.buildURLFromParts(w)):h;var E=R.parseURL(S);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var v=O.exec(E.path);E.netLoc=v[1],E.path=v[2]}E.netLoc&&!E.path&&(E.path="/");var d={scheme:E.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(d.netLoc=E.netLoc,w.path[0]!=="/"))if(!w.path)d.path=E.path,w.params||(d.params=E.params,w.query||(d.query=E.query));else{var a=E.path,l=a.substring(0,a.lastIndexOf("/")+1)+w.path;d.path=R.normalizePath(l)}return d.path===null&&(d.path=g.alwaysNormalize?R.normalizePath(w.path):w.path),R.buildURLFromParts(d)},parseURL:function(S){var h=N.exec(S);return h?{scheme:h[1]||"",netLoc:h[2]||"",path:h[3]||"",params:h[4]||"",query:h[5]||"",fragment:h[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(F,"");S.length!==(S=S.replace(I,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};Z.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(Z,G,L){function K(g){var P={};function w(v){if(P[v])return P[v].exports;var d=P[v]={i:v,l:!1,exports:{}};return g[v].call(d.exports,d,d.exports,w),d.l=!0,d.exports}w.m=g,w.c=P,w.i=function(v){return v},w.d=function(v,d,a){w.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:a})},w.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},w.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return w.d(d,"a",d),d},w.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},w.p="/",w.oe=function(v){throw console.error(v),v};var E=w(w.s=ENTRY_MODULE);return E.default||E}var N="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function F(g){return(g+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(g){return!isNaN(1*g)}function R(g,P,w){var E={};E[w]=[];var v=P.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return E;for(var a=d[1],l=new RegExp("(\\\\n|\\W)"+F(a)+O,"g"),s;s=l.exec(v);){if(s[3]==="dll-reference")continue;E[w].push(s[3])}for(l=new RegExp("\\("+F(a)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+O,"g");s=l.exec(v);)g[s[2]]||(E[w].push(s[1]),g[s[2]]=L(s[1]).m),E[s[2]]=E[s[2]]||[],E[s[2]].push(s[4]);for(var _=Object.keys(E),b=0;b<_.length;b++)for(var f=0;f<E[_[b]].length;f++)I(E[_[b]][f])&&(E[_[b]][f]=1*E[_[b]][f]);return E}function S(g){var P=Object.keys(g);return P.reduce(function(w,E){return w||g[E].length>0},!1)}function h(g,P){for(var w={main:[P]},E={main:[]},v={main:{}};S(w);)for(var d=Object.keys(w),a=0;a<d.length;a++){var l=d[a],s=w[l],_=s.pop();if(v[l]=v[l]||{},v[l][_]||!g[l][_])continue;v[l][_]=!0,E[l]=E[l]||[],E[l].push(_);for(var b=R(g,g[l][_],l),f=Object.keys(b),A=0;A<f.length;A++)w[f[A]]=w[f[A]]||[],w[f[A]]=w[f[A]].concat(b[f[A]])}return E}Z.exports=function(g,P){P=P||{};var w={main:L.m},E=P.all?{main:Object.keys(w.main)}:h(w,g),v="";Object.keys(E).filter(function(_){return _!=="main"}).forEach(function(_){for(var b=0;E[_][b];)b++;E[_].push(b),w[_][b]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+_+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+E[_].map(function(f){return""+JSON.stringify(f)+": "+w[_][f].toString()}).join(",")+`});
|
|
`}),v=v+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+E.main.map(function(_){return""+JSON.stringify(_)+": "+w.main[_].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(P.bare)return d;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(d),s=new window.Worker(l);return s.objectURL=l,s}},"./src/config.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"hlsDefaultConfig",function(){return A}),L.d(G,"mergeConfig",function(){return m}),L.d(G,"enableStreamingMode",function(){return c});var K=L("./src/controller/abr-controller.ts"),N=L("./src/controller/audio-stream-controller.ts"),O=L("./src/controller/audio-track-controller.ts"),F=L("./src/controller/subtitle-stream-controller.ts"),I=L("./src/controller/subtitle-track-controller.ts"),R=L("./src/controller/buffer-controller.ts"),S=L("./src/controller/timeline-controller.ts"),h=L("./src/controller/cap-level-controller.ts"),g=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),w=L("./src/controller/cmcd-controller.ts"),E=L("./src/utils/xhr-loader.ts"),v=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),a=L("./src/utils/mediakeys-helper.ts"),l=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(u){for(var o=1;o<arguments.length;o++){var x=arguments[o];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(u[y]=x[y])}return u},s.apply(this,arguments)}function _(u,o){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(u);o&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),x.push.apply(x,y)}return x}function b(u){for(var o=1;o<arguments.length;o++){var x=arguments[o]!=null?arguments[o]:{};o%2?_(Object(x),!0).forEach(function(y){f(u,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):_(Object(x)).forEach(function(y){Object.defineProperty(u,y,Object.getOwnPropertyDescriptor(x,y))})}return u}function f(u,o,x){return o in u?Object.defineProperty(u,o,{value:x,enumerable:!0,configurable:!0,writable:!0}):u[o]=x,u}var A=b(b({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:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:R.default,capLevelController:h.default,fpsController:g.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:I.default,timelineController:S.TimelineController,audioStreamController:N.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function T(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function m(u,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},u,o)}function c(u){var o=u.loader;if(o!==v.default&&o!==E.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var x=Object(v.fetchSupported)();x&&(u.loader=v.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/polyfills/number.ts"),N=L("./src/utils/ewma-bandwidth-estimator.ts"),O=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),R=L("./src/types/loader.ts"),S=L("./src/utils/logger.ts");function h(w,E){for(var v=0;v<E.length;v++){var d=E[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function g(w,E,v){return E&&h(w.prototype,E),v&&h(w,v),w}var P=function(){function w(v){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=v;var d=v.config;this.bwEstimator=new N.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var E=w.prototype;return E.registerListeners=function(){var d=this.hls;d.on(O.Events.FRAG_LOADING,this.onFragLoading,this),d.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var d=this.hls;d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(d,a){var l=a.frag;if(l.type===R.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=l,this.partCurrent=(s=a.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(d,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var d=this.fragCurrent,a=this.partCurrent,l=this.hls,s=l.autoLevelEnabled,_=l.config,b=l.media;if(!d||!b)return;var f=a?a.stats:d.stats,A=a?a.duration:d.duration;if(f.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||b.paused||!b.playbackRate||!b.readyState)return;var T=performance.now()-f.loading.start,m=Math.abs(b.playbackRate);if(T<=500*A/m)return;var c=l.levels,u=l.minAutoLevel,o=c[d.level],x=f.total||Math.max(f.loaded,Math.round(A*o.maxBitrate/8)),y=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/T),p=(x-f.loaded)/y,D=b.currentTime,U=(F.BufferHelper.bufferInfo(b,D,_.maxBufferHole).end-D)/m;if(U>=2*A/m||p<=U)return;var B=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>u;W--){var M=c[W].maxBitrate;if(B=A*M/(8*.8*y),B<U)break}if(B>=p)return;var k=this.bwEstimator.getEstimate();S.logger.warn("Fragment "+d.sn+(a?" part "+a.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(K.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+p.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=W,this.bwEstimator.sample(T,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:a,stats:f})},E.onFragLoaded=function(d,a){var l=a.frag,s=a.part;if(l.type===R.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(l.sn)){var _=s?s.stats:l.stats,b=s?s.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],A=(f.loaded?f.loaded.bytes:0)+_.loaded,T=(f.loaded?f.loaded.duration:0)+b;f.loaded={bytes:A,duration:T},f.realBitrate=Math.round(8*A/T)}if(l.bitrateTest){var m={stats:_,frag:l,part:s,id:l.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},E.onFragBuffered=function(d,a){var l=a.frag,s=a.part,_=s?s.stats:l.stats;if(_.aborted)return;if(l.type!==R.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var b=_.parsing.end-_.loading.start;this.bwEstimator.sample(b,_.loaded),_.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=b/1e3:this.bitrateTestDelay=0},E.onError=function(d,a){switch(a.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var d=this.fragCurrent,a=this.partCurrent,l=this.hls,s=l.maxAutoLevel,_=l.config,b=l.minAutoLevel,f=l.media,A=a?a.duration:d?d.duration:0,T=f?f.currentTime:0,m=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():_.abrEwmaDefaultEstimate,u=(F.BufferHelper.bufferInfo(f,T,_.maxBufferHole).end-T)/m,o=this.findBestLevel(c,b,s,u,_.abrBandWidthFactor,_.abrBandWidthUpFactor);if(o>=0)return o;S.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=A?Math.min(A,_.maxStarvationDelay):_.maxStarvationDelay,y=_.abrBandWidthFactor,p=_.abrBandWidthUpFactor;if(!u){var D=this.bitrateTestDelay;if(D){var U=A?Math.min(A,_.maxLoadingDelay):_.maxLoadingDelay;x=U-D,S.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=p=1}}return o=this.findBestLevel(c,b,s,u+x,y,p),Math.max(o,0)},E.findBestLevel=function(d,a,l,s,_,b){for(var f,A=this.fragCurrent,T=this.partCurrent,m=this.lastLoadedFragLevel,c=this.hls.levels,u=c[m],o=!!(u!=null&&(f=u.details)!==null&&f!==void 0&&f.live),x=u==null?void 0:u.codecSet,y=T?T.duration:A?A.duration:0,p=l;p>=a;p--){var D=c[p];if(!D||x&&D.codecSet!==x)continue;var U=D.details,B=(T?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||y,W=void 0;p<=m?W=_*d:W=b*d;var M=c[p].maxBitrate,k=M*B/W;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+p+"/"+Math.round(W)+"/"+M+"/"+B+"/"+s+"/"+k),W>M&&(!k||o&&!this.bitrateTestDelay||k<s))return p}return-1},g(w,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,a=this.bwEstimator;if(d!==-1&&(!a||!a.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),w}();G.default=P},"./src/controller/audio-stream-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/polyfills/number.ts"),N=L("./src/controller/base-stream-controller.ts"),O=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),I=L("./src/controller/fragment-tracker.ts"),R=L("./src/types/level.ts"),S=L("./src/types/loader.ts"),h=L("./src/loader/fragment.ts"),g=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),w=L("./src/types/transmuxer.ts"),E=L("./src/controller/fragment-finders.ts"),v=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),a=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(A){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(A[c]=m[c])}return A},l.apply(this,arguments)}function s(A,T){A.prototype=Object.create(T.prototype),A.prototype.constructor=A,_(A,T)}function _(A,T){return _=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},_(A,T)}var b=100,f=function(A){s(T,A);function T(c,u){var o;return o=A.call(this,c,u,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var m=T.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var u=this.hls;u.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(O.Events.ERROR,this.onError,this),u.on(O.Events.BUFFER_RESET,this.onBufferReset,this),u.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var u=this.hls;u.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(O.Events.ERROR,this.onError,this),u.off(O.Events.BUFFER_RESET,this.onBufferReset,this),u.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(u,o){var x=o.frag,y=o.id,p=o.initPTS;if(y==="main"){var D=x.cc;this.initPTS[x.cc]=p,this.log("InitPTS for cc: "+D+" found from main: "+p),this.videoTrackCC=D,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=N.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(b),this.fragLoadError=0,o>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},m.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var u,o=this.levels,x=this.trackId,y=o==null||((u=o[x])===null||u===void 0)?void 0:u.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var p,D=performance.now(),U=this.retryDate;(!U||D>=U||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var W=B.frag,M=B.part,k=B.cache,H=B.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var X=k.flush(),ee={frag:W,part:M,payload:X,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&A.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ae=this.getLoadPosition(),ye=F.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),pe=Object(E.fragmentWithinToleranceTest)(ye.end,this.config.maxFragLookUpTolerance,W);pe<0&&(a.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+ye.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},m.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:u,x=o.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},m.doTickIdle=function(){var u,o,x=this.hls,y=this.levels,p=this.media,D=this.trackId,U=x.config;if(!y||!y[D])return;if(!p&&(this.startFragRequested||!U.startFragPrefetch))return;var B=y[D],W=B.details;if(!W||W.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(W)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,h.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(M===null)return;var k=M.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(k>=H&&!X)return;if(!X&&this._streamEnded(M,W)){x.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var ee=W.fragments,ae=ee[0].start,ye=M.end;if(X){var pe=this.getLoadPosition();ye=pe,W.PTSKnown&&pe<ae&&((M.end>ae||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),p.currentTime=ae+.05))}var he=this.getNextFragment(ye,W);if(!he){this.bufferFlushed=!0;return}((u=he.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((o=he.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(he,W):this.loadFragment(he,W,ye)},m.getMaxBufferLength=function(){var u=A.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return o===null?u:Math.max(u,o.len)},m.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(u,o){var x=o.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new R.Level(y)})},m.onAudioTrackSwitching=function(u,o){var x=!!o.url;this.trackId=o.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(b):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(u,o){this.mainDetails=o.details},m.onAudioTrackLoaded=function(u,o){var x,y=this.levels,p=o.details,D=o.id;if(!y){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+p.startSN+","+p.endSN+"],duration:"+p.totalduration);var U=y[D],B=0;if(p.live||(x=U.details)!==null&&x!==void 0&&x.live){var W=this.mainDetails;if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed||!W)return;!U.details&&p.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(p,W),B=p.fragments[0].start):B=this.alignPlaylists(p,U.details)}U.details=p,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!p.live)&&this.setStartPosition(U.details,B),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(p)&&(this.state=N.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(u){var o,x=u.frag,y=u.part,p=u.payload,D=this.config,U=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var W=B[U];console.assert(W,"Audio track is defined on fragment load progress");var M=W.details;console.assert(M,"Audio track details are defined on fragment load progress");var k=D.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new P.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[x.cc],ee=(o=x.initSegment)===null||o===void 0?void 0:o.data;if(X!==void 0){var ae=!1,ye=y?y.index:-1,pe=ye!==-1,he=new w.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,p.byteLength,ye,pe);H.push(p,ee,k,"",x,y,M.totalduration,ae,he,X)}else{a.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+U);var fe=this.waitingData=this.waitingData||{frag:x,part:y,cache:new g.default,complete:!1},de=fe.cache;de.push(new Uint8Array(p)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,u)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(u,o){var x=o.tracks.audio;x&&(this.mediaBuffer=x.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},m.onFragBuffered=function(u,o){var x=o.frag,y=o.part;if(x.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},m.onError=function(u,o){switch(o.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.AUDIO,o);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=o.fatal?N.State.ERROR:N.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(u,o){var x=o.type;x===h.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(u){var o,x="audio",y=this.hls,p=u.remuxResult,D=u.chunkMeta,U=this.getCurrentContext(D);if(!U){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var B=U.frag,W=U.part,M=p.audio,k=p.text,H=p.id3,X=p.initSegment;if(this.fragContextChanged(B))return;if(this.state=N.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,B,D),y.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:x,tracks:X.tracks})),M){var ee=M.startPTS,ae=M.endPTS,ye=M.startDTS,pe=M.endDTS;W&&(W.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:ae,startDTS:ye,endDTS:pe}),B.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,ee,ae,ye,pe),this.bufferFragmentData(M,B,W,D)}if(H!=null&&(o=H.samples)!==null&&o!==void 0&&o.length){var he=l({frag:B,id:x},H);y.trigger(O.Events.FRAG_PARSING_METADATA,he)}if(k){var fe=l({frag:B,id:x},k);y.trigger(O.Events.FRAG_PARSING_USERDATA,fe)}},m._bufferInitSegment=function(u,o,x){if(this.state!==N.State.PARSING)return;u.video&&delete u.video;var y=u.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,u);var p=y.initSegment;if(p!=null&&p.byteLength){var D={type:"audio",frag:o,part:null,chunkMeta:x,parent:o.type,data:p};this.hls.trigger(O.Events.BUFFER_APPENDING,D)}this.tick()},m.loadFragment=function(u,o,x){var y=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||y===I.FragmentState.NOT_LOADED||y===I.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):o.live&&!Object(K.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=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,u,o,x)))},m.completeAudioSwitch=function(){var u=this.hls,o=this.media,x=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:x})},T}(N.default);G.default=f},"./src/controller/audio-track-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/controller/base-playlist-controller.ts"),F=L("./src/types/loader.ts");function I(P,w){for(var E=0;E<w.length;E++){var v=w[E];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(P,v.key,v)}}function R(P,w,E){return w&&I(P.prototype,w),E&&I(P,E),P}function S(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,h(P,w)}function h(P,w){return h=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},h(P,w)}var g=function(P){S(w,P);function w(v){var d;return d=P.call(this,v,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var E=w.prototype;return E.registerListeners=function(){var d=this.hls;d.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(K.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var d=this.hls;d.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(K.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(d,a){this.tracks=a.audioTracks||[]},E.onAudioTrackLoaded=function(d,a){var l=a.id,s=a.details,_=this.tracksInGroup[l];if(!_){this.warn("Invalid audio track id "+l);return}var b=_.details;_.details=a.details,this.log("audioTrack "+l+" loaded ["+s.startSN+"-"+s.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,b))},E.onLevelLoading=function(d,a){this.switchLevel(a.level)},E.onLevelSwitching=function(d,a){this.switchLevel(a.level)},E.switchLevel=function(d){var a=this.hls.levels[d];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var s=this.tracks.filter(function(b){return!l||b.groupId===l});this.selectDefaultTrack&&!s.some(function(b){return b.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var _={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,_),this.selectInitialTrack()}},E.onError=function(d,a){if(P.prototype.onError.call(this,d,a),a.fatal||!a.context)return;a.context.type===F.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},E.setAudioTrack=function(d){var a=this.tracksInGroup;if(d<0||d>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+d);var s=a[d],_=s.id,b=s.groupId,f=b===void 0?"":b,A=s.name,T=s.type,m=s.url;if(this.trackId=d,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:_,groupId:f,name:A,type:T,url:m}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,l==null?void 0:l.details);this.loadPlaylist(c)},E.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(d){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var s=a[l];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},E.loadPlaylist=function(d){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,s=a.groupId,_=a.url;if(d)try{_=d.addDirectives(_)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:_,id:l,groupId:s,deliveryDirectives:d||null})}},R(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),w}(O.default);G.default=g},"./src/controller/base-playlist-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return R});var K=L("./src/polyfills/number.ts"),N=L("./src/types/level.ts"),O=L("./src/controller/level-helper.ts"),F=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),R=function(){function S(g,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,P+":"),this.warn=F.logger.warn.bind(F.logger,P+":"),this.hls=g}var h=S.prototype;return h.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},h.onError=function(P,w){w.fatal&&w.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},h.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},h.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},h.stopLoad=function(){this.canLoad=!1,this.clearTimer()},h.switchParams=function(P,w){var E=w==null?void 0:w.renditionReports;if(E)for(var v=0;v<E.length;v++){var d=E[v],a=""+d.URI;if(a===P.substr(-a.length)){var l=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var _=Math.min(w.age-w.partTarget,w.targetduration);s!==void 0&&_>w.partTarget&&(s+=1)}if(Object(K.isFiniteNumber)(l))return new N.HlsUrlParameters(l,Object(K.isFiniteNumber)(s)?s:void 0,N.HlsSkip.No)}}},h.loadPlaylist=function(P){},h.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},h.playlistLoaded=function(P,w,E){var v=this,d=w.details,a=w.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||E!=null&&E.live){if(d.reloaded(E),E&&this.log("live playlist "+P+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),E&&d.fragments.length>0&&Object(O.mergeDetails)(E,d),!this.canLoad||!d.live)return;var s,_=void 0,b=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,A=d.lastPartSn,T=d.endSN,m=d.lastPartIndex,c=m!==-1,u=A===T,o=f?0:m;c?(_=u?T+1:A,b=u?o:m+1):_=T+1;var x=d.age,y=x+d.ageHeader,p=Math.min(y-d.partTarget,d.targetduration*1.5);if(p>0){if(E&&p>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+p+" with playlist age: "+d.age),p=0;else{var D=Math.floor(p/d.targetduration);if(_+=D,b!==void 0){var U=Math.round(p%d.targetduration/d.partTarget);b+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+p+" skip sn "+D+" to part "+b)}d.tuneInGoal=p}if(s=this.getDeliveryDirectives(d,w.deliveryDirectives,_,b),f||!u){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,w.deliveryDirectives,_,b);var B=Object(O.computeReloadInterval)(d,a);_!==void 0&&d.canBlockReload&&(B-=d.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(s)},B)}else this.clearTimer()},h.getDeliveryDirectives=function(P,w,E,v){var d=Object(N.getSkipValue)(P,E);return w!=null&&w.skip&&P.deltaUpdateFailed&&(E=w.msn,v=w.part,d=N.HlsSkip.No),new N.HlsUrlParameters(E,v,d)},h.retryLoadingOrFail=function(P){var w=this,E=this.hls.config,v=this.retryCount<E.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(d=P.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return v},S}()},"./src/controller/base-stream-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"State",function(){return T}),L.d(G,"default",function(){return m});var K=L("./src/polyfills/number.ts"),N=L("./src/task-loop.ts"),O=L("./src/controller/fragment-tracker.ts"),F=L("./src/utils/buffer-helper.ts"),I=L("./src/utils/logger.ts"),R=L("./src/events.ts"),S=L("./src/errors.ts"),h=L("./src/types/transmuxer.ts"),g=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),E=L("./src/controller/level-helper.ts"),v=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),a=L("./src/utils/time-ranges.ts"),l=L("./src/types/loader.ts");function s(c,u){for(var o=0;o<u.length;o++){var x=u[o];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function _(c,u,o){return u&&s(c.prototype,u),o&&s(c,o),c}function b(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,A(c,u)}function A(c,u){return A=Object.setPrototypeOf||function(x,y){return x.__proto__=y,x},A(c,u)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},m=function(c){f(u,c);function u(x,y,p){var D;return D=c.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=T.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=p,D.log=I.logger.log.bind(I.logger,p+":"),D.warn=I.logger.warn.bind(I.logger,p+":"),D.hls=x,D.fragmentLoader=new v.default(x.config),D.fragmentTracker=y,D.config=x.config,D.decrypter=new d.default(x,x.config),x.on(R.Events.KEY_LOADED,D.onKeyLoaded,b(D)),D}var o=u.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(y){},o.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},o._streamEnded=function(y,p){var D=this.fragCurrent,U=this.fragmentTracker;if(!p.live&&D&&D.sn===p.endSN&&!y.nextStart){var B=U.getState(D);return B===O.FragmentState.PARTIAL||B===O.FragmentState.OK}return!1},o.onMediaAttached=function(y,p){var D=this.media=this.mediaBuffer=p.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(U.startPosition)},o.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var y=this.config,p=this.fragCurrent,D=this.media,U=this.mediaBuffer,B=this.state,W=D?D.currentTime:0,M=F.BufferHelper.bufferInfo(U||D,W,y.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+B),B===T.ENDED)this.resetLoadingState();else if(p&&!M.len){var k=y.maxFragLookUpTolerance,H=p.start-k,X=p.start+p.duration+k,ee=W>X;(W<H||ee)&&(ee&&p.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),p.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=W),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(y,p){if(this.state!==T.KEY_LOADING||p.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var D=this.levels[p.frag.level].details;D&&this.loadFragment(p.frag,D,p.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(R.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(y,p){this.log("Loading key for "+y.sn+" of ["+p.startSN+"-"+p.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=T.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(R.Events.KEY_LOADING,{frag:y})},o.loadFragment=function(y,p,D){this._loadFragForPlayback(y,p,D)},o._loadFragForPlayback=function(y,p,D){var U=this,B=function(M){if(U.fragContextChanged(y)){U.warn("Fragment "+y.sn+(M.part?" p: "+M.part.index:"")+" of level "+y.level+" was dropped during download."),U.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,U._handleFragmentLoadProgress(M)};this._doFragLoad(y,p,D,B).then(function(W){if(!W)return;U.fragLoadError=0;var M=U.state;if(U.fragContextChanged(y)){(M===T.FRAG_LOADING||M===T.BACKTRACKING||!U.fragCurrent&&M===T.PARSING)&&(U.fragmentTracker.removeFragment(y),U.state=T.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+y.sn+" of level "+y.level),U.hls.trigger(R.Events.FRAG_LOADED,W),U.state===T.BACKTRACKING)){U.fragmentTracker.backtrack(y,W),U.resetFragmentLoading(y);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(y)})},o.flushMainBuffer=function(y,p,D){if(D===void 0&&(D=null),!(y-p))return;var U={startOffset:y,endOffset:p,type:D};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,U)},o._loadInitSegment=function(y){var p=this;this._doFragLoad(y).then(function(D){if(!D||p.fragContextChanged(y)||!p.levels)throw new Error("init load aborted");return D}).then(function(D){var U=p.hls,B=D.payload,W=y.decryptdata;if(B&&B.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var M=self.performance.now();return p.decrypter.webCryptoDecrypt(new Uint8Array(B),W.key.buffer,W.iv.buffer).then(function(k){var H=self.performance.now();return U.trigger(R.Events.FRAG_DECRYPTED,{frag:y,payload:k,stats:{tstart:M,tdecrypt:H}}),D.payload=k,D})}return D}).then(function(D){var U=p.fragCurrent,B=p.hls,W=p.levels;if(!W)throw new Error("init load aborted, missing levels");var M=W[y.level].details;console.assert(M,"Level details are defined when init segment is loaded");var k=y.stats;p.state=T.IDLE,p.fragLoadError=0,y.data=new Uint8Array(D.payload),k.parsing.start=k.buffering.start=self.performance.now(),k.parsing.end=k.buffering.end=self.performance.now(),D.frag===U&&B.trigger(R.Events.FRAG_BUFFERED,{stats:k,frag:U,part:null,id:y.type}),p.tick()}).catch(function(D){p.warn(D),p.resetFragmentLoading(y)})},o.fragContextChanged=function(y){var p=this.fragCurrent;return!y||!p||y.level!==p.level||y.sn!==p.sn||y.urlId!==p.urlId},o.fragBufferedComplete=function(y,p){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(p?" part: "+p.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+a.default.toString(F.BufferHelper.getBuffered(D))),this.state=T.IDLE,this.tick()},o._handleFragmentLoadComplete=function(y){var p=this.transmuxer;if(!p)return;var D=y.frag,U=y.part,B=y.partsLoaded,W=!B||B.length===0||B.some(function(k){return!k}),M=new h.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,U?U.index:-1,!W);p.flush(M)},o._handleFragmentLoadProgress=function(y){},o._doFragLoad=function(y,p,D,U){var B=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(y.start,D||0),this.config.lowLatencyMode&&p){var W=p.partList;if(W&&U){D>y.end&&p.fragmentHint&&(y=p.fragmentHint);var M=this.getNextPart(W,y,D);if(M>-1){var k=W[M];return this.log("Loading part sn: "+y.sn+" p: "+k.index+" cc: "+y.cc+" of playlist ["+p.startSN+"-"+p.endSN+"] parts [0-"+M+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=k.start+k.duration,this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,part:W[M],targetBufferTime:D}),this.doFragPartsLoad(y,W,M,U).catch(function(H){return B.handleFragLoadError(H)})}else if(!y.url||this.loadedEndOfParts(W,D))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(p?"of ["+p.startSN+"-"+p.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(D.toFixed(3))),Object(K.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,targetBufferTime:D}),this.fragmentLoader.load(y,U).catch(function(H){return B.handleFragLoadError(H)})},o.doFragPartsLoad=function(y,p,D,U){var B=this;return new Promise(function(W,M){var k=[],H=function X(ee){var ae=p[ee];B.fragmentLoader.loadPart(y,ae,U).then(function(ye){k[ae.index]=ye;var pe=ye.part;B.hls.trigger(R.Events.FRAG_LOADED,ye);var he=p[ee+1];if(he&&he.fragment===y)X(ee+1);else return W({frag:y,part:pe,partsLoaded:k})}).catch(M)};H(D)})},o.handleFragLoadError=function(y){var p=y.data;return p&&p.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(p.frag,p.part):this.hls.trigger(R.Events.ERROR,p),null},o._handleTransmuxerFlush=function(y){var p=this.getCurrentContext(y);if(!p||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var D=p.frag,U=p.part,B=p.level,W=self.performance.now();D.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(D,U,B,y.partial)},o.getCurrentContext=function(y){var p=this.levels,D=y.level,U=y.sn,B=y.part;if(!p||!p[D])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+D+". The current chunk will not be buffered."),null;var W=p[D],M=B>-1?Object(E.getPartWith)(W,U,B):null,k=M?M.fragment:Object(E.getFragmentWithSN)(W,U,this.fragCurrent);return k?{frag:k,part:M,level:W}:null},o.bufferFragmentData=function(y,p,D,U){if(!y||this.state!==T.PARSING)return;var B=y.data1,W=y.data2,M=B;if(B&&W&&(M=Object(g.appendUint8Array)(B,W)),!M||!M.length)return;var k={type:y.type,frag:p,part:D,chunkMeta:U,parent:p.type,data:M};this.hls.trigger(R.Events.BUFFER_APPENDING,k),y.dropped&&y.independent&&!D&&this.flushBufferGap(p)},o.flushBufferGap=function(y){var p=this.media;if(!p)return;if(!F.BufferHelper.isBuffered(p,p.currentTime)){this.flushMainBuffer(0,y.start);return}var D=p.currentTime,U=F.BufferHelper.bufferInfo(p,D,0),B=y.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),M=Math.max(Math.min(y.start-W,U.end-W),D+W);y.start-M>W&&this.flushMainBuffer(M,y.start)},o.getFwdBufferInfo=function(y,p){var D=this.config,U=this.getLoadPosition();if(!Object(K.isFiniteNumber)(U))return null;var B=F.BufferHelper.bufferInfo(y,U,D.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,p);if(W&&B.nextStart<W.end)return F.BufferHelper.bufferInfo(y,U,Math.max(B.nextStart,D.maxBufferHole))}return B},o.getMaxBufferLength=function(y){var p=this.config,D;return y?D=Math.max(8*p.maxBufferSize/y,p.maxBufferLength):D=p.maxBufferLength,Math.min(D,p.maxMaxBufferLength)},o.reduceMaxBufferLength=function(y){var p=this.config,D=y||p.maxBufferLength;return p.maxMaxBufferLength>=D?(p.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+p.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(y,p){var D,U,B=p.fragments,W=B.length;if(!W)return null;var M=this.config,k=B[0].start,H;if(p.live){var X=M.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!p.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(p,B),this.startPosition=H?this.hls.liveSyncPosition||H.start:y)}else y<=k&&(H=B[0]);if(!H){var ee=M.lowLatencyMode?p.partEnd:p.fragmentEnd;H=this.getFragmentAtPosition(y,ee,p)}return(D=H)!==null&&D!==void 0&&D.initSegment&&!((U=H)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},o.getNextPart=function(y,p,D){for(var U=-1,B=!1,W=!0,M=0,k=y.length;M<k;M++){var H=y[M];if(W=W&&!H.independent,U>-1&&D<H.start)break;var X=H.loaded;!X&&(B||H.independent||W)&&H.fragment===p&&(U=M),B=X}return U},o.loadedEndOfParts=function(y,p){var D=y[y.length-1];return D&&p>D.start&&D.loaded},o.getInitialLiveFragment=function(y,p){var D=this.fragPrevious,U=null;if(D){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),U=Object(w.findFragmentByPDT)(p,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var B=D.sn+1;if(B>=y.startSN&&B<=y.endSN){var W=p[B-y.startSN];D.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(w.findFragWithCC)(p,D.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(U=this.getFragmentAtPosition(M,this.bitrateTest?y.fragmentEnd:y.edge,y))}return U},o.getFragmentAtPosition=function(y,p,D){var U=this.config,B=this.fragPrevious,W=D.fragments,M=D.endSN,k=D.fragmentHint,H=U.maxFragLookUpTolerance,X=!!(U.lowLatencyMode&&D.partList&&k);X&&k&&!this.bitrateTest&&(W=W.concat(k),M=k.sn);var ee;if(y<p){var ae=y>p-H?0:H;ee=Object(w.findFragmentByPTS)(B,W,y,ae)}else ee=W[W.length-1];if(ee){var ye=ee.sn-D.startSN,pe=B&&ee.level===B.level,he=W[ye+1],fe=this.fragmentTracker.getState(ee);if(fe===O.FragmentState.BACKTRACKED){ee=null;for(var de=ye;W[de]&&this.fragmentTracker.getState(W[de])===O.FragmentState.BACKTRACKED;)B?ee=W[de--]:ee=W[--de];ee||(ee=he)}else B&&ee.sn===B.sn&&!X&&(pe&&(ee.sn<M&&this.fragmentTracker.getState(he)!==O.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+he.sn),ee=he):ee=null))}return ee},o.synchronizeToLiveEdge=function(y){var p=this.config,D=this.media;if(!D)return;var U=this.hls.liveSyncPosition,B=D.currentTime,W=y.fragments[0].start,M=y.edge,k=B>=W-p.maxFragLookUpTolerance&&B<=M;if(U!==null&&D.duration>U&&(B<U||!k)){var H=p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:p.liveMaxLatencyDurationCount*y.targetduration;(!k&&D.readyState<4||B<M-H)&&(this.loadedmetadata||(this.nextLoadPosition=U),D.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+U.toFixed(3)),D.currentTime=U))}},o.alignPlaylists=function(y,p){var D=this.levels,U=this.levelLastLoaded,B=this.fragPrevious,W=U!==null?D[U]:null,M=y.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var k=y.fragments[0].start,H=!p,X=y.alignedSliding&&Object(K.isFiniteNumber)(k);if(H||!X&&!k){Object(P.alignStream)(B,W,y);var ee=y.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(p?p.startSN:"na")+"->"+y.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+M),ee}return k},o.waitForCdnTuneIn=function(y){var p=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*p)},o.setStartPosition=function(y,p){var D=this.startPosition;if(D<p&&(D=-1),D===-1||this.lastCurrentTime===-1){var U=y.startTimeOffset;Object(K.isFiniteNumber)(U)?(D=p+U,U<0&&(D+=y.totalduration),D=Math.min(Math.max(p,D),p+y.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+D),this.startPosition=D):y.live?D=this.hls.liveSyncPosition||p:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},o.getLoadPosition=function(){var y=this.media,p=0;return this.loadedmetadata&&y?p=y.currentTime:this.nextLoadPosition&&(p=this.nextLoadPosition),p},o.handleFragLoadAborted=function(y,p){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(p?" part"+p.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},o.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=T.IDLE)},o.onFragmentOrKeyLoadError=function(y,p){if(p.fatal)return;var D=p.frag;if(!D||D.type!==y)return;var U=this.fragCurrent;console.assert(U&&D.sn===U.sn&&D.level===U.level&&D.urlId===U.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+y+" "+D.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else p.levelRetry?(y===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(I.logger.error(p.details+" reaches max retry, redispatch as fatal ..."),p.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},o.afterBufferFlushed=function(y,p,D){if(!y)return;var U=F.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(p,U,D),this.state===T.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},o.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var p=this.levels?this.levels[y].details:null;if(p!=null&&p.live)return this.startPosition=-1,this.setStartPosition(p,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(y,p,D,U){var B=this,W=D.details;console.assert(!!W,"level.details must be defined");var M=Object.keys(y.elementaryStreams).reduce(function(k,H){var X=y.elementaryStreams[H];if(X){var ee=X.endPTS-X.startPTS;if(ee<=0)return B.warn("Could not parse fragment "+y.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),k||!1;var ae=U?0:Object(E.updateFragPTSDTS)(W,y,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return B.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:W,level:D,drift:ae,type:H,frag:y,start:X.startPTS,end:X.endPTS}),!0}return k},!1);M?(this.state=T.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:y,part:p})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},_(u,[{key:"state",get:function(){return this._state},set:function(y){var p=this._state;p!==y&&(this._state=y,this.log(p+"->"+y))}}]),u}(N.default)},"./src/controller/buffer-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return w});var K=L("./src/polyfills/number.ts"),N=L("./src/events.ts"),O=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),I=L("./src/utils/buffer-helper.ts"),R=L("./src/utils/mediasource-helper.ts"),S=L("./src/loader/fragment.ts"),h=L("./src/controller/buffer-operation-queue.ts"),g=Object(R.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function E(d){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=a.hls,s=a.media,_=a.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),s&&(a.updateMediaElementDuration(),l.trigger(N.Events.MEDIA_ATTACHED,{media:s})),_&&_.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=E.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var a=this.hls;a.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(N.Events.BUFFER_RESET,this.onBufferReset,this),a.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(N.Events.BUFFER_EOS,this.onBufferEos,this),a.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(N.Events.FRAG_PARSED,this.onFragParsed,this),a.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(N.Events.BUFFER_RESET,this.onBufferReset,this),a.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(N.Events.BUFFER_EOS,this.onBufferEos,this),a.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(N.Events.FRAG_PARSED,this.onFragParsed,this),a.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new h.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(a,l){var s=2;(l.audio&&!l.video||!l.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(a,l){var s=this.media=l.media;if(s&&g){var _=this.mediaSource=new g;_.addEventListener("sourceopen",this._onMediaSourceOpen),_.addEventListener("sourceended",this._onMediaSourceEnded),_.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(_),this._objectUrl=s.src}},v.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,s=this._objectUrl;if(l){if(O.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(_){O.logger.warn("[buffer-controller]: onMediaDetaching: "+_.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(s&&self.URL.revokeObjectURL(s),a.src===s?(a.removeAttribute("src"),a.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(N.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var s=a.sourceBuffer[l];try{s&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(s),a.sourceBuffer[l]=void 0)}catch(_){O.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",_)}}),this._initSourceBuffer()},v.onBufferCodecs=function(a,l){var s=this,_=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(b){if(_){var f=s.tracks[b];if(f&&typeof f.buffer.changeType=="function"){var A=l[b],T=A.codec,m=A.levelCodec,c=A.container,u=(f.levelCodec||f.codec).replace(P,"$1"),o=(m||T).replace(P,"$1");if(u!==o){var x=c+";codecs="+(m||T);s.appendChangeType(b,x)}}}else s.pendingTracks[b]=l[b]}),_)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(a,l){var s=this,_=this.operationQueue,b={execute:function(){var A=s.sourceBuffer[a];A&&(O.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),A.changeType(l)),_.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(A){O.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",A)}};_.append(b,a)},v.onBufferAppending=function(a,l){var s=this,_=this.hls,b=this.operationQueue,f=this.tracks,A=l.data,T=l.type,m=l.frag,c=l.part,u=l.chunkMeta,o=u.buffering[T],x=self.performance.now();o.start=x;var y=m.stats.buffering,p=c?c.stats.buffering:null;y.start===0&&(y.start=x),p&&p.start===0&&(p.start=x);var D=f.audio,U=T==="audio"&&u.id===1&&(D==null?void 0:D.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),U){var M=s.sourceBuffer[T];if(M){var k=m.start-M.timestampOffset;Math.abs(k)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+k+") sn: "+m.sn+")"),M.timestampOffset=m.start)}}s.appendExecutor(A,T)},onStart:function(){},onComplete:function(){var M=self.performance.now();o.executeEnd=o.end=M,y.first===0&&(y.first=M),p&&p.first===0&&(p.first=M);var k=s.sourceBuffer,H={};for(var X in k)H[X]=I.BufferHelper.getBuffered(k[X]);s.appendError=0,s.hls.trigger(N.Events.BUFFER_APPENDED,{type:T,frag:m,part:c,chunkMeta:u,parent:m.type,timeRanges:H})},onError:function(M){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",M);var k={type:F.ErrorTypes.MEDIA_ERROR,parent:m.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?k.details=F.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,k.details=F.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>_.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+_.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),k.fatal=!0)),_.trigger(N.Events.ERROR,k)}};b.append(B,T)},v.onBufferFlushing=function(a,l){var s=this,_=this.operationQueue,b=function(A){return{execute:s.removeExecutor.bind(s,A,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(N.Events.BUFFER_FLUSHED,{type:A})},onError:function(m){O.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",m)}}};l.type?_.append(b(l.type),l.type):this.getSourceBufferTypes().forEach(function(f){_.append(b(f),f)})},v.onFragParsed=function(a,l){var s=this,_=l.frag,b=l.part,f=[],A=b?b.elementaryStreams:_.elementaryStreams;A[S.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(A[S.ElementaryStreamTypes.AUDIO]&&f.push("audio"),A[S.ElementaryStreamTypes.VIDEO]&&f.push("video"));var T=function(){var c=self.performance.now();_.stats.buffering.end=c,b&&(b.stats.buffering.end=c);var u=b?b.stats:_.stats;s.hls.trigger(N.Events.FRAG_BUFFERED,{frag:_,part:b,stats:u,id:_.type})};f.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+_.type+" level: "+_.level+" sn: "+_.sn),this.blockBuffers(T,f)},v.onFragChanged=function(a,l){this.flushBackBuffer()},v.onBufferEos=function(a,l){var s=this,_=this.getSourceBufferTypes().reduce(function(b,f){var A=s.sourceBuffer[f];return(!l.type||l.type===f)&&(A&&!A.ended&&(A.ended=!0,O.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),b&&!!(!A||A.ended)},!0);_&&this.blockBuffers(function(){var b=s.mediaSource;if(!b||b.readyState!=="open")return;b.endOfStream()})},v.onLevelUpdated=function(a,l){var s=l.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var a=this.hls,l=this.details,s=this.media,_=this.sourceBuffer;if(!s||l===null)return;var b=this.getSourceBufferTypes();if(!b.length)return;var f=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(K.isFiniteNumber)(f)||f<0)return;var A=s.currentTime,T=l.levelTargetDuration,m=Math.max(f,T),c=Math.floor(A/T)*T-m;b.forEach(function(u){var o=_[u];if(o){var x=I.BufferHelper.getBuffered(o);x.length>0&&c>x.start(0)&&(a.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&a.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),a.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,s=this.media,_=this.mediaSource,b=a.fragments[0].start+a.totalduration,f=s.duration,A=Object(K.isFiniteNumber)(_.duration)?_.duration:0;a.live&&l.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),_.duration=Infinity,this.updateSeekableRange(a)):(b>A&&b>f||!Object(K.isFiniteNumber)(f))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+b.toFixed(3)),_.duration=b)},v.updateSeekableRange=function(a){var l=this.mediaSource,s=a.fragments,_=s.length;if(_&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var b=Math.max(0,s[0].start),f=Math.max(b,b+a.totalduration);l.setLiveSeekableRange(b,f)}},v.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,s=this.pendingTracks,_=Object.keys(s).length;if(_&&!a||_===2){this.createSourceBuffers(s),this.pendingTracks={};var b=this.getSourceBufferTypes();if(b.length===0){this.hls.trigger(N.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}b.forEach(function(f){l.executeNext(f)})}},v.createSourceBuffers=function(a){var l=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var _=0;for(var b in a)if(!l[b]){var f=a[b];if(!f)throw Error("source buffer exists for track "+b+", however track does not");var A=f.levelCodec||f.codec,T=f.container+";codecs="+A;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var m=l[b]=s.addSourceBuffer(T),c=b;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[b]={buffer:m,codec:A,container:f.container,levelCodec:f.levelCodec,id:f.id},_++}catch(u){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(N.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:T})}}_&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(a){var l=this.operationQueue,s=l.current(a);s.onStart()},v._onSBUpdateEnd=function(a){var l=this.operationQueue,s=l.current(a);s.onComplete(),l.shiftAndExecuteNext(a)},v._onSBUpdateError=function(a,l){O.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(N.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(a);s&&s.onError(l)},v.removeExecutor=function(a,l,s){var _=this.media,b=this.mediaSource,f=this.operationQueue,A=this.sourceBuffer,T=A[a];if(!_||!b||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(a);return}var m=Object(K.isFiniteNumber)(_.duration)?_.duration:Infinity,c=Object(K.isFiniteNumber)(b.duration)?b.duration:Infinity,u=Math.max(0,l),o=Math.min(s,m,c);o>u?(O.logger.log("[buffer-controller]: Removing ["+u+","+o+"] from the "+a+" SourceBuffer"),console.assert(!T.updating,a+" sourceBuffer must not be updating"),T.remove(u,o)):f.shiftAndExecuteNext(a)},v.appendExecutor=function(a,l){var s=this.operationQueue,_=this.sourceBuffer,b=_[l];if(!b){O.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(l);return}b.ended=!1,console.assert(!b.updating,l+" sourceBuffer must not be updating"),b.appendBuffer(a)},v.blockBuffers=function(a,l){var s=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var _=this.operationQueue,b=l.map(function(f){return _.appendBlocker(f)});Promise.all(b).then(function(){a(),l.forEach(function(f){var A=s.sourceBuffer[f];(!A||!A.updating)&&_.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(a,l,s){var _=this.sourceBuffer[a];if(!_)return;var b=s.bind(this,a);this.listeners[a].push({event:l,listener:b}),_.addEventListener(l,b)},v.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(s){l.removeEventListener(s.event,s.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return N});var K=L("./src/utils/logger.ts"),N=function(){function O(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var F=O.prototype;return F.append=function(R,S){var h=this.queues[S];h.push(R),h.length===1&&this.buffers[S]&&this.executeNext(S)},F.insertAbort=function(R,S){var h=this.queues[S];h.unshift(R),this.executeNext(S)},F.appendBlocker=function(R){var S,h=new Promise(function(P){S=P}),g={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(g,R),h},F.executeNext=function(R){var S=this.buffers,h=this.queues,g=S[R],P=h[R];if(P.length){var w=P[0];try{w.execute()}catch(E){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(E),(!g||!g.updating)&&(P.shift(),this.executeNext(R))}}},F.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},F.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/events.ts");function N(I,R){for(var S=0;S<R.length;S++){var h=R[S];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(I,h.key,h)}}function O(I,R,S){return R&&N(I.prototype,R),S&&N(I,S),I}var F=function(){function I(S){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=S,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=I.prototype;return R.setStreamController=function(h){this.streamController=h},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var h=this.hls;h.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var h=this.hls;h.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(h,g){I.isLevelAllowed(g.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(g.droppedLevel)},R.onMediaAttaching=function(h,g){this.media=g.media instanceof HTMLVideoElement?g.media:null},R.onManifestParsed=function(h,g){var P=this.hls;this.restrictedLevels=[],this.firstLevel=g.firstLevel,P.config.capLevelToPlayerSize&&g.video&&this.startCapping()},R.onBufferCodecs=function(h,g){var P=this.hls;P.config.capLevelToPlayerSize&&g.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var h=this.hls.levels;if(h.length){var g=this.hls;g.autoLevelCapping=this.getMaxLevel(h.length-1),g.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=g.autoLevelCapping}}},R.getMaxLevel=function(h){var g=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(E,v){return I.isLevelAllowed(v,g.restrictedLevels)&&v<=h});return this.clientRect=null,I.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var h=this.media,g={width:0,height:0};if(h){var P=h.getBoundingClientRect();g.width=P.width,g.height=P.height,!g.width&&!g.height&&(g.width=P.right-P.left||h.width||0,g.height=P.bottom-P.top||h.height||0)}return this.clientRect=g,g},I.isLevelAllowed=function(h,g){return g===void 0&&(g=[]),g.indexOf(h)===-1},I.getMaxLevelByMediaSize=function(h,g,P){if(!h||!h.length)return-1;for(var w=function(l,s){return s?l.width!==s.width||l.height!==s.height:!0},E=h.length-1,v=0;v<h.length;v+=1){var d=h[v];if((d.width>=g||d.height>=P)&&w(d,h[v+1])){E=v;break}}return E},O(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 h=1;try{h=self.devicePixelRatio}catch(g){}return h}}]),I}();G.default=F},"./src/controller/cmcd-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return w});var K=L("./src/events.ts"),N=L("./src/types/cmcd.ts"),O=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts");function I(E,v){for(var d=0;d<v.length;d++){var a=v[d];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(E,a.key,a)}}function R(E,v,d){return v&&I(E.prototype,v),d&&I(E,d),E}function S(E,v){var d=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(d)return(d=d.call(E)).next.bind(d);if(Array.isArray(E)||(d=h(E))||v&&E&&typeof E.length=="number"){d&&(E=d);var a=0;return function(){return a>=E.length?{done:!0}:{done:!1,value:E[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function h(E,v){if(!E)return;if(typeof E=="string")return g(E,v);var d=Object.prototype.toString.call(E).slice(8,-1);if(d==="Object"&&E.constructor&&(d=E.constructor.name),d==="Map"||d==="Set")return Array.from(E);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return g(E,v)}function g(E,v){(v==null||v>E.length)&&(v=E.length);for(var d=0,a=new Array(v);d<v;d++)a[d]=E[d];return a}function P(){return P=Object.assign||function(E){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(E[a]=d[a])}return E},P.apply(this,arguments)}var w=function(){function E(d){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(_){try{a.apply(_,{ot:N.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(b){F.logger.warn("Could not generate manifest CMCD data.",b)}},this.applyFragmentData=function(_){try{var b=_.frag,f=a.hls.levels[b.level],A=a.getObjectType(b),T={d:b.duration*1e3,ot:A};(A===N.CMCDObjectType.VIDEO||A===N.CMCDObjectType.AUDIO||A==N.CMCDObjectType.MUXED)&&(T.br=f.bitrate/1e3,T.tb=a.getTopBandwidth(A),T.bl=a.getBufferLength(A)),a.apply(_,T)}catch(m){F.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=d;var l=this.config=d.config,s=l.cmcd;s!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||E.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var v=E.prototype;return v.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(a,l){var s,_;this.audioBuffer=(s=l.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(_=l.tracks.video)===null||_===void 0?void 0:_.buffer},v.createData=function(){var a;return{v:N.CMCDVersion,sf:N.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(a,l){l===void 0&&(l={}),P(l,this.createData());var s=l.ot===N.CMCDObjectType.INIT||l.ot===N.CMCDObjectType.VIDEO||l.ot===N.CMCDObjectType.MUXED;if(this.starved&&s&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var _=E.toHeaders(l);if(!Object.keys(_).length)return;a.headers||(a.headers={}),P(a.headers,_)}else{var b=E.toQuery(l);if(!b)return;a.url=E.appendQueryToUri(a.url,b)}},v.getObjectType=function(a){var l=a.type;return l==="subtitle"?N.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?N.CMCDObjectType.INIT:l==="audio"?N.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(a){for(var l=0,s=a===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,_=S(s),b;!(b=_()).done;){var f=b.value;f.bitrate>l&&(l=f.bitrate)}return l>0?l:NaN},v.getBufferLength=function(a){var l=this.hls.media,s=a===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!l)return NaN;var _=O.BufferHelper.bufferInfo(s,l.currentTime,this.config.maxBufferHole);return _.len*1e3},v.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,s=a||this.config.loader;return function(){function _(f){this.loader=void 0,this.loader=new s(f)}var b=_.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(A,T,m){l(A),this.loader.load(A,T,m)},R(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},v.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,s=a||this.config.loader;return function(){function _(f){this.loader=void 0,this.loader=new s(f)}var b=_.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(A,T,m){l(A),this.loader.load(A,T,m)},R(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},E.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},E.serialize=function(a){for(var l=[],s=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},_=function(U){return Math.round(U)},b=function(U){return _(U/100)*100},f=function(U){return encodeURIComponent(U)},A={br:_,d:_,bl:b,dl:b,mtp:b,nor:f,rtp:b,tb:_},T=Object.keys(a||{}).sort(),m=S(T),c;!(c=m()).done;){var u=c.value,o=a[u];if(!s(o))continue;if(u==="v"&&o===1)continue;if(u=="pr"&&o===1)continue;var x=A[u];x&&(o=x(o));var y=typeof o,p=void 0;u==="ot"||u==="sf"||u==="st"?p=u+"="+o:y==="boolean"?p=u:y==="number"?p=u+"="+o:p=u+"="+JSON.stringify(o),l.push(p)}return l.join(",")},E.toHeaders=function(a){for(var l=Object.keys(a),s={},_=["Object","Request","Session","Status"],b=[{},{},{},{}],f={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,T=l;A<T.length;A++){var m=T[A],c=f[m]!=null?f[m]:1;b[c][m]=a[m]}for(var u=0;u<b.length;u++){var o=E.serialize(b[u]);o&&(s["CMCD-"+_[u]]=o)}return s},E.toQuery=function(a){return"CMCD="+encodeURIComponent(E.serialize(a))},E.appendQueryToUri=function(a,l){if(!l)return a;var s=a.includes("?")?"&":"?";return""+a+s+l},E}()},"./src/controller/eme-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),F=L("./src/utils/mediakeys-helper.ts");function I(w,E){for(var v=0;v<E.length;v++){var d=E[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,E,v){return E&&I(w.prototype,E),v&&I(w,v),w}var S=3,h=function(E,v,d){var a={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),v.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[a]},g=function(E,v,d,a){switch(E){case F.KeySystems.WIDEVINE:return h(v,d,a);default:throw new Error("Unknown key-system: "+E)}},P=function(){function w(v){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=v,this._config=v.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 E=w.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E.getLicenseServerUrl=function(d){switch(d){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},E._attemptKeySystemAccess=function(d,a,l){var s=this,_=g(d,a,l,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var b=this.requestMediaKeySystemAccess(d,_);this.mediaKeysPromise=b.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),b.catch(function(f){O.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},E._onMediaKeySystemAccessObtained=function(d,a){var l=this;O.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var _=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(b){return s.mediaKeys=b,O.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),b});return _.catch(function(b){O.logger.error("Failed to create media-keys:",b)}),_},E._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),d._onNewMediaKeySession(a.mediaKeysSession))})},E._onNewMediaKeySession=function(d){var a=this;O.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){a._onKeySessionMessage(d,l.message)},!1)},E._onKeySessionMessage=function(d,a){O.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){O.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},E.onMediaEncrypted=function(d){var a=this;if(O.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(_){if(!a._media)return;a._attemptSetMediaKeys(_),a._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},E._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(d,a){var l=this,s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var _=s.mediaKeysSession;if(!_){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,_.generateRequest(d,a).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(b){O.logger.error("Error generating key-session request:",b),l.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(d,a,l){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,a,l);var _=this._licenseXhrSetup;if(_)try{_.call(this.hls,s,d),_=void 0}catch(b){O.logger.error(b)}try{s.readyState||s.open("POST",d,!0),_&&_.call(this.hls,s,d)}catch(b){throw new Error("issue setting up KeySystem license XHR "+b)}return s},E._onLicenseRequestReadyStageChange=function(d,a,l,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var _=d.response,b=this._licenseResponseCallback;if(b)try{_=b.call(this.hls,d,a)}catch(A){O.logger.error(A)}s(_)}else{if(O.logger.error("License Request XHR failed ("+a+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=S-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(l,s)}break}},E._generateLicenseRequestChallenge=function(d,a){switch(d.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},E._requestLicense=function(d,a){O.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(l.mediaKeySystemDomain),_=this._createLicenseXhr(s,d,a);O.logger.log("Sending license request to URL: "+s);var b=this._generateLicenseRequestChallenge(l,d);_.send(b)}catch(f){O.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(d,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var d=this._media,a=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(d,a){if(!this._emeEnabled)return;var l=a.levels.map(function(_){return _.audioCodec}).filter(function(_){return!!_}),s=a.levels.map(function(_){return _.videoCodec}).filter(function(_){return!!_});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,l,s)},R(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();G.default=P},"./src/controller/fps-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/events.ts"),N=L("./src/utils/logger.ts"),O=function(){function F(R){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=R,this.registerListeners()}var I=F.prototype;return I.setStreamController=function(S){this.streamController=S},I.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(S,h){var g=this.hls.config;if(g.capLevelOnFPSDrop){var P=h.media instanceof self.HTMLVideoElement?h.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),g.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(S,h,g){var P=performance.now();if(h){if(this.lastTime){var w=P-this.lastTime,E=g-this.lastDroppedFrames,v=h-this.lastDecodedFrames,d=1e3*E/w,a=this.hls;if(a.trigger(K.Events.FPS_DROP,{currentDropped:E,currentDecoded:v,totalDroppedFrames:g}),d>0&&E>a.config.fpsDroppedMonitoringThreshold*v){var l=a.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=g,this.lastDecodedFrames=h}},I.checkFPSInterval=function(){var S=this.media;if(S)if(this.isVideoPlaybackQualityAvailable){var h=S.getVideoPlaybackQuality();this.checkFPS(S,h.totalVideoFrames,h.droppedVideoFrames)}else this.checkFPS(S,S.webkitDecodedFrameCount,S.webkitDroppedFrameCount)},F}();G.default=O},"./src/controller/fragment-finders.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"findFragmentByPDT",function(){return O}),L.d(G,"findFragmentByPTS",function(){return F}),L.d(G,"fragmentWithinToleranceTest",function(){return I}),L.d(G,"pdtWithinToleranceTest",function(){return R}),L.d(G,"findFragWithCC",function(){return S});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/binary-search.ts");function O(h,g,P){if(g===null||!Array.isArray(h)||!h.length||!Object(K.isFiniteNumber)(g))return null;var w=h[0].programDateTime;if(g<(w||0))return null;var E=h[h.length-1].endProgramDateTime;if(g>=(E||0))return null;P=P||0;for(var v=0;v<h.length;++v){var d=h[v];if(R(g,P,d))return d}return null}function F(h,g,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var E=null;if(h?E=g[h.sn-g[0].sn+1]||null:P===0&&g[0].start===0&&(E=g[0]),E&&I(P,w,E)===0)return E;var v=N.default.search(g,I.bind(null,P,w));return v||E}function I(h,g,P){h===void 0&&(h=0),g===void 0&&(g=0);var w=Math.min(g,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=h?1:P.start-w>h&&P.start?-1:0}function R(h,g,P){var w=Math.min(g,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,E=P.endProgramDateTime||0;return E-w>h}function S(h,g){return N.default.search(h,function(P){return P.cc<g?1:P.cc>g?-1:0})}},"./src/controller/fragment-tracker.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"FragmentState",function(){return O}),L.d(G,"FragmentTracker",function(){return F});var K=L("./src/events.ts"),N=L("./src/types/loader.ts"),O;(function(S){S.NOT_LOADED="NOT_LOADED",S.BACKTRACKED="BACKTRACKED",S.APPENDING="APPENDING",S.PARTIAL="PARTIAL",S.OK="OK"})(O||(O={}));var F=function(){function S(g){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=g,this._registerListeners()}var h=S.prototype;return h._registerListeners=function(){var P=this.hls;P.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},h._unregisterListeners=function(){var P=this.hls;P.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},h.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},h.getAppendedFrag=function(P,w){if(w===N.PlaylistLevelType.MAIN){var E=this.activeFragment,v=this.activeParts;if(!E)return null;if(v)for(var d=v.length;d--;){var a=v[d],l=a?a.end:E.appendedPTS;if(a.start<=P&&l!==void 0&&P<=l)return d>9&&(this.activeParts=v.slice(d-9)),a}else if(E.start<=P&&E.appendedPTS!==void 0&&P<=E.appendedPTS)return E}return this.getBufferedFrag(P,w)},h.getBufferedFrag=function(P,w){for(var E=this.fragments,v=Object.keys(E),d=v.length;d--;){var a=E[v[d]];if((a==null?void 0:a.body.type)===w&&a.buffered){var l=a.body;if(l.start<=P&&P<=l.end)return l}}return null},h.detectEvictedFragments=function(P,w,E){var v=this;Object.keys(this.fragments).forEach(function(d){var a=v.fragments[d];if(!a)return;if(!a.buffered){a.body.type===E&&v.removeFragment(a.body);return}var l=a.range[P];if(!l)return;l.time.some(function(s){var _=!v.isTimeBuffered(s.startPTS,s.endPTS,w);return _&&v.removeFragment(a.body),_})})},h.detectPartialFragments=function(P){var w=this,E=this.timeRanges,v=P.frag,d=P.part;if(!E||v.sn==="initSegment")return;var a=R(v),l=this.fragments[a];if(!l)return;Object.keys(E).forEach(function(s){var _=v.elementaryStreams[s];if(!_)return;var b=E[s],f=d!==null||_.partial===!0;l.range[s]=w.getBufferedTimes(v,d,f,b)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},h.fragBuffered=function(P){var w=R(P),E=this.fragments[w];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},h.getBufferedTimes=function(P,w,E,v){for(var d={time:[],partial:E},a=w?w.start:P.start,l=w?w.end:P.end,s=P.minEndPTS||l,_=P.maxStartPTS||a,b=0;b<v.length;b++){var f=v.start(b)-this.bufferPadding,A=v.end(b)+this.bufferPadding;if(_>=f&&s<=A){d.time.push({startPTS:Math.max(a,v.start(b)),endPTS:Math.min(l,v.end(b))});break}else if(a<A&&l>f)d.partial=!0,d.time.push({startPTS:Math.max(a,v.start(b)),endPTS:Math.min(l,v.end(b))});else if(l<=f)break}return d},h.getPartialFragment=function(P){var w=null,E,v,d,a=0,l=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(_){var b=s[_];if(!b)return;I(b)&&(v=b.body.start-l,d=b.body.end+l,P>=v&&P<=d&&(E=Math.min(P-v,d-P),a<=E&&(w=b.body,a=E)))}),w},h.getState=function(P){var w=R(P),E=this.fragments[w];return E?E.buffered?I(E)?O.PARTIAL:O.OK:E.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},h.backtrack=function(P,w){var E=R(P),v=this.fragments[E];if(!v||v.backtrack)return null;var d=v.backtrack=w||v.loaded;return v.loaded=null,d},h.getBacktrackData=function(P){var w=R(P),E=this.fragments[w];if(E){var v,d=E.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(P)}return null},h.isTimeBuffered=function(P,w,E){for(var v,d,a=0;a<E.length;a++){if(v=E.start(a)-this.bufferPadding,d=E.end(a)+this.bufferPadding,P>=v&&w<=d)return!0;if(w<=v)return!1}return!1},h.onFragLoaded=function(P,w){var E=w.frag,v=w.part;if(E.sn==="initSegment"||E.bitrateTest||v)return;var d=R(E);this.fragments[d]={body:E,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},h.onBufferAppended=function(P,w){var E=this,v=w.frag,d=w.part,a=w.timeRanges;if(v.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(s){var _=a[s];if(E.detectEvictedFragments(s,_),!d)for(var b=0;b<_.length;b++)v.appendedPTS=Math.max(_.end(b),v.appendedPTS||0)})},h.onFragBuffered=function(P,w){this.detectPartialFragments(w)},h.hasFragment=function(P){var w=R(P);return!!this.fragments[w]},h.removeFragmentsInRange=function(P,w,E){var v=this;Object.keys(this.fragments).forEach(function(d){var a=v.fragments[d];if(!a)return;if(a.buffered){var l=a.body;l.type===E&&l.start<w&&l.end>P&&v.removeFragment(l)}})},h.removeFragment=function(P){var w=R(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},h.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},S}();function I(S){var h,g;return S.buffered&&(((h=S.range.video)===null||h===void 0?void 0:h.partial)||((g=S.range.audio)===null||g===void 0?void 0:g.partial))}function R(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"STALL_MINIMUM_DURATION_MS",function(){return I}),L.d(G,"MAX_START_GAP_JUMP",function(){return R}),L.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),L.d(G,"SKIP_BUFFER_RANGE_START",function(){return h}),L.d(G,"default",function(){return g});var K=L("./src/utils/buffer-helper.ts"),N=L("./src/errors.ts"),O=L("./src/events.ts"),F=L("./src/utils/logger.ts"),I=250,R=2,S=.1,h=.05,g=function(){function P(E,v,d,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=E,this.media=v,this.fragmentTracker=d,this.hls=a}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(v){var d=this.config,a=this.media,l=this.stalled,s=a.currentTime,_=a.seeking,b=this.seeking&&!_,f=!this.seeking&&_;if(this.seeking=_,s!==v){if(this.moved=!0,l!==null){if(this.stallReported){var A=self.performance.now()-l;F.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||b)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!K.BufferHelper.getBuffered(a).length)return;var T=K.BufferHelper.bufferInfo(a,s,0),m=T.len>0,c=T.nextStart||0;if(!m&&!c)return;if(_){var u=T.len>R,o=!c||c-s>R&&!this.fragmentTracker.getPartialFragment(s);if(u||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(c,T.start||0)-s,p=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=p==null||((x=p.details)===null||x===void 0)?void 0:x.live,U=D?p.details.targetduration*2:R;if(y>0&&y<=U){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(l===null){this.stalled=B;return}var W=B-l;!_&&W>=I&&this._reportStall(T.len);var M=K.BufferHelper.bufferInfo(a,s,d.maxBufferHole);this._tryFixBufferStall(M,W)},w._tryFixBufferStall=function(v,d){var a=this.config,l=this.fragmentTracker,s=this.media,_=s.currentTime,b=l.getPartialFragment(_);if(b){var f=this._trySkipBufferHole(b);if(f)return}v.len>a.maxBufferHole&&d>a.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(v){var d=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},w._trySkipBufferHole=function(v){for(var d=this.config,a=this.hls,l=this.media,s=l.currentTime,_=0,b=K.BufferHelper.getBuffered(l),f=0;f<b.length;f++){var A=b.start(f);if(s+d.maxBufferHole>=_&&s<A){var T=Math.max(A+h,l.currentTime+S);return F.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+T),this.moved=!0,this.stalled=null,l.currentTime=T,v&&a.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+T,frag:v}),T}_=b.end(f)}return 0},w._tryNudgeBuffer=function(){var v=this.config,d=this.hls,a=this.media,l=a.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<v.nudgeMaxRetry){var _=l+s*v.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+l+" to "+_),a.currentTime=_,d.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/events.ts"),N=L("./src/utils/texttrack-utils.ts"),O=L("./src/demux/id3.ts"),F=.25,I=function(){function R(h){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=h,this._registerListeners()}var S=R.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var g=this.hls;g.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),g.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var g=this.hls;g.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),g.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(g,P){this.media=P.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(g){if(!this.media)return;for(var P=0;P<g.length;P++){var w=g[P];if(w.kind==="metadata"&&w.label==="id3")return Object(N.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(g,P){if(!this.media)return;var w=P.frag,E=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<E.length;d++){var a=O.getID3Frames(E[d].data);if(a){var l=E[d].pts,s=d<E.length-1?E[d+1].pts:w.end,_=s-l;_<=0&&(s=l+F);for(var b=0;b<a.length;b++){var f=a[b];if(!O.isTimeStampFrame(f)){var A=new v(l,s,"");A.value=f,this.id3Track.addCue(A)}}}}},S.onBufferFlushing=function(g,P){var w=P.startOffset,E=P.endOffset,v=P.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(N.removeCuesInRange)(d,w,E)}},R}();G.default=I},"./src/controller/latency-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return R});var K=L("./src/errors.ts"),N=L("./src/events.ts"),O=L("./src/utils/logger.ts");function F(S,h){for(var g=0;g<h.length;g++){var P=h[g];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}function I(S,h,g){return h&&F(S.prototype,h),g&&F(S,g),S}var R=function(){function S(g){var P=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 P.timeupdate()},this.hls=g,this.config=g.config,this.registerListeners()}var h=S.prototype;return h.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},h.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.Events.ERROR,this.onError)},h.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},h.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},h.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},h.onLevelUpdated=function(P,w){var E=w.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},h.onError=function(P,w){if(w.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},h.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var v=this.config,d=v.lowLatencyMode,a=v.maxLiveSyncPlaybackRate;if(!d||a===1)return;var l=this.targetLatency;if(l===null)return;var s=E-l,_=Math.min(this.maxLatency,l+w.targetduration),b=s<_;if(w.live&&b&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,a)),A=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;P.playbackRate=Math.min(f,Math.max(1,A))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},h.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},h.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},I(S,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,E=P.partHoldBack,v=P.targetduration,d=this.config,a=d.liveSyncDuration,l=d.liveSyncDurationCount,s=d.lowLatencyMode,_=this.hls.userConfig,b=s&&E||w;(_.liveSyncDuration||_.liveSyncDurationCount||b===0)&&(b=a!==void 0?a:l*v);var f=v,A=1;return b+Math.min(this.stallCount*A,f)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,E=this.levelDetails;if(P===null||w===null||E===null)return null;var v=E.edge,d=P-w-this.edgeStalled,a=v-E.totalduration,l=v-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(a,d),l)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var E=P.buffered.length;return E?P.buffered.end(E-1):w.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return d});var K=L("./src/types/level.ts"),N=L("./src/events.ts"),O=L("./src/errors.ts"),F=L("./src/utils/codecs.ts"),I=L("./src/controller/level-helper.ts"),R=L("./src/controller/base-playlist-controller.ts"),S=L("./src/types/loader.ts");function h(){return h=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var _ in s)Object.prototype.hasOwnProperty.call(s,_)&&(a[_]=s[_])}return a},h.apply(this,arguments)}function g(a,l){for(var s=0;s<l.length;s++){var _=l[s];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(a,_.key,_)}}function P(a,l,s){return l&&g(a.prototype,l),s&&g(a,s),a}function w(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,E(a,l)}function E(a,l){return E=Object.setPrototypeOf||function(_,b){return _.__proto__=b,_},E(a,l)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(a){w(l,a);function l(_){var b;return b=a.call(this,_,"[level-controller]")||this,b._levels=[],b._firstLevel=-1,b._startLevel=void 0,b.currentLevelIndex=-1,b.manualLevelIndex=-1,b.onParsedComplete=void 0,b._registerListeners(),b}var s=l.prototype;return s._registerListeners=function(){var b=this.hls;b.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),b.on(N.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var b=this.hls;b.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),b.off(N.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},s.startLoad=function(){var b=this._levels;b.forEach(function(f){f.loadError=0}),a.prototype.startLoad.call(this)},s.onManifestLoaded=function(b,f){var A=[],T=[],m=[],c,u={},o,x=!1,y=!1,p=!1;if(f.levels.forEach(function(W){var M=W.attrs;x=x||!!(W.width&&W.height),y=y||!!W.videoCodec,p=p||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var k=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;o=u[k],o?o.url.push(W.url):(o=new K.Level(W),u[k]=o,A.push(o)),M&&(M.AUDIO&&Object(I.addGroupId)(o,"audio",M.AUDIO),M.SUBTITLES&&Object(I.addGroupId)(o,"text",M.SUBTITLES))}),(x||y)&&p&&(A=A.filter(function(W){var M=W.videoCodec,k=W.width,H=W.height;return!!M||!!(k&&H)})),A=A.filter(function(W){var M=W.audioCodec,k=W.videoCodec;return(!M||Object(F.isCodecSupportedInMp4)(M,"audio"))&&(!k||Object(F.isCodecSupportedInMp4)(k,"video"))}),f.audioTracks&&(T=f.audioTracks.filter(function(W){return!W.audioCodec||Object(F.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(T)),f.subtitles&&(m=f.subtitles,Object(I.assignTrackIdsByGroup)(m)),A.length>0){c=A[0].bitrate,A.sort(function(W,M){return W.bitrate-M.bitrate}),this._levels=A;for(var D=0;D<A.length;D++)if(A[D].bitrate===c){this._firstLevel=D,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+c);break}var U=p&&!y,B={levels:A,audioTracks:T,subtitleTracks:m,firstLevel:this._firstLevel,stats:f.stats,audio:p,video:y,altAudio:!U&&T.some(function(W){return!!W.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(b,f){if(a.prototype.onError.call(this,b,f),f.fatal)return;var A=f.context,T=this._levels[this.currentLevelIndex];if(A&&(A.type===S.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&A.groupId===T.audioGroupIds[T.urlId]||A.type===S.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&A.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,c=!0,u;switch(f.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var o=this._levels[f.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=f.frag.level)):u=f.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(c=!1),u=A.level),m=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:u=f.level,m=!0;break}u!==void 0&&this.recoverLevel(f,u,m,c)},s.recoverLevel=function(b,f,A,T){var m=b.details,c=this._levels[f];if(c.loadError++,A){var u=this.retryLoadingOrFail(b);if(u)b.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var o=c.url.length;if(o>1&&c.loadError<o)b.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var x=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(m+": switch to "+x),b.levelRetry=!0,this.hls.nextAutoLevel=x)}}},s.redundantFailover=function(b){var f=this._levels[b],A=f.url.length;if(A>1){var T=(f.urlId+1)%A;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(m){m.urlId=T}),this.level=b}},s.onFragLoaded=function(b,f){var A=f.frag;if(A!==void 0&&A.type===S.PlaylistLevelType.MAIN){var T=this._levels[A.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},s.onLevelLoaded=function(b,f){var A,T=f.level,m=f.details,c=this._levels[T];if(!c){var u;this.warn("Invalid level index "+T),(u=f.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(m.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,f,c.details)):(A=f.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(m.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(b,f){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var T=-1,m=this.hls.audioTracks[f.id].groupId,c=0;c<A.audioGroupIds.length;c++)if(A.audioGroupIds[c]===m){T=c;break}T!==A.urlId&&(A.urlId=T,this.startLoad())}},s.loadPlaylist=function(b){var f=this.currentLevelIndex,A=this._levels[f];if(this.canLoad&&A&&A.url.length>0){var T=A.urlId,m=A.url[T];if(b)try{m=b.addDirectives(m)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(b?" at sn "+b.msn+" part "+b.part:"")+" with URL-id "+T+" "+m),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:m,level:f,id:T,deliveryDirectives:b||null})}},s.removeLevel=function(b,f){var A=function(c,u){return u!==f},T=this._levels.filter(function(m,c){return c!==b?!0:m.url.length>1&&f!==void 0?(m.url=m.url.filter(A),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(A)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(A)),m.urlId=0,!0):!1}).map(function(m,c){var u=m.details;return u!=null&&u.fragments&&u.fragments.forEach(function(o){o.level=c}),m});this._levels=T,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:T})},P(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(b){var f,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===b&&(f=A[b])!==null&&f!==void 0&&f.details)return;if(b<0||b>=A.length){var T=b<0;if(this.hls.trigger(N.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:b,fatal:T,reason:"invalid level idx"}),T)return;b=Math.min(b,A.length-1)}this.clearTimer();var m=this.currentLevelIndex,c=A[m],u=A[b];this.log("switching to level "+b+" from "+m),this.currentLevelIndex=b;var o=h({},u,{level:b,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete o._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,o);var x=u.details;if(!x||x.live){var y=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(b){this.manualLevelIndex=b,this._startLevel===void 0&&(this._startLevel=b),b!==-1&&(this.level=b)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(b){this._firstLevel=b}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var b=this.hls.config.startLevel;return b!==void 0?b:this._firstLevel}else return this._startLevel},set:function(b){this._startLevel=b}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(b){this.level=b,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=b)}}]),l}(R.default)},"./src/controller/level-helper.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"addGroupId",function(){return O}),L.d(G,"assignTrackIdsByGroup",function(){return F}),L.d(G,"updatePTS",function(){return I}),L.d(G,"updateFragPTSDTS",function(){return S}),L.d(G,"mergeDetails",function(){return h}),L.d(G,"mapPartIntersection",function(){return g}),L.d(G,"mapFragmentIntersection",function(){return P}),L.d(G,"adjustSliding",function(){return w}),L.d(G,"addSliding",function(){return E}),L.d(G,"computeReloadInterval",function(){return v}),L.d(G,"getFragmentWithSN",function(){return d}),L.d(G,"getPartWith",function(){return a});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/logger.ts");function O(l,s,_){switch(s){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(_);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(_);break}}function F(l){var s={};l.forEach(function(_){var b=_.groupId||"";_.id=s[b]=s[b]||0,s[b]++})}function I(l,s,_){var b=l[s],f=l[_];R(b,f)}function R(l,s){var _=s.startPTS;if(Object(K.isFiniteNumber)(_)){var b=0,f;s.sn>l.sn?(b=_-l.start,f=l):(b=l.start-_,f=s),f.duration!==b&&(f.duration=b)}else if(s.sn>l.sn){var A=l.cc===s.cc;A&&l.minEndPTS?s.start=l.start+(l.minEndPTS-l.start):s.start=l.start+l.duration}else s.start=Math.max(l.start-s.duration,0)}function S(l,s,_,b,f,A){var T=b-_;T<=0&&(N.logger.warn("Fragment should have a positive duration",s),b=_+s.duration,A=f+s.duration);var m=_,c=b,u=s.startPTS,o=s.endPTS;if(Object(K.isFiniteNumber)(u)){var x=Math.abs(u-_);Object(K.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(x,s.deltaPTS):s.deltaPTS=x,m=Math.max(_,u),_=Math.min(_,u),f=Math.min(f,s.startDTS),c=Math.min(b,o),b=Math.max(b,o),A=Math.max(A,s.endDTS)}s.duration=b-_;var y=_-s.start;s.appendedPTS=b,s.start=s.startPTS=_,s.maxStartPTS=m,s.startDTS=f,s.endPTS=b,s.minEndPTS=c,s.endDTS=A;var p=s.sn;if(!l||p<l.startSN||p>l.endSN)return 0;var D,U=p-l.startSN,B=l.fragments;for(B[U]=s,D=U;D>0;D--)R(B[D],B[D-1]);for(D=U;D<B.length-1;D++)R(B[D],B[D+1]);return l.fragmentHint&&R(B[B.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,y}function h(l,s){for(var _=null,b=l.fragments,f=b.length-1;f>=0;f--){var A=b[f].initSegment;if(A){_=A;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var T=0,m;if(P(l,s,function(D,U){D.relurl&&(T=D.cc-U.cc),Object(K.isFiniteNumber)(D.startPTS)&&Object(K.isFiniteNumber)(D.endPTS)&&(U.start=U.startPTS=D.startPTS,U.startDTS=D.startDTS,U.appendedPTS=D.appendedPTS,U.maxStartPTS=D.maxStartPTS,U.endPTS=D.endPTS,U.endDTS=D.endDTS,U.minEndPTS=D.minEndPTS,U.duration=D.endPTS-D.startPTS,U.duration&&(m=U),s.PTSKnown=s.alignedSliding=!0),U.elementaryStreams=D.elementaryStreams,U.loader=D.loader,U.stats=D.stats,U.urlId=D.urlId,D.initSegment&&(U.initSegment=D.initSegment,_=D.initSegment)}),_){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(D){var U;(!D.initSegment||D.initSegment.relurl===((U=_)===null||U===void 0?void 0:U.relurl))&&(D.initSegment=_)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(D){return!D}),s.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=s.skippedSegments;u--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var o=s.fragments;if(T){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<o.length;x++)o[x].cc+=T}s.skippedSegments&&(s.startCC=s.fragments[0].cc),g(l.partList,s.partList,function(D,U){U.elementaryStreams=D.elementaryStreams,U.stats=D.stats}),m?S(s,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):w(l,s),o.length&&(s.totalduration=s.edge-o[0].start),s.driftStartTime=l.driftStartTime,s.driftStart=l.driftStart;var y=s.advancedDateTime;if(s.advanced&&y){var p=s.edge;s.driftStart||(s.driftStartTime=y,s.driftStart=p),s.driftEndTime=y,s.driftEnd=p}else s.driftEndTime=l.driftEndTime,s.driftEnd=l.driftEnd,s.advancedDateTime=l.advancedDateTime}function g(l,s,_){if(l&&s)for(var b=0,f=0,A=l.length;f<=A;f++){var T=l[f],m=s[f+b];T&&m&&T.index===m.index&&T.fragment.sn===m.fragment.sn?_(T,m):b--}}function P(l,s,_){for(var b=s.skippedSegments,f=Math.max(l.startSN,s.startSN)-s.startSN,A=(l.fragmentHint?1:0)+(b?s.endSN:Math.min(l.endSN,s.endSN))-s.startSN,T=s.startSN-l.startSN,m=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=f;u<=A;u++){var o=c[T+u],x=m[u];b&&!x&&u<b&&(x=s.fragments[u]=o),o&&x&&_(o,x)}}function w(l,s){var _=s.startSN+s.skippedSegments-l.startSN,b=l.fragments;if(_<0||_>=b.length)return;E(s,b[_].start)}function E(l,s){if(s){for(var _=l.fragments,b=l.skippedSegments;b<_.length;b++)_[b].start+=s;l.fragmentHint&&(l.fragmentHint.start+=s)}}function v(l,s){var _=1e3*l.levelTargetDuration,b=_/2,f=l.age,A=f>0&&f<_*3,T=s.loading.end-s.loading.start,m,c=l.availabilityDelay;if(l.updated===!1)if(A){var u=333*l.misses;m=Math.max(Math.min(b,T*2),u),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=b;else A?(c=Math.min(c||_/2,f),l.availabilityDelay=c,m=c+_-f):m=_-T;return Math.round(m)}function d(l,s,_){if(!l||!l.details)return null;var b=l.details,f=b.fragments[s-b.startSN];return f||(f=b.fragmentHint,f&&f.sn===s?f:s<b.startSN&&_&&_.sn===s?_:null)}function a(l,s,_){if(!l||!l.details)return null;var b=l.details.partList;if(b)for(var f=b.length;f--;){var A=b[f];if(A.index===_&&A.fragment.sn===s)return A}return null}},"./src/controller/stream-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return b});var K=L("./src/polyfills/number.ts"),N=L("./src/controller/base-stream-controller.ts"),O=L("./src/is-supported.ts"),F=L("./src/events.ts"),I=L("./src/utils/buffer-helper.ts"),R=L("./src/controller/fragment-tracker.ts"),S=L("./src/types/loader.ts"),h=L("./src/loader/fragment.ts"),g=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),w=L("./src/controller/gap-controller.ts"),E=L("./src/errors.ts"),v=L("./src/utils/logger.ts");function d(f,A){for(var T=0;T<A.length;T++){var m=A[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function a(f,A,T){return A&&d(f.prototype,A),T&&d(f,T),f}function l(f,A){f.prototype=Object.create(A.prototype),f.prototype.constructor=f,s(f,A)}function s(f,A){return s=Object.setPrototypeOf||function(m,c){return m.__proto__=c,m},s(f,A)}var _=100,b=function(f){l(A,f);function A(m,c){var u;return u=f.call(this,m,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var T=A.prototype;return T._registerListeners=function(){var c=this.hls;c.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(F.Events.ERROR,this.onError,this),c.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var c=this.hls;c.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(F.Events.ERROR,this.onError,this),c.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(_),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=o.startLevel;x===-1&&(o.config.testBandwidth?(x=0,this.bitrateTest=!0):x=o.nextAutoLevel),this.level=o.nextLoadLevel=x,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var c,u=this.levels,o=this.level,x=u==null||((c=u[o])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var y,p=self.performance.now(),D=this.retryDate;(!D||p>=D||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,u,o=this.hls,x=this.levelLastLoaded,y=this.levels,p=this.media,D=o.config,U=o.nextLoadLevel;if(x===null||!p&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[U])return;var B=y[U];this.level=o.nextLoadLevel=U;var W=B.details;if(!W||this.state===N.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=N.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:p,S.PlaylistLevelType.MAIN);if(M===null)return;var k=M.len,H=this.getMaxBufferLength(B.maxBitrate);if(k>=H)return;if(this._streamEnded(M,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,X),this.state=N.State.ENDED;return}var ee=M.end,ae=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var ye=ae.sn-W.startSN;ye>1&&(ae=W.fragments[ye-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===R.FragmentState.OK&&this.nextLoadPosition>ee){var pe=this.audioOnly&&!this.altAudio?h.ElementaryStreamTypes.AUDIO:h.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(p,pe,S.PlaylistLevelType.MAIN),ae=this.getNextFragment(this.nextLoadPosition,W)}if(!ae)return;ae.initSegment&&!ae.initSegment.data&&!this.bitrateTest&&(ae=ae.initSegment),((c=ae.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=ae.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ae,W):this.loadFragment(ae,W,ee)},T.loadFragment=function(c,u,o){var x,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===R.FragmentState.BACKTRACKED){var p=this.fragmentTracker.getBacktrackData(c);if(p){this._handleFragmentLoadProgress(p),this._handleFragmentLoadComplete(p);return}else y=R.FragmentState.NOT_LOADED}y===R.FragmentState.NOT_LOADED||y===R.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,u,o)):y===R.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,S.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,S.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var o,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&c){var y=this.hls.nextLoadLevel,p=c[y],D=this.fragLastKbps;D&&this.fragCurrent?o=this.fragCurrent.duration*p.maxBitrate/(1e3*D)+1:o=0}else o=0;var U=this.getBufferedFrag(u.currentTime+o);if(U){var B=this.followingBufferedFrag(U);if(B){this.abortCurrentFrag();var W=B.maxStartPTS?B.maxStartPTS:B.start,M=B.duration,k=Math.max(U.end,W+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(c,u){f.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},T.onMediaAttached=function(c,u){f.prototype.onMediaAttached.call(this,c,u);var o=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(K.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(c,u){var o=!1,x=!1,y;u.levels.forEach(function(p){y=p.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(o=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=o&&x&&!Object(O.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},T.onLevelLoading=function(c,u){var o=this.levels;if(!o||this.state!==N.State.IDLE)return;var x=o[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=N.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,u){var o,x=this.levels,y=u.level,p=u.details,D=p.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+p.startSN+","+p.endSN+"], cc ["+p.startCC+", "+p.endCC+"] duration:"+D);var U=this.fragCurrent;U&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==u.level&&U.loader&&(this.state=N.State.IDLE,U.loader.abort()));var B=x[y],W=0;if(p.live||(o=B.details)!==null&&o!==void 0&&o.live){if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed)return;W=this.alignPlaylists(p,B.details)}if(B.details=p,this.levelLastLoaded=y,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:p,level:y}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=N.State.IDLE}this.startFragRequested?p.live&&this.synchronizeToLiveEdge(p):this.setStartPosition(p,W),this.tick()},T._handleFragmentLoadProgress=function(c){var u,o=c.frag,x=c.part,y=c.payload,p=this.levels;if(!p){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var D=p[o.level],U=D.details;if(!U){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=D.videoCodec,W=U.PTSKnown||!U.live,M=(u=o.initSegment)===null||u===void 0?void 0:u.data,k=this._getAudioCodec(D),H=this.transmuxer=this.transmuxer||new g.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=x?x.index:-1,ee=X!==-1,ae=new P.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,y.byteLength,X,ee),ye=this.initPTS[o.cc];H.push(y,M,k,B,o,x,U.totalduration,W,ae,ye)},T.onAudioTrackSwitching=function(c,u){var o=this.altAudio,x=!!u.url,y=u.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var p=this.fragCurrent;p!=null&&p.loader&&(this.log("Switching to main audio track, cancel main fragment load"),p.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var D=this.hls;o&&D.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:y})}},T.onAudioTrackSwitched=function(c,u){var o=u.id,x=!!this.hls.audioTracks[o].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},T.onBufferCreated=function(c,u){var o=u.tracks,x,y,p=!1;for(var D in o){var U=o[D];if(U.id==="main"){if(y=D,x=U,D==="video"){var B=o[D];B&&(this.videoBuffer=B.buffer)}}else p=!0}p&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,u){var o=u.frag,x=u.part;if(o&&o.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(x?" p: "+x.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var y=x?x.stats:o.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,x)},T.onError=function(c,u){switch(u.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.MAIN,u);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=N.State.ERROR):!u.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var o=!0,x=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);x&&x.len>.5&&(o=!this.reduceMaxBufferLength(x.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var o=I.BufferHelper.getBuffered(c);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,u){var o=u.type;if(o!==h.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(o===h.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,o,S.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,u){this.levels=u.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,u=c.currentTime,o=this.startPosition;if(o>=0&&u<o){if(c.seeking){v.logger.log("could not seek to "+o+", already seeking at "+u);return}var x=I.BufferHelper.getBuffered(c),y=x.length?x.start(0):0,p=y-o;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+p+" to match buffer start"),o+=p,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+u),c.currentTime=o}},T._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},T._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(o){var x=u.hls;if(!o||x.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=N.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),x.trigger(F.Events.FRAG_LOADED,o)})},T._handleTransmuxComplete=function(c){var u,o="main",x=this.hls,y=c.remuxResult,p=c.chunkMeta,D=this.getCurrentContext(p);if(!D){this.warn("The loading context changed while buffering fragment "+p.sn+" of level "+p.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(p.level);return}var U=D.frag,B=D.part,W=D.level,M=y.video,k=y.text,H=y.id3,X=y.initSegment,ee=this.altAudio?void 0:y.audio;if(this.fragContextChanged(U))return;if(this.state=N.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,U,p),x.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:o,tracks:X.tracks}));var ae=X.initPTS,ye=X.timescale;Object(K.isFiniteNumber)(ae)&&(this.initPTS[U.cc]=ae,x.trigger(F.Events.INIT_PTS_FOUND,{frag:U,id:o,initPTS:ae,timescale:ye}))}if(M&&y.independent!==!1){if(W.details){var pe=M.startPTS,he=M.endPTS,fe=M.startDTS,de=M.endDTS;if(B)B.elementaryStreams[M.type]={startPTS:pe,endPTS:he,startDTS:fe,endDTS:de};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<pe){this.backtrack(U);return}U.setElementaryStreamInfo(M.type,U.start,he,U.start,de,!0)}U.setElementaryStreamInfo(M.type,pe,he,fe,de),this.bufferFragmentData(M,U,B,p)}}else if(y.independent===!1){this.backtrack(U);return}if(ee){var me=ee.startPTS,$=ee.endPTS,ie=ee.startDTS,te=ee.endDTS;B&&(B.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:$,startDTS:ie,endDTS:te}),U.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,me,$,ie,te),this.bufferFragmentData(ee,U,B,p)}if(H!=null&&(u=H.samples)!==null&&u!==void 0&&u.length){var Ee={frag:U,id:o,samples:H.samples};x.trigger(F.Events.FRAG_PARSING_METADATA,Ee)}if(k){var Ce={frag:U,id:o,samples:k.samples};x.trigger(F.Events.FRAG_PARSING_USERDATA,Ce)}},T._bufferInitSegment=function(c,u,o,x){var y=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var p=u.audio,D=u.video,U=u.audiovideo;if(p){var B=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),p.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(B="mp4a.40.5")),W.indexOf("android")!==-1&&p.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),c.audioCodec&&c.audioCodec!==B&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+B+'"'),p.levelCodec=B,p.id="main",this.log("Init audio buffer, container:"+p.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(c.audioCodec||"")+"/"+p.codec+"]")}D&&(D.levelCodec=c.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+D.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(M){var k=u[M],H=k.initSegment;H!=null&&H.byteLength&&y.hls.trigger(F.Events.BUFFER_APPENDING,{type:M,data:H,frag:o,part:null,chunkMeta:x,parent:o.type})}),this.tick()},T.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=N.State.BACKTRACKING},T.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var o=c.currentTime;if(I.BufferHelper.isBuffered(c,o)?u=this.getAppendedFrag(o):I.BufferHelper.isBuffered(c,o+.1)&&(u=this.getAppendedFrag(o+.1)),u){var x=this.fragPlaying,y=u.level;(!x||u.sn!==x.sn||x.level!==y||u.urlId!==x.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==y)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=u)}}},a(A,[{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}}]),A}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"SubtitleStreamController",function(){return l});var K=L("./src/events.ts"),N=L("./src/utils/logger.ts"),O=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-finders.ts"),I=L("./src/utils/discontinuities.ts"),R=L("./src/controller/level-helper.ts"),S=L("./src/controller/fragment-tracker.ts"),h=L("./src/controller/base-stream-controller.ts"),g=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function w(s,_){for(var b=0;b<_.length;b++){var f=_[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function E(s,_,b){return _&&w(s.prototype,_),b&&w(s,b),s}function v(s,_){s.prototype=Object.create(_.prototype),s.prototype.constructor=s,d(s,_)}function d(s,_){return d=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},d(s,_)}var a=500,l=function(s){v(_,s);function _(f,A){var T;return T=s.call(this,f,A,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var b=_.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var A=this.hls;A.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(K.Events.ERROR,this.onError,this),A.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var A=this.hls;A.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(K.Events.ERROR,this.onError,this),A.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=h.State.IDLE,this.setInterval(a),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(A,T){this.mainDetails=T.details},b.onSubtitleFragProcessed=function(A,T){var m=T.frag,c=T.success;if(this.fragPrevious=m,this.state=h.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var o,x=m.start,y=0;y<u.length;y++)if(x>=u[y].start&&x<=u[y].end){o=u[y];break}var p=m.start+m.duration;o?o.end=p:(o={start:x,end:p},u.push(o)),this.fragmentTracker.fragBuffered(m)},b.onBufferFlushing=function(A,T){var m=T.startOffset,c=T.endOffset;if(m===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,o=this.levels;if(!o.length||!o[u]||!o[u].details)return;var x=o[u].details,y=x.targetduration,p=c-y;if(p<=0)return;T.endOffsetSubtitles=Math.max(0,p),this.tracksBuffered.forEach(function(D){for(var U=0;U<D.length;){if(D[U].end<=p){D.shift();continue}else if(D[U].start<p)D[U].start=p;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,p,g.PlaylistLevelType.SUBTITLE)}},b.onError=function(A,T){var m,c=T.frag;if(!c||c.type!==g.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=h.State.IDLE},b.onSubtitleTracksUpdated=function(A,T){var m=this,c=T.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new P.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){m.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(A,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(a)},b.onSubtitleTrackLoaded=function(A,T){var m,c=T.details,u=T.id,o=this.currentTrackId,x=this.levels;if(!x.length)return;var y=x[o];if(u>=x.length||u!==o||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(m=y.details)!==null&&m!==void 0&&m.live){var p=this.mainDetails;if(c.deltaUpdateFailed||!p)return;var D=p.fragments[0];if(!y.details)c.hasProgramDateTime&&p.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(c,p):D&&Object(R.addSliding)(c,D.start);else{var U=this.alignPlaylists(c,y.details);U===0&&D&&Object(R.addSliding)(c,D.start)}}if(y.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===h.State.IDLE){var B=Object(F.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},b._handleFragmentLoadComplete=function(A){var T=A.frag,m=A.payload,c=T.decryptdata,u=this.hls;if(this.fragContextChanged(T))return;if(m&&m.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),c.key.buffer,c.iv.buffer).then(function(x){var y=performance.now();u.trigger(K.Events.FRAG_DECRYPTED,{frag:T,payload:x,stats:{tstart:o,tdecrypt:y}})})}},b.doTick=function(){if(!this.media){this.state=h.State.IDLE;return}if(this.state===h.State.IDLE){var A,T=this.currentTrackId,m=this.levels;if(!m.length||!m[T]||!m[T].details)return;var c=m[T].details,u=c.targetduration,o=this.config,x=this.media,y=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,o.maxBufferHole),p=y.end,D=y.len,U=this.getMaxBufferLength()+u;if(D>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var B=c.fragments,W=B.length,M=c.edge,k,H=this.fragPrevious;if(p<M){var X=o.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(k=Object(F.findFragmentByPDT)(B,H.endProgramDateTime,X)),k||(k=Object(F.findFragmentByPTS)(H,B,p,X),!k&&H&&H.start<B[0].start&&(k=B[0]))}else k=B[W-1];(A=k)!==null&&A!==void 0&&A.encrypted?(N.logger.log("Loading key for "+k.sn),this.state=h.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:k})):k&&this.fragmentTracker.getState(k)===S.FragmentState.NOT_LOADED&&this.loadFragment(k,c,p)}},b.loadFragment=function(A,T,m){this.fragCurrent=A,s.prototype.loadFragment.call(this,A,T,m)},E(_,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),_}(h.default)},"./src/controller/subtitle-track-controller.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/events.ts"),N=L("./src/utils/texttrack-utils.ts"),O=L("./src/controller/base-playlist-controller.ts"),F=L("./src/types/loader.ts");function I(w,E){for(var v=0;v<E.length;v++){var d=E[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,E,v){return E&&I(w.prototype,E),v&&I(w,v),w}function S(w,E){w.prototype=Object.create(E.prototype),w.prototype.constructor=w,h(w,E)}function h(w,E){return h=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},h(w,E)}var g=function(w){S(E,w);function E(d){var a;return a=w.call(this,d,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var v=E.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},v.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(K.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(K.Events.ERROR,this.onError,this)},v.onMediaAttached=function(a,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},v.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},v.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=P(this.media.textTracks);a.forEach(function(l){Object(N.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},v.onSubtitleTrackLoaded=function(a,l){var s=l.id,_=l.details,b=this.trackId,f=this.tracksInGroup[b];if(!f){this.warn("Invalid subtitle track id "+s);return}var A=f.details;f.details=l.details,this.log("subtitle track "+s+" loaded ["+_.startSN+"-"+_.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,l,A))},v.onLevelLoading=function(a,l){this.switchLevel(l.level)},v.onLevelSwitching=function(a,l){this.switchLevel(l.level)},v.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var s=l.textGroupIds[l.urlId];if(this.groupId!==s){var _=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,b=this.tracks.filter(function(T){return!s||T.groupId===s});this.tracksInGroup=b;var f=this.findTrackId(_==null?void 0:_.name)||this.findTrackId();this.groupId=s;var A={subtitleTracks:b};this.log("Updating subtitle tracks, "+b.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,A),f!==-1&&this.setSubtitleTrack(f,_)}},v.findTrackId=function(a){for(var l=this.tracksInGroup,s=0;s<l.length;s++){var _=l[s];if((!this.selectDefaultTrack||_.default)&&(!a||a===_.name))return _.id}return-1},v.onError=function(a,l){if(w.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},v.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var s=l.id,_=l.groupId,b=l.url;if(a)try{b=a.addDirectives(b)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:b,id:s,groupId:_,deliveryDirectives:a||null})}},v.toggleTrackModes=function(a){var l=this,s=this.media,_=this.subtitleDisplay,b=this.trackId;if(!s)return;var f=P(s.textTracks),A=f.filter(function(c){return c.groupId===l.groupId});if(a===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var T=A[b];T&&(T.mode="disabled")}var m=A[a];m&&(m.mode=_?"showing":"hidden")},v.setSubtitleTrack=function(a,l){var s,_=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(s=_[a])!==null&&s!==void 0&&s.details)||a<-1||a>=_.length)return;this.clearTimer();var b=_[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,b){var f=b.id,A=b.groupId,T=A===void 0?"":A,m=b.name,c=b.type,u=b.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:T,name:m,type:c,url:u});var o=this.switchParams(b.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:a})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=P(this.media.textTracks),s=0;s<l.length;s++)if(l[s].mode==="hidden")a=s;else if(l[s].mode==="showing"){a=s;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},R(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),E}(O.default);function P(w){for(var E=[],v=0;v<w.length;v++){var d=w[v];d.kind==="subtitles"&&d.label&&E.push(w[v])}return E}G.default=g},"./src/controller/timeline-controller.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"TimelineController",function(){return P});var K=L("./src/polyfills/number.ts"),N=L("./src/events.ts"),O=L("./src/utils/cea-608-parser.ts"),F=L("./src/utils/output-filter.ts"),I=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),S=L("./src/utils/imsc1-ttml-parser.ts"),h=L("./src/types/loader.ts"),g=L("./src/utils/logger.ts"),P=function(){function d(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var s=new F.default(this,"textTrack1"),_=new F.default(this,"textTrack2"),b=new F.default(this,"textTrack3"),f=new F.default(this,"textTrack4");this.cea608Parser1=new O.default(1,s,_),this.cea608Parser2=new O.default(3,b,f)}l.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(N.Events.FRAG_LOADING,this.onFragLoading,this),l.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=d.prototype;return a.destroy=function(){var s=this.hls;s.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(N.Events.FRAG_LOADING,this.onFragLoading,this),s.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(s,_,b,f,A){for(var T=!1,m=A.length;m--;){var c=A[m],u=E(c[0],c[1],_,b);if(u>=0&&(c[0]=Math.min(c[0],_),c[1]=Math.max(c[1],b),T=!0,u/(b-_)>.5))return}if(T||A.push([_,b]),this.config.renderTextTracksNatively){var o=this.captionsTracks[s];this.Cues.newCue(o,_,b,f)}else{var x=this.Cues.newCue(null,_,b,f);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:x,track:s})}},a.onInitPtsFound=function(s,_){var b=this,f=_.frag,A=_.id,T=_.initPTS,m=_.timescale,c=this.unparsedVttFrags;A==="main"&&(this.initPTS[f.cc]=T,this.timescale[f.cc]=m),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){b.onFragLoaded(N.Events.FRAG_LOADED,u)}))},a.getExistingTrack=function(s){var _=this.media;if(_)for(var b=0;b<_.textTracks.length;b++){var f=_.textTracks[b];if(f[s])return f}return null},a.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},a.createNativeTrack=function(s){if(this.captionsTracks[s])return;var _=this.captionsProperties,b=this.captionsTracks,f=this.media,A=_[s],T=A.label,m=A.languageCode,c=this.getExistingTrack(s);if(c)b[s]=c,Object(R.clearCurrentCues)(b[s]),Object(R.sendAddTrackEvent)(b[s],f);else{var u=this.createTextTrack("captions",T,m);u&&(u[s]=!0,b[s]=u)}},a.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var _=this.captionsProperties[s];if(!_)return;var b=_.label,f={_id:s,label:b,kind:"captions",default:_.media?!!_.media.default:!1,closedCaptions:_.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},a.createTextTrack=function(s,_,b){var f=this.media;return f?f.addTextTrack(s,_,b):void 0},a.onMediaAttaching=function(s,_){this.media=_.media,this._cleanTracks()},a.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(_){Object(R.clearCurrentCues)(s[_]),delete s[_]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var s=this.media;if(!s)return;var _=s.textTracks;if(_)for(var b=0;b<_.length;b++)Object(R.clearCurrentCues)(_[b])},a.onSubtitleTracksUpdated=function(s,_){var b=this;this.textTracks=[];var f=_.subtitleTracks||[],A=f.some(function(u){return u.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var T=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,o){var x;if(o<m.length){for(var y=null,p=0;p<m.length;p++)if(w(m[p],u)){y=m[p];break}y&&(x=y)}x?Object(R.clearCurrentCues)(x):(x=b.createTextTrack("subtitles",u.name,u.lang),x&&(x.mode="disabled")),x&&(x.groupId=u.groupId,b.textTracks.push(x))})}else if(!T&&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(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},a.onManifestLoaded=function(s,_){var b=this;this.config.enableCEA708Captions&&_.captions&&_.captions.forEach(function(f){var A=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!A)return;var T="textTrack"+A[1],m=b.captionsProperties[T];if(!m)return;m.label=f.name,f.lang&&(m.languageCode=f.lang),m.media=f})},a.onFragLoading=function(s,_){var b=this.cea608Parser1,f=this.cea608Parser2,A=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(b&&f))return;if(_.frag.type===h.PlaylistLevelType.MAIN){var m,c,u=_.frag.sn,o=(m=_==null||((c=_.part)===null||c===void 0)?void 0:c.index)!=null?m:-1;u===A+1||u===A&&o===T+1||(b.reset(),f.reset()),this.lastSn=u,this.lastPartIndex=o}},a.onFragLoaded=function(s,_){var b=_.frag,f=_.payload,A=this.initPTS,T=this.unparsedVttFrags;if(b.type===h.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(K.isFiniteNumber)(A[b.cc])){T.push(_),A.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Missing initial subtitle PTS")});return}var m=b.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var c=this.tracks[b.level],u=this.vttCCs;u[b.cc]||(u[b.cc]={start:b.start,prevCC:this.prevCC,new:!0},this.prevCC=b.cc),c&&c.textCodec===S.IMSC1_CODEC?this._parseIMSC1(b,f):this._parseVTTs(b,f,u)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(s,_){var b=this,f=this.hls;Object(S.parseIMSC1)(_,this.initPTS[s.cc],this.timescale[s.cc],function(A){b._appendCues(A,s.level),f.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(A){g.logger.log("Failed to parse IMSC1: "+A),f.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:A})})},a._parseVTTs=function(s,_,b){var f=this,A=this.hls;Object(I.parseWebVTT)(_,this.initPTS[s.cc],this.timescale[s.cc],b,s.cc,s.start,function(T){f._appendCues(T,s.level),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(T){f._fallbackToIMSC1(s,_),g.logger.log("Failed to parse VTT cue: "+T),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:T})})},a._fallbackToIMSC1=function(s,_){var b=this,f=this.tracks[s.level];f.textCodec||Object(S.parseIMSC1)(_,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=S.IMSC1_CODEC,b._parseIMSC1(s,_)},function(){f.textCodec="wvtt"})},a._appendCues=function(s,_){var b=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[_];if(f.mode==="disabled")return;s.forEach(function(m){return Object(R.addCueToTrack)(f,m)})}else{var A=this.tracks[_],T=A.default?"default":"subtitles"+_;b.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:s,track:T})}},a.onFragDecrypted=function(s,_){var b=_.frag;if(b.type===h.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[b.cc])){this.unparsedVttFrags.push(_);return}this.onFragLoaded(N.Events.FRAG_LOADED,_)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(s,_){var b=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(b&&f))return;for(var A=0;A<_.samples.length;A++){var T=_.samples[A].bytes;if(T){var m=this.extractCea608Data(T);b.addData(_.samples[A].pts,m[0]),f.addData(_.samples[A].pts,m[1])}}},a.onBufferFlushing=function(s,_){var b=_.startOffset,f=_.endOffset,A=_.endOffsetSubtitles,T=_.type,m=this.media;if(!m||m.currentTime<f)return;if(!T||T==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(o){return Object(R.removeCuesInRange)(c[o],b,f)})}if(this.config.renderTextTracksNatively&&(b===0&&A!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(o){return Object(R.removeCuesInRange)(u[o],b,A)})}},a.extractCea608Data=function(s){for(var _=s[0]&31,b=2,f=[[],[]],A=0;A<_;A++){var T=s[b++],m=127&s[b++],c=127&s[b++],u=(4&T)!==0,o=3&T;if(m===0&&c===0)continue;u&&((o===0||o===1)&&(f[o].push(m),f[o].push(c)))}return f},d}();function w(d,a){return d&&d.label===a.name&&!(d.textTrack1||d.textTrack2)}function E(d,a,l,s){return Math.min(a,s)-Math.max(d,l)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return K});var K=function(){function N(F,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=I}var O=N.prototype;return O.decrypt=function(I,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,I)},N}()},"./src/crypt/aes-decryptor.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"removePadding",function(){return N}),L.d(G,"default",function(){return O});var K=L("./src/utils/typed-array.ts");function N(F){var I=F.byteLength,R=I&&new DataView(F.buffer).getUint8(I-1);return R?Object(K.sliceUint8)(F,0,I-R):F}var O=function(){function F(){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=F.prototype;return I.uint8ArrayToUint32Array_=function(S){for(var h=new DataView(S),g=new Uint32Array(4),P=0;P<4;P++)g[P]=h.getUint32(P*4);return g},I.initTable=function(){var S=this.sBox,h=this.invSBox,g=this.subMix,P=g[0],w=g[1],E=g[2],v=g[3],d=this.invSubMix,a=d[0],l=d[1],s=d[2],_=d[3],b=new Uint32Array(256),f=0,A=0,T=0;for(T=0;T<256;T++)T<128?b[T]=T<<1:b[T]=T<<1^283;for(T=0;T<256;T++){var m=A^A<<1^A<<2^A<<3^A<<4;m=m>>>8^m&255^99,S[f]=m,h[m]=f;var c=b[f],u=b[c],o=b[u],x=b[m]*257^m*16843008;P[f]=x<<24|x>>>8,w[f]=x<<16|x>>>16,E[f]=x<<8|x>>>24,v[f]=x,x=o*16843009^u*65537^c*257^f*16843008,a[m]=x<<24|x>>>8,l[m]=x<<16|x>>>16,s[m]=x<<8|x>>>24,_[m]=x,f?(f=c^b[b[b[o^c]]],A^=b[b[A]]):f=A=1}},I.expandKey=function(S){for(var h=this.uint8ArrayToUint32Array_(S),g=!0,P=0;P<h.length&&g;)g=h[P]===this.key[P],P++;if(g)return;this.key=h;var w=this.keySize=h.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var E=this.ksRows=(w+6+1)*4,v,d,a=this.keySchedule=new Uint32Array(E),l=this.invKeySchedule=new Uint32Array(E),s=this.sBox,_=this.rcon,b=this.invSubMix,f=b[0],A=b[1],T=b[2],m=b[3],c,u;for(v=0;v<E;v++){if(v<w){c=a[v]=h[v];continue}u=c,v%w===0?(u=u<<8|u>>>24,u=s[u>>>24]<<24|s[u>>>16&255]<<16|s[u>>>8&255]<<8|s[u&255],u^=_[v/w|0]<<24):w>6&&v%w===4&&(u=s[u>>>24]<<24|s[u>>>16&255]<<16|s[u>>>8&255]<<8|s[u&255]),a[v]=c=(a[v-w]^u)>>>0}for(d=0;d<E;d++)v=E-d,d&3?u=a[v]:u=a[v-4],d<4||v<=4?l[d]=u:l[d]=f[s[u>>>24]]^A[s[u>>>16&255]]^T[s[u>>>8&255]]^m[s[u&255]],l[d]=l[d]>>>0},I.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},I.decrypt=function(S,h,g){for(var P=this.keySize+6,w=this.invKeySchedule,E=this.invSBox,v=this.invSubMix,d=v[0],a=v[1],l=v[2],s=v[3],_=this.uint8ArrayToUint32Array_(g),b=_[0],f=_[1],A=_[2],T=_[3],m=new Int32Array(S),c=new Int32Array(m.length),u,o,x,y,p,D,U,B,W,M,k,H,X,ee,ae=this.networkToHostOrderSwap;h<m.length;){for(W=ae(m[h]),M=ae(m[h+1]),k=ae(m[h+2]),H=ae(m[h+3]),p=W^w[0],D=H^w[1],U=k^w[2],B=M^w[3],X=4,ee=1;ee<P;ee++)u=d[p>>>24]^a[D>>16&255]^l[U>>8&255]^s[B&255]^w[X],o=d[D>>>24]^a[U>>16&255]^l[B>>8&255]^s[p&255]^w[X+1],x=d[U>>>24]^a[B>>16&255]^l[p>>8&255]^s[D&255]^w[X+2],y=d[B>>>24]^a[p>>16&255]^l[D>>8&255]^s[U&255]^w[X+3],p=u,D=o,U=x,B=y,X=X+4;u=E[p>>>24]<<24^E[D>>16&255]<<16^E[U>>8&255]<<8^E[B&255]^w[X],o=E[D>>>24]<<24^E[U>>16&255]<<16^E[B>>8&255]<<8^E[p&255]^w[X+1],x=E[U>>>24]<<24^E[B>>16&255]<<16^E[p>>8&255]<<8^E[D&255]^w[X+2],y=E[B>>>24]<<24^E[p>>16&255]<<16^E[D>>8&255]<<8^E[U&255]^w[X+3],c[h]=ae(u^b),c[h+1]=ae(y^f),c[h+2]=ae(x^A),c[h+3]=ae(o^T),b=W,f=M,A=k,T=H,h=h+4}return c.buffer},F}()},"./src/crypt/decrypter.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return h});var K=L("./src/crypt/aes-crypto.ts"),N=L("./src/crypt/fast-aes-key.ts"),O=L("./src/crypt/aes-decryptor.ts"),F=L("./src/utils/logger.ts"),I=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/typed-array.ts"),S=16,h=function(){function g(w,E,v){var d=v===void 0?{}:v,a=d.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=E,this.removePKCS7Padding=l,l)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(_){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=g.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var v=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(v):v},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(E,v,d,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),v,d);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),v,d).then(a)},P.softwareDecrypt=function(E,v,d){var a=this.currentIV,l=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(E=Object(I.appendUint8Array)(s,E),this.remainderData=null);var _=this.getValidChunk(E);if(!_.length)return null;a&&(d=a);var b=this.softwareDecrypter;b||(b=this.softwareDecrypter=new O.default),b.expandKey(v);var f=l;return this.currentResult=b.decrypt(_.buffer,0,d),this.currentIV=Object(R.sliceUint8)(_,-16).buffer,f||null},P.webCryptoDecrypt=function(E,v,d){var a=this,l=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new N.default(l,v)),this.fastAesKey.expandKey().then(function(s){if(!l)return Promise.reject(new Error("web crypto not initialized"));var _=new K.default(l,d);return _.decrypt(E.buffer,s)}).catch(function(s){return a.onWebCryptoError(s,E,v,d)})},P.onWebCryptoError=function(E,v,d,a){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,a)},P.getValidChunk=function(E){var v=E,d=E.length-E.length%S;return d!==E.length&&(v=Object(R.sliceUint8)(E,0,d),this.remainderData=Object(R.sliceUint8)(E,d)),v},P.logOnce=function(E){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},g}()},"./src/crypt/fast-aes-key.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return K});var K=function(){function N(F,I){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=I}var O=N.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/demux/base-audio-demuxer.ts"),N=L("./src/demux/adts.ts"),O=L("./src/utils/logger.ts"),F=L("./src/demux/id3.ts");function I(h,g){h.prototype=Object.create(g.prototype),h.prototype.constructor=h,R(h,g)}function R(h,g){return R=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},R(h,g)}var S=function(h){I(g,h);function g(w,E){var v;return v=h.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=w,v.config=E,v}var P=g.prototype;return P.resetInitSegment=function(E,v,d){h.prototype.resetInitSegment.call(this,E,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:d,inputTimeScale:9e4,dropped:0}},g.probe=function(E){if(!E)return!1;for(var v=F.getID3Data(E,0)||[],d=v.length,a=E.length;d<a;d++)if(N.probe(E,d))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(E,v){return N.canParse(E,v)},P.appendFrame=function(E,v,d){N.initTrackConfig(E,this.observer,v,d,E.manifestCodec);var a=N.appendFrame(E,v,d,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},g}(K.default);S.minProbeByteLength=9,G.default=S},"./src/demux/adts.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"getAudioConfig",function(){return F}),L.d(G,"isHeaderPattern",function(){return I}),L.d(G,"getHeaderLength",function(){return R}),L.d(G,"getFullFrameLength",function(){return S}),L.d(G,"canGetFrameLength",function(){return h}),L.d(G,"isHeader",function(){return g}),L.d(G,"canParse",function(){return P}),L.d(G,"probe",function(){return w}),L.d(G,"initTrackConfig",function(){return E}),L.d(G,"getFrameDuration",function(){return v}),L.d(G,"parseFrameHeader",function(){return d}),L.d(G,"appendFrame",function(){return a});var K=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),O=L("./src/events.ts");function F(l,s,_,b){var f,A,T,m,c=navigator.userAgent.toLowerCase(),u=b,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[_+2]&192)>>>6)+1;var x=(s[_+2]&60)>>>2;if(x>o.length-1){l.trigger(O.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return T=(s[_+2]&1)<<2,T|=(s[_+3]&192)>>>6,K.logger.log("manifest codec:"+b+", ADTS type:"+f+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(f=5,m=new Array(4),A=x-3):(f=2,m=new Array(2),A=x):c.indexOf("android")!==-1?(f=2,m=new Array(2),A=x):(f=5,m=new Array(4),b&&(b.indexOf("mp4a.40.29")!==-1||b.indexOf("mp4a.40.5")!==-1)||!b&&x>=6?A=x-3:((b&&b.indexOf("mp4a.40.2")!==-1&&(x>=6&&T===1||/vivaldi/i.test(c))||!b&&T===1)&&(f=2,m=new Array(2)),A=x)),m[0]=f<<3,m[0]|=(x&14)>>1,m[1]|=(x&1)<<7,m[1]|=T<<3,f===5&&(m[1]|=(A&14)>>1,m[2]=(A&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:o[x],channelCount:T,codec:"mp4a.40."+f,manifestCodec:u}}function I(l,s){return l[s]===255&&(l[s+1]&246)===240}function R(l,s){return l[s+1]&1?7:9}function S(l,s){return(l[s+3]&3)<<11|l[s+4]<<3|(l[s+5]&224)>>>5}function h(l,s){return s+5<l.length}function g(l,s){return s+1<l.length&&I(l,s)}function P(l,s){return h(l,s)&&I(l,s)&&S(l,s)<=l.length-s}function w(l,s){if(g(l,s)){var _=R(l,s);if(s+_>=l.length)return!1;var b=S(l,s);if(b<=_)return!1;var f=s+b;return f===l.length||g(l,f)}return!1}function E(l,s,_,b,f){if(!l.samplerate){var A=F(s,_,b,f);if(!A)return;l.config=A.config,l.samplerate=A.samplerate,l.channelCount=A.channelCount,l.codec=A.codec,l.manifestCodec=A.manifestCodec,K.logger.log("parsed codec:"+l.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function v(l){return 1024*9e4/l}function d(l,s,_,b,f){var A=R(l,s),T=S(l,s);if(T-=A,T>0){var m=_+b*f;return{headerLength:A,frameLength:T,stamp:m}}}function a(l,s,_,b,f){var A=v(l.samplerate),T=d(s,_,b,f,A);if(T){var m=T.frameLength,c=T.headerLength,u=T.stamp,o=c+m,x=Math.max(0,_+o-s.length),y;x?(y=new Uint8Array(o-c),y.set(s.subarray(_+c,s.length),0)):y=s.subarray(_+c,_+o);var p={unit:y,pts:u};return x||l.samples.push(p),{sample:p,length:o,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"initPTSFn",function(){return S});var K=L("./src/polyfills/number.ts"),N=L("./src/demux/id3.ts"),O=L("./src/demux/dummy-demuxed-track.ts"),F=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/typed-array.ts"),R=function(){function h(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var g=h.prototype;return g.resetInitSegment=function(w,E,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},g.resetTimeStamp=function(){},g.resetContiguity=function(){},g.canParse=function(w,E){return!1},g.appendFrame=function(w,E,v){},g.demux=function(w,E){this.cachedData&&(w=Object(F.appendUint8Array)(this.cachedData,w),this.cachedData=null);var v=N.getID3Data(w,0),d=v?v.length:0,a,l,s=this._audioTrack,_=this._id3Track,b=v?N.getTimeStamp(v):void 0,f=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(b,E)),v&&v.length>0&&_.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),l=this.initPTS;d<f;){if(this.canParse(w,d)){var A=this.appendFrame(s,w,d);A?(this.frameIndex++,l=A.sample.pts,d+=A.length,a=d):d=f}else N.canParse(w,d)?(v=N.getID3Data(w,d),_.samples.push({pts:l,dts:l,data:v}),d+=v.length,a=d):d++;if(d===f&&a!==f){var T=Object(I.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:s,avcTrack:Object(O.dummyTrack)(),id3Track:_,textTrack:Object(O.dummyTrack)()}},g.demuxSampleAes=function(w,E,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},g.flush=function(w){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},g.destroy=function(){},h}(),S=function(g,P){return Object(K.isFiniteNumber)(g)?g*90:P*9e4};G.default=R},"./src/demux/chunk-cache.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return K});var K=function(){function O(){this.chunks=[],this.dataLength=0}var F=O.prototype;return F.push=function(R){this.chunks.push(R),this.dataLength+=R.length},F.flush=function(){var R=this.chunks,S=this.dataLength,h;if(R.length)R.length===1?h=R[0]:h=N(R,S);else return new Uint8Array(0);return this.reset(),h},F.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function N(O,F){for(var I=new Uint8Array(F),R=0,S=0;S<O.length;S++){var h=O[S];I.set(h,R),R+=h.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/utils/logger.ts"),N=function(){function O(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 F=O.prototype;return F.loadWord=function(){var R=this.data,S=this.bytesAvailable,h=R.byteLength-S,g=new Uint8Array(4),P=Math.min(4,S);if(P===0)throw new Error("no bytes available");g.set(R.subarray(h,h+P)),this.word=new DataView(g.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},F.skipBits=function(R){var S;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,S=R>>3,R-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},F.readBits=function(R){var S=Math.min(this.bitsAvailable,R),h=this.word>>>32-S;return R>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=S,this.bitsAvailable>0?this.word<<=S:this.bytesAvailable>0&&this.loadWord(),S=R-S,S>0&&this.bitsAvailable?h<<S|this.readBits(S):h},F.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},F.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(R){for(var S=8,h=8,g,P=0;P<R;P++)h!==0&&(g=this.readEG(),h=(S+g+256)%256),S=h===0?S:h},F.readSPS=function(){var R=0,S=0,h=0,g=0,P,w,E,v=this.readUByte.bind(this),d=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),s=this.skipBits.bind(this),_=this.skipEG.bind(this),b=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var A=v();if(d(5),s(3),v(),b(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var T=a();if(T===3&&s(1),b(),b(),s(1),l())for(w=T!==3?8:12,E=0;E<w;E++)l()&&(E<6?f(16):f(64))}b();var m=a();if(m===0)a();else if(m===1)for(s(1),_(),_(),P=a(),E=0;E<P;E++)_();b(),s(1);var c=a(),u=a(),o=d(1);o===0&&s(1),s(1),l()&&(R=a(),S=a(),h=a(),g=a());var x=[1,1];if(l()&&l()){var y=v();switch(y){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-R*2-S*2),height:(2-o)*(u+1)*16-(o?2:4)*(h+g),pixelRatio:x}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();G.default=N},"./src/demux/id3.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"isHeader",function(){return K}),L.d(G,"isFooter",function(){return N}),L.d(G,"getID3Data",function(){return O}),L.d(G,"canParse",function(){return I}),L.d(G,"getTimeStamp",function(){return R}),L.d(G,"isTimeStampFrame",function(){return S}),L.d(G,"getID3Frames",function(){return g}),L.d(G,"decodeFrame",function(){return P}),L.d(G,"utf8ArrayToStr",function(){return a}),L.d(G,"testables",function(){return l});var K=function(f,A){return A+10<=f.length&&(f[A]===73&&f[A+1]===68&&f[A+2]===51&&(f[A+3]<255&&f[A+4]<255&&(f[A+6]<128&&f[A+7]<128&&f[A+8]<128&&f[A+9]<128)))},N=function(f,A){return A+10<=f.length&&(f[A]===51&&f[A+1]===68&&f[A+2]===73&&(f[A+3]<255&&f[A+4]<255&&(f[A+6]<128&&f[A+7]<128&&f[A+8]<128&&f[A+9]<128)))},O=function(f,A){for(var T=A,m=0;K(f,A);){m+=10;var c=F(f,A+6);m+=c,N(f,A+10)&&(m+=10),A+=m}return m>0?f.subarray(T,T+m):void 0},F=function(f,A){var T=0;return T=(f[A]&127)<<21,T|=(f[A+1]&127)<<14,T|=(f[A+2]&127)<<7,T|=f[A+3]&127,T},I=function(f,A){return K(f,A)&&F(f,A+6)+10<=f.length-A},R=function(f){for(var A=g(f),T=0;T<A.length;T++){var m=A[T];if(S(m))return d(m)}return},S=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},h=function(f){var A=String.fromCharCode(f[0],f[1],f[2],f[3]),T=F(f,4),m=10;return{type:A,size:T,data:f.subarray(m,m+T)}},g=function(f){for(var A=0,T=[];K(f,A);){var m=F(f,A+6);A+=10;for(var c=A+m;A+8<c;){var u=h(f.subarray(A)),o=P(u);o&&T.push(o),A+=u.size+10}N(f,A)&&(A+=10)}return T},P=function(f){return f.type==="PRIV"?w(f):f.type[0]==="W"?v(f):E(f)},w=function(f){if(f.size<2)return;var A=a(f.data,!0),T=new Uint8Array(f.data.subarray(A.length+1));return{key:f.type,info:A,data:T.buffer}},E=function(f){if(f.size<2)return;if(f.type==="TXXX"){var A=1,T=a(f.data.subarray(A),!0);A+=T.length+1;var m=a(f.data.subarray(A));return{key:f.type,info:T,data:m}}var c=a(f.data.subarray(1));return{key:f.type,data:c}},v=function(f){if(f.type==="WXXX"){if(f.size<2)return;var A=1,T=a(f.data.subarray(A),!0);A+=T.length+1;var m=a(f.data.subarray(A));return{key:f.type,info:T,data:m}}var c=a(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var A=new Uint8Array(f.data),T=A[3]&1,m=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return m/=45,T&&(m+=4772185884e-2),Math.round(m)}return},a=function(f,A){A===void 0&&(A=!1);var T=_();if(T){var m=T.decode(f);if(A){var c=m.indexOf("\0");return c!==-1?m.substring(0,c):m}return m.replace(/\0/g,"")}for(var u=f.length,o,x,y,p="",D=0;D<u;){if(o=f[D++],o===0&&A)return p;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:p+=String.fromCharCode(o);break;case 12:case 13:x=f[D++],p+=String.fromCharCode((o&31)<<6|x&63);break;case 14:x=f[D++],y=f[D++],p+=String.fromCharCode((o&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return p},l={decodeTextFrame:E},s;function _(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/demux/base-audio-demuxer.ts"),N=L("./src/demux/id3.ts"),O=L("./src/utils/logger.ts"),F=L("./src/demux/mpegaudio.ts");function I(h,g){h.prototype=Object.create(g.prototype),h.prototype.constructor=h,R(h,g)}function R(h,g){return R=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},R(h,g)}var S=function(h){I(g,h);function g(){return h.apply(this,arguments)||this}var P=g.prototype;return P.resetInitSegment=function(E,v,d){h.prototype.resetInitSegment.call(this,E,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:d,inputTimeScale:9e4,dropped:0}},g.probe=function(E){if(!E)return!1;for(var v=N.getID3Data(E,0)||[],d=v.length,a=E.length;d<a;d++)if(F.probe(E,d))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(E,v){return F.canParse(E,v)},P.appendFrame=function(E,v,d){return this.initPTS===null?void 0:F.appendFrame(E,v,d,this.initPTS,this.frameIndex)},g}(K.default);S.minProbeByteLength=4,G.default=S},"./src/demux/mp4demuxer.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/utils/mp4-tools.ts"),N=L("./src/demux/dummy-demuxed-track.ts"),O=function(){function F(R,S){this.remainderData=null,this.config=void 0,this.config=S}var I=F.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},F.probe=function(S){return Object(K.findBox)({data:S,start:0,end:Math.min(S.length,16384)},["moof"]).length>0},I.demux=function(S){var h=S,g=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(h=Object(K.appendUint8Array)(this.remainderData,S));var P=Object(K.segmentValidRange)(h);this.remainderData=P.remainder,g.samples=P.valid||new Uint8Array}else g.samples=h;return{audioTrack:Object(N.dummyTrack)(),avcTrack:g,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},I.flush=function(){var S=Object(N.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:S,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},I.demuxSampleAes=function(S,h,g){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},F}();O.minProbeByteLength=1024,G.default=O},"./src/demux/mpegaudio.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"appendFrame",function(){return R}),L.d(G,"parseHeader",function(){return S}),L.d(G,"isHeaderPattern",function(){return h}),L.d(G,"isHeader",function(){return g}),L.d(G,"canParse",function(){return P}),L.d(G,"probe",function(){return w});var K=null,N=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function R(E,v,d,a,l){if(d+24>v.length)return;var s=S(v,d);if(s&&d+s.frameLength<=v.length){var _=s.samplesPerFrame*9e4/s.sampleRate,b=a+l*_,f={unit:v.subarray(d,d+s.frameLength),pts:b,dts:b};return E.config=[],E.channelCount=s.channelCount,E.samplerate=s.sampleRate,E.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function S(E,v){var d=E[v+1]>>3&3,a=E[v+1]>>1&3,l=E[v+2]>>4&15,s=E[v+2]>>2&3;if(d!==1&&l!==0&&l!==15&&s!==3){var _=E[v+2]>>1&1,b=E[v+3]>>6,f=d===3?3-a:a===3?3:4,A=N[f*14+l-1]*1e3,T=d===3?0:d===2?1:2,m=O[T*3+s],c=b===3?1:2,u=F[d][a],o=I[a],x=u*8*o,y=Math.floor(u*A/m+_)*o;if(K===null){var p=navigator.userAgent||"",D=p.match(/Chrome\/(\d+)/i);K=D?parseInt(D[1]):0}var U=!!K&&K<=87;return U&&a===2&&A>=224e3&&b===0&&(E[v+3]=E[v+3]|128),{sampleRate:m,channelCount:c,frameLength:y,samplesPerFrame:x}}}function h(E,v){return E[v]===255&&(E[v+1]&224)===224&&(E[v+1]&6)!==0}function g(E,v){return v+1<E.length&&h(E,v)}function P(E,v){var d=4;return h(E,v)&&d<=E.length-v}function w(E,v){if(v+1<E.length&&h(E,v)){var d=4,a=S(E,v),l=d;a!=null&&a.frameLength&&(l=a.frameLength);var s=v+l;return s===E.length||g(E,s)}return!1}},"./src/demux/sample-aes.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/crypt/decrypter.ts"),N=L("./src/demux/tsdemuxer.ts"),O=function(){function F(R,S,h){this.keyData=void 0,this.decrypter=void 0,this.keyData=h,this.decrypter=new K.default(R,S,{removePKCS7Padding:!1})}var I=F.prototype;return I.decryptBuffer=function(S,h){this.decrypter.decrypt(S,this.keyData.key.buffer,this.keyData.iv.buffer,h)},I.decryptAacSample=function(S,h,g,P){var w=S[h].unit,E=w.subarray(16,w.length-w.length%16),v=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),d=this;this.decryptBuffer(v,function(a){var l=new Uint8Array(a);w.set(l,16),P||d.decryptAacSamples(S,h+1,g)})},I.decryptAacSamples=function(S,h,g){for(;;h++){if(h>=S.length){g();return}if(S[h].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(S,h,g,P),!P)return}},I.getAvcEncryptedData=function(S){for(var h=Math.floor((S.length-48)/160)*16+16,g=new Int8Array(h),P=0,w=32;w<=S.length-16;w+=160,P+=16)g.set(S.subarray(w,w+16),P);return g},I.getAvcDecryptedUnit=function(S,h){for(var g=new Uint8Array(h),P=0,w=32;w<=S.length-16;w+=160,P+=16)S.set(g.subarray(P,P+16),w);return S},I.decryptAvcSample=function(S,h,g,P,w,E){var v=Object(N.discardEPB)(w.data),d=this.getAvcEncryptedData(v),a=this;this.decryptBuffer(d.buffer,function(l){w.data=a.getAvcDecryptedUnit(v,l),E||a.decryptAvcSamples(S,h,g+1,P)})},I.decryptAvcSamples=function(S,h,g,P){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;h++,g=0){if(h>=S.length){P();return}for(var w=S[h].units;!(g>=w.length);g++){var E=w[g];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(S,h,g,P,E,v),!v)return}}},F}();G.default=O},"./src/demux/transmuxer-interface.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return w});var K=L("./node_modules/webworkify-webpack/index.js"),N=L.n(K),O=L("./src/events.ts"),F=L("./src/demux/transmuxer.ts"),I=L("./src/utils/logger.ts"),R=L("./src/errors.ts"),S=L("./src/utils/mediasource-helper.ts"),h=L("./node_modules/eventemitter3/index.js"),g=L.n(h),P=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function E(d,a,l,s){var _=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=a,this.onTransmuxComplete=l,this.onFlush=s;var b=d.config,f=function(u,o){o=o||{},o.frag=_.frag,o.id=_.id,d.trigger(u,o)};this.observer=new h.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,f),this.observer.on(O.Events.ERROR,f);var A={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(b.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var m;try{m=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(c){d.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},m.postMessage({cmd:"init",typeSupported:A,vendor:T,id:a,config:JSON.stringify(b)})}catch(c){I.logger.warn("Error in worker:",c),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new F.default(this.observer,A,b,T,a),this.worker=null}}else this.transmuxer=new F.default(this.observer,A,b,T,a)}var v=E.prototype;return v.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},v.push=function(a,l,s,_,b,f,A,T,m,c){var u=this;m.transmuxing.start=self.performance.now();var o=this.transmuxer,x=this.worker,y=f?f.start:b.start,p=b.decryptdata,D=this.frag,U=!(D&&b.cc===D.cc),B=!(D&&m.level===D.level),W=D?m.sn-D.sn:-1,M=this.part?m.part-this.part.index:1,k=!B&&(W===1||W===0&&M===1),H=self.performance.now();(B||W||b.stats.parsing.start===0)&&(b.stats.parsing.start=H),f&&(M||!k)&&(f.stats.parsing.start=H);var X=new F.TransmuxState(U,k,T,B,y);if(!k||U){I.logger.log("[transmuxer-interface, "+b.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+k+`
|
|
accurateTimeOffset: `+T+`
|
|
timeOffset: `+y);var ee=new F.TransmuxConfig(s,_,l,A,c);this.configureTransmuxer(ee)}if(this.frag=b,this.part=f,x)x.postMessage({cmd:"demux",data:a,decryptdata:p,chunkMeta:m,state:X},a instanceof ArrayBuffer?[a]:[]);else if(o){var ae=o.push(a,p,m,X);Object(F.isPromise)(ae)?ae.then(function(ye){u.handleTransmuxComplete(ye)}):this.handleTransmuxComplete(ae)}},v.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var s=this.transmuxer,_=this.worker;if(_)_.postMessage({cmd:"flush",chunkMeta:a});else if(s){var b=s.flush(a);Object(F.isPromise)(b)?b.then(function(f){l.handleFlushResult(f,a)}):this.handleFlushResult(b,a)}},v.handleFlushResult=function(a,l){var s=this;a.forEach(function(_){s.handleTransmuxComplete(_)}),this.onFlush(l)},v.onWorkerMessage=function(a){var l=a.data,s=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,s.trigger(l.event,l.data);break}}},v.configureTransmuxer=function(a){var l=this.worker,s=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):s&&s.configure(a)},v.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},E}()},"./src/demux/transmuxer-worker.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return R});var K=L("./src/demux/transmuxer.ts"),N=L("./src/events.ts"),O=L("./src/utils/logger.ts"),F=L("./node_modules/eventemitter3/index.js"),I=L.n(F);function R(w){var E=new F.EventEmitter,v=function(a,l){w.postMessage({event:a,data:l})};E.on(N.Events.FRAG_DECRYPTED,v),E.on(N.Events.ERROR,v),w.addEventListener("message",function(d){var a=d.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);w.transmuxer=new K.default(E,a.typeSupported,l,a.vendor,a.id),Object(O.enableLogs)(l.debug),v("init",null);break}case"configure":{w.transmuxer.configure(a.config);break}case"demux":{var s=w.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(K.isPromise)(s)?s.then(function(f){S(w,f)}):S(w,s);break}case"flush":{var _=a.chunkMeta,b=w.transmuxer.flush(_);Object(K.isPromise)(b)?b.then(function(f){g(w,f,_)}):g(w,b,_);break}default:break}})}function S(w,E){if(P(E.remuxResult))return;var v=[],d=E.remuxResult,a=d.audio,l=d.video;a&&h(v,a),l&&h(v,l),w.postMessage({event:"transmuxComplete",data:E},v)}function h(w,E){E.data1&&w.push(E.data1.buffer),E.data2&&w.push(E.data2.buffer)}function g(w,E,v){E.forEach(function(d){S(w,d)}),w.postMessage({event:"flush",data:v})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return l}),L.d(G,"isPromise",function(){return b}),L.d(G,"TransmuxConfig",function(){return f}),L.d(G,"TransmuxState",function(){return A});var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/crypt/decrypter.ts"),F=L("./src/demux/aacdemuxer.ts"),I=L("./src/demux/mp4demuxer.ts"),R=L("./src/demux/tsdemuxer.ts"),S=L("./src/demux/mp3demuxer.ts"),h=L("./src/remux/mp4-remuxer.ts"),g=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),E=L("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(T){E.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:R.default,remux:h.default},{demux:I.default,remux:g.default},{demux:F.default,remux:h.default},{demux:S.default,remux:h.default}],a=1024;d.forEach(function(T){var m=T.demux;a=Math.max(a,m.minProbeByteLength)});var l=function(){function T(c,u,o,x,y){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 P.default,this.observer=c,this.typeSupported=u,this.config=o,this.vendor=x,this.id=y}var m=T.prototype;return m.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},m.push=function(u,o,x,y){var p=this,D=x.transmuxing;D.executeStart=v();var U=new Uint8Array(u),B=this.cache,W=this.config,M=this.currentTransmuxState,k=this.transmuxConfig;y&&(this.currentTransmuxState=y);var H=s(U,o);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var ee=X.softwareDecrypt(U,H.key.buffer,H.iv.buffer);if(!ee)return D.executeEnd=v(),_(x);U=new Uint8Array(ee)}else return this.decryptionPromise=X.webCryptoDecrypt(U,H.key.buffer,H.iv.buffer).then(function(we){var Ae=p.push(we,null,x);return p.decryptionPromise=null,Ae}),this.decryptionPromise}var ae=y||M,ye=ae.contiguous,pe=ae.discontinuity,he=ae.trackSwitch,fe=ae.accurateTimeOffset,de=ae.timeOffset,ne=k.audioCodec,me=k.videoCodec,$=k.defaultInitPts,ie=k.duration,te=k.initSegmentData;if((pe||he)&&this.resetInitSegment(te,ne,me,ie),pe&&this.resetInitialTimestamp($),ye||this.resetContiguity(),this.needsProbing(U,pe,he)){if(B.dataLength){var Ee=B.flush();U=Object(w.appendUint8Array)(Ee,U)}this.configureTransmuxer(U,k)}var Ce=this.transmux(U,H,de,fe,x),ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,D.executeEnd=v(),Ce},m.flush=function(u){var o=this,x=u.transmuxing;x.executeStart=v();var y=this.decrypter,p=this.cache,D=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return o.flush(u)});var B=[],W=D.timeOffset;if(y){var M=y.flush();M&&B.push(this.push(M,null,u))}var k=p.dataLength;p.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return k>=a&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=v(),[_(u)];var ee=H.flush(W);return b(ee)?ee.then(function(ae){return o.flushRemux(B,ae,u),B}):(this.flushRemux(B,ee,u),B)},m.flushRemux=function(u,o,x){var y=o.audioTrack,p=o.avcTrack,D=o.id3Track,U=o.textTrack,B=this.currentTransmuxState,W=B.accurateTimeOffset,M=B.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var k=this.remuxer.remux(y,p,D,U,M,W,!0,this.id);u.push({remuxResult:k,chunkMeta:x}),x.transmuxing.executeEnd=v()},m.resetInitialTimestamp=function(u){var o=this.demuxer,x=this.remuxer;if(!o||!x)return;o.resetTimeStamp(u),x.resetTimeStamp(u)},m.resetContiguity=function(){var u=this.demuxer,o=this.remuxer;if(!u||!o)return;u.resetContiguity(),o.resetNextTimestamp()},m.resetInitSegment=function(u,o,x,y){var p=this.demuxer,D=this.remuxer;if(!p||!D)return;p.resetInitSegment(o,x,y),D.resetInitSegment(u,o,x)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(u,o,x,y,p){var D;return o&&o.method==="SAMPLE-AES"?D=this.transmuxSampleAes(u,o,x,y,p):D=this.transmuxUnencrypted(u,x,y,p),D},m.transmuxUnencrypted=function(u,o,x,y){var p=this.demuxer.demux(u,o,!1,!this.config.progressive),D=p.audioTrack,U=p.avcTrack,B=p.id3Track,W=p.textTrack,M=this.remuxer.remux(D,U,B,W,o,x,!1,this.id);return{remuxResult:M,chunkMeta:y}},m.transmuxSampleAes=function(u,o,x,y,p){var D=this;return this.demuxer.demuxSampleAes(u,o,x).then(function(U){var B=D.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,x,y,!1,D.id);return{remuxResult:B,chunkMeta:p}})},m.configureTransmuxer=function(u,o){for(var x=this.config,y=this.observer,p=this.typeSupported,D=this.vendor,U=o.audioCodec,B=o.defaultInitPts,W=o.duration,M=o.initSegmentData,k=o.videoCodec,H,X=0,ee=d.length;X<ee;X++)if(d[X].demux.probe(u)){H=d[X];break}H||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:I.default,remux:g.default});var ae=this.demuxer,ye=this.remuxer,pe=H.remux,he=H.demux;(!ye||!(ye instanceof pe))&&(this.remuxer=new pe(y,x,p,D)),(!ae||!(ae instanceof he))&&(this.demuxer=new he(y,x,p),this.probe=he.probe),this.resetInitSegment(M,U,k,W),this.resetInitialTimestamp(B)},m.needsProbing=function(u,o,x){return!this.demuxer||!this.remuxer||o||x},m.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new O.default(this.observer,this.config)),u},T}();function s(T,m){var c=null;return T.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(c=m),c}var _=function(m){return{remuxResult:{},chunkMeta:m}};function b(T){return"then"in T&&T.then instanceof Function}var f=function(m,c,u,o,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=c,this.initSegmentData=u,this.duration=o,this.defaultInitPts=x},A=function(m,c,u,o,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=o,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"discardEPB",function(){return _});var K=L("./src/demux/adts.ts"),N=L("./src/demux/mpegaudio.ts"),O=L("./src/demux/exp-golomb.ts"),F=L("./src/demux/id3.ts"),I=L("./src/demux/sample-aes.ts"),R=L("./src/events.ts"),S=L("./src/utils/mp4-tools.ts"),h=L("./src/utils/logger.ts"),g=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function b(A,T,m){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=A,this.config=T,this.typeSupported=m}b.probe=function(T){var m=b.syncOffset(T);return m<0?!1:(m&&h.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},b.syncOffset=function(T){for(var m=Math.min(1e3,T.length-3*188),c=0;c<m;){if(T[c]===71&&T[c+188]===71&&T[c+2*188]===71)return c;c++}return-1},b.createTrack=function(T,m){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:P[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?m:void 0}};var f=b.prototype;return f.resetInitSegment=function(T,m,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=b.createTrack("video",c),this._audioTrack=b.createTrack("audio",c),this._id3Track=b.createTrack("id3",c),this._txtTrack=b.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=m,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var T=this._audioTrack,m=this._avcTrack,c=this._id3Track;T&&(T.pesData=null),m&&(m.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(T,m,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var o,x=this._avcTrack,y=this._audioTrack,p=this._id3Track,D=x.pid,U=x.pesData,B=y.pid,W=p.pid,M=y.pesData,k=p.pesData,H=!1,X=this.pmtParsed,ee=this._pmtId,ae=T.length;if(this.remainderData&&(T=Object(S.appendUint8Array)(this.remainderData,T),ae=T.length,this.remainderData=null),ae<188&&!u)return this.remainderData=T,{audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};var ye=Math.max(0,b.syncOffset(T));ae-=(ae+ye)%188,ae<T.byteLength&&!u&&(this.remainderData=new Uint8Array(T.buffer,ae,T.buffer.byteLength-ae));for(var pe=ye;pe<ae;pe+=188)if(T[pe]===71){var he=!!(T[pe+1]&64),fe=((T[pe+1]&31)<<8)+T[pe+2],de=(T[pe+3]&48)>>4,ne=void 0;if(de>1){if(ne=pe+5+T[pe+4],ne===pe+188)continue}else ne=pe+4;switch(fe){case D:he&&(U&&(o=a(U))&&this.parseAVCPES(o,!1),U={data:[],size:0}),U&&(U.data.push(T.subarray(ne,pe+188)),U.size+=pe+188-ne);break;case B:he&&(M&&(o=a(M))&&(y.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),M={data:[],size:0}),M&&(M.data.push(T.subarray(ne,pe+188)),M.size+=pe+188-ne);break;case W:he&&(k&&(o=a(k))&&this.parseID3PES(o),k={data:[],size:0}),k&&(k.data.push(T.subarray(ne,pe+188)),k.size+=pe+188-ne);break;case 0:he&&(ne+=T[ne]+1),ee=this._pmtId=v(T,ne);break;case ee:{he&&(ne+=T[ne]+1);var me=d(T,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);D=me.avc,D>0&&(x.pid=D),B=me.audio,B>0&&(y.pid=B,y.isAAC=me.isAAC),W=me.id3,W>0&&(p.pid=W),H&&!X&&(h.logger.log("reparse from beginning"),H=!1,pe=ye-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=U,y.pesData=M,p.pesData=k;var $={audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};return u&&this.extractRemainingSamples($),$},f.flush=function(){var T=this.remainderData;this.remainderData=null;var m;return T?m=this.demux(T,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},f.extractRemainingSamples=function(T){var m=T.audioTrack,c=T.avcTrack,u=T.id3Track,o=c.pesData,x=m.pesData,y=u.pesData,p;o&&(p=a(o))?(this.parseAVCPES(p,!0),c.pesData=null):c.pesData=o,x&&(p=a(x))?(m.isAAC?this.parseAACPES(p):this.parseMPEGPES(p),m.pesData=null):(x!=null&&x.size&&h.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=x),y&&(p=a(y))?(this.parseID3PES(p),u.pesData=null):u.pesData=y},f.demuxSampleAes=function(T,m,c){var u=this.demux(T,c,!0,!this.config.progressive),o=this.sampleAes=new I.default(this.observer,this.config,m);return this.decrypt(u,o)},f.decrypt=function(T,m){return new Promise(function(c){var u=T.audioTrack,o=T.avcTrack;u.samples&&u.isAAC?m.decryptAacSamples(u.samples,0,function(){o.samples?m.decryptAvcSamples(o.samples,0,0,function(){c(T)}):c(T)}):o.samples&&m.decryptAvcSamples(o.samples,0,0,function(){c(T)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(T,m){var c=this,u=this._avcTrack,o=this.parseAVCNALu(T.data),x=!1,y=this.avcSample,p,D=!1;T.data=null,y&&o.length&&!u.audFound&&(l(y,u),y=this.avcSample=E(!1,T.pts,T.dts,"")),o.forEach(function(U){switch(U.type){case 1:{p=!0,y||(y=c.avcSample=E(!0,T.pts,T.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var B=U.data;if(D&&B.length>4){var W=new O.default(B).readSliceType();(W===2||W===4||W===7||W===9)&&(y.key=!0)}break}case 5:p=!0,y||(y=c.avcSample=E(!0,T.pts,T.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{p=!0,x&&y&&(y.debug+="SEI ");var M=new O.default(_(U.data));M.readUByte();for(var k=0,H=0,X=!1,ee=0;!X&&M.bytesAvailable>1;){k=0;do ee=M.readUByte(),k+=ee;while(ee===255);H=0;do ee=M.readUByte(),H+=ee;while(ee===255);if(k===4&&M.bytesAvailable!==0){X=!0;var ae=M.readUByte();if(ae===181){var ye=M.readUShort();if(ye===49){var pe=M.readUInt();if(pe===1195456820){var he=M.readUByte();if(he===3){for(var fe=M.readUByte(),de=M.readUByte(),ne=31&fe,me=[fe,de],$=0;$<ne;$++)me.push(M.readUByte()),me.push(M.readUByte()),me.push(M.readUByte());s(c._txtTrack.samples,{type:3,pts:T.pts,bytes:me})}}}}}else if(k===5&&M.bytesAvailable!==0){if(X=!0,H>16){for(var ie=[],te=0;te<16;te++)ie.push(M.readUByte().toString(16)),(te===3||te===5||te===7||te===9)&&ie.push("-");for(var Ee=H-16,Ce=new Uint8Array(Ee),ve=0;ve<Ee;ve++)Ce[ve]=M.readUByte();s(c._txtTrack.samples,{pts:T.pts,payloadType:k,uuid:ie.join(""),userData:Object(F.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(H<M.bytesAvailable)for(var we=0;we<H;we++)M.readUByte()}break}case 7:if(p=!0,D=!0,x&&y&&(y.debug+="SPS "),!u.sps){var Ae=new O.default(U.data),De=Ae.readSPS();u.width=De.width,u.height=De.height,u.pixelRatio=De.pixelRatio,u.sps=[U.data],u.duration=c._duration;for(var Ie=U.data.subarray(1,4),Le="avc1.",Oe=0;Oe<3;Oe++){var Xe=Ie[Oe].toString(16);Xe.length<2&&(Xe="0"+Xe),Le+=Xe}u.codec=Le}break;case 8:p=!0,x&&y&&(y.debug+="PPS "),u.pps||(u.pps=[U.data]);break;case 9:p=!1,u.audFound=!0,y&&l(y,u),y=c.avcSample=E(!1,T.pts,T.dts,x?"AUD ":"");break;case 12:p=!1;break;default:p=!1,y&&(y.debug+="unknown NAL "+U.type+" ");break}if(y&&p){var Ze=y.units;Ze.push(U)}}),m&&y&&(l(y,u),this.avcSample=null)},f.getLastNalUnit=function(){var T,m=this.avcSample,c;if(!m||m.units.length===0){var u=this._avcTrack.samples;m=u[u.length-1]}if((T=m)!==null&&T!==void 0&&T.units){var o=m.units;c=o[o.length-1]}return c},f.parseAVCNALu=function(T){var m=T.byteLength,c=this._avcTrack,u=c.naluState||0,o=u,x=[],y=0,p,D,U,B=-1,W=0;for(u===-1&&(B=0,W=T[0]&31,u=0,y=1);y<m;){if(p=T[y++],!u){u=p?0:1;continue}if(u===1){u=p?0:2;continue}if(!p)u=3;else if(p===1){if(B>=0){var M={data:T.subarray(B,y-u-1),type:W};x.push(M)}else{var k=this.getLastNalUnit();if(k&&(o&&y<=4-o&&(k.state&&(k.data=k.data.subarray(0,k.data.byteLength-o))),D=y-u-1,D>0)){var H=new Uint8Array(k.data.byteLength+D);H.set(k.data,0),H.set(T.subarray(0,D),k.data.byteLength),k.data=H,k.state=0}}y<m?(U=T[y]&31,B=y,W=U,u=0):u=-1}else u=0}if(B>=0&&u>=0){var X={data:T.subarray(B,m),type:W,state:u};x.push(X)}if(x.length===0){var ee=this.getLastNalUnit();if(ee){var ae=new Uint8Array(ee.data.byteLength+T.byteLength);ae.set(ee.data,0),ae.set(T,ee.data.byteLength),ee.data=ae}}return c.naluState=u,x},f.parseAACPES=function(T){var m=0,c=this._audioTrack,u=this.aacOverFlow,o=T.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,y=Math.min(u.missing,x),p=x-y;u.sample.unit.set(o.subarray(0,y),p),c.samples.push(u.sample),m=u.missing}var D,U;for(D=m,U=o.length;D<U-1&&!K.isHeader(o,D);D++);if(D!==m){var B,W;if(D<U-1?(B="AAC PES did not start with ADTS header,offset:"+D,W=!1):(B="no ADTS header found in AAC PES",W=!0),h.logger.warn("parsing error:"+B),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:B}),W)return}K.initTrackConfig(c,this.observer,o,D,this.audioCodec);var M;if(T.pts!==void 0)M=T.pts;else if(u){var k=K.getFrameDuration(c.samplerate);M=u.sample.pts+k}else{h.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;D<U;)if(K.isHeader(o,D)){if(D+5<U){var X=K.appendFrame(c,o,D,M,H);if(X)if(X.missing)this.aacOverFlow=X;else{D+=X.length,H++;continue}}break}else D++},f.parseMPEGPES=function(T){var m=T.data,c=m.length,u=0,o=0,x=T.pts;if(x===void 0){h.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<c;)if(N.isHeader(m,o)){var y=N.appendFrame(this._audioTrack,m,o,x,u);if(y)o+=y.length,u++;else break}else o++},f.parseID3PES=function(T){if(T.pts===void 0){h.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},b}();w.minProbeByteLength=188;function E(b,f,A,T){return{key:b,frame:!1,pts:f,dts:A,units:[],debug:T,length:0}}function v(b,f){return(b[f+10]&31)<<8|b[f+11]}function d(b,f,A,T){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(b[f+1]&15)<<8|b[f+2],u=f+3+c-4,o=(b[f+10]&15)<<8|b[f+11];for(f+=12+o;f<u;){var x=(b[f+1]&31)<<8|b[f+2];switch(b[f]){case 207:if(!T){h.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=x);break;case 21:m.id3===-1&&(m.id3=x);break;case 219:if(!T){h.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=x);break;case 3:case 4:A?m.audio===-1&&(m.audio=x,m.isAAC=!1):h.logger.log("MPEG audio found, not supported in this browser");break;case 36:h.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((b[f+3]&15)<<8|b[f+4])+5}return m}function a(b){var f=0,A,T,m,c,u,o=b.data;if(!b||b.size===0)return null;for(;o[0].length<19&&o.length>1;){var x=new Uint8Array(o[0].length+o[1].length);x.set(o[0]),x.set(o[1],o[0].length),o[0]=x,o.splice(1,1)}A=o[0];var y=(A[0]<<16)+(A[1]<<8)+A[2];if(y===1){if(T=(A[4]<<8)+A[5],T&&T>b.size-6)return null;var p=A[7];p&192&&(c=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,p&64?(u=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,c-u>60*9e4&&(h.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),m=A[8];var D=m+9;if(b.size<=D)return null;b.size-=D;for(var U=new Uint8Array(b.size),B=0,W=o.length;B<W;B++){A=o[B];var M=A.byteLength;if(D)if(D>M){D-=M;continue}else A=A.subarray(D),M-=D,D=0;U.set(A,f),f+=M}return T&&(T-=m+3),{data:U,pts:c,dts:u,len:T}}return null}function l(b,f){if(b.units.length&&b.frame){if(b.pts===void 0){var A=f.samples,T=A.length;if(T){var m=A[T-1];b.pts=m.pts,b.dts=m.dts}else{f.dropped++;return}}f.samples.push(b)}b.debug.length&&h.logger.log(b.pts+"/"+b.dts+":"+b.debug)}function s(b,f){var A=b.length;if(A>0){if(f.pts>=b[A-1].pts)b.push(f);else for(var T=A-1;T>=0;T--)if(f.pts<b[T].pts){b.splice(T,0,f);break}}else b.push(f)}function _(b){for(var f=b.byteLength,A=[],T=1;T<f-2;)b[T]===0&&b[T+1]===0&&b[T+2]===3?(A.push(T+2),T+=2):T++;if(A.length===0)return b;var m=f-A.length,c=new Uint8Array(m),u=0;for(T=0;T<m;u++,T++)u===A[0]&&(u++,A.shift()),c[T]=b[u];return c}G.default=w},"./src/errors.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"ErrorTypes",function(){return K}),L.d(G,"ErrorDetails",function(){return N});var K;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(K||(K={}));var N;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(N||(N={}))},"./src/events.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"Events",function(){return K});var K;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return b});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),N=L.n(K),O=L("./src/loader/playlist-loader.ts"),F=L("./src/loader/key-loader.ts"),I=L("./src/controller/id3-track-controller.ts"),R=L("./src/controller/latency-controller.ts"),S=L("./src/controller/level-controller.ts"),h=L("./src/controller/fragment-tracker.ts"),g=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),w=L("./src/utils/logger.ts"),E=L("./src/config.ts"),v=L("./node_modules/eventemitter3/index.js"),d=L.n(v),a=L("./src/events.ts"),l=L("./src/errors.ts");function s(f,A){for(var T=0;T<A.length;T++){var m=A[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function _(f,A,T){return A&&s(f.prototype,A),T&&s(f,T),f}var b=function(){f.isSupported=function(){return Object(P.isSupported)()};function f(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var m=this.config=Object(E.mergeConfig)(f.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(E.enableStreamingMode)(m);var c=m.abrController,u=m.bufferController,o=m.capLevelController,x=m.fpsController,y=this.abrController=new c(this),p=this.bufferController=new u(this),D=this.capLevelController=new o(this),U=new x(this),B=new O.default(this),W=new F.default(this),M=new I.default(this),k=this.levelController=new S.default(this),H=new h.FragmentTracker(this),X=this.streamController=new g.default(this,H);D.setStreamController(X),U.setStreamController(X);var ee=[k,X];this.networkControllers=ee;var ae=[B,W,y,p,D,U,M,H];this.audioTrackController=this.createController(m.audioTrackController,null,ee),this.createController(m.audioStreamController,H,ee),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,ee),this.createController(m.subtitleStreamController,H,ee),this.createController(m.timelineController,null,ae),this.emeController=this.createController(m.emeController,null,ae),this.cmcdController=this.createController(m.cmcdController,null,ae),this.latencyController=this.createController(R.default,null,ae),this.coreComponents=ae}var A=f.prototype;return A.createController=function(m,c,u){if(m){var o=c?new m(this,c):new m(this);return u&&u.push(o),o}return null},A.on=function(m,c,u){u===void 0&&(u=this),this._emitter.on(m,c,u)},A.once=function(m,c,u){u===void 0&&(u=this),this._emitter.once(m,c,u)},A.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},A.off=function(m,c,u,o){u===void 0&&(u=this),this._emitter.off(m,c,u,o)},A.listeners=function(m){return this._emitter.listeners(m)},A.emit=function(m,c,u){return this._emitter.emit(m,c,u)},A.trigger=function(m,c){if(this.config.debug)return this.emit(m,m,c);try{return this.emit(m,m,c)}catch(u){w.logger.error("An internal error happened while handling event "+m+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:u})}return!1},A.listenerCount=function(m){return this._emitter.listenerCount(m)},A.destroy=function(){w.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},A.attachMedia=function(m){w.logger.log("attachMedia"),this._media=m,this.trigger(a.Events.MEDIA_ATTACHING,{media:m})},A.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(m){this.stopLoad();var c=this.media,u=this.url,o=this.url=K.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),c&&u&&u!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(a.Events.MANIFEST_LOADING,{url:m})},A.startLoad=function(m){m===void 0&&(m=-1),w.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(c){c.startLoad(m)})},A.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},A.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){w.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},A.removeLevel=function(m,c){c===void 0&&(c=0),this.levelController.removeLevel(m,c)},_(f,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){w.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){w.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){w.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){w.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){w.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var c=!!m;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(m){this._autoLevelCapping!==m&&(w.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,c=this.config.minAutoBitrate;if(!m)return 0;for(var u=m.length,o=0;o<u;o++)if(m[o].maxBitrate>c)return o;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,c=this.autoLevelCapping,u;return c===-1&&m&&m.length?u=m.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var c=this.audioTrackController;c&&(c.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:E.hlsDefaultConfig},set:function(m){f.defaultConfig=m}}]),f}();b.defaultConfig=void 0},"./src/is-supported.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"isSupported",function(){return O}),L.d(G,"changeTypeSupported",function(){return F});var K=L("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var I=Object(K.getMediaSource)();if(!I)return!1;var R=N(),S=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),h=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!S&&!!h}function F(){var I,R=N();return typeof(R==null||((I=R.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return w}),L.d(G,"LoadError",function(){return v});var K=L("./src/polyfills/number.ts"),N=L("./src/errors.ts");function O(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,h(d,a)}function F(d){var a=typeof Map=="function"?new Map:void 0;return F=function(s){if(s===null||!S(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(s))return a.get(s);a.set(s,_)}function _(){return I(s,arguments,g(this).constructor)}return _.prototype=Object.create(s.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),h(_,s)},F(d)}function I(d,a,l){return R()?I=Reflect.construct:I=function(_,b,f){var A=[null];A.push.apply(A,b);var T=Function.bind.apply(_,A),m=new T;return f&&h(m,f.prototype),m},I.apply(null,arguments)}function R(){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 S(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function h(d,a){return h=Object.setPrototypeOf||function(s,_){return s.__proto__=_,s},h(d,a)}function g(d){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},g(d)}var P=Math.pow(2,17),w=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=d.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(s,_){var b=this,f=s.url;if(!f)return Promise.reject(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var A=this.config,T=A.fLoader,m=A.loader;return new Promise(function(c,u){b.loader&&b.loader.destroy();var o=b.loader=s.loader=T?new T(A):new m(A),x=E(s),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:P};s.stats=o.stats,o.load(x,y,{onSuccess:function(D,U,B,W){b.resetLoader(s,o),c({frag:s,part:null,payload:D.data,networkDetails:W})},onError:function(D,U,B){b.resetLoader(s,o),u(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:D,networkDetails:B}))},onAbort:function(D,U,B){b.resetLoader(s,o),u(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:B}))},onTimeout:function(D,U,B){b.resetLoader(s,o),u(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:B}))},onProgress:function(D,U,B,W){_&&_({frag:s,part:null,payload:B,networkDetails:W})}})})},a.loadPart=function(s,_,b){var f=this;this.abort();var A=this.config,T=A.fLoader,m=A.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var o=f.loader=s.loader=T?new T(A):new m(A),x=E(s,_),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:P};_.stats=o.stats,o.load(x,y,{onSuccess:function(D,U,B,W){f.resetLoader(s,o),f.updateStatsFromPart(s,_);var M={frag:s,part:_,payload:D.data,networkDetails:W};b(M),c(M)},onError:function(D,U,B){f.resetLoader(s,o),u(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:_,response:D,networkDetails:B}))},onAbort:function(D,U,B){s.stats.aborted=_.stats.aborted,f.resetLoader(s,o),u(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:_,networkDetails:B}))},onTimeout:function(D,U,B){f.resetLoader(s,o),u(new v({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:_,networkDetails:B}))}})})},a.updateStatsFromPart=function(s,_){var b=s.stats,f=_.stats,A=f.total;if(b.loaded+=f.loaded,A){var T=Math.round(s.duration/_.duration),m=Math.min(Math.round(b.loaded/A),T),c=T-m,u=c*Math.round(b.loaded/m);b.total=b.loaded+u}else b.total=Math.max(b.loaded,b.total);var o=b.loading,x=f.loading;o.start?o.first+=x.first-x.start:(o.start=x.start,o.first=x.first),o.end=x.end},a.resetLoader=function(s,_){s.loader=null,this.loader===_&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),_.destroy()},d}();function E(d,a){a===void 0&&(a=null);var l=a||d,s={frag:d,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},_=l.byteRangeStartOffset,b=l.byteRangeEndOffset;return Object(K.isFiniteNumber)(_)&&Object(K.isFiniteNumber)(b)&&(s.rangeStart=_,s.rangeEnd=b),s}var v=function(d){O(a,d);function a(l){for(var s,_=arguments.length,b=new Array(_>1?_-1:0),f=1;f<_;f++)b[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(b))||this,s.data=void 0,s.data=l,s}return a}(F(Error))},"./src/loader/fragment.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"ElementaryStreamTypes",function(){return w}),L.d(G,"BaseSegment",function(){return E}),L.d(G,"Fragment",function(){return v}),L.d(G,"Part",function(){return d});var K=L("./src/polyfills/number.ts"),N=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(N),F=L("./src/utils/logger.ts"),I=L("./src/loader/level-key.ts"),R=L("./src/loader/load-stats.ts");function S(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,h(a,l)}function h(a,l){return h=Object.setPrototypeOf||function(_,b){return _.__proto__=b,_},h(a,l)}function g(a,l){for(var s=0;s<l.length;s++){var _=l[s];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(a,_.key,_)}}function P(a,l,s){return l&&g(a.prototype,l),s&&g(a,s),a}var w;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(w||(w={}));var E=function(){function a(s){var _;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(_={},_[w.AUDIO]=null,_[w.VIDEO]=null,_[w.AUDIOVIDEO]=null,_),this.baseurl=s}var l=a.prototype;return l.setByteRange=function(_,b){var f=_.split("@",2),A=[];f.length===1?A[0]=b?b.byteRangeEndOffset:0:A[0]=parseInt(f[1]),A[1]=parseInt(f[0])+A[0],this._byteRange=A},P(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(_){this._url=_}}]),a}(),v=function(a){S(l,a);function l(_,b){var f;return f=a.call(this,b)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new R.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=_,f}var s=l.prototype;return s.createInitializationVector=function(b){for(var f=new Uint8Array(16),A=12;A<16;A++)f[A]=b>>8*(15-A)&255;return f},s.setDecryptDataFromLevelKey=function(b,f){var A=b;return(b==null?void 0:b.method)==="AES-128"&&b.uri&&!b.iv&&(A=I.LevelKey.fromURI(b.uri),A.method=b.method,A.iv=this.createInitializationVector(f),A.keyFormat="identity"),A},s.setElementaryStreamInfo=function(b,f,A,T,m,c){c===void 0&&(c=!1);var u=this.elementaryStreams,o=u[b];if(!o){u[b]={startPTS:f,endPTS:A,startDTS:T,endDTS:m,partial:c};return}o.startPTS=Math.min(o.startPTS,f),o.endPTS=Math.max(o.endPTS,A),o.startDTS=Math.min(o.startDTS,T),o.endDTS=Math.max(o.endDTS,m)},s.clearElementaryStreamInfo=function(){var b=this.elementaryStreams;b[w.AUDIO]=null,b[w.VIDEO]=null,b[w.AUDIOVIDEO]=null},P(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var b=this.sn;typeof b!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),b=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,b)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var b=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+b*1e3}},{key:"encrypted",get:function(){var b;return!!((b=this.decryptdata)!==null&&b!==void 0&&b.keyFormat&&this.decryptdata.uri)}}]),l}(E),d=function(a){S(l,a);function l(s,_,b,f,A){var T;T=a.call(this,b)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new R.LoadStats,T.duration=s.decimalFloatingPoint("DURATION"),T.gap=s.bool("GAP"),T.independent=s.bool("INDEPENDENT"),T.relurl=s.enumeratedString("URI"),T.fragment=_,T.index=f;var m=s.enumeratedString("BYTERANGE");return m&&T.setByteRange(m,A),A&&(T.fragOffset=A.fragOffset+A.duration),T}return P(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var _=this.elementaryStreams;return!!(_.audio||_.video||_.audiovideo)}}]),l}(E)},"./src/loader/key-loader.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return F});var K=L("./src/events.ts"),N=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),F=function(){function I(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var R=I.prototype;return R._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var h in this.loaders){var g=this.loaders[h];g&&g.destroy()}this.loaders={}},R.onKeyLoading=function(h,g){var P=g.frag,w=P.type,E=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=P.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(E&&(O.logger.warn("abort previous key loader for type:"+w),E.abort()),!v){O.logger.warn("key uri is falsy");return}var a=d.loader,l=P.loader=this.loaders[w]=new a(d);this.decrypturl=v,this.decryptkey=null;var s={url:v,frag:P,responseType:"arraybuffer"},_={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(s,_,b)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:P}))},R.loadsuccess=function(h,g,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(h.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:w})},R.loaderror=function(h,g){var P=g.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:h})},R.loadtimeout=function(h,g){var P=g.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},I}()},"./src/loader/level-details.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"LevelDetails",function(){return I});var K=L("./src/polyfills/number.ts");function N(R,S){for(var h=0;h<S.length;h++){var g=S[h];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(R,g.key,g)}}function O(R,S,h){return S&&N(R.prototype,S),h&&N(R,h),R}var F=10,I=function(){function R(h){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=h}var S=R.prototype;return S.reloaded=function(g){if(!g){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-g.lastPartSn,w=this.lastPartIndex-g.lastPartIndex;this.updated=this.endSN!==g.endSN||!!w||!!P,this.advanced=this.endSN>g.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(g.misses*.6):this.misses=g.misses+1,this.availabilityDelay=g.availabilityDelay},O(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||F}},{key:"drift",get:function(){var g=this.driftEndTime-this.driftStartTime;if(g>0){var P=this.driftEnd-this.driftStart;return P*1e3/g}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var g;return(g=this.partList)!==null&&g!==void 0&&g.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var g;return(g=this.fragments)!==null&&g!==void 0&&g.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 g;return(g=this.partList)!==null&&g!==void 0&&g.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var g;return(g=this.partList)!==null&&g!==void 0&&g.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"LevelKey",function(){return I});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),N=L.n(K);function O(R,S){for(var h=0;h<S.length;h++){var g=S[h];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(R,g.key,g)}}function F(R,S,h){return S&&O(R.prototype,S),h&&O(R,h),R}var I=function(){R.fromURL=function(h,g){return new R(h,g)},R.fromURI=function(h){return new R(h)};function R(S,h){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,h?this._uri=Object(K.buildAbsoluteURL)(S,h,{alwaysNormalize:!0}):this._uri=S}return F(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"LoadStats",function(){return K});var K=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(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return l});var K=L("./src/polyfills/number.ts"),N=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(N),F=L("./src/loader/fragment.ts"),I=L("./src/loader/level-details.ts"),R=L("./src/loader/level-key.ts"),S=L("./src/utils/attr-list.ts"),h=L("./src/utils/logger.ts"),g=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function a(A){var T,m;return d.test((T=(m=N.parseURL(A))===null||m===void 0?void 0:m.path)!=null?T:"")}var l=function(){function A(){}return A.findGroup=function(m,c){for(var u=0;u<m.length;u++){var o=m[u];if(o.id===c)return o}},A.convertAVC1ToAVCOTI=function(m){var c=m.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return m},A.resolve=function(m,c){return N.buildAbsoluteURL(c,m,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(m,c){var u=[],o={},x=!1;P.lastIndex=0;for(var y;(y=P.exec(m))!=null;)if(y[1]){var p=new S.AttrList(y[1]),D={attrs:p,bitrate:p.decimalInteger("AVERAGE-BANDWIDTH")||p.decimalInteger("BANDWIDTH"),name:p.NAME,url:A.resolve(y[2],c)},U=p.decimalResolution("RESOLUTION");U&&(D.width=U.width,D.height=U.height),s((p.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=A.convertAVC1ToAVCOTI(D.videoCodec)),u.push(D)}else if(y[3]){var B=new S.AttrList(y[3]);B["DATA-ID"]&&(x=!0,o[B["DATA-ID"]]=B)}return{levels:u,sessionData:x?o:null}},A.parseMasterPlaylistMedia=function(m,c,u,o){o===void 0&&(o=[]);var x,y=[],p=0;for(w.lastIndex=0;(x=w.exec(m))!==null;){var D=new S.AttrList(x[1]);if(D.TYPE===u){var U={attrs:D,bitrate:0,id:p++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:u,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?A.resolve(D.URI,c):""};if(o.length){var B=A.findGroup(o,U.groupId)||o[0];_(U,B,"audioCodec"),_(U,B,"textCodec")}y.push(U)}}return y},A.parseLevelPlaylist=function(m,c,u,o,x){var y=new I.LevelDetails(c),p=y.fragments,D=null,U=0,B=0,W=0,M=0,k=null,H=new F.Fragment(o,c),X,ee,ae,ye=-1,pe=!1;for(E.lastIndex=0,y.m3u8=m;(X=E.exec(m))!==null;){pe&&(pe=!1,H=new F.Fragment(o,c),H.start=W,H.sn=U,H.cc=M,H.level=u,D&&(H.initSegment=D,H.rawProgramDateTime=D.rawProgramDateTime));var he=X[1];if(he){H.duration=parseFloat(he);var fe=(" "+X[2]).slice(1);H.title=fe||null,H.tagList.push(fe?["INF",he,fe]:["INF",he])}else if(X[3])Object(K.isFiniteNumber)(H.duration)&&(H.start=W,ae&&(H.levelkey=ae),H.sn=U,H.level=u,H.cc=M,H.urlId=x,p.push(H),H.relurl=(" "+X[3]).slice(1),f(H,k),k=H,W+=H.duration,U++,B=0,pe=!0);else if(X[4]){var de=(" "+X[4]).slice(1);k?H.setByteRange(de,k):H.setByteRange(de)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),ye===-1&&(ye=p.length);else{if(X=X[0].match(v),!X){h.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<X.length&&!(typeof X[ee]!="undefined");ee++);var ne=(" "+X[ee]).slice(1),me=(" "+X[ee+1]).slice(1),$=X[ee+2]?(" "+X[ee+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":y.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":U=y.startSN=parseInt(me);break;case"SKIP":{var ie=new S.AttrList(me),te=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(te)){y.skippedSegments=te;for(var Ee=te;Ee--;)p.unshift(null);U+=te}var Ce=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(y.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(me);break;case"VERSION":y.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(me||$)&&H.tagList.push($?[me,$]:[me]);break;case"DIS":M++;case"GAP":H.tagList.push([ne]);break;case"BITRATE":H.tagList.push([ne,me]);break;case"DISCONTINUITY-SEQ":M=parseInt(me);break;case"KEY":{var ve,we=new S.AttrList(me),Ae=we.enumeratedString("METHOD"),De=we.URI,Ie=we.hexadecimalInteger("IV"),Le=we.enumeratedString("KEYFORMATVERSIONS"),Oe=we.enumeratedString("KEYID"),Xe=(ve=we.enumeratedString("KEYFORMAT"))!=null?ve:"identity",Ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ze.indexOf(Xe)>-1){h.logger.warn("Keyformat "+Xe+" is not supported from the manifest");continue}else if(Xe!=="identity")continue;Ae&&(ae=R.LevelKey.fromURL(c,De),De&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ae)>=0&&(ae.method=Ae,ae.keyFormat=Xe,Oe&&(ae.keyID=Oe),Le&&(ae.keyFormatVersions=Le),ae.iv=Ie));break}case"START":{var Be=new S.AttrList(me),je=Be.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(je)&&(y.startTimeOffset=je);break}case"MAP":{var rt=new S.AttrList(me);H.relurl=rt.URI,rt.BYTERANGE&&H.setByteRange(rt.BYTERANGE),H.level=u,H.sn="initSegment",ae&&(H.levelkey=ae),H.initSegment=null,D=H,pe=!0;break}case"SERVER-CONTROL":{var Ye=new S.AttrList(me);y.canBlockReload=Ye.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Ye.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Ye.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Ye.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Ye.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var qe=new S.AttrList(me);y.partTarget=qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Te=y.partList;Te||(Te=y.partList=[]);var $e=B>0?Te[Te.length-1]:void 0,Ge=B++,_e=new F.Part(new S.AttrList(me),H,c,Ge,$e);Te.push(_e),H.duration+=_e.duration;break}case"PRELOAD-HINT":{var Ue=new S.AttrList(me);y.preloadHint=Ue;break}case"RENDITION-REPORT":{var ge=new S.AttrList(me);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:h.logger.warn("line parsed but not handled: "+X);break}}}k&&!k.relurl?(p.pop(),W-=k.duration,y.partList&&(y.fragmentHint=k)):y.partList&&(f(H,k),H.cc=M,y.fragmentHint=H);var se=p.length,ce=p[0],Q=p[se-1];if(W+=y.skippedSegments*y.targetduration,W>0&&se&&Q){y.averagetargetduration=W/se;var q=Q.sn;y.endSN=q!=="initSegment"?q:0,ce&&(y.startCC=ce.cc,ce.initSegment||y.fragments.every(function(re){return re.relurl&&a(re.relurl)})&&(h.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new F.Fragment(o,c),H.relurl=Q.relurl,H.level=u,H.sn="initSegment",ce.initSegment=H,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(W+=y.fragmentHint.duration),y.totalduration=W,y.endCC=M,ye>0&&b(p,ye),y},A}();function s(A,T){["video","audio","text"].forEach(function(m){var c=A.filter(function(o){return Object(g.isCodecType)(o,m)});if(c.length){var u=c.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});T[m+"Codec"]=u.length>0?u[0]:c[0],A=A.filter(function(o){return c.indexOf(o)===-1})}}),T.unknownCodecs=A}function _(A,T,m){var c=T[m];c&&(A[m]=c)}function b(A,T){for(var m=A[T],c=T;c--;){var u=A[c];if(!u)return;u.programDateTime=m.programDateTime-u.duration*1e3,m=u}}function f(A,T){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):T!=null&&T.programDateTime&&(A.programDateTime=T.endProgramDateTime),Object(K.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/polyfills/number.ts"),N=L("./src/events.ts"),O=L("./src/errors.ts"),F=L("./src/utils/logger.ts"),I=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/m3u8-parser.ts"),S=L("./src/types/loader.ts"),h=L("./src/utils/attr-list.ts");function g(E){var v=E.type;switch(v){case S.PlaylistContextType.AUDIO_TRACK:return S.PlaylistLevelType.AUDIO;case S.PlaylistContextType.SUBTITLE_TRACK:return S.PlaylistLevelType.SUBTITLE;default:return S.PlaylistLevelType.MAIN}}function P(E,v){var d=E.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var w=function(){function E(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=E.prototype;return v.registerListeners=function(){var a=this.hls;a.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(a){var l=this.hls.config,s=l.pLoader,_=l.loader,b=s||_,f=new b(l);return a.loader=f,this.loaders[a.type]=f,f},v.getInternalLoader=function(a){return this.loaders[a.type]},v.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},v.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(a,l){var s=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:S.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},v.onLevelLoading=function(a,l){var s=l.id,_=l.level,b=l.url,f=l.deliveryDirectives;this.load({id:s,groupId:null,level:_,responseType:"text",type:S.PlaylistContextType.LEVEL,url:b,deliveryDirectives:f})},v.onAudioTrackLoading=function(a,l){var s=l.id,_=l.groupId,b=l.url,f=l.deliveryDirectives;this.load({id:s,groupId:_,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:b,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(a,l){var s=l.id,_=l.groupId,b=l.url,f=l.deliveryDirectives;this.load({id:s,groupId:_,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:b,deliveryDirectives:f})},v.load=function(a){var l,s=this.hls.config,_=this.getInternalLoader(a);if(_){var b=_.context;if(b&&b.url===a.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),_.abort()}var f,A,T,m;switch(a.type){case S.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,A=s.manifestLoadingTimeOut,T=s.manifestLoadingRetryDelay,m=s.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:f=0,A=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,A=s.levelLoadingTimeOut,T=s.levelLoadingRetryDelay,m=s.levelLoadingMaxRetryTimeout;break}if(_=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(a.type===S.PlaylistContextType.LEVEL&&a.level!==null?c=this.hls.levels[a.level].details:a.type===S.PlaylistContextType.AUDIO_TRACK&&a.id!==null?c=this.hls.audioTracks[a.id].details:a.type===S.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(c=this.hls.subtitleTracks[a.id].details),c){var u=c.partTarget,o=c.targetduration;u&&o&&(A=Math.min(Math.max(u*3,o*.8)*1e3,A))}}var x={timeout:A,maxRetry:f,retryDelay:T,maxRetryDelay:m,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};_.load(a,x,y)},v.loadsuccess=function(a,l,s,_){if(_===void 0&&(_=null),s.isSidxRequest){this.handleSidxRequest(a,s),this.handlePlaylistLoaded(a,l,s,_);return}this.resetInternalLoader(s.type);var b=a.data;if(b.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,s,"no EXTM3U delimiter",_);return}l.parsing.start=performance.now(),b.indexOf("#EXTINF:")>0||b.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,s,_):this.handleMasterPlaylist(a,l,s,_)},v.loaderror=function(a,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!1,a)},v.loadtimeout=function(a,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!0)},v.handleMasterPlaylist=function(a,l,s,_){var b=this.hls,f=a.data,A=P(a,s),T=R.default.parseMasterPlaylist(f,A),m=T.levels,c=T.sessionData;if(!m.length){this.handleManifestParsingError(a,s,"no level found in manifest",_);return}var u=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),o=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),x=R.default.parseMasterPlaylistMedia(f,A,"AUDIO",u),y=R.default.parseMasterPlaylistMedia(f,A,"SUBTITLES",o),p=R.default.parseMasterPlaylistMedia(f,A,"CLOSED-CAPTIONS");if(x.length){var D=x.some(function(U){return!U.url});!D&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new h.AttrList({}),bitrate:0,url:""}))}b.trigger(N.Events.MANIFEST_LOADED,{levels:m,audioTracks:x,subtitles:y,captions:p,url:A,stats:l,networkDetails:_,sessionData:c})},v.handleTrackOrLevelPlaylist=function(a,l,s,_){var b=this.hls,f=s.id,A=s.level,T=s.type,m=P(a,s),c=Object(K.isFiniteNumber)(f)?f:0,u=Object(K.isFiniteNumber)(A)?A:c,o=g(s),x=R.default.parseLevelPlaylist(a.data,m,u,o,c);if(!x.fragments.length){b.trigger(N.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(T===S.PlaylistContextType.MANIFEST){var y={attrs:new h.AttrList({}),bitrate:0,details:x,name:"",url:m};b.trigger(N.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:m,stats:l,networkDetails:_,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var p,D=(p=x.fragments[0].initSegment)===null||p===void 0?void 0:p.url;this.load({url:D,isSidxRequest:!0,type:T,level:A,levelDetails:x,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=x,this.handlePlaylistLoaded(a,l,s,_)},v.handleSidxRequest=function(a,l){var s=Object(I.parseSegmentIndex)(new Uint8Array(a.data));if(!s)return;var _=s.references,b=l.levelDetails;_.forEach(function(f,A){var T=f.info,m=b.fragments[A];m.byteRange.length===0&&m.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),m.initSegment&&m.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(a,l,s,_){this.hls.trigger(N.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===S.PlaylistContextType.MANIFEST,url:a.url,reason:s,response:a,context:l,networkDetails:_})},v.handleNetworkError=function(a,l,s,_){s===void 0&&(s=!1),F.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var b=O.ErrorDetails.UNKNOWN,f=!1,A=this.getInternalLoader(a);switch(a.type){case S.PlaylistContextType.MANIFEST:b=s?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case S.PlaylistContextType.LEVEL:b=s?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.AUDIO_TRACK:b=s?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:b=s?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}A&&this.resetInternalLoader(a.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:b,fatal:f,url:a.url,loader:A,context:a,networkDetails:l};_&&(T.response=_),this.hls.trigger(N.Events.ERROR,T)},v.handlePlaylistLoaded=function(a,l,s,_){var b=s.type,f=s.level,A=s.id,T=s.groupId,m=s.loader,c=s.levelDetails,u=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(a,s,"invalid target duration",_);return}if(!m)return;c.live&&(m.getCacheAge&&(c.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(b){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:c,level:f||0,id:A||0,stats:l,networkDetails:_,deliveryDirectives:u});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:c,id:A||0,groupId:T||"",stats:l,networkDetails:_,deliveryDirectives:u});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:c,id:A||0,groupId:T||"",stats:l,networkDetails:_,deliveryDirectives:u});break}},E}();G.default=w},"./src/polyfills/number.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"isFiniteNumber",function(){return K}),L.d(G,"MAX_SAFE_INTEGER",function(){return N});var K=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Z,G,L){"use strict";L.r(G);var K=function(){function N(){}return N.getSilentFrame=function(F,I){switch(F){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},N}();G.default=K},"./src/remux/mp4-generator.ts":function(Z,G,L){"use strict";L.r(G);var K=Math.pow(2,32)-1,N=function(){function O(){}return O.init=function(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var I;for(I in O.types)O.types.hasOwnProperty(I)&&(O.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var R=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]),S=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:R,audio:S};var h=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),g=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=g,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,E,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,h))},O.box=function(I){for(var R=8,S=arguments.length,h=new Array(S>1?S-1:0),g=1;g<S;g++)h[g-1]=arguments[g];for(var P=h.length,w=P;P--;)R+=h[P].byteLength;var E=new Uint8Array(R);for(E[0]=R>>24&255,E[1]=R>>16&255,E[2]=R>>8&255,E[3]=R&255,E.set(I,4),P=0,R=8;P<w;P++)E.set(h[P],R),R+=h[P].byteLength;return E},O.hdlr=function(I){return O.box(O.types.hdlr,O.HDLR_TYPES[I])},O.mdat=function(I){return O.box(O.types.mdat,I)},O.mdhd=function(I,R){R*=I;var S=Math.floor(R/(K+1)),h=Math.floor(R%(K+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,S>>24,S>>16&255,S>>8&255,S&255,h>>24,h>>16&255,h>>8&255,h&255,85,196,0,0]))},O.mdia=function(I){return O.box(O.types.mdia,O.mdhd(I.timescale,I.duration),O.hdlr(I.type),O.minf(I))},O.mfhd=function(I){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},O.minf=function(I){return I.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(I)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(I))},O.moof=function(I,R,S){return O.box(O.types.moof,O.mfhd(I),O.traf(S,R))},O.moov=function(I){for(var R=I.length,S=[];R--;)S[R]=O.trak(I[R]);return O.box.apply(null,[O.types.moov,O.mvhd(I[0].timescale,I[0].duration)].concat(S).concat(O.mvex(I)))},O.mvex=function(I){for(var R=I.length,S=[];R--;)S[R]=O.trex(I[R]);return O.box.apply(null,[O.types.mvex].concat(S))},O.mvhd=function(I,R){R*=I;var S=Math.floor(R/(K+1)),h=Math.floor(R%(K+1)),g=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,S>>24,S>>16&255,S>>8&255,S&255,h>>24,h>>16&255,h>>8&255,h&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,g)},O.sdtp=function(I){var R=I.samples||[],S=new Uint8Array(4+R.length),h,g;for(h=0;h<R.length;h++)g=R[h].flags,S[h+4]=g.dependsOn<<4|g.isDependedOn<<2|g.hasRedundancy;return O.box(O.types.sdtp,S)},O.stbl=function(I){return O.box(O.types.stbl,O.stsd(I),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(I){var R=[],S=[],h,g,P;for(h=0;h<I.sps.length;h++)g=I.sps[h],P=g.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(g));for(h=0;h<I.pps.length;h++)g=I.pps[h],P=g.byteLength,S.push(P>>>8&255),S.push(P&255),S=S.concat(Array.prototype.slice.call(g));var w=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|I.sps.length].concat(R).concat([I.pps.length]).concat(S))),E=I.width,v=I.height,d=I.pixelRatio[0],a=I.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,E>>8&255,E&255,v>>8&255,v&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]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,a>>24,a>>16&255,a>>8&255,a&255])))},O.esds=function(I){var R=I.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(I.config).concat([6,1,2]))},O.mp4a=function(I){var R=I.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(I)))},O.mp3=function(I){var R=I.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},O.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(I)):O.box(O.types.stsd,O.STSD,O.mp4a(I)):O.box(O.types.stsd,O.STSD,O.avc1(I))},O.tkhd=function(I){var R=I.id,S=I.duration*I.timescale,h=I.width,g=I.height,P=Math.floor(S/(K+1)),w=Math.floor(S%(K+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&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,h>>8&255,h&255,0,0,g>>8&255,g&255,0,0]))},O.traf=function(I,R){var S=O.sdtp(I),h=I.id,g=Math.floor(R/(K+1)),P=Math.floor(R%(K+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,h>>24,h>>16&255,h>>8&255,h&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,g>>24,g>>16&255,g>>8&255,g&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(I,S.length+16+20+8+16+8+8),S)},O.trak=function(I){return I.duration=I.duration||4294967295,O.box(O.types.trak,O.tkhd(I),O.mdia(I))},O.trex=function(I){var R=I.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(I,R){var S=I.samples||[],h=S.length,g=12+16*h,P=new Uint8Array(g),w,E,v,d,a,l;for(R+=8+g,P.set([0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,h&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),w=0;w<h;w++)E=S[w],v=E.duration,d=E.size,a=E.flags,l=E.cts,P.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(I){O.types||O.init();var R=O.moov(I),S=new Uint8Array(O.FTYP.byteLength+R.byteLength);return S.set(O.FTYP),S.set(R,O.FTYP.byteLength),S},O}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,G.default=N},"./src/remux/mp4-remuxer.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return l}),L.d(G,"normalizePts",function(){return s});var K=L("./src/polyfills/number.ts"),N=L("./src/remux/aac-helper.ts"),O=L("./src/remux/mp4-generator.ts"),F=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),S=L("./src/types/loader.ts"),h=L("./src/utils/timescale-conversion.ts");function g(){return g=Object.assign||function(A){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(A[c]=m[c])}return A},g.apply(this,arguments)}var P=10*1e3,w=1024,E=1152,v=null,d=null,a=!1,l=function(){function A(m,c,u,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=m,this.config=c,this.typeSupported=u,this.ISGenerated=!1,v===null){var x=navigator.userAgent||"",y=x.match(/Chrome\/(\d+)/i);v=y?parseInt(y[1]):0}if(d===null){var p=navigator.userAgent.match(/Safari\/(\d+)/i);d=p?parseInt(p[1]):0}a=!!v&&v<75||!!d&&d<600}var T=A.prototype;return T.destroy=function(){},T.resetTimeStamp=function(c){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},T.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(c){var u=!1,o=c.reduce(function(x,y){var p=y.pts-x;return p<-4294967296?(u=!0,s(x,y.pts)):p>0?x:y.pts},c[0].pts);return u&&R.logger.debug("PTS rollover detected"),o},T.remux=function(c,u,o,x,y,p,D,U){var B,W,M,k,H,X,ee=y,ae=y,ye=c.pid>-1,pe=u.pid>-1,he=u.samples.length,fe=c.samples.length>0,de=he>1,ne=(!ye||fe)&&(!pe||de)||this.ISGenerated||D;if(ne){this.ISGenerated||(M=this.generateIS(c,u,y));var me=this.isVideoContiguous,$=-1;if(de&&($=_(u.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,$>0){R.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+he+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(u.samples);u.samples=u.samples.slice($),u.dropped+=$,ae+=(u.samples[0].pts-ie)/(u.timescale||9e4)}else $===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),X=!1);if(this.ISGenerated){if(fe&&de){var te=this.getVideoStartPts(u.samples),Ee=s(c.samples[0].pts,te)-te,Ce=Ee/u.inputTimeScale;ee+=Math.max(0,Ce),ae+=Math.max(0,-Ce)}if(fe){if(c.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(c,u,y)),W=this.remuxAudio(c,ee,this.isAudioContiguous,p,pe||de||U===S.PlaylistLevelType.AUDIO?ae:void 0),de){var ve=W?W.endPTS-W.startPTS:0;u.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(c,u,y)),B=this.remuxVideo(u,ae,me,ve)}}else de&&(B=this.remuxVideo(u,ae,me,0));B&&(B.firstKeyFrame=$,B.independent=$!==-1)}}return this.ISGenerated&&(o.samples.length&&(H=this.remuxID3(o,y)),x.samples.length&&(k=this.remuxText(x,y))),{audio:W,video:B,initSegment:M,independent:X,text:k,id3:H}},T.generateIS=function(c,u,o){var x=c.samples,y=u.samples,p=this.typeSupported,D={},U=!Object(K.isFiniteNumber)(this._initPTS),B="audio/mp4",W,M,k;if(U&&(W=M=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(p.mpeg?(B="audio/mpeg",c.codec=""):p.mp3&&(c.codec="mp3")),D.audio={id:"audio",container:B,codec:c.codec,initSegment:!c.isAAC&&p.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(k=c.inputTimeScale,W=M=x[0].pts-Math.round(k*o))),u.sps&&u.pps&&y.length&&(u.timescale=u.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:O.default.initSegment([u]),metadata:{width:u.width,height:u.height}},U)){k=u.inputTimeScale;var H=this.getVideoStartPts(y),X=Math.round(k*o);M=Math.min(M,s(y[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(D).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=M),{tracks:D,initPTS:W,timescale:k}},T.remuxVideo=function(c,u,o,x){var y=c.inputTimeScale,p=c.samples,D=[],U=p.length,B=this._initPTS,W=this.nextAvcDts,M=8,k,H,X,ee=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,ye=0,pe=!1;if(!o||W===null){var he=u*y,fe=p[0].pts-s(p[0].dts,p[0].pts);W=he-fe}for(var de=0;de<U;de++){var ne=p[de];if(ne.pts=s(ne.pts-B,W),ne.dts=s(ne.dts-B,W),ne.dts>ne.pts){var me=9e4*.2;ye=Math.max(Math.min(ye,ne.pts-ne.dts),-1*me)}ne.dts<p[de>0?de-1:de].dts&&(pe=!0)}pe&&p.sort(function(ut,st){var it=ut.dts-st.dts,_t=ut.pts-st.pts;return it||_t}),H=p[0].dts,X=p[p.length-1].dts;var $=Math.round((X-H)/(U-1));if(ye<0){if(ye<$*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(h.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ie=ye,te=0;te<U;te++)p[te].dts=ie=Math.max(ie,p[te].pts-$),p[te].pts=Math.max(ie,p[te].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(h.toMsFromMpegTsClock)(ye,!0)+" ms to overcome this issue");for(var Ee=0;Ee<U;Ee++)p[Ee].dts=p[Ee].dts+ye}H=p[0].dts}if(o){var Ce=H-W,ve=Ce>$,we=Ce<-1;if(ve||we){ve?R.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),H=W;var Ae=p[0].pts-Ce;p[0].dts=H,p[0].pts=Ae,R.logger.log("Video: First PTS/DTS adjusted: "+Object(h.toMsFromMpegTsClock)(Ae,!0)+"/"+Object(h.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(h.toMsFromMpegTsClock)(Ce,!0)+" ms")}}a&&(H=Math.max(0,H));for(var De=0,Ie=0,Le=0;Le<U;Le++){for(var Oe=p[Le],Xe=Oe.units,Ze=Xe.length,Be=0,je=0;je<Ze;je++)Be+=Xe[je].data.length;Ie+=Be,De+=Ze,Oe.length=Be,Oe.dts=Math.max(Oe.dts,H),Oe.pts=Math.max(Oe.pts,Oe.dts,0),ee=Math.min(Oe.pts,ee),ae=Math.max(Oe.pts,ae)}X=p[U-1].dts;var rt=Ie+4*De+8,Ye;try{Ye=new Uint8Array(rt)}catch(ut){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var qe=new DataView(Ye.buffer);qe.setUint32(0,rt),Ye.set(O.default.types.mdat,4);for(var Te=0;Te<U;Te++){for(var $e=p[Te],Ge=$e.units,_e=0,Ue=0,ge=Ge.length;Ue<ge;Ue++){var se=Ge[Ue],ce=se.data,Q=se.data.byteLength;qe.setUint32(M,Q),M+=4,Ye.set(ce,M),M+=Q,_e+=4+Q}if(Te<U-1)k=p[Te+1].dts-$e.dts;else{var q=this.config,re=$e.dts-p[Te>0?Te-1:Te].dts;if(q.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(q.maxBufferHole*y),Se=(x?ee+x*y:this.nextAudioPts)-$e.pts;Se>le?(k=Se-re,k<0&&(k=re),R.logger.log("[mp4-remuxer]: It is approximately "+Se/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=re}else k=re}var Re=Math.round($e.pts-$e.dts);D.push(new b($e.key,k,_e,Re))}if(D.length&&v&&v<70){var Pe=D[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(k!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+k,this.isVideoContiguous=!0;var Ve=O.default.moof(c.sequenceNumber++,H,g({},c,{samples:D})),ke="video",ze={data1:Ve,data2:Ye,startPTS:ee/y,endPTS:(ae+k)/y,startDTS:H/y,endDTS:W/y,type:ke,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ye.length,"MDAT length must not be zero"),ze},T.remuxAudio=function(c,u,o,x,y){var p=c.inputTimeScale,D=c.samplerate?c.samplerate:p,U=p/D,B=c.isAAC?w:E,W=B*U,M=this._initPTS,k=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,ee=k?0:8,ae=this.nextAudioPts||-1,ye=u*p;if(this.isAudioContiguous=o=o||X.length&&ae>0&&(x&&Math.abs(ye-ae)<9e3||Math.abs(s(X[0].pts-M,ye)-ae)<20*W),X.forEach(function(ce){ce.pts=s(ce.pts-M,ye)}),!o||ae<0){if(X=X.filter(function(ce){return ce.pts>=0}),!X.length)return;y===0?ae=0:x?ae=Math.max(0,ye):ae=X[0].pts}if(c.isAAC)for(var pe=y!==void 0,he=this.config.maxAudioFramesDrift,fe=0,de=ae;fe<X.length;fe++){var ne=X[fe],me=ne.pts,$=me-de,ie=Math.abs(1e3*$/p);if($<=-he*W&&pe)fe===0&&(R.logger.warn("Audio frame @ "+(me/p).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/p)+" ms."),this.nextAudioPts=ae=de=me);else if($>=he*W&&ie<P&&pe){var te=Math.round($/W);de=me-te*W,de<0&&(te--,de+=W),fe===0&&(this.nextAudioPts=ae=de),R.logger.warn("[mp4-remuxer]: Injecting "+te+" audio frame @ "+(de/p).toFixed(3)+"s due to "+Math.round(1e3*$/p)+" ms gap.");for(var Ee=0;Ee<te;Ee++){var Ce=Math.max(de,0),ve=N.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ve||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ve=ne.unit.subarray()),X.splice(fe,0,{unit:ve,pts:Ce}),de+=W,fe++}}ne.pts=de,de+=W}for(var we=null,Ae=null,De,Ie=0,Le=X.length;Le--;)Ie+=X[Le].unit.byteLength;for(var Oe=0,Xe=X.length;Oe<Xe;Oe++){var Ze=X[Oe],Be=Ze.unit,je=Ze.pts;if(Ae!==null){var rt=H[Oe-1];rt.duration=Math.round((je-Ae)/U)}else if(o&&c.isAAC&&(je=ae),we=je,Ie>0){Ie+=ee;try{De=new Uint8Array(Ie)}catch(ce){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!k){var Ye=new DataView(De.buffer);Ye.setUint32(0,Ie),De.set(O.default.types.mdat,4)}}else return;De.set(Be,ee);var qe=Be.byteLength;ee+=qe,H.push(new b(!0,B,qe,0)),Ae=je}var Te=H.length;if(!Te)return;var $e=H[H.length-1];this.nextAudioPts=ae=Ae+U*$e.duration;var Ge=k?new Uint8Array(0):O.default.moof(c.sequenceNumber++,we/U,g({},c,{samples:H}));c.samples=[];var _e=we/p,Ue=ae/p,ge="audio",se={data1:Ge,data2:De,startPTS:_e,endPTS:Ue,startDTS:_e,endDTS:Ue,type:ge,hasAudio:!0,hasVideo:!1,nb:Te};return this.isAudioContiguous=!0,console.assert(De.length,"MDAT length must not be zero"),se},T.remuxEmptyAudio=function(c,u,o,x){var y=c.inputTimeScale,p=c.samplerate?c.samplerate:y,D=y/p,U=this.nextAudioPts,B=(U!==null?U:x.startDTS*y)+this._initDTS,W=x.endDTS*y+this._initDTS,M=D*w,k=Math.ceil((W-B)/M),H=N.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],ee=0;ee<k;ee++){var ae=B+ee*M;X.push({unit:H,pts:ae,dts:ae})}return c.samples=X,this.remuxAudio(c,u,o,!1)},T.remuxID3=function(c,u){var o=c.samples.length;if(!o)return;for(var x=c.inputTimeScale,y=this._initPTS,p=this._initDTS,D=0;D<o;D++){var U=c.samples[D];U.pts=s(U.pts-y,u*x)/x,U.dts=s(U.dts-p,u*x)/x}var B=c.samples;return c.samples=[],{samples:B}},T.remuxText=function(c,u){var o=c.samples.length;if(!o)return;for(var x=c.inputTimeScale,y=this._initPTS,p=0;p<o;p++){var D=c.samples[p];D.pts=s(D.pts-y,u*x)/x}c.samples.sort(function(B,W){return B.pts-W.pts});var U=c.samples;return c.samples=[],{samples:U}},A}();function s(A,T){var m;if(T===null)return A;for(T<A?m=-8589934592:m=8589934592;Math.abs(A-T)>4294967296;)A+=m;return A}function _(A){for(var T=0;T<A.length;T++)if(A[T].key)return T;return-1}var b=function(T,m,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=c,this.cts=u,this.flags=new f(T)},f=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/polyfills/number.ts"),N=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/fragment.ts"),F=L("./src/utils/logger.ts"),I=function(){function h(){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 g=h.prototype;return g.destroy=function(){},g.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},g.resetNextTimestamp=function(){this.lastEndDTS=null},g.resetInitSegment=function(w,E,v){this.audioCodec=E,this.videoCodec=v,this.generateInitSegment(w),this.emitInitSegment=!0},g.generateInitSegment=function(w){var E=this.audioCodec,v=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(N.parseInitSegment)(w);E||(E=S(d.audio,O.ElementaryStreamTypes.AUDIO)),v||(v=S(d.video,O.ElementaryStreamTypes.VIDEO));var a={};d.audio&&d.video?a.audiovideo={container:"video/mp4",codec:E+","+v,initSegment:w,id:"main"}:d.audio?a.audio={container:"audio/mp4",codec:E,initSegment:w,id:"audio"}:d.video?a.video={container:"video/mp4",codec:v,initSegment:w,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},g.remux=function(w,E,v,d,a){var l=this.initPTS,s=this.lastEndDTS,_={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(K.isFiniteNumber)(s)||(s=this.lastEndDTS=a||0);var b=E.samples;if(!b||!b.length)return _;var f={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(b),A=this.initData),!A||!A.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),_;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(l)||(this.initPTS=f.initPTS=l=R(A,b,s));var T=Object(N.getDuration)(b,A),m=s,c=T+m;Object(N.offsetStartDTS)(A,b,l),T>0?this.lastEndDTS=c:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!A.audio,o=!!A.video,x="";u&&(x+="audio"),o&&(x+="video");var y={data1:b,startPTS:m,startDTS:m,endPTS:c,endDTS:c,type:x,hasAudio:u,hasVideo:o,nb:1,dropped:0};return _.audio=y.type==="audio"?y:void 0,_.video=y.type!=="audio"?y:void 0,_.text=d,_.id3=v,_.initSegment=f,_},h}(),R=function(g,P,w){return Object(N.getStartDTS)(g,P)-w};function S(h,g){var P=h==null?void 0:h.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||g===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=I},"./src/task-loop.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return K});var K=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=N.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},N}()},"./src/types/cmcd.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"CMCDVersion",function(){return K}),L.d(G,"CMCDObjectType",function(){return N}),L.d(G,"CMCDStreamingFormat",function(){return O}),L.d(G,"CMCDStreamType",function(){return F});var K=1,N;(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"})(N||(N={}));var O;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(O||(O={}));var F;(function(I){I.VOD="v",I.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"HlsSkip",function(){return O}),L.d(G,"getSkipValue",function(){return F}),L.d(G,"HlsUrlParameters",function(){return I}),L.d(G,"Level",function(){return R});function K(S,h){for(var g=0;g<h.length;g++){var P=h[g];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}function N(S,h,g){return h&&K(S.prototype,h),g&&K(S,g),S}var O;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(O||(O={}));function F(S,h){var g=S.canSkipUntil,P=S.canSkipDateRanges,w=S.endSN,E=h!==void 0?h-w:0;return g&&E<g?P?O.v2:O.Yes:O.No}var I=function(){function S(g,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=g,this.part=P,this.skip=w}var h=S.prototype;return h.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},S}(),R=function(){function S(h){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=[h.url],this.attrs=h.attrs,this.bitrate=h.bitrate,h.details&&(this.details=h.details),this.id=h.id||0,this.name=h.name,this.width=h.width||0,this.height=h.height||0,this.audioCodec=h.audioCodec,this.videoCodec=h.videoCodec,this.unknownCodecs=h.unknownCodecs,this.codecSet=[h.videoCodec,h.audioCodec].filter(function(g){return g}).join(",").replace(/\.[^.,]+/g,"")}return N(S,[{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(g){var P=g%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),S}()},"./src/types/loader.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"PlaylistContextType",function(){return K}),L.d(G,"PlaylistLevelType",function(){return N});var K;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var N;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"ChunkMetadata",function(){return K});var K=function(F,I,R,S,h,g){S===void 0&&(S=0),h===void 0&&(h=-1),g===void 0&&(g=!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=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=F,this.sn=I,this.id=R,this.size=S,this.part=h,this.partial=g};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"AttrList",function(){return O});var K=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function F(R){typeof R=="string"&&(R=F.parseAttrList(R));for(var S in R)R.hasOwnProperty(S)&&(this[S]=R[S])}var I=F.prototype;return I.decimalInteger=function(S){var h=parseInt(this[S],10);return h>Number.MAX_SAFE_INTEGER?Infinity:h},I.hexadecimalInteger=function(S){if(this[S]){var h=(this[S]||"0x").slice(2);h=(h.length&1?"0":"")+h;for(var g=new Uint8Array(h.length/2),P=0;P<h.length/2;P++)g[P]=parseInt(h.slice(P*2,P*2+2),16);return g}else return null},I.hexadecimalIntegerAsNumber=function(S){var h=parseInt(this[S],16);return h>Number.MAX_SAFE_INTEGER?Infinity:h},I.decimalFloatingPoint=function(S){return parseFloat(this[S])},I.optionalFloat=function(S,h){var g=this[S];return g?parseFloat(g):h},I.enumeratedString=function(S){return this[S]},I.bool=function(S){return this[S]==="YES"},I.decimalResolution=function(S){var h=K.exec(this[S]);return h===null?void 0:{width:parseInt(h[1],10),height:parseInt(h[2],10)}},F.parseAttrList=function(S){var h,g={},P='"';for(N.lastIndex=0;(h=N.exec(S))!==null;){var w=h[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),g[h[1]]=w}return g},F}()},"./src/utils/binary-search.ts":function(Z,G,L){"use strict";L.r(G);var K={search:function(O,F){for(var I=0,R=O.length-1,S=null,h=null;I<=R;){S=(I+R)/2|0,h=O[S];var g=F(h);if(g>0)I=S+1;else if(g<0)R=S-1;else return h}return null}};G.default=K},"./src/utils/buffer-helper.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"BufferHelper",function(){return O});var K=L("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function F(){}return F.isBuffered=function(R,S){try{if(R){for(var h=F.getBuffered(R),g=0;g<h.length;g++)if(S>=h.start(g)&&S<=h.end(g))return!0}}catch(P){}return!1},F.bufferInfo=function(R,S,h){try{if(R){var g=F.getBuffered(R),P=[],w;for(w=0;w<g.length;w++)P.push({start:g.start(w),end:g.end(w)});return this.bufferedInfo(P,S,h)}}catch(E){}return{len:0,start:S,end:S,nextStart:void 0}},F.bufferedInfo=function(R,S,h){S=Math.max(0,S),R.sort(function(f,A){var T=f.start-A.start;return T||A.end-f.end});var g=[];if(h)for(var P=0;P<R.length;P++){var w=g.length;if(w){var E=g[w-1].end;R[P].start-E<h?R[P].end>E&&(g[w-1].end=R[P].end):g.push(R[P])}else g.push(R[P])}else g=R;for(var v=0,d,a=S,l=S,s=0;s<g.length;s++){var _=g[s].start,b=g[s].end;if(S+h>=_&&S<b)a=_,l=b,v=l-S;else if(S+h<_){d=_;break}}return{len:v,start:a||0,end:l||0,nextStart:d}},F.getBuffered=function(R){try{return R.buffered}catch(S){return K.logger.log("failed to get media.buffered",S),N}},F}()},"./src/utils/cea-608-parser.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"Row",function(){return l}),L.d(G,"CaptionScreen",function(){return s});var K=L("./src/utils/logger.ts"),N={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(c){var u=c;return N.hasOwnProperty(c)&&(u=N[c]),String.fromCharCode(u)},F=15,I=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},S={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},g={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(w||(w={}));var E=function(){function m(){this.time=null,this.verboseLevel=w.ERROR}var c=m.prototype;return c.log=function(o,x){this.verboseLevel>=o&&K.logger.log(this.time+" ["+o+"] "+x)},m}(),v=function(c){for(var u=[],o=0;o<c.length;o++)u.push(c[o].toString(16));return u},d=function(){function m(u,o,x,y,p){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=o||!1,this.italics=x||!1,this.background=y||"black",this.flash=p||!1}var c=m.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(o){for(var x=["foreground","underline","italics","background","flash"],y=0;y<x.length;y++){var p=x[y];o.hasOwnProperty(p)&&(this[p]=o[p])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},c.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),a=function(){function m(u,o,x,y,p,D){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(o,x,y,p,D)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(o,x){this.uchar=o,this.penState.copy(x)},c.setPenState=function(o){this.penState.copy(o)},c.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},c.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),l=function(){function m(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<I;o++)this.chars.push(new a);this.logger=u,this.pos=0,this.currPenState=new d}var c=m.prototype;return c.equals=function(o){for(var x=!0,y=0;y<I;y++)if(!this.chars[y].equals(o.chars[y])){x=!1;break}return x},c.copy=function(o){for(var x=0;x<I;x++)this.chars[x].copy(o.chars[x])},c.isEmpty=function(){for(var o=!0,x=0;x<I;x++)if(!this.chars[x].isEmpty()){o=!1;break}return o},c.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},c.moveCursor=function(o){var x=this.pos+o;if(o>1)for(var y=this.pos+1;y<x+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(o){o>=144&&this.backSpace();var x=O(o);if(this.pos>=I){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(o){var x;for(x=o;x<I;x++)this.chars[x].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var o=[],x=!0,y=0;y<I;y++){var p=this.chars[y].uchar;p!==" "&&(x=!1),o.push(p)}return x?"":o.join("")},c.setPenStyles=function(o){this.currPenState.setStyles(o);var x=this.chars[this.pos];x.setPenState(this.currPenState)},m}(),s=function(){function m(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<F;o++)this.rows.push(new l(u));this.logger=u,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var o=0;o<F;o++)this.rows[o].clear();this.currRow=F-1},c.equals=function(o){for(var x=!0,y=0;y<F;y++)if(!this.rows[y].equals(o.rows[y])){x=!1;break}return x},c.copy=function(o){for(var x=0;x<F;x++)this.rows[x].copy(o.rows[x])},c.isEmpty=function(){for(var o=!0,x=0;x<F;x++)if(!this.rows[x].isEmpty()){o=!1;break}return o},c.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},c.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},c.insertChar=function(o){var x=this.rows[this.currRow];x.insertChar(o)},c.setPen=function(o){var x=this.rows[this.currRow];x.setPenStyles(o)},c.moveCursor=function(o){var x=this.rows[this.currRow];x.moveCursor(o)},c.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var x=this.rows[this.currRow];x.setCursor(o)},c.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var x=o.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var y=0;y<F;y++)this.rows[y].clear();var p=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var U=D.rows[p].cueStartTime,B=this.logger.time;if(U&&B!==null&&U<B)for(var W=0;W<this.nrRollUpRows;W++)this.rows[x-this.nrRollUpRows+W+1].copy(D.rows[p+W])}}this.currRow=x;var M=this.rows[this.currRow];if(o.indent!==null){var k=o.indent,H=Math.max(k-1,0);M.setCursor(o.indent),o.color=M.chars[H].penState.foreground}var X={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(X)},c.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},c.setRollUpRows=function(o){this.nrRollUpRows=o},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(o,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(w.INFO,"Rolling up")},c.getDisplayText=function(o){o=o||!1;for(var x=[],y="",p=-1,D=0;D<F;D++){var U=this.rows[D].getTextString();U&&(p=D+1,o?x.push("Row "+p+": '"+U+"'"):x.push(U.trim()))}return x.length>0&&(o?y="["+x.join(" | ")+"]":y=x.join(`
|
|
`)),y},c.getTextAndFormat=function(){return this.rows},m}(),_=function(){function m(u,o,x){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new s(x),this.nonDisplayedMemory=new s(x),this.lastOutputScreen=new s(x),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=m.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(o){this.outputFilter=o},c.setPAC=function(o){this.writeScreen.setPAC(o)},c.setBkgData=function(o){this.writeScreen.setBkgData(o)},c.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},c.insertChars=function(o){for(var x=0;x<o.length;x++)this.writeScreen.insertChar(o[x]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(w.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(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},c.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},c.ccMIDROW=function(o){var x={flash:!1};if(x.underline=o%2===1,x.italics=o>=46,x.italics)x.foreground="white";else{var y=Math.floor(o/2)-16,p=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=p[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(o){o===void 0&&(o=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},m}(),b=function(){function m(u,o,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new E;this.channels=[null,new _(u,o,y),new _(u+1,x,y)],this.cmdHistory=T(),this.logger=y}var c=m.prototype;return c.getHandler=function(o){return this.channels[o].getHandler()},c.setHandler=function(o,x){this.channels[o].setHandler(x)},c.addData=function(o,x){var y,p,D,U=!1;this.logger.time=o;for(var B=0;B<x.length;B+=2){if(p=x[B]&127,D=x[B+1]&127,p===0&&D===0)continue;if(this.logger.log(w.DATA,"["+v([x[B],x[B+1]])+"] -> ("+v([p,D])+")"),y=this.parseCmd(p,D),y||(y=this.parseMidrow(p,D)),y||(y=this.parsePAC(p,D)),y||(y=this.parseBackgroundAttributes(p,D)),!y&&(U=this.parseChars(p,D),U)){var W=this.currentChannel;if(W&&W>0){var M=this.channels[W];M.insertChars(U)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!U&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+v([p,D])+" orig: "+v([x[B],x[B+1]]))}},c.parseCmd=function(o,x){var y=this.cmdHistory,p=(o===20||o===28||o===21||o===29)&&x>=32&&x<=47,D=(o===23||o===31)&&x>=33&&x<=35;if(!(p||D))return!1;if(A(o,x,y))return f(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+v([o,x])+") is dropped"),!0;var U=o===20||o===21||o===23?1:2,B=this.channels[U];return o===20||o===21||o===28||o===29?x===32?B.ccRCL():x===33?B.ccBS():x===34?B.ccAOF():x===35?B.ccAON():x===36?B.ccDER():x===37?B.ccRU(2):x===38?B.ccRU(3):x===39?B.ccRU(4):x===40?B.ccFON():x===41?B.ccRDC():x===42?B.ccTR():x===43?B.ccRTD():x===44?B.ccEDM():x===45?B.ccCR():x===46?B.ccENM():x===47&&B.ccEOC():B.ccTO(x-32),f(o,x,y),this.currentChannel=U,!0},c.parseMidrow=function(o,x){var y=0;if((o===17||o===25)&&x>=32&&x<=47){if(o===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var p=this.channels[y];return p?(p.ccMIDROW(x),this.logger.log(w.DEBUG,"MIDROW ("+v([o,x])+")"),!0):!1}return!1},c.parsePAC=function(o,x){var y,p=this.cmdHistory,D=(o>=17&&o<=23||o>=25&&o<=31)&&x>=64&&x<=127,U=(o===16||o===24)&&x>=64&&x<=95;if(!(D||U))return!1;if(A(o,x,p))return f(null,null,p),!0;var B=o<=23?1:2;x>=64&&x<=95?y=B===1?R[o]:h[o]:y=B===1?S[o]:g[o];var W=this.channels[B];return W?(W.setPAC(this.interpretPAC(y,x)),f(o,x,p),this.currentChannel=B,!0):!1},c.interpretPAC=function(o,x){var y,p={color:null,italics:!1,indent:null,underline:!1,row:o};return x>95?y=x-96:y=x-64,p.underline=(y&1)===1,y<=13?p.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(p.italics=!0,p.color="white"):p.indent=Math.floor((y-16)/2)*4,p},c.parseChars=function(o,x){var y,p=null,D=null;if(o>=25?(y=2,D=o-8):(y=1,D=o),D>=17&&D<=19){var U;D===17?U=x+80:D===18?U=x+112:U=x+144,this.logger.log(w.INFO,"Special char '"+O(U)+"' in channel "+y),p=[U]}else o>=32&&o<=127&&(p=x===0?[o]:[o,x]);if(p){var B=v(p);this.logger.log(w.DEBUG,"Char codes = "+B.join(",")),f(o,x,this.cmdHistory)}return p},c.parseBackgroundAttributes=function(o,x){var y=(o===16||o===24)&&x>=32&&x<=47,p=(o===23||o===31)&&x>=45&&x<=47;if(!(y||p))return!1;var D,U={};o===16||o===24?(D=Math.floor((x-32)/2),U.background=P[D],x%2===1&&(U.background=U.background+"_semi")):x===45?U.background="transparent":(U.foreground="black",x===47&&(U.underline=!0));var B=o<=23?1:2,W=this.channels[B];return W.setBkgData(U),f(o,x,this.cmdHistory),!0},c.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var x=this.channels[o];x&&x.reset()}this.cmdHistory=T()},c.cueSplitAtTime=function(o){for(var x=0;x<this.channels.length;x++){var y=this.channels[x];y&&y.cueSplitAtTime(o)}},m}();function f(m,c,u){u.a=m,u.b=c}function A(m,c,u){return u.a===m&&u.b===c}function T(){return{a:null,b:null}}G.default=b},"./src/utils/codecs.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"isCodecType",function(){return N}),L.d(G,"isCodecSupportedInMp4",function(){return O});var K={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 N(F,I){var R=K[I];return!!R&&R[F.slice(0,4)]===!0}function O(F,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/utils/vttparser.ts"),N=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),F=/\s/,I={newCue:function(S,h,g,P){for(var w=[],E,v,d,a,l,s=self.VTTCue||self.TextTrackCue,_=0;_<P.rows.length;_++)if(E=P.rows[_],d=!0,a=0,l="",!E.isEmpty()){for(var b=0;b<E.chars.length;b++)F.test(E.chars[b].uchar)&&d?a++:(l+=E.chars[b].uchar,d=!1);E.cueStartTime=h,h===g&&(g+=1e-4),a>=16?a--:a++;var f=Object(K.fixLineBreaks)(l.trim()),A=Object(N.generateCueId)(h,g,f);(!S||!S.cues||!S.cues.getCueById(A))&&(v=new s(h,g,f),v.id=A,v.line=_+1,v.align="left",v.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(v))}return S&&w.length&&(w.sort(function(T,m){return T.line==="auto"||m.line==="auto"?0:T.line>8&&m.line>8?m.line-T.line:T.line-m.line}),w.forEach(function(T){return Object(O.addCueToTrack)(S,T)})),w}};G.default=I},"./src/utils/discontinuities.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"findFirstFragWithCC",function(){return F}),L.d(G,"shouldAlignOnDiscontinuities",function(){return I}),L.d(G,"findDiscontinuousReferenceFrag",function(){return R}),L.d(G,"adjustSlidingStart",function(){return h}),L.d(G,"alignStream",function(){return g}),L.d(G,"alignPDT",function(){return w}),L.d(G,"alignFragmentByPDTDelta",function(){return E}),L.d(G,"alignMediaPlaylistByPDT",function(){return v});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/logger.ts"),O=L("./src/controller/level-helper.ts");function F(d,a){for(var l=null,s=0,_=d.length;s<_;s++){var b=d[s];if(b&&b.cc===a){l=b;break}}return l}function I(d,a,l){return!!(a.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function R(d,a){var l=d.fragments,s=a.fragments;if(!s.length||!l.length){N.logger.log("No fragments to align");return}var _=F(l,s[0].cc);if(!_||_&&!_.startPTS){N.logger.log("No frag in previous level to align on");return}return _}function S(d,a){if(d){var l=d.start+a;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function h(d,a){for(var l=a.fragments,s=0,_=l.length;s<_;s++)S(l[s],d);a.fragmentHint&&S(a.fragmentHint,d),a.alignedSliding=!0}function g(d,a,l){if(!a)return;P(d,l,a),!l.alignedSliding&&a.details&&w(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(O.adjustSliding)(a.details,l)}function P(d,a,l){if(I(d,l,a)){var s=R(l.details,a);s&&Object(K.isFiniteNumber)(s.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),h(s.start,a))}}function w(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,s=d.fragments[0].programDateTime,_=(s-l)/1e3+a.fragments[0].start;_&&Object(K.isFiniteNumber)(_)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(s-l)+"ms, sliding:"+_.toFixed(3)+" "+d.url+" "),h(_,d))}function E(d,a){var l=d.programDateTime;if(!l)return;var s=(l-a)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function v(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,s=a.fragments[0].start,_=l-s*1e3;d.fragments.forEach(function(b){E(b,_)}),d.fragmentHint&&E(d.fragmentHint,_),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/utils/ewma.ts"),N=function(){function O(I,R,S){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=S,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(I),this.fast_=new K.default(R)}var F=O.prototype;return F.update=function(R,S){var h=this.slow_,g=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new K.default(R,h.getEstimate(),h.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new K.default(S,g.getEstimate(),g.getTotalWeight()))},F.sample=function(R,S){R=Math.max(R,this.minDelayMs_);var h=8*S,g=R/1e3,P=h/g;this.fast_.sample(g,P),this.slow_.sample(g,P)},F.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},O}();G.default=N},"./src/utils/ewma.ts":function(Z,G,L){"use strict";L.r(G);var K=function(){function N(F,I,R){I===void 0&&(I=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=I,this.totalWeight_=R}var O=N.prototype;return O.sample=function(I,R){var S=Math.pow(this.alpha_,I);this.estimate_=R*(1-S)+S*this.estimate_,this.totalWeight_+=I},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},N}();G.default=K},"./src/utils/fetch-loader.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"fetchSupported",function(){return E});var K=L("./src/polyfills/number.ts"),N=L("./src/loader/load-stats.ts"),O=L("./src/demux/chunk-cache.ts");function F(s,_){s.prototype=Object.create(_.prototype),s.prototype.constructor=s,g(s,_)}function I(s){var _=typeof Map=="function"?new Map:void 0;return I=function(f){if(f===null||!h(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof _!="undefined"){if(_.has(f))return _.get(f);_.set(f,A)}function A(){return R(f,arguments,P(this).constructor)}return A.prototype=Object.create(f.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),g(A,f)},I(s)}function R(s,_,b){return S()?R=Reflect.construct:R=function(A,T,m){var c=[null];c.push.apply(c,T);var u=Function.bind.apply(A,c),o=new u;return m&&g(o,m.prototype),o},R.apply(null,arguments)}function S(){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(s){return!1}}function h(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function g(s,_){return g=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},g(s,_)}function P(s){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(b){return b.__proto__||Object.getPrototypeOf(b)},P(s)}function w(){return w=Object.assign||function(s){for(var _=1;_<arguments.length;_++){var b=arguments[_];for(var f in b)Object.prototype.hasOwnProperty.call(b,f)&&(s[f]=b[f])}return s},w.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var v=function(){function s(b){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=b.fetchSetup||a,this.controller=new self.AbortController,this.stats=new N.LoadStats}var _=s.prototype;return _.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},_.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},_.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},_.load=function(f,A,T){var m=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=d(f,this.controller.signal),o=T.onProgress,x=f.responseType==="arraybuffer",y=x?"byteLength":"length";this.context=f,this.config=A,this.callbacks=T,this.request=this.fetchSetup(f,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),T.onTimeout(c,f,m.response)},A.timeout),self.fetch(this.request).then(function(p){if(m.response=m.loader=p,!p.ok){var D=p.status,U=p.statusText;throw new l(U||"fetch, bad network response",D,p)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(p.headers.get("Content-Length")||"0"),o&&Object(K.isFiniteNumber)(A.highWaterMark)?m.loadProgressively(p,c,f,A.highWaterMark,o):x?p.arrayBuffer():p.text()}).then(function(p){var D=m.response;self.clearTimeout(m.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=p[y];var U={url:D.url,data:p};o&&!Object(K.isFiniteNumber)(A.highWaterMark)&&o(c,f,p,D),T.onSuccess(U,c,f,D)}).catch(function(p){if(self.clearTimeout(m.requestTimeout),c.aborted)return;var D=p.code||0;T.onError({code:D,text:p.message},f,p.details)})},_.getCacheAge=function(){var f=null;if(this.response){var A=this.response.headers.get("age");f=A?parseFloat(A):null}return f},_.loadProgressively=function(f,A,T,m,c){m===void 0&&(m=0);var u=new O.default,o=f.body.getReader(),x=function y(){return o.read().then(function(p){if(p.done)return u.dataLength&&c(A,T,u.flush(),f),Promise.resolve(new ArrayBuffer(0));var D=p.value,U=D.length;return A.loaded+=U,U<m||u.dataLength?(u.push(D),u.dataLength>=m&&c(A,T,u.flush(),f)):c(A,T,D,f),y()}).catch(function(){return Promise.reject()})};return x()},s}();function d(s,_){var b={method:"GET",mode:"cors",credentials:"same-origin",signal:_,headers:new self.Headers(w({},s.headers))};return s.rangeEnd&&b.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),b}function a(s,_){return new self.Request(s.url,_)}var l=function(s){F(_,s);function _(b,f,A){var T;return T=s.call(this,b)||this,T.code=void 0,T.details=void 0,T.code=f,T.details=A,T}return _}(I(Error));G.default=v},"./src/utils/imsc1-ttml-parser.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"IMSC1_CODEC",function(){return h}),L.d(G,"parseIMSC1",function(){return E});var K=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/vttparser.ts"),O=L("./src/utils/vttcue.ts"),F=L("./src/demux/id3.ts"),I=L("./src/utils/timescale-conversion.ts"),R=L("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(m[o]=u[o])}return m},S.apply(this,arguments)}var h="stpp.ttml.im1t",g=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(m,c,u,o,x){var y=Object(K.findBox)(new Uint8Array(m),["mdat"]);if(y.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var p=y[0],D=Object(F.utf8ArrayToStr)(new Uint8Array(m,p.start,p.end-p.start)),U=Object(I.toTimescaleFromScale)(c,1,u);try{o(v(D,U))}catch(B){x(B)}}function v(m,c){var u=new DOMParser,o=u.parseFromString(m,"text/xml"),x=o.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},p=Object.keys(y).reduce(function(M,k){return M[k]=x.getAttribute("ttp:"+k)||y[k],M},{}),D=x.getAttribute("xml:space")!=="preserve",U=a(d(x,"styling","style")),B=a(d(x,"layout","region")),W=d(x,"body","[begin]");return[].map.call(W,function(M){var k=l(M,D);if(!k||!M.hasAttribute("begin"))return null;var H=f(M.getAttribute("begin"),p),X=f(M.getAttribute("dur"),p),ee=f(M.getAttribute("end"),p);if(H===null)throw b(M);if(ee===null){if(X===null)throw b(M);ee=H+X}var ae=new O.default(H-c,ee-c,k);ae.id=Object(R.generateCueId)(ae.startTime,ae.endTime,ae.text);var ye=B[M.getAttribute("region")],pe=U[M.getAttribute("style")];ae.position=10,ae.size=80;var he=s(ye,pe),fe=he.textAlign;if(fe){var de=w[fe];de&&(ae.lineAlign=de),ae.align=fe}return S(ae,he),ae}).filter(function(M){return M!==null})}function d(m,c,u){var o=m.getElementsByTagName(c)[0];return o?[].slice.call(o.querySelectorAll(u)):[]}function a(m){return m.reduce(function(c,u){var o=u.getAttribute("xml:id");return o&&(c[o]=u),c},{})}function l(m,c){return[].slice.call(m.childNodes).reduce(function(u,o,x){var y;return o.nodeName==="br"&&x?u+`
|
|
`:(y=o.childNodes)!==null&&y!==void 0&&y.length?l(o,c):c?u+o.textContent.trim().replace(/\s+/g," "):u+o.textContent},"")}function s(m,c){var u="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(x,y){var p=_(c,u,y)||_(m,u,y);return p&&(x[y]=p),x},{})}function _(m,c,u){return m.hasAttributeNS(c,u)?m.getAttributeNS(c,u):null}function b(m){return new Error("Could not parse ttml timestamp "+m)}function f(m,c){if(!m)return null;var u=Object(N.parseTimeStamp)(m);return u===null&&(g.test(m)?u=A(m,c):P.test(m)&&(u=T(m,c))),u}function A(m,c){var u=g.exec(m),o=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+o/c.frameRate}function T(m,c){var u=P.exec(m),o=Number(u[1]),x=u[2];switch(x){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/c.frameRate;case"t":return o/c.tickRate}return o}},"./src/utils/logger.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"enableLogs",function(){return R}),L.d(G,"logger",function(){return S});var K=function(){},N={trace:K,debug:K,log:K,warn:K,info:K,error:K},O=N;function F(h){var g=self.console[h];return g?g.bind(self.console,"["+h+"] >"):K}function I(h){for(var g=arguments.length,P=new Array(g>1?g-1:0),w=1;w<g;w++)P[w-1]=arguments[w];P.forEach(function(E){O[E]=h[E]?h[E].bind(h):F(E)})}function R(h){if(self.console&&h===!0||typeof h=="object"){I(h,"debug","log","info","warn","error");try{O.log()}catch(g){O=N}}else O=N}var S=O},"./src/utils/mediakeys-helper.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"KeySystems",function(){return K}),L.d(G,"requestMediaKeySystemAccess",function(){return N});var K;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(K||(K={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"bin2str",function(){return I}),L.d(G,"readUint16",function(){return R}),L.d(G,"readUint32",function(){return S}),L.d(G,"writeUint32",function(){return h}),L.d(G,"findBox",function(){return g}),L.d(G,"parseSegmentIndex",function(){return P}),L.d(G,"parseInitSegment",function(){return w}),L.d(G,"getStartDTS",function(){return E}),L.d(G,"getDuration",function(){return v}),L.d(G,"computeRawDurationFromSamples",function(){return d}),L.d(G,"offsetStartDTS",function(){return a}),L.d(G,"segmentValidRange",function(){return l}),L.d(G,"appendUint8Array",function(){return s});var K=L("./src/utils/typed-array.ts"),N=L("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,F=[].push;function I(_){return String.fromCharCode.apply(null,_)}function R(_,b){"data"in _&&(b+=_.start,_=_.data);var f=_[b]<<8|_[b+1];return f<0?65536+f:f}function S(_,b){"data"in _&&(b+=_.start,_=_.data);var f=_[b]<<24|_[b+1]<<16|_[b+2]<<8|_[b+3];return f<0?4294967296+f:f}function h(_,b,f){"data"in _&&(b+=_.start,_=_.data),_[b]=f>>24,_[b+1]=f>>16&255,_[b+2]=f>>8&255,_[b+3]=f&255}function g(_,b){var f=[];if(!b.length)return f;var A,T,m;"data"in _?(A=_.data,T=_.start,m=_.end):(A=_,T=0,m=A.byteLength);for(var c=T;c<m;){var u=S(A,c),o=I(A.subarray(c+4,c+8)),x=u>1?c+u:m;if(o===b[0])if(b.length===1)f.push({data:A,start:c+8,end:x});else{var y=g({data:A,start:c+8,end:x},b.slice(1));y.length&&F.apply(f,y)}c=x}return f}function P(_){var b=g(_,["moov"]),f=b[0],A=f?f.end:null,T=g(_,["sidx"]);if(!T||!T[0])return null;var m=[],c=T[0],u=c.data[0],o=u===0?8:16,x=S(c,o);o+=4;var y=0,p=0;u===0?o+=8:o+=16,o+=2;var D=c.end+p,U=R(c,o);o+=2;for(var B=0;B<U;B++){var W=o,M=S(c,W);W+=4;var k=M&2147483647,H=(M&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=S(c,W);W+=4,m.push({referenceSize:k,subsegmentDuration:X,info:{duration:X/x,start:D,end:D+k-1}}),D+=k,W+=4,o=W}return{earliestPresentationTime:y,timescale:x,version:u,referencesCount:U,references:m,moovEndOffset:A}}function w(_){for(var b=[],f=g(_,["moov","trak"]),A=0;A<f.length;A++){var T=f[A],m=g(T,["tkhd"])[0];if(m){var c=m.data[m.start],u=c===0?12:20,o=S(m,u),x=g(T,["mdia","mdhd"])[0];if(x){c=x.data[x.start],u=c===0?12:20;var y=S(x,u),p=g(T,["mdia","hdlr"])[0];if(p){var D=I(p.data.subarray(p.start+8,p.start+12)),U={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[D];if(U){var B=g(T,["mdia","minf","stbl","stsd"])[0],W=void 0;B&&(W=I(B.data.subarray(B.start+12,B.start+16))),b[o]={timescale:y,type:U},b[U]={timescale:y,id:o,codec:W}}}}}}var M=g(_,["moov","mvex","trex"]);return M.forEach(function(k){var H=S(k,4),X=b[H];X&&(X.default={duration:S(k,12),flags:S(k,20)})}),b}function E(_,b){return g(b,["moof","traf"]).reduce(function(f,A){var T=g(A,["tfdt"])[0],m=T.data[T.start],c=g(A,["tfhd"]).reduce(function(u,o){var x=S(o,4),y=_[x];if(y){var p=S(T,4);m===1&&(p*=Math.pow(2,32),p+=S(T,8));var D=y.timescale||9e4,U=p/D;if(isFinite(U)&&(u===null||U<u))return U}return u},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(_,b){for(var f=0,A=0,T=0,m=g(_,["moof","traf"]),c=0;c<m.length;c++){var u=m[c],o=g(u,["tfhd"])[0],x=S(o,4),y=b[x];if(!y)continue;var p=y.default,D=S(o,0)|(p==null?void 0:p.flags),U=p==null?void 0:p.duration;D&8&&(D&2?U=S(o,12):U=S(o,8));for(var B=y.timescale||9e4,W=g(u,["trun"]),M=0;M<W.length;M++){if(U){var k=S(W[M],4);f=U*k}else f=d(W[M]);y.type===N.ElementaryStreamTypes.VIDEO?A+=f/B:y.type===N.ElementaryStreamTypes.AUDIO&&(T+=f/B)}}if(A===0&&T===0){var H=P(_);if(H!=null&&H.references)return H.references.reduce(function(X,ee){return X+ee.info.duration||0},0)}return A||T}function d(_){var b=S(_,0),f=8;b&1&&(f+=4),b&4&&(f+=4);for(var A=0,T=S(_,4),m=0;m<T;m++){if(b&256){var c=S(_,f);A+=c,f+=4}b&512&&(f+=4),b&1024&&(f+=4),b&2048&&(f+=4)}return A}function a(_,b,f){g(b,["moof","traf"]).forEach(function(A){g(A,["tfhd"]).forEach(function(T){var m=S(T,4),c=_[m];if(!c)return;var u=c.timescale||9e4;g(A,["tfdt"]).forEach(function(o){var x=o.data[o.start],y=S(o,4);if(x===0)h(o,4,y-f*u);else{y*=Math.pow(2,32),y+=S(o,8),y-=f*u,y=Math.max(y,0);var p=Math.floor(y/(O+1)),D=Math.floor(y%(O+1));h(o,4,p),h(o,8,D)}})})})}function l(_){var b={valid:null,remainder:null},f=g(_,["moof"]);if(f){if(f.length<2)return b.remainder=_,b}else return b;var A=f[f.length-1];return b.valid=Object(K.sliceUint8)(_,0,A.start-8),b.remainder=Object(K.sliceUint8)(_,A.start-8),b}function s(_,b){var f=new Uint8Array(_.length+b.length);return f.set(_),f.set(b,_.length),f}},"./src/utils/output-filter.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"default",function(){return K});var K=function(){function N(F,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=I}var O=N.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(I,R,S){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=R,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"sendAddTrackEvent",function(){return N}),L.d(G,"addCueToTrack",function(){return O}),L.d(G,"clearCurrentCues",function(){return F}),L.d(G,"removeCuesInRange",function(){return I}),L.d(G,"getCuesInRange",function(){return S});var K=L("./src/utils/logger.ts");function N(h,g){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=h,g.dispatchEvent(P)}function O(h,g){var P=h.mode;if(P==="disabled"&&(h.mode="hidden"),h.cues&&!h.cues.getCueById(g.id))try{if(h.addCue(g),!h.cues.getCueById(g.id))throw new Error("addCue is failed for: "+g)}catch(E){K.logger.debug("[texttrack-utils]: "+E);var w=new self.TextTrackCue(g.startTime,g.endTime,g.text);w.id=g.id,h.addCue(w)}P==="disabled"&&(h.mode=P)}function F(h){var g=h.mode;if(g==="disabled"&&(h.mode="hidden"),h.cues)for(var P=h.cues.length;P--;)h.removeCue(h.cues[P]);g==="disabled"&&(h.mode=g)}function I(h,g,P){var w=h.mode;if(w==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0)for(var E=S(h.cues,g,P),v=0;v<E.length;v++)h.removeCue(E[v]);w==="disabled"&&(h.mode=w)}function R(h,g){if(g<h[0].startTime)return 0;var P=h.length-1;if(g>h[P].endTime)return-1;for(var w=0,E=P;w<=E;){var v=Math.floor((E+w)/2);if(g<h[v].startTime)E=v-1;else if(g>h[v].startTime&&w<P)w=v+1;else return v}return h[w].startTime-g<g-h[E].startTime?w:E}function S(h,g,P){var w=[],E=R(h,g);if(E>-1)for(var v=E,d=h.length;v<d;v++){var a=h[v];if(a.startTime>=g&&a.endTime<=P)w.push(a);else if(a.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(Z,G,L){"use strict";L.r(G);var K={toString:function(O){for(var F="",I=O.length,R=0;R<I;R++)F+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return F}};G.default=K},"./src/utils/timescale-conversion.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"toTimescaleFromBase",function(){return N}),L.d(G,"toTimescaleFromScale",function(){return O}),L.d(G,"toMsFromMpegTsClock",function(){return F}),L.d(G,"toMpegTsClockFromTimescale",function(){return I});var K=9e4;function N(R,S,h,g){h===void 0&&(h=1),g===void 0&&(g=!1);var P=R*S*h;return g?Math.round(P):P}function O(R,S,h,g){return h===void 0&&(h=1),g===void 0&&(g=!1),N(R,S,1/h,g)}function F(R,S){return S===void 0&&(S=!1),N(R,1e3,1/K,S)}function I(R,S){return S===void 0&&(S=1),N(R,K,1/S)}},"./src/utils/typed-array.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"sliceUint8",function(){return K});function K(N,O,F){return Uint8Array.prototype.slice?N.slice(O,F):new Uint8Array(Array.prototype.slice.call(N,O,F))}},"./src/utils/vttcue.ts":function(Z,G,L){"use strict";L.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],N=["start","middle","end","left","right"];function O(h,g){if(typeof g!="string")return!1;if(!Array.isArray(h))return!1;var P=g.toLowerCase();return~h.indexOf(P)?P:!1}function F(h){return O(K,h)}function I(h){return O(N,h)}function R(h){for(var g=arguments.length,P=new Array(g>1?g-1:0),w=1;w<g;w++)P[w-1]=arguments[w];for(var E=1;E<arguments.length;E++){var v=arguments[E];for(var d in v)h[d]=v[d]}return h}function S(h,g,P){var w=this,E={enumerable:!0};w.hasBeenReset=!1;var v="",d=!1,a=h,l=g,s=P,_=null,b="",f=!0,A="auto",T="start",m=50,c="middle",u=50,o="middle";Object.defineProperty(w,"id",R({},E,{get:function(){return v},set:function(y){v=""+y}})),Object.defineProperty(w,"pauseOnExit",R({},E,{get:function(){return d},set:function(y){d=!!y}})),Object.defineProperty(w,"startTime",R({},E,{get:function(){return a},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");a=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",R({},E,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",R({},E,{get:function(){return s},set:function(y){s=""+y,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",R({},E,{get:function(){return _},set:function(y){_=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",R({},E,{get:function(){return b},set:function(y){var p=F(y);if(p===!1)throw new SyntaxError("An invalid or illegal string was specified.");b=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",R({},E,{get:function(){return f},set:function(y){f=!!y,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",R({},E,{get:function(){return A},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",R({},E,{get:function(){return T},set:function(y){var p=I(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");T=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",R({},E,{get:function(){return m},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");m=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",R({},E,{get:function(){return c},set:function(y){var p=I(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");c=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",R({},E,{get:function(){return u},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");u=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",R({},E,{get:function(){return o},set:function(y){var p=I(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");o=p,this.hasBeenReset=!0}})),w.displayState=void 0}return S.prototype.getCueAsHTML=function(){var h=self.WebVTT;return h.convertCueToDOMTree(self,this.text)},S}()},"./src/utils/vttparser.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"parseTimeStamp",function(){return O}),L.d(G,"fixLineBreaks",function(){return g}),L.d(G,"VTTParser",function(){return P});var K=L("./src/utils/vttcue.ts"),N=function(){function w(){}var E=w.prototype;return E.decode=function(d,a){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},w}();function O(w){function E(d,a,l,s){return(d|0)*3600+(a|0)*60+(l|0)+parseFloat(s||0)}var v=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?E(v[2],v[3],0,v[4]):E(v[1],v[2],v[3],v[4]):null}var F=function(){function w(){this.values=Object.create(null)}var E=w.prototype;return E.set=function(d,a){!this.get(d)&&a!==""&&(this.values[d]=a)},E.get=function(d,a,l){return l?this.has(d)?this.values[d]:a[l]:this.has(d)?this.values[d]:a},E.has=function(d){return d in this.values},E.alt=function(d,a,l){for(var s=0;s<l.length;++s)if(a===l[s]){this.set(d,a);break}},E.integer=function(d,a){/^-?\d+$/.test(a)&&this.set(d,parseInt(a,10))},E.percent=function(d,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},w}();function I(w,E,v,d){var a=d?w.split(d):[w];for(var l in a){if(typeof a[l]!="string")continue;var s=a[l].split(v);if(s.length!==2)continue;var _=s[0],b=s[1];E(_,b)}}var R=new K.default(0,0,""),S=R.align==="middle"?"middle":"center";function h(w,E,v){var d=w;function a(){var _=O(w);if(_===null)throw new Error("Malformed timestamp: "+d);return w=w.replace(/^[^\sa-zA-Z-]+/,""),_}function l(_,b){var f=new F;I(_,function(m,c){var u;switch(m){case"region":for(var o=v.length-1;o>=0;o--)if(v[o].id===c){f.set(m,v[o].region);break}break;case"vertical":f.alt(m,c,["rl","lr"]);break;case"line":u=c.split(","),f.integer(m,u[0]),f.percent(m,u[0])&&f.set("snapToLines",!1),f.alt(m,u[0],["auto"]),u.length===2&&f.alt("lineAlign",u[1],["start",S,"end"]);break;case"position":u=c.split(","),f.percent(m,u[0]),u.length===2&&f.alt("positionAlign",u[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":f.percent(m,c);break;case"align":f.alt(m,c,["start",S,"end","left","right"]);break}},/:/,/\s/),b.region=f.get("region",null),b.vertical=f.get("vertical","");var A=f.get("line","auto");A==="auto"&&R.line===-1&&(A=-1),b.line=A,b.lineAlign=f.get("lineAlign","start"),b.snapToLines=f.get("snapToLines",!0),b.size=f.get("size",100),b.align=f.get("align",S);var T=f.get("position","auto");T==="auto"&&R.position===50&&(T=b.align==="start"||b.align==="left"?0:b.align==="end"||b.align==="right"?100:50),b.position=T}function s(){w=w.replace(/^\s+/,"")}if(s(),E.startTime=a(),s(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);w=w.substr(3),s(),E.endTime=a(),s(),l(w,E)}function g(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var E=w.prototype;return E.parse=function(d){var a=this;d&&(a.buffer+=a.decoder.decode(d,{stream:!0}));function l(){var T=a.buffer,m=0;for(T=g(T);m<T.length&&T[m]!=="\r"&&T[m]!==`
|
|
`;)++m;var c=T.substr(0,m);return T[m]==="\r"&&++m,T[m]===`
|
|
`&&++m,a.buffer=T.substr(m),c}function s(T){I(T,function(m,c){},/:/)}try{var _="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;_=l();var b=_.match(/^()?WEBVTT([ \t].*)?$/);if(!b||!b[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var f=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;f?f=!1:_=l();switch(a.state){case"HEADER":/:/.test(_)?s(_):_||(a.state="ID");continue;case"NOTE":_||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(_)){a.state="NOTE";break}if(!_)continue;if(a.cue=new K.default(0,0,""),a.state="CUE",_.indexOf("-->")===-1){a.cue.id=_;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{h(_,a.cue,a.regionList)}catch(T){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var A=_.indexOf("-->")!==-1;if(!_||A&&(f=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=_}continue;case"BADCUE":_||(a.state="ID")}}}catch(T){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){d.onparsingerror&&d.onparsingerror(a)}return d.onflush&&d.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(Z,G,L){"use strict";L.r(G),L.d(G,"generateCueId",function(){return P}),L.d(G,"parseWebVTT",function(){return E});var K=L("./src/polyfills/number.ts"),N=L("./src/utils/vttparser.ts"),O=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),I=L("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,S=function(d,a,l){return l===void 0&&(l=0),d.substr(l,a.length)===a},h=function(d){var a=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),_=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(a)||!Object(K.isFiniteNumber)(l)||!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(_))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return a+=1e3*l,a+=60*1e3*s,a+=60*60*1e3*_,a},g=function(d){for(var a=5381,l=d.length;l;)a=a*33^d.charCodeAt(--l);return(a>>>0).toString()};function P(v,d,a){return g(v.toString())+g(d.toString())+g(a)}var w=function(d,a,l){var s=d[a],_=d[s.prevCC];if(!_||!_.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(b=_)!==null&&b!==void 0&&b.new;){var b;d.ccOffset+=s.start-_.start,s.new=!1,s=_,_=d[s.prevCC]}d.presentationOffset=l};function E(v,d,a,l,s,_,b,f){var A=new N.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(R,`
|
|
`).split(`
|
|
`),m=[],c=Object(F.toMpegTsClockFromTimescale)(d,a),u="00:00.000",o=0,x=0,y,p=!0,D=!1;A.oncue=function(U){var B=l[s],W=l.ccOffset,M=(o-c)/9e4;if(B!=null&&B.new&&(x!==void 0?W=l.ccOffset=B.start:w(l,s,M)),M&&(W=M-l.presentationOffset),D){var k=U.endTime-U.startTime,H=Object(I.normalizePts)((U.startTime+W-x)*9e4,_*9e4)/9e4;U.startTime=H,U.endTime=H+k}var X=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(X)),U.id||(U.id=P(U.startTime,U.endTime,X)),U.endTime>0&&m.push(U)},A.onparsingerror=function(U){y=U},A.onflush=function(){if(y){f(y);return}b(m)},T.forEach(function(U){if(p)if(S(U,"X-TIMESTAMP-MAP=")){p=!1,D=!0,U.substr(16).split(",").forEach(function(B){S(B,"LOCAL:")?u=B.substr(6):S(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{x=h(u)/1e3}catch(B){D=!1,y=B}return}else U===""&&(p=!1);A.parse(U+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(Z,G,L){"use strict";L.r(G);var K=L("./src/utils/logger.ts"),N=L("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,F=function(){function I(S){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=S?S.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var R=I.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var h=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),h&&(h.onreadystatechange=null,h.onprogress=null,h.readyState!==4&&(this.stats.aborted=!0,h.abort()))},R.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(h,g,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=h,this.config=g,this.callbacks=P,this.retryDelay=g.retryDelay,this.loadInternal()},R.loadInternal=function(){var h=this.config,g=this.context;if(!h)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var E=this.xhrSetup;try{if(E)try{E(P,g.url)}catch(a){P.open("GET",g.url,!0),E(P,g.url)}P.readyState||P.open("GET",g.url,!0);var v=this.context.headers;if(v)for(var d in v)P.setRequestHeader(d,v[d])}catch(a){this.callbacks.onError({code:P.status,text:a.message},g,P);return}g.rangeEnd&&P.setRequestHeader("Range","bytes="+g.rangeStart+"-"+(g.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=g.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),h.timeout),P.send()},R.readystatechange=function(){var h=this.context,g=this.loader,P=this.stats;if(!h||!g)return;var w=g.readyState,E=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){g.onreadystatechange=null,g.onprogress=null;var v=g.status;if(v>=200&&v<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var d,a;if(h.responseType==="arraybuffer"?(d=g.response,a=d.byteLength):(d=g.responseText,a=d.length),P.loaded=P.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(P,h,d,g),!this.callbacks)return;var s={url:g.responseURL,data:d};this.callbacks.onSuccess(s,P,h,g)}else P.retry>=E.maxRetry||v>=400&&v<499?(K.logger.error(v+" while loading "+h.url),this.callbacks.onError({code:v,text:g.statusText},h,g)):(K.logger.warn(v+" while loading "+h.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,E.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},R.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var h=this.callbacks;h&&(this.abortInternal(),h.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(h){var g=this.stats;g.loaded=h.loaded,h.lengthComputable&&(g.total=h.total)},R.getCacheAge=function(){var h=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var g=this.loader.getResponseHeader("age");h=g?parseFloat(g):null}return h},I}();G.default=F}}).default})},vHTk:function(et,We,J){et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(et,We){function J(){this.buffer=new Array,this.length=0}J.prototype={get:function(Z){var G=Math.floor(Z/8);return(this.buffer[G]>>>7-Z%8&1)==1},put:function(Z,G){for(var L=0;L<G;L++)this.putBit((Z>>>G-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(Z){var G=Math.floor(this.length/8);this.buffer.length<=G&&this.buffer.push(0),Z&&(this.buffer[G]|=128>>>this.length%8),this.length++}},et.exports=J},wzkS:function(et,We,J){"use strict";J.d(We,"c",function(){return N}),J.d(We,"b",function(){return O}),J.d(We,"d",function(){return F}),J.d(We,"a",function(){return R}),J.d(We,"e",function(){return S});var Z=J("9og8"),G=J("WmNS"),L=J.n(G),K=J("ErOA");function N(h){return Object(K.c)("libraries/".concat(h,".json"))}function O(){return Object(K.c)("library_tags.json")}function F(h){return I.apply(this,arguments)}function I(){return I=Object(Z.a)(L.a.mark(function h(g){var P;return L.a.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,Object(K.b)("attachments/".concat(g,".json"));case 2:return P=E.sent,E.abrupt("return",P.status===0);case 4:case"end":return E.stop()}},h)})),I.apply(this,arguments)}function R(h){return Object(K.f)("libraries.json",h)}function S(h,g){return Object(K.g)("libraries/".concat(h,".json"),g)}},y5JW:function(et,We,J){"use strict";J.d(We,"c",function(){return v}),J.d(We,"a",function(){return d});var Z=J("DZo9"),G=J("8z0m"),L=J("+L6B"),K=J("2/Rp"),N=J("9og8"),O=J("miYZ"),F=J("tsqr"),I=J("k1fw"),R=J("oBTY"),S=J("WmNS"),h=J.n(S),g=J("cDcd"),P=J.n(g),w=J("m3rI"),E=J("wzkS"),v="\u3000\u3000";function d(a){var l=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var s=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,s)).toFixed(1)+" "+l[s]}We.b=function(a){var l=a.value,s=l===void 0?[]:l,_=a.action,b=a.onChange,f=a.className,A=a.maxSize,T=A===void 0?150:A,m=a.title,c=m===void 0?"\u6587\u4EF6\u4E0A\u4F20":m,u=a.accept,o=u===void 0?null:u,x={multiple:!1,fileList:s,accept:o,withCredentials:!0,beforeUpload:function(D){var U=D.size/1024/1024;return!0},action:"".concat(w.a.API_SERVER,"/api/attachments.json"),onChange:function(D){var U,B,W=Object(R.a)(D.fileList);if(W=W.map(function(H){return H.name.indexOf(v)===-1&&(H.name="".concat(H.name).concat(v).concat(d(H.size))),Object(I.a)({},H)}),D.file.status==="done"&&((U=D.file)===null||U===void 0||((B=U.response)===null||B===void 0)?void 0:B.status)===-1){var M,k;F.b.error((M=D.file)===null||M===void 0||((k=M.response)===null||k===void 0)?void 0:k.message),b([]);return}b(W)},onRemove:function(){var p=Object(N.a)(h.a.mark(function U(B){var W,M,k;return h.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(W=B.size/1024/1024,!(B.status==="uploading")){X.next=3;break}return X.abrupt("return",!0);case 3:if(W<T){X.next=7;break}return X.abrupt("return",!0);case 7:if(M=B.response?B.response.id:B.uid,!M){X.next=15;break}return X.next=11,Object(E.d)(B.response?B.response.id:B.id);case 11:return k=X.sent,X.abrupt("return",k);case 15:return X.abrupt("return",!0);case 16:case"end":return X.stop()}},U)}));function D(U){return p.apply(this,arguments)}return D}()};function y(p){p.preventDefault(),p.stopPropagation()}return P.a.createElement("div",{className:"single-upload ".concat(f||"")},P.a.createElement(G.a,x,P.a.createElement(K.a,{type:"primary",title:s.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:s.length>0,ghost:!0},c),P.a.createElement("span",{onClick:y,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",T,"M)"," ")))}}}]);
|