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

143 lines
754 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[163,5,6,7],{"+NIl":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(V,A){"use strict";function G(C,T){C.cmdState.push(T)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var T=C.cmdState.pop();T&&T.closeBracket()}function B(C){for(var T=C.cmdState,g=T.length-1;g>=0;g--){var d=T[g];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(C,T,g){return function(){this.name=C,this.bracketNo=0,this.style=T,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=U("importmodule","tag",["string","builtin"]),k.documentclass=U("documentclass","tag",["","atom"]),k.usepackage=U("usepackage","tag",["atom"]),k.begin=U("begin","tag",["atom"]),k.end=U("end","tag",["atom"]),k.label=U("label","tag",["atom"]),k.ref=U("ref","tag",["atom"]),k.eqref=U("eqref","tag",["atom"]),k.cite=U("cite","tag",["atom"]),k.bibitem=U("bibitem","tag",["atom"]),k.Bibitem=U("Bibitem","tag",["atom"]),k.RBibitem=U("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(C,T){C.f=T}function y(C,T){var g;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return g=k.hasOwnProperty(d)?k[d]:k.DEFAULT,g=new g,G(T,g),L(T,O),g.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return L(T,function(u,s){return x(u,s,"\\]")}),"keyword";if(C.match("\\("))return L(T,function(u,s){return x(u,s,"\\)")}),"keyword";if(C.match("$$"))return L(T,function(u,s){return x(u,s,"$$")}),"keyword";if(C.match("$"))return L(T,function(u,s){return x(u,s,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(g=I(T),g)g.closeBracket(o),L(T,O);else return"error";return"bracket"}else return o=="{"||o=="["?(g=k.DEFAULT,g=new g,G(T,g),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),g=B(T),g.name=="begin"&&(g.argument=C.current()),g.styleIdentifier())}function x(C,T,g){if(C.eatSpace())return null;if(g&&C.match(g))return L(T,y),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function O(C,T){var g=C.peek(),d;return g=="{"||g=="["?(d=I(T),d.openBracket(g),C.eat(g),L(T,y),"bracket"):/[ \t\r]/.test(g)?(C.eat(g),null):(L(T,y),R(T),y(C,T))}return{startState:function(){var C=A.inMathMode?function(T,g){return x(T,g)}:y;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,T){return T.f(C,T)},blankLine:function(C){C.f=y,C.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(st,ze,q){},"19Vz":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,k,L){var y=L&&L!=re.Init;if(k&&!y)U.on("blur",I),U.on("change",R),U.on("swapDoc",R),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){G(U)}),R(U);else if(!k&&y){U.off("blur",I),U.off("change",R),U.off("swapDoc",R),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),V(U);var x=U.getWrapperElement();x.className=x.className.replace(" CodeMirror-empty","")}k&&!U.hasFocus()&&I(U)});function V(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function A(U){V(U);var k=U.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=U.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var L=U.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),k.appendChild(L),U.display.lineSpace.insertBefore(k,U.display.lineSpace.firstChild)}function G(U){setTimeout(function(){var k=!1,L=U.getInputField();L.nodeName=="TEXTAREA"?k=!L.value:U.lineCount()==1&&(k=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),k?A(U):V(U)},20)}function I(U){B(U)&&A(U)}function R(U){var k=U.getWrapperElement(),L=B(U);k.className=k.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?A(U):V(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(G,I){var R=G.indentUnit,B={},U=I.htmlMode?V:A;for(var k in U)B[k]=U[k];for(var k in I)B[k]=I[k];var L,y;function x(a,v){function m(F){return v.tokenize=F,F(a,v)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(T("atom","]]>")):null:a.match("--")?m(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(g(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=T("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",v.tokenize=O,"tag bracket");if(E=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}x.isInText=!0;function O(a,v){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return v.tokenize=x,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){v.tokenize=x,v.state=s,v.tagName=v.tagStart=null;var E=v.tokenize(a,v);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(v.tokenize=C(m),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=O;break}return"string"};return v.isInAttribute=!0,v}function T(a,v){return function(m,E){for(;!m.eol();){if(m.match(v)){E.tokenize=x;break}m.next()}return a}}function g(a){return function(v,m){for(var E;(E=v.next())!=null;){if(E=="<")return m.tokenize=g(a+1),m.tokenize(v,m);if(E==">")if(a==1){m.tokenize=x;break}else return m.tokenize=g(a-1),m.tokenize(v,m)}return"meta"}}function d(a,v,m){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,v){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(v))return;o(a)}}function s(a,v,m){return a=="openTag"?(m.tagStart=v.column(),w):a=="closeTag"?p:s}function w(a,v,m){return a=="word"?(m.tagName=v.current(),y="tag",b):B.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,v,m)):(y="error",w)}function p(a,v,m){if(a=="word"){var E=v.current();return m.context&&m.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||B.matchClosing===!1?(y="tag",f):(y="tag error",_)}else return B.allowMissingTagName&&a=="endTag"?(y="tag bracket",f(a,v,m)):(y="error",_)}function f(a,v,m){return a!="endTag"?(y="error",f):(o(m),s)}function _(a,v,m){return y="error",f(a,v,m)}function b(a,v,m){if(a=="word")return y="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?u(m,E):(u(m,E),m.context=new d(m,E,M==m.indented)),s}return y="error",b}function h(a,v,m){return a=="equals"?c:(B.allowMissing||(y="error"),b(a,v,m))}function c(a,v,m){return a=="string"?l:a=="word"&&B.allowUnquoted?(y="string",b):(y="error",b(a,v,m))}function l(a,v,m){return a=="string"?l:b(a,v,m)}return{startState:function(a){var v={tokenize:x,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;L=null;var m=v.tokenize(a,v);return(m||L)&&m!="comment"&&(y=null,v.state=v.state(L||m,a,v),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,v,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=x)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var M=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(M&&M[1])for(;E;)if(E.tagName==M[2]){E=E.prev;break}else if(B.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(M)for(;E;){var F=B.contextGrabbers[E.tagName];if(F&&F.hasOwnProperty(M[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],m=a.context;m;m=m.prev)m.tagName&&v.push(m.tagName);return v.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(st,ze,q){"use strict";q.d(ze,"a",function(){return p});var re=q("+L6B"),V=q("2/Rp"),A=q("2qtc"),G=q("kLXV"),I=q("9og8"),R=q("k1fw"),B=q("miYZ"),U=q("tsqr"),k=q("oBTY"),L=q("tJVT"),y=q("DZo9"),x=q("8z0m"),O=q("WmNS"),C=q.n(O),T=q("cDcd"),g=q.n(T),d=q("m3rI"),o=q("wzkS"),u=q("y5JW"),s=q("LtfV"),w=x.a.Dragger;function p(f){var _=[];return f&&f.length>0&&(_=f.map(function(b){return{uid:b.id,id:b.id,name:b.title+u.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),_}ze.b=function(f){var _=f.value,b=f.onChange,h=f.action,c=f.className,l=f.maxSize,a=l===void 0?150:l,v=f.title,m=v===void 0?"\u4E0A\u4F20\u9644\u4EF6":v,E=f.showRemoveModal,M=E===void 0?!1:E,F=f.accept,j=F===void 0?"":F,W=f.additionalText,D=f.isDragger,P=f.number,H=P===void 0?1e3:P,Y=f.aloneClear,ee=Y===void 0?!1:Y,oe=Object(T.useState)(!1),Te=Object(L.a)(oe,2),ve=Te[0],ge=Te[1],he=Object(T.useState)(_||[]),fe=Object(L.a)(he,2),ae=fe[0],me=fe[1];Object(T.useEffect)(function(){_&&(me(Object(k.a)(_)),H===(_==null?void 0:_.length)&&ge(!0))},[_]);var J=function(){setTimeout(function(){ae.pop(),me(Object(k.a)(ae))},500)},ne={multiple:!0,disabled:ve,accept:j,withCredentials:!0,fileList:ae,beforeUpload:function(Ce,ye){var we=Ce.size/1024/1024;return ae.concat(ye).length>H?(ae.pop(),me(Object(k.a)(ae)),U.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():(J(),!1)):!0},action:h||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Ce){var ye,we,De=Object(k.a)(Ce.fileList);if(Ce.file.status==="done"&&((ye=Ce.file)===null||ye===void 0||((we=ye.response)===null||we===void 0)?void 0:we.status)===-1){var Pe,ke;U.b.error((Pe=Ce.file)===null||Pe===void 0||((ke=Pe.response)===null||ke===void 0)?void 0:ke.message);return}De.length>=H?ge(!0):ge(!1),me(Object(k.a)(De)),De=De.map(function(Oe){var Re;if(Oe!=null&&(Re=Oe.response)!==null&&Re!==void 0&&Re.id){var Ge;Oe.url="/api/attachments/".concat(Oe==null||((Ge=Oe.response)===null||Ge===void 0)?void 0:Ge.id)}return Oe.name.indexOf(u.c)===-1&&(Oe.name="".concat(Oe.name).concat(u.c).concat(Object(u.a)(Oe.size))),Object(R.a)({},Oe)}),console.log("info:",Ce),b(De)},onRemove:function(){var Ee=Object(I.a)(C.a.mark(function ye(we){var De;return C.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(De=function(){var Oe=Object(I.a)(C.a.mark(function Re(){var Ge,$e;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:if(Ge=we.response?we.response.id:we.id,!Ge){He.next=8;break}return He.next=4,Object(o.d)(we.response?we.response.id:we.uid);case 4:return $e=He.sent,He.abrupt("return",$e);case 8:return He.abrupt("return",!0);case 9:case"end":return He.stop()}},Re)}));return function(){return Oe.apply(this,arguments)}}(),!M){ke.next=5;break}return ke.abrupt("return",new Promise(function(Oe,Re){G.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:g.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ge=Object(I.a)(C.a.mark(function Be(){var He;return C.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,De();case 2:He=Je.sent,U.b.success("\u5220\u9664\u6210\u529F"),Oe(!0);case 5:case"end":return Je.stop()}},Be)}));function $e(){return Ge.apply(this,arguments)}return $e}(),onCancel:function(){return Oe(!1)}})}));case 5:return ke.next=7,De();case 7:return ke.abrupt("return",ke.sent);case 8:case"end":return ke.stop()}},ye)}));function Ce(ye){return Ee.apply(this,arguments)}return Ce}()};function Q(Ee){Ee.preventDefault(),Ee.stopPropagation()}return g.a.createElement("div",{className:"multi-upload ".concat(c||"")},D&&g.a.createElement(w,ne,g.a.createElement("p",{className:"ant-upload-drag-icon"},g.a.createElement(s.a,null)),g.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",g.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!D&&g.a.createElement(x.a,ne,g.a.createElement(V.a,{disabled:ve},m),g.a.createElement("span",{onClick:Q,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(st,ze,q){"use strict";q.d(ze,"a",function(){return u});var re=q("Ty5D"),V=q("dI71"),A=q("cDcd"),G=q.n(A),I=q("YS25"),R=q("17x9"),B=q.n(R),U=q("wx14"),k=q("zLVn"),L=q("9R94"),y=function(c){Object(V.a)(l,c);function l(){for(var v,m=arguments.length,E=new Array(m),M=0;M<m;M++)E[M]=arguments[M];return v=c.call.apply(c,[this].concat(E))||this,v.history=Object(I.a)(v.props),v}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),x=function(c){Object(V.a)(l,c);function l(){for(var v,m=arguments.length,E=new Array(m),M=0;M<m;M++)E[M]=arguments[M];return v=c.call.apply(c,[this].concat(E))||this,v.history=Object(I.b)(v.props),v}var a=l.prototype;return a.render=function(){return G.a.createElement(re.c,{history:this.history,children:this.props.children})},l}(G.a.Component),O=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(I.c)(l,null,null,a):l},T=function(l){return l},g=G.a.forwardRef;typeof g=="undefined"&&(g=T);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=g(function(c,l){var a=c.innerRef,v=c.navigate,m=c.onClick,E=Object(k.a)(c,["innerRef","navigate","onClick"]),M=E.target,F=Object(U.a)({},E,{onClick:function(W){try{m&&m(W)}catch(D){throw W.preventDefault(),D}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!d(W)&&(W.preventDefault(),v())}});return T!==g?F.ref=l||a:F.ref=a,G.a.createElement("a",F)}),u=g(function(c,l){var a=c.component,v=a===void 0?o:a,m=c.replace,E=c.to,M=c.innerRef,F=Object(k.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(j){j||Object(L.a)(!1);var W=j.history,D=C(O(E,j.location),j.location),P=D?W.createHref(D):"",H=Object(U.a)({},F,{href:P,navigate:function(){var ee=O(E,j.location),oe=m?W.replace:W.push;oe(ee)}});return T!==g?H.ref=l||M:H.innerRef=M,G.a.createElement(v,H)})});if(!1)var s,w;var p=function(l){return l},f=G.a.forwardRef;typeof f=="undefined"&&(f=p);function _(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(v){return v}).join(" ")}var b=f(function(c,l){var a=c["aria-current"],v=a===void 0?"page":a,m=c.activeClassName,E=m===void 0?"active":m,M=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,D=c.location,P=c.sensitive,H=c.strict,Y=c.style,ee=c.to,oe=c.innerRef,Te=Object(k.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(re.e.Consumer,null,function(ve){ve||Object(L.a)(!1);var ge=D||ve.location,he=C(O(ee,ge),ge),fe=he.pathname,ae=fe&&fe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),me=ae?Object(re.f)(ge.pathname,{path:ae,exact:j,sensitive:P,strict:H}):null,J=!!(W?W(me,ge):me),ne=J?_(F,E):F,Q=J?Object(U.a)({},Y,{},M):Y,Ee=Object(U.a)({"aria-current":J&&v||null,className:ne,style:Q,to:he},Te);return p!==f?Ee.ref=l||oe:Ee.innerRef=oe,G.a.createElement(u,Ee)})});if(!1)var h},"7/Dv":function(st,ze,q){st.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(st,ze,q){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),V=new Uint8Array(16);function A(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(V)}var G=/^(?:[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 I(O){return typeof O=="string"&&G.test(O)}for(var R=I,B=[],U=0;U<256;++U)B.push((U+256).toString(16).substr(1));function k(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,T=(B[O[C+0]]+B[O[C+1]]+B[O[C+2]]+B[O[C+3]]+"-"+B[O[C+4]]+B[O[C+5]]+"-"+B[O[C+6]]+B[O[C+7]]+"-"+B[O[C+8]]+B[O[C+9]]+"-"+B[O[C+10]]+B[O[C+11]]+B[O[C+12]]+B[O[C+13]]+B[O[C+14]]+B[O[C+15]]).toLowerCase();if(!R(T))throw TypeError("Stringified UUID is invalid");return T}var L=k;function y(O,C,T){O=O||{};var g=O.random||(O.rng||A)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,C){T=T||0;for(var d=0;d<16;++d)C[T+d]=g[d];return C}return L(g)}var x=ze.a=y},"7ahc":function(st,ze,q){"use strict";q.d(ze,"a",function(){return w});var re=q("k1fw"),V=q("0Owb"),A=q("+L6B"),G=q("2/Rp"),I=q("y8nQ"),R=q("Vl3Y"),B=q("tJVT"),U=q("OaEy"),k=q("2fM7"),L=q("cDcd"),y=q.n(L),x=q("VrN/"),O=q.n(x),C=q("p77/"),T=q.n(C),g=q("c5Ni"),d=q.n(g),o=k.a.Option,u={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"]};ze.b=function(p){var f=p.callback,_=p.onCancel,b=Object(L.useState)("python"),h=Object(B.a)(b,2),c=h[0],l=h[1];function a(m){l(s[m][1])}function v(m){f(m)}return y.a.createElement(R.a,Object(V.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(k.a,{onChange:a},Object.keys(s).map(function(m){return y.a.createElement(o,{key:m,value:m},s[m][0])}))),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(w,{mode:c})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(G.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function w(p){var f=p.value,_=p.onChange,b=p.mode,h=p.options,c=h===void 0?{}:h,l=Object(L.useRef)(),a=Object(L.useState)(),v=Object(B.a)(a,2),m=v[0],E=v[1];return Object(L.useEffect)(function(){if(m){function M(F){var j=F.getValue();_&&_(j)}return m.on("change",M),function(){m.off("change",M)}}},[m,_]),Object(L.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(L.useEffect)(function(){m&&((f!==m.getValue()||f==="")&&setTimeout(function(){m.setValue(f||" ")},300))},[m,f]),Object(L.useEffect)(function(){if(l.current&&!m){var M=O.a.fromTextArea(l.current,Object(re.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(M)}},[l.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:l}))}},"8EBN":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<re.modeInfo.length;V++){var A=re.modeInfo[V];A.mimes&&(A.mime=A.mimes[0])}re.findModeByMIME=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.mime==G)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==G)return R}}if(/\+xml$/.test(G))return re.findModeByMIME("application/xml");if(/\+json$/.test(G))return re.findModeByMIME("application/json")},re.findModeByExtension=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==G)return R}}},re.findModeByFileName=function(G){for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.file&&R.file.test(G))return R}var B=G.lastIndexOf("."),U=B>-1&&G.substring(B+1,G.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.name.toLowerCase()==G)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==G)return R}}}})},"8hTe":function(st,ze,q){st.exports={button:"button___1wy9m"}},"9Bee":function(st,ze,q){"use strict";var re=q("DYRE"),V=q("zeV3"),A=q("+L6B"),G=q("2/Rp"),I=q("k1fw"),R=q("tJVT"),B=q("cDcd"),U=q.n(B),k=q("vg9a"),L=q("DlQD"),y=q.n(L),x=q("rUJ1");function O(ge,he){var fe=ge.match(/^(\s+)(?:```)/);if(fe===null)return he;var ae=fe[1];return he.split(`
`).map(function(me){var J=me.match(/^\s+/);if(J===null)return me;var ne=Object(R.a)(J,1),Q=ne[0];return Q.length>=ae.length?me.slice(ae.length):me}).join(`
`)}var C=[],T=["<ul>"],g=new y.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,T=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(ge,he,fe,ae){if(he>=ge.length||ge[he].level<=fe)return he;var me=ge[he];ae.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),he++;var J=[];return he=s(ge,he,me.level,J),J.length>0&&(ae.push("<ul>"),J.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),he=s(ge,he,fe,ae),he}function w(){return s(C,0,0,T),T.push("</ul>"),T.join("")}var p={heading:function(he){var fe=d.exec(he);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(he){var fe=this.rules.block.fences.exec(he);if(fe){var ae=fe[0],me=O(ae,fe[3]||""),J=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf(J)>=0){var ne=b(),Q=me;me=ne,h[ne]={type:"block",expression:Q}}return{type:"code",raw:ae,lang:J,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,_=0,b=function(){return"__special_katext_id_".concat(_++,"__")},h={};function c(){return h}function l(){_=0,h={}}function a(ge){return ge=ge.replace(f,function(he,fe){var ae=b();return h[ae]={type:"inline",expression:fe},ae}),ge}var v=g.listitem;g.listitem=function(ge){return v(a(ge))};var m=g.paragraph;g.paragraph=function(ge){return m(a(ge))};var E=g.tablecell;g.tablecell=function(ge,he){return E(a(ge),he)},g.code=function(ge,he,fe){var ae=(he||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(he,'">').concat(fe?ge:Object(x.escape)(ge,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(fe?ge:Object(x.escape)(ge,!0))+"</code></pre>"},g.heading=function(ge,he,fe){var ae=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:ae,level:he,text:ge}),"<h"+he+' id="'+ae+'">'+ge+"</h"+he+">"},y.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),y.a.use({tokenizer:p,renderer:g});var M=y.a,F=q("SJMd"),j=q("ulZh"),W=q.n(j),D=q("m3rI"),P=q("Oy/b"),H=q("p5ED"),Y=q("8hTe"),ee=q.n(Y),oe=/<pre[^>]*>/g;function Te(ge){var he=document.createElement("div");return he.innerHTML=ge,he.childNodes.length===0?"":he.childNodes[0].nodeValue}var ve=ze.a=function(ge){var he=ge.value,fe=he===void 0?"":he,ae=ge.edit,me=ae===void 0?!1:ae,J=ge.className,ne=ge.showTextOnly,Q=ge.showLines,Ee=ge.replaces,Ce=ge.zoomImg,ye=ge.hasMask,we=ge.style,De=we===void 0?{}:we,Pe=ge.stylesPrev,ke=Pe===void 0?{}:Pe,Oe=String(fe),Re=Object(B.useRef)(),Ge=Object(B.useRef)(),$e=Object(B.useState)(""),Be=Object(R.a)($e,2),He=Be[0],rt=Be[1],Je=Object(B.useState)("office"),qe=Object(R.a)(Je,2),Se=qe[0],Ze=qe[1],Ke=Object(B.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,$=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Oe=Oe.replace(de,"("+D.a.API_SERVER+"/api/attachments/").replace($,'"'+D.a.API_SERVER+"/api/attachments/").replace(Z,'"'+D.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(Ae){}var te=M(Oe),le=c();if(Oe.match(/\[TOC\]/)&&(te=te.replace("<p>[TOC]</p>",w()),o()),te=te.replace(/(__special_katext_id_\d+__)/g,function(Ae,_e){var Ue=le[_e],Qe=Ue.type,Ve=Ue.expression;return Object(P.renderToString)(Te(Ve)||"",{displayMode:Qe==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),l(),ne){var ce=document.createElement("div");return ce.innerHTML=te,ce.innerText}return setTimeout(function(){return pe()},500),te},[Oe]),Le=Object(B.useRef)();u.WebkitLineClamp=Q,Q&&(De=Object(I.a)(Object(I.a)({},De),u));function Ie(de){var $=de.target;if($.tagName.toUpperCase()==="IMG"){if(Ce){var Z=$.getAttribute("src");rt(Z),Ze("image")}}else if($.tagName.toUpperCase()==="A"){var te=$.getAttribute("href");if(te.indexOf("office")>-1)de.preventDefault(),rt(te),Ze("office");else if(te.indexOf("application/pdf")>-1)de.preventDefault(),rt(te),Ze("pdf");else if(te.indexOf("text/html")>-1)de.preventDefault(),rt(te),Ze("html");else if(te.startsWith("#")){de.preventDefault();var le=document.getElementById(te.replace("#",""));le&&le.scrollIntoView(!0)}}}var pe=function(){var $,Z=($=Le.current)===null||$===void 0?void 0:$.querySelectorAll("video");Z==null||Z.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(te.src),le.attachMedia(te)}}})};Object(B.useEffect)(function(){if(Le.current&&Ke&&(Ke.match(oe)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",Ie),function(){Le.current.removeEventListener("click",Ie),l(),o()}},[Ke,Le.current,Ie]);var se=function($){if(!me)return;$.target.nodeName==="IMG"?(Re.current.style.display="flex",Re.current.style.width=$.target.clientWidth+"px",Re.current.style.height=$.target.clientHeight+"px",Re.current.style.top=$.target.offsetTop+"px",Re.current.style.left=$.target.offsetLeft+"px",Ge.current.src=$.target.getAttribute("src")):Re.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:Le,style:Object(I.a)({},De),className:"".concat(J||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:se,dangerouslySetInnerHTML:{__html:Ke}}),U.a.createElement("div",{ref:Re,className:ee.a.button},U.a.createElement(V.a,null,U.a.createElement(G.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(G.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:Ge,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(H.a,{close:!0,data:He,type:He!=null&&He.length?Se:"",style:Object(I.a)({},ke),onClose:function(){return rt("")}}))}},"9VGf":function(st,ze,q){"use strict";q.d(ze,"a",function(){return A});var re=q("cDcd"),V=q.n(re);function A(G,I){var R=Object(re.useRef)();Object(re.useEffect)(function(){R.current=G}),Object(re.useEffect)(function(){function B(){R.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},BU3w:function(st,ze,q){"use strict";q.d(ze,"a",function(){return R});var re=q("MNnm"),V="rc-util-key";function A(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function G(B){var U,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var L=document.createElement("style");if((U=k.csp)===null||U===void 0?void 0:U.nonce){var y;L.nonce=(y=k.csp)===null||y===void 0?void 0:y.nonce}L.innerHTML=B;var x=A(k),O=x.firstChild;return k.prepend&&x.prepend?x.prepend(L):k.prepend&&O?x.insertBefore(L,O):x.appendChild(L),L}var I=new Map;function R(B,U){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=A(k);if(!I.has(L)){var y=G("",k),x=y.parentNode;I.set(L,x),x.removeChild(y)}var O=Array.from(I.get(L).children).find(function(o){return o.tagName==="STYLE"&&o[V]===U});if(O){var C,T;if(((C=k.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((T=k.csp)===null||T===void 0?void 0:T.nonce)){var g;O.nonce=(g=k.csp)===null||g===void 0?void 0:g.nonce}return O.innerHTML!==B&&(O.innerHTML=B),O}var d=G(B,k);return d[V]=U,d}},Bd2K:function(st,ze,q){(function(re){re(q("VrN/"),q("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(k,L,y){if(y!=re.Init&&y&&k.removeKeyMap("autoCloseTags"),!L)return;var x={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(x["'/'"]=function(O){return R(O)}),(typeof L!="object"||L.whenOpening!==!1)&&(x["'>'"]=function(O){return G(O)}),k.addKeyMap(x)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function G(k){if(k.getOption("disableInput"))return re.Pass;for(var L=k.listSelections(),y=[],x=k.getOption("autoCloseTags"),O=0;O<L.length;O++){if(!L[O].empty())return re.Pass;var C=L[O].head,T=k.getTokenAt(C),g=re.innerMode(k.getMode(),T.state),d=g.state,o=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return re.Pass;var s=g.mode.configuration=="html",w=typeof x=="object"&&x.dontCloseTags||s&&V,p=typeof x=="object"&&x.indentTags||s&&A;T.end>C.ch&&(u=u.slice(0,u.length-T.end+C.ch));var f=u.toLowerCase();if(!u||T.type=="string"&&(T.end!=C.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&o.close||T.string.indexOf("/")==C.ch-T.start-1||w&&B(w,f)>-1||U(k,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(d)||[],u,C,!0))return re.Pass;var _=typeof x=="object"&&x.emptyTags;if(_&&B(_,u)>-1){y[O]={text:"/>",newPos:re.Pos(C.line,C.ch+2)};continue}var b=p&&B(p,f)>-1;y[O]={indent:b,text:">"+(b?`
`:"")+"</"+u+">",newPos:b?re.Pos(C.line+1,0):re.Pos(C.line,C.ch+1)}}for(var h=typeof x=="object"&&x.dontIndentOnAutoClose,O=L.length-1;O>=0;O--){var c=y[O];k.replaceRange(c.text,L[O].head,L[O].anchor,"+insert");var l=k.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},k.setSelections(l),!h&&c.indent&&(k.indentLine(c.newPos.line,null,!0),k.indentLine(c.newPos.line+1,null,!0))}}function I(k,L){for(var y=k.listSelections(),x=[],O=L?"/":"</",C=k.getOption("autoCloseTags"),T=typeof C=="object"&&C.dontIndentOnSlash,g=0;g<y.length;g++){if(!y[g].empty())return re.Pass;var d=y[g].head,o=k.getTokenAt(d),u=re.innerMode(k.getMode(),o.state),s=u.state;if(L&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return re.Pass;var w,p=u.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(p&&u.mode.name=="javascript")w=O+"script";else if(p&&u.mode.name=="css")w=O+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(s);if(!f||f.length&&U(k,f,f[f.length-1],d))return re.Pass;w=O+f[f.length-1]}k.getLine(d.line).charAt(o.end)!=">"&&(w+=">"),x[g]=w}if(k.replaceSelections(x),y=k.listSelections(),!T)for(var g=0;g<y.length;g++)(g==y.length-1||y[g].head.line<y[g+1].head.line)&&k.indentLine(y[g].head.line)}function R(k){return k.getOption("disableInput")?re.Pass:I(k,!0)}re.commands.closeTag=function(k){return I(k)};function B(k,L){if(k.indexOf)return k.indexOf(L);for(var y=0,x=k.length;y<x;++y)if(k[y]==L)return y;return-1}function U(k,L,y,x,O){if(!re.scanForClosingTag)return!1;var C=Math.min(k.lastLine()+1,x.line+500),T=re.scanForClosingTag(k,x,null,C);if(!T||T.tag!=y)return!1;for(var g=O?1:0,d=L.length-1;d>=0&&L[d]==y;d--)++g;x=T.to;for(var d=1;d<g;d++){var o=re.scanForClosingTag(k,x,null,C);if(!o||o.tag!=y)return!1;x=o.to}return!0}})},BjJ7:function(st,ze,q){"use strict";q.d(ze,"d",function(){return V}),q.d(ze,"c",function(){return A}),q.d(ze,"e",function(){return G}),q.d(ze,"b",function(){return I}),q.d(ze,"a",function(){return B});var re=q("m3rI");function V(U){var k=!0;if(U.length>0){for(var L=0;L<U.length;L++)if(U[L].compile_success==0||!U[L].compile_success){k=!1;break}}else k=!1;return k}function A(U){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],y=0;y<U.length;y++){var x=U[y],O=k?"".concat(k,"/").concat(x.name):"".concat(x.name);L.push({title:x.name,isLeaf:!(x.type==="tree"),key:O})}return L}function G(U,k,L){for(var y=0;y<U.length;y++){var x=U[y];if(x.key===k){x.children=L;break}x.children&&G(x.children,k,L)}return U}function I(U,k,L){var y;return function(){var x=this,O=arguments,C=function(){y=null,L||U.apply(x,O)},T=L&&!y;clearTimeout(y),y=setTimeout(C,k),T&&U.apply(x,O)}}var R=!0,B=re.a.API_SERVER},"C+DQ":function(st,ze,q){},CKgm:function(st,ze,q){"use strict";q.r(ze);var re=q("+L6B"),V=q("2/Rp"),A=q("5NDa"),G=q("5rEg"),I=q("sPJy"),R=q("bE4q"),B=q("miYZ"),U=q("tsqr"),k=q("9og8"),L=q("k1fw"),y=q("y8nQ"),x=q("Vl3Y"),O=q("tJVT"),C=q("PpiC"),T=q("OaEy"),g=q("2fM7"),d=q("WmNS"),o=q.n(d),u=q("cDcd"),s=q.n(u),w=q("Ty5D"),p=q("9kvl"),f=q("55Ip"),_=q("Ot1p"),b=q("500L"),h=q("h+Ho"),c=q("7/Dv"),l=q.n(c),a=g.a.Option,v=function(E){var M,F,j,W=E.forumsDetail,D=E.globalSetting,P=E.loading,H=E.dispatch,Y=Object(C.a)(E,["forumsDetail","globalSetting","loading","dispatch"]),ee=Object(w.i)(),oe=x.a.useForm(),Te=Object(O.a)(oe,1),ve=Te[0],ge=Object(u.useState)({}),he=Object(O.a)(ge,2),fe=he[0],ae=he[1],me=Object(u.useState)(0),J=Object(O.a)(me,2),ne=J[0],Q=J[1],Ee=Object(u.useState)(!1),Ce=Object(O.a)(Ee,2),ye=Ce[0],we=Ce[1],De=Object(u.useState)({}),Pe=Object(O.a)(De,2),ke=Pe[0],Oe=Pe[1],Re=Object(u.useState)(1),Ge=Object(O.a)(Re,2),$e=Ge[0],Be=Ge[1];Object(u.useEffect)(function(){if(He(),ee.memoId)we(!0),rt();else{we(!1);var Se={forum_id:5};ae(Object(L.a)({},Se)),ve.setFieldsValue(Object(L.a)({},Se))}},[ee.memoId]);var He=function(){var Se=Object(k.a)(o.a.mark(function Ze(){var Ke;return o.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return Ie.next=2,Object(h.f)({});case 2:Ke=Ie.sent,Oe(Ke||{});case 4:case"end":return Ie.stop()}},Ze)}));return function(){return Se.apply(this,arguments)}}(),rt=function(){var Se=Object(k.a)(o.a.mark(function Ze(){var Ke,Le,Ie;return o.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return se.next=2,Object(h.e)({id:ee.memoId});case 2:if(se.t0=se.sent,se.t0){se.next=5;break}se.t0={};case 5:Le=se.t0,Ie={subject:Le.subject,content:Le.content,attachments:Object(b.a)(Le.attachments),forum_id:Le.forum_id,memo_tags:(Ke=Le.memo_tags)===null||Ke===void 0?void 0:Ke.map(function(de){return de.id})},ae(Object(L.a)({},Ie)),ve.setFieldsValue(Object(L.a)({},Ie));case 9:case"end":return se.stop()}},Ze)}));return function(){return Se.apply(this,arguments)}}(),Je=function(){var Se=Object(k.a)(o.a.mark(function Ze(Ke){var Le,Ie,pe,se;return o.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:if(pe=Object(L.a)(Object(L.a)({id:ye?ee.memoId:null},fe),{},{attachment_ids:(Le=fe.attachments)===null||Le===void 0||((Ie=Le.filter(function(Z){var te;return(te=Z.response)===null||te===void 0?void 0:te.id}))===null||Ie===void 0)?void 0:Ie.map(function(Z){var te;return(te=Z.response)===null||te===void 0?void 0:te.id}),tags:fe.memo_tags}),!ye){$.next=7;break}return $.next=4,Object(h.n)(pe);case 4:$.t0=$.sent,$.next=10;break;case 7:return $.next=9,Object(h.j)(pe);case 9:$.t0=$.sent;case 10:se=$.t0,Q(0),(se==null?void 0:se.status)===0&&(U.b.success(se==null?void 0:se.message),$e===1?p.d.push("/forums/".concat(ye?ee==null?void 0:ee.memoId:se==null?void 0:se.memo_id)):p.d.push("/forums/".concat(ye?ee==null?void 0:ee.memoId:se==null?void 0:se.memo_id,"/edit")));case 13:case"end":return $.stop()}},Ze)}));return function(Ke){return Se.apply(this,arguments)}}(),qe=function(){document.body.scrollIntoView(),window.location.href.includes("new")?p.d.goBack():p.d.push("/forums/".concat(ee.memoId))};return s.a.createElement("section",{className:l.a.bg},s.a.createElement("section",{className:"animated fadeIn mb10"},s.a.createElement("aside",{className:"mt10"},s.a.createElement(R.a,{separator:"/"},s.a.createElement(R.a.Item,null,s.a.createElement(f.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),s.a.createElement(R.a.Item,null,"\u8BE6\u60C5")))),s.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},ye?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),s.a.createElement(x.a,{form:ve,className:l.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(Ze,Ke){console.log(Ke,"values"),ae(Object(L.a)(Object(L.a)({},fe),Ze))},onFinish:Je,onFinishFailed:function(){Q(0)}},s.a.createElement("div",{className:l.a.fieldWrap},s.a.createElement(x.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(G.a,{maxLength:50,suffix:"".concat(((M=fe.subject)===null||M===void 0?void 0:M.length)||0,"/50")}))),s.a.createElement("div",{className:l.a.mdWrap},s.a.createElement(x.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,{height:600,id:"forums-new-content",watch:!0,defaultValue:fe.content})),s.a.createElement("div",null,s.a.createElement(x.a.Item,{name:"attachments",style:{width:350}},s.a.createElement(b.b,{showRemoveModal:!0})))),s.a.createElement("div",{className:l.a.mdWrap},s.a.createElement(x.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(g.a,{style:{width:300}},ke==null||((F=ke.forums)===null||F===void 0)?void 0:F.map(function(Se){return s.a.createElement(a,{key:Se.id,value:Se.id},Se.name)})))),fe.forum_id===5&&s.a.createElement("div",{className:l.a.mdWrap},s.a.createElement(x.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(g.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function(Ze,Ke){return Ke.props.children.toLocaleLowerCase().indexOf(Ze.toLocaleLowerCase())!=-1}},ke==null||((j=ke.tag_list)===null||j===void 0)?void 0:j.map(function(Se){return s.a.createElement(a,{key:Se.id,value:Se.id},Se.name)})))),s.a.createElement("div",{className:l.a.backgroundFa},s.a.createElement("div",{className:"pt40 mb30"},s.a.createElement(x.a.Item,null,s.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(l.a.button," mr20"),htmlType:"submit",loading:ne===1,onClick:function(){Be(1),Q(1)}},"\u63D0\u4EA4"),s.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(l.a.button," mr20"),htmlType:"submit",loading:ne===2,onClick:function(){Be(2),Q(2)}},"\u4FDD\u5B58"),s.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:"".concat(l.a.button," mr20"),onClick:qe},"\u53D6\u6D88"))))))};ze.default=Object(p.a)(function(m){var E=m.forumsDetail,M=m.loading,F=m.globalSetting;return{forumsDetail:E,globalSetting:F,loading:M.models.forumsDetail}})(v)},DlQD:function(st,ze,q){(function(re,V){st.exports=V()})(this,function(){"use strict";function re(pe,se){for(var de=0;de<se.length;de++){var $=se[de];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(pe,$.key,$)}}function V(pe,se,de){return se&&re(pe.prototype,se),de&&re(pe,de),pe}function A(pe,se){if(!pe)return;if(typeof pe=="string")return G(pe,se);var de=Object.prototype.toString.call(pe).slice(8,-1);if(de==="Object"&&pe.constructor&&(de=pe.constructor.name),de==="Map"||de==="Set")return Array.from(pe);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return G(pe,se)}function G(pe,se){(se==null||se>pe.length)&&(se=pe.length);for(var de=0,$=new Array(se);de<se;de++)$[de]=pe[de];return $}function I(pe,se){var de;if(typeof Symbol=="undefined"||pe[Symbol.iterator]==null){if(Array.isArray(pe)||(de=A(pe))||se&&pe&&typeof pe.length=="number"){de&&(pe=de);var $=0;return function(){return $>=pe.length?{done:!0}:{done:!1,value:pe[$++]}}}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 de=pe[Symbol.iterator](),de.next.bind(de)}function R(pe,se){return se={exports:{}},pe(se,se.exports),se.exports}var B=R(function(pe){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 de($){pe.exports.defaults=$}pe.exports={defaults:se(),getDefaults:se,changeDefaults:de}}),U=B.defaults,k=B.getDefaults,L=B.changeDefaults,y=/[&<>"']/,x=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=function(se){return T[se]};function d(pe,se){if(se){if(y.test(pe))return pe.replace(x,g)}else if(O.test(pe))return pe.replace(C,g);return pe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(pe){return pe.replace(o,function(se,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var s=/(^|[^\[])\^/g;function w(pe,se){pe=pe.source||pe,se=se||"";var de={replace:function(Z,te){return te=te.source||te,te=te.replace(s,"$1"),pe=pe.replace(Z,te),de},getRegex:function(){return new RegExp(pe,se)}};return de}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(pe,se,de){if(pe){var $;try{$=decodeURIComponent(u(de)).replace(p,"").toLowerCase()}catch(Z){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}se&&!f.test(de)&&(de=a(se,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Z){return null}return de}var b={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(pe,se){b[" "+pe]||(h.test(pe)?b[" "+pe]=pe+"/":b[" "+pe]=M(pe,"/",!0)),pe=b[" "+pe];var de=pe.indexOf(":")===-1;return se.substring(0,2)==="//"?de?se:pe.replace(c,"$1")+se:se.charAt(0)==="/"?de?se:pe.replace(l,"$1")+se:pe+se}var v={exec:function(){}};function m(pe){for(var se=1,de,$;se<arguments.length;se++){de=arguments[se];for($ in de)Object.prototype.hasOwnProperty.call(de,$)&&(pe[$]=de[$])}return pe}function E(pe,se){var de=pe.replace(/\|/g,function(te,le,ce){for(var Ae=!1,_e=le;--_e>=0&&ce[_e]==="\\";)Ae=!Ae;return Ae?"|":" |"}),$=de.split(/ \|/),Z=0;if($.length>se)$.splice(se);else for(;$.length<se;)$.push("");for(;Z<$.length;Z++)$[Z]=$[Z].trim().replace(/\\\|/g,"|");return $}function M(pe,se,de){var $=pe.length;if($===0)return"";for(var Z=0;Z<$;){var te=pe.charAt($-Z-1);if(te===se&&!de)Z++;else if(te!==se&&de)Z++;else break}return pe.substr(0,$-Z)}function F(pe,se){if(pe.indexOf(se[1])===-1)return-1;for(var de=pe.length,$=0,Z=0;Z<de;Z++)if(pe[Z]==="\\")Z++;else if(pe[Z]===se[0])$++;else if(pe[Z]===se[1]&&($--,$<0))return Z;return-1}function j(pe){pe&&pe.sanitize&&!pe.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:u,edit:w,cleanUrl:_,resolveUrl:a,noopTest:v,merge:m,splitCells:E,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},D=B.defaults,P=W.rtrim,H=W.splitCells,Y=W.escape,ee=W.findClosingBracket;function oe(pe,se,de){var $=se.href,Z=se.title?Y(se.title):null,te=pe[1].replace(/\\([\[\]])/g,"$1");return pe[0].charAt(0)!=="!"?{type:"link",raw:de,href:$,title:Z,text:te}:{type:"image",raw:de,href:$,title:Z,text:Y(te)}}function Te(pe,se){var de=pe.match(/^(\s+)(?:```)/);if(de===null)return se;var $=de[1];return se.split(`
`).map(function(Z){var te=Z.match(/^\s+/);if(te===null)return Z;var le=te[0];return le.length>=$.length?Z.slice($.length):Z}).join(`
`)}var ve=function(){function pe(de){this.options=de||D}var se=pe.prototype;return se.space=function($){var Z=this.rules.block.newline.exec($);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
`}},se.code=function($,Z){var te=this.rules.block.code.exec($);if(te){var le=Z[Z.length-1];if(le&&le.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var ce=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:P(ce,`
`)}}},se.fences=function($){var Z=this.rules.block.fences.exec($);if(Z){var te=Z[0],le=Te(te,Z[3]||"");return{type:"code",raw:te,lang:Z[2]?Z[2].trim():Z[2],text:le}}},se.heading=function($){var Z=this.rules.block.heading.exec($);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},se.nptable=function($){var Z=this.rules.block.nptable.exec($);if(Z){var te={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[],raw:Z[0]};if(te.header.length===te.align.length){var le=te.align.length,ce;for(ce=0;ce<le;ce++)/^ *-+: *$/.test(te.align[ce])?te.align[ce]="right":/^ *:-+: *$/.test(te.align[ce])?te.align[ce]="center":/^ *:-+ *$/.test(te.align[ce])?te.align[ce]="left":te.align[ce]=null;for(le=te.cells.length,ce=0;ce<le;ce++)te.cells[ce]=H(te.cells[ce],te.header.length);return te}}},se.hr=function($){var Z=this.rules.block.hr.exec($);if(Z)return{type:"hr",raw:Z[0]}},se.blockquote=function($){var Z=this.rules.block.blockquote.exec($);if(Z){var te=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:te}}},se.list=function($){var Z=this.rules.block.list.exec($);if(Z){for(var te=Z[0],le=Z[2],ce=le.length>1,Ae=le[le.length-1]===")",_e={type:"list",raw:te,ordered:ce,start:ce?+le.slice(0,-1):"",loose:!1,items:[]},Ue=Z[0].match(this.rules.block.item),Qe=!1,Ve,mt,dt,ot,Ct,bt,Bt,Ut=Ue.length,Et=0;Et<Ut;Et++)Ve=Ue[Et],te=Ve,mt=Ve.length,Ve=Ve.replace(/^ *([*+-]|\d+[.)]) */,""),~Ve.indexOf(`
`)&&(mt-=Ve.length,Ve=this.options.pedantic?Ve.replace(/^ {1,4}/gm,""):Ve.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Et!==Ut-1&&(dt=this.rules.block.bullet.exec(Ue[Et+1])[0],(ce?dt.length===1||!Ae&&dt[dt.length-1]===")":dt.length>1||this.options.smartLists&&dt!==le)&&(ot=Ue.slice(Et+1).join(`
`),_e.raw=_e.raw.substring(0,_e.raw.length-ot.length),Et=Ut-1)),Ct=Qe||/\n\n(?!\s*$)/.test(Ve),Et!==Ut-1&&(Qe=Ve.charAt(Ve.length-1)===`
`,Ct||(Ct=Qe)),Ct&&(_e.loose=!0),bt=/^\[[ xX]\] /.test(Ve),Bt=void 0,bt&&(Bt=Ve[1]!==" ",Ve=Ve.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:te,task:bt,checked:Bt,loose:Ct,text:Ve});return _e}},se.html=function($){var Z=this.rules.block.html.exec($);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):Y(Z[0]):Z[0]}},se.def=function($){var Z=this.rules.block.def.exec($);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var te=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Z[0],href:Z[2],title:Z[3]}}},se.table=function($){var Z=this.rules.block.table.exec($);if(Z){var te={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[]};if(te.header.length===te.align.length){te.raw=Z[0];var le=te.align.length,ce;for(ce=0;ce<le;ce++)/^ *-+: *$/.test(te.align[ce])?te.align[ce]="right":/^ *:-+: *$/.test(te.align[ce])?te.align[ce]="center":/^ *:-+ *$/.test(te.align[ce])?te.align[ce]="left":te.align[ce]=null;for(le=te.cells.length,ce=0;ce<le;ce++)te.cells[ce]=H(te.cells[ce].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},se.lheading=function($){var Z=this.rules.block.lheading.exec($);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},se.paragraph=function($){var Z=this.rules.block.paragraph.exec($);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
`?Z[1].slice(0,-1):Z[1]}},se.text=function($,Z){var te=this.rules.block.text.exec($);if(te){var le=Z[Z.length-1];return le&&le.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},se.escape=function($){var Z=this.rules.inline.escape.exec($);if(Z)return{type:"escape",raw:Z[0],text:Y(Z[1])}},se.tag=function($,Z,te){var le=this.rules.inline.tag.exec($);if(le)return!Z&&/^<a /i.test(le[0])?Z=!0:Z&&/^<\/a>/i.test(le[0])&&(Z=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:Z,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):Y(le[0]):le[0]}},se.link=function($){var Z=this.rules.inline.link.exec($);if(Z){var te=ee(Z[2],"()");if(te>-1){var le=Z[0].indexOf("!")===0?5:4,ce=le+Z[1].length+te;Z[2]=Z[2].substring(0,te),Z[0]=Z[0].substring(0,ce).trim(),Z[3]=""}var Ae=Z[2],_e="";if(this.options.pedantic){var Ue=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);Ue?(Ae=Ue[1],_e=Ue[3]):_e=""}else _e=Z[3]?Z[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=oe(Z,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},Z[0]);return Qe}},se.reflink=function($,Z){var te;if((te=this.rules.inline.reflink.exec($))||(te=this.rules.inline.nolink.exec($))){var le=(te[2]||te[1]).replace(/\s+/g," ");if(le=Z[le.toLowerCase()],!le||!le.href){var ce=te[0].charAt(0);return{type:"text",raw:ce,text:ce}}var Ae=oe(te,le,te[0]);return Ae}},se.strong=function($,Z,te){te===void 0&&(te="");var le=this.rules.inline.strong.start.exec($);if(le&&(!le[1]||le[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*$.length);var ce=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var Ae;(le=ce.exec(Z))!=null;)if(Ae=this.rules.inline.strong.middle.exec(Z.slice(0,le.index+3)),Ae)return{type:"strong",raw:$.slice(0,Ae[0].length),text:$.slice(2,Ae[0].length-2)}}},se.em=function($,Z,te){te===void 0&&(te="");var le=this.rules.inline.em.start.exec($);if(le&&(!le[1]||le[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*$.length);var ce=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var Ae;(le=ce.exec(Z))!=null;)if(Ae=this.rules.inline.em.middle.exec(Z.slice(0,le.index+2)),Ae)return{type:"em",raw:$.slice(0,Ae[0].length),text:$.slice(1,Ae[0].length-1)}}},se.codespan=function($){var Z=this.rules.inline.code.exec($);if(Z){var te=Z[2].replace(/\n/g," "),le=/[^ ]/.test(te),ce=te.startsWith(" ")&&te.endsWith(" ");return le&&ce&&(te=te.substring(1,te.length-1)),te=Y(te,!0),{type:"codespan",raw:Z[0],text:te}}},se.br=function($){var Z=this.rules.inline.br.exec($);if(Z)return{type:"br",raw:Z[0]}},se.del=function($){var Z=this.rules.inline.del.exec($);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},se.autolink=function($,Z){var te=this.rules.inline.autolink.exec($);if(te){var le,ce;return te[2]==="@"?(le=Y(this.options.mangle?Z(te[1]):te[1]),ce="mailto:"+le):(le=Y(te[1]),ce=le),{type:"link",raw:te[0],text:le,href:ce,tokens:[{type:"text",raw:le,text:le}]}}},se.url=function($,Z){var te;if(te=this.rules.inline.url.exec($)){var le,ce;if(te[2]==="@")le=Y(this.options.mangle?Z(te[0]):te[0]),ce="mailto:"+le;else{var Ae;do Ae=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ae!==te[0]);le=Y(te[0]),te[1]==="www."?ce="http://"+le:ce=le}return{type:"link",raw:te[0],text:le,href:ce,tokens:[{type:"text",raw:le,text:le}]}}},se.inlineText=function($,Z,te){var le=this.rules.inline.text.exec($);if(le){var ce;return Z?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):Y(le[0]):le[0]:ce=Y(this.options.smartypants?te(le[0]):le[0]),{type:"text",raw:le[0],text:ce}}},pe}(),ge=W.noopTest,he=W.edit,fe=W.merge,ae={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:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=he(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=he(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=he(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._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",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=he(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=he(ae._paragraph).replace("hr",ae.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",ae._tag).getRegex(),ae.blockquote=he(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=fe({},ae),ae.gfm=fe({},ae.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*|$)"}),ae.gfm.nptable=he(ae.gfm.nptable).replace("hr",ae.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",ae._tag).getRegex(),ae.gfm.table=he(ae.gfm.table).replace("hr",ae.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",ae._tag).getRegex(),ae.pedantic=fe({},ae.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._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:ge,paragraph:he(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,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:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=he(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=he(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=he(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=he(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=he(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=he(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=he(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=he(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=he(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=he(me._blockSkip,"g").getRegex(),me.overlapSkip=he(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=he(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=he(me.tag).replace("comment",ae._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=he(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=he(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=he(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=fe({},me),me.pedantic=fe({},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:he(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=fe({},me.normal,{escape:he(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=he(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=fe({},me.gfm,{br:he(me.br).replace("{2,}","*").getRegex(),text:he(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ae,inline:me},ne=B.defaults,Q=J.block,Ee=J.inline;function Ce(pe){return pe.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 ye(pe){var se="",de,$,Z=pe.length;for(de=0;de<Z;de++)$=pe.charCodeAt(de),Math.random()>.5&&($="x"+$.toString(16)),se+="&#"+$+";";return se}var we=function(){function pe(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ne,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Q.normal,inline:Ee.normal};this.options.pedantic?($.block=Q.pedantic,$.inline=Ee.pedantic):this.options.gfm&&($.block=Q.gfm,this.options.breaks?$.inline=Ee.breaks:$.inline=Ee.gfm),this.tokenizer.rules=$}pe.lex=function($,Z){var te=new pe(Z);return te.lex($)};var se=pe.prototype;return se.lex=function($){return $=$.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},se.blockTokens=function($,Z,te){Z===void 0&&(Z=[]),te===void 0&&(te=!0),$=$.replace(/^ +$/gm,"");for(var le,ce,Ae,_e;$;){if(le=this.tokenizer.space($)){$=$.substring(le.raw.length),le.type&&Z.push(le);continue}if(le=this.tokenizer.code($,Z)){$=$.substring(le.raw.length),le.type?Z.push(le):(_e=Z[Z.length-1],_e.raw+=`
`+le.raw,_e.text+=`
`+le.text);continue}if(le=this.tokenizer.fences($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.heading($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.nptable($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.hr($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.blockquote($)){$=$.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],te),Z.push(le);continue}if(le=this.tokenizer.list($)){for($=$.substring(le.raw.length),Ae=le.items.length,ce=0;ce<Ae;ce++)le.items[ce].tokens=this.blockTokens(le.items[ce].text,[],!1);Z.push(le);continue}if(le=this.tokenizer.html($)){$=$.substring(le.raw.length),Z.push(le);continue}if(te&&(le=this.tokenizer.def($))){$=$.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($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.lheading($)){$=$.substring(le.raw.length),Z.push(le);continue}if(te&&(le=this.tokenizer.paragraph($))){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.text($,Z)){$=$.substring(le.raw.length),le.type?Z.push(le):(_e=Z[Z.length-1],_e.raw+=`
`+le.raw,_e.text+=`
`+le.text);continue}if($){var Ue="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(Ue);break}else throw new Error(Ue)}}return Z},se.inline=function($){var Z,te,le,ce,Ae,_e,Ue=$.length;for(Z=0;Z<Ue;Z++){_e=$[Z];switch(_e.type){case"paragraph":case"text":case"heading":{_e.tokens=[],this.inlineTokens(_e.text,_e.tokens);break}case"table":{for(_e.tokens={header:[],cells:[]},ce=_e.header.length,te=0;te<ce;te++)_e.tokens.header[te]=[],this.inlineTokens(_e.header[te],_e.tokens.header[te]);for(ce=_e.cells.length,te=0;te<ce;te++)for(Ae=_e.cells[te],_e.tokens.cells[te]=[],le=0;le<Ae.length;le++)_e.tokens.cells[te][le]=[],this.inlineTokens(Ae[le],_e.tokens.cells[te][le]);break}case"blockquote":{this.inline(_e.tokens);break}case"list":{for(ce=_e.items.length,te=0;te<ce;te++)this.inline(_e.items[te].tokens);break}}}return $},se.inlineTokens=function($,Z,te,le,ce){Z===void 0&&(Z=[]),te===void 0&&(te=!1),le===void 0&&(le=!1),ce===void 0&&(ce="");var Ae,_e=$,Ue;if(this.tokens.links){var Qe=Object.keys(this.tokens.links);if(Qe.length>0)for(;(Ue=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)Qe.includes(Ue[0].slice(Ue[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ue=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Ae=this.tokenizer.escape($)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.tag($,te,le)){$=$.substring(Ae.raw.length),te=Ae.inLink,le=Ae.inRawBlock,Z.push(Ae);continue}if(Ae=this.tokenizer.link($)){$=$.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,le)),Z.push(Ae);continue}if(Ae=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,le)),Z.push(Ae);continue}if(Ae=this.tokenizer.strong($,_e,ce)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.em($,_e,ce)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.codespan($)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.br($)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.del($)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.autolink($,ye)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(!te&&(Ae=this.tokenizer.url($,ye))){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.inlineText($,le,Ce)){$=$.substring(Ae.raw.length),ce=Ae.raw.slice(-1),Z.push(Ae);continue}if($){var Ve="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return Z},V(pe,null,[{key:"rules",get:function(){return{block:Q,inline:Ee}}}]),pe}(),De=B.defaults,Pe=W.cleanUrl,ke=W.escape,Oe=function(){function pe(de){this.options=de||De}var se=pe.prototype;return se.code=function($,Z,te){var le=(Z||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight($,le);ce!=null&&ce!==$&&(te=!0,$=ce)}return le?'<pre><code class="'+this.options.langPrefix+ke(le,!0)+'">'+(te?$:ke($,!0))+`</code></pre>
`:"<pre><code>"+(te?$:ke($,!0))+`</code></pre>
`},se.blockquote=function($){return`<blockquote>
`+$+`</blockquote>
`},se.html=function($){return $},se.heading=function($,Z,te,le){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+le.slug(te)+'">'+$+"</h"+Z+`>
`:"<h"+Z+">"+$+"</h"+Z+`>
`},se.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},se.list=function($,Z,te){var le=Z?"ol":"ul",ce=Z&&te!==1?' start="'+te+'"':"";return"<"+le+ce+`>
`+$+"</"+le+`>
`},se.listitem=function($){return"<li>"+$+`</li>
`},se.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},se.paragraph=function($){return"<p>"+$+`</p>
`},se.table=function($,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
<thead>
`+$+`</thead>
`+Z+`</table>
`},se.tablerow=function($){return`<tr>
`+$+`</tr>
`},se.tablecell=function($,Z){var te=Z.header?"th":"td",le=Z.align?"<"+te+' align="'+Z.align+'">':"<"+te+">";return le+$+"</"+te+`>
`},se.strong=function($){return"<strong>"+$+"</strong>"},se.em=function($){return"<em>"+$+"</em>"},se.codespan=function($){return"<code>"+$+"</code>"},se.br=function(){return this.options.xhtml?"<br/>":"<br>"},se.del=function($){return"<del>"+$+"</del>"},se.link=function($,Z,te){if($=Pe(this.options.sanitize,this.options.baseUrl,$),$===null)return te;var le='<a href="'+ke($)+'"';return Z&&(le+=' title="'+Z+'"'),le+=">"+te+"</a>",le},se.image=function($,Z,te){if($=Pe(this.options.sanitize,this.options.baseUrl,$),$===null)return te;var le='<img src="'+$+'" alt="'+te+'"';return Z&&(le+=' title="'+Z+'"'),le+=this.options.xhtml?"/>":">",le},se.text=function($){return $},pe}(),Re=function(){function pe(){}var se=pe.prototype;return se.strong=function($){return $},se.em=function($){return $},se.codespan=function($){return $},se.del=function($){return $},se.html=function($){return $},se.text=function($){return $},se.link=function($,Z,te){return""+te},se.image=function($,Z,te){return""+te},se.br=function(){return""},pe}(),Ge=function(){function pe(){this.seen={}}var se=pe.prototype;return se.slug=function($){var Z=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var te=Z;do this.seen[te]++,Z=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},pe}(),$e=B.defaults,Be=W.unescape,He=function(){function pe(de){this.options=de||$e,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Re,this.slugger=new Ge}pe.parse=function($,Z){var te=new pe(Z);return te.parse($)};var se=pe.prototype;return se.parse=function($,Z){Z===void 0&&(Z=!0);var te="",le,ce,Ae,_e,Ue,Qe,Ve,mt,dt,ot,Ct,bt,Bt,Ut,Et,Cr,Rr,lr,pr=$.length;for(le=0;le<pr;le++){ot=$[le];switch(ot.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,Be(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(mt="",Ve="",_e=ot.header.length,ce=0;ce<_e;ce++)Ve+=this.renderer.tablecell(this.parseInline(ot.tokens.header[ce]),{header:!0,align:ot.align[ce]});for(mt+=this.renderer.tablerow(Ve),dt="",_e=ot.cells.length,ce=0;ce<_e;ce++){for(Qe=ot.tokens.cells[ce],Ve="",Ue=Qe.length,Ae=0;Ae<Ue;Ae++)Ve+=this.renderer.tablecell(this.parseInline(Qe[Ae]),{header:!1,align:ot.align[Ae]});dt+=this.renderer.tablerow(Ve)}te+=this.renderer.table(mt,dt);continue}case"blockquote":{dt=this.parse(ot.tokens),te+=this.renderer.blockquote(dt);continue}case"list":{for(Ct=ot.ordered,bt=ot.start,Bt=ot.loose,_e=ot.items.length,dt="",ce=0;ce<_e;ce++)Et=ot.items[ce],Cr=Et.checked,Rr=Et.task,Ut="",Et.task&&(lr=this.renderer.checkbox(Cr),Bt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=lr+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=lr+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:lr}):Ut+=lr),Ut+=this.parse(Et.tokens,Bt),dt+=this.renderer.listitem(Ut,Rr,Cr);te+=this.renderer.list(dt,Ct,bt);continue}case"html":{te+=this.renderer.html(ot.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(dt=ot.tokens?this.parseInline(ot.tokens):ot.text;le+1<pr&&$[le+1].type==="text";)ot=$[++le],dt+=`
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);te+=Z?this.renderer.paragraph(dt):dt;continue}default:{var fr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return te},se.parseInline=function($,Z){Z=Z||this.renderer;var te="",le,ce,Ae=$.length;for(le=0;le<Ae;le++){ce=$[le];switch(ce.type){case"escape":{te+=Z.text(ce.text);break}case"html":{te+=Z.html(ce.text);break}case"link":{te+=Z.link(ce.href,ce.title,this.parseInline(ce.tokens,Z));break}case"image":{te+=Z.image(ce.href,ce.title,ce.text);break}case"strong":{te+=Z.strong(this.parseInline(ce.tokens,Z));break}case"em":{te+=Z.em(this.parseInline(ce.tokens,Z));break}case"codespan":{te+=Z.codespan(ce.text);break}case"br":{te+=Z.br();break}case"del":{te+=Z.del(this.parseInline(ce.tokens,Z));break}case"text":{te+=Z.text(ce.text);break}default:{var _e='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(_e);return}else throw new Error(_e)}}}return te},pe}(),rt=W.merge,Je=W.checkSanitizeDeprecation,qe=W.escape,Se=B.getDefaults,Ze=B.changeDefaults,Ke=B.defaults;function Le(pe,se,de){if(typeof pe=="undefined"||pe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof pe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(pe)+", string expected");if(typeof se=="function"&&(de=se,se=null),se=rt({},Le.defaults,se||{}),Je(se),de){var $=se.highlight,Z;try{Z=we.lex(pe,se)}catch(Ae){return de(Ae)}var te=function(_e){var Ue;if(!_e)try{Ue=He.parse(Z,se)}catch(Qe){_e=Qe}return se.highlight=$,_e?de(_e):de(null,Ue)};if(!$||$.length<3)return te();if(delete se.highlight,!Z.length)return te();var le=0;Le.walkTokens(Z,function(Ae){Ae.type==="code"&&(le++,setTimeout(function(){$(Ae.text,Ae.lang,function(_e,Ue){if(_e)return te(_e);Ue!=null&&Ue!==Ae.text&&(Ae.text=Ue,Ae.escaped=!0),le--,le===0&&te()})},0))}),le===0&&te();return}try{var ce=we.lex(pe,se);return se.walkTokens&&Le.walkTokens(ce,se.walkTokens),He.parse(ce,se)}catch(Ae){if(Ae.message+=`
Please report this to https://github.com/markedjs/marked.`,se.silent)return"<p>An error occurred:</p><pre>"+qe(Ae.message+"",!0)+"</pre>";throw Ae}}Le.options=Le.setOptions=function(pe){return rt(Le.defaults,pe),Ze(Le.defaults),Le},Le.getDefaults=Se,Le.defaults=Ke,Le.use=function(pe){var se=rt({},pe);if(pe.renderer&&function(){var $=Le.defaults.renderer||new Oe,Z=function(ce){var Ae=$[ce];$[ce]=function(){for(var _e=arguments.length,Ue=new Array(_e),Qe=0;Qe<_e;Qe++)Ue[Qe]=arguments[Qe];var Ve=pe.renderer[ce].apply($,Ue);return Ve===!1&&(Ve=Ae.apply($,Ue)),Ve}};for(var te in pe.renderer)Z(te);se.renderer=$}(),pe.tokenizer&&function(){var $=Le.defaults.tokenizer||new ve,Z=function(ce){var Ae=$[ce];$[ce]=function(){for(var _e=arguments.length,Ue=new Array(_e),Qe=0;Qe<_e;Qe++)Ue[Qe]=arguments[Qe];var Ve=pe.tokenizer[ce].apply($,Ue);return Ve===!1&&(Ve=Ae.apply($,Ue)),Ve}};for(var te in pe.tokenizer)Z(te);se.tokenizer=$}(),pe.walkTokens){var de=Le.defaults.walkTokens;se.walkTokens=function($){pe.walkTokens($),de&&de($)}}Le.setOptions(se)},Le.walkTokens=function(pe,se){for(var de=I(pe),$;!($=de()).done;){var Z=$.value;se(Z);switch(Z.type){case"table":{for(var te=I(Z.tokens.header),le;!(le=te()).done;){var ce=le.value;Le.walkTokens(ce,se)}for(var Ae=I(Z.tokens.cells),_e;!(_e=Ae()).done;)for(var Ue=_e.value,Qe=I(Ue),Ve;!(Ve=Qe()).done;){var mt=Ve.value;Le.walkTokens(mt,se)}break}case"list":{Le.walkTokens(Z.items,se);break}default:Z.tokens&&Le.walkTokens(Z.tokens,se)}}},Le.Parser=He,Le.parser=He.parse,Le.Renderer=Oe,Le.TextRenderer=Re,Le.Lexer=we,Le.lexer=we.lex,Le.Tokenizer=ve,Le.Slugger=Ge,Le.parse=Le;var Ie=Le;return Ie})},ELLl:function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=re.Pos;re.defineOption("autoCloseBrackets",!1,function(T,g,d){d&&d!=re.Init&&(T.removeKeyMap(I),T.state.closeBrackets=null),g&&(R(G(g,"pairs")),T.state.closeBrackets=g,T.addKeyMap(I))});function G(T,g){return g=="pairs"&&typeof T=="string"?T:typeof T=="object"&&T[g]!=null?T[g]:V[g]}var I={Backspace:k,Enter:L};function R(T){for(var g=0;g<T.length;g++){var d=T.charAt(g),o="'"+d+"'";I[o]||(I[o]=B(d))}}R(V.pairs+"`");function B(T){return function(g){return x(g,T)}}function U(T){var g=T.state.closeBrackets;if(!g||g.override)return g;var d=T.getModeAt(T.getCursor());return d.closeBrackets||g}function k(T){var g=U(T);if(!g||T.getOption("disableInput"))return re.Pass;for(var d=G(g,"pairs"),o=T.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(T,o[u].head);if(!s||d.indexOf(s)%2!=0)return re.Pass}for(var u=o.length-1;u>=0;u--){var w=o[u].head;T.replaceRange("",A(w.line,w.ch-1),A(w.line,w.ch+1),"+delete")}}function L(T){var g=U(T),d=g&&G(g,"explode");if(!d||T.getOption("disableInput"))return re.Pass;for(var o=T.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return re.Pass;var s=O(T,o[u].head);if(!s||d.indexOf(s)%2!=0)return re.Pass}T.operation(function(){var w=T.lineSeparator()||`
`;T.replaceSelection(w+w,null),T.execCommand("goCharLeft"),o=T.listSelections();for(var p=0;p<o.length;p++){var f=o[p].head.line;T.indentLine(f,null,!0),T.indentLine(f+1,null,!0)}})}function y(T){var g=re.cmpPos(T.anchor,T.head)>0;return{anchor:new A(T.anchor.line,T.anchor.ch+(g?-1:1)),head:new A(T.head.line,T.head.ch+(g?1:-1))}}function x(T,g){var d=U(T);if(!d||T.getOption("disableInput"))return re.Pass;var o=G(d,"pairs"),u=o.indexOf(g);if(u==-1)return re.Pass;for(var s=G(d,"closeBefore"),w=G(d,"triples"),p=o.charAt(u+1)==g,f=T.listSelections(),_=u%2==0,b,h=0;h<f.length;h++){var c=f[h],l=c.head,a,v=T.getRange(l,A(l.line,l.ch+1));if(_&&!c.empty())a="surround";else if((p||!_)&&v==g)p&&C(T,l)?a="both":w.indexOf(g)>=0&&T.getRange(l,A(l.line,l.ch+3))==g+g+g?a="skipThree":a="skip";else if(p&&l.ch>1&&w.indexOf(g)>=0&&T.getRange(A(l.line,l.ch-2),l)==g+g){if(l.ch>2&&/\bstring/.test(T.getTokenTypeAt(A(l.line,l.ch-2))))return re.Pass;a="addFour"}else if(p){var m=l.ch==0?" ":T.getRange(A(l.line,l.ch-1),l);if(!re.isWordChar(v)&&m!=g&&!re.isWordChar(m))a="both";else return re.Pass}else if(_&&(v.length===0||/\s/.test(v)||s.indexOf(v)>-1))a="both";else return re.Pass;if(!b)b=a;else if(b!=a)return re.Pass}var E=u%2?o.charAt(u-1):g,M=u%2?g:o.charAt(u+1);T.operation(function(){if(b=="skip")T.execCommand("goCharRight");else if(b=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(b=="surround"){for(var j=T.getSelections(),F=0;F<j.length;F++)j[F]=E+j[F]+M;T.replaceSelections(j,"around"),j=T.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=y(j[F]);T.setSelections(j)}else b=="both"?(T.replaceSelection(E+M,null),T.triggerElectric(E+M),T.execCommand("goCharLeft")):b=="addFour"&&(T.replaceSelection(E+E+E+E,"before"),T.execCommand("goCharRight"))})}function O(T,g){var d=T.getRange(A(g.line,g.ch-1),A(g.line,g.ch+1));return d.length==2?d:null}function C(T,g){var d=T.getTokenAt(A(g.line,g.ch+1));return/\bstring/.test(d.type)&&d.start==g.ch&&(g.ch==0||!/\bstring/.test(T.getTokenTypeAt(g)))}})},GfqC:function(st,ze,q){"use strict";var re=q("cDcd"),V=q.n(re),A=q("TSYQ"),G=q.n(A);function I(W,D){var P="cannot "+W.method+" "+W.action+" "+D.status+"'",H=new Error(P);return H.status=D.status,H.method=W.method,H.url=W.action,H}function R(W){var D=W.responseText||W.response;if(!D)return D;try{return JSON.parse(D)}catch(P){return D}}function B(W){var D=new XMLHttpRequest;W.onProgress&&D.upload&&(D.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var P=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var ee=W.data[Y];if(Array.isArray(ee)){ee.forEach(function(oe){P.append(Y+"[]",oe)});return}P.append(Y,W.data[Y])}),W.file instanceof Blob?P.append(W.filename,W.file,W.file.name):P.append(W.filename,W.file),D.onerror=function(ee){W.onError(ee)},D.onload=function(){return D.status<200||D.status>=300?W.onError(I(W,D),R(D)):W.onSuccess(R(D),D)},D.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in D&&(D.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&D.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(Y){H[Y]!==null&&D.setRequestHeader(Y,H[Y])}),D.send(P),{abort:function(){D.abort()}}}var U=+new Date,k=0;function L(){return"rc-upload-"+U+"-"+ ++k}function y(W,D){return W.indexOf(D,W.length-D.length)!==-1}var x=function(W,D){if(W&&D){var P=Array.isArray(D)?D:D.split(","),H=W.name||"",Y=W.type||"",ee=Y.replace(/\/.*$/,"");return P.some(function(oe){var Te=oe.trim();return Te.charAt(0)==="."?y(H.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?ee===Te.replace(/\/.*$/,""):Y===Te})}return!0};function O(W,D){var P=W.createReader(),H=[];function Y(){P.readEntries(function(ee){var oe=Array.prototype.slice.apply(ee);H=H.concat(oe);var Te=!oe.length;Te?D(H):Y()})}Y()}var C=function(D,P,H){var Y=function ee(oe,Te){Te=Te||"",oe.isFile?oe.file(function(ve){H(ve)&&(oe.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),P([ve]))}):oe.isDirectory&&O(oe,function(ve){ve.forEach(function(ge){ee(ge,""+Te+oe.name+"/")})})};D.forEach(function(ee){Y(ee.webkitGetAsEntry())})},T=C,g=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var P=arguments[D];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},d=function(){function W(D,P){var H=[],Y=!0,ee=!1,oe=void 0;try{for(var Te=D[Symbol.iterator](),ve;!(Y=(ve=Te.next()).done)&&!(H.push(ve.value),P&&H.length===P);Y=!0);}catch(ge){ee=!0,oe=ge}finally{try{!Y&&Te.return&&Te.return()}finally{if(ee)throw oe}}return H}return function(D,P){if(Array.isArray(D))return D;if(Symbol.iterator in Object(D))return W(D,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(D,P){for(var H=0;H<P.length;H++){var Y=P[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,P,H){return P&&W(D.prototype,P),H&&W(D,H),D}}();function u(W,D,P){return D in W?Object.defineProperty(W,D,{value:P,enumerable:!0,configurable:!0,writable:!0}):W[D]=P,W}function s(W,D){var P={};for(var H in W){if(D.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;P[H]=W[H]}return P}function w(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function p(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function f(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}var _=function(D){return Object.keys(D).reduce(function(P,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(P[H]=D[H]),P},{})},b=function(W){f(D,W);function D(){var P,H,Y,ee;w(this,D);for(var oe=arguments.length,Te=Array(oe),ve=0;ve<oe;ve++)Te[ve]=arguments[ve];return ee=(H=(Y=p(this,(P=D.__proto__||Object.getPrototypeOf(D)).call.apply(P,[this].concat(Te))),Y),Y.state={uid:L()},Y.reqs={},Y.onChange=function(ge){var he=ge.target.files;Y.uploadFiles(he),Y.reset()},Y.onClick=function(ge){var he=Y.fileInput;if(!he)return;var fe=Y.props,ae=fe.children,me=fe.onClick;ae&&ae.type==="button"&&(he.parentNode.focus(),he.parentNode.querySelector("button").blur()),he.click(),me&&me(ge)},Y.onKeyDown=function(ge){ge.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(ge){var he=Y.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(Y.props.directory)T(Array.prototype.slice.call(ge.dataTransfer.items),Y.uploadFiles,function(ae){return x(ae,Y.props.accept)});else{var fe=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(ae){return x(ae,Y.props.accept)});he===!1&&(fe=fe.slice(0,1)),Y.uploadFiles(fe)}},Y.uploadFiles=function(ge){var he=Array.prototype.slice.call(ge);he.map(function(fe){return fe.uid=L(),fe}).forEach(function(fe){Y.upload(fe,he)})},Y.saveFileInput=function(ge){Y.fileInput=ge},H),p(Y,ee)}return o(D,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,Y){var ee=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var Te=oe.beforeUpload(H,Y);Te&&Te.then?Te.then(function(ve){var ge=Object.prototype.toString.call(ve);return ge==="[object File]"||ge==="[object Blob]"?ee.post(ve):ee.post(H)}).catch(function(ve){console.log(ve)}):Te!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var Y=this;if(!this._isMounted)return;var ee=this.props,oe=ee.onStart,Te=ee.onProgress,ve=ee.transformFile,ge=ve===void 0?function(he){return he}:ve;new Promise(function(he){var fe=ee.action;return typeof fe=="function"&&(fe=fe(H)),he(fe)}).then(function(he){var fe=H.uid,ae=ee.customRequest||B,me=Promise.resolve(ge(H)).then(function(J){var ne=ee.data;return typeof ne=="function"&&(ne=ne(J)),Promise.all([J,ne])}).catch(function(J){console.error(J)});me.then(function(J){var ne=d(J,2),Q=ne[0],Ee=ne[1],Ce={action:he,filename:ee.name,data:Ee,file:Q,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:Te?function(ye){Te(ye,H)}:null,onSuccess:function(we,De){delete Y.reqs[fe],ee.onSuccess(we,H,De)},onError:function(we,De){delete Y.reqs[fe],ee.onError(we,De,H)}};oe(H),Y.reqs[fe]=ae(Ce)})})}},{key:"reset",value:function(){this.setState({uid:L()})}},{key:"abort",value:function(H){var Y=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),Y[ee]&&Y[ee].abort&&Y[ee].abort(),delete Y[ee]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var H,Y=this.props,ee=Y.component,oe=Y.prefixCls,Te=Y.className,ve=Y.disabled,ge=Y.id,he=Y.style,fe=Y.multiple,ae=Y.accept,me=Y.children,J=Y.directory,ne=Y.openFileDialogOnClick,Q=Y.onMouseEnter,Ee=Y.onMouseLeave,Ce=s(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=G()((H={},u(H,oe,!0),u(H,oe+"-disabled",ve),u(H,Te,Te),H)),we=ve?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:Q,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(ee,g({},we,{className:ye,role:"button",style:he}),V.a.createElement("input",g({},_(Ce),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(Pe){return Pe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:fe,onChange:this.onChange})),me)}}]),D}(re.Component),h=b,c=Object.assign||function(W){for(var D=1;D<arguments.length;D++){var P=arguments[D];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},l=function(){function W(D,P){for(var H=0;H<P.length;H++){var Y=P[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(D,Y.key,Y)}}return function(D,P,H){return P&&W(D.prototype,P),H&&W(D,H),D}}();function a(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function v(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function m(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}function E(){}var M=function(W){m(D,W);function D(){var P,H,Y,ee;a(this,D);for(var oe=arguments.length,Te=Array(oe),ve=0;ve<oe;ve++)Te[ve]=arguments[ve];return ee=(H=(Y=v(this,(P=D.__proto__||Object.getPrototypeOf(D)).call.apply(P,[this].concat(Te))),Y),Y.saveUploader=function(ge){Y.uploader=ge},H),v(Y,ee)}return l(D,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return V.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),D}(re.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=ze.a=F},HmJG:function(st,ze,q){},LdHM:function(st,ze,q){"use strict";q.d(ze,"b",function(){return s}),q.d(ze,"a",function(){return p});var re=q("1OyB"),V=q("vuIU"),A=q("Ji7U"),G=q("LK+K"),I=q("cDcd"),R=q("rePB"),B=q("Ff2n"),U=q("ODXe"),k=q("4IlW"),L=q("bX4T"),y=q("YrtM"),x=q("TSYQ"),O=q.n(x),C=q("+nKL"),T=q("8OUc"),g=function(H,Y){var ee=H.prefixCls,oe=H.id,Te=H.flattenOptions,ve=H.childrenAsData,ge=H.values,he=H.searchValue,fe=H.multiple,ae=H.defaultActiveFirstOption,me=H.height,J=H.itemHeight,ne=H.notFoundContent,Q=H.open,Ee=H.menuItemSelectedIcon,Ce=H.virtual,ye=H.onSelect,we=H.onToggleOpen,De=H.onActiveValue,Pe=H.onScroll,ke=H.onMouseEnter,Oe="".concat(ee,"-item"),Re=Object(y.a)(function(){return Te},[Q,Te],function(Ie,pe){return pe[0]&&Ie[1]!==pe[1]}),Ge=I.useRef(null),$e=function(pe){pe.preventDefault()},Be=function(pe){Ge.current&&Ge.current.scrollTo({index:pe})},He=function(pe){for(var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Re.length,$=0;$<de;$+=1){var Z=(pe+$*se+de)%de,te=Re[Z],le=te.group,ce=te.data;if(!le&&!ce.disabled)return Z}return-1},rt=I.useState(function(){return He(0)}),Je=Object(U.a)(rt,2),qe=Je[0],Se=Je[1],Ze=function(pe){Se(pe);var se=Re[pe];if(!se){De(null,-1);return}De(se.data.value,pe)};I.useEffect(function(){Ze(ae!==!1?He(0):-1)},[Re.length,he]),I.useEffect(function(){var Ie=setTimeout(function(){if(!fe&&Q&&ge.size===1){var pe=Array.from(ge)[0],se=Re.findIndex(function(de){var $=de.data;return $.value===pe});Ze(se),Be(se)}});return function(){return clearTimeout(Ie)}},[Q]);var Ke=function(pe){pe!==void 0&&ye(pe,{selected:!ge.has(pe)}),fe||we(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(pe){var se=pe.which;switch(se){case k.a.UP:case k.a.DOWN:{var de=0;if(se===k.a.UP?de=-1:se===k.a.DOWN&&(de=1),de!==0){var $=He(qe+de,de);Be($),Ze($)}break}case k.a.ENTER:{var Z=Re[qe];Z&&!Z.data.disabled?Ke(Z.data.value):Ke(void 0),Q&&pe.preventDefault();break}case k.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(pe){Be(pe)}}}),Re.length===0)return I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Oe,"-empty"),onMouseDown:$e},ne);function Le(Ie){var pe=Re[Ie];if(!pe)return null;var se=pe.data||{},de=se.value,$=se.label,Z=se.children,te=Object(L.a)(se,!0),le=ve?Z:$;return pe?I.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},te,{key:Ie,role:"option",id:"".concat(oe,"_list_").concat(Ie),"aria-selected":ge.has(de)}),de):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Le(qe-1),Le(qe),Le(qe+1)),I.createElement(C.a,{itemKey:"key",ref:Ge,data:Re,height:me,itemHeight:J,fullHeight:!1,onMouseDown:$e,onScroll:Pe,virtual:Ce,onMouseEnter:ke},function(Ie,pe){var se,de=Ie.group,$=Ie.groupOption,Z=Ie.data,te=Z.label,le=Z.key;if(de)return I.createElement("div",{className:O()(Oe,"".concat(Oe,"-group"))},te!==void 0?te:le);var ce=Z.disabled,Ae=Z.value,_e=Z.title,Ue=Z.children,Qe=Z.style,Ve=Z.className,mt=Object(B.a)(Z,["disabled","value","title","children","style","className"]),dt=ge.has(Ae),ot="".concat(Oe,"-option"),Ct=O()(Oe,ot,Ve,(se={},Object(R.a)(se,"".concat(ot,"-grouped"),$),Object(R.a)(se,"".concat(ot,"-active"),qe===pe&&!ce),Object(R.a)(se,"".concat(ot,"-disabled"),ce),Object(R.a)(se,"".concat(ot,"-selected"),dt),se)),bt=ve?Ue:te,Bt=!Ee||typeof Ee=="function"||dt;return I.createElement("div",Object.assign({},mt,{"aria-selected":dt,className:Ct,title:_e,onMouseMove:function(){if(qe===pe||ce)return;Ze(pe)},onClick:function(){ce||Ke(Ae)},style:Qe}),I.createElement("div",{className:"".concat(ot,"-content")},bt||Ae),I.isValidElement(Ee)||dt,Bt&&I.createElement(T.a,{className:"".concat(Oe,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:dt}},dt?"\u2713":null))}))},d=I.forwardRef(g);d.displayName="OptionList";var o=d,u=function(){return null};u.isSelectOption=!0;var s=u,w=function(){return null};w.isSelectOptGroup=!0;var p=w,f=q("VTBJ"),_=q("Zm9Q");function b(P){var H=P.key,Y=P.props,ee=Y.children,oe=Y.value,Te=Object(B.a)(Y,["children","value"]);return Object(f.a)({key:H,value:oe!==void 0?oe:H,children:ee},Te)}function h(P){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(P).map(function(Y,ee){if(!I.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,Te=Y.key,ve=Y.props,ge=ve.children,he=Object(B.a)(ve,["children"]);return H||!oe?b(Y):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ee:Te,"__"),label:Te},he),{},{options:h(ge)})}).filter(function(Y){return Y})}var c=q("2Qr1"),l=q("qNPg"),a=q("U8pU"),v=q("Kwbf"),m=q("WKfj");function E(P){var H=P.mode,Y=P.options,ee=P.children,oe=P.backfill,Te=P.allowClear,ve=P.placeholder,ge=P.getInputElement,he=P.showSearch,fe=P.onSearch,ae=P.defaultOpen,me=P.autoFocus,J=P.labelInValue,ne=P.value,Q=P.inputValue,Ee=P.optionLabelProp,Ce=H==="multiple"||H==="tags",ye=he!==void 0?he:Ce||H==="combobox",we=Y||h(ee);if(Object(v.a)(H!=="tags"||we.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var De=we.some(function(Oe){return Oe.options?Oe.options.some(function(Re){return typeof("value"in Re?Re.value:Re.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(v.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!ge||!Te||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!ye&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ae||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Pe=Object(m.d)(ne);Object(v.a)(!J||Pe.every(function(Oe){return Object(a.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Ce||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var ke=null;Object(_.a)(ee).some(function(Oe){if(!I.isValidElement(Oe)||!Oe.type)return!1;var Re=Oe.type;if(Re.isSelectOption)return!1;if(Re.isSelectOptGroup){var Ge=Object(_.a)(Oe.props.children).every(function($e){return!I.isValidElement($e)||!Oe.type||$e.type.isSelectOption?!0:(ke=$e.type,!1)});return!Ge}return ke=Re,!0}),ke&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(v.a)(Q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=E,F=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(P){Object(A.a)(Y,P);var H=Object(G.a)(Y);function Y(){var ee;return Object(re.a)(this,Y),ee=H.apply(this,arguments),ee.selectRef=I.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(V.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=s,j.OptGroup=p;var W=j,D=ze.c=W},M8RZ:function(st,ze,q){"use strict";q.d(ze,"a",function(){return k});var re=q("fWQN"),V=q("mtLc"),A=q("yKVA"),G=q("879j"),I=q("cDcd"),R=q.n(I),B=q("faye"),U=q.n(B),k=function(L){Object(A.a)(x,L);var y=Object(G.a)(x);function x(O){var C;Object(re.a)(this,x),C=y.call(this,O);var T=window.document;return C.node=T.createElement("div"),T.body.appendChild(C.node),C}return Object(V.a)(x,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),x}(R.a.Component)},Ot1p:function(st,ze,q){"use strict";var re=q("2qtc"),V=q("kLXV"),A=q("rAM+"),G=q("miYZ"),I=q("tsqr"),R=q("9og8"),B=q("tJVT"),U=q("jrin"),k=q("WmNS"),L=q.n(k),y=q("cDcd"),x=q.n(y),O=q("VrN/"),C=q.n(O),T=q("bdgK"),g=q("p77/"),d=q("Bd2K"),o=q("ELLl"),u=q("19Vz"),s=q("lZu9"),w=q("+NIl"),p=q("kSUc"),f=q("9Bee"),_=function(ce){var Ae=ce.value,_e=Ae===void 0?"":Ae,Ue=ce.className,Qe=ce.showTextOnly,Ve=ce.showLines,mt=ce.style,dt=mt===void 0?{}:mt,ot=Object(y.useMemo)(function(){return""},[_e]);return x.a.createElement(x.a.Fragment,null,x.a.createElement("div",{dangerouslySetInnerHTML:{__html:ot}}))},b=q("0Owb"),h=q("dejd"),c=q("C+DQ"),l=q("1vsH"),a=q("m3rI"),v=[{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 m(ce){var Ae=ce.onActionCallback,_e=ce.title,Ue=ce.icon,Qe=ce.actionName,Ve=ce.className,mt=Ve===void 0?"":Ve,dt=ce.children;function ot(){Ae(Qe)}return x.a.createElement("a",{title:_e,className:mt,onClick:ot},x.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),dt)}var E=function(ce){var Ae=ce.watch,_e=ce.showNullButton,Ue=ce.onActionCallback,Qe=ce.fullScreen,Ve=ce.insertTemp,mt=ce.hidetoolBar,dt=ce.uuid,ot=ce.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(v,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return x.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Ct.map(function(bt,Bt){return x.a.createElement("li",{key:Bt},bt.actionName?x.a.createElement(m,Object(b.a)({},bt,{onActionCallback:Ue})):x.a.createElement("span",{className:"v-line"}))}),_e?x.a.createElement("li",null,x.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},x.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ve&&x.a.createElement("li",null,x.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ve),onActionCallback:Ue},x.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),x.a.createElement("li",{className:"btn-full-screen"},x.a.createElement(m,{icon:"".concat(Qe?"icon-shrink":"icon-enlarge"),title:Qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},M=q("M8RZ"),F=q("+L6B"),j=q("2/Rp"),W=q("y8nQ"),D=q("Vl3Y"),P=q("5NDa"),H=q("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ee=function(ce){var Ae=ce.callback,_e=ce.onCancel;function Ue(Qe){Ae(Qe)}return x.a.createElement(D.a,Object(b.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),x.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},x.a.createElement(H.a,null)),x.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},x.a.createElement(H.a,null)),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},oe=q("7ahc"),Te=q("HmJG"),ve=q("BjJ7"),ge=D.a.useForm,he={width:280,marginRight:10},fe={labelCol:{span:5},wrapperCol:{span:19}},ae=function(ce){var Ae=ce.callback,_e=ce.onCancel,Ue=ge(),Qe=Object(B.a)(Ue,1),Ve=Qe[0];function mt(Ct){Ae(Ct)}function dt(Ct,bt){if(Ct.status===-1){I.b.error(Ct.message);return}Ve.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:bt.type})}function ot(Ct){var bt=Ct.target.files[0];J(bt,dt)}return x.a.createElement(D.a,Object(b.a)({form:Ve},fe,{className:"upload-image-panel",onFinish:mt}),x.a.createElement(D.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},x.a.createElement("div",{className:"flex-container"},x.a.createElement(D.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},x.a.createElement(H.a,{style:he})),x.a.createElement(me,{onFileChange:ot}))),x.a.createElement(D.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},x.a.createElement(H.a,{style:{width:264}})),x.a.createElement(D.a.Item,{style:{textAlign:"right"}},x.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))};function me(ce){var Ae=ce.onFileChange;return x.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",x.a.createElement("input",{type:"file",onChange:Ae}))}function J(ce,Ae){if(!ce)throw new String("\u6CA1\u6709\u6587\u4EF6");var _e=new FormData;_e.append("editormd-image-file",ce),_e.append("file_param_name","editormd-image-file"),_e.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Qe){Ae(JSON.parse(Qe.target.responseText),ce)},!1),Ue.addEventListener("error",function(Qe){console.error(Qe)},!1),Ue.open("POST","".concat(ve.a,"/api/attachments.json")),Ue.send(_e)}var ne=q("giR+"),Q=q("fyUT"),Ee=q("7Kak"),Ce=q("9yH6"),ye=Ce.a.Group,we={margin:"0 8px"},De=function(ce){var Ae=ce.callback,_e=ce.onCancel;function Ue(Qe){Ae(Qe)}return x.a.createElement(D.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},x.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},x.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),x.a.createElement("span",{style:we},"\u884C\u6570"),x.a.createElement(D.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},x.a.createElement(Q.a,null)),x.a.createElement("span",{style:we},"\u5217\u6570"),x.a.createElement(D.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},x.a.createElement(Q.a,null))),x.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},x.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),x.a.createElement(D.a.Item,{name:"align"},x.a.createElement(ye,null,x.a.createElement(Ce.a,{value:"default"},x.a.createElement("i",{className:"fa fa-align-justify"})),x.a.createElement(Ce.a,{value:"left"},x.a.createElement("i",{className:"fa fa-align-left"})),x.a.createElement(Ce.a,{value:"center"},x.a.createElement("i",{className:"fa fa-align-center"})),x.a.createElement(Ce.a,{value:"right"},x.a.createElement("i",{className:"fa fa-align-right"}))))),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},Pe=q("ErOA"),ke=q("7Cbv"),Oe="link",Re="upload-image",Ge="code-block",$e="add-table",Be="------------",He={default:Be,left:":".concat(Be),center:":".concat(Be,":"),right:"".concat(Be,":")},rt=q("9VGf"),Je,qe;function Se(){}var Ze=0,Ke=1e4,Le="\u2581",Ie=`
**\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 pe(ce){return/^\d+$/.test(ce)?"".concat(ce,"px"):ce}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=se?"Cmd":"Ctrl",$=["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"],Z=(Je={},Object(U.a)(Je,de+"-B","bold"),Object(U.a)(Je,de+"-I","italic"),Je),te=(qe={},Object(U.a)(qe,Oe,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(qe,Ge,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(qe,Re,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(qe,$e,"\u6DFB\u52A0\u8868\u683C"),qe),le=ze.a=function(ce){var Ae=ce.defaultValue,_e=Ae===void 0?"":Ae,Ue=ce.onChange,Qe=ce.width,Ve=Qe===void 0?"100%":Qe,mt=ce.height,dt=mt===void 0?400:mt,ot=ce.miniToolbar,Ct=ot===void 0?!1:ot,bt=ce.isFocus,Bt=bt===void 0?!1:bt,Ut=ce.watch,Et=ce.insertTemp,Cr=ce.mode,Rr=Cr===void 0?"markdown":Cr,lr=ce.id,pr=lr===void 0?"markdown-editor-id":lr,fr=ce.showResizeBar,ia=fr===void 0?!1:fr,_r=ce.noStorage,Hn=_r===void 0?!1:_r,Kn=ce.showNullButton,Rt=Kn===void 0?!1:Kn,nt=ce.hidetoolBar,Pr=nt===void 0?!1:nt,mn=ce.fullScreen,Qt=mn===void 0?!1:mn,Tt=ce.onBlur,gr=ce.onCMBeforeChange,Mr=ce.onFullScreen,pn=ce.className,Ne=pn===void 0?"":pn,ct=ce.disablePaste,Gn=ct===void 0?!1:ct,gn=ce.placeholder,vn=gn===void 0?"":gn,Zr=ce.values,yn=Zr===void 0?"":Zr,ht=Object(y.useState)(null),_i=Object(B.a)(ht,2),je=_i[0],bn=_i[1],hr=Object(y.useState)(_e),zn=Object(B.a)(hr,2),Qr=zn[0],vr=zn[1],Vn=Object(y.useState)(Ut),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Ai=Object(y.useState)(Qt),$n=Object(B.a)(Ai,2),br=$n[0],Li=$n[1],aa=Object(y.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(y.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Zn=qr[1],sa=Object(y.useState)(dt),Di=Object(B.a)(sa,2),Oi=Di[0],En=Di[1],Ri=Object(y.useState)(!1),Pi=Object(B.a)(Ri,2),la=Pi[0],xn=Pi[1],en=Object(y.useRef)(Object(ke.a)()),tn=Object(y.useRef)(!1),Tn=Object(y.useRef)(),kr=Object(y.useRef)(),Ir=Object(y.useRef)(),Ur=Object(y.useRef)(),Sn=Object(y.useRef)(),Mi=function(){var it=Object(R.a)(L.a.mark(function ft(){var lt,gt;return L.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(Pe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=At.sent,gt!=null&&(lt=gt.attachments)!==null&&lt!==void 0&&lt.length&&(console.log("cm:",je,kr),gt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?je.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?je.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?je.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):je.replaceSelection("[".concat(yt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return At.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(y.useEffect)(function(){vr(yn),je==null||je.setValue(yn)},[yn]),Object(y.useEffect)(function(){Mr==null||Mr(br)},[br]),Object(y.useEffect)(function(){if(kr.current){var it=C.a.fromTextArea(kr.current,{mode:Rr,lineNumbers:!Ct,lineWrapping:!0,value:_e,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(lt,gt){if(Gn){gt.preventDefault();return}var xt=gt.clipboardData;if(xt){var At=xt.types.toString(),yt=xt.items;if(At==="Files"||xt.types.indexOf("Files")>-1){if(gt.preventDefault(),Rr=="stex")return;try{var Ft,qt=yt[1];((Ft=yt[0])===null||Ft===void 0?void 0:Ft.kind)==="file"&&(qt=yt[0]);var vt=qt.getAsFile(),Fr=vt.name.split(".").pop();J(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):$.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(lt,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,gt){Ir.current.classList.add("mouse-hover-md");var xt;if(xt=gt.dataTransfer.files,xt.length>0){gt.preventDefault(),gt.stopPropagation();for(var At=function(qt){var vt=xt[qt],Fr=vt.name.split(".").pop();J(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):$.includes(Fr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},yt=0;yt<xt.length;yt++)At(yt)}}),bn(it),function(){it.off("paste",ft)}}},[]);var ur=Object(y.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Oi,Ir,br]);Object(y.useEffect)(function(){function it(){var lt=new T.default(function(gt){var xt=Object(A.a)(gt),At;try{for(xt.s();!(At=xt.n()).done;){var yt=At.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(ur(),je.setSize("100%","100%"),je.refresh())}}catch(Ft){xt.e(Ft)}finally{xt.f()}});return lt.observe(kr.current.parentElement),lt}if(je){var ft=it();return function(){ft.unobserve(kr.current.parentElement)}}},[je,ur]),Object(y.useEffect)(function(){if(je){for(var it=[],ft=function(){var yt=gt[lt];xt=Object(B.a)(yt,2);var Ft=xt[0],qt=xt[1],vt=Object(U.a)({},Ft,function(){ki(qt)});it.push(vt),je.addKeyMap(vt)},lt=0,gt=Object.entries(Z);lt<gt.length;lt++){var xt;ft()}return Tn.current=setInterval(function(){tn.current&&Mi()},4e3),function(){clearInterval(Tn.current);var At=Object(A.a)(it),yt;try{for(At.s();!(yt=At.n()).done;){var Ft=yt.value;je.removeKeyMap(Ft)}}catch(qt){At.e(qt)}finally{At.f()}}}},[je]),Object(y.useEffect)(function(){Qt!==br&&Li(Qt)},[Qt]),Object(rt.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(pr);it>=Er+Ke&&(!ft||ft!==Qr)&&(window.sessionStorage.setItem(pr,Qr),xn(!0))}},Ke),Object(y.useEffect)(function(){Yn(Ut)},[je,Ut]),Object(y.useEffect)(function(){je&&(Bt&&je.focus())},[je,Bt]),Object(y.useEffect)(function(){if(yr&&je){var it=je.getScrollerElement();function ft(lt){var gt=lt.target;if(Sn.current){var xt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*xt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[je,yr]),Object(y.useEffect)(function(){if(je&&gr){function it(ft,lt){gr(ft,lt)}return je.on("beforeChange",it),function(){je.off("beforeChange",it)}}},[je,gr]),Object(y.useEffect)(function(){if(je&&Tt){function it(){Tt(je.getValue())}return je.on("blur",it),function(){je.off("blur",it)}}},[je,Tt]),Object(y.useEffect)(function(){if(je){function it(ft){var lt=ft.getValue();vr(lt),Zn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(lt)}return je.on("change",it),function(){je.off("change",it)}}},[je,Ue]),Object(y.useEffect)(function(){je&&(_e==null?(je.setValue(""),vr("")):_e!==je.getValue()&&(je.setValue(_e),vr(_e),je.setCursor(je.lineCount(),0)))},[je,_e]);var ki=Object(y.useCallback)(function(it){var ft=je.getCursor(),lt=je.getSelection(),gt=lt.split(`
`);switch(it){case"bold":return je.replaceSelection("**"+lt+"**"),lt===""&&je.setCursor(ft.line,ft.ch+2),je.focus();case"italic":return je.replaceSelection("*"+lt+"*"),lt===""&&je.setCursor(ft.line,ft.ch+1),je.focus();case"code":return je.replaceSelection("`"+lt+"`"),lt===""&&je.setCursor(ft.line,ft.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+lt+"$$`"),lt===""&&je.setCursor(ft.line,ft.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+lt+"\n```"),je.setCursor(ft.line+1,lt.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
`),je.focus();case"list-ul":return lt===""?je.replaceSelection("- "+lt):je.replaceSelection(gt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
`)),je.focus();case"list-ol":return lt===""?je.replaceSelection("1. "+lt):je.replaceSelection(gt.map(function(xt,At){return xt===""?"":"".concat(At+1,". ").concat(xt)}).join(`
`)),je.focus();case"add-null-ch":return lt===""&&je.setCursor(ft.line,ft.ch+1),je.replaceSelection(Le),je.focus();case"inster-template-1":return lt===""&&je.setCursor(ft.line,ft.ch),je.replaceSelection(Ie),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return Yn(!yr),je.focus();case"trigger-full-screen":return Li(!br),je.focus();case Oe:Wr(Oe);return;case Ge:Wr(Ge);return;case Re:Wr(Re);return;case $e:Wr($e);return;default:throw new Error}},[je,yr,br]),wn=Object(y.useCallback)(function(it){Wr("");switch($t){case Oe:var ft=it.title,lt=it.link;return je.replaceSelection("[".concat(ft,"](").concat(lt,")")),je.focus();case Ge:var gt=it.language,xt=it.content;return je.replaceSelection(["```"+gt,xt,"```"].join(`
`)),je.focus();case Re:var At=it.src,yt=it.alt;return yt?je.replaceSelection("![ ".concat(yt," ]( ").concat(At,' "').concat(yt,'" )')):je.replaceSelection("![,](".concat(At,")")),je.focus();case $e:for(var Ft=it.row,qt=it.col,vt=it.align,Fr=`
`,St=0;St<Ft;St++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)St===1&&Vt.push(He[vt]),er.push(" ");St===1&&(Fr+="| ".concat(Vt.join(" | "),` |
`)),Fr+="| ".concat(er.join(qt===1?"":" | "),` |
`)}return je.replaceSelection(Fr+`
`),je.focus();default:throw new Error}},[je,$t]),Qn=Object(y.useMemo)(function(){switch($t){case Oe:return x.a.createElement(ee,{callback:wn,onCancel:Hr});case Ge:return x.a.createElement(oe.b,{callback:wn,onCancel:Hr});case Re:return x.a.createElement(ae,{callback:wn,onCancel:Hr});case $e:return x.a.createElement(De,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(y.useEffect)(function(){if(Ur.current){var it=Ur.current,ft=!1,lt=0;function gt(yt){ft=!0,lt=yt.pageY}function xt(){ft=!1}function At(yt){if(ft){var Ft=yt.pageY-lt;Ft<0&&(Ft=0),Ft>300&&(Ft=300);var qt=dt+Ft+"px";En(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",xt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",xt)}}},[je,Ur]),Object(y.useEffect)(function(){En(dt)},[dt]);var Ar=pe(Ve),qn=pe(Oi),xr={width:Ar,height:qn},ei=Object(y.useMemo)(function(){if(Er){var it=new Date(Er),ft=it.getHours(),lt=it.getMinutes(),gt=it.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,gt=gt<10?"0"+gt:gt,"".concat(ft,":").concat(lt,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(pr),xn(!1),Zn(0)}function rn(){xn(!1),Zn(0),je.setValue(window.sessionStorage.getItem(pr))}function ua(it,ft){var lt=je.getValue();lt=lt.replace(it,ft),vr(lt),je==null||je.setValue(lt)}return x.a.createElement(y.Fragment,null,x.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},x.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(yr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(br?"full-screen":""),style:xr},x.a.createElement(E,{insertTemp:Et,watch:yr,fullScreen:br,showNullButton:Rt,onActionCallback:ki,hidetoolBar:Pr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),x.a.createElement("div",{className:"markdown-editor-body"},x.a.createElement("div",{className:"codemirror-container"},x.a.createElement("textarea",{ref:kr,placeholder:vn})),yr?x.a.createElement("div",{ref:Sn,className:"preview-container"},Rr==="stex"&&x.a.createElement(_,{value:Qr}),Rr!=="stex"&&x.a.createElement(f.a,{edit:!0,value:Qr,replaces:ua})):null))),ia?x.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,x.a.createElement(M.a,null,te[$t]?x.a.createElement(V.a,{centered:!0,title:te[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Qn):null))}},SJMd:function(st,ze){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var q,re,V,A=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var U=window,k=["break,continue,do,else,for,if,return,while"],L=[k,"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"],y=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[y,"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"],O=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],T="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",g=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[k,"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"],u=[k,"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=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[x,C,O,g,d,o,u,s],p=/^(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",_="kwd",b="com",h="typ",c="lit",l="pun",a="pln",v="tag",m="dec",E="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function D(ye){for(var we=0,De=!1,Pe=!1,ke=0,Oe=ye.length;ke<Oe;++ke){var Re=ye[ke];if(Re.ignoreCase)Pe=!0;else if(/[a-z]/i.test(Re.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Pe=!1;break}}var Ge={b:8,t:9,n:10,v:11,f:12,r:13};function $e(qe){var Se=qe.charCodeAt(0);if(Se!==92)return Se;var Ze=qe.charAt(1);return Se=Ge[Ze],Se||("0"<=Ze&&Ze<="7"?parseInt(qe.substring(1),8):Ze==="u"||Ze==="x"?parseInt(qe.substring(2),16):qe.charCodeAt(1))}function Be(qe){if(qe<32)return(qe<16?"\\x0":"\\x")+qe.toString(16);var Se=String.fromCharCode(qe);return Se==="\\"||Se==="-"||Se==="]"||Se==="^"?"\\"+Se:Se}function He(qe){var Se=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")),Ze=[],Ke=Se[0]==="^",Le=["["];Ke&&Le.push("^");for(var Ie=Ke?1:0,pe=Se.length;Ie<pe;++Ie){var se=Se[Ie];if(/\\[bdsw]/i.test(se))Le.push(se);else{var de=$e(se),$;Ie+2<pe&&Se[Ie+1]==="-"?($=$e(Se[Ie+2]),Ie+=2):$=de,Ze.push([de,$]),$<65||de>122||($<65||de>90||Ze.push([Math.max(65,de)|32,Math.min($,90)|32]),$<97||de>122||Ze.push([Math.max(97,de)&~32,Math.min($,122)&~32]))}}Ze.sort(function(ce,Ae){return ce[0]-Ae[0]||Ae[1]-ce[1]});for(var Z=[],te=[],Ie=0;Ie<Ze.length;++Ie){var le=Ze[Ie];le[0]<=te[1]+1?te[1]=Math.max(te[1],le[1]):Z.push(te=le)}for(var Ie=0;Ie<Z.length;++Ie){var le=Z[Ie];Le.push(Be(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Le.push("-"),Le.push(Be(le[1])))}return Le.push("]"),Le.join("")}function rt(qe){for(var Se=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")),Ze=Se.length,Ke=[],Le=0,Ie=0;Le<Ze;++Le){var pe=Se[Le];if(pe==="(")++Ie;else if(pe.charAt(0)==="\\"){var se=+pe.substring(1);se&&(se<=Ie?Ke[se]=-1:Se[Le]=Be(se))}}for(var Le=1;Le<Ke.length;++Le)Ke[Le]===-1&&(Ke[Le]=++we);for(var Le=0,Ie=0;Le<Ze;++Le){var pe=Se[Le];if(pe==="(")++Ie,Ke[Ie]||(Se[Le]="(?:");else if(pe.charAt(0)==="\\"){var se=+pe.substring(1);se&&se<=Ie&&(Se[Le]="\\"+Ke[se])}}for(var Le=0;Le<Ze;++Le)Se[Le]==="^"&&Se[Le+1]!=="^"&&(Se[Le]="");if(qe.ignoreCase&&De)for(var Le=0;Le<Ze;++Le){var pe=Se[Le],de=pe.charAt(0);pe.length>=2&&de==="["?Se[Le]=He(pe):de!=="\\"&&(Se[Le]=pe.replace(/[a-zA-Z]/g,function(te){var le=te.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Se.join("")}for(var Je=[],ke=0,Oe=ye.length;ke<Oe;++ke){var Re=ye[ke];if(Re.global||Re.multiline)throw new Error(""+Re);Je.push("(?:"+rt(Re)+")")}return new RegExp(Je.join("|"),Pe?"gi":"g")}function P(ye,we){var De=/(?:^|\s)nocode(?:\s|$)/,Pe=[],ke=0,Oe=[],Re=0;function Ge($e){var Be=$e.nodeType;if(Be==1){if(De.test($e.className))return;for(var He=$e.firstChild;He;He=He.nextSibling)Ge(He);var rt=$e.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Pe[Re]=`
`,Oe[Re<<1]=ke++,Oe[Re++<<1|1]=$e)}else if(Be==3||Be==4){var Je=$e.nodeValue;Je.length&&(we?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),Pe[Re]=Je,Oe[Re<<1]=ke,ke+=Je.length,Oe[Re++<<1|1]=$e)}}return Ge(ye),{sourceCode:Pe.join("").replace(/\n$/,""),spans:Oe}}function H(ye,we,De,Pe,ke){if(!De)return;var Oe={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:we,decorations:null};Pe(Oe),ke.push.apply(ke,Oe.decorations)}var Y=/\S/;function ee(ye){for(var we=void 0,De=ye.firstChild;De;De=De.nextSibling){var Pe=De.nodeType;we=Pe===1?we?ye:De:Pe===3&&Y.test(De.nodeValue)?ye:we}return we===ye?void 0:we}function oe(ye,we){var De={},Pe;(function(){for(var Re=ye.concat(we),Ge=[],$e={},Be=0,He=Re.length;Be<He;++Be){var rt=Re[Be],Je=rt[3];if(Je)for(var qe=Je.length;--qe>=0;)De[Je.charAt(qe)]=rt;var Se=rt[1],Ze=""+Se;$e.hasOwnProperty(Ze)||(Ge.push(Se),$e[Ze]=null)}Ge.push(/[\0-\uffff]/),Pe=D(Ge)})();var ke=we.length,Oe=function(Re){for(var Ge=Re.sourceCode,$e=Re.basePos,Be=Re.sourceNode,He=[$e,a],rt=0,Je=Ge.match(Pe)||[],qe={},Se=0,Ze=Je.length;Se<Ze;++Se){var Ke=Je[Se],Le=qe[Ke],Ie=void 0,pe;if(typeof Le=="string")pe=!1;else{var se=De[Ke.charAt(0)];if(se)Ie=Ke.match(se[1]),Le=se[0];else{for(var de=0;de<ke;++de)if(se=we[de],Ie=Ke.match(se[1]),Ie){Le=se[0];break}Ie||(Le=a)}pe=Le.length>=5&&Le.substring(0,5)==="lang-",pe&&!(Ie&&typeof Ie[1]=="string")&&(pe=!1,Le=E),pe||(qe[Ke]=Le)}var $=rt;if(rt+=Ke.length,!pe)He.push($e+$,Le);else{var Z=Ie[1],te=Ke.indexOf(Z),le=te+Z.length;Ie[2]&&(le=Ke.length-Ie[2].length,te=le-Z.length);var ce=Le.substring(5);H(Be,$e+$,Ke.substring(0,te),Oe,He),H(Be,$e+$+te,Z,me(ce,Z),He),H(Be,$e+$+le,Ke.substring(le),Oe,He)}}Re.decorations=He};return Oe}function Te(ye){var we=[],De=[];ye.tripleQuotedStrings?we.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?we.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&De.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Pe=ye.hashComments;Pe&&(ye.cStyleComments?(Pe>1?we.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([b,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(De.push([b,/^\/\/[^\r\n]*/,null]),De.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=ye.regexLiterals;if(ke){var Oe=ke>1?"":`
\r`,Re=Oe?".":"[\\S\\s]",Ge="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Re+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Re+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+Ge+")")])}var $e=ye.types;$e&&De.push([h,$e]);var Be=(""+ye.keywords).replace(/^ | $/g,"");Be.length&&De.push([_,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(He+="(?!s*/)"),De.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(He),null]),oe(we,De)}var ve=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(ye,we,De){for(var Pe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Oe=ye.ownerDocument,Re=Oe.createElement("li");ye.firstChild;)Re.appendChild(ye.firstChild);var Ge=[Re];function $e(Se){var Ze=Se.nodeType;if(Ze==1&&!Pe.test(Se.className))if(Se.nodeName==="br")Be(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Ke=Se.firstChild;Ke;Ke=Ke.nextSibling)$e(Ke);else if((Ze==3||Ze==4)&&De){var Le=Se.nodeValue,Ie=Le.match(ke);if(Ie){var pe=Le.substring(0,Ie.index);Se.nodeValue=pe;var se=Le.substring(Ie.index+Ie[0].length);if(se){var de=Se.parentNode;de.insertBefore(Oe.createTextNode(se),Se.nextSibling)}Be(Se),pe||Se.parentNode.removeChild(Se)}}}function Be(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function Ze(Ie,pe){var se=pe?Ie.cloneNode(!1):Ie,de=Ie.parentNode;if(de){var $=Ze(de,1),Z=Ie.nextSibling;$.appendChild(se);for(var te=Z;te;te=Z)Z=te.nextSibling,$.appendChild(te)}return se}for(var Ke=Ze(Se.nextSibling,0),Le;(Le=Ke.parentNode)&&Le.nodeType===1;)Ke=Le;Ge.push(Ke)}for(var He=0;He<Ge.length;++He)$e(Ge[He]);we===(we|0)&&Ge[0].setAttribute("value",we);var rt=Oe.createElement("ol");rt.className="linenums";for(var Je=Math.max(0,we-1|0)||0,He=0,qe=Ge.length;He<qe;++He)Re=Ge[He],Re.className="L"+(He+Je)%10,Re.firstChild||Re.appendChild(Oe.createTextNode("\xA0")),rt.appendChild(Re);ye.appendChild(rt)}function he(ye){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var De=/\n/g,Pe=ye.sourceCode,ke=Pe.length,Oe=0,Re=ye.spans,Ge=Re.length,$e=0,Be=ye.decorations,He=Be.length,rt=0;Be[He]=ke;var Je,qe;for(qe=Je=0;qe<He;)Be[qe]!==Be[qe+2]?(Be[Je++]=Be[qe++],Be[Je++]=Be[qe++]):qe+=2;for(He=Je,qe=Je=0;qe<He;){for(var Se=Be[qe],Ze=Be[qe+1],Ke=qe+2;Ke+2<=He&&Be[Ke+1]===Ze;)Ke+=2;Be[Je++]=Se,Be[Je++]=Ze,qe=Ke}He=Be.length=Je;var Le=ye.sourceNode,Ie="";Le&&(Ie=Le.style.display,Le.style.display="none");try{for(var pe=null;$e<Ge;){var se=Re[$e],de=Re[$e+2]||ke,$=Be[rt+2]||ke,Ke=Math.min(de,$),Z=Re[$e+1],te;if(Z.nodeType!==1&&(te=Pe.substring(Oe,Ke))){we&&(te=te.replace(De,"\r")),Z.nodeValue=te;var le=Z.ownerDocument,ce=le.createElement("span");ce.className=Be[rt+1];var Ae=Z.parentNode;Ae.replaceChild(ce,Z),ce.appendChild(Z),Oe<de&&(Re[$e+1]=Z=le.createTextNode(Pe.substring(Ke,de)),Ae.insertBefore(Z,ce.nextSibling))}Oe=Ke,Oe>=de&&($e+=2),Oe>=$&&(rt+=2)}}finally{Le&&(Le.style.display=Ie)}}var fe={};function ae(ye,we){for(var De=we.length;--De>=0;){var Pe=we[De];fe.hasOwnProperty(Pe)?U.console&&console.warn("cannot override language handler %s",Pe):fe[Pe]=ye}}function me(ye,we){return ye&&fe.hasOwnProperty(ye)||(ye=/^\s*</.test(we)?"default-markup":"default-code"),fe[ye]}ae(ve,["default-code"]),ae(oe([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(oe([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(oe([],[[F,/^[\s\S]+/]]),["uq.val"]),ae(Te({keywords:x,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ae(Te({keywords:"null,true,false"}),["json"]),ae(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ae(Te({keywords:O,cStyleComments:!0}),["java"]),ae(Te({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(Te({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(Te({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(Te({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(oe([],[[f,/^[\s\S]+/]]),["regex"]);function J(ye){var we=ye.langExtension;try{var De=P(ye.sourceNode,ye.pre),Pe=De.sourceCode;ye.sourceCode=Pe,ye.spans=De.spans,ye.basePos=0,me(we,Pe)(ye),he(ye)}catch(ke){U.console&&console.log(ke&&ke.stack||ke)}}function ne(ye,we,De){var Pe=De||!1,ke=we||null,Oe=document.createElement("div");Oe.innerHTML="<pre>"+ye+"</pre>",Oe=Oe.firstChild,Pe&&ge(Oe,Pe,!0);var Re={langExtension:ke,numberLines:Pe,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Re),Oe.innerHTML}function Q(ye,we){var De=we||document.body,Pe=De.ownerDocument||document;function ke(se){return De.getElementsByTagName(se)}for(var Oe=[ke("pre"),ke("code"),ke("xmp")],Re=[],Ge=0;Ge<Oe.length;++Ge)for(var $e=0,Be=Oe[Ge].length;$e<Be;++$e)Re.push(Oe[Ge][$e]);Oe=null;var He=Date;He.now||(He={now:function(){return+new Date}});var rt=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,qe=/\bprettyprint\b/,Se=/\bprettyprinted\b/,Ze=/pre|xmp/i,Ke=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Ie={};function pe(){for(var se=U.PR_SHOULD_USE_CONTINUATION?He.now()+250:Infinity;rt<Re.length&&He.now()<se;rt++){for(var de=Re[rt],$=Ie,Z=de;Z=Z.previousSibling;){var te=Z.nodeType,le=(te===7||te===8)&&Z.nodeValue;if(le?!/^\??prettify\b/.test(le):te!==3||/\S/.test(Z.nodeValue))break;if(le){$={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ut,Et,Cr){$[Et]=Cr});break}}var ce=de.className;if(($!==Ie||qe.test(ce))&&!Se.test(ce)){for(var Ae=!1,_e=de.parentNode;_e;_e=_e.parentNode){var Ue=_e.tagName;if(Le.test(Ue)&&_e.className&&qe.test(_e.className)){Ae=!0;break}}if(!Ae){de.className+=" prettyprinted";var Qe=$.lang;if(!Qe){Qe=ce.match(Je);var Ve;!Qe&&(Ve=ee(de))&&Ke.test(Ve.tagName)&&(Qe=Ve.className.match(Je)),Qe&&(Qe=Qe[1])}var mt;if(Ze.test(de.tagName))mt=1;else{var dt=de.currentStyle,ot=Pe.defaultView,Ct=dt?dt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(de,null).getPropertyValue("white-space"):0;mt=Ct&&Ct.substring(0,3)==="pre"}var bt=$.linenums;(bt=bt==="true"||+bt)||(bt=ce.match(/\blinenums\b(?::(\d+))?/),bt=bt?bt[1]&&bt[1].length?+bt[1]:!0:!1),bt&&ge(de,bt,mt);var Bt={langExtension:Qe,sourceNode:de,numberLines:bt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};J(Bt)}}}rt<Re.length?U.setTimeout(pe,250):typeof ye=="function"&&ye()}pe()}var Ee=U.PR={createSimpleLexer:oe,registerLangHandler:ae,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:_,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:E,PR_STRING:f,PR_TAG:v,PR_TYPE:h,prettyPrintOne:A?U.prettyPrintOne=ne:R=ne,prettyPrint:B=A?U.prettyPrint=Q:B=Q},Ce=U.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(st,ze,q){(function(re,V){st.exports=V()})(this,function(){"use strict";var re=navigator.userAgent,V=navigator.platform,A=/gecko\/\d/i.test(re),G=/MSIE \d/.test(re),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),R=/Edge\/(\d+)/.exec(re),B=G||I||R,U=B&&(G?document.documentMode||6:+(R||I)[1]),k=!R&&/WebKit\//.test(re),L=k&&/Qt\/\d+\.\d+/.test(re),y=!R&&/Chrome\//.test(re),x=/Opera\//.test(re),O=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),T=/PhantomJS/.test(re),g=!R&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),d=/Android/.test(re),o=g||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),u=g||/Mac/.test(V),s=/\bCrOS\b/.test(re),w=/win/i.test(V),p=x&&re.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(x=!1,k=!0);var f=u&&(L||x&&(p==null||p<12.11)),_=A||B&&U>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)i.appendChild(t[S]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=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 E(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 M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};g?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function D(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,N=i||0;;){var K=e.indexOf(" ",S);if(K<0||K>=t)return N+(t-S);N+=K-S,N+=n-N%n,S=K+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=D(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.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 oe=50,Te={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},ge={origin:"*mouse"},he={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var N=S-r;if(S==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var ae=[""];function me(e){for(;ae.length<=e;)ae.push(J(ae)+" ");return ae[e]}function J(e){return e[e.length-1]}function ne(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Q(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&P(t,n),n}var ye=/[\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()||ye.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Oe(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Re(e,t,n){for(;(n<0?t>0:t<e.length)&&Oe(e.charAt(t));)t+=n;return t}function Ge(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function $e(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var N=e[S];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Be=null;function He(e,t,n){var r;Be=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Be=i),S.from==t&&(S.from!=S.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(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function z(X,ie,ue){this.level=X,this.from=ie,this.to=ue}return function(X,ie){var ue=ie=="ltr"?"L":"R";if(X.length==0||ie=="ltr"&&!r.test(X))return!1;for(var xe=X.length,be=[],Me=0;Me<xe;++Me)be.push(n(X.charCodeAt(Me)));for(var Fe=0,We=ue;Fe<xe;++Fe){var Xe=be[Fe];Xe=="m"?be[Fe]=We:We=Xe}for(var et=0,Ye=ue;et<xe;++et){var tt=be[et];tt=="1"&&Ye=="r"?be[et]="n":S.test(tt)&&(Ye=tt,tt=="r"&&(be[et]="R"))}for(var ut=1,at=be[0];ut<xe-1;++ut){var pt=be[ut];pt=="+"&&at=="1"&&be[ut+1]=="1"?be[ut]="1":pt==","&&at==be[ut+1]&&(at=="1"||at=="n")&&(be[ut]=at),at=pt}for(var Lt=0;Lt<xe;++Lt){var Ht=be[Lt];if(Ht==",")be[Lt]="N";else if(Ht=="%"){var Ot=void 0;for(Ot=Lt+1;Ot<xe&&be[Ot]=="%";++Ot);for(var sr=Lt&&be[Lt-1]=="!"||Ot<xe&&be[Ot]=="1"?"1":"N",nr=Lt;nr<Ot;++nr)be[nr]=sr;Lt=Ot-1}}for(var kt=0,ir=ue;kt<xe;++kt){var zt=be[kt];ir=="L"&&zt=="1"?be[kt]="L":S.test(zt)&&(ir=zt)}for(var Nt=0;Nt<xe;++Nt)if(i.test(be[Nt])){var It=void 0;for(It=Nt+1;It<xe&&i.test(be[It]);++It);for(var Pt=(Nt?be[Nt-1]:ue)=="L",ar=(It<xe?be[It]:ue)=="L",jn=Pt==ar?Pt?"L":"R":ue,Jr=Nt;Jr<It;++Jr)be[Jr]=jn;Nt=It-1}for(var Yt=[],Or,Kt=0;Kt<xe;)if(N.test(be[Kt])){var Va=Kt;for(++Kt;Kt<xe&&N.test(be[Kt]);++Kt);Yt.push(new z(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=ie=="rtl"?1:0;for(++Kt;Kt<xe&&be[Kt]!="L";++Kt);for(var Zt=jr;Zt<Kt;)if(K.test(be[Zt])){jr<Zt&&(Yt.splice(fn,0,new z(1,jr,Zt)),fn+=hn);var Wn=Zt;for(++Zt;Zt<Kt&&K.test(be[Zt]);++Zt);Yt.splice(fn,0,new z(2,Wn,Zt)),fn+=hn,jr=Zt}else++Zt;jr<Kt&&Yt.splice(fn,0,new z(1,jr,Kt))}return ie=="ltr"&&(Yt[0].level==1&&(Or=X.match(/^\s+/))&&(Yt[0].from=Or[0].length,Yt.unshift(new z(0,0,Or[0].length))),J(Yt).level==1&&(Or=X.match(/\s+$/))&&(J(Yt).to-=Or[0].length,Yt.push(new z(0,xe-Or[0].length,xe)))),ie=="rtl"?Yt.reverse():Yt}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var qe=[],Se=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||qe).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||qe}function Ke(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var S=ee(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function Le(e,t){var n=Ze(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 Ie(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Le(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function pe(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 Ze(e,t).length>0}function de(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){$(e),Z(e)}function ce(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var _e=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ue;function Qe(e){if(Ue==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ue=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=Ue?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ve;function mt(e){if(Ve!=null)return Ve;var t=l(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Ve=r.right-n.right<3}var dt=`
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 S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=S.indexOf("\r");N!=-1?(n.push(S.slice(0,N)),t+=N+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function Bt(e){if(bt!=null)return bt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(n.left-r.left)>1}var Ut={},Et={};function Cr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function Rr(e,t){Et[e]=t}function lr(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[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 lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=lr(t);var n=Ut[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var fr={};function ia(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};P(t,n)}function _r(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 Hn(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 Rt=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};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Rt.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},Rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.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)},Rt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(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],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function Pr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var N=S.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function mn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Qt(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 gr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],z=K.height;if(t<z)break;t-=z}return n+N}function Mr(e,t){return t>=e.first&&t<e.first+e.size}function pn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ne(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ne))return new Ne(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function gn(e){return Ne(e.line,e.ch)}function vn(e,t){return ct(e,t)<0?t:e}function Zr(e,t){return ct(e,t)<0?e:t}function yn(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 Ne(e.first,0);var n=e.first+e.size-1;return t.line>n?Ne(n,nt(e,n).text.length):_i(t,nt(e,t.line).text.length)}function _i(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function je(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var bn=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 bn?new hr(e,_r(e.mode,t.state),n,t.lookAhead):new hr(e,_r(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?_r(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],S={};br(e,t.text,e.doc.mode,n,function(X,ie){return i.push(X,ie)},S,r);for(var N=n.state,K=function(X){n.baseTokens=i;var ie=e.state.overlays[X],ue=1,xe=0;n.state=!0,br(e,t.text,ie.mode,n,function(be,Me){for(var Fe=ue;xe<be;){var We=i[ue];We>be&&i.splice(ue,1,be,i[ue+1],We),ue+=2,xe=Math.min(be,We)}if(!Me)return;if(ie.opaque)i.splice(Fe,ue-Fe,be,"overlay "+Me),ue=Fe+2;else for(;Fe<ue;Fe+=2){var Xe=i[Fe+1];i[Fe+1]=(Xe?Xe+" ":"")+"overlay "+Me}},S),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)K(z);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function Qr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=vr(e,Tt(t)),i=t.text.length>e.options.maxHighlightLength&&_r(e.doc.mode,r.state),S=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.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 vr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var S=Li(e,t,n),N=S>r.first&&nt(r,S-1).stateAfter,K=N?hr.fromSaved(r,N,S):new hr(r,Kn(r.mode),S);return r.iter(S,t,function(z){Vn(e,z.text,K);var X=K.line;z.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function Vn(e,t,n,r){var i=e.doc.mode,S=new Rt(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Xn(i,n.state);!S.eol();)yr(i,S,n.state),S.start=S.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function yr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(e,n).mode);var S=e.token(t,n);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=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,S=i.mode,N;t=ht(i,t);var K=nt(i,t.line),z=vr(e,t.line,n),X=new Rt(K.text,e.options.tabSize,z),ie;for(r&&(ie=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,N=yr(S,X,z.state),r&&ie.push(new Yn(X,N,_r(i.mode,z.state)));return r?ie:new Yn(X,N,z.state)}function $n(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 br(e,t,n,r,i,S,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var z=0,X=null,ie=new Rt(t,e.options.tabSize,r),ue,xe=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),S);!ie.eol();){if(ie.pos>e.options.maxHighlightLength?(K=!1,N&&Vn(e,t,r,ie.pos),ie.pos=t.length,ue=null):ue=$n(yr(n,ie,r.state,xe),S),xe){var be=xe[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!K||X!=ue){for(;z<ie.start;)z=Math.min(ie.start,z+5e3),i(z,X);X=ue}ie.start=ie.pos}for(;z<ie.pos;){var Me=Math.min(ie.pos,z+5e3);i(Me,X),z=Me}}function Li(e,t,n){for(var r,i,S=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=S.first)return S.first;var z=nt(S,K-1),X=z.stateAfter;if(X&&(!n||K+(X instanceof bn?X.lookAhead:0)<=S.modeFrontier))return K;var ie=H(z.text,null,e.options.tabSize);(i==null||r>ie)&&(i=K-1,r=ie)}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=nt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Jn=!1,$t=!1;function Wr(){Jn=!0}function oa(){$t=!0}function qr(e,t,n){this.marker=e,this.from=t,this.to=n}function Er(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Zn(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 Di(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],N=S.marker,K=S.from==null||(N.inclusiveLeft?S.from<=t:S.from<t);if(K||S.from==t&&N.type=="bookmark"&&(!n||!S.marker.insertLeft)){var z=S.to==null||(N.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new qr(N,S.from,z?null:S.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],N=S.marker,K=S.to==null||(N.inclusiveRight?S.to>=t:S.to>t);if(K||S.from==t&&N.type=="bookmark"&&(!n||S.marker.insertLeft)){var z=S.from==null||(N.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new qr(N,z?null:S.from-t,S.to==null?null:S.to-t))}}return r}function En(e,t){if(t.full)return null;var n=Mr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Mr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,N=ct(t.from,t.to)==0,K=Di(n,i,N),z=Oi(r,S,N),X=t.text.length==1,ie=J(t.text).length+(X?i:0);if(K)for(var ue=0;ue<K.length;++ue){var xe=K[ue];if(xe.to==null){var be=Er(z,xe.marker);be?X&&(xe.to=be.to==null?null:be.to+ie):xe.to=i}}if(z)for(var Me=0;Me<z.length;++Me){var Fe=z[Me];if(Fe.to!=null&&(Fe.to+=ie),Fe.from==null){var We=Er(K,Fe.marker);We||(Fe.from=ie,X&&(K||(K=[])).push(Fe))}else Fe.from+=ie,X&&(K||(K=[])).push(Fe)}K&&(K=Ri(K)),z&&z!=K&&(z=Ri(z));var Xe=[K];if(!X){var et=t.text.length-2,Ye;if(et>0&&K)for(var tt=0;tt<K.length;++tt)K[tt].to==null&&(Ye||(Ye=[])).push(new qr(K[tt].marker,null,null));for(var ut=0;ut<et;++ut)Xe.push(Ye);Xe.push(z)}return Xe}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 Fe=be.markedSpans[Me].marker;Fe.readOnly&&(!r||ee(r,Fe)==-1)&&(r||(r=[])).push(Fe)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var N=r[S],K=N.find(0),z=0;z<i.length;++z){var X=i[z];if(ct(X.to,K.from)<0||ct(X.from,K.to)>0)continue;var ie=[z,1],ue=ct(X.from,K.from),xe=ct(X.to,K.to);(ue<0||!N.inclusiveLeft&&!ue)&&ie.push({from:X.from,to:K.from}),(xe>0||!N.inclusiveRight&&!xe)&&ie.push({from:K.to,to:X.to}),i.splice.apply(i,ie),z+=ie.length-3}return i}function la(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 xn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),S=ct(r.from,i.from)||en(e)-en(t);if(S)return-S;var N=ct(r.to,i.to)||tn(e)-tn(t);return N||t.id-e.id}function kr(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return kr(e,!0)}function Ur(e){return kr(e,!1)}function Sn(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||Tn(r,S.marker)<0)&&(r=S.marker)}return r}function Mi(e,t,n,r,i){var S=nt(e,t),N=$t&&S.markedSpans;if(N)for(var K=0;K<N.length;++K){var z=N[K];if(!z.marker.collapsed)continue;var X=z.marker.find(0),ie=ct(X.from,n)||en(z.marker)-en(i),ue=ct(X.to,r)||tn(z.marker)-tn(i);if(ie>=0&&ue<=0||ie<=0&&ue>=0)continue;if(ie<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.to,n)>=0:ct(X.to,n)>0)||ie>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.from,r)<=0:ct(X.from,r)<0))return!0}}function ur(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function ki(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Ur(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Qn(e,t){var n=nt(e,t),r=ur(n);return n==r?t:Tt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Ar(e,n))return t;for(;r=Ur(n);)n=r.find(1,!0).line;return Tt(n)+1}function Ar(e,t){var n=$t&&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&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&qn(e,t,i))return!0}function xr(e){e=ur(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 S=n.parent;S;n=S,S=n.parent)for(var N=0;N<S.children.length;++N){var K=S.children[N];if(K==n)break;t+=K.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Ur(r);){var S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Ii(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return Tt(this)},de(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),xn(e,n);var i=r?r(e):1;i!=e.height&&Qt(e,i)}function it(e){e.parent=null,la(e)}var ft={},lt={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lt:ft;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function xt(e,t){var n=v("span",null,null,k?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var S=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=yt,mt(e.display.measure)&&(N=Je(S,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&&Tt(S);Fr(S,r,Qr(e,S,K)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=j(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=j(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Qe(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(k){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function At(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function yt(e,t,n,r,i,S,N){if(!t)return;var K=e.splitSpaces?Ft(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,ie;if(!z.test(t))e.col+=t.length,ie=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ie),B&&U<9&&(X=!0),e.pos+=t.length;else{ie=document.createDocumentFragment();for(var ue=0;;){z.lastIndex=ue;var xe=z.exec(t),be=xe?xe.index-ue:t.length-ue;if(be){var Me=document.createTextNode(K.slice(ue,ue+be));B&&U<9?ie.appendChild(a("span",[Me])):ie.appendChild(Me),e.map.push(e.pos,e.pos+be,Me),e.col+=be,e.pos+=be}if(!xe)break;ue+=be+1;var Fe=void 0;if(xe[0]==" "){var We=e.cm.options.tabSize,Xe=We-e.col%We;Fe=ie.appendChild(a("span",me(Xe),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=Xe}else xe[0]=="\r"||xe[0]==`
`?(Fe=ie.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",xe[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(xe[0]),Fe.setAttribute("cm-text",xe[0]),B&&U<9?ie.appendChild(a("span",[Fe])):ie.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||X||S||N){var et=n||"";r&&(et+=r),i&&(et+=i);var Ye=a("span",[ie],et,S);if(N)for(var tt in N)N.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ye.setAttribute(tt,N[tt]);return e.content.appendChild(Ye)}e.content.appendChild(ie)}function Ft(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function qt(e,t){return function(n,r,i,S,N,K,z){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,ie=X+r.length;;){for(var ue=void 0,xe=0;xe<t.length&&!(ue=t[xe],ue.to>X&&ue.from<=X);xe++);if(ue.to>=ie)return e(n,r,i,S,N,K,z);e(n,r.slice(0,ue.to-X),i,S,null,K,z),S=null,r=r.slice(ue.to-X),X=ue.to}}}function vt(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 Fr(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(S,S=n[N]),gt(n[N+1],t.cm.options));return}for(var K=i.length,z=0,X=1,ie="",ue,xe,be=0,Me,Fe,We,Xe,et;;){if(be==z){Me=Fe=We=xe="",et=null,Xe=null,be=Infinity;for(var Ye=[],tt=void 0,ut=0;ut<r.length;++ut){var at=r[ut],pt=at.marker;if(pt.type=="bookmark"&&at.from==z&&pt.widgetNode)Ye.push(pt);else if(at.from<=z&&(at.to==null||at.to>z||pt.collapsed&&at.to==z&&at.from==z)){if(at.to!=null&&at.to!=z&&be>at.to&&(be=at.to,Fe=""),pt.className&&(Me+=" "+pt.className),pt.css&&(xe=(xe?xe+";":"")+pt.css),pt.startStyle&&at.from==z&&(We+=" "+pt.startStyle),pt.endStyle&&at.to==be&&(tt||(tt=[])).push(pt.endStyle,at.to),pt.title&&((et||(et={})).title=pt.title),pt.attributes)for(var Lt in pt.attributes)(et||(et={}))[Lt]=pt.attributes[Lt];pt.collapsed&&(!Xe||Tn(Xe.marker,pt)<0)&&(Xe=at)}else at.from>z&&be>at.from&&(be=at.from)}if(tt)for(var Ht=0;Ht<tt.length;Ht+=2)tt[Ht+1]==be&&(Fe+=" "+tt[Ht]);if(!Xe||Xe.from==z)for(var Ot=0;Ot<Ye.length;++Ot)vt(t,0,Ye[Ot]);if(Xe&&(Xe.from||0)==z){if(vt(t,(Xe.to==null?K+1:Xe.to)-z,Xe.marker,Xe.from==null),Xe.to==null)return;Xe.to==z&&(Xe=!1)}}if(z>=K)break;for(var sr=Math.min(K,be);;){if(ie){var nr=z+ie.length;if(!Xe){var kt=nr>sr?ie.slice(0,sr-z):ie;t.addToken(t,kt,ue?ue+Me:Me,We,z+kt.length==be?Fe:"",xe,et)}if(nr>=sr){ie=ie.slice(sr-z),z=sr;break}z=nr,We=""}ie=i.slice(S,S=n[X++]),ue=gt(n[X++],t.cm.options)}}}function St(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?Tt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Ar(e,t)}function er(e,t,n){for(var r=[],i,S=t;S<n;S=i){var N=new St(e.doc,nt(e.doc,S),S);i=S+N.size,r.push(N)}return r}var Vt=null;function mr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Vt=null,t(n)}}var ti=null;function Gt(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(Ps,0));for(var S=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)S(N)}function Ps(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?ks(e,t):S=="gutter"?Ja(e,t,n,r):S=="class"?da(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&U<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(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):xt(e,t)}function ks(e,t){var n=t.text.className,r=$a(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,da(e,t)):n&&(t.text.className=n)}function da(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 Ja(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=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var N=ri(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var z=0;z<e.display.gutterSpecs.length;++z){var X=e.display.gutterSpecs[z].className,ie=S.hasOwnProperty(X)&&S[X];ie&&K.appendChild(a("div",[ie],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Za(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Za(e,t,r),t.node}function Za(e,t,n){if(Qa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,n,!1)}function Qa(e,t,n,r,i){if(!t.widgets)return;for(var S=ri(n),N=0,K=t.widgets;N<K.length;++N){var z=K[N],X=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Fs(z,X,n,r),e.display.input.setUneditable(X),i&&z.above?S.insertBefore(X,n.gutter||n.text):S.appendChild(X),Gt(z,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Nr(e,t){for(var n=ce(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 ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Lr(e){return oe-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&nn(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var z=N[K],X=N[K+1];Math.abs(z.bottom-X.bottom)>2&&S.push((z.bottom+X.top)/2-n.top)}}S.push(n.bottom-n.top)}}function eo(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=ur(t);var n=Tt(t),r=e.display.externalMeasured=new St(e.doc,t,n);r.lineN=n;var i=r.built=xt(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Dr(e,Cn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Cn(e,t){var n=Tt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),N;return t.cache.hasOwnProperty(S)?N=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[S]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,S,N,K,z,X=0;X<e.length;X+=3)if(K=e[X],z=e[X+1],t<K?(i=0,S=1,N="left"):t<z?(i=t-K,S=i+1):(X==e.length-3||t==z&&e[X+3]>t)&&(S=z-K,i=S-1,t>=z&&(N="right")),i!=null){if(r=e[X+2],K==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],N="left";if(n=="right"&&i==z-K)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],N="right";break}return{node:r,start:i,end:S,collapse:N,coverStart:K,coverEnd:z}}function js(e,t){var n=ro;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=no(t.map,n,r),S=i.node,N=i.start,K=i.end,z=i.collapse,X;if(S.nodeType==3){for(var ie=0;ie<4;ie++){for(;N&&Oe(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&Oe(t.line.text.charAt(i.coverStart+K));)++K;if(B&&U<9&&N==0&&K==i.coverEnd-i.coverStart?X=S.parentNode.getBoundingClientRect():X=js(m(S,N,K).getClientRects(),r),X.left||X.right||N==0)break;K=N,N=N-1,z="right"}B&&U<11&&(X=Hs(e.display.measure,X))}else{N>0&&(z=r="right");var ue;e.options.lineWrapping&&(ue=S.getClientRects()).length>1?X=ue[r=="right"?ue.length-1:0]:X=S.getBoundingClientRect()}if(B&&U<9&&!N&&(!X||!X.left&&!X.right)){var xe=S.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+An(e.display),top:xe.top,bottom:xe.bottom}:X=ro}for(var be=X.top-t.rect.top,Me=X.bottom-t.rect.top,Fe=(be+Me)/2,We=t.view.measure.heights,Xe=0;Xe<We.length-1&&!(Fe<We[Xe]);Xe++);var et=Xe?We[Xe-1]:0,Ye=We[Xe],tt={left:(z=="right"?X.right:X.left)-t.rect.left,right:(z=="left"?X.left:X.right)-t.rect.left,top:et,bottom:Ye};return!X.left&&!X.right&&(tt.bogus=!0),e.options.singleCursorHeightPerLine||(tt.rtop=be,tt.rbottom=Me),tt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Bt(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 io(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 ao(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return y&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var S=ma(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var N=xr(t);if(r=="local"?N+=Ui(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:so());var z=K.left+(r=="window"?0:oo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function pa(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Fi(e,r,to(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,S){r=r||nt(e.doc,t.line),i||(i=Cn(e,r));function N(Me,Fe){var We=Dr(e,i,Me,Fe?"right":"left",S);return Fe?We.left=We.right:We.right=We.left,Fi(e,r,We,n)}var K=Je(r,e.doc.direction),z=t.ch,X=t.sticky;if(z>=r.text.length?(z=r.text.length,X="before"):z<=0&&(z=0,X="after"),!K)return N(X=="before"?z-1:z,X=="before");function ie(Me,Fe,We){var Xe=K[Fe],et=Xe.level==1;return N(We?Me-1:Me,et!=We)}var ue=He(K,z,X),xe=Be,be=ie(z,ue,X=="before");return xe!=null&&(be.other=ie(z,xe,X!="before")),be}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=An(e.display)*t.ch);var r=nt(e.doc,t.line),i=xr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var S=Ne(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=gr(r,n),S=r.first+r.size-1;if(i>S)return ga(r.first+r.size-1,nt(r,S).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var K=Ks(e,N,i,t,n),z=Sn(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var X=z.find(1);if(X.line==i)return X;N=nt(r,i=X.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,S=Ge(function(N){return Dr(e,n,N-1).bottom<=r},i,0);return i=Ge(function(N){return Dr(e,n,N).top>r},S,i),{begin:S,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Fi(e,t,Dr(e,n,r),"line").top;return co(e,t,n,i)}function ya(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-=xr(t);var S=Cn(e,t),N=ma(t),K=0,z=t.text.length,X=!0,ie=Je(t,e.doc.direction);if(ie){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,S,ie,r,i);X=ue.level!=1,K=X?ue.from:ue.to-1,z=X?ue.to:ue.from-1}var xe=null,be=null,Me=Ge(function(ut){var at=Dr(e,S,ut);return at.top+=N,at.bottom+=N,ya(at,r,i,!1)?(at.top<=i&&at.left<=r&&(xe=ut,be=at),!0):!1},K,z),Fe,We,Xe=!1;if(be){var et=r-be.left<be.right-r,Ye=et==X;Me=xe+(Ye?0:1),We=Ye?"after":"before",Fe=et?be.left:be.right}else{!X&&(Me==z||Me==K)&&Me++,We=Me==0?"after":Me==t.text.length?"before":Dr(e,S,Me-(X?1:0)).bottom+N<=i==X?"after":"before";var tt=Tr(e,Ne(n,Me,We),"line",t,S);Fe=tt.left,Xe=i<tt.top?-1:i>=tt.bottom?1:0}return Me=Re(t.text,Me,1),ga(n,Me,We,Xe,r-Fe)}function Gs(e,t,n,r,i,S,N){var K=Ge(function(ue){var xe=i[ue],be=xe.level!=1;return ya(Tr(e,Ne(n,be?xe.to:xe.from,be?"before":"after"),"line",t,r),S,N,!0)},0,i.length-1),z=i[K];if(K>0){var X=z.level!=1,ie=Tr(e,Ne(n,X?z.from:z.to,X?"after":"before"),"line",t,r);ya(ie,S,N,!0)&&ie.top>N&&(z=i[K-1])}return z}function zs(e,t,n,r,i,S,N){var K=co(e,t,r,N),z=K.begin,X=K.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ie=null,ue=null,xe=0;xe<i.length;xe++){var be=i[xe];if(be.from>=X||be.to<=z)continue;var Me=be.level!=1,Fe=Dr(e,r,Me?Math.min(X,be.to)-1:Math.max(z,be.from)).right,We=Fe<S?S-Fe+1e9:Fe-S;(!ie||ue>We)&&(ie=be,ue=We)}return ie||(ie=i[i.length-1]),ie.from<z&&(ie={from:z,to:ie.to,level:ie.level}),ie.to>X&&(ie={from:ie.from,to:X,level:ie.level}),ie}var an;function _n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}l(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function An(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,N=0;S;S=S.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=S.offsetLeft+S.clientLeft+i,r[K]=S.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=_n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/An(e.display)-3);return function(i){if(Ar(e.doc,i))return 0;var S=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(S+=i.widgets[N].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Qt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&ce(t).getAttribute("cm-not-content")=="true")return null;var S,N,K=i.lineSpace.getBoundingClientRect();try{S=t.clientX-K.left,N=t.clientY-K.top}catch(ue){return null}var z=va(e,S,N),X;if(r&&z.xRel>0&&(X=nt(e.doc,z.line).text).length==z.ch){var ie=H(X,X.length,e.options.tabSize)-X.length;z=Ne(z.line,Math.max(0,Math.round((S-qa(e.display).left)/An(e.display))-ie))}return z}function sn(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)$t&&Qn(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var S=Ni(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Ni(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var K=Ni(e,t,t,-1),z=Ni(e,n,n+r,1);K&&z?(i.view=i.view.slice(0,K.index).concat(er(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Kr(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 S=r.view[sn(e,t)];if(S.node==null)return;var N=S.changes||(S.changes=[]);ee(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),S,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,z=0;z<i;z++)K+=N[z].size;if(K!=t){if(r>0){if(i==N.length-1)return null;S=K+N[i].size-t,i++}else S=K-t;t+=S,n+=S}for(;Qn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function mo(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 po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var z=K.empty();(z||e.options.showCursorWhenSelecting)&&go(e,K.head,i),z||Xs(e,K,S)}return r}function go(e,t,n){var r=Tr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.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,S=document.createDocumentFragment(),N=qa(e.display),K=N.left,z=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,X=i.direction=="ltr";function ie(Ye,tt,ut,at){tt<0&&(tt=0),tt=Math.round(tt),at=Math.round(at),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ye+`px;
top: `+tt+"px; width: "+(ut==null?z-Ye:ut)+`px;
height: `+(at-tt)+"px"))}function ue(Ye,tt,ut){var at=nt(i,Ye),pt=at.text.length,Lt,Ht;function Ot(kt,ir){return pa(e,Ne(Ye,kt),"div",at,ir)}function sr(kt,ir,zt){var Nt=fo(e,at,null,kt),It=ir=="ltr"==(zt=="after")?"left":"right",Pt=zt=="after"?Nt.begin:Nt.end-(/\s/.test(at.text.charAt(Nt.end-1))?2:1);return Ot(Pt,It)[It]}var nr=Je(at,i.direction);return $e(nr,tt||0,ut==null?pt:ut,function(kt,ir,zt,Nt){var It=zt=="ltr",Pt=Ot(kt,It?"left":"right"),ar=Ot(ir-1,It?"right":"left"),jn=tt==null&&kt==0,Jr=ut==null&&ir==pt,Yt=Nt==0,Or=!nr||Nt==nr.length-1;if(ar.top-Pt.top<=3){var Kt=(X?jn:Jr)&&Yt,Va=(X?Jr:jn)&&Or,jr=Kt?K:(It?Pt:ar).left,fn=Va?z:(It?ar:Pt).right;ie(jr,Pt.top,fn-jr,Pt.bottom)}else{var hn,Zt,Wn,Xa;It?(hn=X&&jn&&Yt?K:Pt.left,Zt=X?z:sr(kt,zt,"before"),Wn=X?K:sr(ir,zt,"after"),Xa=X&&Jr&&Or?z:ar.right):(hn=X?sr(kt,zt,"before"):K,Zt=!X&&jn&&Yt?z:Pt.right,Wn=!X&&Jr&&Or?K:ar.left,Xa=X?sr(ir,zt,"after"):z),ie(hn,Pt.top,Zt-hn,Pt.bottom),Pt.bottom<ar.top&&ie(K,Pt.bottom,null,ar.top),ie(Wn,ar.top,Xa-Wn,ar.bottom)}(!Lt||Bi(Pt,Lt)<0)&&(Lt=Pt),Bi(ar,Lt)<0&&(Lt=ar),(!Ht||Bi(Pt,Ht)<0)&&(Ht=Pt),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Lt,end:Ht}}var xe=t.from(),be=t.to();if(xe.line==be.line)ue(xe.line,xe.ch,be.ch);else{var Me=nt(i,xe.line),Fe=nt(i,be.line),We=ur(Me)==ur(Fe),Xe=ue(xe.line,xe.ch,We?Me.text.length+1:null).end,et=ue(be.line,We?0:null,be.ch).start;We&&(Xe.top<et.top-2?(ie(Xe.right,Xe.top,null,Xe.bottom),ie(K,et.top,et.left,et.bottom)):ie(Xe.right,Xe.top,et.left-Xe.right,Xe.bottom)),Xe.bottom<et.top&&ie(K,Xe.bottom,null,et.top)}n.appendChild(S)}function Ta(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()||Ln(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ln(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Ln(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],S=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&U<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var X=i.node.getBoundingClientRect();N=X.bottom-X.top,!S&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var ie=i.line.height-N;if((ie>.005||ie<-.005)&&(Qt(i.line,N),bo(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)bo(i.rest[ue]);if(K>e.display.sizerWidth){var xe=Math.ceil(K/An(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(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,S=gr(t,r),N=gr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,z=n.ensure.to.line;K<S?(S=K,N=gr(t,xr(nt(t,K))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(S=gr(t,xr(nt(t,z))-e.wrapper.clientHeight),N=z)}return{from:S,to:Math.max(N,S+1)}}function Ys(e,t){if(Ie(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!T){var S=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Ui(e.display))+`px;
height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var N=!1,K=Tr(e,t),z=!n||n==t?K:Tr(e,n);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-r,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+r};var X=wa(e,i),ie=e.doc.scrollTop,ue=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-ie)>1&&(N=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=_n(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=fa(e),N={};t.bottom-t.top>S&&(t.bottom=t.top+S);var K=e.doc.height+ca(n),z=t.top<r,X=t.bottom>K-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+S){var ie=Math.min(t.top,(X?K:t.bottom)-S);ie!=i&&(N.scrollTop=ie)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,be=nn(e)-n.gutters.offsetWidth,Me=t.right-t.left>be;return Me&&(t.right=t.left+be),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+ue-(Me?0:10)):t.right>be+xe-3&&(N.scrollLeft=t.right+(Me?0:10)-be),N}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Dn(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 Zs(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||Aa(e,{top:t}),xo(e,t,!0),A&&Aa(e),di(e,100)}function xo(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 ln(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,_o(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+ca(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+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.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 S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"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}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=u&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.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 On(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(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),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function dn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var S=0;S<t.length;S++)nl(t[S]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ii(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&&_a(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=to(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+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(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&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&On(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(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 S=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(S)for(var K=0;K<S.length;++K)S[K].lines.length||Le(S[K],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Le(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function or(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,D(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=vr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var N=S.styles,K=S.text.length>e.options.maxHighlightLength?_r(t.mode,r.state):null,z=zn(e,S,r,!0);K&&(r.state=K),S.styles=z.styles;var X=S.styleClasses,ie=z.classes;ie?S.styleClasses=ie:X&&(S.styleClasses=null);for(var ue=!N||N.length!=S.styles.length||X!=ie&&(!X||!ie||X.bgClass!=ie.bgClass||X.textClass!=ie.textClass),xe=0;!ue&&xe<N.length;++xe)ue=N[xe]!=S.styles[xe];ue&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&Vn(e,S.text,r),S.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&&or(e,function(){for(var S=0;S<i.length;S++)Kr(e,i[S],"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=nn(e),this.force=n,this.dims=ba(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++)Le.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(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==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(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 _a(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(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&&mo(e)==0)return!1;Ao(e)&&(Gr(e),t.dims=ba(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(S=Qn(e.doc,S),N=Hr(e.doc,N));var K=S!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,N),n.viewOffset=xr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=mo(e);if(!K&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(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(!_a(e,t))break;ji(e);var i=li(e);ai(e),On(e,i),Da(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 Aa(e,t){var n=new Ki(e,t);if(_a(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),On(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,N=S.firstChild;function K(Me){var Fe=Me.nextSibling;return k&&u&&e.display.currentWheelTarget==Me?Me.style.display="none":Me.parentNode.removeChild(Me),Fe}for(var z=r.view,X=r.viewFrom,ie=0;ie<z.length;ie++){var ue=z[ie];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=S){var xe=Us(e,ue,X,n);S.insertBefore(xe,N)}else{for(;N!=ue.node;)N=K(N);var be=i&&t!=null&&t<=X&&ue.lineNumber;ue.changes&&(ee(ue.changes,"gutter")>-1&&(be=!1),Ya(e,ue,X,n)),be&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(pn(e.options,X)))),N=ue.node.nextSibling}X+=ue.size}for(;N;)N=K(N)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function _o(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=S),n[N].gutterBackground&&(n[N].gutterBackground.style.left=S));var K=n[N].alignable;if(K)for(var z=0;z<K.length;z++)K[z].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=i.firstChild.offsetWidth,N=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],N=null;if(typeof S!="string"&&(N=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Lo(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],S=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+S));N&&(K.style.cssText=N),S=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",La(e)}function ci(e){Lo(e.display),tr(e),_o(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[S],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(A&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Oa(r.gutters,r.lineNumbers),Lo(i),n.init(i)}var Gi=0,dr=null;B?dr=-.53:A?dr=15:y?dr=-.7:O&&(dr=-1/3);function Do(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=Do(e);return t.x*=dr,t.y*=dr,t}function Oo(e,t){var n=Do(t),r=n.x,i=n.y,S=e.display,N=S.scroller,K=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&z))return;if(i&&u&&k){e:for(var X=t.target,ie=S.view;X!=N;X=X.parentNode)for(var ue=0;ue<ie.length;ue++)if(ie[ue].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!A&&!x&&dr!=null){i&&z&&si(e,Math.max(0,N.scrollTop+i*dr)),ln(e,Math.max(0,N.scrollLeft+r*dr)),(!i||i&&z)&&$(t),S.wheelStartX=null;return}if(i&&dr!=null){var xe=i*dr,be=e.doc.scrollTop,Me=be+S.wrapper.clientHeight;xe<0?be=Math.max(0,be+xe-50):Me=Math.min(e.doc.height,Me+xe+50),Aa(e,{top:be,bottom:Me})}Gi<20&&(S.wheelStartX==null?(S.wheelStartX=N.scrollLeft,S.wheelStartY=N.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Fe=N.scrollLeft-S.wheelStartX,We=N.scrollTop-S.wheelStartY,Xe=We&&S.wheelDY&&We/S.wheelDY||Fe&&S.wheelDX&&Fe/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!Xe)return;dr=(dr*Gi+Xe)/(Gi+1),++Gi},200)):(S.wheelDX+=r,S.wheelDY+=i))}var cr=function(e,t){this.ranges=e,this.primIndex=t};cr.prototype.primary=function(){return this.ranges[this.primIndex]},cr.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(!Gn(n.anchor,r.anchor)||!Gn(n.head,r.head))return!1}return!0},cr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new cr(e,this.primIndex)},cr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},cr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return Zr(this.anchor,this.head)},wt.prototype.to=function(){return vn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Sr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,be){return ct(xe.from(),be.from())}),n=ee(t,i);for(var S=1;S<t.length;S++){var N=t[S],K=t[S-1],z=ct(K.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var X=Zr(K.from(),N.from()),ie=vn(K.to(),N.to()),ue=K.empty()?N.from()==N.head:K.from()==K.head;S<=n&&--n,t.splice(--S,2,new wt(ue?ie:X,ue?X:ie))}}return new cr(t,n)}function zr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Vr(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+=Vr(t).ch-t.to.ch),Ne(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(Ro(i.anchor,t),Ro(i.head,t)))}return Sr(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Ne(n.line,e.ch-t.ch+n.ch):Ne(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ne(e.first,0),S=i,N=0;N<t.length;N++){var K=t[N],z=Po(K.from,i,S),X=Po(Vr(K),i,S);if(i=K.to,S=X,n=="around"){var ie=e.sel.ranges[N],ue=ct(ie.head,ie.anchor)<0;r[N]=new wt(ue?X:z,ue?z:X)}else r[N]=new wt(z,z)}return new cr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=pr(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 Mo(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(et){return n?n[et]:null}function S(et,Ye,tt){ua(et,Ye,tt,r),Gt(et,"change",et,t)}function N(et,Ye){for(var tt=[],ut=et;ut<Ye;++ut)tt.push(new rn(X[ut],i(ut),r));return tt}var K=t.from,z=t.to,X=t.text,ie=nt(e,K.line),ue=nt(e,z.line),xe=J(X),be=i(X.length-1),Me=z.line-K.line;if(t.full)e.insert(0,N(0,X.length)),e.remove(X.length,e.size-X.length);else if(Mo(e,t)){var Fe=N(0,X.length-1);S(ue,ue.text,be),Me&&e.remove(K.line,Me),Fe.length&&e.insert(K.line,Fe)}else if(ie==ue)if(X.length==1)S(ie,ie.text.slice(0,K.ch)+xe+ie.text.slice(z.ch),be);else{var We=N(1,X.length-1);We.push(new rn(xe+ie.text.slice(z.ch),be,r)),S(ie,ie.text.slice(0,K.ch)+X[0],i(0)),e.insert(K.line+1,We)}else if(X.length==1)S(ie,ie.text.slice(0,K.ch)+X[0]+ue.text.slice(z.ch),i(0)),e.remove(K.line+1,Me);else{S(ie,ie.text.slice(0,K.ch)+X[0],i(0)),S(ue,xe+ue.text.slice(z.ch),be);var Xe=N(1,X.length-1);Me>1&&e.remove(K.line+1,Me-1),e.insert(K.line+1,Xe)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,S,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var z=i.linked[K];if(z.doc==S)continue;var X=N&&z.sharedHist;if(n&&!X)continue;t(z.doc,X),r(z.doc,i,X)}}r(e,null,!0)}function ko(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Pa(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){or(e,function(){Io(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 ka(e,t){var n={from:gn(t.from),to:Vr(t),text:Pr(e,t.from,t.to)};return No(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return No(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Uo(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Fo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=J(N.changes),ct(t.from,t.to)==0&&ct(t.from,K.to)==0?K.to=Vr(t):N.changes.push(ka(e,t));else{var z=J(i.done);for((!z||!z.ranges)&&Vi(e.sel,i.done),N={changes:[ka(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Le(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||pl(e,S,J(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Vi(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=N.markedSpans),++S})}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 Bo(e,t){var n=yl(e,t),r=En(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],N=r[i];if(S&&N){e:for(var K=0;K<N.length;++K){for(var z=N[K],X=0;X<S.length;++X)if(S[X].marker==z.marker)continue e;S.push(z)}}else N&&(n[i]=N)}return n}function Rn(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?cr.prototype.deepCopy.call(S):S);continue}var N=S.changes,K=[];r.push({changes:K});for(var z=0;z<N.length;++z){var X=N[z],ie=void 0;if(K.push({from:X.from,to:X.to,text:X.text}),t)for(var ue in X)(ie=ue.match(/^spans_(\d+)$/))&&(ee(t,Number(ie[1]))>-1&&(J(K)[ue]=X[ue],delete X[ue]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var S=ct(t,i)<0;S!=ct(n,i)<0?(i=t,t=n):S!=ct(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new cr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Ia(e.sel.ranges[S],t[S],null,i);var N=Sr(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,Sr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var S=0;S<i.length;S++)this.ranges[S]=new wt(ht(e,i[S].anchor),ht(e,i[S].head))},origin:n&&n.origin};return Le(e,"beforeSelectionChange",e,r),e.cm&&Le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Sr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Xt(e,t,n)}function Xt(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||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Dn(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,pe(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var N=t.ranges[S],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],z=$i(e,N.anchor,K&&K.anchor,n,r),X=$i(e,N.head,K&&K.head,n,r);(i||z!=N.anchor||X!=N.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new wt(z,X))}return i?Sr(e.cm,i,t.primIndex):t}function Pn(e,t,n,r,i){var S=nt(e,t.line);if(S.markedSpans)for(var N=0;N<S.markedSpans.length;++N){var K=S.markedSpans[N],z=K.marker,X="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ie="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(X?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ie?K.to>=t.ch:K.to>t.ch))){if(i&&(Le(z,"beforeCursorEnter"),z.explicitlyCleared))if(S.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var ue=z.find(r<0?1:-1),xe=void 0;if((r<0?ie:X)&&(ue=Vo(e,ue,-r,ue&&ue.line==t.line?S:null)),ue&&ue.line==t.line&&(xe=ct(ue,n))&&(r<0?xe<0:xe>0))return Pn(e,ue,t,r,i)}var be=z.find(r<0?-1:1);return(r<0?X:ie)&&(be=Vo(e,be,r,be.line==t.line?S:null)),be?Pn(e,be,t,r,i):null}}return t}function $i(e,t,n,r,i){var S=r||1,N=Pn(e,t,n,S,i)||!i&&Pn(e,t,n,S,!0)||Pn(e,t,n,-S,i)||!i&&Pn(e,t,n,-S,!0);return N||(e.cantEdit=!0,Ne(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Ne(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+n)}function Xo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),ve)}function Yo(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,S,N,K){i&&(r.from=ht(e,i)),S&&(r.to=ht(e,S)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Le(e,"beforeChange",e,r),e.cm&&Le(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Mn(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,Mn)(e,t,n);if(e.cm.state.suppressEdits)return}if((se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Ra(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,S){!S&&ee(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,En(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,N=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,X=0;X<K.length&&!(S=K[X],n?S.ranges&&!S.equals(e.sel):!S.ranges);X++);if(X==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=K.pop(),S.ranges){if(Vi(S,z),n&&!S.equals(e.sel)){Xt(e,S,{clearRedo:!1});return}N=S}else if(r){K.push(S);return}else break;var ie=[];Vi(N,z),z.push({changes:ie,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var ue=se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"),xe=function(Fe){var We=S.changes[Fe];if(We.origin=t,ue&&!Yo(e,We,!1))return K.length=0,{};ie.push(ka(e,We));var Xe=Fe?Ra(e,We):J(K);hi(e,We,Xe,Bo(e,We)),!Fe&&e.cm&&e.cm.scrollIntoView({from:We.from,to:Vr(We)});var et=[];Xr(e,function(Ye,tt){!tt&&ee(et,Ye.history)==-1&&(qo(Ye.history,We),et.push(Ye.history)),hi(Ye,We,null,Bo(Ye,We))})},be=S.changes.length-1;be>=0;--be){var Me=xe(be);if(Me)return Me.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ne(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(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++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Jo(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);Jo(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Ne(S,nt(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,N=t.to,K=!1,z=S.line;e.options.lineWrapping||(z=Tt(ur(nt(r,S.line))),r.iter(z,N.line+1,function(be){if(be==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&pe(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(z,S.line+t.text.length,function(be){var Me=ei(be);Me>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Me,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),aa(r,S.line),di(e,400);var X=t.text.length-(N.line-S.line)-1;t.full?tr(e):S.line==N.line&&t.text.length==1&&!Mo(e.doc,t)?Kr(e,S.line,"text"):tr(e,S.line,N.line+1,X);var ie=se(e,"changes"),ue=se(e,"change");if(ue||ie){var xe={from:S,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&Gt(e,"change",e,xe),ie&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function kn(e,t,n,r,i){var S;r||(r=n),ct(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Mn(e,{from:n,to:r,text:t,origin:i})}function Zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],N=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var K=0;K<S.ranges.length;K++)Zo(S.ranges[K].anchor,t,n,r),Zo(S.ranges[K].head,t,n,r);continue}for(var z=0;z<S.changes.length;++z){var X=S.changes[z];if(n<X.from.line)X.from=Ne(X.from.line+r,X.from.ch),X.to=Ne(X.to.line+r,X.to.ch);else if(t<=X.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Qo(e.done,n,r,i),Qo(e.undone,n,r,i)}function mi(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=nt(e,yn(e,t)):i=Tt(t),i==null?null:(r(S,i)&&e.cm&&Kr(e.cm,i,n),S)}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,it(i),Gt(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 S=Math.min(t,i-e),N=r.height;if(r.removeInner(e,S),this.height-=N-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof pi))){var K=[];this.collapse(K),this.children=[new pi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var z=new pi(i.lines.slice(K,K+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=S}},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],S=i.chunkSize();if(e<S){var N=Math.min(t,S-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=S}}};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 S=ni(this);Qt(n,Math.max(0,n.height-S)),e&&(or(e,function(){es(e,n,-S),Kr(e,r,"widget")}),Gt(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;Ar(this.doc,r)||Qt(r,r.height+i),n&&or(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Gt(n,"lineWidgetChanged",n,e,Tt(r))})},de(vi);function es(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new vi(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),mi(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,S&&!Ar(e,N)){var z=xr(N)<e.scrollTop;Qt(N,N.height+ni(i)),z&&Ca(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&Gt(S,"lineWidgetAdded",S,i,typeof t=="number"?t:Tt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),se(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var N=this.lines[S],K=Er(N.markedSpans,this);e&&!this.collapsed?Kr(e,Tt(N),"text"):e&&(K.to!=null&&(i=Tt(N)),K.from!=null&&(r=Tt(N))),N.markedSpans=Zn(N.markedSpans,K),K.from==null&&this.collapsed&&!Ar(this.doc,N)&&e&&Qt(N,_n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var X=ur(this.lines[z]),ie=ei(X);ie>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ie,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&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var S=this.lines[i],N=Er(S.markedSpans,this);if(N.from!=null&&(n=Ne(t?S:Tt(S),N.from),e==-1))return n;if(N.to!=null&&(r=Ne(t?S:Tt(S),N.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;or(r,function(){var i=t.line,S=Tt(t.line),N=ha(r,S);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ar(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var z=ni(n)-K;z&&Qt(i,i.height+z)}Gt(r,"markerChanged",r,e)})},Yr.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)},Yr.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)}},de(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var S=new Yr(e,i),N=ct(t,n);if(r&&P(r,S,!1),N>0||N==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=v("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Mi(e,t.line,t,n,S)||t.line!=n.line&&Mi(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}S.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,X;if(e.iter(K,n.line+1,function(ue){z&&S.collapsed&&!z.options.lineWrapping&&ur(ue)==z.display.maxLine&&(X=!0),S.collapsed&&K!=t.line&&Qt(ue,0),sa(ue,new qr(S,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),S.collapsed&&e.iter(t.line,n.line+1,function(ue){Ar(e,ue)&&Qt(ue,0)}),S.clearOnEnter&&Se(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++ts,S.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),S.collapsed)tr(z,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var ie=t.line;ie<=n.line;ie++)Kr(z,ie,"text");S.atomic&&Go(z.doc),Gt(z,"markerAdded",z,S)}return S}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();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},de(yi);function Tl(e,t,n,r,i){r=P(r),r.shared=!1;var S=[In(e,t,n,r,i)],N=S[0],K=r.widgetNode;return Xr(e,function(z){K&&(r.widgetNode=K.cloneNode(!0)),S.push(In(z,ht(z,t),ht(z,n),r,i));for(var X=0;X<z.linked.length;++X)if(z.linked[X].isParent)return;N=J(S)}),new yi(S,N)}function rs(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(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(),S=e.clipPos(i.from),N=e.clipPos(i.to);if(ct(S,N)){var K=In(e,S,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];Xr(i.primary.doc,function(z){return S.push(z)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];ee(S,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,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 rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Ne(n,0);this.sel=zr(S),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)),Ma(this,{from:S,to:S,text:e}),Xt(this,zr(S),ve)};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=mn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;Mn(this,{from:t,to:Ne(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,zr(t),ve)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,kn(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(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(Mr(this,e))return nt(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),ur(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:Wt(function(e,t,n){Wo(this,ht(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,je(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);jo(this,je(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,Sr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(ht(this,e),ht(this,t||e))),Xt(this,Sr(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=Pr(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=Pr(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:Wt(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var N=i.ranges[S];r[S]={from:N.from(),to:N.to(),text:this.splitLines(e[S]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Mn(this,r[z]);K?Ho(this,K):this.cm&&Dn(this.cm)}),undo:Wt(function(){Ji(this,"undo")}),redo:Wt(function(){Ji(this,"redo")}),undoSelection:Wt(function(){Ji(this,"undo",!0)}),redoSelection:Wt(function(){Ji(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),Xr(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:Rn(this.history.done),undone:Rn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=Rn(e.done.slice(0),null,!0),t.undone=Rn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return mi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Pe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&mi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Pe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mr(this,e))return null;if(t=e,e=nt(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:Wt(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(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(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",S=r[i];if(S)if(n==null)r[i]=null;else{var N=S.match(b(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=S.slice(0,N.index)+(!N.index||K==S.length?"":" ")+S.slice(K)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(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),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=nt(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(S){var N=S.markedSpans;if(N)for(var K=0;K<N.length;K++){var z=N[K];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++n}),ht(this,Ne(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(mn(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(mn(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,rs(this)),r},unlinkDoc:function(e){if(e instanceof Dt&&(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(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=Rn(this.history.done,r),e.history.undone=Rn(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):dt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Wt(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 ns=0;function _l(e){var t=this;if(is(t),Ie(t,e)||Nr(t.display,e))return;$(e),B&&(ns=+new Date);var n=on(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,S=Array(i),N=0,K=function(){++N==i&&jt(t,function(){n=ht(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(S.filter(function(Me){return Me!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mn(t.doc,be),Ho(t.doc,zr(ht(t.doc,n),ht(t.doc,Vr(be))))})()},z=function(be,Me){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,be.type)==-1){K();return}var Fe=new FileReader;Fe.onerror=function(){return K()},Fe.onload=function(){var We=Fe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(We)){K();return}S[Me]=We,K()},Fe.readAsText(be)},X=0;X<r.length;X++)z(r[X],X);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 ie=e.dataTransfer.getData("Text");if(ie){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Yi(t.doc,zr(n,n)),ue)for(var xe=0;xe<ue.length;++xe)kn(t.doc,"",ue[xe].anchor,ue[xe].head,"drag");t.replaceSelection(ie,"around","paste"),t.display.input.focus()}}catch(be){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){le(t);return}if(Ie(e,t)||Nr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",x&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),x&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(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 S=0;S<n.length;S++)e(n[S])})}var os=!1;function Dl(){if(os)return;Ol(),os=!0}function Ol(){var e;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Se(window,"blur",function(){return as(Ln)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={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++)$r[bi+48]=$r[bi+96]=String(bi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var Ei=1;Ei<=12;Ei++)$r[Ei+111]=$r[Ei+63235]="F"+Ei;var Br={};Br.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"},Br.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"},Br.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"},Br.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"]},Br.default=u?Br.macDefault:Br.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))S=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(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=ne(n.split(" "),Pl),S=0;S<i.length;S++){var N=void 0,K=void 0;S==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,S+1).join(" "),N="...");var z=t[K];if(!z)t[K]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Un(e,t,n,r){t=Qi(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 Un(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var N=Un(e,t.fallthrough[S],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(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 us(e,t){if(x&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function Qi(e){return typeof e=="string"?Br[e]:e}function Fn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&ct(S.from,J(r).to)<=0;){var N=r.pop();if(ct(N.from,S.from)<0){S.from=N.from;break}}r.push(S)}or(e,function(){for(var K=r.length-1;K>=0;K--)kn(e.doc,"",r[K].from,r[K].to,"+delete");Dn(e)})}function Fa(e,t,n){var r=Re(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Je(n,t.doc.direction);if(S){var N=i<0?J(S):S[0],K=i<0==(N.level==1),z=K?"after":"before",X;if(N.level>0||t.doc.direction=="rtl"){var ie=Cn(t,n);X=i<0?n.text.length-1:0;var ue=Dr(t,ie,X).top;X=Ge(function(xe){return Dr(t,ie,xe).top==ue},i<0==(N.level==1)?N.from:N.to-1,X),z=="before"&&(X=Fa(n,X,1))}else X=i<0?N.to:N.from;return new Ne(r,X,z)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Je(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 S=He(i,n.ch,n.sticky),N=i[S];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Na(t,n,r);var K=function(Xe,et){return Fa(t,Xe instanceof Ne?Xe.ch:Xe,et)},z,X=function(Xe){return e.options.lineWrapping?(z=z||Cn(e,t),fo(e,t,z,Xe)):{begin:0,end:t.text.length}},ie=X(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var ue=N.level==1==r<0,xe=K(n,ue?1:-1);if(xe!=null&&(ue?xe<=N.to&&xe<=ie.end:xe>=N.from&&xe>=ie.begin)){var be=ue?"before":"after";return new Ne(n.line,xe,be)}}var Me=function(Xe,et,Ye){for(var tt=function(Lt,Ht){return Ht?new Ne(n.line,K(Lt,1),"before"):new Ne(n.line,Lt,"after")};Xe>=0&&Xe<i.length;Xe+=et){var ut=i[Xe],at=et>0==(ut.level!=1),pt=at?Ye.begin:K(Ye.end,-1);if(ut.from<=pt&&pt<ut.to)return tt(pt,at);if(pt=at?ut.from:K(ut.to,-1),Ye.begin<=pt&&pt<Ye.end)return tt(pt,at)}},Fe=Me(S+r,r,ie);if(Fe)return Fe;var We=r>0?ie.end:K(ie.begin,-1);return We!=null&&!(r>0&&We==t.text.length)&&(Fe=Me(r>0?0:i.length-1,r,X(We)),Fe)?Fe:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Fn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Fn(e,function(t){return{from:Ne(t.from().line,0),to:ht(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Fn(e,function(t){return{from:Ne(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(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(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")},he)},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")},he)},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/)?cs(e,t.head):r},he)},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 S=n[i].from(),N=H(e.getLine(S.line),S.ch,r);t.push(me(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return or(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,S=nt(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=nt(e.doc,i.line-1).text;N&&(i=new Ne(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ne(i.line-1,N.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return or(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);Dn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=ur(n);return r!=n&&(t=Tt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=ki(n);return r!=n&&(t=Tt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=Je(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=S&&t.ch;return Ne(n.line,N?0:S,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)!=Te}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=Un(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Un(t,e.options.extraKeys,n,e)||Un(t,e.options.keyMap,n,e)}var Fl=new Y;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),Ta(e)),!!i}function hs(e,t){var n=us(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 Nl(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var ja=null;function ms(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Ie(t,e))return;B&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);x&&(ja=r?n:null,!r&&n==88&&!Ct&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Ke(document,"keyup",n),Ke(document,"mouseover",n))}Se(document,"keyup",n),Se(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ie(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Nr(t.display,e)||Ie(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(x&&n==ja){ja=null,$(e);return}if(x&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&ct(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 Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Ie(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=Ae(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):ce(e)==n.scroller&&$(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(_?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Ti(e,ls(S,i),i,function(N){if(typeof N=="string"&&(N=xi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"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=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(D(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),S=e.doc.sel,N;e.options.dragDrop&&_e&&!e.isReadOnly()&&n=="single"&&(N=S.contains(t))>-1&&(ct((N=S.ranges[N]).from(),t)<0||t.xRel>0)&&(ct(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,S=!1,N=jt(e,function(X){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ke(i.wrapper.ownerDocument,"mouseup",N),Ke(i.wrapper.ownerDocument,"mousemove",K),Ke(i.scroller,"dragstart",z),Ke(i.scroller,"drop",N),S||($(X),r.addNew||Xi(e.doc,n,null,null,r.extend),k&&!O||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(X){S=S||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},z=function(){return S=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",N),Se(i.wrapper.ownerDocument,"mousemove",K),Se(i.scroller,"dragstart",z),Se(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),ht(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;$(t);var N,K,z=S.sel,X=z.ranges;if(r.addNew&&!r.extend?(K=S.sel.contains(n),K>-1?N=X[K]:N=new wt(n,n)):(N=S.sel.primary(),K=S.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new wt(n,n)),n=on(e,t,!0,!0),K=-1;else{var ie=ys(e,n,r.unit);r.extend?N=Ia(N,ie.anchor,ie.head,r.extend):N=ie}r.addNew?K==-1?(K=X.length,Xt(S,Sr(e,X.concat([N]),K),{scroll:!1,origin:"*mouse"})):X.length>1&&X[K].empty()&&r.unit=="char"&&!r.extend?(Xt(S,Sr(e,X.slice(0,K).concat(X.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=S.sel):Ua(S,K,N,ge):(K=0,Xt(S,new cr([N],0),ge),z=S.sel);var ue=n;function xe(Ye){if(ct(ue,Ye)==0)return;if(ue=Ye,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,at=H(nt(S,n.line).text,n.ch,ut),pt=H(nt(S,Ye.line).text,Ye.ch,ut),Lt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Ye.line),sr=Math.min(e.lastLine(),Math.max(n.line,Ye.line));Ot<=sr;Ot++){var nr=nt(S,Ot).text,kt=fe(nr,Lt,ut);Lt==Ht?tt.push(new wt(Ne(Ot,kt),Ne(Ot,kt))):nr.length>kt&&tt.push(new wt(Ne(Ot,kt),Ne(Ot,fe(nr,Ht,ut))))}tt.length||tt.push(new wt(n,n)),Xt(S,Sr(e,z.ranges.slice(0,K).concat(tt),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ye)}else{var ir=N,zt=ys(e,Ye,r.unit),Nt=ir.anchor,It;ct(zt.anchor,Nt)>0?(It=zt.head,Nt=Zr(ir.from(),zt.anchor)):(It=zt.anchor,Nt=vn(ir.to(),zt.head));var Pt=z.ranges.slice(0);Pt[K]=Xl(e,new wt(ht(S,Nt),It)),Xt(S,Sr(e,Pt,K),ge)}}var be=i.wrapper.getBoundingClientRect(),Me=0;function Fe(Ye){var tt=++Me,ut=on(e,Ye,!0,r.unit=="rectangle");if(!ut)return;if(ct(ut,ue)!=0){e.curOp.focus=M(),xe(ut);var at=Wi(i,S);(ut.line>=at.to||ut.line<at.from)&&setTimeout(jt(e,function(){Me==tt&&Fe(Ye)}),150)}else{var pt=Ye.clientY<be.top?-20:Ye.clientY>be.bottom?20:0;pt&&setTimeout(jt(e,function(){if(Me!=tt)return;i.scroller.scrollTop+=pt,Fe(Ye)}),50)}}function We(Ye){e.state.selectingText=!1,Me=Infinity,Ye&&($(Ye),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",Xe),Ke(i.wrapper.ownerDocument,"mouseup",et),S.history.lastSelOrigin=null}var Xe=jt(e,function(Ye){Ye.buttons===0||!Ae(Ye)?We(Ye):Fe(Ye)}),et=jt(e,We);e.state.selectingText=et,Se(i.wrapper.ownerDocument,"mousemove",Xe),Se(i.wrapper.ownerDocument,"mouseup",et)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var S=Je(i);if(!S)return t;var N=He(S,n.ch,n.sticky),K=S[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var z=N+(K.from==n.ch==(K.level!=1)?0:1);if(z==0||z==S.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ie=He(S,r.ch,r.sticky),ue=ie-N||(r.ch-n.ch)*(K.level==1?-1:1);ie==z-1||ie==z?X=ue<0:X=ue>0}var xe=S[z+(X?-1:0)],be=X==(xe.level==1),Me=be?xe.from:xe.to,Fe=be?"after":"before";return n.ch==Me&&n.sticky==Fe?t:new wt(new Ne(n.line,Me,Fe),r)}function bs(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(S>K.bottom||!se(e,n))return te(t);S-=K.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var X=N.gutters.childNodes[z];if(X&&X.getBoundingClientRect().right>=i){var ie=gr(e.doc,S),ue=e.display.gutterSpecs[z];return Le(e,n,e,ie,ue.className,t),te(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Ie(e,t,"contextmenu"))return;_||e.display.input.onContextMenu(t)}function Yl(e,t){return se(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(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 Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,S,N){e.defaults[r]=i,S&&(t[r]=N?function(K,z,X){X!=Nn&&S(K,z,X)}:S)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!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 S=[],N=r.doc.first;r.doc.iter(function(z){for(var X=0;;){var ie=z.text.indexOf(i,X);if(ie==-1)break;X=ie+i.length,S.push(Ne(N,ie))}N++});for(var K=S.length-1;K>=0;K--)kn(r.doc,i,S[K],Ne(S[K].line,S[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Nn&&r.refresh()}),n("specialCharPlaceholder",At,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),ci(r)},!0),n("keyMap","default",function(r,i,S){var N=Qi(i),K=S!=Nn&&Qi(S);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return On(r)},!0),n("scrollbarStyle","native",function(r){wo(r),On(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=Oa(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"&&(Ln(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,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 Jl(e,t,n){var r=n&&n!=Nn;if(!t!=!r){var i=e.display.dragFunctions,S=t?Se:Ke;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function Dt(e,t){var n=this;if(!(this instanceof Dt))return new Dt(e,t);this.options=t=t?P(t):{},P(Ts,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 Dt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(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 Y,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),B&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Dl(),dn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Ln(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Ao(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ka.length;++K)Ka[K](this);cn(this),k&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Dt.defaults=Ts,Dt.optionHandlers=ea;function Ql(e){var t=e.display;Se(t.scroller,"mousedown",jt(e,vs)),B&&U<11?Se(t.scroller,"dblclick",jt(e,function(z){if(Ie(e,z))return;var X=on(e,z);if(!X||Ha(e,z)||Nr(e.display,z))return;$(z);var ie=e.findWordAt(X);Xi(e.doc,ie.anchor,ie.head)})):Se(t.scroller,"dblclick",function(z){return Ie(e,z)||$(z)}),Se(t.scroller,"contextmenu",function(z){return Es(e,z)}),Se(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||Es(e,z)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S(z){if(z.touches.length!=1)return!1;var X=z.touches[0];return X.radiusX<=1&&X.radiusY<=1}function N(z,X){if(X.left==null)return!0;var ie=X.left-z.left,ue=X.top-z.top;return ie*ie+ue*ue>20*20}Se(t.scroller,"touchstart",function(z){if(!Ie(e,z)&&!S(z)&&!Ha(e,z)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!Nr(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ie=e.coordsChar(t.activeTouch,"page"),ue;!X.prev||N(X,X.prev)?ue=new wt(ie,ie):!X.prev.prev||N(X,X.prev.prev)?ue=e.findWordAt(ie):ue=new wt(Ne(ie.line,0),ht(e.doc,Ne(ie.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),$(z)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(z){return Oo(e,z)}),Se(t.scroller,"DOMMouseScroll",function(z){return Oo(e,z)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Ie(e,z)||le(z)},over:function(z){Ie(e,z)||(Ll(e,z),le(z))},start:function(z){return Al(e,z)},drop:jt(e,_l),leave:function(z){Ie(e,z)||is(e)}};var K=t.input.getField();Se(K,"keyup",function(z){return ps.call(e,z)}),Se(K,"keydown",jt(e,ms)),Se(K,"keypress",jt(e,gs)),Se(K,"focus",function(z){return Sa(e,z)}),Se(K,"blur",function(z){return Ln(e,z)})}var Ka=[];Dt.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=vr(e,t).state:n="prev");var N=e.options.tabSize,K=nt(i,t),z=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var X=K.text.match(/^\s*/)[0],ie;if(!r&&!/\S/.test(K.text))ie=0,n="not";else if(n=="smart"&&(ie=i.mode.indent(S,K.text.slice(X.length),K.text),ie==Te||ie>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ie=H(nt(i,t-1).text,null,N):ie=0:n=="add"?ie=z+e.options.indentUnit:n=="subtract"?ie=z-e.options.indentUnit:typeof n=="number"&&(ie=z+n),ie=Math.max(0,ie);var ue="",xe=0;if(e.options.indentWithTabs)for(var be=Math.floor(ie/N);be;--be)xe+=N,ue+=" ";if(xe<ie&&(ue+=me(ie-xe)),ue!=X)return kn(i,ue,Ne(t,0),Ne(t,X.length),"+input"),K.stateAfter=null,!0;for(var Me=0;Me<i.sel.ranges.length;Me++){var Fe=i.sel.ranges[Me];if(Fe.head.line==t&&Fe.head.ch<X.length){var We=Ne(t,X.length);Ua(i,Me,new wt(We,We));break}}}var wr=null;function ta(e){wr=e}function Ga(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,z=dt(t),X=null;if(K&&r.ranges.length>1)if(wr&&wr.text.join(`
`)==t){if(r.ranges.length%wr.text.length==0){X=[];for(var ie=0;ie<wr.text.length;ie++)X.push(S.splitLines(wr.text[ie]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ne(z,function(Xe){return[Xe]}));for(var ue=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var be=r.ranges[xe],Me=be.from(),Fe=be.to();be.empty()&&(n&&n>0?Me=Ne(Me.line,Me.ch-n):e.state.overwrite&&!K?Fe=Ne(Fe.line,Math.min(nt(S,Fe.line).text.length,Fe.ch+J(z).length)):K&&wr&&wr.lineWise&&wr.text.join(`
`)==z.join(`
`)&&(Me=Fe=Ne(Me.line,0)));var We={from:Me,to:Fe,text:X?X[xe%X.length]:z,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,We),Gt(e,"inputRead",e,We)}t&&!K&&ws(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&or(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(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 S=e.getModeAt(i.head),N=!1;if(S.electricChars){for(var K=0;K<S.electricChars.length;K++)if(t.indexOf(S.electricChars.charAt(K))>-1){N=Ci(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ci(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,S={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function _s(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),_s(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 S=this.options,N=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),Le(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:Jt(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");Q(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Jt(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var N=i[S].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(S,1),this.state.modeGen++,tr(this);return}}}),indentLine:Jt(function(r,i,S){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mr(this.doc,r)&&Ci(this,r,i,S)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,S=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>S&&(Ci(this,K.head.line,r,!0),S=K.head.line,N==this.doc.sel.primIndex&&Dn(this));else{var z=K.from(),X=K.to(),ie=Math.max(S,z.line);S=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var ue=ie;ue<S;++ue)Ci(this,ue,r);var xe=this.doc.sel.ranges;z.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Ua(this.doc,N,new wt(z,xe[N].to()),ve)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Qr(this,nt(this.doc,r.line)),S=0,N=(i.length-1)/2,K=r.ch,z;if(K==0)z=i[2];else for(;;){var X=S+N>>1;if((X?i[X*2-1]:0)>=K)N=X;else if(i[X*2+1]<K)S=X+1;else{z=i[X*2+2];break}}var ie=z?z.indexOf("overlay "):-1;return ie<0?z:ie==0?null:z.slice(0,ie-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 S=[];if(!n.hasOwnProperty(i))return S;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&S.push(N[K[i]]);else if(K[i])for(var z=0;z<K[i].length;z++){var X=N[K[i][z]];X&&S.push(X)}else K.helperType&&N[K.helperType]?S.push(N[K.helperType]):N[K.name]&&S.push(N[K.name]);for(var ie=0;ie<N._global.length;ie++){var ue=N._global[ie];ue.pred(K,this)&&ee(S,ue.val)==-1&&S.push(ue.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=yn(S,r==null?S.first+S.size-1:r),vr(this,r+1,i).state},cursorCoords:function(r,i){var S,N=this.doc.sel.primary();return r==null?S=N.head:typeof r=="object"?S=ht(this.doc,r):S=r?N.from():N.to(),Tr(this,S,i||"page")},charCoords:function(r,i){return pa(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,gr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var N=!1,K;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,N=!0),K=nt(this.doc,r)}else K=r;return Fi(this,K,{top:0,left:0},i||"page",S||N).top+(N?this.doc.height-xr(K):0)},defaultTextHeight:function(){return _n(this.display)},defaultCharWidth:function(){return An(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,N,K){var z=this.display;r=Tr(this,ht(this.doc,r));var X=r.bottom,ie=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")X=r.top;else if(N=="above"||N=="near"){var ue=Math.max(z.wrapper.clientHeight,this.doc.height),xe=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(X=r.bottom),ie+i.offsetWidth>xe&&(ie=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",K=="right"?(ie=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ie=0:K=="middle"&&(ie=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ie+"px"),S&&Js(this,{left:ie,top:X,right:ie+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Jt(ms),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,S,N){var K=1;i<0&&(K=-1,i=-i);for(var z=ht(this.doc,r),X=0;X<i&&!(z=za(this.doc,z,K,S,N),z.hitSide);++X);return z},moveH:Jt(function(r,i){var S=this;this.extendSelectionsBy(function(N){return S.display.shift||S.doc.extend||N.empty()?za(S.doc,N.head,r,i,S.options.rtlMoveVisually):r<0?N.from():N.to()},he)}),deleteH:Jt(function(r,i){var S=this.doc.sel,N=this.doc;S.somethingSelected()?N.replaceSelection("",null,"+delete"):Fn(this,function(K){var z=za(N,K.head,r,i,!1);return r<0?{from:z,to:K.head}:{from:K.head,to:z}})}),findPosV:function(r,i,S,N){var K=1,z=N;i<0&&(K=-1,i=-i);for(var X=ht(this.doc,r),ie=0;ie<i;++ie){var ue=Tr(this,X,"div");if(z==null?z=ue.left:ue.left=z,X=Ls(this,ue,K,S),X.hitSide)break}return X},moveV:Jt(function(r,i){var S=this,N=this.doc,K=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ie){if(z)return r<0?ie.from():ie.to();var ue=Tr(S,ie.head,"div");ie.goalColumn!=null&&(ue.left=ie.goalColumn),K.push(ue.left);var xe=Ls(S,ue,r,i);return i=="page"&&ie==N.sel.primary()&&Ca(S,pa(S,xe,"div").top-ue.top),xe},he),K.length)for(var X=0;X<N.sel.ranges.length;X++)N.sel.ranges[X].goalColumn=K[X]}),findWordAt:function(r){var i=this.doc,S=nt(i,r.line).text,N=r.ch,K=r.ch;if(S){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||K==S.length)&&N?--N:++K;for(var X=S.charAt(N),ie=De(X,z)?function(ue){return De(ue,z)}:/\s/.test(X)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!De(ue)};N>0&&ie(S.charAt(N-1));)--N;for(;K<S.length&&ie(S.charAt(K));)++K}return new wt(Ne(r.line,N),Ne(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Lr(this)-this.display.barHeight,width:r.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Jt(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:Ne(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?Zs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Jt(function(r,i){var S=this,N=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&ao(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(z){if(z.widgets){for(var X=0;X<z.widgets.length;X++)if(z.widgets[X].noHScroll){Kr(S,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Le(this,"refresh",this)}),operation:function(r){return or(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Jt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-_n(this.display))>.5||this.options.lineWrapping)&&xa(this),Le(this,"refresh",this)}),swapDoc:Jt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ko(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Gt(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}},de(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,N){e.registerHelper(r,i,N),n[r]._global.push({pred:S,val:N})}}function za(e,t,n,r,i){var S=t,N=n,K=nt(e,t.line),z=i&&e.direction=="rtl"?-n:n;function X(){var et=t.line+z;return et<e.first||et>=e.first+e.size?!1:(t=new Ne(et,t.ch,t.sticky),K=nt(e,et))}function ie(et){var Ye;if(r=="codepoint"){var tt=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ye=null:Ye=new Ne(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ye=kl(e.cm,K,t,n):Ye=Na(K,t,n);if(Ye==null)if(!et&&X())t=Ba(i,e.cm,K,t.line,z);else return!1;else t=Ye;return!0}if(r=="char"||r=="codepoint")ie();else if(r=="column")ie(!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&&!ie(!Me));Me=!1){var Fe=K.text.charAt(t.ch)||`
`,We=De(Fe,be)?"w":xe&&Fe==`
`?"n":!xe||/\s/.test(Fe)?null:"p";if(xe&&!Me&&!We&&(We="s"),ue&&ue!=We){n<0&&(n=1,ie(),t.sticky="after");break}if(We&&(ue=We),n>0&&!ie(!Me))break}var Xe=$i(e,t,S,N,!0);return Gn(S,Xe)&&(Xe.hitSide=!0),Xe}function Ls(e,t,n,r){var i=e.doc,S=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*_n(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,S,N),!X.outside);){if(n<0?N<=0:N>=i.height){X.hitSide=!0;break}N+=n*5}return X}var _t=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};_t.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;_s(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Se(i,"paste",function(K){if(!S(K)||Ie(r,K)||Ss(K,r))return;U<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Se(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Se(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!S(K)||Ie(r,K))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=Cs(r);ta({lineWise:!0,text:z.text}),K.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var X=wr.text.join(`
`);if(K.clipboardData.setData("Text",X),K.clipboardData.getData("Text")==X){K.preventDefault();return}}var ie=As(),ue=ie.firstChild;r.display.lineSpace.insertBefore(ie,r.display.lineSpace.firstChild),ue.value=wr.text.join(`
`);var xe=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ie),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Se(i,"copy",N),Se(i,"cut",N)},_t.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},_t.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},_t.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},_t.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 S=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&N&&!N.bad&&ct(Zr(S,N),r)==0&&ct(vn(S,N),i)==0)return;var K=t.display.view,z=r.line>=t.display.viewFrom&&Ds(t,r)||{node:K[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Ds(t,i);if(!X){var ie=K[K.length-1].measure,ue=ie.maps?ie.maps[ie.maps.length-1]:ie.map;X={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!z||!X){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),be;try{be=m(z.node,z.offset,X.offset,X.node)}catch(Me){}be&&(!A&&t.state.focused?(e.collapse(z.node,z.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),xe&&e.anchorNode==null?e.addRange(xe):A&&this.startGracePeriod()),this.rememberSelection()},_t.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)},_t.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},_t.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},_t.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},_t.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},_t.prototype.blur=function(){this.div.blur()},_t.prototype.getField=function(){return this.div},_t.prototype.supportsTouch=function(){return!0},_t.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():or(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)},_t.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},_t.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&y&&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&&or(t,function(){Xt(t.doc,zr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},_t.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=Ne(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,N,K;r.line==t.viewFrom||(S=sn(e,r.line))==0?(N=Tt(t.view[0].line),K=t.view[0].node):(N=Tt(t.view[S].line),K=t.view[S-1].node.nextSibling);var z=sn(e,i.line),X,ie;if(z==t.view.length-1?(X=t.viewTo-1,ie=t.lineDiv.lastChild):(X=Tt(t.view[z+1].line)-1,ie=t.view[z+1].node.previousSibling),!K)return!1;for(var ue=e.doc.splitLines(tu(e,K,ie,N,X)),xe=Pr(e.doc,Ne(N,0),Ne(X,nt(e.doc,X).text.length));ue.length>1&&xe.length>1;)if(J(ue)==J(xe))ue.pop(),xe.pop(),X--;else if(ue[0]==xe[0])ue.shift(),xe.shift(),N++;else break;for(var be=0,Me=0,Fe=ue[0],We=xe[0],Xe=Math.min(Fe.length,We.length);be<Xe&&Fe.charCodeAt(be)==We.charCodeAt(be);)++be;for(var et=J(ue),Ye=J(xe),tt=Math.min(et.length-(ue.length==1?be:0),Ye.length-(xe.length==1?be:0));Me<tt&&et.charCodeAt(et.length-Me-1)==Ye.charCodeAt(Ye.length-Me-1);)++Me;if(ue.length==1&&xe.length==1&&N==r.line)for(;be&&be>r.ch&&et.charCodeAt(et.length-Me-1)==Ye.charCodeAt(Ye.length-Me-1);)be--,Me++;ue[ue.length-1]=et.slice(0,et.length-Me).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var ut=Ne(N,be),at=Ne(X,xe.length?J(xe).length-Me:0);if(ue.length>1||ue[0]||ct(ut,at))return kn(e.doc,ue,ut,at,"+input"),!0},_t.prototype.ensurePolled=function(){this.forceCompositionEnd()},_t.prototype.reset=function(){this.forceCompositionEnd()},_t.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},_t.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)},_t.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&or(this.cm,function(){return tr(e.cm)})},_t.prototype.setUneditable=function(e){e.contentEditable="false"},_t.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},_t.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},_t.prototype.onContextMenu=function(){},_t.prototype.resetPosition=function(){},_t.prototype.needsContentAttribute=!0;function Ds(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),S=Je(r,e.doc.direction),N="left";if(S){var K=He(S,t.ch);N=K%2?"right":"left"}var z=no(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",N=!1,K=e.doc.lineSeparator(),z=!1;function X(be){return function(Me){return Me.id==be}}function ie(){N&&(S+=K,z&&(S+=K),N=z=!1)}function ue(be){be&&(ie(),S+=be)}function xe(be){if(be.nodeType==1){var Me=be.getAttribute("cm-text");if(Me){ue(Me);return}var Fe=be.getAttribute("cm-marker"),We;if(Fe){var Xe=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Fe));Xe.length&&(We=Xe[0].find(0))&&ue(Pr(e.doc,We.from,We.to).join(K));return}if(be.getAttribute("contenteditable")=="false")return;var et=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;et&&ie();for(var Ye=0;Ye<be.childNodes.length;Ye++)xe(be.childNodes[Ye]);/^(pre|p)$/i.test(be.nodeName)&&(z=!0),et&&(N=!0)}else be.nodeType==3&&ue(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,z=!1;return S}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Ne(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 S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!E(r,t))return Bn(Ne(Tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?J(e.rest):e.line;return Bn(Ne(Tt(S),S.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var z=e.measure,X=z.maps;function ie(We,Xe,et){for(var Ye=-1;Ye<(X?X.length:0);Ye++)for(var tt=Ye<0?z.map:X[Ye],ut=0;ut<tt.length;ut+=3){var at=tt[ut+2];if(at==We||at==Xe){var pt=Tt(Ye<0?e.line:e.rest[Ye]),Lt=tt[ut]+et;return(et<0||at!=We)&&(Lt=tt[ut+(et?1:0)]),Ne(pt,Lt)}}}var ue=ie(N,K,n);if(ue)return Bn(ue,i);for(var xe=K.nextSibling,be=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(ue=ie(xe,xe.firstChild,0),ue)return Bn(Ne(ue.line,ue.ch-be),i);be+=xe.textContent.length}for(var Me=K.previousSibling,Fe=n;Me;Me=Me.previousSibling){if(ue=ie(Me,Me.firstChild,-1),ue)return Bn(Ne(ue.line,ue.ch+Fe),i);Fe+=Me.textContent.length}}var Mt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Mt.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),g&&(i.style.width="0px"),Se(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(N){if(Ie(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(N){if(Ie(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=Cs(r);ta({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,ve):(n.prevInput="",i.value=K.text.join(`
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Se(i,"cut",S),Se(i,"copy",S),Se(e.scroller,"paste",function(N){if(Nr(e,N)||Ie(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Se(e.lineSpace,"selectstart",function(N){Nr(e,N)||$(N)}),Se(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Mt.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Mt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Mt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-S.left))}return r},Mt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Mt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},Mt.prototype.getField=function(){return this.textarea},Mt.prototype.supportsTouch=function(){return!1},Mt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Mt.prototype.blur=function(){this.textarea.blur()},Mt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Mt.prototype.receivedFocus=function(){this.slowPoll()},Mt.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()})},Mt.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)},Mt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&U>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return or(t,function(){Ga(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Mt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Mt.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},Mt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=on(n,e),N=r.scroller.scrollTop;if(!S||x)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(S)==-1&&jt(n,Xt)(n.doc,zr(S),ve);var z=i.style.cssText,X=t.wrapper.style.cssText,ie=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ie.top-5)+"px; left: "+(e.clientX-ie.left-5)+`px;
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;k&&(ue=window.scrollY),r.input.focus(),k&&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 Fe=n.somethingSelected(),We="\u200B"+(Fe?i.value:"");i.value="\u21DA",i.value=We,t.prevInput=Fe?"":"\u200B",i.selectionStart=1,i.selectionEnd=We.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=z,B&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&U<9)&&xe();var Fe=0,We=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Fe++<10?r.detectingSelectAll=setTimeout(We,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(We,200)}}if(B&&U>=9&&xe(),_){le(e);var Me=function(){Ke(window,"mouseup",Me),setTimeout(be,20)};Se(window,"mouseup",Me)}else setTimeout(be,50)},Mt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Mt.prototype.setUneditable=function(){},Mt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Se(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var N=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Dt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=Ke,e.on=Se,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=H,e.findColumn=fe,e.isWordChar=we,e.Pass=Te,e.signal=Le,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Ne,e.cmpPos=ct,e.modes=Ut,e.mimeModes=Et,e.resolveMode=lr,e.getMode=pr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=_r,e.startState=Kn,e.innerMode=Hn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Un,e.normalizeKeyMap=Ml,e.StringStream=Rt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=$,e.e_stopPropagation=Z,e.e_stop=le,e.addClass=F,e.contains=E,e.rmClass=h,e.keyNames=$r}$l(Dt),ql(Dt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&ee(au,na)<0&&(Dt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return de(rr),Dt.inputStyles={textarea:Mt,contenteditable:_t},Dt.defineMode=function(e){!Dt.defaults.mode&&e!="null"&&(Dt.defaults.mode=e),Cr.apply(this,arguments)},Dt.defineMIME=Rr,Dt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Dt.defineMIME("text/plain","null"),Dt.defineExtension=function(e,t){Dt.prototype[e]=t},Dt.defineDocExtension=function(e,t){rr.prototype[e]=t},Dt.fromTextArea=nu,iu(Dt),Dt.version="5.58.2",Dt})},Y1PL:function(st,ze,q){"use strict";q.r(ze),q.d(ze,"ResizableTextArea",function(){return ee});var re=q("wx14"),V=q("1OyB"),A=q("vuIU"),G=q("Ji7U"),I=q("LK+K"),R=q("cDcd"),B=q("VTBJ"),U=q("rePB"),k=q("Zm9Q"),L=q("Kwbf"),y=q("c+Xe"),x=q("m+aA"),O=q("bdgK"),C=new Map;function T(ve){ve.forEach(function(ge){var he,fe=ge.target;(he=C.get(fe))===null||he===void 0||he.forEach(function(ae){return ae(fe)})})}var g=new O.default(T),d=null,o=null;function u(ve,ge){C.has(ve)||(C.set(ve,new Set),g.observe(ve)),C.get(ve).add(ge)}function s(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(g.unobserve(ve),C.delete(ve)))}var w=function(ve){Object(G.a)(he,ve);var ge=Object(I.a)(he);function he(){return Object(V.a)(this,he),ge.apply(this,arguments)}return Object(A.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(R.Component),p=R.createContext(null);function f(ve){var ge=ve.children,he=ve.onBatchResize,fe=R.useRef(0),ae=R.useRef([]),me=R.useContext(p),J=R.useCallback(function(ne,Q,Ee){fe.current+=1;var Ce=fe.current;ae.current.push({size:ne,element:Q,data:Ee}),Promise.resolve().then(function(){Ce===fe.current&&(he==null||he(ae.current),ae.current=[])}),me==null||me(ne,Q,Ee)},[he,me]);return R.createElement(p.Provider,{value:J},ge)}function _(ve){var ge=ve.children,he=ve.disabled,fe=R.useRef(null),ae=R.useRef(null),me=R.useContext(p),J=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=R.isValidElement(ge)&&Object(y.c)(ge),Q=ne?ge.ref:null,Ee=R.useMemo(function(){return Object(y.a)(Q,fe)},[Q,fe]),Ce=R.useRef(ve);Ce.current=ve;var ye=R.useCallback(function(we){var De=Ce.current,Pe=De.onResize,ke=De.data,Oe=we.getBoundingClientRect(),Re=Oe.width,Ge=Oe.height,$e=we.offsetWidth,Be=we.offsetHeight,He=Math.floor(Re),rt=Math.floor(Ge);if(J.current.width!==He||J.current.height!==rt||J.current.offsetWidth!==$e||J.current.offsetHeight!==Be){var Je={width:He,height:rt,offsetWidth:$e,offsetHeight:Be};J.current=Je;var qe=$e===Math.round(Re)?Re:$e,Se=Be===Math.round(Ge)?Ge:Be,Ze=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:qe,offsetHeight:Se});me==null||me(Ze,we,ke),Pe&&Promise.resolve().then(function(){Pe(Ze,we)})}},[]);return R.useEffect(function(){var we=Object(x.a)(fe.current)||Object(x.a)(ae.current);return we&&!he&&u(we,ye),function(){return s(we,ye)}},[fe.current,he]),R.createElement(w,{ref:ae},ne?R.cloneElement(ge,{ref:Ee}):ge)}var b="rc-observer-key";function h(ve){var ge=ve.children,he=Object(k.a)(ge);return he.map(function(fe,ae){var me=(fe==null?void 0:fe.key)||"".concat(b,"-").concat(ae);return R.createElement(_,Object(re.a)({},ve,{key:me}),fe)})}h.Collection=f;var c=h,l=q("bT9E"),a=q("TSYQ"),v=q.n(a),m=`
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
`,E=["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"],M={},F;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&M[he])return M[he];var fe=window.getComputedStyle(ve),ae=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),me=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),J=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ne=E.map(function(Ee){return"".concat(Ee,":").concat(fe.getPropertyValue(Ee))}).join(";"),Q={sizingStyle:ne,paddingSize:me,borderSize:J,boxSizing:ae};return ge&&he&&(M[he]=Q),Q}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ve.getAttribute("wrap")?F.setAttribute("wrap",ve.getAttribute("wrap")):F.removeAttribute("wrap");var ae=j(ve,ge),me=ae.paddingSize,J=ae.borderSize,ne=ae.boxSizing,Q=ae.sizingStyle;F.setAttribute("style","".concat(Q,";").concat(m)),F.value=ve.value||ve.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ye=F.scrollHeight,we;if(ne==="border-box"?ye+=J:ne==="content-box"&&(ye-=me),he!==null||fe!==null){F.value=" ";var De=F.scrollHeight-me;he!==null&&(Ee=De*he,ne==="border-box"&&(Ee=Ee+me+J),ye=Math.max(Ee,ye)),fe!==null&&(Ce=De*fe,ne==="border-box"&&(Ce=Ce+me+J),we=ye>Ce?"":"hidden",ye=Math.min(Ce,ye))}return{height:ye,minHeight:Ee,maxHeight:Ce,overflowY:we,resize:"none"}}var D=q("Gytx"),P=q.n(D),H;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(H||(H={}));var Y=function(ve){Object(G.a)(he,ve);var ge=Object(I.a)(he);function he(fe){var ae;return Object(V.a)(this,he),ae=ge.call(this,fe),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(me){ae.textArea=me},ae.handleResize=function(me){var J=ae.state.resizeStatus,ne=ae.props,Q=ne.autoSize,Ee=ne.onResize;if(J!==H.NONE)return;typeof Ee=="function"&&Ee(me),Q&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var me=ae.props.autoSize;if(!me||!ae.textArea)return;var J=me.minRows,ne=me.maxRows,Q=W(ae.textArea,!1,J,ne);ae.setState({textareaStyles:Q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:H.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:H.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var me=ae.props,J=me.prefixCls,ne=J===void 0?"rc-textarea":J,Q=me.autoSize,Ee=me.onResize,Ce=me.className,ye=me.disabled,we=ae.state,De=we.textareaStyles,Pe=we.resizeStatus,ke=Object(l.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Oe=v()(ne,Ce,Object(U.a)({},"".concat(ne,"-disabled"),ye));"value"in ke&&(ke.value=ke.value||"");var Re=Object(B.a)(Object(B.a)(Object(B.a)({},ae.props.style),De),Pe===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ae.handleResize,disabled:!(Q||Ee)},R.createElement("textarea",Object(re.a)({},ke,{className:Oe,style:Re,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:H.NONE},ae}return Object(A.a)(he,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!P()(ae.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 ae=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,me)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(R.Component),ee=Y,oe=function(ve){Object(G.a)(he,ve);var ge=Object(I.a)(he);function he(fe){var ae;Object(V.a)(this,he),ae=ge.call(this,fe),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(J){ae.resizableTextArea=J},ae.handleChange=function(J){var ne=ae.props.onChange;ae.setValue(J.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ne&&ne(J)},ae.handleKeyDown=function(J){var ne=ae.props,Q=ne.onPressEnter,Ee=ne.onKeyDown;J.keyCode===13&&Q&&Q(J),Ee&&Ee(J)};var me=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ae.state={value:me},ae}return Object(A.a)(he,[{key:"setValue",value:function(ae,me){"value"in this.props||this.setState({value:ae},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ee,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),he}(R.Component),Te=ze.default=oe},ZW9T:function(st,ze,q){"use strict";q.d(ze,"a",function(){return p});var re=q("k1fw"),V=q("miYZ"),A=q("tsqr"),G=q("rAM+"),I=q("tJVT"),R=q("PpiC"),B=q("cDcd"),U=q.n(B),k=q("bdgK");function L(f,_,b,h,c){var l=_.getWordUntilPosition(b),a={startLineNumber:b.lineNumber,endLineNumber:b.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn},v=h.map(function(m){return{label:m,kind:f.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(m){v.push(Object(re.a)(Object(re.a)({},m),{},{range:a}))}),v}var y=function(f){var _={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},b=["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(a,v){var m=L(f,a,v,b,[_]);return{suggestions:m}}});var h=["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(a,v){var m=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=L(f,a,v,h,m);return{suggestions:E}}});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(a,v){var m=[_,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=L(f,a,v,c,m);return{suggestions:E}}})},x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=q("LvDl"),C=q("+ua5");function T(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function g(){}var d=!1,o={"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 u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],_=f;if(Array.isArray(f)){for(var b=0;b<f.length;b++){var h=o[f[b]];if(h)return h}return _[0]}return o[_]||_}var s=null,w=ze.b=function(f){var _=f.width,b=_===void 0?"100%":_,h=f.height,c=h===void 0?"100%":h,l=f.value,a=f.language,v=a===void 0?"javascript":a,m=f.style,E=m===void 0?{}:m,M=f.options,F=M===void 0?{}:M,j=f.overrideServices,W=j===void 0?{}:j,D=f.theme,P=D===void 0?"vs-dark":D,H=f.onEditBlur,Y=f.onSave,ee=f.autoHeight,oe=ee===void 0?!1:ee,Te=f.forbidCopy,ve=Te===void 0?!1:Te,ge=f.onChange,he=ge===void 0?g:ge,fe=f.editorDidMount,ae=fe===void 0?g:fe,me=f.onFocus,J=me===void 0?g:me,ne=f.filename,Q=ne===void 0?"educoder.txt":ne,Ee=f.errorLine,Ce=f.errorContent,ye=Ce===void 0?"":Ce,we=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),De=Object(B.useRef)(),Pe=Object(B.useRef)({}),ke=Object(B.useRef)(),Oe=Object(B.useRef)(!1),Re=Object(B.useRef)(),Ge=Object(B.useState)(!1),$e=Object(I.a)(Ge,2),Be=$e[0],He=$e[1];function rt(){var _e;return De.current&&(_e=new k.default(function(Ue){var Qe=Object(G.a)(Ue),Ve;try{for(Qe.s();!(Ve=Qe.n()).done;){var mt=Ve.value;(mt.target.offsetHeight>0||mt.target.offsetWidth>0)&&Pe.current.instance.layout()}}catch(dt){Qe.e(dt)}finally{Qe.f()}}),_e.observe(De.current)),_e}function Je(){A.b.warn(decodeURIComponent(x))}var qe=function(){var Ue=Pe.current.instance;if(l!=null&&Ue&&Be){var Qe=Ue.getModel();Qe&&l!==Qe.getValue()&&(d=!0,Qe.setValue(l),Ue.layout(),d=!1)}};Object(B.useEffect)(function(){ke.current&&clearTimeout(ke.current),ke.current=setTimeout(function(){qe()},500)},[l,Be,Pe.current]),Object(B.useEffect)(function(){if(Ee&&Pe.current&&Pe.current.instance){var _e=Pe.current.instance;_e.changeViewZones(function(Qe){var Ve=document.createElement("div");Ve.style.padding="10px 20px",Ve.style.width="calc(100% - 20px)",Ve.className="my-error-line-wrp",Ve.innerHTML=ye,Qe.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:Ve})});var Ue={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}};_e.addOverlayWidget(Ue),_e.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,Pe.current,Be]);function Se(){var _e=Pe.current.instance;if(_e){var Ue=_e.getSelection(),Qe=Pe.current.pastePos||{},Ve=new s.Range(Qe.startLineNumber||Ue.endLineNumber,Qe.startColumn||Ue.endColumn,Qe.endLineNumber||Ue.endLineNumber,Qe.endColumn||Ue.endColumn);setTimeout(function(){_e.executeEdits("",[{range:Ve,text:""}])},300)}}function Ze(_e){(window.navigator.platform.match("Mac")?_e.metaKey:_e.ctrlKey)&&_e.keyCode==83&&(_e.preventDefault(),Y())}var Ke=function(){if(oe&&Pe.current.instance){var Ue=Pe.current.instance.getContentHeight();ce(Ue<c?c:Ue)}else ce(c)};function Le(_e){var Ue=document.createEvent("MouseEvents");Ue.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),_e.dispatchEvent(Ue)}function Ie(_e,Ue){var Qe=window.URL||window.webkitURL||window,Ve=new Blob([Ue]),mt=document.createElementNS("http://www.w3.org/1999/xhtml","a");mt.href=Qe.createObjectURL(Ve),mt.download=_e,Le(mt)}Object(B.useEffect)(function(){Ke()},[Ke]),Object(B.useEffect)(function(){De.current&&!Be&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(_e){try{s=_e,Pe.current.instance=s.editor.create(De.current,{value:l,language:u(v),theme:P,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ue=Pe.current.instance;if(ae(Ue,s),setTimeout(function(){Ke(),Pe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ie(Q||"educoder.txt",Ue.getValue())}})},500),Pe.current.subscription=Ue.onDidChangeModelContent(function(Ve){Oe.current?clearTimeout(Re.current):(Ke(),he(Ue.getValue(),Ve)),Re.current=setTimeout(function(){Oe.current=!1},500)}),window.Monaco||y(s),ve&&(Ue.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Je(),null}),Ue.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Je(),null})),window.Monaco=s,H&&Ue.onDidBlurEditorWidget(function(){H(Ue.getValue())}),J&&Ue.onDidFocusEditorText(function(){J(Ue.getValue())}),ve){Ue.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Je(),null}),Ue.onDidPaste(function(Ve){Pe.current.pastePos=Ve});try{window.addEventListener("paste",Se)}catch(Ve){}}var Qe=rt();return He(!0),function(){var Ve=Pe.current.instance;Ve.dispose();var mt=Ve.getModel();mt&&mt.dispose(),Pe.current.subscription&&Pe.current.subscription.dispose(),ve&&window.removeEventListener("paste",Se),Qe.unobserve(De.current)}}catch(Ve){}})},[]),Object(B.useEffect)(function(){var _e=Pe.current.instance;if(_e&&Be)return document.addEventListener("keydown",Ze,!1),function(){document.removeEventListener("keydown",Ze)}},[Y,Be]),Object(B.useEffect)(function(){var _e=Pe.current.instance;if(_e&&Be){var Ue=u(v);s.editor.setModelLanguage(_e.getModel(),Ue),console.log("language:",v,_e.getModel(),Ue)}},[v,Be]),Object(B.useEffect)(function(){var _e=Pe.current.instance;_e&&Be&&s.editor.setTheme(P)},[P,Be]),Object(B.useEffect)(function(){var _e=Pe.current.instance;_e&&Be&&(_e.updateOptions(Object(re.a)({},F)),setTimeout(function(){_e.getModel().updateOptions(Object(re.a)({},F))},200))},[JSON.stringify(F),Be]),Object(B.useEffect)(function(){var _e=Pe.current.instance;_e&&Be&&_e.layout()},[b,c,Be]);var pe=Object(B.useState)(T(b)),se=Object(I.a)(pe,2),de=se[0],$=se[1],Z=Object(B.useState)(T(c)),te=Object(I.a)(Z,2),le=te[0],ce=te[1],Ae=Object(re.a)(Object(re.a)({},E),{},{width:de,height:le});return U.a.createElement("div",{className:"my-monaco-editor",ref:De,style:Ae})};function p(f){var _=f.width,b=_===void 0?"100%":_,h=f.height,c=h===void 0?"100%":h,l=f.original,a=f.modified,v=f.language,m=f.options,E=m===void 0?{}:m,M=Object(B.useRef)(),F=Object(B.useState)(null),j=Object(I.a)(F,2),W=j[0],D=j[1];function P(oe){var Te;return M.current&&(Te=new k.default(function(ve){var ge=Object(G.a)(ve),he;try{for(ge.s();!(he=ge.n()).done;){var fe=he.value;(fe.target.offsetHeight>0||fe.target.offsetWidth>0)&&oe.layout()}}catch(ae){ge.e(ae)}finally{ge.f()}}),Te.observe(M.current)),Te}Object(B.useEffect)(function(){M.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(oe){s=oe;var Te=s.editor.createDiffEditor(M.current,Object(re.a)(Object(re.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},E),{},{wordWrap:!0}));D(Te);var ve=P(Te);return function(){Te.dispose();var ge=Te.getModel();ge&&ge.dispose(),ve.unobserve(M.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(l,v),modified:s.editor.createModel(a,v)})},[l,a,v,W]);var H=T(b),Y=T(c),ee={width:H,height:Y};return U.a.createElement("div",{className:"my-diff-editor",ref:M,style:ee})}},ZpRC:function(st,ze,q){"use strict";function re(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function V(y,x){return(!x||y!=="hidden")&&y!=="visible"&&y!=="clip"}function A(y,x){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var O=getComputedStyle(y,null);return V(O.overflowY,x)||V(O.overflowX,x)||function(C){var T=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!T&&(T.clientHeight<C.scrollHeight||T.clientWidth<C.scrollWidth)}(y)}return!1}function G(y,x,O,C,T,g,d,o){return g<y&&d>x||g>y&&d<x?0:g<=y&&o<=O||d>=x&&o>=O?g-y-C:d>x&&o<O||g<y&&o>O?d-x+T:0}var I=function(y,x){var O=window,C=x.scrollMode,T=x.block,g=x.inline,d=x.boundary,o=x.skipOverflowHiddenElements,u=typeof d=="function"?d:function(De){return De!==d};if(!re(y))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,w=[],p=y;re(p)&&u(p);){if((p=p.parentElement)===s){w.push(p);break}p!=null&&p===document.body&&A(p)&&!A(document.documentElement)||p!=null&&A(p,o)&&w.push(p)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,_=O.visualViewport?O.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=y.getBoundingClientRect(),l=c.height,a=c.width,v=c.top,m=c.right,E=c.bottom,M=c.left,F=T==="start"||T==="nearest"?v:T==="end"?E:v+l/2,j=g==="center"?M+a/2:g==="end"?m:M,W=[],D=0;D<w.length;D++){var P=w[D],H=P.getBoundingClientRect(),Y=H.height,ee=H.width,oe=H.top,Te=H.right,ve=H.bottom,ge=H.left;if(C==="if-needed"&&v>=0&&M>=0&&E<=_&&m<=f&&v>=oe&&E<=ve&&M>=ge&&m<=Te)return W;var he=getComputedStyle(P),fe=parseInt(he.borderLeftWidth,10),ae=parseInt(he.borderTopWidth,10),me=parseInt(he.borderRightWidth,10),J=parseInt(he.borderBottomWidth,10),ne=0,Q=0,Ee="offsetWidth"in P?P.offsetWidth-P.clientWidth-fe-me:0,Ce="offsetHeight"in P?P.offsetHeight-P.clientHeight-ae-J:0;if(s===P)ne=T==="start"?F:T==="end"?F-_:T==="nearest"?G(h,h+_,_,ae,J,h+F,h+F+l,l):F-_/2,Q=g==="start"?j:g==="center"?j-f/2:g==="end"?j-f:G(b,b+f,f,fe,me,b+j,b+j+a,a),ne=Math.max(0,ne+h),Q=Math.max(0,Q+b);else{ne=T==="start"?F-oe-ae:T==="end"?F-ve+J+Ce:T==="nearest"?G(oe,ve,Y,ae,J+Ce,F,F+l,l):F-(oe+Y/2)+Ce/2,Q=g==="start"?j-ge-fe:g==="center"?j-(ge+ee/2)+Ee/2:g==="end"?j-Te+me+Ee:G(ge,Te,ee,fe,me+Ee,j,j+a,a);var ye=P.scrollLeft,we=P.scrollTop;F+=we-(ne=Math.max(0,Math.min(we+ne,P.scrollHeight-Y+Ce))),j+=ye-(Q=Math.max(0,Math.min(ye+Q,P.scrollWidth-ee+Ee)))}W.push({el:P,top:ne,left:Q})}return W};function R(y){return y===Object(y)&&Object.keys(y).length!==0}function B(y,x){x===void 0&&(x="auto");var O="scrollBehavior"in document.body.style;y.forEach(function(C){var T=C.el,g=C.top,d=C.left;T.scroll&&O?T.scroll({top:g,left:d,behavior:x}):(T.scrollTop=g,T.scrollLeft=d)})}function U(y){return y===!1?{block:"end",inline:"nearest"}:R(y)?y:{block:"start",inline:"nearest"}}function k(y,x){var O=!y.ownerDocument.documentElement.contains(y);if(R(x)&&typeof x.behavior=="function")return x.behavior(O?[]:I(y,x));if(O)return;var C=U(x);return B(I(y,C),C.behavior)}var L=ze.a=k},Zss7:function(st,ze,q){var re;(function(V){var A=/^\s+/,G=/\s+$/,I=0,R=V.round,B=V.min,U=V.max,k=V.random;function L(J,ne){if(J=J||"",ne=ne||{},J instanceof L)return J;if(!(this instanceof L))return new L(J,ne);var Q=y(J);this._originalInput=J,this._r=Q.r,this._g=Q.g,this._b=Q.b,this._a=Q.a,this._roundA=R(100*this._a)/100,this._format=ne.format||Q.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Q.ok,this._tc_id=I++}L.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),ne,Q,Ee,Ce,ye,we;return ne=J.r/255,Q=J.g/255,Ee=J.b/255,ne<=.03928?Ce=ne/12.92:Ce=V.pow((ne+.055)/1.055,2.4),Q<=.03928?ye=Q/12.92:ye=V.pow((Q+.055)/1.055,2.4),Ee<=.03928?we=Ee/12.92:we=V.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ye+.0722*we},setAlpha:function(J){return this._a=W(J),this._roundA=R(100*this._a)/100,this},toHsv:function(){var J=T(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=T(this._r,this._g,this._b),ne=R(J.h*360),Q=R(J.s*100),Ee=R(J.v*100);return this._a==1?"hsv("+ne+", "+Q+"%, "+Ee+"%)":"hsva("+ne+", "+Q+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var J=O(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=O(this._r,this._g,this._b),ne=R(J.h*360),Q=R(J.s*100),Ee=R(J.l*100);return this._a==1?"hsl("+ne+", "+Q+"%, "+Ee+"%)":"hsla("+ne+", "+Q+"%, "+Ee+"%, "+this._roundA+")"},toHex:function(J){return d(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(D(this._r,255)*100)+"%",g:R(D(this._g,255)*100)+"%",b:R(D(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%)":"rgba("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var ne="#"+u(this._r,this._g,this._b,this._a),Q=ne,Ee=this._gradientType?"GradientType = 1, ":"";if(J){var Ce=L(J);Q="#"+u(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ne+",endColorstr="+Q+")"},toString:function(J){var ne=!!J;J=J||this._format;var Q=!1,Ee=this._a<1&&this._a>=0,Ce=!ne&&Ee&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Ce?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(Q=this.toRgbString()),J==="prgb"&&(Q=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(Q=this.toHexString()),J==="hex3"&&(Q=this.toHexString(!0)),J==="hex4"&&(Q=this.toHex8String(!0)),J==="hex8"&&(Q=this.toHex8String()),J==="name"&&(Q=this.toName()),J==="hsl"&&(Q=this.toHslString()),J==="hsv"&&(Q=this.toHsvString()),Q||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function(J,ne){var Q=J.apply(null,[this].concat([].slice.call(ne)));return this._r=Q._r,this._g=Q._g,this._b=Q._b,this.setAlpha(Q._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function(J,ne){return J.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},L.fromRatio=function(J,ne){if(typeof J=="object"){var Q={};for(var Ee in J)J.hasOwnProperty(Ee)&&(Ee==="a"?Q[Ee]=J[Ee]:Q[Ee]=Te(J[Ee]));J=Q}return L(J,ne)};function y(J){var ne={r:0,g:0,b:0},Q=1,Ee=null,Ce=null,ye=null,we=!1,De=!1;return typeof J=="string"&&(J=ae(J)),typeof J=="object"&&(fe(J.r)&&fe(J.g)&&fe(J.b)?(ne=x(J.r,J.g,J.b),we=!0,De=String(J.r).substr(-1)==="%"?"prgb":"rgb"):fe(J.h)&&fe(J.s)&&fe(J.v)?(Ee=Te(J.s),Ce=Te(J.v),ne=g(J.h,Ee,Ce),we=!0,De="hsv"):fe(J.h)&&fe(J.s)&&fe(J.l)&&(Ee=Te(J.s),ye=Te(J.l),ne=C(J.h,Ee,ye),we=!0,De="hsl"),J.hasOwnProperty("a")&&(Q=J.a)),Q=W(Q),{ok:we,format:J.format||De,r:B(255,U(ne.r,0)),g:B(255,U(ne.g,0)),b:B(255,U(ne.b,0)),a:Q}}function x(J,ne,Q){return{r:D(J,255)*255,g:D(ne,255)*255,b:D(Q,255)*255}}function O(J,ne,Q){J=D(J,255),ne=D(ne,255),Q=D(Q,255);var Ee=U(J,ne,Q),Ce=B(J,ne,Q),ye,we,De=(Ee+Ce)/2;if(Ee==Ce)ye=we=0;else{var Pe=Ee-Ce;we=De>.5?Pe/(2-Ee-Ce):Pe/(Ee+Ce);switch(Ee){case J:ye=(ne-Q)/Pe+(ne<Q?6:0);break;case ne:ye=(Q-J)/Pe+2;break;case Q:ye=(J-ne)/Pe+4;break}ye/=6}return{h:ye,s:we,l:De}}function C(J,ne,Q){var Ee,Ce,ye;J=D(J,360),ne=D(ne,100),Q=D(Q,100);function we(ke,Oe,Re){return Re<0&&(Re+=1),Re>1&&(Re-=1),Re<1/6?ke+(Oe-ke)*6*Re:Re<1/2?Oe:Re<2/3?ke+(Oe-ke)*(2/3-Re)*6:ke}if(ne===0)Ee=Ce=ye=Q;else{var De=Q<.5?Q*(1+ne):Q+ne-Q*ne,Pe=2*Q-De;Ee=we(Pe,De,J+1/3),Ce=we(Pe,De,J),ye=we(Pe,De,J-1/3)}return{r:Ee*255,g:Ce*255,b:ye*255}}function T(J,ne,Q){J=D(J,255),ne=D(ne,255),Q=D(Q,255);var Ee=U(J,ne,Q),Ce=B(J,ne,Q),ye,we,De=Ee,Pe=Ee-Ce;if(we=Ee===0?0:Pe/Ee,Ee==Ce)ye=0;else{switch(Ee){case J:ye=(ne-Q)/Pe+(ne<Q?6:0);break;case ne:ye=(Q-J)/Pe+2;break;case Q:ye=(J-ne)/Pe+4;break}ye/=6}return{h:ye,s:we,v:De}}function g(J,ne,Q){J=D(J,360)*6,ne=D(ne,100),Q=D(Q,100);var Ee=V.floor(J),Ce=J-Ee,ye=Q*(1-ne),we=Q*(1-Ce*ne),De=Q*(1-(1-Ce)*ne),Pe=Ee%6,ke=[Q,we,ye,ye,De,Q][Pe],Oe=[De,Q,Q,we,ye,ye][Pe],Re=[ye,ye,De,Q,Q,we][Pe];return{r:ke*255,g:Oe*255,b:Re*255}}function d(J,ne,Q,Ee){var Ce=[oe(R(J).toString(16)),oe(R(ne).toString(16)),oe(R(Q).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 o(J,ne,Q,Ee,Ce){var ye=[oe(R(J).toString(16)),oe(R(ne).toString(16)),oe(R(Q).toString(16)),oe(ve(Ee))];return Ce&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function u(J,ne,Q,Ee){var Ce=[oe(ve(Ee)),oe(R(J).toString(16)),oe(R(ne).toString(16)),oe(R(Q).toString(16))];return Ce.join("")}L.equals=function(J,ne){return!J||!ne?!1:L(J).toRgbString()==L(ne).toRgbString()},L.random=function(){return L.fromRatio({r:k(),g:k(),b:k()})};function s(J,ne){ne=ne===0?0:ne||10;var Q=L(J).toHsl();return Q.s-=ne/100,Q.s=P(Q.s),L(Q)}function w(J,ne){ne=ne===0?0:ne||10;var Q=L(J).toHsl();return Q.s+=ne/100,Q.s=P(Q.s),L(Q)}function p(J){return L(J).desaturate(100)}function f(J,ne){ne=ne===0?0:ne||10;var Q=L(J).toHsl();return Q.l+=ne/100,Q.l=P(Q.l),L(Q)}function _(J,ne){ne=ne===0?0:ne||10;var Q=L(J).toRgb();return Q.r=U(0,B(255,Q.r-R(255*-(ne/100)))),Q.g=U(0,B(255,Q.g-R(255*-(ne/100)))),Q.b=U(0,B(255,Q.b-R(255*-(ne/100)))),L(Q)}function b(J,ne){ne=ne===0?0:ne||10;var Q=L(J).toHsl();return Q.l-=ne/100,Q.l=P(Q.l),L(Q)}function h(J,ne){var Q=L(J).toHsl(),Ee=(Q.h+ne)%360;return Q.h=Ee<0?360+Ee:Ee,L(Q)}function c(J){var ne=L(J).toHsl();return ne.h=(ne.h+180)%360,L(ne)}function l(J){var ne=L(J).toHsl(),Q=ne.h;return[L(J),L({h:(Q+120)%360,s:ne.s,l:ne.l}),L({h:(Q+240)%360,s:ne.s,l:ne.l})]}function a(J){var ne=L(J).toHsl(),Q=ne.h;return[L(J),L({h:(Q+90)%360,s:ne.s,l:ne.l}),L({h:(Q+180)%360,s:ne.s,l:ne.l}),L({h:(Q+270)%360,s:ne.s,l:ne.l})]}function v(J){var ne=L(J).toHsl(),Q=ne.h;return[L(J),L({h:(Q+72)%360,s:ne.s,l:ne.l}),L({h:(Q+216)%360,s:ne.s,l:ne.l})]}function m(J,ne,Q){ne=ne||6,Q=Q||30;var Ee=L(J).toHsl(),Ce=360/Q,ye=[L(J)];for(Ee.h=(Ee.h-(Ce*ne>>1)+720)%360;--ne;)Ee.h=(Ee.h+Ce)%360,ye.push(L(Ee));return ye}function E(J,ne){ne=ne||6;for(var Q=L(J).toHsv(),Ee=Q.h,Ce=Q.s,ye=Q.v,we=[],De=1/ne;ne--;)we.push(L({h:Ee,s:Ce,v:ye})),ye=(ye+De)%1;return we}L.mix=function(J,ne,Q){Q=Q===0?0:Q||50;var Ee=L(J).toRgb(),Ce=L(ne).toRgb(),ye=Q/100,we={r:(Ce.r-Ee.r)*ye+Ee.r,g:(Ce.g-Ee.g)*ye+Ee.g,b:(Ce.b-Ee.b)*ye+Ee.b,a:(Ce.a-Ee.a)*ye+Ee.a};return L(we)},L.readability=function(J,ne){var Q=L(J),Ee=L(ne);return(V.max(Q.getLuminance(),Ee.getLuminance())+.05)/(V.min(Q.getLuminance(),Ee.getLuminance())+.05)},L.isReadable=function(J,ne,Q){var Ee=L.readability(J,ne),Ce,ye;ye=!1,Ce=me(Q);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ye=Ee>=4.5;break;case"AAlarge":ye=Ee>=3;break;case"AAAsmall":ye=Ee>=7;break}return ye},L.mostReadable=function(J,ne,Q){var Ee=null,Ce=0,ye,we,De,Pe;Q=Q||{},we=Q.includeFallbackColors,De=Q.level,Pe=Q.size;for(var ke=0;ke<ne.length;ke++)ye=L.readability(J,ne[ke]),ye>Ce&&(Ce=ye,Ee=L(ne[ke]));return L.isReadable(J,Ee,{level:De,size:Pe})||!we?Ee:(Q.includeFallbackColors=!1,L.mostReadable(J,["#fff","#000"],Q))};var M=L.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=L.hexNames=j(M);function j(J){var ne={};for(var Q in J)J.hasOwnProperty(Q)&&(ne[J[Q]]=Q);return ne}function W(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function D(J,ne){Y(J)&&(J="100%");var Q=ee(J);return J=B(ne,U(0,parseFloat(J))),Q&&(J=parseInt(J*ne,10)/100),V.abs(J-ne)<1e-6?1:J%ne/parseFloat(ne)}function P(J){return B(1,U(0,J))}function H(J){return parseInt(J,16)}function Y(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function ee(J){return typeof J=="string"&&J.indexOf("%")!=-1}function oe(J){return J.length==1?"0"+J:""+J}function Te(J){return J<=1&&(J=J*100+"%"),J}function ve(J){return V.round(parseFloat(J)*255).toString(16)}function ge(J){return H(J)/255}var he=function(){var J="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",Q="(?:"+ne+")|(?:"+J+")",Ee="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?",Ce="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?";return{CSS_UNIT:new RegExp(Q),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 fe(J){return!!he.CSS_UNIT.exec(J)}function ae(J){J=J.replace(A,"").replace(G,"").toLowerCase();var ne=!1;if(M[J])J=M[J],ne=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Q;return(Q=he.rgb.exec(J))?{r:Q[1],g:Q[2],b:Q[3]}:(Q=he.rgba.exec(J))?{r:Q[1],g:Q[2],b:Q[3],a:Q[4]}:(Q=he.hsl.exec(J))?{h:Q[1],s:Q[2],l:Q[3]}:(Q=he.hsla.exec(J))?{h:Q[1],s:Q[2],l:Q[3],a:Q[4]}:(Q=he.hsv.exec(J))?{h:Q[1],s:Q[2],v:Q[3]}:(Q=he.hsva.exec(J))?{h:Q[1],s:Q[2],v:Q[3],a:Q[4]}:(Q=he.hex8.exec(J))?{r:H(Q[1]),g:H(Q[2]),b:H(Q[3]),a:ge(Q[4]),format:ne?"name":"hex8"}:(Q=he.hex6.exec(J))?{r:H(Q[1]),g:H(Q[2]),b:H(Q[3]),format:ne?"name":"hex"}:(Q=he.hex4.exec(J))?{r:H(Q[1]+""+Q[1]),g:H(Q[2]+""+Q[2]),b:H(Q[3]+""+Q[3]),a:ge(Q[4]+""+Q[4]),format:ne?"name":"hex8"}:(Q=he.hex3.exec(J))?{r:H(Q[1]+""+Q[1]),g:H(Q[2]+""+Q[2]),b:H(Q[3]+""+Q[3]),format:ne?"name":"hex"}:!1}function me(J){var ne,Q;return J=J||{level:"AA",size:"small"},ne=(J.level||"AA").toUpperCase(),Q=(J.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),Q!=="small"&&Q!=="large"&&(Q="small"),{level:ne,size:Q}}st.exports?st.exports=L:!(re=function(){return L}.call(ze,q,ze,st),re!==void 0&&(st.exports=re))})(Math)},bT9E:function(st,ze,q){"use strict";q.d(ze,"a",function(){return V});var re=q("VTBJ");function V(A,G){var I=Object(re.a)({},A);return Array.isArray(G)&&G.forEach(function(R){delete I[R]}),I}},c5Ni:function(st,ze,q){},dejd:function(st,ze,q){},dmUQ:function(st,ze,q){"use strict";var re=q("Ff2n"),V=q("rePB"),A=q("1OyB"),G=q("vuIU"),I=q("Ji7U"),R=q("md7G"),B=q("foSv"),U=q("cDcd"),k=q.n(U),L=q("TSYQ"),y=q.n(L),x=q("4IlW");function O(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,m)}return v}function C(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?O(Object(v),!0).forEach(function(m){Object(V.a)(l,m,v[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):O(Object(v)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(v,m))})}return l}function T(l){var a=g();return function(){var m=Object(B.a)(l),E;if(a){var M=Object(B.a)(this).constructor;E=Reflect.construct(m,arguments,M)}else E=m.apply(this,arguments);return Object(R.a)(this,E)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,w=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},_=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},b=function(l){Object(I.a)(v,l);var a=T(v);function v(m){var E;Object(A.a)(this,v),E=a.call(this,m),E.onKeyDown=function(j){var W=E.props,D=W.onKeyDown,P=W.onPressEnter;if(j.keyCode===x.a.UP){var H=E.getRatio(j);E.up(j,H,null),E.stop()}else if(j.keyCode===x.a.DOWN){var Y=E.getRatio(j);E.down(j,Y,null),E.stop()}else j.keyCode===x.a.ENTER&&P&&P(j);if(E.recordCursorPosition(),E.lastKeyCode=j.keyCode,D){for(var ee=arguments.length,oe=new Array(ee>1?ee-1:0),Te=1;Te<ee;Te++)oe[Te-1]=arguments[Te];D.apply(void 0,[j].concat(oe))}},E.onKeyUp=function(j){var W=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),W){for(var D=arguments.length,P=new Array(D>1?D-1:0),H=1;H<D;H++)P[H-1]=arguments[H];W.apply(void 0,[j].concat(P))}},E.onChange=function(j){var W=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(j)),E.setState({inputValue:E.rawInput}),W(E.toNumber(E.rawInput))},E.onMouseUp=function(){var j=E.props.onMouseUp;E.recordCursorPosition(),j&&j.apply(void 0,arguments)},E.onFocus=function(){var j;E.setState({focused:!0}),(j=E.props).onFocus.apply(j,arguments)},E.onBlur=function(){var j=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var W=E.getCurrentValidValue(E.state.inputValue),D=E.setValue(W,d);if(j){var P=E.input.value,H=E.getInputDisplayValue({focus:!1,value:D});E.input.value=H&&Number(H),j.apply(void 0,arguments),E.input.value=P}},E.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},E.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},E.getPrecision=function(j){if(f(E.props.precision))return E.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var D=0;return W.indexOf(".")>=0&&(D=W.length-W.indexOf(".")-1),D},E.getInputDisplayValue=function(j){var W=j||E.state,D=W.focused,P=W.inputValue,H=W.value,Y;D?Y=P:Y=E.toPrecisionAsStep(H),Y==null&&(Y="");var ee=E.formatWrapper(Y);return f(E.props.decimalSeparator)&&(ee=ee.toString().replace(".",E.props.decimalSeparator)),ee},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var W=E.input.value,D=W.lastIndexOf(j);if(D===-1)return!1;var P=E.cursorBefore.length;return E.lastKeyCode===x.a.DELETE&&E.cursorBefore.charAt(P-1)===j[0]?(E.fixCaret(P,P),!0):D+j.length===W.length?(E.fixCaret(D,D),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,D){var P=j.substring(D);return E.restoreByAfter(P)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,W,D){E.pressingUpOrDown=!0,E.step("down",j,W,D)},E.up=function(j,W,D){E.pressingUpOrDown=!0,E.step("up",j,W,D)},E.saveInput=function(j){E.input=j};var M=m.value;M===void 0&&(M=m.defaultValue),E.state={focused:m.autoFocus};var F=E.getValidValue(E.toNumber(M));return E.state=C(C({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(G.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var M=this.props,F=M.value,j=M.onChange,W=M.max,D=M.min,P=this.state.focused;if(E){if(!_(E.value,F)||!_(E.max,W)||!_(E.min,D)){var H=P?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=H:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:Y})}var ee="value"in this.props?F:this.state.value;"max"in this.props&&E.max!==W&&typeof ee=="number"&&ee>W&&j&&j(W),"min"in this.props&&E.min!==D&&typeof ee=="number"&&ee<D&&j&&j(D)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===x.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===x.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case x.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case x.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}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(E){var M=E;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(E){var M=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(E,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),W=this.state.value,D=W===void 0?null:W,P=this.state.inputValue,H=P===void 0?null:P,Y=typeof j=="number"?j.toFixed(F):"".concat(j),ee=j!==D||Y!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},M),ee&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(f(j))return j;var D=this.getPrecision(M),P=this.getPrecision(W),H=this.getPrecision(E);return E?Math.max(H,D+P):D+P}},{key:"getPrecisionFactor",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(E,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var M=Math.abs(this.getMaxPrecision(E));return isNaN(M)?E.toString():Number(E).toFixed(M)}},{key:"toNumber",value:function(E){var M=this.props.precision,F=this.state.focused,j=E&&E.length>16&&F;return this.isNotCompleteNumber(E)||j?E:f(M)?Math.round(E*Math.pow(10,M))/Math.pow(10,M):Number(E)}},{key:"upStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E+j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"downStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E-j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"step",value:function(E,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var D=this.props;if(D.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var H=this["".concat(E,"Step")](P,j),Y=H>D.max||H<D.min;if(H>D.max?H=D.max:H<D.min&&(H=D.min),this.setValue(H,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[E](M,j,!0)},W?s:w)}},{key:"fixCaret",value:function(E,M){if(E===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(E!==F||M!==j)&&this.input.setSelectionRange(E,M)}catch(W){}}},{key:"render",value:function(){var E,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,D=M.useTouch,P=M.autoComplete,H=M.upHandler,Y=M.downHandler,ee=M.className,oe=M.max,Te=M.min,ve=M.style,ge=M.title,he=M.onMouseEnter,fe=M.onMouseLeave,ae=M.onMouseOver,me=M.onMouseOut,J=M.required,ne=M.onClick,Q=M.tabIndex,Ee=M.type,Ce=M.placeholder,ye=M.id,we=M.inputMode,De=M.pattern,Pe=M.step,ke=M.maxLength,Oe=M.autoFocus,Re=M.name,Ge=M.onPaste,$e=M.onInput,Be=Object(re.a)(M,["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"]),He=this.state,rt=He.value,Je=He.focused,qe=y()(F,(E={},Object(V.a)(E,ee,!!ee),Object(V.a)(E,"".concat(F,"-disabled"),j),Object(V.a)(E,"".concat(F,"-focused"),Je),E)),Se={};Object.keys(Be).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Se[le]=Be[le])});var Ze=!W&&!j,Ke=this.getInputDisplayValue(null),Le=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=oe),Ie=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Te),pe=Le||j||W,se=Ie||j||W,de=y()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),pe)),$=y()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),se)),Z=D?{onTouchStart:pe?d:this.up,onTouchEnd:this.stop}:{onMouseDown:pe?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=D?{onTouchStart:se?d:this.down,onTouchEnd:this.stop}:{onMouseDown:se?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:qe,style:ve,title:ge,onMouseEnter:he,onMouseLeave:fe,onMouseOver:ae,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(F,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":pe,className:de}),H||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),k.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":se,className:$}),Y||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),k.a.createElement("div",{className:"".concat(F,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":oe,"aria-valuenow":rt,required:J,type:Ee,placeholder:Ce,onPaste:Ge,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Q,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:Oe,maxLength:ke,readOnly:W,disabled:j,max:oe,min:Te,step:Pe,name:Re,title:ge,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ke),pattern:De,inputMode:we,onInput:$e},Se))))}}]),v}(k.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var h=b,c=ze.a=h},h78n:function(st,ze,q){"use strict";q.d(ze,"a",function(){return E});var re=q("cDcd"),V=q.n(re),A=q("TSYQ"),G=q.n(A),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(re.useRef)()}),D=Object(re.useRef)();return Object(re.useEffect)(function(){var P=Date.now(),H=!1;Object.keys(W).forEach(function(Y){var ee=W[Y].current;if(!ee)return;H=!0;var oe=ee.style;oe.transitionDuration=".3s, .3s, .3s, .06s",D.current&&P-D.current<100&&(oe.transitionDuration="0s, 0s")}),H&&(D.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var D in W)Object.prototype.hasOwnProperty.call(W,D)&&(F[D]=W[D])}return F},B.apply(this,arguments)}function U(F,j){return O(F)||x(F,j)||L(F,j)||k()}function k(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(F,j){if(!F)return;if(typeof F=="string")return y(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return y(F,j)}function y(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,D=new Array(j);W<j;W++)D[W]=F[W];return D}function x(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],D=!0,P=!1,H=void 0;try{for(var Y=F[Symbol.iterator](),ee;!(D=(ee=Y.next()).done)&&!(W.push(ee.value),j&&W.length===j);D=!0);}catch(oe){P=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(P)throw H}}return W}function O(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=T(F,j),D,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(D=H[P],j.indexOf(D)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function T(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H<D.length;H++){if(P=D[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var g=function(j){var W=j.className,D=j.percent,P=j.prefixCls,H=j.strokeColor,Y=j.strokeLinecap,ee=j.strokeWidth,oe=j.style,Te=j.trailColor,ve=j.trailWidth,ge=j.transition,he=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete he.gapPosition;var fe=Array.isArray(D)?D:[D],ae=Array.isArray(H)?H:[H],me=R(fe),J=U(me,1),ne=J[0],Q=ee/2,Ee=100-ee/2,Ce="M ".concat(Y==="round"?Q:0,",").concat(Q,`
L `).concat(Y==="round"?Ee:100,",").concat(Q),ye="0 0 100 ".concat(ee),we=0;return V.a.createElement("svg",B({className:G()("".concat(P,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:oe},he),V.a.createElement("path",{className:"".concat(P,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:Te,strokeWidth:ve||ee,fillOpacity:"0"}),fe.map(function(De,Pe){var ke={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Oe=ae[Pe]||ae[ae.length-1];return we+=De,V.a.createElement("path",{key:Pe,className:"".concat(P,"-line-path"),d:Ce,strokeLinecap:Y,stroke:Oe,strokeWidth:ee,fillOpacity:"0",ref:ne[Pe],style:ke})}))};g.defaultProps=I;var d=g;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var D in W)Object.prototype.hasOwnProperty.call(W,D)&&(F[D]=W[D])}return F},o.apply(this,arguments)}function u(F,j){return _(F)||f(F,j)||w(F,j)||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 w(F,j){if(!F)return;if(typeof F=="string")return p(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(F,j)}function p(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,D=new Array(j);W<j;W++)D[W]=F[W];return D}function f(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],D=!0,P=!1,H=void 0;try{for(var Y=F[Symbol.iterator](),ee;!(D=(ee=Y.next()).done)&&!(W.push(ee.value),j&&W.length===j);D=!0);}catch(oe){P=!0,H=oe}finally{try{!D&&Y.return!=null&&Y.return()}finally{if(P)throw H}}return W}function _(F){if(Array.isArray(F))return F}function b(F,j){if(F==null)return{};var W=h(F,j),D,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(D=H[P],j.indexOf(D)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function h(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H<D.length;H++){if(P=D[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function v(F,j,W,D){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,Y=50-D/2,ee=0,oe=-Y,Te=0,ve=-2*Y;switch(H){case"left":ee=-Y,oe=0,Te=2*Y,ve=0;break;case"right":ee=Y,oe=0,Te=-2*Y,ve=0;break;case"bottom":oe=Y,ve=2*Y;break;default:}var ge="M 50,50 m ".concat(ee,",").concat(oe,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Te,",").concat(-ve,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Te,",").concat(ve),he=Math.PI*2*Y,fe={stroke:W,strokeDasharray:"".concat(j/100*(he-P),"px ").concat(he,"px"),strokeDashoffset:"-".concat(P/2+F/100*(he-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:fe}}var m=function(j){var W=j.prefixCls,D=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,Y=j.gapPosition,ee=j.trailColor,oe=j.strokeLinecap,Te=j.style,ve=j.className,ge=j.strokeColor,he=j.percent,fe=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(re.useMemo)(function(){return c+=1,c},[]),me=v(0,100,ee,D,H,Y),J=me.pathString,ne=me.pathStyle,Q=a(he),Ee=a(ge),Ce=Ee.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),ye=R(Q),we=u(ye,1),De=we[0],Pe=function(){var Oe=0;return Q.map(function(Re,Ge){var $e=Ee[Ge]||Ee[Ee.length-1],Be=Object.prototype.toString.call($e)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ae,")"):"",He=v(Oe,Re,$e,D,H,Y);return Oe+=Re,V.a.createElement("path",{key:Ge,className:"".concat(W,"-circle-path"),d:He.pathString,stroke:Be,strokeLinecap:oe,strokeWidth:D,opacity:Re===0?0:1,fillOpacity:"0",style:He.pathStyle,ref:De[Ge]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Te},fe),Ce&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(ke,Oe){return l(ke)-l(Oe)}).map(function(ke,Oe){return V.a.createElement("stop",{key:Oe,offset:ke,stopColor:Ce[ke]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:ee,strokeLinecap:oe,strokeWidth:P||D,fillOpacity:"0",style:ne}),Pe().reverse())};m.defaultProps=I;var E=m,M={Line:d,Circle:E}},kSUc:function(st,ze,q){},lZu9:function(st,ze,q){(function(re){re(q("VrN/"),q("1eCo"),q("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(V,A){var G=re.getMode(V,"text/html"),I=G.name=="null";function R(D){if(re.findModeByName){var P=re.findModeByName(D);P&&(D=P.mime||P.mimes[0])}var H=re.getMode(V,D);return H.name=="null"?null:H}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in B)B.hasOwnProperty(U)&&A.tokenTypeOverrides[U]&&(B[U]=A.tokenTypeOverrides[U]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,x=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function u(D,P,H){return P.f=P.inline=H,H(D,P)}function s(D,P,H){return P.f=P.block=H,H(D,P)}function w(D){return!D||!/\S/.test(D.string)}function p(D){if(D.linkTitle=!1,D.linkHref=!1,D.linkText=!1,D.em=!1,D.strong=!1,D.strikethrough=!1,D.quote=0,D.indentedCode=!1,D.f==_){var P=I;if(!P){var H=re.innerMode(G,D.htmlState);P=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}P&&(D.f=l,D.block=f,D.htmlState=null)}return D.trailingSpace=0,D.trailingSpaceNewLine=!1,D.prevLine=D.thisLine,D.thisLine={stream:null},null}function f(D,P){var H=D.column()===P.indentation,Y=w(P.prevLine.stream),ee=P.indentedCode,oe=P.prevLine.hr,Te=P.list!==!1,ve=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var ge=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,Te)){for(P.list=null;ge<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=ge-P.listStack[P.listStack.length-1])}var he=!Y&&!oe&&!P.prevLine.header&&(!Te||!ee)&&!P.prevLine.fencedCodeEnd,fe=(P.list===!1||oe||Y)&&P.indentation<=ve&&D.match(k),ae=null;if(P.indentationDiff>=4&&(ee||P.prevLine.fencedCodeEnd||P.prevLine.header||Y))return D.skipToEnd(),P.indentedCode=!0,B.code;if(D.eatSpace())return null;if(H&&P.indentation<=ve&&(ae=D.match(x))&&ae[1].length<=6)return P.quote=0,P.header=ae[1].length,P.thisLine.header=!0,A.highlightFormatting&&(P.formatting="header"),P.f=P.inline,h(P);if(P.indentation<=ve&&D.eat(">"))return P.quote=H?1:P.quote+1,A.highlightFormatting&&(P.formatting="quote"),D.eatSpace(),h(P);if(!fe&&!P.setext&&H&&P.indentation<=ve&&(ae=D.match(L))){var me=ae[1]?"ol":"ul";return P.indentation=ge+D.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,A.taskLists&&D.match(y,!1)&&(P.taskList=!0),P.f=P.inline,A.highlightFormatting&&(P.formatting=["list","list-"+me]),h(P)}else{if(H&&P.indentation<=ve&&(ae=D.match(T,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ae[1]+"+ *$"),P.localMode=A.fencedCodeBlockHighlighting&&R(ae[2]||A.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=re.startState(P.localMode)),P.f=P.block=b,A.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!he||!Te)&&!P.quote&&P.list===!1&&!P.code&&!fe&&!g.test(D.string)&&(ae=D.lookAhead(1))&&(ae=ae.match(O)))return P.setext?(P.header=P.setext,P.setext=0,D.skipToEnd(),A.highlightFormatting&&(P.formatting="header")):(P.header=ae[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,h(P);if(fe)return D.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,B.hr;if(D.peek()==="[")return u(D,P,M)}return u(D,P,P.inline)}function _(D,P){var H=G.token(D,P.htmlState);if(!I){var Y=re.innerMode(G,P.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||P.md_inside&&D.current().indexOf(">")>-1)&&(P.f=l,P.block=f,P.htmlState=null)}return H}function b(D,P){var H=P.listStack[P.listStack.length-1]||0,Y=P.indentation<H,ee=H+3;if(P.fencedEndRE&&P.indentation<=ee&&(Y||D.match(P.fencedEndRE))){A.highlightFormatting&&(P.formatting="code-block");var oe;return Y||(oe=h(P)),P.localMode=P.localState=null,P.block=f,P.f=l,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,Y?s(D,P,P.block):oe}else return P.localMode?P.localMode.token(D,P.localState):(D.skipToEnd(),B.code)}function h(D){var P=[];if(D.formatting){P.push(B.formatting),typeof D.formatting=="string"&&(D.formatting=[D.formatting]);for(var H=0;H<D.formatting.length;H++)P.push(B.formatting+"-"+D.formatting[H]),D.formatting[H]==="header"&&P.push(B.formatting+"-"+D.formatting[H]+"-"+D.header),D.formatting[H]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=D.quote?P.push(B.formatting+"-"+D.formatting[H]+"-"+D.quote):P.push("error"))}if(D.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(D.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(D.linkHref?P.push(B.linkHref,"url"):(D.strong&&P.push(B.strong),D.em&&P.push(B.em),D.strikethrough&&P.push(B.strikethrough),D.emoji&&P.push(B.emoji),D.linkText&&P.push(B.linkText),D.code&&P.push(B.code),D.image&&P.push(B.image),D.imageAltText&&P.push(B.imageAltText,"link"),D.imageMarker&&P.push(B.imageMarker)),D.header&&P.push(B.header,B.header+"-"+D.header),D.quote&&(P.push(B.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=D.quote?P.push(B.quote+"-"+D.quote):P.push(B.quote+"-"+A.maxBlockquoteDepth)),D.list!==!1){var Y=(D.listStack.length-1)%3;Y?Y===1?P.push(B.list2):P.push(B.list3):P.push(B.list1)}return D.trailingSpaceNewLine?P.push("trailing-space-new-line"):D.trailingSpace&&P.push("trailing-space-"+(D.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function c(D,P){return D.match(C,!0)?h(P):void 0}function l(D,P){var H=P.text(D,P);if(typeof H!="undefined")return H;if(P.list)return P.list=null,h(P);if(P.taskList){var Y=D.match(y,!0)[1]===" ";return Y?P.taskOpen=!0:P.taskClosed=!0,A.highlightFormatting&&(P.formatting="task"),P.taskList=!1,h(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&D.match(/^#+$/,!0))return A.highlightFormatting&&(P.formatting="header"),h(P);var ee=D.next();if(P.linkTitle){P.linkTitle=!1;var oe=ee;ee==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(D.match(new RegExp(Te),!0))return B.linkHref}if(ee==="`"){var ve=P.formatting;A.highlightFormatting&&(P.formatting="code"),D.eatWhile("`");var ge=D.current().length;if(P.code==0&&(!P.quote||ge==1))return P.code=ge,h(P);if(ge==P.code){var he=h(P);return P.code=0,he}else return P.formatting=ve,h(P)}else if(P.code)return h(P);if(ee==="\\"&&(D.next(),A.highlightFormatting)){var fe=h(P),ae=B.formatting+"-escape";return fe?fe+" "+ae:ae}if(ee==="!"&&D.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="["&&P.imageMarker&&D.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="]"&&P.imageAltText){A.highlightFormatting&&(P.formatting="image");var fe=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=v,fe}if(ee==="["&&!P.image)return P.linkText&&D.match(/^.*?\]/)||(P.linkText=!0,A.highlightFormatting&&(P.formatting="link")),h(P);if(ee==="]"&&P.linkText){A.highlightFormatting&&(P.formatting="link");var fe=h(P);return P.linkText=!1,P.inline=P.f=D.match(/\(.*?\)| ?\[.*?\]/,!1)?v:l,fe}if(ee==="<"&&D.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var fe=h(P);return fe?fe+=" ":fe="",fe+B.linkInline}if(ee==="<"&&D.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var fe=h(P);return fe?fe+=" ":fe="",fe+B.linkEmail}if(A.xml&&ee==="<"&&D.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=D.string.indexOf(">",D.pos);if(me!=-1){var J=D.string.substring(D.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(P.md_inside=!0)}return D.backUp(1),P.htmlState=re.startState(G),s(D,P,_)}if(A.xml&&ee==="<"&&D.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ne=1,Q=D.pos==1?" ":D.string.charAt(D.pos-2);ne<3&&D.eat(ee);)ne++;var Ee=D.peek()||" ",Ce=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(Q)||d.test(Q)),ye=!/\s/.test(Q)&&(!d.test(Q)||/\s/.test(Ee)||d.test(Ee)),we=null,De=null;if(ne%2&&(!P.em&&Ce&&(ee==="*"||!ye||d.test(Q))?we=!0:P.em==ee&&ye&&(ee==="*"||!Ce||d.test(Ee))&&(we=!1)),ne>1&&(!P.strong&&Ce&&(ee==="*"||!ye||d.test(Q))?De=!0:P.strong==ee&&ye&&(ee==="*"||!Ce||d.test(Ee))&&(De=!1)),De!=null||we!=null){A.highlightFormatting&&(P.formatting=we==null?"strong":De==null?"em":"strong em"),we===!0&&(P.em=ee),De===!0&&(P.strong=ee);var he=h(P);return we===!1&&(P.em=!1),De===!1&&(P.strong=!1),he}}else if(ee===" "&&(D.eat("*")||D.eat("_"))){if(D.peek()===" ")return h(P);D.backUp(1)}if(A.strikethrough){if(ee==="~"&&D.eatWhile(ee)){if(P.strikethrough){A.highlightFormatting&&(P.formatting="strikethrough");var he=h(P);return P.strikethrough=!1,he}else if(D.match(/^[^\s]/,!1))return P.strikethrough=!0,A.highlightFormatting&&(P.formatting="strikethrough"),h(P)}else if(ee===" "&&D.match(/^~~/,!0)){if(D.peek()===" ")return h(P);D.backUp(2)}}if(A.emoji&&ee===":"&&D.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,A.highlightFormatting&&(P.formatting="emoji");var Pe=h(P);return P.emoji=!1,Pe}return ee===" "&&(D.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),h(P)}function a(D,P){var H=D.next();if(H===">"){P.f=P.inline=l,A.highlightFormatting&&(P.formatting="link");var Y=h(P);return Y?Y+=" ":Y="",Y+B.linkInline}return D.match(/^[^>]+/,!0),B.linkInline}function v(D,P){if(D.eatSpace())return null;var H=D.next();return H==="("||H==="["?(P.f=P.inline=E(H==="("?")":"]"),A.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(D){return function(P,H){var Y=P.next();if(Y===D){H.f=H.inline=l,A.highlightFormatting&&(H.formatting="link-string");var ee=h(H);return H.linkHref=!1,ee}return P.match(m[D]),H.linkHref=!0,h(H)}}function M(D,P){return D.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=F,D.next(),A.highlightFormatting&&(P.formatting="link"),P.linkText=!0,h(P)):u(D,P,l)}function F(D,P){if(D.match(/^\]:/,!0)){P.f=P.inline=j,A.highlightFormatting&&(P.formatting="link");var H=h(P);return P.linkText=!1,H}return D.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(D,P){return D.eatSpace()?null:(D.match(/^[^\s]+/,!0),D.peek()===void 0?P.linkTitle=!0:D.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=l,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(D){return{f:D.f,prevLine:D.prevLine,thisLine:D.thisLine,block:D.block,htmlState:D.htmlState&&re.copyState(G,D.htmlState),indentation:D.indentation,localMode:D.localMode,localState:D.localMode?re.copyState(D.localMode,D.localState):null,inline:D.inline,text:D.text,formatting:!1,linkText:D.linkText,linkTitle:D.linkTitle,linkHref:D.linkHref,code:D.code,em:D.em,strong:D.strong,strikethrough:D.strikethrough,emoji:D.emoji,header:D.header,setext:D.setext,hr:D.hr,taskList:D.taskList,list:D.list,listStack:D.listStack.slice(0),quote:D.quote,indentedCode:D.indentedCode,trailingSpace:D.trailingSpace,trailingSpaceNewLine:D.trailingSpaceNewLine,md_inside:D.md_inside,fencedEndRE:D.fencedEndRE}},token:function(D,P){if(P.formatting=!1,D!=P.thisLine.stream){if(P.header=0,P.hr=!1,D.match(/^\s*$/,!0))return p(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:D},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=_)){var H=D.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=H,P.indentationDiff=null,H>0)return null}}return P.f(D,P)},innerMode:function(D){return D.block==_?{state:D.htmlState,mode:G}:D.localState?{state:D.localState,mode:D.localMode}:{state:D,mode:W}},indent:function(D,P,H){return D.block==_&&G.indent?G.indent(D.htmlState,P,H):D.localState&&D.localMode.indent?D.localMode.indent(D.localState,P,H):re.Pass},blankLine:p,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V=re.Pos;function A(d,o){return d.line-o.line||d.ch-o.ch}var G="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(d,o,u,s){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function U(d,o){var u=d.cm.getTokenTypeAt(V(d.line,o));return u&&/\btag\b/.test(u)}function k(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function L(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(k(d))continue;return}if(!U(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function x(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var u=R.exec(d.text);if(u&&u.index==o)return u}}function O(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(k(d))continue;return}if(!U(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function T(d,o){for(var u=[];;){var s=O(d),w,p=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(w=y(d)))return;if(w=="selfClose")continue;if(s[1]){for(var _=u.length-1;_>=0;--_)if(u[_]==s[2]){u.length=_;break}if(_<0&&(!o||o==s[2]))return{tag:s[2],from:V(p,f),to:V(d.line,d.ch)}}else u.push(s[2])}}function g(d,o){for(var u=[];;){var s=C(d);if(!s)return;if(s=="selfClose"){x(d);continue}var w=d.line,p=d.ch,f=x(d);if(!f)return;if(f[1])u.push(f[2]);else{for(var _=u.length-1;_>=0;--_)if(u[_]==f[2]){u.length=_;break}if(_<0&&(!o||o==f[2]))return{tag:f[2],from:V(d.line,d.ch),to:V(w,p)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var s=O(u);if(!s||u.line!=o.line)return;var w=y(u);if(!w)return;if(!s[1]&&w!="selfClose"){var p=V(u.line,u.ch),f=T(u,s[2]);return f&&A(f.from,p)>0?{from:p,to:f.from}:null}}}),re.findMatchingTag=function(d,o,u){var s=new B(d,o.line,o.ch,u);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var w=y(s),p=w&&V(s.line,s.ch),f=w&&x(s);if(!w||!f||A(s,o)>0)return;var _={from:V(s.line,s.ch),to:p,tag:f[2]};return w=="selfClose"?{open:_,close:null,at:"open"}:f[1]?{open:g(s,f[2]),close:_,at:"close"}:(s=new B(d,p.line,p.ch,u),{open:_,close:T(s,f[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,s){for(var w=new B(d,o.line,o.ch,u);;){var p=g(w,s);if(!p)break;var f=new B(d,o.line,o.ch,u),_=T(f,p.tag);if(_)return{open:p,close:_}}},re.scanForClosingTag=function(d,o,u,s){var w=new B(d,o.line,o.ch,s?{from:0,to:s}:null);return T(w,u)}})},p5ED:function(st,ze,q){"use strict";var re=q("+L6B"),V=q("2/Rp"),A=q("5Dmo"),G=q("3S7+"),I=q("k1fw"),R=q("tJVT"),B=q("cDcd"),U=q.n(B),k=q("vHTk"),L=q.n(k),y=q("yEEn"),x=q("ZW9T"),O=q("1vsH");ze.a=function(C){var T=C.name,g=C.data,d=C.theme,o=C.type,u=C.filename,s=C.monacoEditor,w=C.className,p=C.style,f=C.close,_=C.onClose,b=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],v=Object(B.useState)(""),m=Object(R.a)(v,2),E=m[0],M=m[1],F,j=1024*1024,W=10*j,D=Object(B.useRef)();o==="office"&&(F=Object(O.V)(g).filesize,F>W&&(o="other")),u&&(s.filename=u),Object(B.useEffect)(function(){var Y,ee,oe=(Y=document.cookie)===null||Y===void 0||((ee=Y.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");oe==null||oe.map(function(Te){var ve=Te.split("=");ve[0]==="_educoder_session"&&M(ve[1])})},[]);var P=function(){if(g.startsWith("http")||g.startsWith("/")){H();return}Object(O.z)(u||"educoder",g,u)},H=function(){Object(O.x)(u||T,g)};return console.log("data:",g,"fileanme:",u," name:",T),U.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(b&&L.a.bgBlack," ").concat(o?L.a.wrp:"hide")},f&&U.a.createElement("div",{className:L.a.close,ref:D},U.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return D.current}},U.a.createElement("span",{onClick:H},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return D.current}},U.a.createElement("span",{className:"",onClick:_},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(L.a[w]," ").concat(w," ").concat(L.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&U.a.createElement(x.b,s)),o==="audio"&&U.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),o==="video"&&U.a.createElement(U.a.Fragment,null,g!=null&&g.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),o==="html"&&U.a.createElement("iframe",{src:g+"&disposition=inline"}),o==="pdf"&&U.a.createElement("embed",{className:L.a.embed,src:g}),o==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),o==="other"&&U.a.createElement("div",null,U.a.createElement(V.a,{type:"primary",size:"large",onClick:P},U.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&U.a.createElement(V.a,{type:"primary",size:"large",onClick:P},U.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(st,ze,q){},"rAM+":function(st,ze,q){"use strict";q.d(ze,"a",function(){return V});var re=q("Qw5x");function V(A,G){var I;if(typeof Symbol=="undefined"||A[Symbol.iterator]==null){if(Array.isArray(A)||(I=Object(re.a)(A))||G&&A&&typeof A.length=="number"){I&&(A=I);var R=0,B=function(){};return{s:B,n:function(){return R>=A.length?{done:!0}:{done:!1,value:A[R++]}},e:function(x){throw x},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,k=!1,L;return{s:function(){I=A[Symbol.iterator]()},n:function(){var x=I.next();return U=x.done,x},e:function(x){k=!0,L=x},f:function(){try{!U&&I.return!=null&&I.return()}finally{if(k)throw L}}}}},rUJ1:function(st,ze){const q=/[&<>"']/,re=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,G={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},I=b=>G[b];function R(b,h){if(h){if(q.test(b))return b.replace(re,I)}else if(V.test(b))return b.replace(A,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(b){return b.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const k=/(^|[^\[])\^/g;function L(b,h){b=b.source||b,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(k,"$1"),b=b.replace(l,a),c),getRegex:()=>new RegExp(b,h)};return c}const y=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(b,h,c){if(b){let l;try{l=decodeURIComponent(U(c)).replace(y,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!x.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},T=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,h){C[" "+b]||(T.test(b)?C[" "+b]=b+"/":C[" "+b]=p(b,"/",!0)),b=C[" "+b];const c=b.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:b.replace(g,"$1")+h:h.charAt(0)==="/"?c?h:b.replace(d,"$1")+h:b+h}const u={exec:function(){}};function s(b){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(b[l]=c[l])}return b}function w(b,h){const c=b.replace(/\|/g,(v,m,E)=>{let M=!1,F=m;for(;--F>=0&&E[F]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function p(b,h,c){const l=b.length;if(l===0)return"";let a=0;for(;a<l;){const v=b.charAt(l-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return b.substr(0,l-a)}function f(b,h){if(b.indexOf(h[1])===-1)return-1;const c=b.length;let l=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===h[0])l++;else if(b[a]===h[1]&&(l--,l<0))return a;return-1}function _(b){b&&b.sanitize&&!b.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")}st.exports={escape:R,unescape:U,edit:L,cleanUrl:O,resolveUrl:o,noopTest:u,merge:s,splitCells:w,rtrim:p,findClosingBracket:f,checkSanitizeDeprecation:_}},ulZh:function(st,ze,q){typeof window!="undefined"&&function(V,A){st.exports=A()}(this,function(){return function(re){var V={};function A(G){if(V[G])return V[G].exports;var I=V[G]={i:G,l:!1,exports:{}};return re[G].call(I.exports,I,I.exports,A),I.l=!0,I.exports}return A.m=re,A.c=V,A.d=function(G,I,R){A.o(G,I)||Object.defineProperty(G,I,{enumerable:!0,get:R})},A.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},A.t=function(G,I){if(I&1&&(G=A(G)),I&8)return G;if(I&4&&typeof G=="object"&&G&&G.__esModule)return G;var R=Object.create(null);if(A.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:G}),I&2&&typeof G!="string")for(var B in G)A.d(R,B,function(U){return G[U]}.bind(null,B));return R},A.n=function(G){var I=G&&G.__esModule?function(){return G.default}:function(){return G};return A.d(I,"a",I),I},A.o=function(G,I){return Object.prototype.hasOwnProperty.call(G,I)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,V,A){"use strict";var G=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function B(y,x,O){this.fn=y,this.context=x,this.once=O||!1}function U(y,x,O,C,T){if(typeof O!="function")throw new TypeError("The listener must be a function");var g=new B(O,C||y,T),d=I?I+x:x;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],g]:y._events[d].push(g):(y._events[d]=g,y._eventsCount++),y}function k(y,x){--y._eventsCount===0?y._events=new R:delete y._events[x]}function L(){this._events=new R,this._eventsCount=0}L.prototype.eventNames=function(){var x=[],O,C;if(this._eventsCount===0)return x;for(C in O=this._events)G.call(O,C)&&x.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(O)):x},L.prototype.listeners=function(x){var O=I?I+x:x,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var T=0,g=C.length,d=new Array(g);T<g;T++)d[T]=C[T].fn;return d},L.prototype.listenerCount=function(x){var O=I?I+x:x,C=this._events[O];return C?C.fn?1:C.length:0},L.prototype.emit=function(x,O,C,T,g,d){var o=I?I+x:x;if(!this._events[o])return!1;var u=this._events[o],s=arguments.length,w,p;if(u.fn){u.once&&this.removeListener(x,u.fn,void 0,!0);switch(s){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,O),!0;case 3:return u.fn.call(u.context,O,C),!0;case 4:return u.fn.call(u.context,O,C,T),!0;case 5:return u.fn.call(u.context,O,C,T,g),!0;case 6:return u.fn.call(u.context,O,C,T,g,d),!0}for(p=1,w=new Array(s-1);p<s;p++)w[p-1]=arguments[p];u.fn.apply(u.context,w)}else{var f=u.length,_;for(p=0;p<f;p++){u[p].once&&this.removeListener(x,u[p].fn,void 0,!0);switch(s){case 1:u[p].fn.call(u[p].context);break;case 2:u[p].fn.call(u[p].context,O);break;case 3:u[p].fn.call(u[p].context,O,C);break;case 4:u[p].fn.call(u[p].context,O,C,T);break;default:if(!w)for(_=1,w=new Array(s-1);_<s;_++)w[_-1]=arguments[_];u[p].fn.apply(u[p].context,w)}}}return!0},L.prototype.on=function(x,O,C){return U(this,x,O,C,!1)},L.prototype.once=function(x,O,C){return U(this,x,O,C,!0)},L.prototype.removeListener=function(x,O,C,T){var g=I?I+x:x;if(!this._events[g])return this;if(!O)return k(this,g),this;var d=this._events[g];if(d.fn)d.fn===O&&(!T||d.once)&&(!C||d.context===C)&&k(this,g);else{for(var o=0,u=[],s=d.length;o<s;o++)(d[o].fn!==O||T&&!d[o].once||C&&d[o].context!==C)&&u.push(d[o]);u.length?this._events[g]=u.length===1?u[0]:u:k(this,g)}return this},L.prototype.removeAllListeners=function(x){var O;return x?(O=I?I+x:x,this._events[O]&&k(this,O)):(this._events=new R,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=I,L.EventEmitter=L,re.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,V,A){(function(G){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(L,y,x){if(x=x||{},L=L.trim(),y=y.trim(),!y){if(!x.alwaysNormalize)return L;var O=k.parseURL(L);if(!O)throw new Error("Error trying to parse base URL.");return O.path=k.normalizePath(O.path),k.buildURLFromParts(O)}var C=k.parseURL(y);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return x.alwaysNormalize?(C.path=k.normalizePath(C.path),k.buildURLFromParts(C)):y;var T=k.parseURL(L);if(!T)throw new Error("Error trying to parse base URL.");if(!T.netLoc&&T.path&&T.path[0]!=="/"){var g=R.exec(T.path);T.netLoc=g[1],T.path=g[2]}T.netLoc&&!T.path&&(T.path="/");var d={scheme:T.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=T.netLoc,C.path[0]!=="/"))if(!C.path)d.path=T.path,C.params||(d.params=T.params,C.query||(d.query=T.query));else{var o=T.path,u=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=k.normalizePath(u)}return d.path===null&&(d.path=x.alwaysNormalize?k.normalizePath(C.path):C.path),k.buildURLFromParts(d)},parseURL:function(L){var y=I.exec(L);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(B,"");L.length!==(L=L.replace(U,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};re.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(re,V,A){function G(x){var O={};function C(g){if(O[g])return O[g].exports;var d=O[g]={i:g,l:!1,exports:{}};return x[g].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=x,C.c=O,C.i=function(g){return g},C.d=function(g,d,o){C.o(g,d)||Object.defineProperty(g,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},C.n=function(g){var d=g&&g.__esModule?function(){return g.default}:function(){return g};return C.d(d,"a",d),d},C.o=function(g,d){return Object.prototype.hasOwnProperty.call(g,d)},C.p="/",C.oe=function(g){throw console.error(g),g};var T=C(C.s=ENTRY_MODULE);return T.default||T}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(x){return(x+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(x){return!isNaN(1*x)}function k(x,O,C){var T={};T[C]=[];var g=O.toString(),d=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return T;for(var o=d[1],u=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),s;s=u.exec(g);){if(s[3]==="dll-reference")continue;T[C].push(s[3])}for(u=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");s=u.exec(g);)x[s[2]]||(T[C].push(s[1]),x[s[2]]=A(s[1]).m),T[s[2]]=T[s[2]]||[],T[s[2]].push(s[4]);for(var w=Object.keys(T),p=0;p<w.length;p++)for(var f=0;f<T[w[p]].length;f++)U(T[w[p]][f])&&(T[w[p]][f]=1*T[w[p]][f]);return T}function L(x){var O=Object.keys(x);return O.reduce(function(C,T){return C||x[T].length>0},!1)}function y(x,O){for(var C={main:[O]},T={main:[]},g={main:{}};L(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var u=d[o],s=C[u],w=s.pop();if(g[u]=g[u]||{},g[u][w]||!x[u][w])continue;g[u][w]=!0,T[u]=T[u]||[],T[u].push(w);for(var p=k(x,x[u][w],u),f=Object.keys(p),_=0;_<f.length;_++)C[f[_]]=C[f[_]]||[],C[f[_]]=C[f[_]].concat(p[f[_]])}return T}re.exports=function(x,O){O=O||{};var C={main:A.m},T=O.all?{main:Object.keys(C.main)}:y(C,x),g="";Object.keys(T).filter(function(w){return w!=="main"}).forEach(function(w){for(var p=0;T[w][p];)p++;T[w].push(p),C[w][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+w+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+T[w].map(function(f){return""+JSON.stringify(f)+": "+C[w][f].toString()}).join(",")+`});
`}),g=g+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+T.main.map(function(w){return""+JSON.stringify(w)+": "+C.main[w].toString()}).join(",")+"}))(self);";var d=new window.Blob([g],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),s=new window.Worker(u);return s.objectURL=u,s}},"./src/config.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"hlsDefaultConfig",function(){return _}),A.d(V,"mergeConfig",function(){return h}),A.d(V,"enableStreamingMode",function(){return c});var G=A("./src/controller/abr-controller.ts"),I=A("./src/controller/audio-stream-controller.ts"),R=A("./src/controller/audio-track-controller.ts"),B=A("./src/controller/subtitle-stream-controller.ts"),U=A("./src/controller/subtitle-track-controller.ts"),k=A("./src/controller/buffer-controller.ts"),L=A("./src/controller/timeline-controller.ts"),y=A("./src/controller/cap-level-controller.ts"),x=A("./src/controller/fps-controller.ts"),O=A("./src/controller/eme-controller.ts"),C=A("./src/controller/cmcd-controller.ts"),T=A("./src/utils/xhr-loader.ts"),g=A("./src/utils/fetch-loader.ts"),d=A("./src/utils/cues.ts"),o=A("./src/utils/mediakeys-helper.ts"),u=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(l[m]=v[m])}return l},s.apply(this,arguments)}function w(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,m)}return v}function p(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?w(Object(v),!0).forEach(function(m){f(l,m,v[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):w(Object(v)).forEach(function(m){Object.defineProperty(l,m,Object.getOwnPropertyDescriptor(v,m))})}return l}function f(l,a,v){return a in l?Object.defineProperty(l,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[a]=v,l}var _=p(p({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:T.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:k.default,capLevelController:y.default,fpsController:x.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:L.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:O.default,cmcdController:C.default});function b(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},l,a)}function c(l){var a=l.loader;if(a!==g.default&&a!==T.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var v=Object(g.fetchSupported)();v&&(l.loader=g.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/utils/ewma-bandwidth-estimator.ts"),R=A("./src/events.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/errors.ts"),k=A("./src/types/loader.ts"),L=A("./src/utils/logger.ts");function y(C,T){for(var g=0;g<T.length;g++){var d=T[g];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function x(C,T,g){return T&&y(C.prototype,T),g&&y(C,g),C}var O=function(){function C(g){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=g;var d=g.config;this.bwEstimator=new I.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var T=C.prototype;return T.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},T.onFragLoading=function(d,o){var u=o.frag;if(u.type===k.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=u,this.partCurrent=(s=o.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},T.onLevelLoaded=function(d,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},T._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.autoLevelEnabled,w=u.config,p=u.media;if(!d||!p)return;var f=o?o.stats:d.stats,_=o?o.duration:d.duration;if(f.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-f.loading.start,h=Math.abs(p.playbackRate);if(b<=500*_/h)return;var c=u.levels,l=u.minAutoLevel,a=c[d.level],v=f.total||Math.max(f.loaded,Math.round(_*a.maxBitrate/8)),m=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/b),E=(v-f.loaded)/m,M=p.currentTime,F=(B.BufferHelper.bufferInfo(p,M,w.maxBufferHole).end-M)/h;if(F>=2*_/h||E<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var D=c[W].maxBitrate;if(j=_*D/(8*.8*m),j<F)break}if(j>=E)return;var P=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
Current BW estimate: `+(Object(G.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),u.nextLoadLevel=W,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},T.onFragLoaded=function(d,o){var u=o.frag,s=o.part;if(u.type===k.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(u.sn)){var w=s?s.stats:u.stats,p=s?s.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],_=(f.loaded?f.loaded.bytes:0)+w.loaded,b=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:_,duration:b},f.realBitrate=Math.round(8*_/b)}if(u.bitrateTest){var h={stats:w,frag:u,part:s,id:u.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},T.onFragBuffered=function(d,o){var u=o.frag,s=o.part,w=s?s.stats:u.stats;if(w.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var p=w.parsing.end-w.loading.start;this.bwEstimator.sample(p,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},T.onError=function(d,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},T.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},T.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.maxAutoLevel,w=u.config,p=u.minAutoLevel,f=u.media,_=o?o.duration:d?d.duration:0,b=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(f,b,w.maxBufferHole).end-b)/h,a=this.findBestLevel(c,p,s,l,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=_?Math.min(_,w.maxStarvationDelay):w.maxStarvationDelay,m=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var F=_?Math.min(_,w.maxLoadingDelay):w.maxLoadingDelay;v=F-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),m=E=1}}return a=this.findBestLevel(c,p,s,l+v,m,E),Math.max(a,0)},T.findBestLevel=function(d,o,u,s,w,p){for(var f,_=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(f=l.details)!==null&&f!==void 0&&f.live),v=l==null?void 0:l.codecSet,m=b?b.duration:_?_.duration:0,E=u;E>=o;E--){var M=c[E];if(!M||v&&M.codecSet!==v)continue;var F=M.details,j=(b?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||m,W=void 0;E<=h?W=w*d:W=p*d;var D=c[E].maxBitrate,P=D*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+D+"/"+j+"/"+s+"/"+P),W>D&&(!P||a&&!this.bitrateTestDelay||P<s))return E}return-1},x(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),C}();V.default=O},"./src/controller/audio-stream-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/controller/base-stream-controller.ts"),R=A("./src/events.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/controller/fragment-tracker.ts"),k=A("./src/types/level.ts"),L=A("./src/types/loader.ts"),y=A("./src/loader/fragment.ts"),x=A("./src/demux/chunk-cache.ts"),O=A("./src/demux/transmuxer-interface.ts"),C=A("./src/types/transmuxer.ts"),T=A("./src/controller/fragment-finders.ts"),g=A("./src/utils/discontinuities.ts"),d=A("./src/errors.ts"),o=A("./src/utils/logger.ts");function u(){return u=Object.assign||function(_){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(_[c]=h[c])}return _},u.apply(this,arguments)}function s(_,b){_.prototype=Object.create(b.prototype),_.prototype.constructor=_,w(_,b)}function w(_,b){return w=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},w(_,b)}var p=100,f=function(_){s(b,_);function b(c,l){var a;return a=_.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(R.Events.ERROR,this.onError,this),l.on(R.Events.BUFFER_RESET,this.onBufferReset,this),l.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(R.Events.ERROR,this.onError,this),l.off(R.Events.BUFFER_RESET,this.onBufferReset,this),l.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var v=a.frag,m=a.id,E=a.initPTS;if(m==="main"){var M=v.cc;this.initPTS[v.cc]=E,this.log("InitPTS for cc: "+M+" found from main: "+E),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,v=this.trackId,m=a==null||((l=a[v])===null||l===void 0)?void 0:l.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var E,M=performance.now(),F=this.retryDate;(!F||M>=F||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,D=j.part,P=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=P.flush(),ee={frag:W,part:D,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&_.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),ve=Object(T.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,v=this.hls,m=this.levels,E=this.media,M=this.trackId,F=v.config;if(!m||!m[M])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=m[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(P>=H&&!Y)return;if(!Y&&this._streamEnded(D,W)){v.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ee=W.fragments,oe=ee[0].start,Te=D.end;if(Y){var ve=this.getLoadPosition();Te=ve,W.PTSKnown&&ve<oe&&((D.end>oe||D.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var ge=this.getNextFragment(Te,W);if(!ge){this.bufferFlushed=!0;return}((l=ge.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Te)},h.getMaxBufferLength=function(){var l=_.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,_.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(m){return new k.Level(m)})},h.onAudioTrackSwitching=function(l,a){var v=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(p):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var v,m=this.levels,E=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var F=m[M],j=0;if(E.live||(v=F.details)!==null&&v!==void 0&&v.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!F.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(E,W),j=E.fragments[0].start):j=this.alignPlaylists(E,F.details)}F.details=E,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,v=l.frag,m=l.part,E=l.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var D=W.details;console.assert(D,"Audio track details are defined on fragment load progress");var P=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new O.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[v.cc],ee=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var oe=!1,Te=m?m.index:-1,ve=Te!==-1,ge=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,E.byteLength,Te,ve);H.push(E,ee,P,"",v,m,D.totalduration,oe,ge,Y)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+D.startSN+" ,"+D.endSN+"],track "+F);var he=this.waitingData=this.waitingData||{frag:v,part:m,cache:new x.default,complete:!1},fe=he.cache;fe.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}_.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var v=a.frag,m=a.part;if(v.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(m?" p: "+m.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,m)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var v=!0,m=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);m&&m.len>.5&&(v=!this.reduceMaxBufferLength(m.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var v=a.type;v===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,v="audio",m=this.hls,E=l.remuxResult,M=l.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,D=E.audio,P=E.text,H=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&D&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,M),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:Y.tracks})),D){var ee=D.startPTS,oe=D.endPTS,Te=D.startDTS,ve=D.endDTS;W&&(W.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:Te,endDTS:ve}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ee,oe,Te,ve),this.bufferFragmentData(D,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var ge=u({frag:j,id:v},H);m.trigger(R.Events.FRAG_PARSING_METADATA,ge)}if(P){var he=u({frag:j,id:v},P);m.trigger(R.Events.FRAG_PARSING_USERDATA,he)}},h._bufferInitSegment=function(l,a,v){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var m=l.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,l);var E=m.initSegment;if(E!=null&&E.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:E};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(l,a,v){var m=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||m===U.FragmentState.NOT_LOADED||m===U.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,l,a,v)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:v})},b}(I.default);V.default=f},"./src/controller/audio-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function U(O,C){for(var T=0;T<C.length;T++){var g=C[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(O,g.key,g)}}function k(O,C,T){return C&&U(O.prototype,C),T&&U(O,T),O}function L(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,y(O,C)}function y(O,C){return y=Object.setPrototypeOf||function(g,d){return g.__proto__=d,g},y(O,C)}var x=function(O){L(C,O);function C(g){var d;return d=O.call(this,g,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var T=C.prototype;return T.registerListeners=function(){var d=this.hls;d.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},T.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},T.onAudioTrackLoaded=function(d,o){var u=o.id,s=o.details,w=this.tracksInGroup[u];if(!w){this.warn("Invalid audio track id "+u);return}var p=w.details;w.details=o.details,this.log("audioTrack "+u+" loaded ["+s.startSN+"-"+s.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,p))},T.onLevelLoading=function(d,o){this.switchLevel(o.level)},T.onLevelSwitching=function(d,o){this.switchLevel(o.level)},T.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var s=this.tracks.filter(function(p){return!u||p.groupId===u});this.selectDefaultTrack&&!s.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var w={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},T.onError=function(d,o){if(O.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},T.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+d);var s=o[d],w=s.id,p=s.groupId,f=p===void 0?"":p,_=s.name,b=s.type,h=s.url;if(this.trackId=d,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:f,name:_,type:b,url:h}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,u==null?void 0:u.details);this.loadPlaylist(c)},T.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},T.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var s=o[u];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},T.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,s=o.groupId,w=o.url;if(d)try{w=d.addDirectives(w)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:w,id:u,groupId:s,deliveryDirectives:d||null})}},k(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),C}(R.default);V.default=x},"./src/controller/base-playlist-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/polyfills/number.ts"),I=A("./src/types/level.ts"),R=A("./src/controller/level-helper.ts"),B=A("./src/utils/logger.ts"),U=A("./src/errors.ts"),k=function(){function L(x,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,O+":"),this.warn=B.logger.warn.bind(B.logger,O+":"),this.hls=x}var y=L.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(O,C){C.fatal&&C.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(O,C){var T=C==null?void 0:C.renditionReports;if(T)for(var g=0;g<T.length;g++){var d=T[g],o=""+d.URI;if(o===O.substr(-o.length)){var u=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var w=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&w>C.partTarget&&(s+=1)}if(Object(G.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(G.isFiniteNumber)(s)?s:void 0,I.HlsSkip.No)}}},y.loadPlaylist=function(O){},y.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},y.playlistLoaded=function(O,C,T){var g=this,d=C.details,o=C.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||T!=null&&T.live){if(d.reloaded(T),T&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),T&&d.fragments.length>0&&Object(R.mergeDetails)(T,d),!this.canLoad||!d.live)return;var s,w=void 0,p=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,_=d.lastPartSn,b=d.endSN,h=d.lastPartIndex,c=h!==-1,l=_===b,a=f?0:h;c?(w=l?b+1:_,p=l?a:h+1):w=b+1;var v=d.age,m=v+d.ageHeader,E=Math.min(m-d.partTarget,d.targetduration*1.5);if(E>0){if(T&&E>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var M=Math.floor(E/d.targetduration);if(w+=M,p!==void 0){var F=Math.round(E%d.targetduration/d.partTarget);p+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+E+" skip sn "+M+" to part "+p)}d.tuneInGoal=E}if(s=this.getDeliveryDirectives(d,C.deliveryDirectives,w,p),f||!l){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,C.deliveryDirectives,w,p);var j=Object(R.computeReloadInterval)(d,o);w!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(s)},j)}else this.clearTimer()},y.getDeliveryDirectives=function(O,C,T,g){var d=Object(I.getSkipValue)(O,T);return C!=null&&C.skip&&O.deltaUpdateFailed&&(T=C.msn,g=C.part,d=I.HlsSkip.No),new I.HlsUrlParameters(T,g,d)},y.retryLoadingOrFail=function(O){var C=this,T=this.hls.config,g=this.retryCount<T.levelLoadingMaxRetry;if(g){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*T.levelLoadingRetryDelay,T.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return g},L}()},"./src/controller/base-stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"State",function(){return b}),A.d(V,"default",function(){return h});var G=A("./src/polyfills/number.ts"),I=A("./src/task-loop.ts"),R=A("./src/controller/fragment-tracker.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/utils/logger.ts"),k=A("./src/events.ts"),L=A("./src/errors.ts"),y=A("./src/types/transmuxer.ts"),x=A("./src/utils/mp4-tools.ts"),O=A("./src/utils/discontinuities.ts"),C=A("./src/controller/fragment-finders.ts"),T=A("./src/controller/level-helper.ts"),g=A("./src/loader/fragment-loader.ts"),d=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),u=A("./src/types/loader.ts");function s(c,l){for(var a=0;a<l.length;a++){var v=l[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function w(c,l,a){return l&&s(c.prototype,l),a&&s(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,_(c,l)}function _(c,l){return _=Object.setPrototypeOf||function(v,m){return v.__proto__=m,v},_(c,l)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){f(l,c);function l(v,m,E){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=b.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=E,M.log=U.logger.log.bind(U.logger,E+":"),M.warn=U.logger.warn.bind(U.logger,E+":"),M.hls=v,M.fragmentLoader=new g.default(v.config),M.fragmentTracker=m,M.config=v.config,M.decrypter=new d.default(v,v.config),v.on(k.Events.KEY_LOADED,M.onKeyLoaded,p(M)),M}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,E){var M=this.fragCurrent,F=this.fragmentTracker;if(!E.live&&M&&M.sn===E.endSN&&!m.nextStart){var j=F.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(m,E){var M=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,E=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,D=B.BufferHelper.bufferInfo(F||M,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(E&&!D.len){var P=m.maxFragLookUpTolerance,H=E.start-P,Y=E.start+E.duration+P,ee=W>Y;(W<H||ee)&&(ee&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!D.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,E){if(this.state!==b.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var M=this.levels[E.frag.level].details;M&&this.loadFragment(E.frag,M,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,E){this.log("Loading key for "+m.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,E,M){this._loadFragForPlayback(m,E,M)},a._loadFragForPlayback=function(m,E,M){var F=this,j=function(D){if(F.fragContextChanged(m)){F.warn("Fragment "+m.sn+(D.part?" p: "+D.part.index:"")+" of level "+m.level+" was dropped during download."),F.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,F._handleFragmentLoadProgress(D)};this._doFragLoad(m,E,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var D=F.state;if(F.fragContextChanged(m)){(D===b.FRAG_LOADING||D===b.BACKTRACKING||!F.fragCurrent&&D===b.PARSING)&&(F.fragmentTracker.removeFragment(m),F.state=b.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+m.sn+" of level "+m.level),F.hls.trigger(k.Events.FRAG_LOADED,W),F.state===b.BACKTRACKING)){F.fragmentTracker.backtrack(m,W),F.resetFragmentLoading(m);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,E,M){if(M===void 0&&(M=null),!(m-E))return;var F={startOffset:m,endOffset:E,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(m){var E=this;this._doFragLoad(m).then(function(M){if(!M||E.fragContextChanged(m)||!E.levels)throw new Error("init load aborted");return M}).then(function(M){var F=E.hls,j=M.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var D=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(P){var H=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:P,stats:{tstart:D,tdecrypt:H}}),M.payload=P,M})}return M}).then(function(M){var F=E.fragCurrent,j=E.hls,W=E.levels;if(!W)throw new Error("init load aborted, missing levels");var D=W[m.level].details;console.assert(D,"Level details are defined when init segment is loaded");var P=m.stats;E.state=b.IDLE,E.fragLoadError=0,m.data=new Uint8Array(M.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),M.frag===F&&j.trigger(k.Events.FRAG_BUFFERED,{stats:P,frag:F,part:null,id:m.type}),E.tick()}).catch(function(M){E.warn(M),E.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},a.fragBufferedComplete=function(m,E){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var M=m.frag,F=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(P){return!P}),D=new y.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);E.flush(D)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&F){M>m.end&&E.fragmentHint&&(m=E.fragmentHint);var D=this.getNextPart(W,m,M);if(D>-1){var P=W[D];return this.log("Loading part sn: "+m.sn+" p: "+P.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+D+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:W[D],targetBufferTime:M}),this.doFragPartsLoad(m,W,D,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!m.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(m,E,M,F){var j=this;return new Promise(function(W,D){var P=[],H=function Y(ee){var oe=E[ee];j.fragmentLoader.loadPart(m,oe,F).then(function(Te){P[oe.index]=Te;var ve=Te.part;j.hls.trigger(k.Events.FRAG_LOADED,Te);var ge=E[ee+1];if(ge&&ge.fragment===m)Y(ee+1);else return W({frag:m,part:ve,partsLoaded:P})}).catch(D)};H(M)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(k.Events.ERROR,E),null},a._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=E.frag,F=E.part,j=E.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,m.partial)},a.getCurrentContext=function(m){var E=this.levels,M=m.level,F=m.sn,j=m.part;if(!E||!E[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=E[M],D=j>-1?Object(T.getPartWith)(W,F,j):null,P=D?D.fragment:Object(T.getFragmentWithSN)(W,F,this.fragCurrent);return P?{frag:P,part:D,level:W}:null},a.bufferFragmentData=function(m,E,M,F){if(!m||this.state!==b.PARSING)return;var j=m.data1,W=m.data2,D=j;if(j&&W&&(D=Object(x.appendUint8Array)(j,W)),!D||!D.length)return;var P={type:m.type,frag:E,part:M,chunkMeta:F,parent:E.type,data:D};this.hls.trigger(k.Events.BUFFER_APPENDING,P),m.dropped&&m.independent&&!M&&this.flushBufferGap(E)},a.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var M=E.currentTime,F=B.BufferHelper.bufferInfo(E,M,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),D=Math.max(Math.min(m.start-W,F.end-W),M+W);m.start-D>W&&this.flushMainBuffer(D,m.start)},a.getFwdBufferInfo=function(m,E){var M=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(m,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,E);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var E=this.config,M;return m?M=Math.max(8*E.maxBufferSize/m,E.maxBufferLength):M=E.maxBufferLength,Math.min(M,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var E=this.config,M=m||E.maxBufferLength;return E.maxMaxBufferLength>=M?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var M,F,j=E.fragments,W=j.length;if(!W)return null;var D=this.config,P=j[0].start,H;if(E.live){var Y=D.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(E,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:m)}else m<=P&&(H=j[0]);if(!H){var ee=D.lowLatencyMode?E.partEnd:E.fragmentEnd;H=this.getFragmentAtPosition(m,ee,E)}return(M=H)!==null&&M!==void 0&&M.initSegment&&!((F=H)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(m,E,M){for(var F=-1,j=!1,W=!0,D=0,P=m.length;D<P;D++){var H=m[D];if(W=W&&!H.independent,F>-1&&M<H.start)break;var Y=H.loaded;!Y&&(j||H.independent||W)&&H.fragment===E&&(F=D),j=Y}return F},a.loadedEndOfParts=function(m,E){var M=m[m.length-1];return M&&E>M.start&&M.loaded},a.getInitialLiveFragment=function(m,E){var M=this.fragPrevious,F=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(E,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=E[j-m.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(E,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var D=this.hls.liveSyncPosition;D!==null&&(F=this.getFragmentAtPosition(D,this.bitrateTest?m.fragmentEnd:m.edge,m))}return F},a.getFragmentAtPosition=function(m,E,M){var F=this.config,j=this.fragPrevious,W=M.fragments,D=M.endSN,P=M.fragmentHint,H=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&P);Y&&P&&!this.bitrateTest&&(W=W.concat(P),D=P.sn);var ee;if(m<E){var oe=m>E-H?0:H;ee=Object(C.findFragmentByPTS)(j,W,m,oe)}else ee=W[W.length-1];if(ee){var Te=ee.sn-M.startSN,ve=j&&ee.level===j.level,ge=W[Te+1],he=this.fragmentTracker.getState(ee);if(he===R.FragmentState.BACKTRACKED){ee=null;for(var fe=Te;W[fe]&&this.fragmentTracker.getState(W[fe])===R.FragmentState.BACKTRACKED;)j?ee=W[fe--]:ee=W[--fe];ee||(ee=ge)}else j&&ee.sn===j.sn&&!Y&&(ve&&(ee.sn<D&&this.fragmentTracker.getState(ge)!==R.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+ge.sn),ee=ge):ee=null))}return ee},a.synchronizeToLiveEdge=function(m){var E=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=m.fragments[0].start,D=m.edge,P=j>=W-E.maxFragLookUpTolerance&&j<=D;if(F!==null&&M.duration>F&&(j<F||!P)){var H=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*m.targetduration;(!P&&M.readyState<4||j<D-H)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+D+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(m,E){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,D=m.fragments.length;if(!D)return this.warn("No fragments in live playlist"),0;var P=m.fragments[0].start,H=!E,Y=m.alignedSliding&&Object(G.isFiniteNumber)(P);if(H||!Y&&!P){Object(O.alignStream)(j,W,m);var ee=m.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+D),ee}return P},a.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},a.setStartPosition=function(m,E){var M=this.startPosition;if(M<E&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=m.startTimeOffset;Object(G.isFiniteNumber)(F)?(M=E+F,F<0&&(M+=m.totalduration),M=Math.min(Math.max(E,M),E+m.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||E:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,E=0;return this.loadedmetadata&&m?E=m.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(m,E){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(E?" part"+E.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,E){if(E.fatal)return;var M=E.frag;if(!M||M.type!==m)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(U.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,E,M){if(!m)return;var F=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(E,F,M),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[m].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,E,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var D=Object.keys(m.elementaryStreams).reduce(function(P,H){var Y=m.elementaryStreams[H];if(Y){var ee=Y.endPTS-Y.startPTS;if(ee<=0)return j.warn("Could not parse fragment "+m.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),P||!1;var oe=F?0:Object(T.updateFragPTSDTS)(W,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:oe,type:H,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return P},!1);D?(this.state=b.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(l,[{key:"state",get:function(){return this._state},set:function(m){var E=this._state;E!==m&&(this._state=m,this.log(E+"->"+m))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./src/errors.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/mediasource-helper.ts"),L=A("./src/loader/fragment.ts"),y=A("./src/controller/buffer-operation-queue.ts"),x=Object(k.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function T(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,s=o.media,w=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:s})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var g=T.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(o,u){var s=2;(u.audio&&!u.video||!u.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(o,u){var s=this.media=u.media;if(s&&x){var w=this.mediaSource=new x;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(w),this._objectUrl=s.src}},g.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,s=this._objectUrl;if(u){if(R.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var s=o.sourceBuffer[u];try{s&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[u]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",w)}}),this._initSourceBuffer()},g.onBufferCodecs=function(o,u){var s=this,w=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(p){if(w){var f=s.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var _=u[p],b=_.codec,h=_.levelCodec,c=_.container,l=(f.levelCodec||f.codec).replace(O,"$1"),a=(h||b).replace(O,"$1");if(l!==a){var v=c+";codecs="+(h||b);s.appendChangeType(p,v)}}}else s.pendingTracks[p]=u[p]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(o,u){var s=this,w=this.operationQueue,p={execute:function(){var _=s.sourceBuffer[o];_&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),_.changeType(u)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(_){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",_)}};w.append(p,o)},g.onBufferAppending=function(o,u){var s=this,w=this.hls,p=this.operationQueue,f=this.tracks,_=u.data,b=u.type,h=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[b],v=self.performance.now();a.start=v;var m=h.stats.buffering,E=c?c.stats.buffering:null;m.start===0&&(m.start=v),E&&E.start===0&&(E.start=v);var M=f.audio,F=b==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var D=s.sourceBuffer[b];if(D){var P=h.start-D.timestampOffset;Math.abs(P)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+P+") sn: "+h.sn+")"),D.timestampOffset=h.start)}}s.appendExecutor(_,b)},onStart:function(){},onComplete:function(){var D=self.performance.now();a.executeEnd=a.end=D,m.first===0&&(m.first=D),E&&E.first===0&&(E.first=D);var P=s.sourceBuffer,H={};for(var Y in P)H[Y]=U.BufferHelper.getBuffered(P[Y]);s.appendError=0,s.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(D){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",D);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:D,fatal:!1};D.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),w.trigger(I.Events.ERROR,P)}};p.append(j,b)},g.onBufferFlushing=function(o,u){var s=this,w=this.operationQueue,p=function(_){return{execute:s.removeExecutor.bind(s,_,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(I.Events.BUFFER_FLUSHED,{type:_})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+_+" SourceBuffer",h)}}};u.type?w.append(p(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){w.append(p(f),f)})},g.onFragParsed=function(o,u){var s=this,w=u.frag,p=u.part,f=[],_=p?p.elementaryStreams:w.elementaryStreams;_[L.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(_[L.ElementaryStreamTypes.AUDIO]&&f.push("audio"),_[L.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var c=self.performance.now();w.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var l=p?p.stats:w.stats;s.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:p,stats:l,id:w.type})};f.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(b,f)},g.onFragChanged=function(o,u){this.flushBackBuffer()},g.onBufferEos=function(o,u){var s=this,w=this.getSourceBufferTypes().reduce(function(p,f){var _=s.sourceBuffer[f];return(!u.type||u.type===f)&&(_&&!_.ended&&(_.ended=!0,R.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!_||_.ended)},!0);w&&this.blockBuffers(function(){var p=s.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},g.onLevelUpdated=function(o,u){var s=u.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var o=this.hls,u=this.details,s=this.media,w=this.sourceBuffer;if(!s||u===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(f)||f<0)return;var _=s.currentTime,b=u.levelTargetDuration,h=Math.max(f,b),c=Math.floor(_/b)*b-h;p.forEach(function(l){var a=w[l];if(a){var v=U.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,s=this.media,w=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=s.duration,_=Object(G.isFiniteNumber)(w.duration)?w.duration:0;o.live&&u.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(p>_&&p>f||!Object(G.isFiniteNumber)(f))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),w.duration=p)},g.updateSeekableRange=function(o){var u=this.mediaSource,s=o.fragments,w=s.length;if(w&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var p=Math.max(0,s[0].start),f=Math.max(p,p+o.totalduration);u.setLiveSeekableRange(p,f)}},g.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,s=this.pendingTracks,w=Object.keys(s).length;if(w&&!o||w===2){this.createSourceBuffers(s),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){u.executeNext(f)})}},g.createSourceBuffers=function(o){var u=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var p in o)if(!u[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var _=f.levelCodec||f.codec,b=f.container+";codecs="+_;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=u[p]=s.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:h,codec:_,container:f.container,levelCodec:f.levelCodec,id:f.id},w++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:b})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(o){var u=this.operationQueue,s=u.current(o);s.onStart()},g._onSBUpdateEnd=function(o){var u=this.operationQueue,s=u.current(o);s.onComplete(),u.shiftAndExecuteNext(o)},g._onSBUpdateError=function(o,u){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(u)},g.removeExecutor=function(o,u,s){var w=this.media,p=this.mediaSource,f=this.operationQueue,_=this.sourceBuffer,b=_[o];if(!w||!p||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(G.isFiniteNumber)(p.duration)?p.duration:Infinity,l=Math.max(0,u),a=Math.min(s,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(l,a)):f.shiftAndExecuteNext(o)},g.appendExecutor=function(o,u){var s=this.operationQueue,w=this.sourceBuffer,p=w[u];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(u);return}p.ended=!1,console.assert(!p.updating,u+" sourceBuffer must not be updating"),p.appendBuffer(o)},g.blockBuffers=function(o,u){var s=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,p=u.map(function(f){return w.appendBlocker(f)});Promise.all(p).then(function(){o(),u.forEach(function(f){var _=s.sourceBuffer[f];(!_||!_.updating)&&w.shiftAndExecuteNext(f)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(o,u,s){var w=this.sourceBuffer[o];if(!w)return;var p=s.bind(this,o);this.listeners[o].push({event:u,listener:p}),w.addEventListener(u,p)},g.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(s){u.removeEventListener(s.event,s.listener)})},T}()},"./src/controller/buffer-operation-queue.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return I});var G=A("./src/utils/logger.ts"),I=function(){function R(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=R.prototype;return B.append=function(k,L){var y=this.queues[L];y.push(k),y.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(k,L){var y=this.queues[L];y.unshift(k),this.executeNext(L)},B.appendBlocker=function(k){var L,y=new Promise(function(O){L=O}),x={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(x,k),y},B.executeNext=function(k){var L=this.buffers,y=this.queues,x=L[k],O=y[k];if(O.length){var C=O[0];try{C.execute()}catch(T){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(T),(!x||!x.updating)&&(O.shift(),this.executeNext(k))}}},B.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},B.current=function(k){return this.queues[k][0]},R}()},"./src/controller/cap-level-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts");function I(U,k){for(var L=0;L<k.length;L++){var y=k[L];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(U,y.key,y)}}function R(U,k,L){return k&&I(U.prototype,k),L&&I(U,L),U}var B=function(){function U(L){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=U.prototype;return k.setStreamController=function(y){this.streamController=y},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var y=this.hls;y.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var y=this.hls;y.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(y,x){U.isLevelAllowed(x.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(x.droppedLevel)},k.onMediaAttaching=function(y,x){this.media=x.media instanceof HTMLVideoElement?x.media:null},k.onManifestParsed=function(y,x){var O=this.hls;this.restrictedLevels=[],this.firstLevel=x.firstLevel,O.config.capLevelToPlayerSize&&x.video&&this.startCapping()},k.onBufferCodecs=function(y,x){var O=this.hls;O.config.capLevelToPlayerSize&&x.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var x=this.hls;x.autoLevelCapping=this.getMaxLevel(y.length-1),x.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=x.autoLevelCapping}}},k.getMaxLevel=function(y){var x=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(T,g){return U.isLevelAllowed(g,x.restrictedLevels)&&g<=y});return this.clientRect=null,U.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,x={width:0,height:0};if(y){var O=y.getBoundingClientRect();x.width=O.width,x.height=O.height,!x.width&&!x.height&&(x.width=O.right-O.left||y.width||0,x.height=O.bottom-O.top||y.height||0)}return this.clientRect=x,x},U.isLevelAllowed=function(y,x){return x===void 0&&(x=[]),x.indexOf(y)===-1},U.getMaxLevelByMediaSize=function(y,x,O){if(!y||!y.length)return-1;for(var C=function(u,s){return s?u.width!==s.width||u.height!==s.height:!0},T=y.length-1,g=0;g<y.length;g+=1){var d=y[g];if((d.width>=x||d.height>=O)&&C(d,y[g+1])){T=g;break}}return T},R(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(x){}return y}}]),U}();V.default=B},"./src/controller/cmcd-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/events.ts"),I=A("./src/types/cmcd.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/utils/logger.ts");function U(T,g){for(var d=0;d<g.length;d++){var o=g[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(T,o.key,o)}}function k(T,g,d){return g&&U(T.prototype,g),d&&U(T,d),T}function L(T,g){var d=typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(d)return(d=d.call(T)).next.bind(d);if(Array.isArray(T)||(d=y(T))||g&&T&&typeof T.length=="number"){d&&(T=d);var o=0;return function(){return o>=T.length?{done:!0}:{done:!1,value:T[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(T,g){if(!T)return;if(typeof T=="string")return x(T,g);var d=Object.prototype.toString.call(T).slice(8,-1);if(d==="Object"&&T.constructor&&(d=T.constructor.name),d==="Map"||d==="Set")return Array.from(T);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return x(T,g)}function x(T,g){(g==null||g>T.length)&&(g=T.length);for(var d=0,o=new Array(g);d<g;d++)o[d]=T[d];return o}function O(){return O=Object.assign||function(T){for(var g=1;g<arguments.length;g++){var d=arguments[g];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(T[o]=d[o])}return T},O.apply(this,arguments)}var C=function(){function T(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(w){try{var p=w.frag,f=o.hls.levels[p.level],_=o.getObjectType(p),b={d:p.duration*1e3,ot:_};(_===I.CMCDObjectType.VIDEO||_===I.CMCDObjectType.AUDIO||_==I.CMCDObjectType.MUXED)&&(b.br=f.bitrate/1e3,b.tb=o.getTopBandwidth(_),b.bl=o.getBufferLength(_)),o.apply(w,b)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var u=this.config=d.config,s=u.cmcd;s!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||T.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var g=T.prototype;return g.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(o,u){var s,w;this.audioBuffer=(s=u.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(w=u.tracks.video)===null||w===void 0?void 0:w.buffer},g.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(o,u){u===void 0&&(u={}),O(u,this.createData());var s=u.ot===I.CMCDObjectType.INIT||u.ot===I.CMCDObjectType.VIDEO||u.ot===I.CMCDObjectType.MUXED;if(this.starved&&s&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var w=T.toHeaders(u);if(!Object.keys(w).length)return;o.headers||(o.headers={}),O(o.headers,w)}else{var p=T.toQuery(u);if(!p)return;o.url=T.appendQueryToUri(o.url,p)}},g.getObjectType=function(o){var u=o.type;return u==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:u==="audio"?I.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(o){for(var u=0,s=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=L(s),p;!(p=w()).done;){var f=p.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},g.getBufferLength=function(o){var u=this.hls.media,s=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!u)return NaN;var w=R.BufferHelper.bufferInfo(s,u.currentTime,this.config.maxBufferHole);return w.len*1e3},g.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(_,b,h){u(_),this.loader.load(_,b,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},g.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(_,b,h){u(_),this.loader.load(_,b,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},T.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},T.serialize=function(o){for(var u=[],s=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},p=function(F){return w(F/100)*100},f=function(F){return encodeURIComponent(F)},_={br:w,d:w,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:w},b=Object.keys(o||{}).sort(),h=L(b),c;!(c=h()).done;){var l=c.value,a=o[l];if(!s(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var v=_[l];v&&(a=v(a));var m=typeof a,E=void 0;l==="ot"||l==="sf"||l==="st"?E=l+"="+a:m==="boolean"?E=l:m==="number"?E=l+"="+a:E=l+"="+JSON.stringify(a),u.push(E)}return u.join(",")},T.toHeaders=function(o){for(var u=Object.keys(o),s={},w=["Object","Request","Session","Status"],p=[{},{},{},{}],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},_=0,b=u;_<b.length;_++){var h=b[_],c=f[h]!=null?f[h]:1;p[c][h]=o[h]}for(var l=0;l<p.length;l++){var a=T.serialize(p[l]);a&&(s["CMCD-"+w[l]]=a)}return s},T.toQuery=function(o){return"CMCD="+encodeURIComponent(T.serialize(o))},T.appendQueryToUri=function(o,u){if(!u)return o;var s=o.includes("?")?"&":"?";return""+o+s+u},T}()},"./src/controller/eme-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=A("./src/utils/mediakeys-helper.ts");function U(C,T){for(var g=0;g<T.length;g++){var d=T[g];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function k(C,T,g){return T&&U(C.prototype,T),g&&U(C,g),C}var L=3,y=function(T,g,d){var o={audioCapabilities:[],videoCapabilities:[]};return T.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),g.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},x=function(T,g,d,o){switch(T){case B.KeySystems.WIDEVINE:return y(g,d,o);default:throw new Error("Unknown key-system: "+T)}},O=function(){function C(g){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=g,this._config=g.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var T=C.prototype;return T.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},T._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},T._attemptKeySystemAccess=function(d,o,u){var s=this,w=x(d,o,u,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(d,w);this.mediaKeysPromise=p.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),p.catch(function(f){R.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},T._onMediaKeySystemAccessObtained=function(d,o){var u=this;R.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return s.mediaKeys=p,R.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),p});return w.catch(function(p){R.logger.error("Failed to create media-keys:",p)}),w},T._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},T._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},T._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){R.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},T.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},T._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},T._generateRequestWithPreferredKeySession=function(d,o){var u=this,s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var w=s.mediaKeysSession;if(!w){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,w.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(p){R.logger.error("Error generating key-session request:",p),u.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},T._createLicenseXhr=function(d,o,u){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,o,u);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,s,d),w=void 0}catch(p){R.logger.error(p)}try{s.readyState||s.open("POST",d,!0),w&&w.call(this.hls,s,d)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return s},T._onLicenseRequestReadyStageChange=function(d,o,u,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var w=d.response,p=this._licenseResponseCallback;if(p)try{w=p.call(this.hls,d,o)}catch(_){R.logger.error(_)}s(w)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=L-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,s)}break}},T._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},T._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(u.mediaKeySystemDomain),w=this._createLicenseXhr(s,d,o);R.logger.log("Sending license request to URL: "+s);var p=this._generateLicenseRequestChallenge(u,d);w.send(p)}catch(f){R.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},T.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},T.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},T.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),s=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,s)},k(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=O},"./src/controller/fps-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=function(){function B(k){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=k,this.registerListeners()}var U=B.prototype;return U.setStreamController=function(L){this.streamController=L},U.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(L,y){var x=this.hls.config;if(x.capLevelOnFPSDrop){var O=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),x.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(L,y,x){var O=performance.now();if(y){if(this.lastTime){var C=O-this.lastTime,T=x-this.lastDroppedFrames,g=y-this.lastDecodedFrames,d=1e3*T/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:T,currentDecoded:g,totalDroppedFrames:x}),d>0&&T>o.config.fpsDroppedMonitoringThreshold*g){var u=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=x,this.lastDecodedFrames=y}},U.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var y=L.getVideoPlaybackQuality();this.checkFPS(L,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"findFragmentByPDT",function(){return R}),A.d(V,"findFragmentByPTS",function(){return B}),A.d(V,"fragmentWithinToleranceTest",function(){return U}),A.d(V,"pdtWithinToleranceTest",function(){return k}),A.d(V,"findFragWithCC",function(){return L});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/binary-search.ts");function R(y,x,O){if(x===null||!Array.isArray(y)||!y.length||!Object(G.isFiniteNumber)(x))return null;var C=y[0].programDateTime;if(x<(C||0))return null;var T=y[y.length-1].endProgramDateTime;if(x>=(T||0))return null;O=O||0;for(var g=0;g<y.length;++g){var d=y[g];if(k(x,O,d))return d}return null}function B(y,x,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var T=null;if(y?T=x[y.sn-x[0].sn+1]||null:O===0&&x[0].start===0&&(T=x[0]),T&&U(O,C,T)===0)return T;var g=I.default.search(x,U.bind(null,O,C));return g||T}function U(y,x,O){y===void 0&&(y=0),x===void 0&&(x=0);var C=Math.min(x,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=y?1:O.start-C>y&&O.start?-1:0}function k(y,x,O){var C=Math.min(x,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,T=O.endProgramDateTime||0;return T-C>y}function L(y,x){return I.default.search(y,function(O){return O.cc<x?1:O.cc>x?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"FragmentState",function(){return R}),A.d(V,"FragmentTracker",function(){return B});var G=A("./src/events.ts"),I=A("./src/types/loader.ts"),R;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(R||(R={}));var B=function(){function L(x){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=x,this._registerListeners()}var y=L.prototype;return y._registerListeners=function(){var O=this.hls;O.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var O=this.hls;O.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(O,C){if(C===I.PlaylistLevelType.MAIN){var T=this.activeFragment,g=this.activeParts;if(!T)return null;if(g)for(var d=g.length;d--;){var o=g[d],u=o?o.end:T.appendedPTS;if(o.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=g.slice(d-9)),o}else if(T.start<=O&&T.appendedPTS!==void 0&&O<=T.appendedPTS)return T}return this.getBufferedFrag(O,C)},y.getBufferedFrag=function(O,C){for(var T=this.fragments,g=Object.keys(T),d=g.length;d--;){var o=T[g[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var u=o.body;if(u.start<=O&&O<=u.end)return u}}return null},y.detectEvictedFragments=function(O,C,T){var g=this;Object.keys(this.fragments).forEach(function(d){var o=g.fragments[d];if(!o)return;if(!o.buffered){o.body.type===T&&g.removeFragment(o.body);return}var u=o.range[O];if(!u)return;u.time.some(function(s){var w=!g.isTimeBuffered(s.startPTS,s.endPTS,C);return w&&g.removeFragment(o.body),w})})},y.detectPartialFragments=function(O){var C=this,T=this.timeRanges,g=O.frag,d=O.part;if(!T||g.sn==="initSegment")return;var o=k(g),u=this.fragments[o];if(!u)return;Object.keys(T).forEach(function(s){var w=g.elementaryStreams[s];if(!w)return;var p=T[s],f=d!==null||w.partial===!0;u.range[s]=C.getBufferedTimes(g,d,f,p)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},y.fragBuffered=function(O){var C=k(O),T=this.fragments[C];T&&(T.backtrack=T.loaded=null,T.buffered=!0)},y.getBufferedTimes=function(O,C,T,g){for(var d={time:[],partial:T},o=C?C.start:O.start,u=C?C.end:O.end,s=O.minEndPTS||u,w=O.maxStartPTS||o,p=0;p<g.length;p++){var f=g.start(p)-this.bufferPadding,_=g.end(p)+this.bufferPadding;if(w>=f&&s<=_){d.time.push({startPTS:Math.max(o,g.start(p)),endPTS:Math.min(u,g.end(p))});break}else if(o<_&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,g.start(p)),endPTS:Math.min(u,g.end(p))});else if(u<=f)break}return d},y.getPartialFragment=function(O){var C=null,T,g,d,o=0,u=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(w){var p=s[w];if(!p)return;U(p)&&(g=p.body.start-u,d=p.body.end+u,O>=g&&O<=d&&(T=Math.min(O-g,d-O),o<=T&&(C=p.body,o=T)))}),C},y.getState=function(O){var C=k(O),T=this.fragments[C];return T?T.buffered?U(T)?R.PARTIAL:R.OK:T.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},y.backtrack=function(O,C){var T=k(O),g=this.fragments[T];if(!g||g.backtrack)return null;var d=g.backtrack=C||g.loaded;return g.loaded=null,d},y.getBacktrackData=function(O){var C=k(O),T=this.fragments[C];if(T){var g,d=T.backtrack;if(d!=null&&(g=d.payload)!==null&&g!==void 0&&g.byteLength)return d;this.removeFragment(O)}return null},y.isTimeBuffered=function(O,C,T){for(var g,d,o=0;o<T.length;o++){if(g=T.start(o)-this.bufferPadding,d=T.end(o)+this.bufferPadding,O>=g&&C<=d)return!0;if(C<=g)return!1}return!1},y.onFragLoaded=function(O,C){var T=C.frag,g=C.part;if(T.sn==="initSegment"||T.bitrateTest||g)return;var d=k(T);this.fragments[d]={body:T,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(O,C){var T=this,g=C.frag,d=C.part,o=C.timeRanges;if(g.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=g,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var w=o[s];if(T.detectEvictedFragments(s,w),!d)for(var p=0;p<w.length;p++)g.appendedPTS=Math.max(w.end(p),g.appendedPTS||0)})},y.onFragBuffered=function(O,C){this.detectPartialFragments(C)},y.hasFragment=function(O){var C=k(O);return!!this.fragments[C]},y.removeFragmentsInRange=function(O,C,T){var g=this;Object.keys(this.fragments).forEach(function(d){var o=g.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===T&&u.start<C&&u.end>O&&g.removeFragment(u)}})},y.removeFragment=function(O){var C=k(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function U(L){var y,x;return L.buffered&&(((y=L.range.video)===null||y===void 0?void 0:y.partial)||((x=L.range.audio)===null||x===void 0?void 0:x.partial))}function k(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"STALL_MINIMUM_DURATION_MS",function(){return U}),A.d(V,"MAX_START_GAP_JUMP",function(){return k}),A.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),A.d(V,"SKIP_BUFFER_RANGE_START",function(){return y}),A.d(V,"default",function(){return x});var G=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts"),B=A("./src/utils/logger.ts"),U=250,k=2,L=.1,y=.05,x=function(){function O(T,g,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=T,this.media=g,this.fragmentTracker=d,this.hls=o}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(g){var d=this.config,o=this.media,u=this.stalled,s=o.currentTime,w=o.seeking,p=this.seeking&&!w,f=!this.seeking&&w;if(this.seeking=w,s!==g){if(this.moved=!0,u!==null){if(this.stallReported){var _=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(_)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var b=G.BufferHelper.bufferInfo(o,s,0),h=b.len>0,c=b.nextStart||0;if(!h&&!c)return;if(w){var l=b.len>k,a=!c||c-s>k&&!this.fragmentTracker.getPartialFragment(s);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,m=Math.max(c,b.start||0)-s,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=E==null||((v=E.details)===null||v===void 0)?void 0:v.live,F=M?E.details.targetduration*2:k;if(m>0&&m<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(u===null){this.stalled=j;return}var W=j-u;!w&&W>=U&&this._reportStall(b.len);var D=G.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(D,W)},C._tryFixBufferStall=function(g,d){var o=this.config,u=this.fragmentTracker,s=this.media,w=s.currentTime,p=u.getPartialFragment(w);if(p){var f=this._trySkipBufferHole(p);if(f)return}g.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(g){var d=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+g+")"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},C._trySkipBufferHole=function(g){for(var d=this.config,o=this.hls,u=this.media,s=u.currentTime,w=0,p=G.BufferHelper.getBuffered(u),f=0;f<p.length;f++){var _=p.start(f);if(s+d.maxBufferHole>=w&&s<_){var b=Math.max(_+y,u.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+b),this.moved=!0,this.stalled=null,u.currentTime=b,g&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+b,frag:g}),b}w=p.end(f)}return 0},C._tryNudgeBuffer=function(){var g=this.config,d=this.hls,o=this.media,u=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<g.nudgeMaxRetry){var w=u+s*g.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+u+" to "+w),o.currentTime=w,d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+g.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/texttrack-utils.ts"),R=A("./src/demux/id3.ts"),B=.25,U=function(){function k(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var L=k.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var x=this.hls;x.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var x=this.hls;x.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(x,O){this.media=O.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(x){if(!this.media)return;for(var O=0;O<x.length;O++){var C=x[O];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(x,O){if(!this.media)return;var C=O.frag,T=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<T.length;d++){var o=R.getID3Frames(T[d].data);if(o){var u=T[d].pts,s=d<T.length-1?T[d+1].pts:C.end,w=s-u;w<=0&&(s=u+B);for(var p=0;p<o.length;p++){var f=o[p];if(!R.isTimeStampFrame(f)){var _=new g(u,s,"");_.value=f,this.id3Track.addCue(_)}}}}},L.onBufferFlushing=function(x,O){var C=O.startOffset,T=O.endOffset,g=O.type;if(!g||g==="audio"){var d=this.id3Track;d&&Object(I.removeCuesInRange)(d,C,T)}},k}();V.default=U},"./src/controller/latency-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/errors.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts");function B(L,y){for(var x=0;x<y.length;x++){var O=y[x];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(L,O.key,O)}}function U(L,y,x){return y&&B(L.prototype,y),x&&B(L,x),L}var k=function(){function L(x){var O=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 O.timeupdate()},this.hls=x,this.config=x.config,this.registerListeners()}var y=L.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},y.onMediaAttached=function(O,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(O,C){var T=C.details;this.levelDetails=T,T.advanced&&this.timeupdate(),!T.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(O,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var T=this.computeLatency();if(T===null)return;this._latency=T;var g=this.config,d=g.lowLatencyMode,o=g.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var s=T-u,w=Math.min(this.maxLatency,u+C.targetduration),p=s<w;if(C.live&&p&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),_=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,_))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},y.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},y.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},U(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,T=O.partHoldBack,g=O.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,s=d.lowLatencyMode,w=this.hls.userConfig,p=s&&T||C;(w.liveSyncDuration||w.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:u*g);var f=g,_=1;return p+Math.min(this.stallCount*_,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,T=this.levelDetails;if(O===null||C===null||T===null)return null;var g=T.edge,d=O-C-this.edgeStalled,o=g-T.totalduration,u=g-(this.config.lowLatencyMode&&T.partTarget||T.targetduration);return Math.min(Math.max(o,d),u)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var T=O.buffered.length;return T?O.buffered.end(T-1):C.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return d});var G=A("./src/types/level.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/codecs.ts"),U=A("./src/controller/level-helper.ts"),k=A("./src/controller/base-playlist-controller.ts"),L=A("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var w in s)Object.prototype.hasOwnProperty.call(s,w)&&(o[w]=s[w])}return o},y.apply(this,arguments)}function x(o,u){for(var s=0;s<u.length;s++){var w=u[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,s){return u&&x(o.prototype,u),s&&x(o,s),o}function C(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,T(o,u)}function T(o,u){return T=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},T(o,u)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(u,o);function u(w){var p;return p=o.call(this,w,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var s=u.prototype;return s._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var p=this._levels;p.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(p,f){var _=[],b=[],h=[],c,l={},a,v=!1,m=!1,E=!1;if(f.levels.forEach(function(W){var D=W.attrs;v=v||!!(W.width&&W.height),m=m||!!W.videoCodec,E=E||!!W.audioCodec,g&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var P=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[P],a?a.url.push(W.url):(a=new G.Level(W),l[P]=a,_.push(a)),D&&(D.AUDIO&&Object(U.addGroupId)(a,"audio",D.AUDIO),D.SUBTITLES&&Object(U.addGroupId)(a,"text",D.SUBTITLES))}),(v||m)&&E&&(_=_.filter(function(W){var D=W.videoCodec,P=W.width,H=W.height;return!!D||!!(P&&H)})),_=_.filter(function(W){var D=W.audioCodec,P=W.videoCodec;return(!D||Object(B.isCodecSupportedInMp4)(D,"audio"))&&(!P||Object(B.isCodecSupportedInMp4)(P,"video"))}),f.audioTracks&&(b=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(b)),f.subtitles&&(h=f.subtitles,Object(U.assignTrackIdsByGroup)(h)),_.length>0){c=_[0].bitrate,_.sort(function(W,D){return W.bitrate-D.bitrate}),this._levels=_;for(var M=0;M<_.length;M++)if(_[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+_.length+" level(s) found, first bitrate: "+c);break}var F=E&&!m,j={levels:_,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:m,altAudio:!F&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var _=f.context,b=this._levels[this.currentLevelIndex];if(_&&(_.type===L.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&_.groupId===b.audioGroupIds[b.urlId]||_.type===L.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&_.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(f.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=f.frag.level)):l=f.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:_&&(_.deliveryDirectives&&(c=!1),l=_.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=f.level,h=!0;break}l!==void 0&&this.recoverLevel(f,l,h,c)},s.recoverLevel=function(p,f,_,b){var h=p.details,c=this._levels[f];if(c.loadError++,_){var l=this.retryLoadingOrFail(p);if(l)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var v=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),p.levelRetry=!0,this.hls.nextAutoLevel=v)}}},s.redundantFailover=function(p){var f=this._levels[p],_=f.url.length;if(_>1){var b=(f.urlId+1)%_;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=p}},s.onFragLoaded=function(p,f){var _=f.frag;if(_!==void 0&&_.type===L.PlaylistLevelType.MAIN){var b=this._levels[_.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},s.onLevelLoaded=function(p,f){var _,b=f.level,h=f.details,c=this._levels[b];if(!c){var l;this.warn("Invalid level index "+b),(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,c.details)):(_=f.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(h.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(p,f){var _=this.hls.levels[this.currentLevelIndex];if(!_)return;if(_.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[f.id].groupId,c=0;c<_.audioGroupIds.length;c++)if(_.audioGroupIds[c]===h){b=c;break}b!==_.urlId&&(_.urlId=b,this.startLoad())}},s.loadPlaylist=function(p){var f=this.currentLevelIndex,_=this._levels[f];if(this.canLoad&&_&&_.url.length>0){var b=_.urlId,h=_.url[b];if(p)try{h=p.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:b,deliveryDirectives:p||null})}},s.removeLevel=function(p,f){var _=function(c,l){return l!==f},b=this._levels.filter(function(h,c){return c!==p?!0:h.url.length>1&&f!==void 0?(h.url=h.url.filter(_),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(_)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(_)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,_=this._levels;if(_.length===0)return;if(this.currentLevelIndex===p&&(f=_[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=_.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,_.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=_[h],l=_[p];this.log("switching to level "+p+" from "+h),this.currentLevelIndex=p;var a=y({},l,{level:p,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var v=l.details;if(!v||v.live){var m=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"addGroupId",function(){return R}),A.d(V,"assignTrackIdsByGroup",function(){return B}),A.d(V,"updatePTS",function(){return U}),A.d(V,"updateFragPTSDTS",function(){return L}),A.d(V,"mergeDetails",function(){return y}),A.d(V,"mapPartIntersection",function(){return x}),A.d(V,"mapFragmentIntersection",function(){return O}),A.d(V,"adjustSliding",function(){return C}),A.d(V,"addSliding",function(){return T}),A.d(V,"computeReloadInterval",function(){return g}),A.d(V,"getFragmentWithSN",function(){return d}),A.d(V,"getPartWith",function(){return o});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts");function R(u,s,w){switch(s){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(w);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(w);break}}function B(u){var s={};u.forEach(function(w){var p=w.groupId||"";w.id=s[p]=s[p]||0,s[p]++})}function U(u,s,w){var p=u[s],f=u[w];k(p,f)}function k(u,s){var w=s.startPTS;if(Object(G.isFiniteNumber)(w)){var p=0,f;s.sn>u.sn?(p=w-u.start,f=u):(p=u.start-w,f=s),f.duration!==p&&(f.duration=p)}else if(s.sn>u.sn){var _=u.cc===s.cc;_&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration}else s.start=Math.max(u.start-s.duration,0)}function L(u,s,w,p,f,_){var b=p-w;b<=0&&(I.logger.warn("Fragment should have a positive duration",s),p=w+s.duration,_=f+s.duration);var h=w,c=p,l=s.startPTS,a=s.endPTS;if(Object(G.isFiniteNumber)(l)){var v=Math.abs(l-w);Object(G.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(v,s.deltaPTS):s.deltaPTS=v,h=Math.max(w,l),w=Math.min(w,l),f=Math.min(f,s.startDTS),c=Math.min(p,a),p=Math.max(p,a),_=Math.max(_,s.endDTS)}s.duration=p-w;var m=w-s.start;s.appendedPTS=p,s.start=s.startPTS=w,s.maxStartPTS=h,s.startDTS=f,s.endPTS=p,s.minEndPTS=c,s.endDTS=_;var E=s.sn;if(!u||E<u.startSN||E>u.endSN)return 0;var M,F=E-u.startSN,j=u.fragments;for(j[F]=s,M=F;M>0;M--)k(j[M],j[M-1]);for(M=F;M<j.length-1;M++)k(j[M],j[M+1]);return u.fragmentHint&&k(j[j.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function y(u,s){for(var w=null,p=u.fragments,f=p.length-1;f>=0;f--){var _=p[f].initSegment;if(_){w=_;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var b=0,h;if(O(u,s,function(M,F){M.relurl&&(b=M.cc-F.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(h=F),s.PTSKnown=s.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,w=M.initSegment)}),w){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=w)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(M){return!M}),s.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=s.skippedSegments;l--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=b}s.skippedSegments&&(s.startCC=s.fragments[0].cc),x(u.partList,s.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),h?L(s,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(u,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var m=s.advancedDateTime;if(s.advanced&&m){var E=s.edge;s.driftStart||(s.driftStartTime=m,s.driftStart=E),s.driftEndTime=m,s.driftEnd=E}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function x(u,s,w){if(u&&s)for(var p=0,f=0,_=u.length;f<=_;f++){var b=u[f],h=s[f+p];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?w(b,h):p--}}function O(u,s,w){for(var p=s.skippedSegments,f=Math.max(u.startSN,s.startSN)-s.startSN,_=(u.fragmentHint?1:0)+(p?s.endSN:Math.min(u.endSN,s.endSN))-s.startSN,b=s.startSN-u.startSN,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=f;l<=_;l++){var a=c[b+l],v=h[l];p&&!v&&l<p&&(v=s.fragments[l]=a),a&&v&&w(a,v)}}function C(u,s){var w=s.startSN+s.skippedSegments-u.startSN,p=u.fragments;if(w<0||w>=p.length)return;T(s,p[w].start)}function T(u,s){if(s){for(var w=u.fragments,p=u.skippedSegments;p<w.length;p++)w[p].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function g(u,s){var w=1e3*u.levelTargetDuration,p=w/2,f=u.age,_=f>0&&f<w*3,b=s.loading.end-s.loading.start,h,c=u.availabilityDelay;if(u.updated===!1)if(_){var l=333*u.misses;h=Math.max(Math.min(p,b*2),l),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=p;else _?(c=Math.min(c||w/2,f),u.availabilityDelay=c,h=c+w-f):h=w-b;return Math.round(h)}function d(u,s,w){if(!u||!u.details)return null;var p=u.details,f=p.fragments[s-p.startSN];return f||(f=p.fragmentHint,f&&f.sn===s?f:s<p.startSN&&w&&w.sn===s?w:null)}function o(u,s,w){if(!u||!u.details)return null;var p=u.details.partList;if(p)for(var f=p.length;f--;){var _=p[f];if(_.index===w&&_.fragment.sn===s)return _}return null}},"./src/controller/stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return p});var G=A("./src/polyfills/number.ts"),I=A("./src/controller/base-stream-controller.ts"),R=A("./src/is-supported.ts"),B=A("./src/events.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),L=A("./src/types/loader.ts"),y=A("./src/loader/fragment.ts"),x=A("./src/demux/transmuxer-interface.ts"),O=A("./src/types/transmuxer.ts"),C=A("./src/controller/gap-controller.ts"),T=A("./src/errors.ts"),g=A("./src/utils/logger.ts");function d(f,_){for(var b=0;b<_.length;b++){var h=_[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function o(f,_,b){return _&&d(f.prototype,_),b&&d(f,b),f}function u(f,_){f.prototype=Object.create(_.prototype),f.prototype.constructor=f,s(f,_)}function s(f,_){return s=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},s(f,_)}var w=100,p=function(f){u(_,f);function _(h,c){var l;return l=f.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var b=_.prototype;return b._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,v=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),M=this.retryDate;(!M||E>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,l,a=this.hls,v=this.levelLastLoaded,m=this.levels,E=this.media,M=a.config,F=a.nextLoadLevel;if(v===null||!E&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[F])return;var j=m[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,L.PlaylistLevelType.MAIN);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(j.maxBitrate);if(P>=H)return;if(this._streamEnded(D,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var ee=D.end,oe=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Te=oe.sn-W.startSN;Te>1&&(oe=W.fragments[Te-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===k.FragmentState.OK&&this.nextLoadPosition>ee){var ve=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ve,L.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((c=oe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=oe.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},b.loadFragment=function(c,l,a){var v,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===k.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.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,l,a)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,v=this.getAppendedFrag(l.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!l.paused&&c){var m=this.hls.nextLoadLevel,E=c[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,D=j.duration,P=Math.max(F.end,W+Math.min(Math.max(D-this.config.maxFragLookUpTolerance,D*.5),D*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,l){f.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},b.onMediaAttached=function(c,l){f.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},b.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)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,l){var a=!1,v=!1,m;l.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var v=a[l.level];(!v.details||v.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(v.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,l){var a,v=this.levels,m=l.level,E=l.details,M=E.totalduration;if(!v){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==l.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=v[m],W=0;if(E.live||(a=j.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;W=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=I.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,W),this.tick()},b._handleFragmentLoadProgress=function(c){var l,a=c.frag,v=c.part,m=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=E[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,D=(l=a.initSegment)===null||l===void 0?void 0:l.data,P=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new x.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=v?v.index:-1,ee=Y!==-1,oe=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,ee),Te=this.initPTS[a.cc];H.push(m,D,P,j,a,v,F.totalduration,W,oe,Te)},b.onAudioTrackSwitching=function(c,l){var a=this.altAudio,v=!!l.url,m=l.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(c,l){var a=l.id,v=!!this.hls.audioTracks[a].url;if(v){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=v,this.tick()},b.onBufferCreated=function(c,l){var a=l.tracks,v,m,E=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(m=M,v=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&v?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,l){var a=l.frag,v=l.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},b.onError=function(c,l){switch(l.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,l);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,l){var a=l.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,L.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,l){this.levels=l.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){g.logger.log("could not seek to "+a+", already seeking at "+l);return}var v=U.BufferHelper.getBuffered(c),m=v.length?v.start(0):0,E=m-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},b._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},b._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var v=l.hls;if(!a||v.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=I.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var m=c.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),v.trigger(B.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var l,a="main",v=this.hls,m=c.remuxResult,E=c.chunkMeta,M=this.getCurrentContext(E);if(!M){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var F=M.frag,j=M.part,W=M.level,D=m.video,P=m.text,H=m.id3,Y=m.initSegment,ee=this.altAudio?void 0:m.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,E),v.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var oe=Y.initPTS,Te=Y.timescale;Object(G.isFiniteNumber)(oe)&&(this.initPTS[F.cc]=oe,v.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:oe,timescale:Te}))}if(D&&m.independent!==!1){if(W.details){var ve=D.startPTS,ge=D.endPTS,he=D.startDTS,fe=D.endDTS;if(j)j.elementaryStreams[D.type]={startPTS:ve,endPTS:ge,startDTS:he,endDTS:fe};else if(D.firstKeyFrame&&D.independent&&(this.couldBacktrack=!0),D.dropped&&D.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<ve){this.backtrack(F);return}F.setElementaryStreamInfo(D.type,F.start,ge,F.start,fe,!0)}F.setElementaryStreamInfo(D.type,ve,ge,he,fe),this.bufferFragmentData(D,F,j,E)}}else if(m.independent===!1){this.backtrack(F);return}if(ee){var me=ee.startPTS,J=ee.endPTS,ne=ee.startDTS,Q=ee.endDTS;j&&(j.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:J,startDTS:ne,endDTS:Q}),F.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,me,J,ne,Q),this.bufferFragmentData(ee,F,j,E)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var Ee={frag:F,id:a,samples:H.samples};v.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(P){var Ce={frag:F,id:a,samples:P.samples};v.trigger(B.Events.FRAG_PARSING_USERDATA,Ce)}},b._bufferInitSegment=function(c,l,a,v){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var E=l.audio,M=l.video,F=l.audiovideo;if(E){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),E.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),E.levelCodec=j,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(D){var P=l[D],H=P.initSegment;H!=null&&H.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:D,data:H,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(U.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):U.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var v=this.fragPlaying,m=l.level;(!v||l.sn!==v.sn||v.level!==m||l.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!v||v.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=l)}}},o(_,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),_}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"SubtitleStreamController",function(){return u});var G=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/controller/fragment-finders.ts"),U=A("./src/utils/discontinuities.ts"),k=A("./src/controller/level-helper.ts"),L=A("./src/controller/fragment-tracker.ts"),y=A("./src/controller/base-stream-controller.ts"),x=A("./src/types/loader.ts"),O=A("./src/types/level.ts");function C(s,w){for(var p=0;p<w.length;p++){var f=w[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function T(s,w,p){return w&&C(s.prototype,w),p&&C(s,p),s}function g(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,d(s,w)}function d(s,w){return d=Object.setPrototypeOf||function(f,_){return f.__proto__=_,f},d(s,w)}var o=500,u=function(s){g(w,s);function w(f,_){var b;return b=s.call(this,f,_,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=w.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var _=this.hls;_.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(G.Events.ERROR,this.onError,this),_.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var _=this.hls;_.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(G.Events.ERROR,this.onError,this),_.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(_,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(_,b){var h=b.frag,c=b.success;if(this.fragPrevious=h,this.state=y.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,v=h.start,m=0;m<l.length;m++)if(v>=l[m].start&&v<=l[m].end){a=l[m];break}var E=h.start+h.duration;a?a.end=E:(a={start:v,end:E},l.push(a)),this.fragmentTracker.fragBuffered(h)},p.onBufferFlushing=function(_,b){var h=b.startOffset,c=b.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var v=a[l].details,m=v.targetduration,E=c-m;if(E<=0)return;b.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=E){M.shift();continue}else if(M[F].start<E)M[F].start=E;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,E,x.PlaylistLevelType.SUBTITLE)}},p.onError=function(_,b){var h,c=b.frag;if(!c||c.type!==x.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},p.onSubtitleTracksUpdated=function(_,b){var h=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new O.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(_,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(_,b){var h,c=b.details,l=b.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var m=v[a];if(l>=v.length||l!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=m.details)!==null&&h!==void 0&&h.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var M=E.fragments[0];if(!m.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,E):M&&Object(k.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,m.details);F===0&&M&&Object(k.addSliding)(c,M.start)}}if(m.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(_){var b=_.frag,h=_.payload,c=b.decryptdata,l=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(v){var m=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:b,payload:v,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var _,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var c=h[b].details,l=c.targetduration,a=this.config,v=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-l,a.maxBufferHole),E=m.end,M=m.len,F=this.getMaxBufferLength()+l;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,D=c.edge,P,H=this.fragPrevious;if(E<D){var Y=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,Y)),P||(P=Object(B.findFragmentByPTS)(H,j,E,Y),!P&&H&&H.start<j[0].start&&(P=j[0]))}else P=j[W-1];(_=P)!==null&&_!==void 0&&_.encrypted?(I.logger.log("Loading key for "+P.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===L.FragmentState.NOT_LOADED&&this.loadFragment(P,c,E)}},p.loadFragment=function(_,b,h){this.fragCurrent=_,s.prototype.loadFragment.call(this,_,b,h)},T(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(y.default)},"./src/controller/subtitle-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/texttrack-utils.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function U(C,T){for(var g=0;g<T.length;g++){var d=T[g];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function k(C,T,g){return T&&U(C.prototype,T),g&&U(C,g),C}function L(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,y(C,T)}function y(C,T){return y=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},y(C,T)}var x=function(C){L(T,C);function T(d){var o;return o=C.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var g=T.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},g.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},g.onMediaAttached=function(o,u){if(this.media=u.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)},g.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},g.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=O(this.media.textTracks);o.forEach(function(u){Object(I.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},g.onSubtitleTrackLoaded=function(o,u){var s=u.id,w=u.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+s);return}var _=f.details;f.details=u.details,this.log("subtitle track "+s+" loaded ["+w.startSN+"-"+w.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,u,_))},g.onLevelLoading=function(o,u){this.switchLevel(u.level)},g.onLevelSwitching=function(o,u){this.switchLevel(u.level)},g.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var s=u.textGroupIds[u.urlId];if(this.groupId!==s){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!s||b.groupId===s});this.tracksInGroup=p;var f=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=s;var _={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,_),f!==-1&&this.setSubtitleTrack(f,w)}},g.findTrackId=function(o){for(var u=this.tracksInGroup,s=0;s<u.length;s++){var w=u[s];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},g.onError=function(o,u){if(C.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},g.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var s=u.id,w=u.groupId,p=u.url;if(o)try{p=o.addDirectives(p)}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(G.Events.SUBTITLE_TRACK_LOADING,{url:p,id:s,groupId:w,deliveryDirectives:o||null})}},g.toggleTrackModes=function(o){var u=this,s=this.media,w=this.subtitleDisplay,p=this.trackId;if(!s)return;var f=O(s.textTracks),_=f.filter(function(c){return c.groupId===u.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var b=_[p];b&&(b.mode="disabled")}var h=_[o];h&&(h.mode=w?"showing":"hidden")},g.setSubtitleTrack=function(o,u){var s,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=w[o])!==null&&s!==void 0&&s.details)||o<-1||o>=w.length)return;this.clearTimer();var p=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,_=p.groupId,b=_===void 0?"":_,h=p.name,c=p.type,l=p.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:h,type:c,url:l});var a=this.switchParams(p.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=O(this.media.textTracks),s=0;s<u.length;s++)if(u[s].mode==="hidden")o=s;else if(u[s].mode==="showing"){o=s;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},k(T,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),T}(R.default);function O(C){for(var T=[],g=0;g<C.length;g++){var d=C[g];d.kind==="subtitles"&&d.label&&T.push(C[g])}return T}V.default=x},"./src/controller/timeline-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"TimelineController",function(){return O});var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/cea-608-parser.ts"),B=A("./src/utils/output-filter.ts"),U=A("./src/utils/webvtt-parser.ts"),k=A("./src/utils/texttrack-utils.ts"),L=A("./src/utils/imsc1-ttml-parser.ts"),y=A("./src/types/loader.ts"),x=A("./src/utils/logger.ts"),O=function(){function d(u){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=g(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 B.default(this,"textTrack1"),w=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,s,w),this.cea608Parser2=new R.default(3,p,f)}u.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(I.Events.FRAG_LOADING,this.onFragLoading,this),u.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(I.Events.FRAG_LOADING,this.onFragLoading,this),s.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,w,p,f,_){for(var b=!1,h=_.length;h--;){var c=_[h],l=T(c[0],c[1],w,p);if(l>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],p),b=!0,l/(p-w)>.5))return}if(b||_.push([w,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,w,p,f)}else{var v=this.Cues.newCue(null,w,p,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:v,track:s})}},o.onInitPtsFound=function(s,w){var p=this,f=w.frag,_=w.id,b=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;_==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){p.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(s){var w=this.media;if(w)for(var p=0;p<w.textTracks.length;p++){var f=w.textTracks[p];if(f[s])return f}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var w=this.captionsProperties,p=this.captionsTracks,f=this.media,_=w[s],b=_.label,h=_.languageCode,c=this.getExistingTrack(s);if(c)p[s]=c,Object(k.clearCurrentCues)(p[s]),Object(k.sendAddTrackEvent)(p[s],f);else{var l=this.createTextTrack("captions",b,h);l&&(l[s]=!0,p[s]=l)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var w=this.captionsProperties[s];if(!w)return;var p=w.label,f={_id:s,label:p,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(s,w,p){var f=this.media;return f?f.addTextTrack(s,w,p):void 0},o.onMediaAttaching=function(s,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(w){Object(k.clearCurrentCues)(s[w]),delete s[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var s=this.media;if(!s)return;var w=s.textTracks;if(w)for(var p=0;p<w.length;p++)Object(k.clearCurrentCues)(w[p])},o.onSubtitleTracksUpdated=function(s,w){var p=this;this.textTracks=[];var f=w.subtitleTracks||[],_=f.some(function(l){return l.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||_&&this.config.enableIMSC1){var b=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var v;if(a<h.length){for(var m=null,E=0;E<h.length;E++)if(C(h[E],l)){m=h[E];break}m&&(v=m)}v?Object(k.clearCurrentCues)(v):(v=p.createTextTrack("subtitles",l.name,l.lang),v&&(v.mode="disabled")),v&&(v.groupId=l.groupId,p.textTracks.push(v))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(s,w){var p=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(f){var _=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!_)return;var b="textTrack"+_[1],h=p.captionsProperties[b];if(!h)return;h.label=f.name,f.lang&&(h.languageCode=f.lang),h.media=f})},o.onFragLoading=function(s,w){var p=this.cea608Parser1,f=this.cea608Parser2,_=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&f))return;if(w.frag.type===y.PlaylistLevelType.MAIN){var h,c,l=w.frag.sn,a=(h=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===_+1||l===_&&a===b+1||(p.reset(),f.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(s,w){var p=w.frag,f=w.payload,_=this.initPTS,b=this.unparsedVttFrags;if(p.type===y.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(G.isFiniteNumber)(_[p.cc])){b.push(w),_.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var h=p.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[p.level],l=this.vttCCs;l[p.cc]||(l[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===L.IMSC1_CODEC?this._parseIMSC1(p,f):this._parseVTTs(p,f,l)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,w){var p=this,f=this.hls;Object(L.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(_){p._appendCues(_,s.level),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(_){x.logger.log("Failed to parse IMSC1: "+_),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:_})})},o._parseVTTs=function(s,w,p){var f=this,_=this.hls;Object(U.parseWebVTT)(w,this.initPTS[s.cc],this.timescale[s.cc],p,s.cc,s.start,function(b){f._appendCues(b,s.level),_.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(b){f._fallbackToIMSC1(s,w),x.logger.log("Failed to parse VTT cue: "+b),_.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:b})})},o._fallbackToIMSC1=function(s,w){var p=this,f=this.tracks[s.level];f.textCodec||Object(L.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=L.IMSC1_CODEC,p._parseIMSC1(s,w)},function(){f.textCodec="wvtt"})},o._appendCues=function(s,w){var p=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[w];if(f.mode==="disabled")return;s.forEach(function(h){return Object(k.addCueToTrack)(f,h)})}else{var _=this.tracks[w],b=_.default?"default":"subtitles"+w;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:s,track:b})}},o.onFragDecrypted=function(s,w){var p=w.frag;if(p.type===y.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(I.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,w){var p=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(p&&f))return;for(var _=0;_<w.samples.length;_++){var b=w.samples[_].bytes;if(b){var h=this.extractCea608Data(b);p.addData(w.samples[_].pts,h[0]),f.addData(w.samples[_].pts,h[1])}}},o.onBufferFlushing=function(s,w){var p=w.startOffset,f=w.endOffset,_=w.endOffsetSubtitles,b=w.type,h=this.media;if(!h||h.currentTime<f)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(k.removeCuesInRange)(c[a],p,f)})}if(this.config.renderTextTracksNatively&&(p===0&&_!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(k.removeCuesInRange)(l[a],p,_)})}},o.extractCea608Data=function(s){for(var w=s[0]&31,p=2,f=[[],[]],_=0;_<w;_++){var b=s[p++],h=127&s[p++],c=127&s[p++],l=(4&b)!==0,a=3&b;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(f[a].push(h),f[a].push(c)))}return f},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function T(d,o,u,s){return Math.min(o,s)-Math.max(d,u)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var R=I.prototype;return R.decrypt=function(U,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,U)},I}()},"./src/crypt/aes-decryptor.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"removePadding",function(){return I}),A.d(V,"default",function(){return R});var G=A("./src/utils/typed-array.ts");function I(B){var U=B.byteLength,k=U&&new DataView(B.buffer).getUint8(U-1);return k?Object(G.sliceUint8)(B,0,U-k):B}var R=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=B.prototype;return U.uint8ArrayToUint32Array_=function(L){for(var y=new DataView(L),x=new Uint32Array(4),O=0;O<4;O++)x[O]=y.getUint32(O*4);return x},U.initTable=function(){var L=this.sBox,y=this.invSBox,x=this.subMix,O=x[0],C=x[1],T=x[2],g=x[3],d=this.invSubMix,o=d[0],u=d[1],s=d[2],w=d[3],p=new Uint32Array(256),f=0,_=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var h=_^_<<1^_<<2^_<<3^_<<4;h=h>>>8^h&255^99,L[f]=h,y[h]=f;var c=p[f],l=p[c],a=p[l],v=p[h]*257^h*16843008;O[f]=v<<24|v>>>8,C[f]=v<<16|v>>>16,T[f]=v<<8|v>>>24,g[f]=v,v=a*16843009^l*65537^c*257^f*16843008,o[h]=v<<24|v>>>8,u[h]=v<<16|v>>>16,s[h]=v<<8|v>>>24,w[h]=v,f?(f=c^p[p[p[a^c]]],_^=p[p[_]]):f=_=1}},U.expandKey=function(L){for(var y=this.uint8ArrayToUint32Array_(L),x=!0,O=0;O<y.length&&x;)x=y[O]===this.key[O],O++;if(x)return;this.key=y;var C=this.keySize=y.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var T=this.ksRows=(C+6+1)*4,g,d,o=this.keySchedule=new Uint32Array(T),u=this.invKeySchedule=new Uint32Array(T),s=this.sBox,w=this.rcon,p=this.invSubMix,f=p[0],_=p[1],b=p[2],h=p[3],c,l;for(g=0;g<T;g++){if(g<C){c=o[g]=y[g];continue}l=c,g%C===0?(l=l<<8|l>>>24,l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255],l^=w[g/C|0]<<24):C>6&&g%C===4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255]),o[g]=c=(o[g-C]^l)>>>0}for(d=0;d<T;d++)g=T-d,d&3?l=o[g]:l=o[g-4],d<4||g<=4?u[d]=l:u[d]=f[s[l>>>24]]^_[s[l>>>16&255]]^b[s[l>>>8&255]]^h[s[l&255]],u[d]=u[d]>>>0},U.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},U.decrypt=function(L,y,x){for(var O=this.keySize+6,C=this.invKeySchedule,T=this.invSBox,g=this.invSubMix,d=g[0],o=g[1],u=g[2],s=g[3],w=this.uint8ArrayToUint32Array_(x),p=w[0],f=w[1],_=w[2],b=w[3],h=new Int32Array(L),c=new Int32Array(h.length),l,a,v,m,E,M,F,j,W,D,P,H,Y,ee,oe=this.networkToHostOrderSwap;y<h.length;){for(W=oe(h[y]),D=oe(h[y+1]),P=oe(h[y+2]),H=oe(h[y+3]),E=W^C[0],M=H^C[1],F=P^C[2],j=D^C[3],Y=4,ee=1;ee<O;ee++)l=d[E>>>24]^o[M>>16&255]^u[F>>8&255]^s[j&255]^C[Y],a=d[M>>>24]^o[F>>16&255]^u[j>>8&255]^s[E&255]^C[Y+1],v=d[F>>>24]^o[j>>16&255]^u[E>>8&255]^s[M&255]^C[Y+2],m=d[j>>>24]^o[E>>16&255]^u[M>>8&255]^s[F&255]^C[Y+3],E=l,M=a,F=v,j=m,Y=Y+4;l=T[E>>>24]<<24^T[M>>16&255]<<16^T[F>>8&255]<<8^T[j&255]^C[Y],a=T[M>>>24]<<24^T[F>>16&255]<<16^T[j>>8&255]<<8^T[E&255]^C[Y+1],v=T[F>>>24]<<24^T[j>>16&255]<<16^T[E>>8&255]<<8^T[M&255]^C[Y+2],m=T[j>>>24]<<24^T[E>>16&255]<<16^T[M>>8&255]<<8^T[F&255]^C[Y+3],c[y]=oe(l^p),c[y+1]=oe(m^f),c[y+2]=oe(v^_),c[y+3]=oe(a^b),p=W,f=D,_=P,b=H,y=y+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return y});var G=A("./src/crypt/aes-crypto.ts"),I=A("./src/crypt/fast-aes-key.ts"),R=A("./src/crypt/aes-decryptor.ts"),B=A("./src/utils/logger.ts"),U=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),L=16,y=function(){function x(C,T,g){var d=g===void 0?{}:g,o=d.removePKCS7Padding,u=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=T,this.removePKCS7Padding=u,u)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=x.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var T=this.currentResult;if(!T){this.reset();return}var g=new Uint8Array(T);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(g):g},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(T,g,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(T),g,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(T),g,d).then(o)},O.softwareDecrypt=function(T,g,d){var o=this.currentIV,u=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(T=Object(U.appendUint8Array)(s,T),this.remainderData=null);var w=this.getValidChunk(T);if(!w.length)return null;o&&(d=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new R.default),p.expandKey(g);var f=u;return this.currentResult=p.decrypt(w.buffer,0,d),this.currentIV=Object(k.sliceUint8)(w,-16).buffer,f||null},O.webCryptoDecrypt=function(T,g,d){var o=this,u=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new I.default(u,g)),this.fastAesKey.expandKey().then(function(s){if(!u)return Promise.reject(new Error("web crypto not initialized"));var w=new G.default(u,d);return w.decrypt(T.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,T,g,d)})},O.onWebCryptoError=function(T,g,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",T),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,d,o)},O.getValidChunk=function(T){var g=T,d=T.length-T.length%L;return d!==T.length&&(g=Object(k.sliceUint8)(T,0,d),this.remainderData=Object(k.sliceUint8)(T,d)),g},O.logOnce=function(T){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+T),this.logEnabled=!1},x}()},"./src/crypt/fast-aes-key.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/adts.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/id3.ts");function U(y,x){y.prototype=Object.create(x.prototype),y.prototype.constructor=y,k(y,x)}function k(y,x){return k=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},k(y,x)}var L=function(y){U(x,y);function x(C,T){var g;return g=y.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=C,g.config=T,g}var O=x.prototype;return O.resetInitSegment=function(T,g,d){y.prototype.resetInitSegment.call(this,T,g,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:T,duration:d,inputTimeScale:9e4,dropped:0}},x.probe=function(T){if(!T)return!1;for(var g=B.getID3Data(T,0)||[],d=g.length,o=T.length;d<o;d++)if(I.probe(T,d))return R.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(T,g){return I.canParse(T,g)},O.appendFrame=function(T,g,d){I.initTrackConfig(T,this.observer,g,d,T.manifestCodec);var o=I.appendFrame(T,g,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},x}(G.default);L.minProbeByteLength=9,V.default=L},"./src/demux/adts.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"getAudioConfig",function(){return B}),A.d(V,"isHeaderPattern",function(){return U}),A.d(V,"getHeaderLength",function(){return k}),A.d(V,"getFullFrameLength",function(){return L}),A.d(V,"canGetFrameLength",function(){return y}),A.d(V,"isHeader",function(){return x}),A.d(V,"canParse",function(){return O}),A.d(V,"probe",function(){return C}),A.d(V,"initTrackConfig",function(){return T}),A.d(V,"getFrameDuration",function(){return g}),A.d(V,"parseFrameHeader",function(){return d}),A.d(V,"appendFrame",function(){return o});var G=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts");function B(u,s,w,p){var f,_,b,h,c=navigator.userAgent.toLowerCase(),l=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[w+2]&192)>>>6)+1;var v=(s[w+2]&60)>>>2;if(v>a.length-1){u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return b=(s[w+2]&1)<<2,b|=(s[w+3]&192)>>>6,G.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(f=5,h=new Array(4),_=v-3):(f=2,h=new Array(2),_=v):c.indexOf("android")!==-1?(f=2,h=new Array(2),_=v):(f=5,h=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&v>=6?_=v-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(v>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(f=2,h=new Array(2)),_=v)),h[0]=f<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=b<<3,f===5&&(h[1]|=(_&14)>>1,h[2]=(_&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:b,codec:"mp4a.40."+f,manifestCodec:l}}function U(u,s){return u[s]===255&&(u[s+1]&246)===240}function k(u,s){return u[s+1]&1?7:9}function L(u,s){return(u[s+3]&3)<<11|u[s+4]<<3|(u[s+5]&224)>>>5}function y(u,s){return s+5<u.length}function x(u,s){return s+1<u.length&&U(u,s)}function O(u,s){return y(u,s)&&U(u,s)&&L(u,s)<=u.length-s}function C(u,s){if(x(u,s)){var w=k(u,s);if(s+w>=u.length)return!1;var p=L(u,s);if(p<=w)return!1;var f=s+p;return f===u.length||x(u,f)}return!1}function T(u,s,w,p,f){if(!u.samplerate){var _=B(s,w,p,f);if(!_)return;u.config=_.config,u.samplerate=_.samplerate,u.channelCount=_.channelCount,u.codec=_.codec,u.manifestCodec=_.manifestCodec,G.logger.log("parsed codec:"+u.codec+", rate:"+_.samplerate+", channels:"+_.channelCount)}}function g(u){return 1024*9e4/u}function d(u,s,w,p,f){var _=k(u,s),b=L(u,s);if(b-=_,b>0){var h=w+p*f;return{headerLength:_,frameLength:b,stamp:h}}}function o(u,s,w,p,f){var _=g(u.samplerate),b=d(s,w,p,f,_);if(b){var h=b.frameLength,c=b.headerLength,l=b.stamp,a=c+h,v=Math.max(0,w+a-s.length),m;v?(m=new Uint8Array(a-c),m.set(s.subarray(w+c,s.length),0)):m=s.subarray(w+c,w+a);var E={unit:m,pts:l};return v||u.samples.push(E),{sample:E,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"initPTSFn",function(){return L});var G=A("./src/polyfills/number.ts"),I=A("./src/demux/id3.ts"),R=A("./src/demux/dummy-demuxed-track.ts"),B=A("./src/utils/mp4-tools.ts"),U=A("./src/utils/typed-array.ts"),k=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var x=y.prototype;return x.resetInitSegment=function(C,T,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},x.resetTimeStamp=function(){},x.resetContiguity=function(){},x.canParse=function(C,T){return!1},x.appendFrame=function(C,T,g){},x.demux=function(C,T){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var g=I.getID3Data(C,0),d=g?g.length:0,o,u,s=this._audioTrack,w=this._id3Track,p=g?I.getTimeStamp(g):void 0,f=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(p,T)),g&&g.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),u=this.initPTS;d<f;){if(this.canParse(C,d)){var _=this.appendFrame(s,C,d);_?(this.frameIndex++,u=_.sample.pts,d+=_.length,o=d):d=f}else I.canParse(C,d)?(g=I.getID3Data(C,d),w.samples.push({pts:u,dts:u,data:g}),d+=g.length,o=d):d++;if(d===f&&o!==f){var b=Object(U.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:s,avcTrack:Object(R.dummyTrack)(),id3Track:w,textTrack:Object(R.dummyTrack)()}},x.demuxSampleAes=function(C,T,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},x.flush=function(C){var T=this.cachedData;return T&&(this.cachedData=null,this.demux(T,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},x.destroy=function(){},y}(),L=function(x,O){return Object(G.isFiniteNumber)(x)?x*90:O*9e4};V.default=k},"./src/demux/chunk-cache.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(k){this.chunks.push(k),this.dataLength+=k.length},B.flush=function(){var k=this.chunks,L=this.dataLength,y;if(k.length)k.length===1?y=k[0]:y=I(k,L);else return new Uint8Array(0);return this.reset(),y},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,B){for(var U=new Uint8Array(B),k=0,L=0;L<R.length;L++){var y=R[L];U.set(y,k),k+=y.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),I=function(){function R(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var k=this.data,L=this.bytesAvailable,y=k.byteLength-L,x=new Uint8Array(4),O=Math.min(4,L);if(O===0)throw new Error("no bytes available");x.set(k.subarray(y,y+O)),this.word=new DataView(x.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},B.skipBits=function(k){var L;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,L=k>>3,k-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},B.readBits=function(k){var L=Math.min(this.bitsAvailable,k),y=this.word>>>32-L;return k>32&&G.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=k-L,L>0&&this.bitsAvailable?y<<L|this.readBits(L):y},B.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},B.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(k){for(var L=8,y=8,x,O=0;O<k;O++)y!==0&&(x=this.readEG(),y=(L+x+256)%256),L=y===0?L:y},B.readSPS=function(){var k=0,L=0,y=0,x=0,O,C,T,g=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),s=this.skipBits.bind(this),w=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);g();var _=g();if(d(5),s(3),g(),p(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){var b=o();if(b===3&&s(1),p(),p(),s(1),u())for(C=b!==3?8:12,T=0;T<C;T++)u()&&(T<6?f(16):f(64))}p();var h=o();if(h===0)o();else if(h===1)for(s(1),w(),w(),O=o(),T=0;T<O;T++)w();p(),s(1);var c=o(),l=o(),a=d(1);a===0&&s(1),s(1),u()&&(k=o(),L=o(),y=o(),x=o());var v=[1,1];if(u()&&u()){var m=g();switch(m){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((c+1)*16-k*2-L*2),height:(2-a)*(l+1)*16-(a?2:4)*(y+x),pixelRatio:v}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=I},"./src/demux/id3.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isHeader",function(){return G}),A.d(V,"isFooter",function(){return I}),A.d(V,"getID3Data",function(){return R}),A.d(V,"canParse",function(){return U}),A.d(V,"getTimeStamp",function(){return k}),A.d(V,"isTimeStampFrame",function(){return L}),A.d(V,"getID3Frames",function(){return x}),A.d(V,"decodeFrame",function(){return O}),A.d(V,"utf8ArrayToStr",function(){return o}),A.d(V,"testables",function(){return u});var G=function(f,_){return _+10<=f.length&&(f[_]===73&&f[_+1]===68&&f[_+2]===51&&(f[_+3]<255&&f[_+4]<255&&(f[_+6]<128&&f[_+7]<128&&f[_+8]<128&&f[_+9]<128)))},I=function(f,_){return _+10<=f.length&&(f[_]===51&&f[_+1]===68&&f[_+2]===73&&(f[_+3]<255&&f[_+4]<255&&(f[_+6]<128&&f[_+7]<128&&f[_+8]<128&&f[_+9]<128)))},R=function(f,_){for(var b=_,h=0;G(f,_);){h+=10;var c=B(f,_+6);h+=c,I(f,_+10)&&(h+=10),_+=h}return h>0?f.subarray(b,b+h):void 0},B=function(f,_){var b=0;return b=(f[_]&127)<<21,b|=(f[_+1]&127)<<14,b|=(f[_+2]&127)<<7,b|=f[_+3]&127,b},U=function(f,_){return G(f,_)&&B(f,_+6)+10<=f.length-_},k=function(f){for(var _=x(f),b=0;b<_.length;b++){var h=_[b];if(L(h))return d(h)}return},L=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},y=function(f){var _=String.fromCharCode(f[0],f[1],f[2],f[3]),b=B(f,4),h=10;return{type:_,size:b,data:f.subarray(h,h+b)}},x=function(f){for(var _=0,b=[];G(f,_);){var h=B(f,_+6);_+=10;for(var c=_+h;_+8<c;){var l=y(f.subarray(_)),a=O(l);a&&b.push(a),_+=l.size+10}I(f,_)&&(_+=10)}return b},O=function(f){return f.type==="PRIV"?C(f):f.type[0]==="W"?g(f):T(f)},C=function(f){if(f.size<2)return;var _=o(f.data,!0),b=new Uint8Array(f.data.subarray(_.length+1));return{key:f.type,info:_,data:b.buffer}},T=function(f){if(f.size<2)return;if(f.type==="TXXX"){var _=1,b=o(f.data.subarray(_),!0);_+=b.length+1;var h=o(f.data.subarray(_));return{key:f.type,info:b,data:h}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},g=function(f){if(f.type==="WXXX"){if(f.size<2)return;var _=1,b=o(f.data.subarray(_),!0);_+=b.length+1;var h=o(f.data.subarray(_));return{key:f.type,info:b,data:h}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var _=new Uint8Array(f.data),b=_[3]&1,h=(_[4]<<23)+(_[5]<<15)+(_[6]<<7)+_[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},o=function(f,_){_===void 0&&(_=!1);var b=w();if(b){var h=b.decode(f);if(_){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=f.length,a,v,m,E="",M=0;M<l;){if(a=f[M++],a===0&&_)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:v=f[M++],E+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=f[M++],m=f[M++],E+=String.fromCharCode((a&15)<<12|(v&63)<<6|(m&63)<<0);break;default:}}return E},u={decodeTextFrame:T},s;function w(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/id3.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/mpegaudio.ts");function U(y,x){y.prototype=Object.create(x.prototype),y.prototype.constructor=y,k(y,x)}function k(y,x){return k=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},k(y,x)}var L=function(y){U(x,y);function x(){return y.apply(this,arguments)||this}var O=x.prototype;return O.resetInitSegment=function(T,g,d){y.prototype.resetInitSegment.call(this,T,g,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:T,duration:d,inputTimeScale:9e4,dropped:0}},x.probe=function(T){if(!T)return!1;for(var g=I.getID3Data(T,0)||[],d=g.length,o=T.length;d<o;d++)if(B.probe(T,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(T,g){return B.canParse(T,g)},O.appendFrame=function(T,g,d){return this.initPTS===null?void 0:B.appendFrame(T,g,d,this.initPTS,this.frameIndex)},x}(G.default);L.minProbeByteLength=4,V.default=L},"./src/demux/mp4demuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/mp4-tools.ts"),I=A("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(k,L){this.remainderData=null,this.config=void 0,this.config=L}var U=B.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},B.probe=function(L){return Object(G.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},U.demux=function(L){var y=L,x=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(G.appendUint8Array)(this.remainderData,L));var O=Object(G.segmentValidRange)(y);this.remainderData=O.remainder,x.samples=O.valid||new Uint8Array}else x.samples=y;return{audioTrack:Object(I.dummyTrack)(),avcTrack:x,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.flush=function(){var L=Object(I.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:L,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.demuxSampleAes=function(L,y,x){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"appendFrame",function(){return k}),A.d(V,"parseHeader",function(){return L}),A.d(V,"isHeaderPattern",function(){return y}),A.d(V,"isHeader",function(){return x}),A.d(V,"canParse",function(){return O}),A.d(V,"probe",function(){return C});var G=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function k(T,g,d,o,u){if(d+24>g.length)return;var s=L(g,d);if(s&&d+s.frameLength<=g.length){var w=s.samplesPerFrame*9e4/s.sampleRate,p=o+u*w,f={unit:g.subarray(d,d+s.frameLength),pts:p,dts:p};return T.config=[],T.channelCount=s.channelCount,T.samplerate=s.sampleRate,T.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function L(T,g){var d=T[g+1]>>3&3,o=T[g+1]>>1&3,u=T[g+2]>>4&15,s=T[g+2]>>2&3;if(d!==1&&u!==0&&u!==15&&s!==3){var w=T[g+2]>>1&1,p=T[g+3]>>6,f=d===3?3-o:o===3?3:4,_=I[f*14+u-1]*1e3,b=d===3?0:d===2?1:2,h=R[b*3+s],c=p===3?1:2,l=B[d][o],a=U[o],v=l*8*a,m=Math.floor(l*_/h+w)*a;if(G===null){var E=navigator.userAgent||"",M=E.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var F=!!G&&G<=87;return F&&o===2&&_>=224e3&&p===0&&(T[g+3]=T[g+3]|128),{sampleRate:h,channelCount:c,frameLength:m,samplesPerFrame:v}}}function y(T,g){return T[g]===255&&(T[g+1]&224)===224&&(T[g+1]&6)!==0}function x(T,g){return g+1<T.length&&y(T,g)}function O(T,g){var d=4;return y(T,g)&&d<=T.length-g}function C(T,g){if(g+1<T.length&&y(T,g)){var d=4,o=L(T,g),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var s=g+u;return s===T.length||x(T,s)}return!1}},"./src/demux/sample-aes.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/crypt/decrypter.ts"),I=A("./src/demux/tsdemuxer.ts"),R=function(){function B(k,L,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new G.default(k,L,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(L,y){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,y)},U.decryptAacSample=function(L,y,x,O){var C=L[y].unit,T=C.subarray(16,C.length-C.length%16),g=T.buffer.slice(T.byteOffset,T.byteOffset+T.length),d=this;this.decryptBuffer(g,function(o){var u=new Uint8Array(o);C.set(u,16),O||d.decryptAacSamples(L,y+1,x)})},U.decryptAacSamples=function(L,y,x){for(;;y++){if(y>=L.length){x();return}if(L[y].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(L,y,x,O),!O)return}},U.getAvcEncryptedData=function(L){for(var y=Math.floor((L.length-48)/160)*16+16,x=new Int8Array(y),O=0,C=32;C<=L.length-16;C+=160,O+=16)x.set(L.subarray(C,C+16),O);return x},U.getAvcDecryptedUnit=function(L,y){for(var x=new Uint8Array(y),O=0,C=32;C<=L.length-16;C+=160,O+=16)L.set(x.subarray(O,O+16),C);return L},U.decryptAvcSample=function(L,y,x,O,C,T){var g=Object(I.discardEPB)(C.data),d=this.getAvcEncryptedData(g),o=this;this.decryptBuffer(d.buffer,function(u){C.data=o.getAvcDecryptedUnit(g,u),T||o.decryptAvcSamples(L,y,x+1,O)})},U.decryptAvcSamples=function(L,y,x,O){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,x=0){if(y>=L.length){O();return}for(var C=L[y].units;!(x>=C.length);x++){var T=C[x];if(T.data.length<=48||T.type!==1&&T.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(L,y,x,O,T,g),!g)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./node_modules/webworkify-webpack/index.js"),I=A.n(G),R=A("./src/events.ts"),B=A("./src/demux/transmuxer.ts"),U=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),L=A("./src/utils/mediasource-helper.ts"),y=A("./node_modules/eventemitter3/index.js"),x=A.n(y),O=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function T(d,o,u,s){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=u,this.onFlush=s;var p=d.config,f=function(l,a){a=a||{},a.frag=w.frag,a.id=w.id,d.trigger(l,a)};this.observer=new y.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,f),this.observer.on(R.Events.ERROR,f);var _={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:_,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){U.logger.warn("Error in worker:",c),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,_,p,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,_,p,b,o)}var g=T.prototype;return g.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},g.push=function(o,u,s,w,p,f,_,b,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,m=f?f.start:p.start,E=p.decryptdata,M=this.frag,F=!(M&&p.cc===M.cc),j=!(M&&h.level===M.level),W=M?h.sn-M.sn:-1,D=this.part?h.part-this.part.index:1,P=!j&&(W===1||W===0&&D===1),H=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=H),f&&(D||!P)&&(f.stats.parsing.start=H);var Y=new B.TransmuxState(F,P,b,j,m);if(!P||F){U.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
discontinuity: `+F+`
trackSwitch: `+j+`
contiguous: `+P+`
accurateTimeOffset: `+b+`
timeOffset: `+m);var ee=new B.TransmuxConfig(s,w,u,_,c);this.configureTransmuxer(ee)}if(this.frag=p,this.part=f,v)v.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var oe=a.push(o,E,h,Y);Object(B.isPromise)(oe)?oe.then(function(Te){l.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(oe)}},g.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(s){var p=s.flush(o);Object(B.isPromise)(p)?p.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},g.handleFlushResult=function(o,u){var s=this;o.forEach(function(w){s.handleTransmuxComplete(w)}),this.onFlush(u)},g.onWorkerMessage=function(o){var u=o.data,s=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,s.trigger(u.event,u.data);break}}},g.configureTransmuxer=function(o){var u=this.worker,s=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},g.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},T}()},"./src/demux/transmuxer-worker.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/demux/transmuxer.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./node_modules/eventemitter3/index.js"),U=A.n(B);function k(C){var T=new B.EventEmitter,g=function(o,u){C.postMessage({event:o,data:u})};T.on(I.Events.FRAG_DECRYPTED,g),T.on(I.Events.ERROR,g),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);C.transmuxer=new G.default(T,o.typeSupported,u,o.vendor,o.id),Object(R.enableLogs)(u.debug),g("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var s=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(s)?s.then(function(f){L(C,f)}):L(C,s);break}case"flush":{var w=o.chunkMeta,p=C.transmuxer.flush(w);Object(G.isPromise)(p)?p.then(function(f){x(C,f,w)}):x(C,p,w);break}default:break}})}function L(C,T){if(O(T.remuxResult))return;var g=[],d=T.remuxResult,o=d.audio,u=d.video;o&&y(g,o),u&&y(g,u),C.postMessage({event:"transmuxComplete",data:T},g)}function y(C,T){T.data1&&C.push(T.data1.buffer),T.data2&&C.push(T.data2.buffer)}function x(C,T,g){T.forEach(function(d){L(C,d)}),C.postMessage({event:"flush",data:g})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u}),A.d(V,"isPromise",function(){return p}),A.d(V,"TransmuxConfig",function(){return f}),A.d(V,"TransmuxState",function(){return _});var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/crypt/decrypter.ts"),B=A("./src/demux/aacdemuxer.ts"),U=A("./src/demux/mp4demuxer.ts"),k=A("./src/demux/tsdemuxer.ts"),L=A("./src/demux/mp3demuxer.ts"),y=A("./src/remux/mp4-remuxer.ts"),x=A("./src/remux/passthrough-remuxer.ts"),O=A("./src/demux/chunk-cache.ts"),C=A("./src/utils/mp4-tools.ts"),T=A("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(b){T.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var d=[{demux:k.default,remux:y.default},{demux:U.default,remux:x.default},{demux:B.default,remux:y.default},{demux:L.default,remux:y.default}],o=1024;d.forEach(function(b){var h=b.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function b(c,l,a,v,m){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 O.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=v,this.id=m}var h=b.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,v,m){var E=this,M=v.transmuxing;M.executeStart=g();var F=new Uint8Array(l),j=this.cache,W=this.config,D=this.currentTransmuxState,P=this.transmuxConfig;m&&(this.currentTransmuxState=m);var H=s(F,a);if(H&&H.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var ee=Y.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!ee)return M.executeEnd=g(),w(v);F=new Uint8Array(ee)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(we){var De=E.push(we,null,v);return E.decryptionPromise=null,De}),this.decryptionPromise}var oe=m||D,Te=oe.contiguous,ve=oe.discontinuity,ge=oe.trackSwitch,he=oe.accurateTimeOffset,fe=oe.timeOffset,ae=P.audioCodec,me=P.videoCodec,J=P.defaultInitPts,ne=P.duration,Q=P.initSegmentData;if((ve||ge)&&this.resetInitSegment(Q,ae,me,ne),ve&&this.resetInitialTimestamp(J),Te||this.resetContiguity(),this.needsProbing(F,ve,ge)){if(j.dataLength){var Ee=j.flush();F=Object(C.appendUint8Array)(Ee,F)}this.configureTransmuxer(F,P)}var Ce=this.transmux(F,H,fe,he,v),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,M.executeEnd=g(),Ce},h.flush=function(l){var a=this,v=l.transmuxing;v.executeStart=g();var m=this.decrypter,E=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(m){var D=m.flush();D&&j.push(this.push(D,null,l))}var P=E.dataLength;E.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return P>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=g(),[w(l)];var ee=H.flush(W);return p(ee)?ee.then(function(oe){return a.flushRemux(j,oe,l),j}):(this.flushRemux(j,ee,l),j)},h.flushRemux=function(l,a,v){var m=a.audioTrack,E=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,D=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var P=this.remuxer.remux(m,E,M,F,D,W,!0,this.id);l.push({remuxResult:P,chunkMeta:v}),v.transmuxing.executeEnd=g()},h.resetInitialTimestamp=function(l){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(l),v.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,v,m){var E=this.demuxer,M=this.remuxer;if(!E||!M)return;E.resetInitSegment(a,v,m),M.resetInitSegment(l,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,v,m,E){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,v,m,E):M=this.transmuxUnencrypted(l,v,m,E),M},h.transmuxUnencrypted=function(l,a,v,m){var E=this.demuxer.demux(l,a,!1,!this.config.progressive),M=E.audioTrack,F=E.avcTrack,j=E.id3Track,W=E.textTrack,D=this.remuxer.remux(M,F,j,W,a,v,!1,this.id);return{remuxResult:D,chunkMeta:m}},h.transmuxSampleAes=function(l,a,v,m,E){var M=this;return this.demuxer.demuxSampleAes(l,a,v).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,m,!1,M.id);return{remuxResult:j,chunkMeta:E}})},h.configureTransmuxer=function(l,a){for(var v=this.config,m=this.observer,E=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,D=a.initSegmentData,P=a.videoCodec,H,Y=0,ee=d.length;Y<ee;Y++)if(d[Y].demux.probe(l)){H=d[Y];break}H||(T.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:U.default,remux:x.default});var oe=this.demuxer,Te=this.remuxer,ve=H.remux,ge=H.demux;(!Te||!(Te instanceof ve))&&(this.remuxer=new ve(m,v,E,M)),(!oe||!(oe instanceof ge))&&(this.demuxer=new ge(m,v,E),this.probe=ge.probe),this.resetInitSegment(D,F,P,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,v){return!this.demuxer||!this.remuxer||a||v},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new R.default(this.observer,this.config)),l},b}();function s(b,h){var c=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var w=function(h){return{remuxResult:{},chunkMeta:h}};function p(b){return"then"in b&&b.then instanceof Function}var f=function(h,c,l,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=v},_=function(h,c,l,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"discardEPB",function(){return w});var G=A("./src/demux/adts.ts"),I=A("./src/demux/mpegaudio.ts"),R=A("./src/demux/exp-golomb.ts"),B=A("./src/demux/id3.ts"),U=A("./src/demux/sample-aes.ts"),k=A("./src/events.ts"),L=A("./src/utils/mp4-tools.ts"),y=A("./src/utils/logger.ts"),x=A("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function p(_,b,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=_,this.config=b,this.typeSupported=h}p.probe=function(b){var h=p.syncOffset(b);return h<0?!1:(h&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),c=0;c<h;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:O[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var f=p.prototype;return f.resetInitSegment=function(b,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=h,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(b,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,m=this._audioTrack,E=this._id3Track,M=v.pid,F=v.pesData,j=m.pid,W=E.pid,D=m.pesData,P=E.pesData,H=!1,Y=this.pmtParsed,ee=this._pmtId,oe=b.length;if(this.remainderData&&(b=Object(L.appendUint8Array)(this.remainderData,b),oe=b.length,this.remainderData=null),oe<188&&!l)return this.remainderData=b,{audioTrack:m,avcTrack:v,id3Track:E,textTrack:this._txtTrack};var Te=Math.max(0,p.syncOffset(b));oe-=(oe+Te)%188,oe<b.byteLength&&!l&&(this.remainderData=new Uint8Array(b.buffer,oe,b.buffer.byteLength-oe));for(var ve=Te;ve<oe;ve+=188)if(b[ve]===71){var ge=!!(b[ve+1]&64),he=((b[ve+1]&31)<<8)+b[ve+2],fe=(b[ve+3]&48)>>4,ae=void 0;if(fe>1){if(ae=ve+5+b[ve+4],ae===ve+188)continue}else ae=ve+4;switch(he){case M:ge&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(b.subarray(ae,ve+188)),F.size+=ve+188-ae);break;case j:ge&&(D&&(a=o(D))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),D={data:[],size:0}),D&&(D.data.push(b.subarray(ae,ve+188)),D.size+=ve+188-ae);break;case W:ge&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(b.subarray(ae,ve+188)),P.size+=ve+188-ae);break;case 0:ge&&(ae+=b[ae]+1),ee=this._pmtId=g(b,ae);break;case ee:{ge&&(ae+=b[ae]+1);var me=d(b,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=me.avc,M>0&&(v.pid=M),j=me.audio,j>0&&(m.pid=j,m.isAAC=me.isAAC),W=me.id3,W>0&&(E.pid=W),H&&!Y&&(y.logger.log("reparse from beginning"),H=!1,ve=Te-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,m.pesData=D,E.pesData=P;var J={audioTrack:m,avcTrack:v,id3Track:E,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},f.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},f.extractRemainingSamples=function(b){var h=b.audioTrack,c=b.avcTrack,l=b.id3Track,a=c.pesData,v=h.pesData,m=l.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,v&&(E=o(v))?(h.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),h.pesData=null):(v!=null&&v.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),m&&(E=o(m))?(this.parseID3PES(E),l.pesData=null):l.pesData=m},f.demuxSampleAes=function(b,h,c){var l=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,h);return this.decrypt(l,a)},f.decrypt=function(b,h){return new Promise(function(c){var l=b.audioTrack,a=b.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(b.data),v=!1,m=this.avcSample,E,M=!1;b.data=null,m&&a.length&&!l.audFound&&(u(m,l),m=this.avcSample=T(!1,b.pts,b.dts,"")),a.forEach(function(F){switch(F.type){case 1:{E=!0,m||(m=c.avcSample=T(!0,b.pts,b.dts,"")),v&&(m.debug+="NDR "),m.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=c.avcSample=T(!0,b.pts,b.dts,"")),v&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,v&&m&&(m.debug+="SEI ");var D=new R.default(w(F.data));D.readUByte();for(var P=0,H=0,Y=!1,ee=0;!Y&&D.bytesAvailable>1;){P=0;do ee=D.readUByte(),P+=ee;while(ee===255);H=0;do ee=D.readUByte(),H+=ee;while(ee===255);if(P===4&&D.bytesAvailable!==0){Y=!0;var oe=D.readUByte();if(oe===181){var Te=D.readUShort();if(Te===49){var ve=D.readUInt();if(ve===1195456820){var ge=D.readUByte();if(ge===3){for(var he=D.readUByte(),fe=D.readUByte(),ae=31&he,me=[he,fe],J=0;J<ae;J++)me.push(D.readUByte()),me.push(D.readUByte()),me.push(D.readUByte());s(c._txtTrack.samples,{type:3,pts:b.pts,bytes:me})}}}}}else if(P===5&&D.bytesAvailable!==0){if(Y=!0,H>16){for(var ne=[],Q=0;Q<16;Q++)ne.push(D.readUByte().toString(16)),(Q===3||Q===5||Q===7||Q===9)&&ne.push("-");for(var Ee=H-16,Ce=new Uint8Array(Ee),ye=0;ye<Ee;ye++)Ce[ye]=D.readUByte();s(c._txtTrack.samples,{pts:b.pts,payloadType:P,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(H<D.bytesAvailable)for(var we=0;we<H;we++)D.readUByte()}break}case 7:if(E=!0,M=!0,v&&m&&(m.debug+="SPS "),!l.sps){var De=new R.default(F.data),Pe=De.readSPS();l.width=Pe.width,l.height=Pe.height,l.pixelRatio=Pe.pixelRatio,l.sps=[F.data],l.duration=c._duration;for(var ke=F.data.subarray(1,4),Oe="avc1.",Re=0;Re<3;Re++){var Ge=ke[Re].toString(16);Ge.length<2&&(Ge="0"+Ge),Oe+=Ge}l.codec=Oe}break;case 8:E=!0,v&&m&&(m.debug+="PPS "),l.pps||(l.pps=[F.data]);break;case 9:E=!1,l.audFound=!0,m&&u(m,l),m=c.avcSample=T(!1,b.pts,b.dts,v?"AUD ":"");break;case 12:E=!1;break;default:E=!1,m&&(m.debug+="unknown NAL "+F.type+" ");break}if(m&&E){var $e=m.units;$e.push(F)}}),h&&m&&(u(m,l),this.avcSample=null)},f.getLastNalUnit=function(){var b,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var a=h.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(b){var h=b.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,v=[],m=0,E,M,F,j=-1,W=0;for(l===-1&&(j=0,W=b[0]&31,l=0,m=1);m<h;){if(E=b[m++],!l){l=E?0:1;continue}if(l===1){l=E?0:2;continue}if(!E)l=3;else if(E===1){if(j>=0){var D={data:b.subarray(j,m-l-1),type:W};v.push(D)}else{var P=this.getLastNalUnit();if(P&&(a&&m<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),M=m-l-1,M>0)){var H=new Uint8Array(P.data.byteLength+M);H.set(P.data,0),H.set(b.subarray(0,M),P.data.byteLength),P.data=H,P.state=0}}m<h?(F=b[m]&31,j=m,W=F,l=0):l=-1}else l=0}if(j>=0&&l>=0){var Y={data:b.subarray(j,h),type:W,state:l};v.push(Y)}if(v.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+b.byteLength);oe.set(ee.data,0),oe.set(b,ee.data.byteLength),ee.data=oe}}return c.naluState=l,v},f.parseAACPES=function(b){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=b.data;if(l){this.aacOverFlow=null;var v=l.sample.unit.byteLength,m=Math.min(l.missing,v),E=v-m;l.sample.unit.set(a.subarray(0,m),E),c.samples.push(l.sample),h=l.missing}var M,F;for(M=h,F=a.length;M<F-1&&!G.isHeader(a,M);M++);if(M!==h){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),y.logger.warn("parsing error:"+j),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,M,this.audioCodec);var D;if(b.pts!==void 0)D=b.pts;else if(l){var P=G.getFrameDuration(c.samplerate);D=l.sample.pts+P}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<F;)if(G.isHeader(a,M)){if(M+5<F){var Y=G.appendFrame(c,a,M,D,H);if(Y)if(Y.missing)this.aacOverFlow=Y;else{M+=Y.length,H++;continue}}break}else M++},f.parseMPEGPES=function(b){var h=b.data,c=h.length,l=0,a=0,v=b.pts;if(v===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var m=I.appendFrame(this._audioTrack,h,a,v,l);if(m)a+=m.length,l++;else break}else a++},f.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();C.minProbeByteLength=188;function T(p,f,_,b){return{key:p,frame:!1,pts:f,dts:_,units:[],debug:b,length:0}}function g(p,f){return(p[f+10]&31)<<8|p[f+11]}function d(p,f,_,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[f+1]&15)<<8|p[f+2],l=f+3+c-4,a=(p[f+10]&15)<<8|p[f+11];for(f+=12+a;f<l;){var v=(p[f+1]&31)<<8|p[f+2];switch(p[f]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=v);break;case 21:h.id3===-1&&(h.id3=v);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:_?h.audio===-1&&(h.audio=v,h.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((p[f+3]&15)<<8|p[f+4])+5}return h}function o(p){var f=0,_,b,h,c,l,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}_=a[0];var m=(_[0]<<16)+(_[1]<<8)+_[2];if(m===1){if(b=(_[4]<<8)+_[5],b&&b>p.size-6)return null;var E=_[7];E&192&&(c=(_[9]&14)*536870912+(_[10]&255)*4194304+(_[11]&254)*16384+(_[12]&255)*128+(_[13]&254)/2,E&64?(l=(_[14]&14)*536870912+(_[15]&255)*4194304+(_[16]&254)*16384+(_[17]&255)*128+(_[18]&254)/2,c-l>60*9e4&&(y.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=_[8];var M=h+9;if(p.size<=M)return null;p.size-=M;for(var F=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){_=a[j];var D=_.byteLength;if(M)if(M>D){M-=D;continue}else _=_.subarray(M),D-=M,M=0;F.set(_,f),f+=D}return b&&(b-=h+3),{data:F,pts:c,dts:l,len:b}}return null}function u(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var _=f.samples,b=_.length;if(b){var h=_[b-1];p.pts=h.pts,p.dts=h.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&y.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function s(p,f){var _=p.length;if(_>0){if(f.pts>=p[_-1].pts)p.push(f);else for(var b=_-1;b>=0;b--)if(f.pts<p[b].pts){p.splice(b,0,f);break}}else p.push(f)}function w(p){for(var f=p.byteLength,_=[],b=1;b<f-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(_.push(b+2),b+=2):b++;if(_.length===0)return p;var h=f-_.length,c=new Uint8Array(h),l=0;for(b=0;b<h;l++,b++)l===_[0]&&(l++,_.shift()),c[b]=p[l];return c}V.default=C},"./src/errors.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"ErrorTypes",function(){return G}),A.d(V,"ErrorDetails",function(){return I});var G;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(G||(G={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"Events",function(){return G});var G;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(G||(G={}))},"./src/hls.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return p});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(G),R=A("./src/loader/playlist-loader.ts"),B=A("./src/loader/key-loader.ts"),U=A("./src/controller/id3-track-controller.ts"),k=A("./src/controller/latency-controller.ts"),L=A("./src/controller/level-controller.ts"),y=A("./src/controller/fragment-tracker.ts"),x=A("./src/controller/stream-controller.ts"),O=A("./src/is-supported.ts"),C=A("./src/utils/logger.ts"),T=A("./src/config.ts"),g=A("./node_modules/eventemitter3/index.js"),d=A.n(g),o=A("./src/events.ts"),u=A("./src/errors.ts");function s(f,_){for(var b=0;b<_.length;b++){var h=_[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function w(f,_,b){return _&&s(f.prototype,_),b&&s(f,b),f}var p=function(){f.isSupported=function(){return Object(O.isSupported)()};function f(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(T.mergeConfig)(f.DefaultConfig,b);this.userConfig=b,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(T.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,v=h.fpsController,m=this.abrController=new c(this),E=this.bufferController=new l(this),M=this.capLevelController=new a(this),F=new v(this),j=new R.default(this),W=new B.default(this),D=new U.default(this),P=this.levelController=new L.default(this),H=new y.FragmentTracker(this),Y=this.streamController=new x.default(this,H);M.setStreamController(Y),F.setStreamController(Y);var ee=[P,Y];this.networkControllers=ee;var oe=[j,W,m,E,M,F,D,H];this.audioTrackController=this.createController(h.audioTrackController,null,ee),this.createController(h.audioStreamController,H,ee),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ee),this.createController(h.subtitleStreamController,H,ee),this.createController(h.timelineController,null,oe),this.emeController=this.createController(h.emeController,null,oe),this.cmcdController=this.createController(h.cmcdController,null,oe),this.latencyController=this.createController(k.default,null,oe),this.coreComponents=oe}var _=f.prototype;return _.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},_.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},_.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},_.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},_.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},_.listeners=function(h){return this._emitter.listeners(h)},_.emit=function(h,c,l){return this._emitter.emit(h,c,l)},_.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},_.listenerCount=function(h){return this._emitter.listenerCount(h)},_.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},_.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},_.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},_.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},_.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},_.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},_.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},_.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},_.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},w(f,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:T.hlsDefaultConfig},set:function(h){f.defaultConfig=h}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isSupported",function(){return R}),A.d(V,"changeTypeSupported",function(){return B});var G=A("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var U=Object(G.getMediaSource)();if(!U)return!1;var k=I(),L=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!L&&!!y}function B(){var U,k=I();return typeof(k==null||((U=k.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C}),A.d(V,"LoadError",function(){return g});var G=A("./src/polyfills/number.ts"),I=A("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!L(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,w)}function w(){return U(s,arguments,x(this).constructor)}return w.prototype=Object.create(s.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),y(w,s)},B(d)}function U(d,o,u){return k()?U=Reflect.construct:U=function(w,p,f){var _=[null];_.push.apply(_,p);var b=Function.bind.apply(w,_),h=new b;return f&&y(h,f.prototype),h},U.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function L(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(s,w){return s.__proto__=w,s},y(d,o)}function x(d){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},x(d)}var O=Math.pow(2,17),C=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(s,w){var p=this,f=s.url;if(!f)return Promise.reject(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var _=this.config,b=_.fLoader,h=_.loader;return new Promise(function(c,l){p.loader&&p.loader.destroy();var a=p.loader=s.loader=b?new b(_):new h(_),v=T(s),m={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=a.stats,a.load(v,m,{onSuccess:function(M,F,j,W){p.resetLoader(s,a),c({frag:s,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){p.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:M,networkDetails:j}))},onAbort:function(M,F,j){p.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:j}))},onTimeout:function(M,F,j){p.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:j}))},onProgress:function(M,F,j,W){w&&w({frag:s,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(s,w,p){var f=this;this.abort();var _=this.config,b=_.fLoader,h=_.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=s.loader=b?new b(_):new h(_),v=T(s,w),m={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(v,m,{onSuccess:function(M,F,j,W){f.resetLoader(s,a),f.updateStatsFromPart(s,w);var D={frag:s,part:w,payload:M.data,networkDetails:W};p(D),c(D)},onError:function(M,F,j){f.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:w,response:M,networkDetails:j}))},onAbort:function(M,F,j){s.stats.aborted=w.stats.aborted,f.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:w,networkDetails:j}))},onTimeout:function(M,F,j){f.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:w,networkDetails:j}))}})})},o.updateStatsFromPart=function(s,w){var p=s.stats,f=w.stats,_=f.total;if(p.loaded+=f.loaded,_){var b=Math.round(s.duration/w.duration),h=Math.min(Math.round(p.loaded/_),b),c=b-h,l=c*Math.round(p.loaded/h);p.total=p.loaded+l}else p.total=Math.max(p.loaded,p.total);var a=p.loading,v=f.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(s,w){s.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},d}();function T(d,o){o===void 0&&(o=null);var u=o||d,s={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},w=u.byteRangeStartOffset,p=u.byteRangeEndOffset;return Object(G.isFiniteNumber)(w)&&Object(G.isFiniteNumber)(p)&&(s.rangeStart=w,s.rangeEnd=p),s}var g=function(d){R(o,d);function o(u){for(var s,w=arguments.length,p=new Array(w>1?w-1:0),f=1;f<w;f++)p[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(p))||this,s.data=void 0,s.data=u,s}return o}(B(Error))},"./src/loader/fragment.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"ElementaryStreamTypes",function(){return C}),A.d(V,"BaseSegment",function(){return T}),A.d(V,"Fragment",function(){return g}),A.d(V,"Part",function(){return d});var G=A("./src/polyfills/number.ts"),I=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(I),B=A("./src/utils/logger.ts"),U=A("./src/loader/level-key.ts"),k=A("./src/loader/load-stats.ts");function L(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,y(o,u)}function y(o,u){return y=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},y(o,u)}function x(o,u){for(var s=0;s<u.length;s++){var w=u[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,u,s){return u&&x(o.prototype,u),s&&x(o,s),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var T=function(){function o(s){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[C.AUDIO]=null,w[C.VIDEO]=null,w[C.AUDIOVIDEO]=null,w),this.baseurl=s}var u=o.prototype;return u.setByteRange=function(w,p){var f=w.split("@",2),_=[];f.length===1?_[0]=p?p.byteRangeEndOffset:0:_[0]=parseInt(f[1]),_[1]=parseInt(f[0])+_[0],this._byteRange=_},O(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),g=function(o){L(u,o);function u(w,p){var f;return f=o.call(this,p)||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 k.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=w,f}var s=u.prototype;return s.createInitializationVector=function(p){for(var f=new Uint8Array(16),_=12;_<16;_++)f[_]=p>>8*(15-_)&255;return f},s.setDecryptDataFromLevelKey=function(p,f){var _=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(_=U.LevelKey.fromURI(p.uri),_.method=p.method,_.iv=this.createInitializationVector(f),_.keyFormat="identity"),_},s.setElementaryStreamInfo=function(p,f,_,b,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[p];if(!a){l[p]={startPTS:f,endPTS:_,startDTS:b,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,_),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,h)},s.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var p=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),u}(T),d=function(o){L(u,o);function u(s,w,p,f,_){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new k.LoadStats,b.duration=s.decimalFloatingPoint("DURATION"),b.gap=s.bool("GAP"),b.independent=s.bool("INDEPENDENT"),b.relurl=s.enumeratedString("URI"),b.fragment=w,b.index=f;var h=s.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,_),_&&(b.fragOffset=_.fragOffset+_.duration),b}return O(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),u}(T)},"./src/loader/key-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return B});var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=function(){function U(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var k=U.prototype;return k._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var x=this.loaders[y];x&&x.destroy()}this.loaders={}},k.onKeyLoading=function(y,x){var O=x.frag,C=O.type,T=this.loaders[C];if(!O.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=O.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(T&&(R.logger.warn("abort previous key loader for type:"+C),T.abort()),!g){R.logger.warn("key uri is falsy");return}var o=d.loader,u=O.loader=this.loaders[C]=new o(d);this.decrypturl=g,this.decryptkey=null;var s={url:g,frag:O,responseType:"arraybuffer"},w={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(s,w,p)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:O}))},k.loadsuccess=function(y,x,O){var C=O.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(y.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},k.loaderror=function(y,x){var O=x.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:y})},k.loadtimeout=function(y,x){var O=x.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},U}()},"./src/loader/level-details.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LevelDetails",function(){return U});var G=A("./src/polyfills/number.ts");function I(k,L){for(var y=0;y<L.length;y++){var x=L[y];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(k,x.key,x)}}function R(k,L,y){return L&&I(k.prototype,L),y&&I(k,y),k}var B=10,U=function(){function k(y){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=y}var L=k.prototype;return L.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-x.lastPartSn,C=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!C||!!O,this.advanced=this.endSN>x.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},R(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var O=this.driftEnd-this.driftStart;return O*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.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 x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LevelKey",function(){return U});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(G);function R(k,L){for(var y=0;y<L.length;y++){var x=L[y];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(k,x.key,x)}}function B(k,L,y){return L&&R(k.prototype,L),y&&R(k,y),k}var U=function(){k.fromURL=function(y,x){return new k(y,x)},k.fromURI=function(y){return new k(y)};function k(L,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(G.buildAbsoluteURL)(L,y,{alwaysNormalize:!0}):this._uri=L}return B(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LoadStats",function(){return G});var G=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u});var G=A("./src/polyfills/number.ts"),I=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(I),B=A("./src/loader/fragment.ts"),U=A("./src/loader/level-details.ts"),k=A("./src/loader/level-key.ts"),L=A("./src/utils/attr-list.ts"),y=A("./src/utils/logger.ts"),x=A("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,T=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(_){var b,h;return d.test((b=(h=I.parseURL(_))===null||h===void 0?void 0:h.path)!=null?b:"")}var u=function(){function _(){}return _.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},_.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},_.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},_.parseMasterPlaylist=function(h,c){var l=[],a={},v=!1;O.lastIndex=0;for(var m;(m=O.exec(h))!=null;)if(m[1]){var E=new L.AttrList(m[1]),M={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:_.resolve(m[2],c)},F=E.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),s((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=_.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(m[3]){var j=new L.AttrList(m[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:v?a:null}},_.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var v,m=[],E=0;for(C.lastIndex=0;(v=C.exec(h))!==null;){var M=new L.AttrList(v[1]);if(M.TYPE===l){var F={attrs:M,bitrate:0,id:E++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?_.resolve(M.URI,c):""};if(a.length){var j=_.findGroup(a,F.groupId)||a[0];w(F,j,"audioCodec"),w(F,j,"textCodec")}m.push(F)}}return m},_.parseLevelPlaylist=function(h,c,l,a,v){var m=new U.LevelDetails(c),E=m.fragments,M=null,F=0,j=0,W=0,D=0,P=null,H=new B.Fragment(a,c),Y,ee,oe,Te=-1,ve=!1;for(T.lastIndex=0,m.m3u8=h;(Y=T.exec(h))!==null;){ve&&(ve=!1,H=new B.Fragment(a,c),H.start=W,H.sn=F,H.cc=D,H.level=l,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var ge=Y[1];if(ge){H.duration=parseFloat(ge);var he=(" "+Y[2]).slice(1);H.title=he||null,H.tagList.push(he?["INF",ge,he]:["INF",ge])}else if(Y[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,oe&&(H.levelkey=oe),H.sn=F,H.level=l,H.cc=D,H.urlId=v,E.push(H),H.relurl=(" "+Y[3]).slice(1),f(H,P),P=H,W+=H.duration,F++,j=0,ve=!0);else if(Y[4]){var fe=(" "+Y[4]).slice(1);P?H.setByteRange(fe,P):H.setByteRange(fe)}else if(Y[5])H.rawProgramDateTime=(" "+Y[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Te===-1&&(Te=E.length);else{if(Y=Y[0].match(g),!Y){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<Y.length&&!(typeof Y[ee]!="undefined");ee++);var ae=(" "+Y[ee]).slice(1),me=(" "+Y[ee+1]).slice(1),J=Y[ee+2]?(" "+Y[ee+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":m.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":F=m.startSN=parseInt(me);break;case"SKIP":{var ne=new L.AttrList(me),Q=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(Q)){m.skippedSegments=Q;for(var Ee=Q;Ee--;)E.unshift(null);F+=Q}var Ce=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(m.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(me);break;case"VERSION":m.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(me||J)&&H.tagList.push(J?[me,J]:[me]);break;case"DIS":D++;case"GAP":H.tagList.push([ae]);break;case"BITRATE":H.tagList.push([ae,me]);break;case"DISCONTINUITY-SEQ":D=parseInt(me);break;case"KEY":{var ye,we=new L.AttrList(me),De=we.enumeratedString("METHOD"),Pe=we.URI,ke=we.hexadecimalInteger("IV"),Oe=we.enumeratedString("KEYFORMATVERSIONS"),Re=we.enumeratedString("KEYID"),Ge=(ye=we.enumeratedString("KEYFORMAT"))!=null?ye:"identity",$e=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if($e.indexOf(Ge)>-1){y.logger.warn("Keyformat "+Ge+" is not supported from the manifest");continue}else if(Ge!=="identity")continue;De&&(oe=k.LevelKey.fromURL(c,Pe),Pe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(oe.method=De,oe.keyFormat=Ge,Re&&(oe.keyID=Re),Oe&&(oe.keyFormatVersions=Oe),oe.iv=ke));break}case"START":{var Be=new L.AttrList(me),He=Be.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(He)&&(m.startTimeOffset=He);break}case"MAP":{var rt=new L.AttrList(me);H.relurl=rt.URI,rt.BYTERANGE&&H.setByteRange(rt.BYTERANGE),H.level=l,H.sn="initSegment",oe&&(H.levelkey=oe),H.initSegment=null,M=H,ve=!0;break}case"SERVER-CONTROL":{var Je=new L.AttrList(me);m.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var qe=new L.AttrList(me);m.partTarget=qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=m.partList;Se||(Se=m.partList=[]);var Ze=j>0?Se[Se.length-1]:void 0,Ke=j++,Le=new B.Part(new L.AttrList(me),H,c,Ke,Ze);Se.push(Le),H.duration+=Le.duration;break}case"PRELOAD-HINT":{var Ie=new L.AttrList(me);m.preloadHint=Ie;break}case"RENDITION-REPORT":{var pe=new L.AttrList(me);m.renditionReports=m.renditionReports||[],m.renditionReports.push(pe);break}default:y.logger.warn("line parsed but not handled: "+Y);break}}}P&&!P.relurl?(E.pop(),W-=P.duration,m.partList&&(m.fragmentHint=P)):m.partList&&(f(H,P),H.cc=D,m.fragmentHint=H);var se=E.length,de=E[0],$=E[se-1];if(W+=m.skippedSegments*m.targetduration,W>0&&se&&$){m.averagetargetduration=W/se;var Z=$.sn;m.endSN=Z!=="initSegment"?Z:0,de&&(m.startCC=de.cc,de.initSegment||m.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=$.relurl,H.level=l,H.sn="initSegment",de.initSegment=H,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=D,Te>0&&p(E,Te),m},_}();function s(_,b){["video","audio","text"].forEach(function(h){var c=_.filter(function(a){return Object(x.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=l.length>0?l[0]:c[0],_=_.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=_}function w(_,b,h){var c=b[h];c&&(_[h]=c)}function p(_,b){for(var h=_[b],c=b;c--;){var l=_[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function f(_,b){_.rawProgramDateTime?_.programDateTime=Date.parse(_.rawProgramDateTime):b!=null&&b.programDateTime&&(_.programDateTime=b.endProgramDateTime),Object(G.isFiniteNumber)(_.programDateTime)||(_.programDateTime=null,_.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/logger.ts"),U=A("./src/utils/mp4-tools.ts"),k=A("./src/loader/m3u8-parser.ts"),L=A("./src/types/loader.ts"),y=A("./src/utils/attr-list.ts");function x(T){var g=T.type;switch(g){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function O(T,g){var d=T.url;return(d===void 0||d.indexOf("data:")===0)&&(d=g.url),d}var C=function(){function T(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var g=T.prototype;return g.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(o){var u=this.hls.config,s=u.pLoader,w=u.loader,p=s||w,f=new p(u);return o.loader=f,this.loaders[o.type]=f,f},g.getInternalLoader=function(o){return this.loaders[o.type]},g.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},g.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(o,u){var s=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},g.onLevelLoading=function(o,u){var s=u.id,w=u.level,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:null,level:w,responseType:"text",type:L.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},g.onAudioTrackLoading=function(o,u){var s=u.id,w=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},g.onSubtitleTrackLoading=function(o,u){var s=u.id,w=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},g.load=function(o){var u,s=this.hls.config,w=this.getInternalLoader(o);if(w){var p=w.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var f,_,b,h;switch(o.type){case L.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,_=s.manifestLoadingTimeOut,b=s.manifestLoadingRetryDelay,h=s.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:f=0,_=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,_=s.levelLoadingTimeOut,b=s.levelLoadingRetryDelay,h=s.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===L.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===L.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(_=Math.min(Math.max(l*3,a*.8)*1e3,_))}}var v={timeout:_,maxRetry:f,retryDelay:b,maxRetryDelay:h,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,v,m)},g.loadsuccess=function(o,u,s,w){if(w===void 0&&(w=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,u,s,w);return}this.resetInternalLoader(s.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",w);return}u.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,s,w):this.handleMasterPlaylist(o,u,s,w)},g.loaderror=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!1,o)},g.loadtimeout=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!0)},g.handleMasterPlaylist=function(o,u,s,w){var p=this.hls,f=o.data,_=O(o,s),b=k.default.parseMasterPlaylist(f,_),h=b.levels,c=b.sessionData;if(!h.length){this.handleManifestParsingError(o,s,"no level found in manifest",w);return}var l=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),v=k.default.parseMasterPlaylistMedia(f,_,"AUDIO",l),m=k.default.parseMasterPlaylistMedia(f,_,"SUBTITLES",a),E=k.default.parseMasterPlaylistMedia(f,_,"CLOSED-CAPTIONS");if(v.length){var M=v.some(function(F){return!F.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:m,captions:E,url:_,stats:u,networkDetails:w,sessionData:c})},g.handleTrackOrLevelPlaylist=function(o,u,s,w){var p=this.hls,f=s.id,_=s.level,b=s.type,h=O(o,s),c=Object(G.isFiniteNumber)(f)?f:0,l=Object(G.isFiniteNumber)(_)?_:c,a=x(s),v=k.default.parseLevelPlaylist(o.data,h,l,a,c);if(!v.fragments.length){p.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(b===L.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:v,name:"",url:h};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:u,networkDetails:w,sessionData:null})}if(u.parsing.end=performance.now(),v.needSidxRanges){var E,M=(E=v.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:M,isSidxRequest:!0,type:b,level:_,levelDetails:v,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=v,this.handlePlaylistLoaded(o,u,s,w)},g.handleSidxRequest=function(o,u){var s=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var w=s.references,p=u.levelDetails;w.forEach(function(f,_){var b=f.info,h=p.fragments[_];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(o,u,s,w){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===L.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:u,networkDetails:w})},g.handleNetworkError=function(o,u,s,w){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=R.ErrorDetails.UNKNOWN,f=!1,_=this.getInternalLoader(o);switch(o.type){case L.PlaylistContextType.MANIFEST:p=s?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case L.PlaylistContextType.LEVEL:p=s?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case L.PlaylistContextType.AUDIO_TRACK:p=s?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:p=s?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}_&&this.resetInternalLoader(o.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:_,context:o,networkDetails:u};w&&(b.response=w),this.hls.trigger(I.Events.ERROR,b)},g.handlePlaylistLoaded=function(o,u,s,w){var p=s.type,f=s.level,_=s.id,b=s.groupId,h=s.loader,c=s.levelDetails,l=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",w);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:f||0,id:_||0,stats:u,networkDetails:w,deliveryDirectives:l});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:_||0,groupId:b||"",stats:u,networkDetails:w,deliveryDirectives:l});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:_||0,groupId:b||"",stats:u,networkDetails:w,deliveryDirectives:l});break}},T}();V.default=C},"./src/polyfills/number.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isFiniteNumber",function(){return G}),A.d(V,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,V,A){"use strict";A.r(V);var G=function(){function I(){}return I.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},I}();V.default=G},"./src/remux/mp4-generator.ts":function(re,V,A){"use strict";A.r(V);var G=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in R.types)R.types.hasOwnProperty(U)&&(R.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:k,audio:L};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=x,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),T=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,O,T,O,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,y))},R.box=function(U){for(var k=8,L=arguments.length,y=new Array(L>1?L-1:0),x=1;x<L;x++)y[x-1]=arguments[x];for(var O=y.length,C=O;O--;)k+=y[O].byteLength;var T=new Uint8Array(k);for(T[0]=k>>24&255,T[1]=k>>16&255,T[2]=k>>8&255,T[3]=k&255,T.set(U,4),O=0,k=8;O<C;O++)T.set(y[O],k),k+=y[O].byteLength;return T},R.hdlr=function(U){return R.box(R.types.hdlr,R.HDLR_TYPES[U])},R.mdat=function(U){return R.box(R.types.mdat,U)},R.mdhd=function(U,k){k*=U;var L=Math.floor(k/(G+1)),y=Math.floor(k%(G+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},R.mdia=function(U){return R.box(R.types.mdia,R.mdhd(U.timescale,U.duration),R.hdlr(U.type),R.minf(U))},R.mfhd=function(U){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},R.minf=function(U){return U.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(U)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(U))},R.moof=function(U,k,L){return R.box(R.types.moof,R.mfhd(U),R.traf(L,k))},R.moov=function(U){for(var k=U.length,L=[];k--;)L[k]=R.trak(U[k]);return R.box.apply(null,[R.types.moov,R.mvhd(U[0].timescale,U[0].duration)].concat(L).concat(R.mvex(U)))},R.mvex=function(U){for(var k=U.length,L=[];k--;)L[k]=R.trex(U[k]);return R.box.apply(null,[R.types.mvex].concat(L))},R.mvhd=function(U,k){k*=U;var L=Math.floor(k/(G+1)),y=Math.floor(k%(G+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,x)},R.sdtp=function(U){var k=U.samples||[],L=new Uint8Array(4+k.length),y,x;for(y=0;y<k.length;y++)x=k[y].flags,L[y+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return R.box(R.types.sdtp,L)},R.stbl=function(U){return R.box(R.types.stbl,R.stsd(U),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(U){var k=[],L=[],y,x,O;for(y=0;y<U.sps.length;y++)x=U.sps[y],O=x.byteLength,k.push(O>>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(x));for(y=0;y<U.pps.length;y++)x=U.pps[y],O=x.byteLength,L.push(O>>>8&255),L.push(O&255),L=L.concat(Array.prototype.slice.call(x));var C=R.box(R.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|U.sps.length].concat(k).concat([U.pps.length]).concat(L))),T=U.width,g=U.height,d=U.pixelRatio[0],o=U.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T>>8&255,T&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(U){var k=U.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(U.config).concat([6,1,2]))},R.mp4a=function(U){var k=U.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),R.box(R.types.esds,R.esds(U)))},R.mp3=function(U){var k=U.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},R.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(U)):R.box(R.types.stsd,R.STSD,R.mp4a(U)):R.box(R.types.stsd,R.STSD,R.avc1(U))},R.tkhd=function(U){var k=U.id,L=U.duration*U.timescale,y=U.width,x=U.height,O=Math.floor(L/(G+1)),C=Math.floor(L%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,x>>8&255,x&255,0,0]))},R.traf=function(U,k){var L=R.sdtp(U),y=U.id,x=Math.floor(k/(G+1)),O=Math.floor(k%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,O>>24,O>>16&255,O>>8&255,O&255])),R.trun(U,L.length+16+20+8+16+8+8),L)},R.trak=function(U){return U.duration=U.duration||4294967295,R.box(R.types.trak,R.tkhd(U),R.mdia(U))},R.trex=function(U){var k=U.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(U,k){var L=U.samples||[],y=L.length,x=12+16*y,O=new Uint8Array(x),C,T,g,d,o,u;for(k+=8+x,O.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),C=0;C<y;C++)T=L[C],g=T.duration,d=T.size,o=T.flags,u=T.cts,O.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*C);return R.box(R.types.trun,O)},R.initSegment=function(U){R.types||R.init();var k=R.moov(U),L=new Uint8Array(R.FTYP.byteLength+k.byteLength);return L.set(R.FTYP),L.set(k,R.FTYP.byteLength),L},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,V.default=I},"./src/remux/mp4-remuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u}),A.d(V,"normalizePts",function(){return s});var G=A("./src/polyfills/number.ts"),I=A("./src/remux/aac-helper.ts"),R=A("./src/remux/mp4-generator.ts"),B=A("./src/events.ts"),U=A("./src/errors.ts"),k=A("./src/utils/logger.ts"),L=A("./src/types/loader.ts"),y=A("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign||function(_){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(_[c]=h[c])}return _},x.apply(this,arguments)}var O=10*1e3,C=1024,T=1152,g=null,d=null,o=!1,u=function(){function _(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,g===null){var v=navigator.userAgent||"",m=v.match(/Chrome\/(\d+)/i);g=m?parseInt(m[1]):0}if(d===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);d=E?parseInt(E[1]):0}o=!!g&&g<75||!!d&&d<600}var b=_.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(v,m){var E=m.pts-v;return E<-4294967296?(l=!0,s(v,m.pts)):E>0?v:m.pts},c[0].pts);return l&&k.logger.debug("PTS rollover detected"),a},b.remux=function(c,l,a,v,m,E,M,F){var j,W,D,P,H,Y,ee=m,oe=m,Te=c.pid>-1,ve=l.pid>-1,ge=l.samples.length,he=c.samples.length>0,fe=ge>1,ae=(!Te||he)&&(!ve||fe)||this.ISGenerated||M;if(ae){this.ISGenerated||(D=this.generateIS(c,l,m));var me=this.isVideoContiguous,J=-1;if(fe&&(J=w(l.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,J>0){k.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+ge+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,oe+=(l.samples[0].pts-ne)/(l.timescale||9e4)}else J===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(he&&fe){var Q=this.getVideoStartPts(l.samples),Ee=s(c.samples[0].pts,Q)-Q,Ce=Ee/l.inputTimeScale;ee+=Math.max(0,Ce),oe+=Math.max(0,-Ce)}if(he){if(c.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),D=this.generateIS(c,l,m)),W=this.remuxAudio(c,ee,this.isAudioContiguous,E,ve||fe||F===L.PlaylistLevelType.AUDIO?oe:void 0),fe){var ye=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),D=this.generateIS(c,l,m)),j=this.remuxVideo(l,oe,me,ye)}}else fe&&(j=this.remuxVideo(l,oe,me,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,m)),v.samples.length&&(P=this.remuxText(v,m))),{audio:W,video:j,initSegment:D,independent:Y,text:P,id3:H}},b.generateIS=function(c,l,a){var v=c.samples,m=l.samples,E=this.typeSupported,M={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,D,P;if(F&&(W=D=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(j="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=D=v[0].pts-Math.round(P*a))),l.sps&&l.pps&&m.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){P=l.inputTimeScale;var H=this.getVideoStartPts(m),Y=Math.round(P*a);D=Math.min(D,s(m[0].dts,H)-Y),W=Math.min(W,H-Y)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=D),{tracks:M,initPTS:W,timescale:P}},b.remuxVideo=function(c,l,a,v){var m=c.inputTimeScale,E=c.samples,M=[],F=E.length,j=this._initPTS,W=this.nextAvcDts,D=8,P,H,Y,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Te=0,ve=!1;if(!a||W===null){var ge=l*m,he=E[0].pts-s(E[0].dts,E[0].pts);W=ge-he}for(var fe=0;fe<F;fe++){var ae=E[fe];if(ae.pts=s(ae.pts-j,W),ae.dts=s(ae.dts-j,W),ae.dts>ae.pts){var me=9e4*.2;Te=Math.max(Math.min(Te,ae.pts-ae.dts),-1*me)}ae.dts<E[fe>0?fe-1:fe].dts&&(ve=!0)}ve&&E.sort(function(mt,dt){var ot=mt.dts-dt.dts,Ct=mt.pts-dt.pts;return ot||Ct}),H=E[0].dts,Y=E[E.length-1].dts;var J=Math.round((Y-H)/(F-1));if(Te<0){if(Te<J*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-J,!0)+" ms");for(var ne=Te,Q=0;Q<F;Q++)E[Q].dts=ne=Math.max(ne,E[Q].pts-J),E[Q].pts=Math.max(ne,E[Q].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var Ee=0;Ee<F;Ee++)E[Ee].dts=E[Ee].dts+Te}H=E[0].dts}if(a){var Ce=H-W,ye=Ce>J,we=Ce<-1;if(ye||we){ye?k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),H=W;var De=E[0].pts-Ce;E[0].dts=H,E[0].pts=De,k.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(De,!0)+"/"+Object(y.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Ce,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Pe=0,ke=0,Oe=0;Oe<F;Oe++){for(var Re=E[Oe],Ge=Re.units,$e=Ge.length,Be=0,He=0;He<$e;He++)Be+=Ge[He].data.length;ke+=Be,Pe+=$e,Re.length=Be,Re.dts=Math.max(Re.dts,H),Re.pts=Math.max(Re.pts,Re.dts,0),ee=Math.min(Re.pts,ee),oe=Math.max(Re.pts,oe)}Y=E[F-1].dts;var rt=ke+4*Pe+8,Je;try{Je=new Uint8Array(rt)}catch(mt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var qe=new DataView(Je.buffer);qe.setUint32(0,rt),Je.set(R.default.types.mdat,4);for(var Se=0;Se<F;Se++){for(var Ze=E[Se],Ke=Ze.units,Le=0,Ie=0,pe=Ke.length;Ie<pe;Ie++){var se=Ke[Ie],de=se.data,$=se.data.byteLength;qe.setUint32(D,$),D+=4,Je.set(de,D),D+=$,Le+=4+$}if(Se<F-1)P=E[Se+1].dts-Ze.dts;else{var Z=this.config,te=Ze.dts-E[Se>0?Se-1:Se].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(Z.maxBufferHole*m),ce=(v?ee+v*m:this.nextAudioPts)-Ze.pts;ce>le?(P=ce-te,P<0&&(P=te),k.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=te}else P=te}var Ae=Math.round(Ze.pts-Ze.dts);M.push(new p(Ze.key,P,Le,Ae))}if(M.length&&g&&g<70){var _e=M[0].flags;_e.dependsOn=2,_e.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+P,this.isVideoContiguous=!0;var Ue=R.default.moof(c.sequenceNumber++,H,x({},c,{samples:M})),Qe="video",Ve={data1:Ue,data2:Je,startPTS:ee/m,endPTS:(oe+P)/m,startDTS:H/m,endDTS:W/m,type:Qe,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Ve},b.remuxAudio=function(c,l,a,v,m){var E=c.inputTimeScale,M=c.samplerate?c.samplerate:E,F=E/M,j=c.isAAC?C:T,W=j*F,D=this._initPTS,P=!c.isAAC&&this.typeSupported.mpeg,H=[],Y=c.samples,ee=P?0:8,oe=this.nextAudioPts||-1,Te=l*E;if(this.isAudioContiguous=a=a||Y.length&&oe>0&&(v&&Math.abs(Te-oe)<9e3||Math.abs(s(Y[0].pts-D,Te)-oe)<20*W),Y.forEach(function(de){de.pts=s(de.pts-D,Te)}),!a||oe<0){if(Y=Y.filter(function(de){return de.pts>=0}),!Y.length)return;m===0?oe=0:v?oe=Math.max(0,Te):oe=Y[0].pts}if(c.isAAC)for(var ve=m!==void 0,ge=this.config.maxAudioFramesDrift,he=0,fe=oe;he<Y.length;he++){var ae=Y[he],me=ae.pts,J=me-fe,ne=Math.abs(1e3*J/E);if(J<=-ge*W&&ve)he===0&&(k.logger.warn("Audio frame @ "+(me/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/E)+" ms."),this.nextAudioPts=oe=fe=me);else if(J>=ge*W&&ne<O&&ve){var Q=Math.round(J/W);fe=me-Q*W,fe<0&&(Q--,fe+=W),he===0&&(this.nextAudioPts=oe=fe),k.logger.warn("[mp4-remuxer]: Injecting "+Q+" audio frame @ "+(fe/E).toFixed(3)+"s due to "+Math.round(1e3*J/E)+" ms gap.");for(var Ee=0;Ee<Q;Ee++){var Ce=Math.max(fe,0),ye=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ae.unit.subarray()),Y.splice(he,0,{unit:ye,pts:Ce}),fe+=W,he++}}ae.pts=fe,fe+=W}for(var we=null,De=null,Pe,ke=0,Oe=Y.length;Oe--;)ke+=Y[Oe].unit.byteLength;for(var Re=0,Ge=Y.length;Re<Ge;Re++){var $e=Y[Re],Be=$e.unit,He=$e.pts;if(De!==null){var rt=H[Re-1];rt.duration=Math.round((He-De)/F)}else if(a&&c.isAAC&&(He=oe),we=He,ke>0){ke+=ee;try{Pe=new Uint8Array(ke)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!P){var Je=new DataView(Pe.buffer);Je.setUint32(0,ke),Pe.set(R.default.types.mdat,4)}}else return;Pe.set(Be,ee);var qe=Be.byteLength;ee+=qe,H.push(new p(!0,j,qe,0)),De=He}var Se=H.length;if(!Se)return;var Ze=H[H.length-1];this.nextAudioPts=oe=De+F*Ze.duration;var Ke=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,we/F,x({},c,{samples:H}));c.samples=[];var Le=we/E,Ie=oe/E,pe="audio",se={data1:Ke,data2:Pe,startPTS:Le,endPTS:Ie,startDTS:Le,endDTS:Ie,type:pe,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(Pe.length,"MDAT length must not be zero"),se},b.remuxEmptyAudio=function(c,l,a,v){var m=c.inputTimeScale,E=c.samplerate?c.samplerate:m,M=m/E,F=this.nextAudioPts,j=(F!==null?F:v.startDTS*m)+this._initDTS,W=v.endDTS*m+this._initDTS,D=M*C,P=Math.ceil((W-j)/D),H=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ee=0;ee<P;ee++){var oe=j+ee*D;Y.push({unit:H,pts:oe,dts:oe})}return c.samples=Y,this.remuxAudio(c,l,a,!1)},b.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,m=this._initPTS,E=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=s(F.pts-m,l*v)/v,F.dts=s(F.dts-E,l*v)/v}var j=c.samples;return c.samples=[],{samples:j}},b.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,m=this._initPTS,E=0;E<a;E++){var M=c.samples[E];M.pts=s(M.pts-m,l*v)/v}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},_}();function s(_,b){var h;if(b===null)return _;for(b<_?h=-8589934592:h=8589934592;Math.abs(_-b)>4294967296;)_+=h;return _}function w(_){for(var b=0;b<_.length;b++)if(_[b].key)return b;return-1}var p=function(b,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new f(b)},f=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/fragment.ts"),B=A("./src/utils/logger.ts"),U=function(){function y(){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 x=y.prototype;return x.destroy=function(){},x.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},x.resetNextTimestamp=function(){this.lastEndDTS=null},x.resetInitSegment=function(C,T,g){this.audioCodec=T,this.videoCodec=g,this.generateInitSegment(C),this.emitInitSegment=!0},x.generateInitSegment=function(C){var T=this.audioCodec,g=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(I.parseInitSegment)(C);T||(T=L(d.audio,R.ElementaryStreamTypes.AUDIO)),g||(g=L(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:T+","+g,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:T,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:g,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},x.remux=function(C,T,g,d,o){var u=this.initPTS,s=this.lastEndDTS,w={audio:void 0,video:void 0,text:d,id3:g,initSegment:void 0};Object(G.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var p=T.samples;if(!p||!p.length)return w;var f={initPTS:void 0,timescale:1},_=this.initData;if((!_||!_.length)&&(this.generateInitSegment(p),_=this.initData),!_||!_.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=k(_,p,s));var b=Object(I.getDuration)(p,_),h=s,c=b+h;Object(I.offsetStartDTS)(_,p,u),b>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!_.audio,a=!!_.video,v="";l&&(v+="audio"),a&&(v+="video");var m={data1:p,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:l,hasVideo:a,nb:1,dropped:0};return w.audio=m.type==="audio"?m:void 0,w.video=m.type!=="audio"?m:void 0,w.text=d,w.id3=g,w.initSegment=f,w},y}(),k=function(x,O,C){return Object(I.getStartDTS)(x,O)-C};function L(y,x){var O=y==null?void 0:y.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||x===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=U},"./src/task-loop.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"CMCDVersion",function(){return G}),A.d(V,"CMCDObjectType",function(){return I}),A.d(V,"CMCDStreamingFormat",function(){return R}),A.d(V,"CMCDStreamType",function(){return B});var G=1,I;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(I||(I={}));var R;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(R||(R={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"HlsSkip",function(){return R}),A.d(V,"getSkipValue",function(){return B}),A.d(V,"HlsUrlParameters",function(){return U}),A.d(V,"Level",function(){return k});function G(L,y){for(var x=0;x<y.length;x++){var O=y[x];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(L,O.key,O)}}function I(L,y,x){return y&&G(L.prototype,y),x&&G(L,x),L}var R;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(R||(R={}));function B(L,y){var x=L.canSkipUntil,O=L.canSkipDateRanges,C=L.endSN,T=y!==void 0?y-C:0;return x&&T<x?O?R.v2:R.Yes:R.No}var U=function(){function L(x,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=O,this.skip=C}var y=L.prototype;return y.addDirectives=function(O){var C=new self.URL(O);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},L}(),k=function(){function L(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(x){return x}).join(",").replace(/\.[^.,]+/g,"")}return I(L,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(x){var O=x%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),L}()},"./src/types/loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"PlaylistContextType",function(){return G}),A.d(V,"PlaylistLevelType",function(){return I});var G;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"ChunkMetadata",function(){return G});var G=function(B,U,k,L,y,x){L===void 0&&(L=0),y===void 0&&(y=-1),x===void 0&&(x=!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=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=U,this.id=k,this.size=L,this.part=y,this.partial=x};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"AttrList",function(){return R});var G=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(k){typeof k=="string"&&(k=B.parseAttrList(k));for(var L in k)k.hasOwnProperty(L)&&(this[L]=k[L])}var U=B.prototype;return U.decimalInteger=function(L){var y=parseInt(this[L],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},U.hexadecimalInteger=function(L){if(this[L]){var y=(this[L]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var x=new Uint8Array(y.length/2),O=0;O<y.length/2;O++)x[O]=parseInt(y.slice(O*2,O*2+2),16);return x}else return null},U.hexadecimalIntegerAsNumber=function(L){var y=parseInt(this[L],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},U.decimalFloatingPoint=function(L){return parseFloat(this[L])},U.optionalFloat=function(L,y){var x=this[L];return x?parseFloat(x):y},U.enumeratedString=function(L){return this[L]},U.bool=function(L){return this[L]==="YES"},U.decimalResolution=function(L){var y=G.exec(this[L]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},B.parseAttrList=function(L){var y,x={},O='"';for(I.lastIndex=0;(y=I.exec(L))!==null;){var C=y[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),x[y[1]]=C}return x},B}()},"./src/utils/binary-search.ts":function(re,V,A){"use strict";A.r(V);var G={search:function(R,B){for(var U=0,k=R.length-1,L=null,y=null;U<=k;){L=(U+k)/2|0,y=R[L];var x=B(y);if(x>0)U=L+1;else if(x<0)k=L-1;else return y}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"BufferHelper",function(){return R});var G=A("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(k,L){try{if(k){for(var y=B.getBuffered(k),x=0;x<y.length;x++)if(L>=y.start(x)&&L<=y.end(x))return!0}}catch(O){}return!1},B.bufferInfo=function(k,L,y){try{if(k){var x=B.getBuffered(k),O=[],C;for(C=0;C<x.length;C++)O.push({start:x.start(C),end:x.end(C)});return this.bufferedInfo(O,L,y)}}catch(T){}return{len:0,start:L,end:L,nextStart:void 0}},B.bufferedInfo=function(k,L,y){L=Math.max(0,L),k.sort(function(f,_){var b=f.start-_.start;return b||_.end-f.end});var x=[];if(y)for(var O=0;O<k.length;O++){var C=x.length;if(C){var T=x[C-1].end;k[O].start-T<y?k[O].end>T&&(x[C-1].end=k[O].end):x.push(k[O])}else x.push(k[O])}else x=k;for(var g=0,d,o=L,u=L,s=0;s<x.length;s++){var w=x[s].start,p=x[s].end;if(L+y>=w&&L<p)o=w,u=p,g=u-L;else if(L+y<w){d=w;break}}return{len:g,start:o||0,end:u||0,nextStart:d}},B.getBuffered=function(k){try{return k.buffered}catch(L){return G.logger.log("failed to get media.buffered",L),I}},B}()},"./src/utils/cea-608-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"Row",function(){return u}),A.d(V,"CaptionScreen",function(){return s});var G=A("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(c){var l=c;return I.hasOwnProperty(c)&&(l=I[c]),String.fromCharCode(l)},B=15,U=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},x={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var T=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,v){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+v)},h}(),g=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,v,m,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=v||!1,this.background=m||"black",this.flash=E||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],m=0;m<v.length;m++){var E=v[m];a.hasOwnProperty(E)&&(this[E]=a[E])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,v,m,E,M){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,v,m,E,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),u=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<U;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var v=!0,m=0;m<U;m++)if(!this.chars[m].equals(a.chars[m])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<U;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<U;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var m=this.pos+1;m<v+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=R(a);if(this.pos>=U){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v<U;v++)this.chars[v].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],v=!0,m=0;m<U;m++){var E=this.chars[m].uchar;E!==" "&&(v=!1),a.push(E)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},h}(),s=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new u(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var v=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<B;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<B;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var m=0;m<B;m++)this.rows[m].clear();var E=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[E].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[v-this.nrRollUpRows+W+1].copy(M.rows[E+W])}}this.currRow=v;var D=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,H=Math.max(P-1,0);D.setCursor(a.indent),a.color=D.chars[H].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],m="",E=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(E=M+1,a?v.push("Row "+E+": '"+F+"'"):v.push(F.trim()))}return v.length>0&&(a?m="["+v.join(" | ")+"]":m=v.join(`
`)),m},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(l,a,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(v),this.nonDisplayedMemory=new s(v),this.lastOutputScreen=new s(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var m=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=E[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),p=function(){function h(l,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new T;this.channels=[null,new w(l,a,m),new w(l+1,v,m)],this.cmdHistory=b(),this.logger=m}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var m,E,M,F=!1;this.logger.time=a;for(var j=0;j<v.length;j+=2){if(E=v[j]&127,M=v[j+1]&127,E===0&&M===0)continue;if(this.logger.log(C.DATA,"["+g([v[j],v[j+1]])+"] -> ("+g([E,M])+")"),m=this.parseCmd(E,M),m||(m=this.parseMidrow(E,M)),m||(m=this.parsePAC(E,M)),m||(m=this.parseBackgroundAttributes(E,M)),!m&&(F=this.parseChars(E,M),F)){var W=this.currentChannel;if(W&&W>0){var D=this.channels[W];D.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+g([E,M])+" orig: "+g([v[j],v[j+1]]))}},c.parseCmd=function(a,v){var m=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,M=(a===23||a===31)&&v>=33&&v<=35;if(!(E||M))return!1;if(_(a,v,m))return f(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+g([a,v])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?v===32?j.ccRCL():v===33?j.ccBS():v===34?j.ccAOF():v===35?j.ccAON():v===36?j.ccDER():v===37?j.ccRU(2):v===38?j.ccRU(3):v===39?j.ccRU(4):v===40?j.ccFON():v===41?j.ccRDC():v===42?j.ccTR():v===43?j.ccRTD():v===44?j.ccEDM():v===45?j.ccCR():v===46?j.ccENM():v===47&&j.ccEOC():j.ccTO(v-32),f(a,v,m),this.currentChannel=F,!0},c.parseMidrow=function(a,v){var m=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+g([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var m,E=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(M||F))return!1;if(_(a,v,E))return f(null,null,E),!0;var j=a<=23?1:2;v>=64&&v<=95?m=j===1?k[a]:y[a]:m=j===1?L[a]:x[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,v)),f(a,v,E),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,v){var m,E={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?m=v-96:m=v-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},c.parseChars=function(a,v){var m,E=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var F;M===17?F=v+80:M===18?F=v+112:F=v+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+m),E=[F]}else a>=32&&a<=127&&(E=v===0?[a]:[a,v]);if(E){var j=g(E);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),f(a,v,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,v){var m=(a===16||a===24)&&v>=32&&v<=47,E=(a===23||a===31)&&v>=45&&v<=47;if(!(m||E))return!1;var M,F={};a===16||a===24?(M=Math.floor((v-32)/2),F.background=O[M],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),f(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var m=this.channels[v];m&&m.cueSplitAtTime(a)}},h}();function f(h,c,l){l.a=h,l.b=c}function _(h,c,l){return l.a===h&&l.b===c}function b(){return{a:null,b:null}}V.default=p},"./src/utils/codecs.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isCodecType",function(){return I}),A.d(V,"isCodecSupportedInMp4",function(){return R});var G={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(B,U){var k=G[U];return!!k&&k[B.slice(0,4)]===!0}function R(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/vttparser.ts"),I=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(L,y,x,O){for(var C=[],T,g,d,o,u,s=self.VTTCue||self.TextTrackCue,w=0;w<O.rows.length;w++)if(T=O.rows[w],d=!0,o=0,u="",!T.isEmpty()){for(var p=0;p<T.chars.length;p++)B.test(T.chars[p].uchar)&&d?o++:(u+=T.chars[p].uchar,d=!1);T.cueStartTime=y,y===x&&(x+=1e-4),o>=16?o--:o++;var f=Object(G.fixLineBreaks)(u.trim()),_=Object(I.generateCueId)(y,x,f);(!L||!L.cues||!L.cues.getCueById(_))&&(g=new s(y,x,f),g.id=_,g.line=w+1,g.align="left",g.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(g))}return L&&C.length&&(C.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),C.forEach(function(b){return Object(R.addCueToTrack)(L,b)})),C}};V.default=U},"./src/utils/discontinuities.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"findFirstFragWithCC",function(){return B}),A.d(V,"shouldAlignOnDiscontinuities",function(){return U}),A.d(V,"findDiscontinuousReferenceFrag",function(){return k}),A.d(V,"adjustSlidingStart",function(){return y}),A.d(V,"alignStream",function(){return x}),A.d(V,"alignPDT",function(){return C}),A.d(V,"alignFragmentByPDTDelta",function(){return T}),A.d(V,"alignMediaPlaylistByPDT",function(){return g});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts"),R=A("./src/controller/level-helper.ts");function B(d,o){for(var u=null,s=0,w=d.length;s<w;s++){var p=d[s];if(p&&p.cc===o){u=p;break}}return u}function U(d,o,u){return!!(o.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function k(d,o){var u=d.fragments,s=o.fragments;if(!s.length||!u.length){I.logger.log("No fragments to align");return}var w=B(u,s[0].cc);if(!w||w&&!w.startPTS){I.logger.log("No frag in previous level to align on");return}return w}function L(d,o){if(d){var u=d.start+o;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function y(d,o){for(var u=o.fragments,s=0,w=u.length;s<w;s++)L(u[s],d);o.fragmentHint&&L(o.fragmentHint,d),o.alignedSliding=!0}function x(d,o,u){if(!o)return;O(d,u,o),!u.alignedSliding&&o.details&&C(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(R.adjustSliding)(o.details,u)}function O(d,o,u){if(U(d,u,o)){var s=k(u.details,o);s&&Object(G.isFiniteNumber)(s.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(s.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=d.fragments[0].programDateTime,w=(s-u)/1e3+o.fragments[0].start;w&&Object(G.isFiniteNumber)(w)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(s-u)+"ms, sliding:"+w.toFixed(3)+" "+d.url+" "),y(w,d))}function T(d,o){var u=d.programDateTime;if(!u)return;var s=(u-o)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function g(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=o.fragments[0].start,w=u-s*1e3;d.fragments.forEach(function(p){T(p,w)}),d.fragmentHint&&T(d.fragmentHint,w),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/ewma.ts"),I=function(){function R(U,k,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new G.default(U),this.fast_=new G.default(k)}var B=R.prototype;return B.update=function(k,L){var y=this.slow_,x=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new G.default(k,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new G.default(L,x.getEstimate(),x.getTotalWeight()))},B.sample=function(k,L){k=Math.max(k,this.minDelayMs_);var y=8*L,x=k/1e3,O=y/x;this.fast_.sample(x,O),this.slow_.sample(x,O)},B.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=I},"./src/utils/ewma.ts":function(re,V,A){"use strict";A.r(V);var G=function(){function I(B,U,k){U===void 0&&(U=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=U,this.totalWeight_=k}var R=I.prototype;return R.sample=function(U,k){var L=Math.pow(this.alpha_,U);this.estimate_=k*(1-L)+L*this.estimate_,this.totalWeight_+=U},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();V.default=G},"./src/utils/fetch-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"fetchSupported",function(){return T});var G=A("./src/polyfills/number.ts"),I=A("./src/loader/load-stats.ts"),R=A("./src/demux/chunk-cache.ts");function B(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,x(s,w)}function U(s){var w=typeof Map=="function"?new Map:void 0;return U=function(f){if(f===null||!y(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(f))return w.get(f);w.set(f,_)}function _(){return k(f,arguments,O(this).constructor)}return _.prototype=Object.create(f.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),x(_,f)},U(s)}function k(s,w,p){return L()?k=Reflect.construct:k=function(_,b,h){var c=[null];c.push.apply(c,b);var l=Function.bind.apply(_,c),a=new l;return h&&x(a,h.prototype),a},k.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function y(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function x(s,w){return x=Object.setPrototypeOf||function(f,_){return f.__proto__=_,f},x(s,w)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},O(s)}function C(){return C=Object.assign||function(s){for(var w=1;w<arguments.length;w++){var p=arguments[w];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(s[f]=p[f])}return s},C.apply(this,arguments)}function T(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var g=function(){function s(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var w=s.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(f,_,b){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(f,this.controller.signal),a=b.onProgress,v=f.responseType==="arraybuffer",m=v?"byteLength":"length";this.context=f,this.config=_,this.callbacks=b,this.request=this.fetchSetup(f,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(c,f,h.response)},_.timeout),self.fetch(this.request).then(function(E){if(h.response=h.loader=E,!E.ok){var M=E.status,F=E.statusText;throw new u(F||"fetch, bad network response",M,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(_.highWaterMark)?h.loadProgressively(E,c,f,_.highWaterMark,a):v?E.arrayBuffer():E.text()}).then(function(E){var M=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[m];var F={url:M.url,data:E};a&&!Object(G.isFiniteNumber)(_.highWaterMark)&&a(c,f,E,M),b.onSuccess(F,c,f,M)}).catch(function(E){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=E.code||0;b.onError({code:M,text:E.message},f,E.details)})},w.getCacheAge=function(){var f=null;if(this.response){var _=this.response.headers.get("age");f=_?parseFloat(_):null}return f},w.loadProgressively=function(f,_,b,h,c){h===void 0&&(h=0);var l=new R.default,a=f.body.getReader(),v=function m(){return a.read().then(function(E){if(E.done)return l.dataLength&&c(_,b,l.flush(),f),Promise.resolve(new ArrayBuffer(0));var M=E.value,F=M.length;return _.loaded+=F,F<h||l.dataLength?(l.push(M),l.dataLength>=h&&c(_,b,l.flush(),f)):c(_,b,M,f),m()}).catch(function(){return Promise.reject()})};return v()},s}();function d(s,w){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&p.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),p}function o(s,w){return new self.Request(s.url,w)}var u=function(s){B(w,s);function w(p,f,_){var b;return b=s.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=_,b}return w}(U(Error));V.default=g},"./src/utils/imsc1-ttml-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"IMSC1_CODEC",function(){return y}),A.d(V,"parseIMSC1",function(){return T});var G=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/utils/vttcue.ts"),B=A("./src/demux/id3.ts"),U=A("./src/utils/timescale-conversion.ts"),k=A("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},L.apply(this,arguments)}var y="stpp.ttml.im1t",x=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function T(h,c,l,a,v){var m=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(m.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var E=m[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(h,E.start,E.end-E.start)),F=Object(U.toTimescaleFromScale)(c,1,l);try{a(g(M,F))}catch(j){v(j)}}function g(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(m).reduce(function(D,P){return D[P]=v.getAttribute("ttp:"+P)||m[P],D},{}),M=v.getAttribute("xml:space")!=="preserve",F=o(d(v,"styling","style")),j=o(d(v,"layout","region")),W=d(v,"body","[begin]");return[].map.call(W,function(D){var P=u(D,M);if(!P||!D.hasAttribute("begin"))return null;var H=f(D.getAttribute("begin"),E),Y=f(D.getAttribute("dur"),E),ee=f(D.getAttribute("end"),E);if(H===null)throw p(D);if(ee===null){if(Y===null)throw p(D);ee=H+Y}var oe=new R.default(H-c,ee-c,P);oe.id=Object(k.generateCueId)(oe.startTime,oe.endTime,oe.text);var Te=j[D.getAttribute("region")],ve=F[D.getAttribute("style")];oe.position=10,oe.size=80;var ge=s(Te,ve),he=ge.textAlign;if(he){var fe=C[he];fe&&(oe.lineAlign=fe),oe.align=he}return L(oe,ge),oe}).filter(function(D){return D!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function u(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,v){var m;return a.nodeName==="br"&&v?l+`
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?u(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function s(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,m){var E=w(c,l,m)||w(h,l,m);return E&&(v[m]=E),v},{})}function w(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function p(h){return new Error("Could not parse ttml timestamp "+h)}function f(h,c){if(!h)return null;var l=Object(I.parseTimeStamp)(h);return l===null&&(x.test(h)?l=_(h,c):O.test(h)&&(l=b(h,c))),l}function _(h,c){var l=x.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function b(h,c){var l=O.exec(h),a=Number(l[1]),v=l[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"enableLogs",function(){return k}),A.d(V,"logger",function(){return L});var G=function(){},I={trace:G,debug:G,log:G,warn:G,info:G,error:G},R=I;function B(y){var x=self.console[y];return x?x.bind(self.console,"["+y+"] >"):G}function U(y){for(var x=arguments.length,O=new Array(x>1?x-1:0),C=1;C<x;C++)O[C-1]=arguments[C];O.forEach(function(T){R[T]=y[T]?y[T].bind(y):B(T)})}function k(y){if(self.console&&y===!0||typeof y=="object"){U(y,"debug","log","info","warn","error");try{R.log()}catch(x){R=I}}else R=I}var L=R},"./src/utils/mediakeys-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"KeySystems",function(){return G}),A.d(V,"requestMediaKeySystemAccess",function(){return I});var G;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(G||(G={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"bin2str",function(){return U}),A.d(V,"readUint16",function(){return k}),A.d(V,"readUint32",function(){return L}),A.d(V,"writeUint32",function(){return y}),A.d(V,"findBox",function(){return x}),A.d(V,"parseSegmentIndex",function(){return O}),A.d(V,"parseInitSegment",function(){return C}),A.d(V,"getStartDTS",function(){return T}),A.d(V,"getDuration",function(){return g}),A.d(V,"computeRawDurationFromSamples",function(){return d}),A.d(V,"offsetStartDTS",function(){return o}),A.d(V,"segmentValidRange",function(){return u}),A.d(V,"appendUint8Array",function(){return s});var G=A("./src/utils/typed-array.ts"),I=A("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function U(w){return String.fromCharCode.apply(null,w)}function k(w,p){"data"in w&&(p+=w.start,w=w.data);var f=w[p]<<8|w[p+1];return f<0?65536+f:f}function L(w,p){"data"in w&&(p+=w.start,w=w.data);var f=w[p]<<24|w[p+1]<<16|w[p+2]<<8|w[p+3];return f<0?4294967296+f:f}function y(w,p,f){"data"in w&&(p+=w.start,w=w.data),w[p]=f>>24,w[p+1]=f>>16&255,w[p+2]=f>>8&255,w[p+3]=f&255}function x(w,p){var f=[];if(!p.length)return f;var _,b,h;"data"in w?(_=w.data,b=w.start,h=w.end):(_=w,b=0,h=_.byteLength);for(var c=b;c<h;){var l=L(_,c),a=U(_.subarray(c+4,c+8)),v=l>1?c+l:h;if(a===p[0])if(p.length===1)f.push({data:_,start:c+8,end:v});else{var m=x({data:_,start:c+8,end:v},p.slice(1));m.length&&B.apply(f,m)}c=v}return f}function O(w){var p=x(w,["moov"]),f=p[0],_=f?f.end:null,b=x(w,["sidx"]);if(!b||!b[0])return null;var h=[],c=b[0],l=c.data[0],a=l===0?8:16,v=L(c,a);a+=4;var m=0,E=0;l===0?a+=8:a+=16,a+=2;var M=c.end+E,F=k(c,a);a+=2;for(var j=0;j<F;j++){var W=a,D=L(c,W);W+=4;var P=D&2147483647,H=(D&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=L(c,W);W+=4,h.push({referenceSize:P,subsegmentDuration:Y,info:{duration:Y/v,start:M,end:M+P-1}}),M+=P,W+=4,a=W}return{earliestPresentationTime:m,timescale:v,version:l,referencesCount:F,references:h,moovEndOffset:_}}function C(w){for(var p=[],f=x(w,["moov","trak"]),_=0;_<f.length;_++){var b=f[_],h=x(b,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=L(h,l),v=x(b,["mdia","mdhd"])[0];if(v){c=v.data[v.start],l=c===0?12:20;var m=L(v,l),E=x(b,["mdia","hdlr"])[0];if(E){var M=U(E.data.subarray(E.start+8,E.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(F){var j=x(b,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:m,type:F},p[F]={timescale:m,id:a,codec:W}}}}}}var D=x(w,["moov","mvex","trex"]);return D.forEach(function(P){var H=L(P,4),Y=p[H];Y&&(Y.default={duration:L(P,12),flags:L(P,20)})}),p}function T(w,p){return x(p,["moof","traf"]).reduce(function(f,_){var b=x(_,["tfdt"])[0],h=b.data[b.start],c=x(_,["tfhd"]).reduce(function(l,a){var v=L(a,4),m=w[v];if(m){var E=L(b,4);h===1&&(E*=Math.pow(2,32),E+=L(b,8));var M=m.timescale||9e4,F=E/M;if(isFinite(F)&&(l===null||F<l))return F}return l},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function g(w,p){for(var f=0,_=0,b=0,h=x(w,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=x(l,["tfhd"])[0],v=L(a,4),m=p[v];if(!m)continue;var E=m.default,M=L(a,0)|(E==null?void 0:E.flags),F=E==null?void 0:E.duration;M&8&&(M&2?F=L(a,12):F=L(a,8));for(var j=m.timescale||9e4,W=x(l,["trun"]),D=0;D<W.length;D++){if(F){var P=L(W[D],4);f=F*P}else f=d(W[D]);m.type===I.ElementaryStreamTypes.VIDEO?_+=f/j:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=f/j)}}if(_===0&&b===0){var H=O(w);if(H!=null&&H.references)return H.references.reduce(function(Y,ee){return Y+ee.info.duration||0},0)}return _||b}function d(w){var p=L(w,0),f=8;p&1&&(f+=4),p&4&&(f+=4);for(var _=0,b=L(w,4),h=0;h<b;h++){if(p&256){var c=L(w,f);_+=c,f+=4}p&512&&(f+=4),p&1024&&(f+=4),p&2048&&(f+=4)}return _}function o(w,p,f){x(p,["moof","traf"]).forEach(function(_){x(_,["tfhd"]).forEach(function(b){var h=L(b,4),c=w[h];if(!c)return;var l=c.timescale||9e4;x(_,["tfdt"]).forEach(function(a){var v=a.data[a.start],m=L(a,4);if(v===0)y(a,4,m-f*l);else{m*=Math.pow(2,32),m+=L(a,8),m-=f*l,m=Math.max(m,0);var E=Math.floor(m/(R+1)),M=Math.floor(m%(R+1));y(a,4,E),y(a,8,M)}})})})}function u(w){var p={valid:null,remainder:null},f=x(w,["moof"]);if(f){if(f.length<2)return p.remainder=w,p}else return p;var _=f[f.length-1];return p.valid=Object(G.sliceUint8)(w,0,_.start-8),p.remainder=Object(G.sliceUint8)(w,_.start-8),p}function s(w,p){var f=new Uint8Array(w.length+p.length);return f.set(w),f.set(p,w.length),f}},"./src/utils/output-filter.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(B,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=U}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(U,k,L){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=k,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"sendAddTrackEvent",function(){return I}),A.d(V,"addCueToTrack",function(){return R}),A.d(V,"clearCurrentCues",function(){return B}),A.d(V,"removeCuesInRange",function(){return U}),A.d(V,"getCuesInRange",function(){return L});var G=A("./src/utils/logger.ts");function I(y,x){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=y,x.dispatchEvent(O)}function R(y,x){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(x.id))try{if(y.addCue(x),!y.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(T){G.logger.debug("[texttrack-utils]: "+T);var C=new self.TextTrackCue(x.startTime,x.endTime,x.text);C.id=x.id,y.addCue(C)}O==="disabled"&&(y.mode=O)}function B(y){var x=y.mode;if(x==="disabled"&&(y.mode="hidden"),y.cues)for(var O=y.cues.length;O--;)y.removeCue(y.cues[O]);x==="disabled"&&(y.mode=x)}function U(y,x,O){var C=y.mode;if(C==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var T=L(y.cues,x,O),g=0;g<T.length;g++)y.removeCue(T[g]);C==="disabled"&&(y.mode=C)}function k(y,x){if(x<y[0].startTime)return 0;var O=y.length-1;if(x>y[O].endTime)return-1;for(var C=0,T=O;C<=T;){var g=Math.floor((T+C)/2);if(x<y[g].startTime)T=g-1;else if(x>y[g].startTime&&C<O)C=g+1;else return g}return y[C].startTime-x<x-y[T].startTime?C:T}function L(y,x,O){var C=[],T=k(y,x);if(T>-1)for(var g=T,d=y.length;g<d;g++){var o=y[g];if(o.startTime>=x&&o.endTime<=O)C.push(o);else if(o.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(re,V,A){"use strict";A.r(V);var G={toString:function(R){for(var B="",U=R.length,k=0;k<U;k++)B+="["+R.start(k).toFixed(3)+","+R.end(k).toFixed(3)+"]";return B}};V.default=G},"./src/utils/timescale-conversion.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"toTimescaleFromBase",function(){return I}),A.d(V,"toTimescaleFromScale",function(){return R}),A.d(V,"toMsFromMpegTsClock",function(){return B}),A.d(V,"toMpegTsClockFromTimescale",function(){return U});var G=9e4;function I(k,L,y,x){y===void 0&&(y=1),x===void 0&&(x=!1);var O=k*L*y;return x?Math.round(O):O}function R(k,L,y,x){return y===void 0&&(y=1),x===void 0&&(x=!1),I(k,L,1/y,x)}function B(k,L){return L===void 0&&(L=!1),I(k,1e3,1/G,L)}function U(k,L){return L===void 0&&(L=1),I(k,G,1/L)}},"./src/utils/typed-array.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"sliceUint8",function(){return G});function G(I,R,B){return Uint8Array.prototype.slice?I.slice(R,B):new Uint8Array(Array.prototype.slice.call(I,R,B))}},"./src/utils/vttcue.ts":function(re,V,A){"use strict";A.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],I=["start","middle","end","left","right"];function R(y,x){if(typeof x!="string")return!1;if(!Array.isArray(y))return!1;var O=x.toLowerCase();return~y.indexOf(O)?O:!1}function B(y){return R(G,y)}function U(y){return R(I,y)}function k(y){for(var x=arguments.length,O=new Array(x>1?x-1:0),C=1;C<x;C++)O[C-1]=arguments[C];for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var d in g)y[d]=g[d]}return y}function L(y,x,O){var C=this,T={enumerable:!0};C.hasBeenReset=!1;var g="",d=!1,o=y,u=x,s=O,w=null,p="",f=!0,_="auto",b="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",k({},T,{get:function(){return g},set:function(m){g=""+m}})),Object.defineProperty(C,"pauseOnExit",k({},T,{get:function(){return d},set:function(m){d=!!m}})),Object.defineProperty(C,"startTime",k({},T,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",k({},T,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",k({},T,{get:function(){return s},set:function(m){s=""+m,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",k({},T,{get:function(){return w},set:function(m){w=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",k({},T,{get:function(){return p},set:function(m){var E=B(m);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",k({},T,{get:function(){return f},set:function(m){f=!!m,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",k({},T,{get:function(){return _},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",k({},T,{get:function(){return b},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");b=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",k({},T,{get:function(){return h},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",k({},T,{get:function(){return c},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",k({},T,{get:function(){return l},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",k({},T,{get:function(){return a},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),C.displayState=void 0}return L.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"parseTimeStamp",function(){return R}),A.d(V,"fixLineBreaks",function(){return x}),A.d(V,"VTTParser",function(){return O});var G=A("./src/utils/vttcue.ts"),I=function(){function C(){}var T=C.prototype;return T.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function T(d,o,u,s){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(s||0)}var g=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?T(g[2],g[3],0,g[4]):T(g[1],g[2],g[3],g[4]):null}var B=function(){function C(){this.values=Object.create(null)}var T=C.prototype;return T.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},T.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},T.has=function(d){return d in this.values},T.alt=function(d,o,u){for(var s=0;s<u.length;++s)if(o===u[s]){this.set(d,o);break}},T.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},T.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},C}();function U(C,T,g,d){var o=d?C.split(d):[C];for(var u in o){if(typeof o[u]!="string")continue;var s=o[u].split(g);if(s.length!==2)continue;var w=s[0],p=s[1];T(w,p)}}var k=new G.default(0,0,""),L=k.align==="middle"?"middle":"center";function y(C,T,g){var d=C;function o(){var w=R(C);if(w===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),w}function u(w,p){var f=new B;U(w,function(h,c){var l;switch(h){case"region":for(var a=g.length-1;a>=0;a--)if(g[a].id===c){f.set(h,g[a].region);break}break;case"vertical":f.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),f.integer(h,l[0]),f.percent(h,l[0])&&f.set("snapToLines",!1),f.alt(h,l[0],["auto"]),l.length===2&&f.alt("lineAlign",l[1],["start",L,"end"]);break;case"position":l=c.split(","),f.percent(h,l[0]),l.length===2&&f.alt("positionAlign",l[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":f.percent(h,c);break;case"align":f.alt(h,c,["start",L,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var _=f.get("line","auto");_==="auto"&&k.line===-1&&(_=-1),p.line=_,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",L);var b=f.get("position","auto");b==="auto"&&k.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function s(){C=C.replace(/^\s+/,"")}if(s(),T.startTime=o(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),s(),T.endTime=o(),s(),u(C,T)}function x(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var T=C.prototype;return T.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var b=o.buffer,h=0;for(b=x(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
`;)++h;var c=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
`&&++h,o.buffer=b.substr(h),c}function s(b){U(b,function(h,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=u();var p=w.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:w=u();switch(o.state){case"HEADER":/:/.test(w)?s(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(w,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var _=w.indexOf("-->")!==-1;if(!w||_&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},T.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"generateCueId",function(){return O}),A.d(V,"parseWebVTT",function(){return T});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/demux/id3.ts"),B=A("./src/utils/timescale-conversion.ts"),U=A("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,L=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),w=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*s,o+=60*60*1e3*w,o},x=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function O(g,d,o){return x(g.toString())+x(d.toString())+x(o)}var C=function(d,o,u){var s=d[o],w=d[s.prevCC];if(!w||!w.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(p=w)!==null&&p!==void 0&&p.new;){var p;d.ccOffset+=s.start-w.start,s.new=!1,s=w,w=d[s.prevCC]}d.presentationOffset=u};function T(g,d,o,u,s,w,p,f){var _=new I.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(k,`
`).split(`
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,v=0,m,E=!0,M=!1;_.oncue=function(F){var j=u[s],W=u.ccOffset,D=(a-c)/9e4;if(j!=null&&j.new&&(v!==void 0?W=u.ccOffset=j.start:C(u,s,D)),D&&(W=D-u.presentationOffset),M){var P=F.endTime-F.startTime,H=Object(U.normalizePts)((F.startTime+W-v)*9e4,w*9e4)/9e4;F.startTime=H,F.endTime=H+P}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=O(F.startTime,F.endTime,Y)),F.endTime>0&&h.push(F)},_.onparsingerror=function(F){m=F},_.onflush=function(){if(m){f(m);return}p(h)},b.forEach(function(F){if(E)if(L(F,"X-TIMESTAMP-MAP=")){E=!1,M=!0,F.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?l=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{v=y(l)/1e3}catch(j){M=!1,m=j}return}else F===""&&(E=!1);_.parse(F+`
`)}),_.flush()}},"./src/utils/xhr-loader.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),I=A("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function U(L){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=L?L.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var k=U.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},k.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(y,x,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=x,this.callbacks=O,this.retryDelay=x.retryDelay,this.loadInternal()},k.loadInternal=function(){var y=this.config,x=this.context;if(!y)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var T=this.xhrSetup;try{if(T)try{T(O,x.url)}catch(o){O.open("GET",x.url,!0),T(O,x.url)}O.readyState||O.open("GET",x.url,!0);var g=this.context.headers;if(g)for(var d in g)O.setRequestHeader(d,g[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},x,O);return}x.rangeEnd&&O.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),O.send()},k.readystatechange=function(){var y=this.context,x=this.loader,O=this.stats;if(!y||!x)return;var C=x.readyState,T=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){x.onreadystatechange=null,x.onprogress=null;var g=x.status;if(g>=200&&g<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=x.response,o=d.byteLength):(d=x.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(O,y,d,x),!this.callbacks)return;var s={url:x.responseURL,data:d};this.callbacks.onSuccess(s,O,y,x)}else O.retry>=T.maxRetry||g>=400&&g<499?(G.logger.error(g+" while loading "+y.url),this.callbacks.onError({code:g,text:x.statusText},y,x)):(G.logger.warn(g+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,T.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout)},k.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(y){var x=this.stats;x.loaded=y.loaded,y.lengthComputable&&(x.total=y.total)},k.getCacheAge=function(){var y=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");y=x?parseFloat(x):null}return y},U}();V.default=B}}).default})},vHTk:function(st,ze,q){st.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(st,ze,q){"use strict";q.d(ze,"c",function(){return I}),q.d(ze,"b",function(){return R}),q.d(ze,"d",function(){return B}),q.d(ze,"a",function(){return k}),q.d(ze,"e",function(){return L});var re=q("9og8"),V=q("WmNS"),A=q.n(V),G=q("ErOA");function I(y){return Object(G.c)("libraries/".concat(y,".json"))}function R(){return Object(G.c)("library_tags.json")}function B(y){return U.apply(this,arguments)}function U(){return U=Object(re.a)(A.a.mark(function y(x){var O;return A.a.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,Object(G.b)("attachments/".concat(x,".json"));case 2:return O=T.sent,T.abrupt("return",O.status===0);case 4:case"end":return T.stop()}},y)})),U.apply(this,arguments)}function k(y){return Object(G.f)("libraries.json",y)}function L(y,x){return Object(G.g)("libraries/".concat(y,".json"),x)}},y5JW:function(st,ze,q){"use strict";q.d(ze,"c",function(){return g}),q.d(ze,"a",function(){return d});var re=q("DZo9"),V=q("8z0m"),A=q("+L6B"),G=q("2/Rp"),I=q("9og8"),R=q("miYZ"),B=q("tsqr"),U=q("k1fw"),k=q("oBTY"),L=q("WmNS"),y=q.n(L),x=q("cDcd"),O=q.n(x),C=q("m3rI"),T=q("wzkS"),g="\u3000\u3000";function d(o){var u=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var s=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,s)).toFixed(1)+" "+u[s]}ze.b=function(o){var u=o.value,s=u===void 0?[]:u,w=o.action,p=o.onChange,f=o.className,_=o.maxSize,b=_===void 0?150:_,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,l=o.accept,a=l===void 0?null:l,v={multiple:!1,fileList:s,accept:a,withCredentials:!0,beforeUpload:function(M){var F=M.size/1024/1024;return!0},action:"".concat(C.a.API_SERVER,"/api/attachments.json"),onChange:function(M){var F,j,W=Object(k.a)(M.fileList);if(W=W.map(function(H){return H.name.indexOf(g)===-1&&(H.name="".concat(H.name).concat(g).concat(d(H.size))),Object(U.a)({},H)}),M.file.status==="done"&&((F=M.file)===null||F===void 0||((j=F.response)===null||j===void 0)?void 0:j.status)===-1){var D,P;B.b.error((D=M.file)===null||D===void 0||((P=D.response)===null||P===void 0)?void 0:P.message),p([]);return}p(W)},onRemove:function(){var E=Object(I.a)(y.a.mark(function F(j){var W,D,P;return y.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(W=j.size/1024/1024,!(j.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(W<b){Y.next=7;break}return Y.abrupt("return",!0);case 7:if(D=j.response?j.response.id:j.uid,!D){Y.next=15;break}return Y.next=11,Object(T.d)(j.response?j.response.id:j.id);case 11:return P=Y.sent,Y.abrupt("return",P);case 15:return Y.abrupt("return",!0);case 16:case"end":return Y.stop()}},F)}));function M(F){return E.apply(this,arguments)}return M}()};function m(E){E.preventDefault(),E.stopPropagation()}return O.a.createElement("div",{className:"single-upload ".concat(f||"")},O.a.createElement(V.a,v,O.a.createElement(G.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),O.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M)"," ")))}}}]);