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.
140 lines
748 KiB
140 lines
748 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[73,5,7,16],{"+NIl":function(ut,Ze,te){(function(Z){Z(te("VrN/"))})(function(Z){"use strict";Z.defineMode("stex",function(G,D){"use strict";function K(C,S){C.cmdState.push(S)}function M(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function P(C){var S=C.cmdState.pop();S&&S.closeBracket()}function N(C){for(var S=C.cmdState,b=S.length-1;b>=0;b--){var d=S[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function k(C,S,b){return function(){this.name=C,this.bracketNo=0,this.style=S,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var A={};A.importmodule=k("importmodule","tag",["string","builtin"]),A.documentclass=k("documentclass","tag",["","atom"]),A.usepackage=k("usepackage","tag",["atom"]),A.begin=k("begin","tag",["atom"]),A.end=k("end","tag",["atom"]),A.label=k("label","tag",["atom"]),A.ref=k("ref","tag",["atom"]),A.eqref=k("eqref","tag",["atom"]),A.cite=k("cite","tag",["atom"]),A.bibitem=k("bibitem","tag",["atom"]),A.Bibitem=k("Bibitem","tag",["atom"]),A.RBibitem=k("RBibitem","tag",["atom"]),A.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(C,S){C.f=S}function x(C,S){var b;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return b=A.hasOwnProperty(d)?A[d]:A.DEFAULT,b=new b,K(S,b),_(S,O),b.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return _(S,function(s,u){return L(s,u,"\\]")}),"keyword";if(C.match("\\("))return _(S,function(s,u){return L(s,u,"\\)")}),"keyword";if(C.match("$$"))return _(S,function(s,u){return L(s,u,"$$")}),"keyword";if(C.match("$"))return _(S,function(s,u){return L(s,u,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(b=M(S),b)b.closeBracket(o),_(S,O);else return"error";return"bracket"}else return o=="{"||o=="["?(b=A.DEFAULT,b=new b,K(S,b),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),b=N(S),b.name=="begin"&&(b.argument=C.current()),b.styleIdentifier())}function L(C,S,b){if(C.eatSpace())return null;if(b&&C.match(b))return _(S,x),"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,S){var b=C.peek(),d;return b=="{"||b=="["?(d=M(S),d.openBracket(b),C.eat(b),_(S,x),"bracket"):/[ \t\r]/.test(b)?(C.eat(b),null):(_(S,x),P(S),x(C,S))}return{startState:function(){var C=D.inMathMode?function(S,b){return L(S,b)}:x;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,S){return S.f(C,S)},blankLine:function(C){C.f=x,C.cmdState.length=0},lineComment:"%"}}),Z.defineMIME("text/x-stex","stex"),Z.defineMIME("text/x-latex","stex")})},"19Vz":function(ut,Ze,te){(function(Z){Z(te("VrN/"))})(function(Z){Z.defineOption("placeholder","",function(k,A,_){var x=_&&_!=Z.Init;if(A&&!x)k.on("blur",M),k.on("change",P),k.on("swapDoc",P),Z.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){K(k)}),P(k);else if(!A&&x){k.off("blur",M),k.off("change",P),k.off("swapDoc",P),Z.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),G(k);var L=k.getWrapperElement();L.className=L.className.replace(" CodeMirror-empty","")}A&&!k.hasFocus()&&M(k)});function G(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function D(k){G(k);var A=k.state.placeholder=document.createElement("pre");A.style.cssText="height: 0; overflow: visible",A.style.direction=k.getOption("direction"),A.className="CodeMirror-placeholder CodeMirror-line-like";var _=k.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),A.appendChild(_),k.display.lineSpace.insertBefore(A,k.display.lineSpace.firstChild)}function K(k){setTimeout(function(){var A=!1,_=k.getInputField();_.nodeName=="TEXTAREA"?A=!_.value:k.lineCount()==1&&(A=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),A?D(k):G(k)},20)}function M(k){N(k)&&D(k)}function P(k){var A=k.getWrapperElement(),_=N(k);A.className=A.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?D(k):G(k)}function N(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(ut,Ze,te){(function(Z){Z(te("VrN/"))})(function(Z){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};Z.defineMode("xml",function(K,M){var P=K.indentUnit,N={},k=M.htmlMode?G:D;for(var A in k)N[A]=k[A];for(var A in M)N[A]=M[A];var _,x;function L(a,v){function g(U){return v.tokenize=U,U(a,v)}var m=a.next();if(m=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(S("atom","]]>")):null:a.match("--")?g(S("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=S("meta","?>"),"meta"):(_=a.eat("/")?"closeTag":"openTag",v.tokenize=O,"tag bracket");if(m=="&"){var R;return a.eat("#")?a.eat("x")?R=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):R=a.eatWhile(/[\d]/)&&a.eat(";"):R=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),R?"atom":"error"}else return a.eatWhile(/[^&<]/),null}L.isInText=!0;function O(a,v){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return v.tokenize=L,_=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return _="equals",null;if(g=="<"){v.tokenize=L,v.state=u,v.tagName=v.tagStart=null;var m=v.tokenize(a,v);return m?m+" tag error":"tag error"}else return/[\'\"]/.test(g)?(v.tokenize=C(g),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(g,m){for(;!g.eol();)if(g.next()==a){m.tokenize=O;break}return"string"};return v.isInAttribute=!0,v}function S(a,v){return function(g,m){for(;!g.eol();){if(g.match(v)){m.tokenize=L;break}g.next()}return a}}function b(a){return function(v,g){for(var m;(m=v.next())!=null;){if(m=="<")return g.tokenize=b(a+1),g.tokenize(v,g);if(m==">")if(a==1){g.tokenize=L;break}else return g.tokenize=b(a-1),g.tokenize(v,g)}return"meta"}}function d(a,v,g){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=g,(N.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,v){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!N.contextGrabbers.hasOwnProperty(g)||!N.contextGrabbers[g].hasOwnProperty(v))return;o(a)}}function u(a,v,g){return a=="openTag"?(g.tagStart=v.column(),T):a=="closeTag"?f:u}function T(a,v,g){return a=="word"?(g.tagName=v.current(),x="tag",y):N.allowMissingTagName&&a=="endTag"?(x="tag bracket",y(a,v,g)):(x="error",T)}function f(a,v,g){if(a=="word"){var m=v.current();return g.context&&g.context.tagName!=m&&N.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==m||N.matchClosing===!1?(x="tag",p):(x="tag error",w)}else return N.allowMissingTagName&&a=="endTag"?(x="tag bracket",p(a,v,g)):(x="error",w)}function p(a,v,g){return a!="endTag"?(x="error",p):(o(g),u)}function w(a,v,g){return x="error",p(a,v,g)}function y(a,v,g){if(a=="word")return x="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var m=g.tagName,R=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||N.autoSelfClosers.hasOwnProperty(m)?s(g,m):(s(g,m),g.context=new d(g,m,R==g.indented)),u}return x="error",y}function h(a,v,g){return a=="equals"?c:(N.allowMissing||(x="error"),y(a,v,g))}function c(a,v,g){return a=="string"?l:a=="word"&&N.allowUnquoted?(x="string",y):(x="error",y(a,v,g))}function l(a,v,g){return a=="string"?l:y(a,v,g)}return{startState:function(a){var v={tokenize:L,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;_=null;var g=v.tokenize(a,v);return(g||_)&&g!="comment"&&(x=null,v.state=v.state(_||g,a,v),x&&(g=x=="error"?g+" error":x)),g},indent:function(a,v,g){var m=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(m&&m.noIndent)return Z.Pass;if(a.tokenize!=O&&a.tokenize!=L)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return N.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(N.multilineTagIndentFactor||1);if(N.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var R=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(R&&R[1])for(;m;)if(m.tagName==R[2]){m=m.prev;break}else if(N.implicitlyClosed.hasOwnProperty(m.tagName))m=m.prev;else break;else if(R)for(;m;){var U=N.contextGrabbers[m.tagName];if(U&&U.hasOwnProperty(R[2]))m=m.prev;else break}for(;m&&m.prev&&!m.startOfLine;)m=m.prev;return m?m.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:N.htmlMode?"html":"xml",helperType:N.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],g=a.context;g;g=g.prev)g.tagName&&v.push(g.tagName);return v.reverse()}}}),Z.defineMIME("text/xml","xml"),Z.defineMIME("application/xml","xml"),Z.mimeModes.hasOwnProperty("text/html")||Z.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3Rgl":function(ut,Ze,te){"use strict";te.r(Ze);var Z=te("+L6B"),G=te("2/Rp"),D=te("6UJt"),K=te("DFOY"),M=te("/zsF"),P=te("PArb"),N=te("5NDa"),k=te("5rEg"),A=te("OaEy"),_=te("2fM7"),x=te("14J3"),L=te("BMrR"),O=te("jCWc"),C=te("kPKH"),S=te("sPJy"),b=te("bE4q"),d=te("miYZ"),o=te("tsqr"),s=te("k1fw"),u=te("9og8"),T=te("y8nQ"),f=te("Vl3Y"),p=te("tJVT"),w=te("PpiC"),y=te("B9cy"),h=te("Ol7k"),c=te("lUTK"),l=te("BvKs"),a=te("WmNS"),v=te.n(a),g=te("q1tI"),m=te.n(g),R=te("Ot1p"),U=te("Ty5D"),W=te("9kvl"),X=te("55Ip"),B=te("gJ3r"),F=te("m7e3"),z=te.n(F),Q=l.a.SubMenu,ie=h.a.Content,ce=h.a.Sider,Ce=function(Te){var se,de,q,oe,ye,fe,Le,ve=Te.graduation,De=Te.globalSetting,be=Te.loading,we=Te.user,Re=Te.dispatch,Fe=Object(w.a)(Te,["graduation","globalSetting","loading","user","dispatch"]),Pe=Object(U.i)(),Ae=Object(U.h)(),Se=we.userInfo,We=f.a.useForm(),Ge=Object(p.a)(We,1),Xe=Ge[0],je=ve.addTopicData,qe=function(){var Ue=Object(u.a)(v.a.mark(function Ke(){var xe,$e,Ye;return v.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return xe=Xe.getFieldsValue(),$e=Object(s.a)({},xe),$e.city&&($e.province=$e.city[0],$e.city=$e.city[1]),Ie.next=5,Re({type:"graduation/addTopic",payload:{coursesId:Pe.coursesId,attachment_ids:[],graduation_topic:$e}});case 5:Ye=Ie.sent,Ye.status?o.b.error(Ye.message):W.d.push("/classrooms/".concat(Pe.coursesId,"/graduation_topics/").concat(Pe.categoryId));case 7:case"end":return Ie.stop()}},Ke)}));return function(){return Ue.apply(this,arguments)}}();return Object(g.useEffect)(function(){Re({type:"graduation/addTopicDefaultData",payload:Object(s.a)({},Pe)})},[Pe.coursesId]),m.a.createElement("section",{className:"edu-container"},m.a.createElement("section",{className:"animated fadeIn"},m.a.createElement("aside",{className:"mt10"},Se&&m.a.createElement(b.a,{separator:">"},m.a.createElement(b.a.Item,null,m.a.createElement(X.a,{to:"".concat(Se.first_category_url)},Se==null||((se=Se.course)===null||se===void 0)?void 0:se.course_name)),m.a.createElement(b.a.Item,null,m.a.createElement(X.a,{to:"/classrooms/".concat(Pe.coursesId,"/graduation_topics/").concat(Pe.categoryId)},"\u6BD5\u8BBE\u9009\u9898")),m.a.createElement(b.a.Item,null,"\u65B0\u5EFA"))),m.a.createElement("aside",{className:[z.a.title,"mt20"].join(" ")},m.a.createElement(L.a,{style:{width:"100%"}},m.a.createElement(C.a,{flex:"1"},m.a.createElement("strong",{className:"font20 ml5"},"\u65B0\u5EFA\u6BD5\u8BBE\u9009\u9898")),m.a.createElement(C.a,null,m.a.createElement(X.a,{className:"font16 c-light-black",to:"/classrooms/".concat(Pe.coursesId,"/exercise")},"\u8FD4\u56DE"))))),m.a.createElement("section",{className:[z.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},m.a.createElement(f.a,{layout:"vertical",form:Xe,scrollToFirstError:!0,onFinish:function(){var Ue=Object(u.a)(v.a.mark(function Ke(xe){return v.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:qe();case 1:case"end":return Ye.stop()}},Ke)}));return function(Ke){return Ue.apply(this,arguments)}}()},m.a.createElement(f.a.Item,{name:"tea_id",label:"\u6307\u5BFC\u8001\u5E08\uFF1A",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08"}]},m.a.createElement(_.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08",style:{width:200}},(de=je.teacher_list)===null||de===void 0?void 0:de.map(function(Ue,Ke){return m.a.createElement(_.a.Option,{value:Ue.id,key:Ke},Ue.name)}))),m.a.createElement(f.a.Item,{name:"name",label:"\u9009\u9898\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},m.a.createElement(k.a,{maxLength:60,size:"large",placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),m.a.createElement(P.a,null),m.a.createElement(f.a.Item,{label:"\u9009\u9898\u7B80\u4ECB",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}]},m.a.createElement(R.a,{watch:!0,placeholder:"\u8BF7\u7B80\u8981\u8BF4\u660E\u9009\u9898\u5185\u5BB9\uFF0C\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"})),m.a.createElement(L.a,{gutter:[20,0]},m.a.createElement(C.a,{flex:"1"},m.a.createElement(f.a.Item,{name:"topic_type"},m.a.createElement(_.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u7C7B\u578B"},(q=je.topic_type)===null||q===void 0?void 0:q.map(function(Ue,Ke){return m.a.createElement(_.a.Option,{value:Ue.id,key:Ke},Ue.name)})))),m.a.createElement(C.a,{flex:"1"},m.a.createElement(f.a.Item,{name:"topic_source"},m.a.createElement(_.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6765\u6E90"},(oe=je.topic_source)===null||oe===void 0?void 0:oe.map(function(Ue,Ke){return m.a.createElement(_.a.Option,{value:Ue.id,key:Ke},Ue.name)})))),m.a.createElement(C.a,{flex:"1"},m.a.createElement(f.a.Item,{name:"topic_property_first"},m.a.createElement(_.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D281"},(ye=je.topic_property_first)===null||ye===void 0?void 0:ye.map(function(Ue,Ke){return m.a.createElement(_.a.Option,{value:Ue.id,key:Ke},Ue.name)})))),m.a.createElement(C.a,{flex:"1"},m.a.createElement(f.a.Item,{name:"topic_property_second"},m.a.createElement(_.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D282"},(fe=je.topic_property_second)===null||fe===void 0?void 0:fe.map(function(Ue,Ke){return m.a.createElement(_.a.Option,{value:Ue.id,key:Ke},Ue.name)})))),m.a.createElement(C.a,{flex:"150px"})),m.a.createElement(P.a,null),m.a.createElement(f.a.Item,{name:"source_unit",label:"\u9009\u9898\u6765\u6E90\u5355\u4F4D\uFF1A"},m.a.createElement(k.a,{width:"200",size:"large",style:{width:200},placeholder:"\u8BF7\u586B\u5199\u6765\u6E90\u5355\u4F4D"})),m.a.createElement(f.a.Item,{name:"topic_repeat",label:"\u9009\u9898\u91CD\u590D\u60C5\u51B5\uFF1A"},m.a.createElement(_.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u91CD\u590D\u60C5\u51B5",style:{width:200}},(Le=je.topic_repeat)===null||Le===void 0?void 0:Le.map(function(Ue,Ke){return m.a.createElement(_.a.Option,{value:Ue.id,key:Ke},Ue.name)}))),m.a.createElement(f.a.Item,{name:"city",label:"\u8C03\u7814\u6216\u5B9E\u4E60\u5730\u70B9\uFF1A"},m.a.createElement(K.a,{size:"large",style:{width:200},options:B.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730"})))),m.a.createElement("aside",{className:z.a.btns},m.a.createElement(G.a,{type:"primary",onClick:function(){Xe.submit()}},"\u4FDD\u5B58"),m.a.createElement(X.a,{to:"/classrooms/".concat(Pe.coursesId,"/graduation_topics/").concat(Pe.categoryId)},"\u53D6\u6D88")))};Ze.default=Object(W.a)(function(pe){var Te=pe.graduation,se=pe.loading,de=pe.user,q=pe.globalSetting;return{graduation:Te,globalSetting:q,user:de,loading:se.effects}})(Ce)},"55Ip":function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return s});var Z=te("Ty5D"),G=te("dI71"),D=te("q1tI"),K=te.n(D),M=te("YS25"),P=te("17x9"),N=te.n(P),k=te("wx14"),A=te("zLVn"),_=te("9R94"),x=function(c){Object(G.a)(l,c);function l(){for(var v,g=arguments.length,m=new Array(g),R=0;R<g;R++)m[R]=arguments[R];return v=c.call.apply(c,[this].concat(m))||this,v.history=Object(M.a)(v.props),v}var a=l.prototype;return a.render=function(){return K.a.createElement(Z.c,{history:this.history,children:this.props.children})},l}(K.a.Component),L=function(c){Object(G.a)(l,c);function l(){for(var v,g=arguments.length,m=new Array(g),R=0;R<g;R++)m[R]=arguments[R];return v=c.call.apply(c,[this].concat(m))||this,v.history=Object(M.b)(v.props),v}var a=l.prototype;return a.render=function(){return K.a.createElement(Z.c,{history:this.history,children:this.props.children})},l}(K.a.Component),O=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(M.c)(l,null,null,a):l},S=function(l){return l},b=K.a.forwardRef;typeof b=="undefined"&&(b=S);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=b(function(c,l){var a=c.innerRef,v=c.navigate,g=c.onClick,m=Object(A.a)(c,["innerRef","navigate","onClick"]),R=m.target,U=Object(k.a)({},m,{onClick:function(X){try{g&&g(X)}catch(B){throw X.preventDefault(),B}!X.defaultPrevented&&X.button===0&&(!R||R==="_self")&&!d(X)&&(X.preventDefault(),v())}});return S!==b?U.ref=l||a:U.ref=a,K.a.createElement("a",U)}),s=b(function(c,l){var a=c.component,v=a===void 0?o:a,g=c.replace,m=c.to,R=c.innerRef,U=Object(A.a)(c,["component","replace","to","innerRef"]);return K.a.createElement(Z.e.Consumer,null,function(W){W||Object(_.a)(!1);var X=W.history,B=C(O(m,W.location),W.location),F=B?X.createHref(B):"",z=Object(k.a)({},U,{href:F,navigate:function(){var ie=O(m,W.location),ce=g?X.replace:X.push;ce(ie)}});return S!==b?z.ref=l||R:z.innerRef=R,K.a.createElement(v,z)})});if(!1)var u,T;var f=function(l){return l},p=K.a.forwardRef;typeof p=="undefined"&&(p=f);function w(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(v){return v}).join(" ")}var y=p(function(c,l){var a=c["aria-current"],v=a===void 0?"page":a,g=c.activeClassName,m=g===void 0?"active":g,R=c.activeStyle,U=c.className,W=c.exact,X=c.isActive,B=c.location,F=c.sensitive,z=c.strict,Q=c.style,ie=c.to,ce=c.innerRef,Ce=Object(A.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(Z.e.Consumer,null,function(pe){pe||Object(_.a)(!1);var Te=B||pe.location,se=C(O(ie,Te),Te),de=se.pathname,q=de&&de.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),oe=q?Object(Z.f)(Te.pathname,{path:q,exact:W,sensitive:F,strict:z}):null,ye=!!(X?X(oe,Te):oe),fe=ye?w(U,m):U,Le=ye?Object(k.a)({},Q,{},R):Q,ve=Object(k.a)({"aria-current":ye&&v||null,className:fe,style:Le,to:se},Ce);return f!==p?ve.ref=l||ce:ve.innerRef=ce,K.a.createElement(s,ve)})});if(!1)var h},"7ahc":function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return T});var Z=te("k1fw"),G=te("0Owb"),D=te("+L6B"),K=te("2/Rp"),M=te("y8nQ"),P=te("Vl3Y"),N=te("tJVT"),k=te("OaEy"),A=te("2fM7"),_=te("q1tI"),x=te.n(_),L=te("VrN/"),O=te.n(L),C=te("p77/"),S=te.n(C),b=te("c5Ni"),d=te.n(b),o=A.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Ze.b=function(f){var p=f.callback,w=f.onCancel,y=Object(_.useState)("python"),h=Object(N.a)(y,2),c=h[0],l=h[1];function a(g){l(u[g][1])}function v(g){p(g)}return x.a.createElement(P.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),x.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(A.a,{onChange:a},Object.keys(u).map(function(g){return x.a.createElement(o,{key:g,value:g},u[g][0])}))),x.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(T,{mode:c})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(K.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function T(f){var p=f.value,w=f.onChange,y=f.mode,h=f.options,c=h===void 0?{}:h,l=Object(_.useRef)(),a=Object(_.useState)(),v=Object(N.a)(a,2),g=v[0],m=v[1];return Object(_.useEffect)(function(){if(g){function R(U){var W=U.getValue();w&&w(W)}return g.on("change",R),function(){g.off("change",R)}}},[g,w]),Object(_.useEffect)(function(){g&&g.setOption("mode",y)},[g,y]),Object(_.useEffect)(function(){g&&((p!==g.getValue()||p==="")&&setTimeout(function(){g.setValue(p||" ")},300))},[g,p]),Object(_.useEffect)(function(){if(l.current&&!g){var R=O.a.fromTextArea(l.current,Object(Z.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));m(R)}},[l.current,g]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:l}))}},"8EBN":function(ut,Ze,te){(function(Z){Z(te("VrN/"))})(function(Z){"use strict";Z.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G<Z.modeInfo.length;G++){var D=Z.modeInfo[G];D.mimes&&(D.mime=D.mimes[0])}Z.findModeByMIME=function(K){K=K.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.mime==K)return P;if(P.mimes){for(var N=0;N<P.mimes.length;N++)if(P.mimes[N]==K)return P}}if(/\+xml$/.test(K))return Z.findModeByMIME("application/xml");if(/\+json$/.test(K))return Z.findModeByMIME("application/json")},Z.findModeByExtension=function(K){K=K.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.ext){for(var N=0;N<P.ext.length;N++)if(P.ext[N]==K)return P}}},Z.findModeByFileName=function(K){for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.file&&P.file.test(K))return P}var N=K.lastIndexOf("."),k=N>-1&&K.substring(N+1,K.length);if(k)return Z.findModeByExtension(k)},Z.findModeByName=function(K){K=K.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.name.toLowerCase()==K)return P;if(P.alias){for(var N=0;N<P.alias.length;N++)if(P.alias[N].toLowerCase()==K)return P}}}})},"9Bee":function(ut,Ze,te){"use strict";var Z=te("k1fw"),G=te("tJVT"),D=te("q1tI"),K=te.n(D),M=te("vg9a"),P=te("DlQD"),N=te.n(P),k=te("rUJ1");function A(z,Q){var ie=z.match(/^(\s+)(?:```)/);if(ie===null)return Q;var ce=ie[1];return Q.split(`
|
|
`).map(function(Ce){var pe=Ce.match(/^\s+/);if(pe===null)return Ce;var Te=Object(G.a)(pe,1),se=Te[0];return se.length>=ce.length?Ce.slice(ce.length):Ce}).join(`
|
|
`)}var _=[],x=["<ul>"],L=new N.a.Renderer,O=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){_.length=0,x=["<ul>"]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(z,Q,ie,ce){if(Q>=z.length||z[Q].level<=ie)return Q;var Ce=z[Q];ce.push("<li><a href='#"+Ce.anchor+"'>"+Ce.text+"</a>"),Q++;var pe=[];return Q=b(z,Q,Ce.level,pe),pe.length>0&&(ce.push("<ul>"),pe.forEach(function(Te){ce.push(Te)}),ce.push("</ul>")),ce.push("</li>"),Q=b(z,Q,ie,ce),Q}function d(){return b(_,0,0,x),x.push("</ul>"),x.join("")}var o={heading:function(Q){var ie=O.exec(Q);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},fences:function(Q){var ie=this.rules.block.fences.exec(Q);if(ie){var ce=ie[0],Ce=A(ce,ie[3]||""),pe=ie[2]?ie[2].trim():ie[2];if(["latex","katex","math"].indexOf(pe)>=0){var Te=T(),se=Ce;Ce=Te,f[Te]={type:"block",expression:se}}return{type:"code",raw:ce,lang:pe,text:Ce}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,T=function(){return"__special_katext_id_".concat(u++,"__")},f={};function p(){return f}function w(){u=0,f={}}function y(z){return z=z.replace(s,function(Q,ie){var ce=T();return f[ce]={type:"inline",expression:ie},ce}),z}var h=L.listitem;L.listitem=function(z){return h(y(z))};var c=L.paragraph;L.paragraph=function(z){return c(y(z))};var l=L.tablecell;L.tablecell=function(z,Q){return l(y(z),Q)},L.code=function(z,Q,ie){var ce=(Q||"").match(/\S*/)[0];return ce?["latex","katex","math"].indexOf(ce)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Q,'">').concat(ie?z:Object(k.escape)(z,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ie?z:Object(k.escape)(z,!0))+"</code></pre>"},L.heading=function(z,Q,ie){var ce=this.options.headerPrefix+ie.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return _.push({anchor:ce,level:Q,text:z}),"<h"+Q+' id="'+ce+'">'+z+"</h"+Q+">"},N.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),N.a.use({tokenizer:o,renderer:L});var a=N.a,v=te("SJMd"),g=te("ulZh"),m=te.n(g),R=te("m3rI"),U=te("Oy/b"),W=te("p5ED"),X=/<pre[^>]*>/g;function B(z){var Q=document.createElement("div");return Q.innerHTML=z,Q.childNodes.length===0?"":Q.childNodes[0].nodeValue}var F=Ze.a=function(z){var Q=z.value,ie=Q===void 0?"":Q,ce=z.className,Ce=z.showTextOnly,pe=z.showLines,Te=z.style,se=Te===void 0?{}:Te,de=z.stylesPrev,q=de===void 0?{}:de,oe=String(ie),ye=Object(D.useState)(""),fe=Object(G.a)(ye,2),Le=fe[0],ve=fe[1],De=Object(D.useMemo)(function(){try{var Fe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Pe=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ae=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;oe=oe.replace(Fe,"("+R.a.API_SERVER+"/api/attachments/").replace(Pe,'"'+R.a.API_SERVER+"/api/attachments/").replace(Ae,'"'+R.a.API_SERVER+"/files/uploads/").replace(/\r\n/g,`
|
|
`),oe=oe.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Xe){}var Se=a(oe),We=p();if(oe.match(/\[TOC\]/)&&(Se=Se.replace("<p>[TOC]</p>",d()),C()),Se=Se.replace(/(__special_katext_id_\d+__)/g,function(Xe,je){var qe=We[je],Ue=qe.type,Ke=qe.expression;return Object(U.renderToString)(B(Ke)||"",{displayMode:Ue==="block",throwOnError:!1,output:"html"})}),Se=Se.replace(/▁/g,"\u2581\u2581\u2581"),w(),Ce){var Ge=document.createElement("div");return Ge.innerHTML=Se,Ge.innerText}return setTimeout(function(){return Re()},500),Se},[oe]),be=Object(D.useRef)();S.WebkitLineClamp=pe,pe&&(se=Object(Z.a)(Object(Z.a)({},se),S));function we(Fe){var Pe=Fe.target;if(Pe.tagName.toUpperCase()==="A"){var Ae=Pe.getAttribute("href");if(Ae.indexOf("office")>-1)Fe.preventDefault(),ve(Ae);else if(Ae.startsWith("#")){Fe.preventDefault();var Se=document.getElementById(Ae.replace("#",""));Se&&Se.scrollIntoView(!0)}}}var Re=function(){var Pe,Ae=(Pe=be.current)===null||Pe===void 0?void 0:Pe.querySelectorAll("video");Ae==null||Ae.forEach(function(Se){if(Se.oncontextmenu=function(){return!1},Se.src.indexOf(".m3u8")>-1&&!Se.canPlayType("application/vnd.apple.mpegurl")){if(m.a.isSupported()){var We=new m.a;We.loadSource(Se.src),We.attachMedia(Se)}}})};return Object(D.useEffect)(function(){if(be.current&&De&&(De.match(X)&&window.PR.prettyPrint()),be.current)return be.current.addEventListener("click",we),function(){be.current.removeEventListener("click",we),w(),C()}},[De,be.current,we]),K.a.createElement(K.a.Fragment,null,K.a.createElement("div",{ref:be,style:Object(Z.a)({},se),className:"".concat(ce||""," markdown-body "),dangerouslySetInnerHTML:{__html:De}}),K.a.createElement(W.a,{close:!0,data:Le,type:Le!=null&&Le.length?"office":"",style:Object(Z.a)({},q),onClose:function(){return ve("")}}))}},"9VGf":function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return D});var Z=te("q1tI"),G=te.n(Z);function D(K,M){var P=Object(Z.useRef)();Object(Z.useEffect)(function(){P.current=K}),Object(Z.useEffect)(function(){function N(){P.current()}if(M!==null){var k=setInterval(N,M);return function(){return clearInterval(k)}}},[M])}},BU3w:function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return P});var Z=te("MNnm"),G="rc-util-key";function D(N){if(N.attachTo)return N.attachTo;var k=document.querySelector("head");return k||document.body}function K(N){var k,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(Z.a)())return null;var _=document.createElement("style");if((k=A.csp)===null||k===void 0?void 0:k.nonce){var x;_.nonce=(x=A.csp)===null||x===void 0?void 0:x.nonce}_.innerHTML=N;var L=D(A),O=L.firstChild;return A.prepend&&L.prepend?L.prepend(_):A.prepend&&O?L.insertBefore(_,O):L.appendChild(_),_}var M=new Map;function P(N,k){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_=D(A);if(!M.has(_)){var x=K("",A),L=x.parentNode;M.set(_,L),L.removeChild(x)}var O=Array.from(M.get(_).children).find(function(o){return o.tagName==="STYLE"&&o[G]===k});if(O){var C,S;if(((C=A.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((S=A.csp)===null||S===void 0?void 0:S.nonce)){var b;O.nonce=(b=A.csp)===null||b===void 0?void 0:b.nonce}return O.innerHTML!==N&&(O.innerHTML=N),O}var d=K(N,A);return d[G]=k,d}},Bd2K:function(ut,Ze,te){(function(Z){Z(te("VrN/"),te("osHv"))})(function(Z){Z.defineOption("autoCloseTags",!1,function(A,_,x){if(x!=Z.Init&&x&&A.removeKeyMap("autoCloseTags"),!_)return;var L={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(L["'/'"]=function(O){return P(O)}),(typeof _!="object"||_.whenOpening!==!1)&&(L["'>'"]=function(O){return K(O)}),A.addKeyMap(L)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function K(A){if(A.getOption("disableInput"))return Z.Pass;for(var _=A.listSelections(),x=[],L=A.getOption("autoCloseTags"),O=0;O<_.length;O++){if(!_[O].empty())return Z.Pass;var C=_[O].head,S=A.getTokenAt(C),b=Z.innerMode(A.getMode(),S.state),d=b.state,o=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),s=o&&o.name;if(!s)return Z.Pass;var u=b.mode.configuration=="html",T=typeof L=="object"&&L.dontCloseTags||u&&G,f=typeof L=="object"&&L.indentTags||u&&D;S.end>C.ch&&(s=s.slice(0,s.length-S.end+C.ch));var p=s.toLowerCase();if(!s||S.type=="string"&&(S.end!=C.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&o.close||S.string.indexOf("/")==C.ch-S.start-1||T&&N(T,p)>-1||k(A,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],s,C,!0))return Z.Pass;var w=typeof L=="object"&&L.emptyTags;if(w&&N(w,s)>-1){x[O]={text:"/>",newPos:Z.Pos(C.line,C.ch+2)};continue}var y=f&&N(f,p)>-1;x[O]={indent:y,text:">"+(y?`
|
|
|
|
`:"")+"</"+s+">",newPos:y?Z.Pos(C.line+1,0):Z.Pos(C.line,C.ch+1)}}for(var h=typeof L=="object"&&L.dontIndentOnAutoClose,O=_.length-1;O>=0;O--){var c=x[O];A.replaceRange(c.text,_[O].head,_[O].anchor,"+insert");var l=A.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},A.setSelections(l),!h&&c.indent&&(A.indentLine(c.newPos.line,null,!0),A.indentLine(c.newPos.line+1,null,!0))}}function M(A,_){for(var x=A.listSelections(),L=[],O=_?"/":"</",C=A.getOption("autoCloseTags"),S=typeof C=="object"&&C.dontIndentOnSlash,b=0;b<x.length;b++){if(!x[b].empty())return Z.Pass;var d=x[b].head,o=A.getTokenAt(d),s=Z.innerMode(A.getMode(),o.state),u=s.state;if(_&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return Z.Pass;var T,f=s.mode.name!="xml"&&A.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")T=O+"script";else if(f&&s.mode.name=="css")T=O+"style";else{var p=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!p||p.length&&k(A,p,p[p.length-1],d))return Z.Pass;T=O+p[p.length-1]}A.getLine(d.line).charAt(o.end)!=">"&&(T+=">"),L[b]=T}if(A.replaceSelections(L),x=A.listSelections(),!S)for(var b=0;b<x.length;b++)(b==x.length-1||x[b].head.line<x[b+1].head.line)&&A.indentLine(x[b].head.line)}function P(A){return A.getOption("disableInput")?Z.Pass:M(A,!0)}Z.commands.closeTag=function(A){return M(A)};function N(A,_){if(A.indexOf)return A.indexOf(_);for(var x=0,L=A.length;x<L;++x)if(A[x]==_)return x;return-1}function k(A,_,x,L,O){if(!Z.scanForClosingTag)return!1;var C=Math.min(A.lastLine()+1,L.line+500),S=Z.scanForClosingTag(A,L,null,C);if(!S||S.tag!=x)return!1;for(var b=O?1:0,d=_.length-1;d>=0&&_[d]==x;d--)++b;L=S.to;for(var d=1;d<b;d++){var o=Z.scanForClosingTag(A,L,null,C);if(!o||o.tag!=x)return!1;L=o.to}return!0}})},BjJ7:function(ut,Ze,te){"use strict";te.d(Ze,"d",function(){return G}),te.d(Ze,"c",function(){return D}),te.d(Ze,"e",function(){return K}),te.d(Ze,"b",function(){return M}),te.d(Ze,"a",function(){return N});var Z=te("m3rI");function G(k){var A=!0;if(k.length>0){for(var _=0;_<k.length;_++)if(k[_].compile_success==0||!k[_].compile_success){A=!1;break}}else A=!1;return A}function D(k){for(var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],x=0;x<k.length;x++){var L=k[x],O=A?"".concat(A,"/").concat(L.name):"".concat(L.name);_.push({title:L.name,isLeaf:!(L.type==="tree"),key:O})}return _}function K(k,A,_){for(var x=0;x<k.length;x++){var L=k[x];if(L.key===A){L.children=_;break}L.children&&K(L.children,A,_)}return k}function M(k,A,_){var x;return function(){var L=this,O=arguments,C=function(){x=null,_||k.apply(L,O)},S=_&&!x;clearTimeout(x),x=setTimeout(C,A),S&&k.apply(L,O)}}var P=!0,N=Z.a.API_SERVER},"C+DQ":function(ut,Ze,te){},DlQD:function(ut,Ze,te){(function(Z,G){ut.exports=G()})(this,function(){"use strict";function Z(ne,ae){for(var le=0;le<ae.length;le++){var Y=ae[le];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(ne,Y.key,Y)}}function G(ne,ae,le){return ae&&Z(ne.prototype,ae),le&&Z(ne,le),ne}function D(ne,ae){if(!ne)return;if(typeof ne=="string")return K(ne,ae);var le=Object.prototype.toString.call(ne).slice(8,-1);if(le==="Object"&&ne.constructor&&(le=ne.constructor.name),le==="Map"||le==="Set")return Array.from(ne);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return K(ne,ae)}function K(ne,ae){(ae==null||ae>ne.length)&&(ae=ne.length);for(var le=0,Y=new Array(ae);le<ae;le++)Y[le]=ne[le];return Y}function M(ne,ae){var le;if(typeof Symbol=="undefined"||ne[Symbol.iterator]==null){if(Array.isArray(ne)||(le=D(ne))||ae&&ne&&typeof ne.length=="number"){le&&(ne=le);var Y=0;return function(){return Y>=ne.length?{done:!0}:{done:!1,value:ne[Y++]}}}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 le=ne[Symbol.iterator](),le.next.bind(le)}function P(ne,ae){return ae={exports:{}},ne(ae,ae.exports),ae.exports}var N=P(function(ne){function ae(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function le(Y){ne.exports.defaults=Y}ne.exports={defaults:ae(),getDefaults:ae,changeDefaults:le}}),k=N.defaults,A=N.getDefaults,_=N.changeDefaults,x=/[&<>"']/,L=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,S={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(ae){return S[ae]};function d(ne,ae){if(ae){if(x.test(ne))return ne.replace(L,b)}else if(O.test(ne))return ne.replace(C,b);return ne}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ne){return ne.replace(o,function(ae,le){return le=le.toLowerCase(),le==="colon"?":":le.charAt(0)==="#"?le.charAt(1)==="x"?String.fromCharCode(parseInt(le.substring(2),16)):String.fromCharCode(+le.substring(1)):""})}var u=/(^|[^\[])\^/g;function T(ne,ae){ne=ne.source||ne,ae=ae||"";var le={replace:function($,J){return J=J.source||J,J=J.replace(u,"$1"),ne=ne.replace($,J),le},getRegex:function(){return new RegExp(ne,ae)}};return le}var f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(ne,ae,le){if(ne){var Y;try{Y=decodeURIComponent(s(le)).replace(f,"").toLowerCase()}catch($){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ae&&!p.test(le)&&(le=a(ae,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch($){return null}return le}var y={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ne,ae){y[" "+ne]||(h.test(ne)?y[" "+ne]=ne+"/":y[" "+ne]=R(ne,"/",!0)),ne=y[" "+ne];var le=ne.indexOf(":")===-1;return ae.substring(0,2)==="//"?le?ae:ne.replace(c,"$1")+ae:ae.charAt(0)==="/"?le?ae:ne.replace(l,"$1")+ae:ne+ae}var v={exec:function(){}};function g(ne){for(var ae=1,le,Y;ae<arguments.length;ae++){le=arguments[ae];for(Y in le)Object.prototype.hasOwnProperty.call(le,Y)&&(ne[Y]=le[Y])}return ne}function m(ne,ae){var le=ne.replace(/\|/g,function(J,ee,me){for(var Ee=!1,ke=ee;--ke>=0&&me[ke]==="\\";)Ee=!Ee;return Ee?"|":" |"}),Y=le.split(/ \|/),$=0;if(Y.length>ae)Y.splice(ae);else for(;Y.length<ae;)Y.push("");for(;$<Y.length;$++)Y[$]=Y[$].trim().replace(/\\\|/g,"|");return Y}function R(ne,ae,le){var Y=ne.length;if(Y===0)return"";for(var $=0;$<Y;){var J=ne.charAt(Y-$-1);if(J===ae&&!le)$++;else if(J!==ae&&le)$++;else break}return ne.substr(0,Y-$)}function U(ne,ae){if(ne.indexOf(ae[1])===-1)return-1;for(var le=ne.length,Y=0,$=0;$<le;$++)if(ne[$]==="\\")$++;else if(ne[$]===ae[0])Y++;else if(ne[$]===ae[1]&&(Y--,Y<0))return $;return-1}function W(ne){ne&&ne.sanitize&&!ne.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 X={escape:d,unescape:s,edit:T,cleanUrl:w,resolveUrl:a,noopTest:v,merge:g,splitCells:m,rtrim:R,findClosingBracket:U,checkSanitizeDeprecation:W},B=N.defaults,F=X.rtrim,z=X.splitCells,Q=X.escape,ie=X.findClosingBracket;function ce(ne,ae,le){var Y=ae.href,$=ae.title?Q(ae.title):null,J=ne[1].replace(/\\([\[\]])/g,"$1");return ne[0].charAt(0)!=="!"?{type:"link",raw:le,href:Y,title:$,text:J}:{type:"image",raw:le,href:Y,title:$,text:Q(J)}}function Ce(ne,ae){var le=ne.match(/^(\s+)(?:```)/);if(le===null)return ae;var Y=le[1];return ae.split(`
|
|
`).map(function($){var J=$.match(/^\s+/);if(J===null)return $;var ee=J[0];return ee.length>=Y.length?$.slice(Y.length):$}).join(`
|
|
`)}var pe=function(){function ne(le){this.options=le||B}var ae=ne.prototype;return ae.space=function(Y){var $=this.rules.block.newline.exec(Y);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
|
|
`}},ae.code=function(Y,$){var J=this.rules.block.code.exec(Y);if(J){var ee=$[$.length-1];if(ee&&ee.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var me=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?me:F(me,`
|
|
`)}}},ae.fences=function(Y){var $=this.rules.block.fences.exec(Y);if($){var J=$[0],ee=Ce(J,$[3]||"");return{type:"code",raw:J,lang:$[2]?$[2].trim():$[2],text:ee}}},ae.heading=function(Y){var $=this.rules.block.heading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ae.nptable=function(Y){var $=this.rules.block.nptable.exec(Y);if($){var J={type:"table",header:z($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[],raw:$[0]};if(J.header.length===J.align.length){var ee=J.align.length,me;for(me=0;me<ee;me++)/^ *-+: *$/.test(J.align[me])?J.align[me]="right":/^ *:-+: *$/.test(J.align[me])?J.align[me]="center":/^ *:-+ *$/.test(J.align[me])?J.align[me]="left":J.align[me]=null;for(ee=J.cells.length,me=0;me<ee;me++)J.cells[me]=z(J.cells[me],J.header.length);return J}}},ae.hr=function(Y){var $=this.rules.block.hr.exec(Y);if($)return{type:"hr",raw:$[0]}},ae.blockquote=function(Y){var $=this.rules.block.blockquote.exec(Y);if($){var J=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:J}}},ae.list=function(Y){var $=this.rules.block.list.exec(Y);if($){for(var J=$[0],ee=$[2],me=ee.length>1,Ee=ee[ee.length-1]===")",ke={type:"list",raw:J,ordered:me,start:me?+ee.slice(0,-1):"",loose:!1,items:[]},tt=$[0].match(this.rules.block.item),dt=!1,it,At,mt,ot,It,yt,Yt,Wt=tt.length,pt=0;pt<Wt;pt++)it=tt[pt],J=it,At=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(`
|
|
`)&&(At-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+At+"}","gm"),"")),pt!==Wt-1&&(mt=this.rules.block.bullet.exec(tt[pt+1])[0],(me?mt.length===1||!Ee&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==ee)&&(ot=tt.slice(pt+1).join(`
|
|
`),ke.raw=ke.raw.substring(0,ke.raw.length-ot.length),pt=Wt-1)),It=dt||/\n\n(?!\s*$)/.test(it),pt!==Wt-1&&(dt=it.charAt(it.length-1)===`
|
|
`,It||(It=dt)),It&&(ke.loose=!0),yt=/^\[[ xX]\] /.test(it),Yt=void 0,yt&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),ke.items.push({type:"list_item",raw:J,task:yt,checked:Yt,loose:It,text:it});return ke}},ae.html=function(Y){var $=this.rules.block.html.exec(Y);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):Q($[0]):$[0]}},ae.def=function(Y){var $=this.rules.block.def.exec(Y);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var J=$[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:$[0],href:$[2],title:$[3]}}},ae.table=function(Y){var $=this.rules.block.table.exec(Y);if($){var J={type:"table",header:z($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[]};if(J.header.length===J.align.length){J.raw=$[0];var ee=J.align.length,me;for(me=0;me<ee;me++)/^ *-+: *$/.test(J.align[me])?J.align[me]="right":/^ *:-+: *$/.test(J.align[me])?J.align[me]="center":/^ *:-+ *$/.test(J.align[me])?J.align[me]="left":J.align[me]=null;for(ee=J.cells.length,me=0;me<ee;me++)J.cells[me]=z(J.cells[me].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},ae.lheading=function(Y){var $=this.rules.block.lheading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ae.paragraph=function(Y){var $=this.rules.block.paragraph.exec(Y);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
|
|
`?$[1].slice(0,-1):$[1]}},ae.text=function(Y,$){var J=this.rules.block.text.exec(Y);if(J){var ee=$[$.length-1];return ee&&ee.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},ae.escape=function(Y){var $=this.rules.inline.escape.exec(Y);if($)return{type:"escape",raw:$[0],text:Q($[1])}},ae.tag=function(Y,$,J){var ee=this.rules.inline.tag.exec(Y);if(ee)return!$&&/^<a /i.test(ee[0])?$=!0:$&&/^<\/a>/i.test(ee[0])&&($=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(ee[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ee[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:ee[0],inLink:$,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):Q(ee[0]):ee[0]}},ae.link=function(Y){var $=this.rules.inline.link.exec(Y);if($){var J=ie($[2],"()");if(J>-1){var ee=$[0].indexOf("!")===0?5:4,me=ee+$[1].length+J;$[2]=$[2].substring(0,J),$[0]=$[0].substring(0,me).trim(),$[3]=""}var Ee=$[2],ke="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);tt?(Ee=tt[1],ke=tt[3]):ke=""}else ke=$[3]?$[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=ce($,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:ke&&ke.replace(this.rules.inline._escapes,"$1")},$[0]);return dt}},ae.reflink=function(Y,$){var J;if((J=this.rules.inline.reflink.exec(Y))||(J=this.rules.inline.nolink.exec(Y))){var ee=(J[2]||J[1]).replace(/\s+/g," ");if(ee=$[ee.toLowerCase()],!ee||!ee.href){var me=J[0].charAt(0);return{type:"text",raw:me,text:me}}var Ee=ce(J,ee,J[0]);return Ee}},ae.strong=function(Y,$,J){J===void 0&&(J="");var ee=this.rules.inline.strong.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var me=ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;me.lastIndex=0;for(var Ee;(ee=me.exec($))!=null;)if(Ee=this.rules.inline.strong.middle.exec($.slice(0,ee.index+3)),Ee)return{type:"strong",raw:Y.slice(0,Ee[0].length),text:Y.slice(2,Ee[0].length-2)}}},ae.em=function(Y,$,J){J===void 0&&(J="");var ee=this.rules.inline.em.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var me=ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;me.lastIndex=0;for(var Ee;(ee=me.exec($))!=null;)if(Ee=this.rules.inline.em.middle.exec($.slice(0,ee.index+2)),Ee)return{type:"em",raw:Y.slice(0,Ee[0].length),text:Y.slice(1,Ee[0].length-1)}}},ae.codespan=function(Y){var $=this.rules.inline.code.exec(Y);if($){var J=$[2].replace(/\n/g," "),ee=/[^ ]/.test(J),me=J.startsWith(" ")&&J.endsWith(" ");return ee&&me&&(J=J.substring(1,J.length-1)),J=Q(J,!0),{type:"codespan",raw:$[0],text:J}}},ae.br=function(Y){var $=this.rules.inline.br.exec(Y);if($)return{type:"br",raw:$[0]}},ae.del=function(Y){var $=this.rules.inline.del.exec(Y);if($)return{type:"del",raw:$[0],text:$[1]}},ae.autolink=function(Y,$){var J=this.rules.inline.autolink.exec(Y);if(J){var ee,me;return J[2]==="@"?(ee=Q(this.options.mangle?$(J[1]):J[1]),me="mailto:"+ee):(ee=Q(J[1]),me=ee),{type:"link",raw:J[0],text:ee,href:me,tokens:[{type:"text",raw:ee,text:ee}]}}},ae.url=function(Y,$){var J;if(J=this.rules.inline.url.exec(Y)){var ee,me;if(J[2]==="@")ee=Q(this.options.mangle?$(J[0]):J[0]),me="mailto:"+ee;else{var Ee;do Ee=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(Ee!==J[0]);ee=Q(J[0]),J[1]==="www."?me="http://"+ee:me=ee}return{type:"link",raw:J[0],text:ee,href:me,tokens:[{type:"text",raw:ee,text:ee}]}}},ae.inlineText=function(Y,$,J){var ee=this.rules.inline.text.exec(Y);if(ee){var me;return $?me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):Q(ee[0]):ee[0]:me=Q(this.options.smartypants?J(ee[0]):ee[0]),{type:"text",raw:ee[0],text:me}}},ne}(),Te=X.noopTest,se=X.edit,de=X.merge,q={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};q._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,q._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,q.def=se(q.def).replace("label",q._label).replace("title",q._title).getRegex(),q.bullet=/(?:[*+-]|\d{1,9}[.)])/,q.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,q.item=se(q.item,"gm").replace(/bull/g,q.bullet).getRegex(),q.list=se(q.list).replace(/bull/g,q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+q.def.source+")").getRegex(),q._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",q._comment=/<!--(?!-?>)[\s\S]*?-->/,q.html=se(q.html,"i").replace("comment",q._comment).replace("tag",q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),q.paragraph=se(q._paragraph).replace("hr",q.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",q._tag).getRegex(),q.blockquote=se(q.blockquote).replace("paragraph",q.paragraph).getRegex(),q.normal=de({},q),q.gfm=de({},q.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*|$)"}),q.gfm.nptable=se(q.gfm.nptable).replace("hr",q.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",q._tag).getRegex(),q.gfm.table=se(q.gfm.table).replace("hr",q.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",q._tag).getRegex(),q.pedantic=de({},q.normal,{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",q._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Te,paragraph:se(q.normal._paragraph).replace("hr",q.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",oe.punctuation=se(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=se(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=se(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=se(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=se(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=se(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=se(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=se(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=se(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=se(oe._blockSkip,"g").getRegex(),oe.overlapSkip=se(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._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])?)+(?![-_])/,oe.autolink=se(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=se(oe.tag).replace("comment",q._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=se(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=se(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=se(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=de({},oe),oe.pedantic=de({},oe.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:se(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=de({},oe.normal,{escape:se(oe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),oe.gfm.url=se(oe.gfm.url,"i").replace("email",oe.gfm._extended_email).getRegex(),oe.breaks=de({},oe.gfm,{br:se(oe.br).replace("{2,}","*").getRegex(),text:se(oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ye={block:q,inline:oe},fe=N.defaults,Le=ye.block,ve=ye.inline;function De(ne){return ne.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 be(ne){var ae="",le,Y,$=ne.length;for(le=0;le<$;le++)Y=ne.charCodeAt(le),Math.random()>.5&&(Y="x"+Y.toString(16)),ae+="&#"+Y+";";return ae}var we=function(){function ne(le){this.tokens=[],this.tokens.links=Object.create(null),this.options=le||fe,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Le.normal,inline:ve.normal};this.options.pedantic?(Y.block=Le.pedantic,Y.inline=ve.pedantic):this.options.gfm&&(Y.block=Le.gfm,this.options.breaks?Y.inline=ve.breaks:Y.inline=ve.gfm),this.tokenizer.rules=Y}ne.lex=function(Y,$){var J=new ne($);return J.lex(Y)};var ae=ne.prototype;return ae.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(Y,$,J){$===void 0&&($=[]),J===void 0&&(J=!0),Y=Y.replace(/^ +$/gm,"");for(var ee,me,Ee,ke;Y;){if(ee=this.tokenizer.space(Y)){Y=Y.substring(ee.raw.length),ee.type&&$.push(ee);continue}if(ee=this.tokenizer.code(Y,$)){Y=Y.substring(ee.raw.length),ee.type?$.push(ee):(ke=$[$.length-1],ke.raw+=`
|
|
`+ee.raw,ke.text+=`
|
|
`+ee.text);continue}if(ee=this.tokenizer.fences(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.heading(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.nptable(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.hr(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.blockquote(Y)){Y=Y.substring(ee.raw.length),ee.tokens=this.blockTokens(ee.text,[],J),$.push(ee);continue}if(ee=this.tokenizer.list(Y)){for(Y=Y.substring(ee.raw.length),Ee=ee.items.length,me=0;me<Ee;me++)ee.items[me].tokens=this.blockTokens(ee.items[me].text,[],!1);$.push(ee);continue}if(ee=this.tokenizer.html(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(J&&(ee=this.tokenizer.def(Y))){Y=Y.substring(ee.raw.length),this.tokens.links[ee.tag]||(this.tokens.links[ee.tag]={href:ee.href,title:ee.title});continue}if(ee=this.tokenizer.table(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.lheading(Y)){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(J&&(ee=this.tokenizer.paragraph(Y))){Y=Y.substring(ee.raw.length),$.push(ee);continue}if(ee=this.tokenizer.text(Y,$)){Y=Y.substring(ee.raw.length),ee.type?$.push(ee):(ke=$[$.length-1],ke.raw+=`
|
|
`+ee.raw,ke.text+=`
|
|
`+ee.text);continue}if(Y){var tt="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return $},ae.inline=function(Y){var $,J,ee,me,Ee,ke,tt=Y.length;for($=0;$<tt;$++){ke=Y[$];switch(ke.type){case"paragraph":case"text":case"heading":{ke.tokens=[],this.inlineTokens(ke.text,ke.tokens);break}case"table":{for(ke.tokens={header:[],cells:[]},me=ke.header.length,J=0;J<me;J++)ke.tokens.header[J]=[],this.inlineTokens(ke.header[J],ke.tokens.header[J]);for(me=ke.cells.length,J=0;J<me;J++)for(Ee=ke.cells[J],ke.tokens.cells[J]=[],ee=0;ee<Ee.length;ee++)ke.tokens.cells[J][ee]=[],this.inlineTokens(Ee[ee],ke.tokens.cells[J][ee]);break}case"blockquote":{this.inline(ke.tokens);break}case"list":{for(me=ke.items.length,J=0;J<me;J++)this.inline(ke.items[J].tokens);break}}}return Y},ae.inlineTokens=function(Y,$,J,ee,me){$===void 0&&($=[]),J===void 0&&(J=!1),ee===void 0&&(ee=!1),me===void 0&&(me="");var Ee,ke=Y,tt;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(ke))!=null;)dt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(ke=ke.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(ke))!=null;)ke=ke.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Ee=this.tokenizer.escape(Y)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.tag(Y,J,ee)){Y=Y.substring(Ee.raw.length),J=Ee.inLink,ee=Ee.inRawBlock,$.push(Ee);continue}if(Ee=this.tokenizer.link(Y)){Y=Y.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ee)),$.push(Ee);continue}if(Ee=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ee)),$.push(Ee);continue}if(Ee=this.tokenizer.strong(Y,ke,me)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],J,ee),$.push(Ee);continue}if(Ee=this.tokenizer.em(Y,ke,me)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],J,ee),$.push(Ee);continue}if(Ee=this.tokenizer.codespan(Y)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.br(Y)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.del(Y)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],J,ee),$.push(Ee);continue}if(Ee=this.tokenizer.autolink(Y,be)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(!J&&(Ee=this.tokenizer.url(Y,be))){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.inlineText(Y,ee,De)){Y=Y.substring(Ee.raw.length),me=Ee.raw.slice(-1),$.push(Ee);continue}if(Y){var it="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return $},G(ne,null,[{key:"rules",get:function(){return{block:Le,inline:ve}}}]),ne}(),Re=N.defaults,Fe=X.cleanUrl,Pe=X.escape,Ae=function(){function ne(le){this.options=le||Re}var ae=ne.prototype;return ae.code=function(Y,$,J){var ee=($||"").match(/\S*/)[0];if(this.options.highlight){var me=this.options.highlight(Y,ee);me!=null&&me!==Y&&(J=!0,Y=me)}return ee?'<pre><code class="'+this.options.langPrefix+Pe(ee,!0)+'">'+(J?Y:Pe(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(J?Y:Pe(Y,!0))+`</code></pre>
|
|
`},ae.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},ae.html=function(Y){return Y},ae.heading=function(Y,$,J,ee){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+ee.slug(J)+'">'+Y+"</h"+$+`>
|
|
`:"<h"+$+">"+Y+"</h"+$+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(Y,$,J){var ee=$?"ol":"ul",me=$&&J!==1?' start="'+J+'"':"";return"<"+ee+me+`>
|
|
`+Y+"</"+ee+`>
|
|
`},ae.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},ae.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},ae.table=function(Y,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+$+`</table>
|
|
`},ae.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},ae.tablecell=function(Y,$){var J=$.header?"th":"td",ee=$.align?"<"+J+' align="'+$.align+'">':"<"+J+">";return ee+Y+"</"+J+`>
|
|
`},ae.strong=function(Y){return"<strong>"+Y+"</strong>"},ae.em=function(Y){return"<em>"+Y+"</em>"},ae.codespan=function(Y){return"<code>"+Y+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(Y){return"<del>"+Y+"</del>"},ae.link=function(Y,$,J){if(Y=Fe(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var ee='<a href="'+Pe(Y)+'"';return $&&(ee+=' title="'+$+'"'),ee+=">"+J+"</a>",ee},ae.image=function(Y,$,J){if(Y=Fe(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var ee='<img src="'+Y+'" alt="'+J+'"';return $&&(ee+=' title="'+$+'"'),ee+=this.options.xhtml?"/>":">",ee},ae.text=function(Y){return Y},ne}(),Se=function(){function ne(){}var ae=ne.prototype;return ae.strong=function(Y){return Y},ae.em=function(Y){return Y},ae.codespan=function(Y){return Y},ae.del=function(Y){return Y},ae.html=function(Y){return Y},ae.text=function(Y){return Y},ae.link=function(Y,$,J){return""+J},ae.image=function(Y,$,J){return""+J},ae.br=function(){return""},ne}(),We=function(){function ne(){this.seen={}}var ae=ne.prototype;return ae.slug=function(Y){var $=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var J=$;do this.seen[J]++,$=J+"-"+this.seen[J];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},ne}(),Ge=N.defaults,Xe=X.unescape,je=function(){function ne(le){this.options=le||Ge,this.options.renderer=this.options.renderer||new Ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Se,this.slugger=new We}ne.parse=function(Y,$){var J=new ne($);return J.parse(Y)};var ae=ne.prototype;return ae.parse=function(Y,$){$===void 0&&($=!0);var J="",ee,me,Ee,ke,tt,dt,it,At,mt,ot,It,yt,Yt,Wt,pt,Tr,zr,lr,Sr=Y.length;for(ee=0;ee<Sr;ee++){ot=Y[ee];switch(ot.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,Xe(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(At="",it="",ke=ot.header.length,me=0;me<ke;me++)it+=this.renderer.tablecell(this.parseInline(ot.tokens.header[me]),{header:!0,align:ot.align[me]});for(At+=this.renderer.tablerow(it),mt="",ke=ot.cells.length,me=0;me<ke;me++){for(dt=ot.tokens.cells[me],it="",tt=dt.length,Ee=0;Ee<tt;Ee++)it+=this.renderer.tablecell(this.parseInline(dt[Ee]),{header:!1,align:ot.align[Ee]});mt+=this.renderer.tablerow(it)}J+=this.renderer.table(At,mt);continue}case"blockquote":{mt=this.parse(ot.tokens),J+=this.renderer.blockquote(mt);continue}case"list":{for(It=ot.ordered,yt=ot.start,Yt=ot.loose,ke=ot.items.length,mt="",me=0;me<ke;me++)pt=ot.items[me],Tr=pt.checked,zr=pt.task,Wt="",pt.task&&(lr=this.renderer.checkbox(Tr),Yt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=lr+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=lr+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:lr}):Wt+=lr),Wt+=this.parse(pt.tokens,Yt),mt+=this.renderer.listitem(Wt,zr,Tr);J+=this.renderer.list(mt,It,yt);continue}case"html":{J+=this.renderer.html(ot.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(mt=ot.tokens?this.parseInline(ot.tokens):ot.text;ee+1<Sr&&Y[ee+1].type==="text";)ot=Y[++ee],mt+=`
|
|
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);J+=$?this.renderer.paragraph(mt):mt;continue}default:{var hr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return J},ae.parseInline=function(Y,$){$=$||this.renderer;var J="",ee,me,Ee=Y.length;for(ee=0;ee<Ee;ee++){me=Y[ee];switch(me.type){case"escape":{J+=$.text(me.text);break}case"html":{J+=$.html(me.text);break}case"link":{J+=$.link(me.href,me.title,this.parseInline(me.tokens,$));break}case"image":{J+=$.image(me.href,me.title,me.text);break}case"strong":{J+=$.strong(this.parseInline(me.tokens,$));break}case"em":{J+=$.em(this.parseInline(me.tokens,$));break}case"codespan":{J+=$.codespan(me.text);break}case"br":{J+=$.br();break}case"del":{J+=$.del(this.parseInline(me.tokens,$));break}case"text":{J+=$.text(me.text);break}default:{var ke='Token with "'+me.type+'" type was not found.';if(this.options.silent){console.error(ke);return}else throw new Error(ke)}}}return J},ne}(),qe=X.merge,Ue=X.checkSanitizeDeprecation,Ke=X.escape,xe=N.getDefaults,$e=N.changeDefaults,Ye=N.defaults;function _e(ne,ae,le){if(typeof ne=="undefined"||ne===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ne!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ne)+", string expected");if(typeof ae=="function"&&(le=ae,ae=null),ae=qe({},_e.defaults,ae||{}),Ue(ae),le){var Y=ae.highlight,$;try{$=we.lex(ne,ae)}catch(Ee){return le(Ee)}var J=function(ke){var tt;if(!ke)try{tt=je.parse($,ae)}catch(dt){ke=dt}return ae.highlight=Y,ke?le(ke):le(null,tt)};if(!Y||Y.length<3)return J();if(delete ae.highlight,!$.length)return J();var ee=0;_e.walkTokens($,function(Ee){Ee.type==="code"&&(ee++,setTimeout(function(){Y(Ee.text,Ee.lang,function(ke,tt){if(ke)return J(ke);tt!=null&&tt!==Ee.text&&(Ee.text=tt,Ee.escaped=!0),ee--,ee===0&&J()})},0))}),ee===0&&J();return}try{var me=we.lex(ne,ae);return ae.walkTokens&&_e.walkTokens(me,ae.walkTokens),je.parse(me,ae)}catch(Ee){if(Ee.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Ke(Ee.message+"",!0)+"</pre>";throw Ee}}_e.options=_e.setOptions=function(ne){return qe(_e.defaults,ne),$e(_e.defaults),_e},_e.getDefaults=xe,_e.defaults=Ye,_e.use=function(ne){var ae=qe({},ne);if(ne.renderer&&function(){var Y=_e.defaults.renderer||new Ae,$=function(me){var Ee=Y[me];Y[me]=function(){for(var ke=arguments.length,tt=new Array(ke),dt=0;dt<ke;dt++)tt[dt]=arguments[dt];var it=ne.renderer[me].apply(Y,tt);return it===!1&&(it=Ee.apply(Y,tt)),it}};for(var J in ne.renderer)$(J);ae.renderer=Y}(),ne.tokenizer&&function(){var Y=_e.defaults.tokenizer||new pe,$=function(me){var Ee=Y[me];Y[me]=function(){for(var ke=arguments.length,tt=new Array(ke),dt=0;dt<ke;dt++)tt[dt]=arguments[dt];var it=ne.tokenizer[me].apply(Y,tt);return it===!1&&(it=Ee.apply(Y,tt)),it}};for(var J in ne.tokenizer)$(J);ae.tokenizer=Y}(),ne.walkTokens){var le=_e.defaults.walkTokens;ae.walkTokens=function(Y){ne.walkTokens(Y),le&&le(Y)}}_e.setOptions(ae)},_e.walkTokens=function(ne,ae){for(var le=M(ne),Y;!(Y=le()).done;){var $=Y.value;ae($);switch($.type){case"table":{for(var J=M($.tokens.header),ee;!(ee=J()).done;){var me=ee.value;_e.walkTokens(me,ae)}for(var Ee=M($.tokens.cells),ke;!(ke=Ee()).done;)for(var tt=ke.value,dt=M(tt),it;!(it=dt()).done;){var At=it.value;_e.walkTokens(At,ae)}break}case"list":{_e.walkTokens($.items,ae);break}default:$.tokens&&_e.walkTokens($.tokens,ae)}}},_e.Parser=je,_e.parser=je.parse,_e.Renderer=Ae,_e.TextRenderer=Se,_e.Lexer=we,_e.lexer=we.lex,_e.Tokenizer=pe,_e.Slugger=We,_e.parse=_e;var Ie=_e;return Ie})},ELLl:function(ut,Ze,te){(function(Z){Z(te("VrN/"))})(function(Z){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=Z.Pos;Z.defineOption("autoCloseBrackets",!1,function(S,b,d){d&&d!=Z.Init&&(S.removeKeyMap(M),S.state.closeBrackets=null),b&&(P(K(b,"pairs")),S.state.closeBrackets=b,S.addKeyMap(M))});function K(S,b){return b=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[b]!=null?S[b]:G[b]}var M={Backspace:A,Enter:_};function P(S){for(var b=0;b<S.length;b++){var d=S.charAt(b),o="'"+d+"'";M[o]||(M[o]=N(d))}}P(G.pairs+"`");function N(S){return function(b){return L(b,S)}}function k(S){var b=S.state.closeBrackets;if(!b||b.override)return b;var d=S.getModeAt(S.getCursor());return d.closeBrackets||b}function A(S){var b=k(S);if(!b||S.getOption("disableInput"))return Z.Pass;for(var d=K(b,"pairs"),o=S.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return Z.Pass;var u=O(S,o[s].head);if(!u||d.indexOf(u)%2!=0)return Z.Pass}for(var s=o.length-1;s>=0;s--){var T=o[s].head;S.replaceRange("",D(T.line,T.ch-1),D(T.line,T.ch+1),"+delete")}}function _(S){var b=k(S),d=b&&K(b,"explode");if(!d||S.getOption("disableInput"))return Z.Pass;for(var o=S.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return Z.Pass;var u=O(S,o[s].head);if(!u||d.indexOf(u)%2!=0)return Z.Pass}S.operation(function(){var T=S.lineSeparator()||`
|
|
`;S.replaceSelection(T+T,null),S.execCommand("goCharLeft"),o=S.listSelections();for(var f=0;f<o.length;f++){var p=o[f].head.line;S.indentLine(p,null,!0),S.indentLine(p+1,null,!0)}})}function x(S){var b=Z.cmpPos(S.anchor,S.head)>0;return{anchor:new D(S.anchor.line,S.anchor.ch+(b?-1:1)),head:new D(S.head.line,S.head.ch+(b?1:-1))}}function L(S,b){var d=k(S);if(!d||S.getOption("disableInput"))return Z.Pass;var o=K(d,"pairs"),s=o.indexOf(b);if(s==-1)return Z.Pass;for(var u=K(d,"closeBefore"),T=K(d,"triples"),f=o.charAt(s+1)==b,p=S.listSelections(),w=s%2==0,y,h=0;h<p.length;h++){var c=p[h],l=c.head,a,v=S.getRange(l,D(l.line,l.ch+1));if(w&&!c.empty())a="surround";else if((f||!w)&&v==b)f&&C(S,l)?a="both":T.indexOf(b)>=0&&S.getRange(l,D(l.line,l.ch+3))==b+b+b?a="skipThree":a="skip";else if(f&&l.ch>1&&T.indexOf(b)>=0&&S.getRange(D(l.line,l.ch-2),l)==b+b){if(l.ch>2&&/\bstring/.test(S.getTokenTypeAt(D(l.line,l.ch-2))))return Z.Pass;a="addFour"}else if(f){var g=l.ch==0?" ":S.getRange(D(l.line,l.ch-1),l);if(!Z.isWordChar(v)&&g!=b&&!Z.isWordChar(g))a="both";else return Z.Pass}else if(w&&(v.length===0||/\s/.test(v)||u.indexOf(v)>-1))a="both";else return Z.Pass;if(!y)y=a;else if(y!=a)return Z.Pass}var m=s%2?o.charAt(s-1):b,R=s%2?b:o.charAt(s+1);S.operation(function(){if(y=="skip")S.execCommand("goCharRight");else if(y=="skipThree")for(var U=0;U<3;U++)S.execCommand("goCharRight");else if(y=="surround"){for(var W=S.getSelections(),U=0;U<W.length;U++)W[U]=m+W[U]+R;S.replaceSelections(W,"around"),W=S.listSelections().slice();for(var U=0;U<W.length;U++)W[U]=x(W[U]);S.setSelections(W)}else y=="both"?(S.replaceSelection(m+R,null),S.triggerElectric(m+R),S.execCommand("goCharLeft")):y=="addFour"&&(S.replaceSelection(m+m+m+m,"before"),S.execCommand("goCharRight"))})}function O(S,b){var d=S.getRange(D(b.line,b.ch-1),D(b.line,b.ch+1));return d.length==2?d:null}function C(S,b){var d=S.getTokenAt(D(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(S.getTokenTypeAt(b)))}})},HmJG:function(ut,Ze,te){},LdHM:function(ut,Ze,te){"use strict";te.d(Ze,"b",function(){return u}),te.d(Ze,"a",function(){return f});var Z=te("1OyB"),G=te("vuIU"),D=te("Ji7U"),K=te("LK+K"),M=te("q1tI"),P=te("rePB"),N=te("Ff2n"),k=te("ODXe"),A=te("4IlW"),_=te("bX4T"),x=te("YrtM"),L=te("TSYQ"),O=te.n(L),C=te("+nKL"),S=te("8OUc"),b=function(z,Q){var ie=z.prefixCls,ce=z.id,Ce=z.flattenOptions,pe=z.childrenAsData,Te=z.values,se=z.searchValue,de=z.multiple,q=z.defaultActiveFirstOption,oe=z.height,ye=z.itemHeight,fe=z.notFoundContent,Le=z.open,ve=z.menuItemSelectedIcon,De=z.virtual,be=z.onSelect,we=z.onToggleOpen,Re=z.onActiveValue,Fe=z.onScroll,Pe=z.onMouseEnter,Ae="".concat(ie,"-item"),Se=Object(x.a)(function(){return Ce},[Le,Ce],function(Ie,ne){return ne[0]&&Ie[1]!==ne[1]}),We=M.useRef(null),Ge=function(ne){ne.preventDefault()},Xe=function(ne){We.current&&We.current.scrollTo({index:ne})},je=function(ne){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,le=Se.length,Y=0;Y<le;Y+=1){var $=(ne+Y*ae+le)%le,J=Se[$],ee=J.group,me=J.data;if(!ee&&!me.disabled)return $}return-1},qe=M.useState(function(){return je(0)}),Ue=Object(k.a)(qe,2),Ke=Ue[0],xe=Ue[1],$e=function(ne){xe(ne);var ae=Se[ne];if(!ae){Re(null,-1);return}Re(ae.data.value,ne)};M.useEffect(function(){$e(q!==!1?je(0):-1)},[Se.length,se]),M.useEffect(function(){var Ie=setTimeout(function(){if(!de&&Le&&Te.size===1){var ne=Array.from(Te)[0],ae=Se.findIndex(function(le){var Y=le.data;return Y.value===ne});$e(ae),Xe(ae)}});return function(){return clearTimeout(Ie)}},[Le]);var Ye=function(ne){ne!==void 0&&be(ne,{selected:!Te.has(ne)}),de||we(!1)};if(M.useImperativeHandle(Q,function(){return{onKeyDown:function(ne){var ae=ne.which;switch(ae){case A.a.UP:case A.a.DOWN:{var le=0;if(ae===A.a.UP?le=-1:ae===A.a.DOWN&&(le=1),le!==0){var Y=je(Ke+le,le);Xe(Y),$e(Y)}break}case A.a.ENTER:{var $=Se[Ke];$&&!$.data.disabled?Ye($.data.value):Ye(void 0),Le&&ne.preventDefault();break}case A.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ne){Xe(ne)}}}),Se.length===0)return M.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),className:"".concat(Ae,"-empty"),onMouseDown:Ge},fe);function _e(Ie){var ne=Se[Ie];if(!ne)return null;var ae=ne.data||{},le=ae.value,Y=ae.label,$=ae.children,J=Object(_.a)(ae,!0),ee=pe?$:Y;return ne?M.createElement("div",Object.assign({"aria-label":typeof ee=="string"?ee:null},J,{key:Ie,role:"option",id:"".concat(ce,"_list_").concat(Ie),"aria-selected":Te.has(le)}),le):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),style:{height:0,width:0,overflow:"hidden"}},_e(Ke-1),_e(Ke),_e(Ke+1)),M.createElement(C.a,{itemKey:"key",ref:We,data:Se,height:oe,itemHeight:ye,fullHeight:!1,onMouseDown:Ge,onScroll:Fe,virtual:De,onMouseEnter:Pe},function(Ie,ne){var ae,le=Ie.group,Y=Ie.groupOption,$=Ie.data,J=$.label,ee=$.key;if(le)return M.createElement("div",{className:O()(Ae,"".concat(Ae,"-group"))},J!==void 0?J:ee);var me=$.disabled,Ee=$.value,ke=$.title,tt=$.children,dt=$.style,it=$.className,At=Object(N.a)($,["disabled","value","title","children","style","className"]),mt=Te.has(Ee),ot="".concat(Ae,"-option"),It=O()(Ae,ot,it,(ae={},Object(P.a)(ae,"".concat(ot,"-grouped"),Y),Object(P.a)(ae,"".concat(ot,"-active"),Ke===ne&&!me),Object(P.a)(ae,"".concat(ot,"-disabled"),me),Object(P.a)(ae,"".concat(ot,"-selected"),mt),ae)),yt=pe?tt:J,Yt=!ve||typeof ve=="function"||mt;return M.createElement("div",Object.assign({},At,{"aria-selected":mt,className:It,title:ke,onMouseMove:function(){if(Ke===ne||me)return;$e(ne)},onClick:function(){me||Ye(Ee)},style:dt}),M.createElement("div",{className:"".concat(ot,"-content")},yt||Ee),M.isValidElement(ve)||mt,Yt&&M.createElement(S.a,{className:"".concat(Ae,"-option-state"),customizeIcon:ve,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=M.forwardRef(b);d.displayName="OptionList";var o=d,s=function(){return null};s.isSelectOption=!0;var u=s,T=function(){return null};T.isSelectOptGroup=!0;var f=T,p=te("VTBJ"),w=te("Zm9Q");function y(F){var z=F.key,Q=F.props,ie=Q.children,ce=Q.value,Ce=Object(N.a)(Q,["children","value"]);return Object(p.a)({key:z,value:ce!==void 0?ce:z,children:ie},Ce)}function h(F){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(F).map(function(Q,ie){if(!M.isValidElement(Q)||!Q.type)return null;var ce=Q.type.isSelectOptGroup,Ce=Q.key,pe=Q.props,Te=pe.children,se=Object(N.a)(pe,["children"]);return z||!ce?y(Q):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?ie:Ce,"__"),label:Ce},se),{},{options:h(Te)})}).filter(function(Q){return Q})}var c=te("2Qr1"),l=te("qNPg"),a=te("U8pU"),v=te("Kwbf"),g=te("WKfj");function m(F){var z=F.mode,Q=F.options,ie=F.children,ce=F.backfill,Ce=F.allowClear,pe=F.placeholder,Te=F.getInputElement,se=F.showSearch,de=F.onSearch,q=F.defaultOpen,oe=F.autoFocus,ye=F.labelInValue,fe=F.value,Le=F.inputValue,ve=F.optionLabelProp,De=z==="multiple"||z==="tags",be=se!==void 0?se:De||z==="combobox",we=Q||h(ie);if(Object(v.a)(z!=="tags"||we.every(function(Ae){return!Ae.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),z==="tags"||z==="combobox"){var Re=we.some(function(Ae){return Ae.options?Ae.options.some(function(Se){return typeof("value"in Se?Se.value:Se.key)=="number"}):typeof("value"in Ae?Ae.value:Ae.key)=="number"});Object(v.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(z!=="combobox"||!ve,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(z==="combobox"||!ce,"`backfill` only works with `combobox` mode."),Object(v.a)(z==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(v.b)(z!=="combobox"||!Te||!Ce||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),de&&!be&&z!=="combobox"&&z!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!q||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),fe!=null){var Fe=Object(g.d)(fe);Object(v.a)(!ye||Fe.every(function(Ae){return Object(a.a)(Ae)==="object"&&("key"in Ae||"value"in Ae)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!De||Array.isArray(fe),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Pe=null;Object(w.a)(ie).some(function(Ae){if(!M.isValidElement(Ae)||!Ae.type)return!1;var Se=Ae.type;if(Se.isSelectOption)return!1;if(Se.isSelectOptGroup){var We=Object(w.a)(Ae.props.children).every(function(Ge){return!M.isValidElement(Ge)||!Ae.type||Ge.type.isSelectOption?!0:(Pe=Ge.type,!1)});return!We}return Pe=Se,!0}),Pe&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Pe.displayName||Pe.name||Pe,"`.")),Object(v.a)(Le===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=m,U=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:R,fillOptionsWithMissingValue:c.a}),W=function(F){Object(D.a)(Q,F);var z=Object(K.a)(Q);function Q(){var ie;return Object(Z.a)(this,Q),ie=z.apply(this,arguments),ie.selectRef=M.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(G.a)(Q,[{key:"render",value:function(){return M.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),Q}(M.Component);W.Option=u,W.OptGroup=f;var X=W,B=Ze.c=X},M8RZ:function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return A});var Z=te("fWQN"),G=te("mtLc"),D=te("yKVA"),K=te("879j"),M=te("q1tI"),P=te.n(M),N=te("i8i4"),k=te.n(N),A=function(_){Object(D.a)(L,_);var x=Object(K.a)(L);function L(O){var C;Object(Z.a)(this,L),C=x.call(this,O);var S=window.document;return C.node=S.createElement("div"),S.body.appendChild(C.node),C}return Object(G.a)(L,[{key:"render",value:function(){var C=this.props.children;return Object(N.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),L}(P.a.Component)},Ot1p:function(ut,Ze,te){"use strict";var Z=te("2qtc"),G=te("kLXV"),D=te("rAM+"),K=te("miYZ"),M=te("tsqr"),P=te("tJVT"),N=te("jrin"),k=te("q1tI"),A=te.n(k),_=te("VrN/"),x=te.n(_),L=te("bdgK"),O=te("p77/"),C=te("Bd2K"),S=te("ELLl"),b=te("19Vz"),d=te("lZu9"),o=te("+NIl"),s=te("kSUc"),u=te("9Bee"),T=function(ne){var ae=ne.value,le=ae===void 0?"":ae,Y=ne.className,$=ne.showTextOnly,J=ne.showLines,ee=ne.style,me=ee===void 0?{}:ee,Ee=Object(k.useMemo)(function(){return""},[le]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ee}}))},f=te("0Owb"),p=te("dejd"),w=te("C+DQ"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function h(ne){var ae=ne.onActionCallback,le=ne.title,Y=ne.icon,$=ne.actionName,J=ne.className,ee=J===void 0?"":J,me=ne.children;function Ee(){ae($)}return A.a.createElement("a",{title:le,className:ee,onClick:Ee},A.a.createElement("i",{className:"md-iconfont ".concat(Y)}),me)}var c=function(ne){var ae=ne.watch,le=ne.showNullButton,Y=ne.onActionCallback,$=ne.fullScreen,J=ne.insertTemp,ee=ne.hidetoolBar,me=[].concat(y,[{title:"".concat(ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!ee&&me.map(function(Ee,ke){return A.a.createElement("li",{key:ke},Ee.actionName?A.a.createElement(h,Object(f.a)({},Ee,{onActionCallback:Y})):A.a.createElement("span",{className:"v-line"}))}),le?A.a.createElement("li",null,A.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Y},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,J&&A.a.createElement("li",null,A.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(J),onActionCallback:Y},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(h,{icon:"".concat($?"icon-shrink":"icon-enlarge"),title:$?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Y})))},l=te("M8RZ"),a=te("+L6B"),v=te("2/Rp"),g=te("y8nQ"),m=te("Vl3Y"),R=te("5NDa"),U=te("5rEg"),W={labelCol:{span:4},wrapperCol:{span:20}},X=function(ne){var ae=ne.callback,le=ne.onCancel;function Y($){ae($)}return A.a.createElement(m.a,Object(f.a)({},W,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Y}),A.a.createElement(m.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(U.a,null)),A.a.createElement(m.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(U.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(v.a,{type:"ghost",onClick:le},"\u53D6\u6D88")))},B=te("7ahc"),F=te("HmJG"),z=te("BjJ7"),Q=m.a.useForm,ie={width:280,marginRight:10},ce={labelCol:{span:5},wrapperCol:{span:19}},Ce=function(ne){var ae=ne.callback,le=ne.onCancel,Y=Q(),$=Object(P.a)(Y,1),J=$[0];function ee(ke){ae(ke)}function me(ke,tt){J.setFieldsValue({src:"/api/attachments/".concat(ke.id),type:tt.type})}function Ee(ke){var tt=ke.target.files[0];Te(tt,me)}return A.a.createElement(m.a,Object(f.a)({form:J},ce,{className:"upload-image-panel",onFinish:ee}),A.a.createElement(m.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(m.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(U.a,{style:ie})),A.a.createElement(pe,{onFileChange:Ee}))),A.a.createElement(m.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},A.a.createElement(U.a,{style:{width:264}})),A.a.createElement(m.a.Item,{style:{textAlign:"right"}},A.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(v.a,{type:"ghost",onClick:le},"\u53D6\u6D88")))};function pe(ne){var ae=ne.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:ae}))}function Te(ne,ae){if(!ne)throw new String("\u6CA1\u6709\u6587\u4EF6");var le=new FormData;le.append("editormd-image-file",ne),le.append("file_param_name","editormd-image-file"),le.append("byxhr","true");var Y=new window.XMLHttpRequest;Y.withCredentials=!0,Y.addEventListener("load",function($){ae(JSON.parse($.target.responseText),ne)},!1),Y.addEventListener("error",function($){console.error($)},!1),Y.open("POST","".concat(z.a,"/api/attachments.json")),Y.send(le)}var se=te("giR+"),de=te("fyUT"),q=te("7Kak"),oe=te("9yH6"),ye=oe.a.Group,fe={margin:"0 8px"},Le=function(ne){var ae=ne.callback,le=ne.onCancel;function Y($){ae($)}return A.a.createElement(m.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Y},A.a.createElement("div",{className:"flex-container"},A.a.createElement("span",{style:fe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:fe},"\u884C\u6570"),A.a.createElement(m.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(de.a,null)),A.a.createElement("span",{style:fe},"\u5217\u6570"),A.a.createElement(m.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(de.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12}},A.a.createElement("span",{style:fe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(m.a.Item,{name:"align"},A.a.createElement(ye,null,A.a.createElement(oe.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(oe.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(oe.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(oe.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(v.a,{type:"ghost",onClick:le},"\u53D6\u6D88")))},ve=te("m3rI"),De="link",be="upload-image",we="code-block",Re="add-table",Fe="------------",Pe={default:Fe,left:":".concat(Fe),center:":".concat(Fe,":"),right:"".concat(Fe,":")},Ae=te("9VGf"),Se,We;function Ge(){}var Xe=0,je=1e4,qe="\u2581",Ue=`
|
|
**\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 Ke(ne){return/^\d+$/.test(ne)?"".concat(ne,"px"):ne}var xe=navigator.platform.toUpperCase().indexOf("MAC")>=0,$e=xe?"Cmd":"Ctrl",Ye=(Se={},Object(N.a)(Se,$e+"-B","bold"),Object(N.a)(Se,$e+"-I","italic"),Se),_e=(We={},Object(N.a)(We,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(We,we,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(We,be,"\u6DFB\u52A0\u56FE\u7247"),Object(N.a)(We,Re,"\u6DFB\u52A0\u8868\u683C"),We),Ie=Ze.a=function(ne){var ae=ne.defaultValue,le=ae===void 0?"":ae,Y=ne.onChange,$=ne.width,J=$===void 0?"100%":$,ee=ne.height,me=ee===void 0?400:ee,Ee=ne.miniToolbar,ke=Ee===void 0?!1:Ee,tt=ne.isFocus,dt=tt===void 0?!1:tt,it=ne.watch,At=ne.insertTemp,mt=ne.mode,ot=mt===void 0?"markdown":mt,It=ne.id,yt=It===void 0?"markdown-editor-id":It,Yt=ne.showResizeBar,Wt=Yt===void 0?!1:Yt,pt=ne.noStorage,Tr=pt===void 0?!1:pt,zr=ne.showNullButton,lr=zr===void 0?!1:zr,Sr=ne.hidetoolBar,hr=Sr===void 0?!1:Sr,yi=ne.fullScreen,ur=yi===void 0?!1:yi,Vr=ne.onBlur,cn=ne.onCMBeforeChange,Ct=ne.onFullScreen,et=ne.className,wr=et===void 0?"":et,fn=ne.disablePaste,dr=fn===void 0?!1:fn,gt=ne.placeholder,Cr=gt===void 0?"":gt,Rr=ne.values,Xr=Rr===void 0?"":Rr,Ne=Object(k.useState)(null),lt=Object(P.a)(Ne,2),He=lt[0],Nn=lt[1],hn=Object(k.useState)(le),Yr=Object(P.a)(hn,2),$r=Yr[0],st=Yr[1],Qi=Object(k.useState)(it),Un=Object(P.a)(Qi,2),cr=Un[0],ar=Un[1],bi=Object(k.useState)(ur),Bn=Object(P.a)(bi,2),rr=Bn[0],mn=Bn[1],Ei=Object(k.useState)(""),pn=Object(P.a)(Ei,2),Lr=pn[0],Dr=pn[1],xi=Object(k.useState)(0),jn=Object(P.a)(xi,2),Jr=jn[0],Wn=jn[1],Ti=Object(k.useState)(me),fr=Object(P.a)(Ti,2),Si=fr[0],wi=fr[1],gn=Object(k.useState)(!1),Pr=Object(P.a)(gn,2),Na=Pr[0],Kn=Pr[1],Qr=Object(k.useRef)(),Hn=Object(k.useRef)(),Mr=Object(k.useRef)(),Zr=Object(k.useRef)();Object(k.useEffect)(function(){st(Xr),He==null||He.setValue(Xr)},[Xr]),Object(k.useEffect)(function(){Ct==null||Ct(rr)},[rr]),Object(k.useEffect)(function(){if(Qr.current){var rt=x.a.fromTextArea(Qr.current,{mode:ot,lineNumbers:!ke,lineWrapping:!0,value:le,autoCloseTags:!0,autoCloseBrackets:!0});dt&&rt.focus();function ct(ft,Et){if(dr){Et.preventDefault();return}var xt=Et.clipboardData;if(xt){var St=xt.types.toString(),Rt=xt.items,Lt=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(St==="Files"||xt.types.indexOf("Files")>-1){if(Et.preventDefault(),ot=="stex")return;try{var Gt,mr=Rt[1];((Gt=Rt[0])===null||Gt===void 0?void 0:Gt.kind)==="file"&&(mr=Rt[0]);var wt=mr.getAsFile(),kr=wt.name.split(".").pop();Te(wt,function(zt){if(zt.id){var Ir,Fr,yn;(wt==null||((Ir=wt.type)===null||Ir===void 0)?void 0:Ir.indexOf("image"))>-1?rt.replaceSelection(".concat(zt.content_type,")")):(wt==null||((Fr=wt.type)===null||Fr===void 0)?void 0:Fr.indexOf("video"))>-1?rt.replaceSelection('<video width="100%" controls src="'.concat(ve.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(wt==null||((yn=wt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?rt.replaceSelection('<a href="'.concat(ve.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(wt.type,'&disposition=inline" target="_blank">').concat(wt.name,"</a>")):Lt.includes(kr)?rt.replaceSelection('<a href="'.concat(ve.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(wt.name,"</a>")):rt.replaceSelection("[".concat(wt.name,"](").concat(ve.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return rt.on("paste",ct),Nn(rt),function(){rt.off("paste",ct)}}},[]);var Ci=Object(k.useCallback)(function(){if(Hn.current)try{}catch(rt){console.log(rt,"---- to set md editor body height")}},[Si,Hn,rr]);Object(k.useEffect)(function(){function rt(){var ft=new L.default(function(Et){var xt=Object(D.a)(Et),St;try{for(xt.s();!(St=xt.n()).done;){var Rt=St.value;(Rt.target.offsetHeight>0||Rt.target.offsetWidth>0)&&(Ci(),He.setSize("100%","100%"),He.refresh())}}catch(Lt){xt.e(Lt)}finally{xt.f()}});return ft.observe(Qr.current.parentElement),ft}if(He){var ct=rt();return function(){ct.unobserve(Qr.current.parentElement)}}},[He,Ci]),Object(k.useEffect)(function(){if(He){for(var rt=[],ct=function(){var Rt=Et[ft];xt=Object(P.a)(Rt,2);var Lt=xt[0],Gt=xt[1],mr=Object(N.a)({},Lt,function(){Gn(Gt)});rt.push(mr),He.addKeyMap(mr)},ft=0,Et=Object.entries(Ye);ft<Et.length;ft++){var xt;ct()}return function(){var St=Object(D.a)(rt),Rt;try{for(St.s();!(Rt=St.n()).done;){var Lt=Rt.value;He.removeKeyMap(Lt)}}catch(Gt){St.e(Gt)}finally{St.f()}}}},[He]),Object(k.useEffect)(function(){ur!==rr&&mn(ur)},[ur]),Object(Ae.a)(function(){if(!Tr&&Jr>0){var rt=new Date().getTime(),ct=window.sessionStorage.getItem(yt);rt>=Jr+je&&(!ct||ct!==$r)&&(window.sessionStorage.setItem(yt,$r),Kn(!0))}},je),Object(k.useEffect)(function(){ar(it)},[He,it]),Object(k.useEffect)(function(){He&&(dt&&He.focus())},[He,dt]),Object(k.useEffect)(function(){if(cr&&He){var rt=He.getScrollerElement();function ct(ft){var Et=ft.target;if(Zr.current){var xt=Et.scrollTop/Et.scrollHeight;Zr.current.scrollTop=Zr.current.scrollHeight*xt}}return rt.addEventListener("scroll",ct),function(){rt.removeEventListener("scroll",ct)}}},[He,cr]),Object(k.useEffect)(function(){if(He&&cn){function rt(ct,ft){cn(ct,ft)}return He.on("beforeChange",rt),function(){He.off("beforeChange",rt)}}},[He,cn]),Object(k.useEffect)(function(){if(He&&Vr){function rt(){Vr(He.getValue())}return He.on("blur",rt),function(){He.off("blur",rt)}}},[He,Vr]),Object(k.useEffect)(function(){if(He){function rt(ct){var ft=ct.getValue();st(ft),Wn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Y&&Y(ft)}return He.on("change",rt),function(){He.off("change",rt)}}},[He,Y]),Object(k.useEffect)(function(){He&&(le==null?(He.setValue(""),st("")):le!==He.getValue()&&(He.setValue(le),st(le),He.setCursor(He.lineCount(),0)))},[He,le]);var Gn=Object(k.useCallback)(function(rt){var ct=He.getCursor(),ft=He.getSelection(),Et=ft.split(`
|
|
`);switch(rt){case"bold":return He.replaceSelection("**"+ft+"**"),ft===""&&He.setCursor(ct.line,ct.ch+2),He.focus();case"italic":return He.replaceSelection("*"+ft+"*"),ft===""&&He.setCursor(ct.line,ct.ch+1),He.focus();case"code":return He.replaceSelection("`"+ft+"`"),ft===""&&He.setCursor(ct.line,ct.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+ft+"$$`"),ft===""&&He.setCursor(ct.line,ct.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+ft+"\n```"),He.setCursor(ct.line+1,ft.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
|
|
`),He.focus();case"list-ul":return ft===""?He.replaceSelection("- "+ft):He.replaceSelection(Et.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),He.focus();case"list-ol":return ft===""?He.replaceSelection("1. "+ft):He.replaceSelection(Et.map(function(xt,St){return xt===""?"":"".concat(St+1,". ").concat(xt)}).join(`
|
|
`)),He.focus();case"add-null-ch":return ft===""&&He.setCursor(ct.line,ct.ch+1),He.replaceSelection(qe),He.focus();case"inster-template-1":return ft===""&&He.setCursor(ct.line,ct.ch),He.replaceSelection(Ue),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return ar(!cr),He.focus();case"trigger-full-screen":return mn(!rr),He.focus();case De:Dr(De);return;case we:Dr(we);return;case be:Dr(be);return;case Re:Dr(Re);return;default:throw new Error}},[He,cr,rr]),qr=Object(k.useCallback)(function(rt){Dr("");switch(Lr){case De:var ct=rt.title,ft=rt.link;return He.replaceSelection("[".concat(ct,"](").concat(ft,")")),He.focus();case we:var Et=rt.language,xt=rt.content;return He.replaceSelection(["```"+Et,xt,"```"].join(`
|
|
`)),He.focus();case be:var St=rt.src,Rt=rt.alt;return He.replaceSelection(".concat(St,' "').concat(Rt,'" )')),He.focus();case Re:for(var Lt=rt.row,Gt=rt.col,mr=rt.align,wt=`
|
|
`,kr=0;kr<Lt;kr++){for(var zt=[],Ir=[],Fr=0;Fr<Gt;Fr++)kr===1&&Ir.push(Pe[mr]),zt.push(" ");kr===1&&(wt+="| ".concat(Ir.join(" | "),` |
|
|
`)),wt+="| ".concat(zt.join(Gt===1?"":" | "),` |
|
|
`)}return He.replaceSelection(wt+`
|
|
`),He.focus();default:throw new Error}},[He,Lr]),vn=Object(k.useMemo)(function(){switch(Lr){case De:return A.a.createElement(X,{callback:qr,onCancel:yr});case we:return A.a.createElement(B.b,{callback:qr,onCancel:yr});case be:return A.a.createElement(Ce,{callback:qr,onCancel:yr});case Re:return A.a.createElement(Le,{callback:qr,onCancel:yr});default:return null}},[Lr]);function yr(){Dr("")}Object(k.useEffect)(function(){if(Mr.current){var rt=Mr.current,ct=!1,ft=0;function Et(Rt){ct=!0,ft=Rt.pageY}function xt(){ct=!1}function St(Rt){if(ct){var Lt=Rt.pageY-ft;Lt<0&&(Lt=0),Lt>300&&(Lt=300);var Gt=me+Lt+"px";wi(Gt)}}return rt.addEventListener("mousedown",Et),document.addEventListener("mousemove",St),document.addEventListener("mouseup",xt),function(){rt.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",xt)}}},[He,Mr]),Object(k.useEffect)(function(){wi(me)},[me]);var zn=Ke(J),Li=Ke(Si),Di={width:zn,height:Li},Vn=Object(k.useMemo)(function(){if(Jr){var rt=new Date(Jr),ct=rt.getHours(),ft=rt.getMinutes(),Et=rt.getSeconds();return ct=ct<10?"0"+ct:ct,ft=ft<10?"0"+ft:ft,Et=Et<10?"0"+Et:Et,"".concat(ct,":").concat(ft,":").concat(Et)}return 0},[Jr]);function Ua(){window.sessionStorage.removeItem(yt),Kn(!1),Wn(0)}function Zi(){Kn(!1),Wn(0),He.setValue(window.sessionStorage.getItem(yt))}return A.a.createElement(k.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Hn},A.a.createElement("div",{className:"markdown-editor-container ".concat(wr," ").concat(cr?"on-preview":""," ").concat(ke?"mini":""," ").concat(rr?"full-screen":""),style:Di},A.a.createElement(c,{insertTemp:At,watch:cr,fullScreen:rr,showNullButton:lr,onActionCallback:Gn,hidetoolBar:hr}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Qr,placeholder:Cr})),cr?A.a.createElement("div",{ref:Zr,className:"preview-container"},ot==="stex"&&A.a.createElement(T,{value:$r}),ot!=="stex"&&A.a.createElement(u.a,{value:$r})):null))),Wt?A.a.createElement("a",{ref:Mr,className:"editor-resize"}):null,A.a.createElement(l.a,null,_e[Lr]?A.a.createElement(G.a,{centered:!0,title:_e[Lr],visible:!0,onCancel:yr,footer:null},vn):null))}},RxwV:function(ut,Ze,te){"use strict";var Z=te("q1tI"),G=te("uciX"),D=te("2W6z"),K=te.n(D),M=te("4IlW"),P=te("uK0f"),N=te.n(P);function k(se,de){if(se===de)return!0;if(!se||!de)return!1;var q=se.length;if(de.length!==q)return!1;for(var oe=0;oe<q;oe++)if(se[oe]!==de[oe])return!1;return!0}function A(se){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(q){return typeof q}:A=function(q){return q&&typeof Symbol=="function"&&q.constructor===Symbol&&q!==Symbol.prototype?"symbol":typeof q},A(se)}function _(se,de){if(!(se instanceof de))throw new TypeError("Cannot call a class as a function")}function x(se,de){for(var q=0;q<de.length;q++){var oe=de[q];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(se,oe.key,oe)}}function L(se,de,q){return de&&x(se.prototype,de),q&&x(se,q),se}function O(se,de){if(typeof de!="function"&&de!==null)throw new TypeError("Super expression must either be null or a function");se.prototype=Object.create(de&&de.prototype,{constructor:{value:se,writable:!0,configurable:!0}}),de&&C(se,de)}function C(se,de){return C=Object.setPrototypeOf||function(oe,ye){return oe.__proto__=ye,oe},C(se,de)}function S(se){var de=o();return function(){var q=s(se),oe;if(de){var ye=s(this).constructor;oe=Reflect.construct(q,arguments,ye)}else oe=q.apply(this,arguments);return b(this,oe)}}function b(se,de){return de&&(A(de)==="object"||typeof de=="function")?de:d(se)}function d(se){if(se===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return se}function o(){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(se){return!1}}function s(se){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(q){return q.__proto__||Object.getPrototypeOf(q)},s(se)}var u=function(){var se=function(de){O(oe,de);var q=S(oe);function oe(){var ye;return _(this,oe),ye=q.apply(this,arguments),ye.menuItems={},ye.saveMenuItem=function(fe){return function(Le){ye.menuItems[fe]=Le}},ye}return L(oe,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(fe){!fe.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(fe){var Le=this.props,ve=Le.fieldNames,De=Le.defaultFieldNames;return ve[fe]||De[fe]}},{key:"getOption",value:function(fe,Le){var ve=this.props,De=ve.prefixCls,be=ve.expandTrigger,we=ve.expandIcon,Re=ve.loadingIcon,Fe=this.props.onSelect.bind(this,fe,Le),Pe=this.props.onItemDoubleClick.bind(this,fe,Le),Ae={onClick:Fe,onDoubleClick:Pe},Se="".concat(De,"-menu-item"),We=null,Ge=fe[this.getFieldName("children")]&&fe[this.getFieldName("children")].length>0;(Ge||fe.isLeaf===!1)&&(Se+=" ".concat(De,"-menu-item-expand"),fe.loading||(We=Z.createElement("span",{className:"".concat(De,"-menu-item-expand-icon")},we))),be==="hover"&&(Ge||fe.isLeaf===!1)&&(Ae={onMouseEnter:this.delayOnSelect.bind(this,Fe),onMouseLeave:this.delayOnSelect.bind(this),onClick:Fe}),this.isActiveOption(fe,Le)&&(Se+=" ".concat(De,"-menu-item-active"),Ae.ref=this.saveMenuItem(Le)),fe.disabled&&(Se+=" ".concat(De,"-menu-item-disabled"));var Xe=null;fe.loading&&(Se+=" ".concat(De,"-menu-item-loading"),Xe=Re||null);var je="";return"title"in fe?je=fe.title:typeof fe[this.getFieldName("label")]=="string"&&(je=fe[this.getFieldName("label")]),Z.createElement("li",Object.assign({key:fe[this.getFieldName("value")],className:Se,title:je},Ae,{role:"menuitem",onMouseDown:function(Ue){return Ue.preventDefault()}}),fe[this.getFieldName("label")],We,Xe)}},{key:"getActiveOptions",value:function(fe){var Le=this,ve=this.props.options,De=fe||this.props.activeValue;return N()(ve,function(be,we){return be[Le.getFieldName("value")]===De[we]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var fe=this,Le=this.props.options,ve=this.getActiveOptions().map(function(De){return De[fe.getFieldName("children")]}).filter(function(De){return!!De});return ve.unshift(Le),ve}},{key:"delayOnSelect",value:function(fe){for(var Le=this,ve=arguments.length,De=new Array(ve>1?ve-1:0),be=1;be<ve;be++)De[be-1]=arguments[be];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof fe=="function"&&(this.delayTimer=window.setTimeout(function(){fe(De),Le.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var fe=this.getShowOptions().length,Le=0;Le<fe;Le++){var ve=this.menuItems[Le];ve&&ve.parentElement&&(ve.parentElement.scrollTop=ve.offsetTop)}}},{key:"isActiveOption",value:function(fe,Le){var ve=this.props.activeValue,De=ve===void 0?[]:ve;return De[Le]===fe[this.getFieldName("value")]}},{key:"render",value:function(){var fe=this,Le=this.props,ve=Le.prefixCls,De=Le.dropdownMenuColumnStyle;return Z.createElement("div",null,this.getShowOptions().map(function(be,we){return Z.createElement("ul",{className:"".concat(ve,"-menu"),key:we,style:De},be.map(function(Re){return fe.getOption(Re,we)}))}))}}]),oe}(Z.Component);return se.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},se}(),T=u,f={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},p=f;function w(se){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(q){return typeof q}:w=function(q){return q&&typeof Symbol=="function"&&q.constructor===Symbol&&q!==Symbol.prototype?"symbol":typeof q},w(se)}function y(se,de){if(se==null)return{};var q=h(se,de),oe,ye;if(Object.getOwnPropertySymbols){var fe=Object.getOwnPropertySymbols(se);for(ye=0;ye<fe.length;ye++){if(oe=fe[ye],de.indexOf(oe)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(se,oe))continue;q[oe]=se[oe]}}return q}function h(se,de){if(se==null)return{};var q={},oe=Object.keys(se),ye,fe;for(fe=0;fe<oe.length;fe++){if(ye=oe[fe],de.indexOf(ye)>=0)continue;q[ye]=se[ye]}return q}function c(se){return g(se)||v(se)||a(se)||l()}function l(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(se,de){if(!se)return;if(typeof se=="string")return m(se,de);var q=Object.prototype.toString.call(se).slice(8,-1);if(q==="Object"&&se.constructor&&(q=se.constructor.name),q==="Map"||q==="Set")return Array.from(se);if(q==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(q))return m(se,de)}function v(se){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(se))return Array.from(se)}function g(se){if(Array.isArray(se))return m(se)}function m(se,de){(de==null||de>se.length)&&(de=se.length);for(var q=0,oe=new Array(de);q<de;q++)oe[q]=se[q];return oe}function R(se,de){if(!(se instanceof de))throw new TypeError("Cannot call a class as a function")}function U(se,de){for(var q=0;q<de.length;q++){var oe=de[q];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(se,oe.key,oe)}}function W(se,de,q){return de&&U(se.prototype,de),q&&U(se,q),se}function X(se,de){if(typeof de!="function"&&de!==null)throw new TypeError("Super expression must either be null or a function");se.prototype=Object.create(de&&de.prototype,{constructor:{value:se,writable:!0,configurable:!0}}),de&&B(se,de)}function B(se,de){return B=Object.setPrototypeOf||function(oe,ye){return oe.__proto__=ye,oe},B(se,de)}function F(se){var de=ie();return function(){var q=ce(se),oe;if(de){var ye=ce(this).constructor;oe=Reflect.construct(q,arguments,ye)}else oe=q.apply(this,arguments);return z(this,oe)}}function z(se,de){return de&&(w(de)==="object"||typeof de=="function")?de:Q(se)}function Q(se){if(se===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return se}function ie(){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(se){return!1}}function ce(se){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(q){return q.__proto__||Object.getPrototypeOf(q)},ce(se)}var Ce=function(){var se=function(de){X(oe,de);var q=F(oe);function oe(ye){var fe;R(this,oe),fe=q.call(this,ye),fe.setPopupVisible=function(ve){var De=fe.state.value;"popupVisible"in fe.props||fe.setState({popupVisible:ve}),ve&&!fe.state.popupVisible&&fe.setState({activeValue:De}),fe.props.onPopupVisibleChange(ve)},fe.handleChange=function(ve,De,be){var we=De.visible;(be.type!=="keydown"||be.keyCode===M.a.ENTER)&&(fe.props.onChange(ve.map(function(Re){return Re[fe.getFieldName("value")]}),ve),fe.setPopupVisible(we))},fe.handlePopupVisibleChange=function(ve){fe.setPopupVisible(ve)},fe.handleMenuSelect=function(ve,De,be){var we=fe.trigger.getRootDomNode();we&&we.focus&&we.focus();var Re=fe.props,Fe=Re.changeOnSelect,Pe=Re.loadData,Ae=Re.expandTrigger;if(!ve||ve.disabled)return;var Se=fe.state.activeValue;Se=Se.slice(0,De+1),Se[De]=ve[fe.getFieldName("value")];var We=fe.getActiveOptions(Se);if(ve.isLeaf===!1&&!ve[fe.getFieldName("children")]&&Pe){Fe&&fe.handleChange(We,{visible:!0},be),fe.setState({activeValue:Se}),Pe(We);return}var Ge={};!ve[fe.getFieldName("children")]||!ve[fe.getFieldName("children")].length?(fe.handleChange(We,{visible:!1},be),Ge.value=Se):Fe&&(be.type==="click"||be.type==="keydown")&&(Ae==="hover"?fe.handleChange(We,{visible:!1},be):fe.handleChange(We,{visible:!0},be),Ge.value=Se),Ge.activeValue=Se,("value"in fe.props||be.type==="keydown"&&be.keyCode!==M.a.ENTER)&&delete Ge.value,fe.setState(Ge)},fe.handleItemDoubleClick=function(){var ve=fe.props.changeOnSelect;ve&&fe.setPopupVisible(!1)},fe.handleKeyDown=function(ve){var De=fe.props.children;if(De&&De.props.onKeyDown){De.props.onKeyDown(ve);return}var be=c(fe.state.activeValue),we=be.length-1<0?0:be.length-1,Re=fe.getCurrentLevelOptions(),Fe=Re.map(function(We){return We[fe.getFieldName("value")]}).indexOf(be[we]);if(ve.keyCode!==M.a.DOWN&&ve.keyCode!==M.a.UP&&ve.keyCode!==M.a.LEFT&&ve.keyCode!==M.a.RIGHT&&ve.keyCode!==M.a.ENTER&&ve.keyCode!==M.a.SPACE&&ve.keyCode!==M.a.BACKSPACE&&ve.keyCode!==M.a.ESC&&ve.keyCode!==M.a.TAB)return;if(!fe.state.popupVisible&&ve.keyCode!==M.a.BACKSPACE&&ve.keyCode!==M.a.LEFT&&ve.keyCode!==M.a.RIGHT&&ve.keyCode!==M.a.ESC&&ve.keyCode!==M.a.TAB){fe.setPopupVisible(!0);return}if(ve.keyCode===M.a.DOWN||ve.keyCode===M.a.UP){ve.preventDefault();var Pe=Fe;Pe!==-1?ve.keyCode===M.a.DOWN?(Pe+=1,Pe=Pe>=Re.length?0:Pe):(Pe-=1,Pe=Pe<0?Re.length-1:Pe):Pe=0,be[we]=Re[Pe][fe.getFieldName("value")]}else if(ve.keyCode===M.a.LEFT||ve.keyCode===M.a.BACKSPACE)ve.preventDefault(),be.splice(be.length-1,1);else if(ve.keyCode===M.a.RIGHT)ve.preventDefault(),Re[Fe]&&Re[Fe][fe.getFieldName("children")]&&be.push(Re[Fe][fe.getFieldName("children")][0][fe.getFieldName("value")]);else if(ve.keyCode===M.a.ESC||ve.keyCode===M.a.TAB){fe.setPopupVisible(!1);return}(!be||be.length===0)&&fe.setPopupVisible(!1);var Ae=fe.getActiveOptions(be),Se=Ae[Ae.length-1];fe.handleMenuSelect(Se,Ae.length-1,ve),fe.props.onKeyDown&&fe.props.onKeyDown(ve)},fe.saveTrigger=function(ve){fe.trigger=ve};var Le=[];return"value"in ye?Le=ye.value||[]:"defaultValue"in ye&&(Le=ye.defaultValue||[]),K()(!("filedNames"in ye),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),fe.state={popupVisible:ye.popupVisible,activeValue:Le,value:Le,prevProps:ye},fe.defaultFieldNames={label:"label",value:"value",children:"children"},fe}return W(oe,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(fe){var Le=this.defaultFieldNames,ve=this.props,De=ve.fieldNames,be=ve.filedNames;return"filedNames"in this.props?be[fe]||Le[fe]:De[fe]||Le[fe]}},{key:"getFieldNames",value:function(){var fe=this.props,Le=fe.fieldNames,ve=fe.filedNames;return"filedNames"in this.props?ve:Le}},{key:"getCurrentLevelOptions",value:function(){var fe=this,Le=this.props.options,ve=Le===void 0?[]:Le,De=this.state.activeValue,be=De===void 0?[]:De,we=N()(ve,function(Re,Fe){return Re[fe.getFieldName("value")]===be[Fe]},{childrenKeyName:this.getFieldName("children")});return we[we.length-2]?we[we.length-2][this.getFieldName("children")]:c(ve).filter(function(Re){return!Re.disabled})}},{key:"getActiveOptions",value:function(fe){var Le=this;return N()(this.props.options||[],function(ve,De){return ve[Le.getFieldName("value")]===fe[De]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var fe=this.props,Le=fe.prefixCls,ve=fe.transitionName,De=fe.popupClassName,be=fe.options,we=be===void 0?[]:be,Re=fe.disabled,Fe=fe.builtinPlacements,Pe=fe.popupPlacement,Ae=fe.children,Se=fe.dropdownRender,We=y(fe,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Ge=Z.createElement("div",null),Xe="";we&&we.length>0?Ge=Z.createElement(T,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):Xe=" ".concat(Le,"-menus-empty");var je=Ge;return Se&&(je=Se(Ge)),Z.createElement(G.a,Object.assign({ref:this.saveTrigger},We,{popupPlacement:Pe,builtinPlacements:Fe,popupTransitionName:ve,action:Re?[]:["click"],popupVisible:Re?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(Le,"-menus"),popupClassName:De+Xe,popup:je}),Z.cloneElement(Ae,{onKeyDown:this.handleKeyDown,tabIndex:Re?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(fe,Le){var ve=Le.prevProps,De=ve===void 0?{}:ve,be={prevProps:fe};return"value"in fe&&!k(De.value,fe.value)&&(be.value=fe.value||[],"loadData"in fe||(be.activeValue=fe.value||[])),"popupVisible"in fe&&(be.popupVisible=fe.popupVisible),be}}]),oe}(Z.Component);return se.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:p,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},se}(),pe=Ce,Te=Ze.a=pe},SJMd:function(ut,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 te,Z,G,D=!1,K,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,N;(function(){var k=window,A=["break,continue,do,else,for,if,return,while"],_=[A,"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"],x=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],L=[x,"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=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[x,"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"],S="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",b=[x,"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=[A,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[A,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[A,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[L,C,O,b,d,o,s,u],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",w="kwd",y="com",h="typ",c="lit",l="pun",a="pln",v="tag",g="dec",m="src",R="atn",U="atv",W="nocode",X="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(be){for(var we=0,Re=!1,Fe=!1,Pe=0,Ae=be.length;Pe<Ae;++Pe){var Se=be[Pe];if(Se.ignoreCase)Fe=!0;else if(/[a-z]/i.test(Se.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Fe=!1;break}}var We={b:8,t:9,n:10,v:11,f:12,r:13};function Ge(Ke){var xe=Ke.charCodeAt(0);if(xe!==92)return xe;var $e=Ke.charAt(1);return xe=We[$e],xe||("0"<=$e&&$e<="7"?parseInt(Ke.substring(1),8):$e==="u"||$e==="x"?parseInt(Ke.substring(2),16):Ke.charCodeAt(1))}function Xe(Ke){if(Ke<32)return(Ke<16?"\\x0":"\\x")+Ke.toString(16);var xe=String.fromCharCode(Ke);return xe==="\\"||xe==="-"||xe==="]"||xe==="^"?"\\"+xe:xe}function je(Ke){var xe=Ke.substring(1,Ke.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),$e=[],Ye=xe[0]==="^",_e=["["];Ye&&_e.push("^");for(var Ie=Ye?1:0,ne=xe.length;Ie<ne;++Ie){var ae=xe[Ie];if(/\\[bdsw]/i.test(ae))_e.push(ae);else{var le=Ge(ae),Y;Ie+2<ne&&xe[Ie+1]==="-"?(Y=Ge(xe[Ie+2]),Ie+=2):Y=le,$e.push([le,Y]),Y<65||le>122||(Y<65||le>90||$e.push([Math.max(65,le)|32,Math.min(Y,90)|32]),Y<97||le>122||$e.push([Math.max(97,le)&~32,Math.min(Y,122)&~32]))}}$e.sort(function(me,Ee){return me[0]-Ee[0]||Ee[1]-me[1]});for(var $=[],J=[],Ie=0;Ie<$e.length;++Ie){var ee=$e[Ie];ee[0]<=J[1]+1?J[1]=Math.max(J[1],ee[1]):$.push(J=ee)}for(var Ie=0;Ie<$.length;++Ie){var ee=$[Ie];_e.push(Xe(ee[0])),ee[1]>ee[0]&&(ee[1]+1>ee[0]&&_e.push("-"),_e.push(Xe(ee[1])))}return _e.push("]"),_e.join("")}function qe(Ke){for(var xe=Ke.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),$e=xe.length,Ye=[],_e=0,Ie=0;_e<$e;++_e){var ne=xe[_e];if(ne==="(")++Ie;else if(ne.charAt(0)==="\\"){var ae=+ne.substring(1);ae&&(ae<=Ie?Ye[ae]=-1:xe[_e]=Xe(ae))}}for(var _e=1;_e<Ye.length;++_e)Ye[_e]===-1&&(Ye[_e]=++we);for(var _e=0,Ie=0;_e<$e;++_e){var ne=xe[_e];if(ne==="(")++Ie,Ye[Ie]||(xe[_e]="(?:");else if(ne.charAt(0)==="\\"){var ae=+ne.substring(1);ae&&ae<=Ie&&(xe[_e]="\\"+Ye[ae])}}for(var _e=0;_e<$e;++_e)xe[_e]==="^"&&xe[_e+1]!=="^"&&(xe[_e]="");if(Ke.ignoreCase&&Re)for(var _e=0;_e<$e;++_e){var ne=xe[_e],le=ne.charAt(0);ne.length>=2&&le==="["?xe[_e]=je(ne):le!=="\\"&&(xe[_e]=ne.replace(/[a-zA-Z]/g,function(J){var ee=J.charCodeAt(0);return"["+String.fromCharCode(ee&~32,ee|32)+"]"}))}return xe.join("")}for(var Ue=[],Pe=0,Ae=be.length;Pe<Ae;++Pe){var Se=be[Pe];if(Se.global||Se.multiline)throw new Error(""+Se);Ue.push("(?:"+qe(Se)+")")}return new RegExp(Ue.join("|"),Fe?"gi":"g")}function F(be,we){var Re=/(?:^|\s)nocode(?:\s|$)/,Fe=[],Pe=0,Ae=[],Se=0;function We(Ge){var Xe=Ge.nodeType;if(Xe==1){if(Re.test(Ge.className))return;for(var je=Ge.firstChild;je;je=je.nextSibling)We(je);var qe=Ge.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(Fe[Se]=`
|
|
`,Ae[Se<<1]=Pe++,Ae[Se++<<1|1]=Ge)}else if(Xe==3||Xe==4){var Ue=Ge.nodeValue;Ue.length&&(we?Ue=Ue.replace(/\r\n?/g,`
|
|
`):Ue=Ue.replace(/[ \t\r\n]+/g," "),Fe[Se]=Ue,Ae[Se<<1]=Pe,Pe+=Ue.length,Ae[Se++<<1|1]=Ge)}}return We(be),{sourceCode:Fe.join("").replace(/\n$/,""),spans:Ae}}function z(be,we,Re,Fe,Pe){if(!Re)return;var Ae={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:we,decorations:null};Fe(Ae),Pe.push.apply(Pe,Ae.decorations)}var Q=/\S/;function ie(be){for(var we=void 0,Re=be.firstChild;Re;Re=Re.nextSibling){var Fe=Re.nodeType;we=Fe===1?we?be:Re:Fe===3&&Q.test(Re.nodeValue)?be:we}return we===be?void 0:we}function ce(be,we){var Re={},Fe;(function(){for(var Se=be.concat(we),We=[],Ge={},Xe=0,je=Se.length;Xe<je;++Xe){var qe=Se[Xe],Ue=qe[3];if(Ue)for(var Ke=Ue.length;--Ke>=0;)Re[Ue.charAt(Ke)]=qe;var xe=qe[1],$e=""+xe;Ge.hasOwnProperty($e)||(We.push(xe),Ge[$e]=null)}We.push(/[\0-\uffff]/),Fe=B(We)})();var Pe=we.length,Ae=function(Se){for(var We=Se.sourceCode,Ge=Se.basePos,Xe=Se.sourceNode,je=[Ge,a],qe=0,Ue=We.match(Fe)||[],Ke={},xe=0,$e=Ue.length;xe<$e;++xe){var Ye=Ue[xe],_e=Ke[Ye],Ie=void 0,ne;if(typeof _e=="string")ne=!1;else{var ae=Re[Ye.charAt(0)];if(ae)Ie=Ye.match(ae[1]),_e=ae[0];else{for(var le=0;le<Pe;++le)if(ae=we[le],Ie=Ye.match(ae[1]),Ie){_e=ae[0];break}Ie||(_e=a)}ne=_e.length>=5&&_e.substring(0,5)==="lang-",ne&&!(Ie&&typeof Ie[1]=="string")&&(ne=!1,_e=m),ne||(Ke[Ye]=_e)}var Y=qe;if(qe+=Ye.length,!ne)je.push(Ge+Y,_e);else{var $=Ie[1],J=Ye.indexOf($),ee=J+$.length;Ie[2]&&(ee=Ye.length-Ie[2].length,J=ee-$.length);var me=_e.substring(5);z(Xe,Ge+Y,Ye.substring(0,J),Ae,je),z(Xe,Ge+Y+J,$,oe(me,$),je),z(Xe,Ge+Y+ee,Ye.substring(ee),Ae,je)}}Se.decorations=je};return Ae}function Ce(be){var we=[],Re=[];be.tripleQuotedStrings?we.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?we.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&Re.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Fe=be.hashComments;Fe&&(be.cStyleComments?(Fe>1?we.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([y,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(Re.push([y,/^\/\/[^\r\n]*/,null]),Re.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Pe=be.regexLiterals;if(Pe){var Ae=Pe>1?"":`
|
|
\r`,Se=Ae?".":"[\\S\\s]",We="/(?=[^/*"+Ae+"])(?:[^/\\x5B\\x5C"+Ae+"]|\\x5C"+Se+"|\\x5B(?:[^\\x5C\\x5D"+Ae+"]|\\x5C"+Se+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+X+"("+We+")")])}var Ge=be.types;Ge&&Re.push([h,Ge]);var Xe=(""+be.keywords).replace(/^ | $/g,"");Xe.length&&Re.push([w,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(je+="(?!s*/)"),Re.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(je),null]),ce(we,Re)}var pe=Ce({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(be,we,Re){for(var Fe=/(?:^|\s)nocode(?:\s|$)/,Pe=/\r\n?|\n/,Ae=be.ownerDocument,Se=Ae.createElement("li");be.firstChild;)Se.appendChild(be.firstChild);var We=[Se];function Ge(xe){var $e=xe.nodeType;if($e==1&&!Fe.test(xe.className))if(xe.nodeName==="br")Xe(xe),xe.parentNode&&xe.parentNode.removeChild(xe);else for(var Ye=xe.firstChild;Ye;Ye=Ye.nextSibling)Ge(Ye);else if(($e==3||$e==4)&&Re){var _e=xe.nodeValue,Ie=_e.match(Pe);if(Ie){var ne=_e.substring(0,Ie.index);xe.nodeValue=ne;var ae=_e.substring(Ie.index+Ie[0].length);if(ae){var le=xe.parentNode;le.insertBefore(Ae.createTextNode(ae),xe.nextSibling)}Xe(xe),ne||xe.parentNode.removeChild(xe)}}}function Xe(xe){for(;!xe.nextSibling;)if(xe=xe.parentNode,!xe)return;function $e(Ie,ne){var ae=ne?Ie.cloneNode(!1):Ie,le=Ie.parentNode;if(le){var Y=$e(le,1),$=Ie.nextSibling;Y.appendChild(ae);for(var J=$;J;J=$)$=J.nextSibling,Y.appendChild(J)}return ae}for(var Ye=$e(xe.nextSibling,0),_e;(_e=Ye.parentNode)&&_e.nodeType===1;)Ye=_e;We.push(Ye)}for(var je=0;je<We.length;++je)Ge(We[je]);we===(we|0)&&We[0].setAttribute("value",we);var qe=Ae.createElement("ol");qe.className="linenums";for(var Ue=Math.max(0,we-1|0)||0,je=0,Ke=We.length;je<Ke;++je)Se=We[je],Se.className="L"+(je+Ue)%10,Se.firstChild||Se.appendChild(Ae.createTextNode("\xA0")),qe.appendChild(Se);be.appendChild(qe)}function se(be){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Re=/\n/g,Fe=be.sourceCode,Pe=Fe.length,Ae=0,Se=be.spans,We=Se.length,Ge=0,Xe=be.decorations,je=Xe.length,qe=0;Xe[je]=Pe;var Ue,Ke;for(Ke=Ue=0;Ke<je;)Xe[Ke]!==Xe[Ke+2]?(Xe[Ue++]=Xe[Ke++],Xe[Ue++]=Xe[Ke++]):Ke+=2;for(je=Ue,Ke=Ue=0;Ke<je;){for(var xe=Xe[Ke],$e=Xe[Ke+1],Ye=Ke+2;Ye+2<=je&&Xe[Ye+1]===$e;)Ye+=2;Xe[Ue++]=xe,Xe[Ue++]=$e,Ke=Ye}je=Xe.length=Ue;var _e=be.sourceNode,Ie="";_e&&(Ie=_e.style.display,_e.style.display="none");try{for(var ne=null;Ge<We;){var ae=Se[Ge],le=Se[Ge+2]||Pe,Y=Xe[qe+2]||Pe,Ye=Math.min(le,Y),$=Se[Ge+1],J;if($.nodeType!==1&&(J=Fe.substring(Ae,Ye))){we&&(J=J.replace(Re,"\r")),$.nodeValue=J;var ee=$.ownerDocument,me=ee.createElement("span");me.className=Xe[qe+1];var Ee=$.parentNode;Ee.replaceChild(me,$),me.appendChild($),Ae<le&&(Se[Ge+1]=$=ee.createTextNode(Fe.substring(Ye,le)),Ee.insertBefore($,me.nextSibling))}Ae=Ye,Ae>=le&&(Ge+=2),Ae>=Y&&(qe+=2)}}finally{_e&&(_e.style.display=Ie)}}var de={};function q(be,we){for(var Re=we.length;--Re>=0;){var Fe=we[Re];de.hasOwnProperty(Fe)?k.console&&console.warn("cannot override language handler %s",Fe):de[Fe]=be}}function oe(be,we){return be&&de.hasOwnProperty(be)||(be=/^\s*</.test(we)?"default-markup":"default-code"),de[be]}q(pe,["default-code"]),q(ce([],[[a,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\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"]),q(ce([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!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"]),q(ce([],[[U,/^[\s\S]+/]]),["uq.val"]),q(Ce({keywords:L,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),q(Ce({keywords:"null,true,false"}),["json"]),q(Ce({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),q(Ce({keywords:O,cStyleComments:!0}),["java"]),q(Ce({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),q(Ce({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),q(Ce({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),q(Ce({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),q(Ce({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),q(Ce({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),q(ce([],[[p,/^[\s\S]+/]]),["regex"]);function ye(be){var we=be.langExtension;try{var Re=F(be.sourceNode,be.pre),Fe=Re.sourceCode;be.sourceCode=Fe,be.spans=Re.spans,be.basePos=0,oe(we,Fe)(be),se(be)}catch(Pe){k.console&&console.log(Pe&&Pe.stack||Pe)}}function fe(be,we,Re){var Fe=Re||!1,Pe=we||null,Ae=document.createElement("div");Ae.innerHTML="<pre>"+be+"</pre>",Ae=Ae.firstChild,Fe&&Te(Ae,Fe,!0);var Se={langExtension:Pe,numberLines:Fe,sourceNode:Ae,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ye(Se),Ae.innerHTML}function Le(be,we){var Re=we||document.body,Fe=Re.ownerDocument||document;function Pe(ae){return Re.getElementsByTagName(ae)}for(var Ae=[Pe("pre"),Pe("code"),Pe("xmp")],Se=[],We=0;We<Ae.length;++We)for(var Ge=0,Xe=Ae[We].length;Ge<Xe;++Ge)Se.push(Ae[We][Ge]);Ae=null;var je=Date;je.now||(je={now:function(){return+new Date}});var qe=0,Ue=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ke=/\bprettyprint\b/,xe=/\bprettyprinted\b/,$e=/pre|xmp/i,Ye=/^code$/i,_e=/^(?:pre|code|xmp)$/i,Ie={};function ne(){for(var ae=k.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;qe<Se.length&&je.now()<ae;qe++){for(var le=Se[qe],Y=Ie,$=le;$=$.previousSibling;){var J=$.nodeType,ee=(J===7||J===8)&&$.nodeValue;if(ee?!/^\??prettify\b/.test(ee):J!==3||/\S/.test($.nodeValue))break;if(ee){Y={},ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,pt,Tr){Y[pt]=Tr});break}}var me=le.className;if((Y!==Ie||Ke.test(me))&&!xe.test(me)){for(var Ee=!1,ke=le.parentNode;ke;ke=ke.parentNode){var tt=ke.tagName;if(_e.test(tt)&&ke.className&&Ke.test(ke.className)){Ee=!0;break}}if(!Ee){le.className+=" prettyprinted";var dt=Y.lang;if(!dt){dt=me.match(Ue);var it;!dt&&(it=ie(le))&&Ye.test(it.tagName)&&(dt=it.className.match(Ue)),dt&&(dt=dt[1])}var At;if($e.test(le.tagName))At=1;else{var mt=le.currentStyle,ot=Fe.defaultView,It=mt?mt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(le,null).getPropertyValue("white-space"):0;At=It&&It.substring(0,3)==="pre"}var yt=Y.linenums;(yt=yt==="true"||+yt)||(yt=me.match(/\blinenums\b(?::(\d+))?/),yt=yt?yt[1]&&yt[1].length?+yt[1]:!0:!1),yt&&Te(le,yt,At);var Yt={langExtension:dt,sourceNode:le,numberLines:yt,pre:At,sourceCode:null,basePos:null,spans:null,decorations:null};ye(Yt)}}}qe<Se.length?k.setTimeout(ne,250):typeof be=="function"&&be()}ne()}var ve=k.PR={createSimpleLexer:ce,registerLangHandler:q,sourceDecorator:Ce,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:U,PR_COMMENT:y,PR_DECLARATION:g,PR_KEYWORD:w,PR_LITERAL:c,PR_NOCODE:W,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:m,PR_STRING:p,PR_TAG:v,PR_TYPE:h,prettyPrintOne:D?k.prettyPrintOne=fe:P=fe,prettyPrint:N=D?k.prettyPrint=Le:N=Le},De=k.define;typeof De=="function"&&De.amd&&De("google-code-prettify",[],function(){return ve})})()},"VrN/":function(ut,Ze,te){(function(Z,G){ut.exports=G()})(this,function(){"use strict";var Z=navigator.userAgent,G=navigator.platform,D=/gecko\/\d/i.test(Z),K=/MSIE \d/.test(Z),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Z),P=/Edge\/(\d+)/.exec(Z),N=K||M||P,k=N&&(K?document.documentMode||6:+(P||M)[1]),A=!P&&/WebKit\//.test(Z),_=A&&/Qt\/\d+\.\d+/.test(Z),x=!P&&/Chrome\//.test(Z),L=/Opera\//.test(Z),O=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Z),S=/PhantomJS/.test(Z),b=!P&&/AppleWebKit/.test(Z)&&/Mobile\/\w+/.test(Z),d=/Android/.test(Z),o=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Z),s=b||/Mac/.test(G),u=/\bCrOS\b/.test(Z),T=/win/i.test(G),f=L&&Z.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(L=!1,A=!0);var p=s&&(_||L&&(f==null||f<12.11)),w=D||N&&k>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=y(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function 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 E=0;E<t.length;++E)i.appendChild(t[E]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var g;document.createRange?g=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:g=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function m(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 R(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function W(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(n[r]).test(t)&&(t+=" "+n[r]);return t}var X=function(e){e.select()};b?X=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:N&&(X=function(e){try{e.select()}catch(t){}});function B(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(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 z(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var E=r||0,I=i||0;;){var j=e.indexOf(" ",E);if(j<0||j>=t)return I+(t-E);I+=j-E,I+=n-I%n,E=j+1}}var Q=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};Q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Q.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 ie(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ce=50,Ce={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},Te={origin:"*mouse"},se={origin:"+move"};function de(e,t,n){for(var r=0,i=0;;){var E=e.indexOf(" ",r);E==-1&&(E=e.length);var I=E-r;if(E==e.length||i+I>=t)return r+Math.min(I,t-i);if(i+=E-r,i+=n-i%n,r=E+1,i>=t)return r}}var q=[""];function oe(e){for(;q.length<=e;)q.push(ye(q)+" ");return q[e]}function ye(e){return e[e.length-1]}function fe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Le(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ve(){}function De(e,t){var n;return Object.create?n=Object.create(e):(ve.prototype=e,n=new ve),t&&F(t,n),n}var be=/[\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()||be.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Fe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Pe=/[\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 Ae(e){return e.charCodeAt(0)>=768&&Pe.test(e)}function Se(e,t,n){for(;(n<0?t>0:t<e.length)&&Ae(e.charAt(t));)t+=n;return t}function We(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,E=r<0?Math.ceil(i):Math.floor(i);if(E==t)return e(E)?t:n;e(E)?n=E:t=E+r}}function Ge(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,E=0;E<e.length;++E){var I=e[E];(I.from<n&&I.to>t||t==n&&I.to==t)&&(r(Math.max(I.from,t),Math.min(I.to,n),I.level==1?"rtl":"ltr",E),i=!0)}i||r(t,n,"ltr")}var Xe=null;function je(e,t,n){var r;Xe=null;for(var i=0;i<e.length;++i){var E=e[i];if(E.from<t&&E.to>t)return i;E.to==t&&(E.from!=E.to&&n=="before"?r=i:Xe=i),E.from==t&&(E.from!=E.to&&n!="before"?r=i:Xe=i)}return r!=null?r:Xe}var qe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(V){return V<=247?e.charAt(V):1424<=V&&V<=1524?"R":1536<=V&&V<=1785?t.charAt(V-1536):1774<=V&&V<=2220?"r":8192<=V&&V<=8203?"w":V==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,E=/[LRr]/,I=/[Lb1n]/,j=/[1n]/;function H(V,re,ue){this.level=V,this.from=re,this.to=ue}return function(V,re){var ue=re=="ltr"?"L":"R";if(V.length==0||re=="ltr"&&!r.test(V))return!1;for(var ge=V.length,he=[],Oe=0;Oe<ge;++Oe)he.push(n(V.charCodeAt(Oe)));for(var Me=0,Be=ue;Me<ge;++Me){var ze=he[Me];ze=="m"?he[Me]=Be:Be=ze}for(var Je=0,Ve=ue;Je<ge;++Je){var Qe=he[Je];Qe=="1"&&Ve=="r"?he[Je]="n":E.test(Qe)&&(Ve=Qe,Qe=="r"&&(he[Je]="R"))}for(var at=1,nt=he[0];at<ge-1;++at){var ht=he[at];ht=="+"&&nt=="1"&&he[at+1]=="1"?he[at]="1":ht==","&&nt==he[at+1]&&(nt=="1"||nt=="n")&&(he[at]=nt),nt=ht}for(var Tt=0;Tt<ge;++Tt){var Bt=he[Tt];if(Bt==",")he[Tt]="N";else if(Bt=="%"){var _t=void 0;for(_t=Tt+1;_t<ge&&he[_t]=="%";++_t);for(var ir=Tt&&he[Tt-1]=="!"||_t<ge&&he[_t]=="1"?"1":"N",qt=Tt;qt<_t;++qt)he[qt]=ir;Tt=_t-1}}for(var Mt=0,er=ue;Mt<ge;++Mt){var Ht=he[Mt];er=="L"&&Ht=="1"?he[Mt]="L":E.test(Ht)&&(er=Ht)}for(var Ft=0;Ft<ge;++Ft)if(i.test(he[Ft])){var kt=void 0;for(kt=Ft+1;kt<ge&&i.test(he[kt]);++kt);for(var Ot=(Ft?he[Ft-1]:ue)=="L",tr=(kt<ge?he[kt]:ue)=="L",In=Ot==tr?Ot?"L":"R":ue,Gr=Ft;Gr<kt;++Gr)he[Gr]=In;Ft=kt-1}for(var Xt=[],xr,jt=0;jt<ge;)if(I.test(he[jt])){var Ia=jt;for(++jt;jt<ge&&I.test(he[jt]);++jt);Xt.push(new H(0,Ia,jt))}else{var Or=jt,un=Xt.length,dn=re=="rtl"?1:0;for(++jt;jt<ge&&he[jt]!="L";++jt);for(var Jt=Or;Jt<jt;)if(j.test(he[Jt])){Or<Jt&&(Xt.splice(un,0,new H(1,Or,Jt)),un+=dn);var Fn=Jt;for(++Jt;Jt<jt&&j.test(he[Jt]);++Jt);Xt.splice(un,0,new H(2,Fn,Jt)),un+=dn,Or=Jt}else++Jt;Or<jt&&Xt.splice(un,0,new H(1,Or,jt))}return re=="ltr"&&(Xt[0].level==1&&(xr=V.match(/^\s+/))&&(Xt[0].from=xr[0].length,Xt.unshift(new H(0,0,xr[0].length))),ye(Xt).level==1&&(xr=V.match(/\s+$/))&&(ye(Xt).to-=xr[0].length,Xt.push(new H(0,ge-xr[0].length,ge)))),re=="rtl"?Xt.reverse():Xt}}();function Ue(e,t){var n=e.order;return n==null&&(n=e.order=qe(e.text,t)),n}var Ke=[],xe=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]||Ke).concat(n)}};function $e(e,t){return e._handlers&&e._handlers[t]||Ke}function Ye(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 E=ie(i,n);E>-1&&(r[t]=i.slice(0,E).concat(i.slice(E+1)))}}}function _e(e,t){var n=$e(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ie(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),_e(e,n||t.type,e,t),J(t)||t.codemirrorIgnore}function ne(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)ie(n,t[r])==-1&&n.push(t[r])}function ae(e,t){return $e(e,t).length>0}function le(e){e.prototype.on=function(t,n){xe(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function J(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ee(e){Y(e),$(e)}function me(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var ke=function(){if(N&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function dt(e){if(tt==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(N&&k<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var it;function At(e){if(it!=null)return it;var t=l(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:it=r.right-n.right<3}var mt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var E=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),I=E.indexOf("\r");I!=-1?(n.push(E.slice(0,I)),t+=I+1):(n.push(E),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},It=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),yt=null;function Yt(e){if(yt!=null)return yt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return yt=Math.abs(n.left-r.left)>1}var Wt={},pt={};function Tr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function zr(e,t){pt[e]=t}function lr(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=De(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Sr(e,t){t=lr(t);var n=Wt[t.name];if(!n)return Sr(e,"text/plain");var r=n(e,t);if(hr.hasOwnProperty(t.name)){var i=hr[t.name];for(var E in i){if(!i.hasOwnProperty(E))continue;r.hasOwnProperty(E)&&(r["_"+E]=r[E]),r[E]=i[E]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var I in t.modeProps)r[I]=t.modeProps[I];return r}var hr={};function yi(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};F(t,n)}function ur(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Vr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function cn(e,t,n){return e.startState?e.startState(t,n):!0}var Ct=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ct.prototype.eol=function(){return this.pos>=this.string.length},Ct.prototype.sol=function(){return this.pos==this.lineStart},Ct.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ct.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ct.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Ct.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ct.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ct.prototype.skipToEnd=function(){this.pos=this.string.length},Ct.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ct.prototype.backUp=function(e){this.pos-=e},Ct.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(I){return n?I.toLowerCase():I},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var E=this.string.slice(this.pos).match(e);return E&&E.index>0?null:(E&&t!==!1&&(this.pos+=E[0].length),E)}},Ct.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ct.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ct.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ct.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function et(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],E=i.chunkSize();if(t<E){n=i;break}t-=E}return n.lines[t]}function wr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(E){var I=E.text;i==n.line&&(I=I.slice(0,n.ch)),i==t.line&&(I=I.slice(t.ch)),r.push(I),++i}),r}function fn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function dr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function gt(e){if(e.parent==null)return null;for(var t=e.parent,n=ie(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Cr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],E=i.height;if(t<E){e=i;continue e}t-=E,n+=i.chunkSize()}return n}while(!e.lines);for(var I=0;I<e.lines.length;++I){var j=e.lines[I],H=j.height;if(t<H)break;t-=H}return n+I}function Rr(e,t){return t>=e.first&&t<e.first+e.size}function Xr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function 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 lt(e,t){return e.line-t.line||e.ch-t.ch}function He(e,t){return e.sticky==t.sticky&<(e,t)==0}function Nn(e){return Ne(e.line,e.ch)}function hn(e,t){return lt(e,t)<0?t:e}function Yr(e,t){return lt(e,t)<0?e:t}function $r(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function st(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,et(e,n).text.length):Qi(t,et(e,t.line).text.length)}function Qi(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Un(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=st(e,t[r]);return n}var cr=function(e,t){this.state=e,this.lookAhead=t},ar=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ar.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ar.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ar.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ar.fromSaved=function(e,t,n){return t instanceof cr?new ar(e,ur(e.mode,t.state),n,t.lookAhead):new ar(e,ur(e.mode,t),n)},ar.prototype.save=function(e){var t=e!==!1?ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new cr(t,this.maxLookAhead):t};function bi(e,t,n,r){var i=[e.state.modeGen],E={};jn(e,t.text,e.doc.mode,n,function(V,re){return i.push(V,re)},E,r);for(var I=n.state,j=function(V){n.baseTokens=i;var re=e.state.overlays[V],ue=1,ge=0;n.state=!0,jn(e,t.text,re.mode,n,function(he,Oe){for(var Me=ue;ge<he;){var Be=i[ue];Be>he&&i.splice(ue,1,he,i[ue+1],Be),ue+=2,ge=Math.min(he,Be)}if(!Oe)return;if(re.opaque)i.splice(Me,ue-Me,he,"overlay "+Oe),ue=Me+2;else for(;Me<ue;Me+=2){var ze=i[Me+1];i[Me+1]=(ze?ze+" ":"")+"overlay "+Oe}},E),n.state=I,n.baseTokens=null,n.baseTokenPos=1},H=0;H<e.state.overlays.length;++H)j(H);return{styles:i,classes:E.bgClass||E.textClass?E:null}}function Bn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=rr(e,gt(t)),i=t.text.length>e.options.maxHighlightLength&&ur(e.doc.mode,r.state),E=bi(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=E.styles,E.classes?t.styleClasses=E.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function rr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ar(r,!0,t);var E=Jr(e,t,n),I=E>r.first&&et(r,E-1).stateAfter,j=I?ar.fromSaved(r,I,E):new ar(r,cn(r.mode),E);return r.iter(E,t,function(H){mn(e,H.text,j);var V=j.line;H.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?j.save():null,j.nextLine()}),n&&(r.modeFrontier=j.line),j}function mn(e,t,n,r){var i=e.doc.mode,E=new Ct(t,e.options.tabSize,n);for(E.start=E.pos=r||0,t==""&&Ei(i,n.state);!E.eol();)pn(i,E,n.state),E.start=E.pos}function Ei(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Vr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Vr(e,n).mode);var E=e.token(t,n);if(t.pos>t.start)return E}throw new Error("Mode "+e.name+" failed to advance stream.")}var Lr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Dr(e,t,n,r){var i=e.doc,E=i.mode,I;t=st(i,t);var j=et(i,t.line),H=rr(e,t.line,n),V=new Ct(j.text,e.options.tabSize,H),re;for(r&&(re=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,I=pn(E,V,H.state),r&&re.push(new Lr(V,I,ur(i.mode,H.state)));return r?re:new Lr(V,I,H.state)}function xi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function jn(e,t,n,r,i,E,I){var j=n.flattenSpans;j==null&&(j=e.options.flattenSpans);var H=0,V=null,re=new Ct(t,e.options.tabSize,r),ue,ge=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),E);!re.eol();){if(re.pos>e.options.maxHighlightLength?(j=!1,I&&mn(e,t,r,re.pos),re.pos=t.length,ue=null):ue=xi(pn(n,re,r.state,ge),E),ge){var he=ge[0].name;he&&(ue="m-"+(ue?he+" "+ue:he))}if(!j||V!=ue){for(;H<re.start;)H=Math.min(re.start,H+5e3),i(H,V);V=ue}re.start=re.pos}for(;H<re.pos;){var Oe=Math.min(re.pos,H+5e3);i(Oe,V),H=Oe}}function Jr(e,t,n){for(var r,i,E=e.doc,I=n?-1:t-(e.doc.mode.innerMode?1e3:100),j=t;j>I;--j){if(j<=E.first)return E.first;var H=et(E,j-1),V=H.stateAfter;if(V&&(!n||j+(V instanceof cr?V.lookAhead:0)<=E.modeFrontier))return j;var re=z(H.text,null,e.options.tabSize);(i==null||r>re)&&(i=j-1,r=re)}return i}function Wn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=et(e,r).stateAfter;if(i&&(!(i instanceof cr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ti=!1,fr=!1;function Si(){Ti=!0}function wi(){fr=!0}function gn(e,t,n){this.marker=e,this.from=t,this.to=n}function Pr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Na(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Kn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Qr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],I=E.marker,j=E.from==null||(I.inclusiveLeft?E.from<=t:E.from<t);if(j||E.from==t&&I.type=="bookmark"&&(!n||!E.marker.insertLeft)){var H=E.to==null||(I.inclusiveRight?E.to>=t:E.to>t);(r||(r=[])).push(new gn(I,E.from,H?null:E.to))}}return r}function Hn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],I=E.marker,j=E.to==null||(I.inclusiveRight?E.to>=t:E.to>t);if(j||E.from==t&&I.type=="bookmark"&&(!n||E.marker.insertLeft)){var H=E.from==null||(I.inclusiveLeft?E.from<=t:E.from<t);(r||(r=[])).push(new gn(I,H?null:E.from-t,E.to==null?null:E.to-t))}}return r}function Mr(e,t){if(t.full)return null;var n=Rr(e,t.from.line)&&et(e,t.from.line).markedSpans,r=Rr(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,E=t.to.ch,I=lt(t.from,t.to)==0,j=Qr(n,i,I),H=Hn(r,E,I),V=t.text.length==1,re=ye(t.text).length+(V?i:0);if(j)for(var ue=0;ue<j.length;++ue){var ge=j[ue];if(ge.to==null){var he=Pr(H,ge.marker);he?V&&(ge.to=he.to==null?null:he.to+re):ge.to=i}}if(H)for(var Oe=0;Oe<H.length;++Oe){var Me=H[Oe];if(Me.to!=null&&(Me.to+=re),Me.from==null){var Be=Pr(j,Me.marker);Be||(Me.from=re,V&&(j||(j=[])).push(Me))}else Me.from+=re,V&&(j||(j=[])).push(Me)}j&&(j=Zr(j)),H&&H!=j&&(H=Zr(H));var ze=[j];if(!V){var Je=t.text.length-2,Ve;if(Je>0&&j)for(var Qe=0;Qe<j.length;++Qe)j[Qe].to==null&&(Ve||(Ve=[])).push(new gn(j[Qe].marker,null,null));for(var at=0;at<Je;++at)ze.push(Ve);ze.push(H)}return ze}function Zr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(he){if(he.markedSpans)for(var Oe=0;Oe<he.markedSpans.length;++Oe){var Me=he.markedSpans[Oe].marker;Me.readOnly&&(!r||ie(r,Me)==-1)&&(r||(r=[])).push(Me)}}),!r)return null;for(var i=[{from:t,to:n}],E=0;E<r.length;++E)for(var I=r[E],j=I.find(0),H=0;H<i.length;++H){var V=i[H];if(lt(V.to,j.from)<0||lt(V.from,j.to)>0)continue;var re=[H,1],ue=lt(V.from,j.from),ge=lt(V.to,j.to);(ue<0||!I.inclusiveLeft&&!ue)&&re.push({from:V.from,to:j.from}),(ge>0||!I.inclusiveRight&&!ge)&&re.push({from:j.to,to:V.to}),i.splice.apply(i,re),H+=re.length-3}return i}function Gn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function qr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function vn(e){return e.inclusiveLeft?-1:0}function yr(e){return e.inclusiveRight?1:0}function zn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),E=lt(r.from,i.from)||vn(e)-vn(t);if(E)return-E;var I=lt(r.to,i.to)||yr(e)-yr(t);return I||t.id-e.id}function Li(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=void 0,E=0;E<n.length;++E)i=n[E],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||zn(r,i.marker)<0)&&(r=i.marker);return r}function Di(e){return Li(e,!0)}function Vn(e){return Li(e,!1)}function Ua(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var E=n[i];E.marker.collapsed&&(E.from==null||E.from<t)&&(E.to==null||E.to>t)&&(!r||zn(r,E.marker)<0)&&(r=E.marker)}return r}function Zi(e,t,n,r,i){var E=et(e,t),I=fr&&E.markedSpans;if(I)for(var j=0;j<I.length;++j){var H=I[j];if(!H.marker.collapsed)continue;var V=H.marker.find(0),re=lt(V.from,n)||vn(H.marker)-vn(i),ue=lt(V.to,r)||yr(H.marker)-yr(i);if(re>=0&&ue<=0||re<=0&&ue>=0)continue;if(re<=0&&(H.marker.inclusiveRight&&i.inclusiveLeft?lt(V.to,n)>=0:lt(V.to,n)>0)||re>=0&&(H.marker.inclusiveRight&&i.inclusiveLeft?lt(V.from,r)<=0:lt(V.from,r)<0))return!0}}function rt(e){for(var t;t=Di(e);)e=t.find(-1,!0).line;return e}function ct(e){for(var t;t=Vn(e);)e=t.find(1,!0).line;return e}function ft(e){for(var t,n;t=Vn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Et(e,t){var n=et(e,t),r=rt(n);return n==r?t:gt(r)}function xt(e,t){if(t>e.lastLine())return t;var n=et(e,t),r;if(!St(e,n))return t;for(;r=Vn(n);)n=r.find(1,!0).line;return gt(n)+1}function St(e,t){var n=fr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Rt(e,t,r))return!0}}function Rt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Rt(e,r.line,Pr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,E=0;E<t.markedSpans.length;++E)if(i=t.markedSpans[E],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Rt(e,t,i))return!0}function Lt(e){e=rt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var E=n.parent;E;n=E,E=n.parent)for(var I=0;I<E.children.length;++I){var j=E.children[I];if(j==n)break;t+=j.height}return t}function Gt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Di(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Vn(r);){var E=n.find(0,!0);t-=r.text.length-E.from.ch,r=E.to.line,t+=r.text.length-E.to.ch}return t}function mr(e){var t=e.display,n=e.doc;t.maxLine=et(n,n.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Gt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var wt=function(e,t,n){this.text=e,qr(this,t),this.height=n?n(this):1};wt.prototype.lineNo=function(){return gt(this)},le(wt);function kr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Gn(e),qr(e,n);var i=r?r(e):1;i!=e.height&&dr(e,i)}function zt(e){e.parent=null,Gn(e)}var Ir={},Fr={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Fr:Ir;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(e,t){var n=v("span",null,null,A?"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 E=i?t.rest[i-1]:t.line,I=void 0;r.pos=0,r.addToken=Cs,At(e.display.measure)&&(I=Ue(E,e.doc.direction))&&(r.addToken=Ds(r.addToken,I)),r.map=[];var j=t!=e.display.externalMeasured&>(E);As(E,r,Bn(e,E,j)),E.styleClasses&&(E.styleClasses.bgClass&&(r.bgClass=W(E.styleClasses.bgClass,r.bgClass||"")),E.styleClasses.textClass&&(r.textClass=W(E.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(dt(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(A){var H=r.content.lastChild;(/\bcm-tab\b/.test(H.className)||H.querySelector&&H.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return _e(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=W(r.pre.className,r.textClass||"")),r}function ws(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,E,I){if(!t)return;var j=e.splitSpaces?Ls(t,e.trailingSpace):t,H=e.cm.state.specialChars,V=!1,re;if(!H.test(t))e.col+=t.length,re=document.createTextNode(j),e.map.push(e.pos,e.pos+t.length,re),N&&k<9&&(V=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var ue=0;;){H.lastIndex=ue;var ge=H.exec(t),he=ge?ge.index-ue:t.length-ue;if(he){var Oe=document.createTextNode(j.slice(ue,ue+he));N&&k<9?re.appendChild(a("span",[Oe])):re.appendChild(Oe),e.map.push(e.pos,e.pos+he,Oe),e.col+=he,e.pos+=he}if(!ge)break;ue+=he+1;var Me=void 0;if(ge[0]==" "){var Be=e.cm.options.tabSize,ze=Be-e.col%Be;Me=re.appendChild(a("span",oe(ze),"cm-tab")),Me.setAttribute("role","presentation"),Me.setAttribute("cm-text"," "),e.col+=ze}else ge[0]=="\r"||ge[0]==`
|
|
`?(Me=re.appendChild(a("span",ge[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Me.setAttribute("cm-text",ge[0]),e.col+=1):(Me=e.cm.options.specialCharPlaceholder(ge[0]),Me.setAttribute("cm-text",ge[0]),N&&k<9?re.appendChild(a("span",[Me])):re.appendChild(Me),e.col+=1);e.map.push(e.pos,e.pos+1,Me),e.pos++}}if(e.trailingSpace=j.charCodeAt(t.length-1)==32,n||r||i||V||E||I){var Je=n||"";r&&(Je+=r),i&&(Je+=i);var Ve=a("span",[re],Je,E);if(I)for(var Qe in I)I.hasOwnProperty(Qe)&&Qe!="style"&&Qe!="class"&&Ve.setAttribute(Qe,I[Qe]);return e.content.appendChild(Ve)}e.content.appendChild(re)}function Ls(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var E=e.charAt(i);E==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(E="\xA0"),r+=E,n=E==" "}return r}function Ds(e,t){return function(n,r,i,E,I,j,H){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,re=V+r.length;;){for(var ue=void 0,ge=0;ge<t.length&&!(ue=t[ge],ue.to>V&&ue.from<=V);ge++);if(ue.to>=re)return e(n,r,i,E,I,j,H);e(n,r.slice(0,ue.to-V),i,E,null,j,H),E=null,r=r.slice(ue.to-V),V=ue.to}}}function ja(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function As(e,t,n){var r=e.markedSpans,i=e.text,E=0;if(!r){for(var I=1;I<n.length;I+=2)t.addToken(t,i.slice(E,E=n[I]),yn(n[I+1],t.cm.options));return}for(var j=i.length,H=0,V=1,re="",ue,ge,he=0,Oe,Me,Be,ze,Je;;){if(he==H){Oe=Me=Be=ge="",Je=null,ze=null,he=Infinity;for(var Ve=[],Qe=void 0,at=0;at<r.length;++at){var nt=r[at],ht=nt.marker;if(ht.type=="bookmark"&&nt.from==H&&ht.widgetNode)Ve.push(ht);else if(nt.from<=H&&(nt.to==null||nt.to>H||ht.collapsed&&nt.to==H&&nt.from==H)){if(nt.to!=null&&nt.to!=H&&he>nt.to&&(he=nt.to,Me=""),ht.className&&(Oe+=" "+ht.className),ht.css&&(ge=(ge?ge+";":"")+ht.css),ht.startStyle&&nt.from==H&&(Be+=" "+ht.startStyle),ht.endStyle&&nt.to==he&&(Qe||(Qe=[])).push(ht.endStyle,nt.to),ht.title&&((Je||(Je={})).title=ht.title),ht.attributes)for(var Tt in ht.attributes)(Je||(Je={}))[Tt]=ht.attributes[Tt];ht.collapsed&&(!ze||zn(ze.marker,ht)<0)&&(ze=nt)}else nt.from>H&&he>nt.from&&(he=nt.from)}if(Qe)for(var Bt=0;Bt<Qe.length;Bt+=2)Qe[Bt+1]==he&&(Me+=" "+Qe[Bt]);if(!ze||ze.from==H)for(var _t=0;_t<Ve.length;++_t)ja(t,0,Ve[_t]);if(ze&&(ze.from||0)==H){if(ja(t,(ze.to==null?j+1:ze.to)-H,ze.marker,ze.from==null),ze.to==null)return;ze.to==H&&(ze=!1)}}if(H>=j)break;for(var ir=Math.min(j,he);;){if(re){var qt=H+re.length;if(!ze){var Mt=qt>ir?re.slice(0,ir-H):re;t.addToken(t,Mt,ue?ue+Oe:Oe,Be,H+Mt.length==he?Me:"",ge,Je)}if(qt>=ir){re=re.slice(ir-H),H=ir;break}H=qt,Be=""}re=i.slice(E,E=n[V++]),ue=yn(n[V++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=ft(t),this.size=this.rest?gt(ye(this.rest))-n+1:1,this.node=this.text=null,this.hidden=St(e,t)}function Ai(e,t,n){for(var r=[],i,E=t;E<n;E=i){var I=new Wa(e.doc,et(e.doc,E),E);i=E+I.size,r.push(I)}return r}var bn=null;function _s(e){bn?bn.ops.push(e):e.ownsGroup=bn={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{bn=null,t(n)}}var Xn=null;function Kt(e,t){var n=$e(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;bn?i=bn.delayedCallbacks:Xn?i=Xn:(i=Xn=[],setTimeout(Ps,0));for(var E=function(j){i.push(function(){return n[j].apply(null,r)})},I=0;I<n.length;++I)E(I)}function Ps(){var e=Xn;Xn=null;for(var t=0;t<e.length;++t)e[t]()}function Ka(e,t,n,r){for(var i=0;i<t.changes.length;i++){var E=t.changes[i];E=="text"?ks(e,t):E=="gutter"?Ga(e,t,n,r):E=="class"?qi(e,t):E=="widget"&&Is(e,t,r)}t.changes=null}function Yn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),N&&k<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=Yn(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ha(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function ks(e,t){var n=t.text.className,r=Ha(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){Ms(e,t),t.line.wrapClass?Yn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ga(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=Yn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var E=t.line.gutterMarkers;if(e.options.lineNumbers||E){var I=Yn(t),j=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(j),I.insertBefore(j,t.text),t.line.gutterClass&&(j.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!E||!E["CodeMirror-linenumbers"])&&(t.lineNumber=j.appendChild(a("div",Xr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),E)for(var H=0;H<e.display.gutterSpecs.length;++H){var V=e.display.gutterSpecs[H].className,re=E.hasOwnProperty(V)&&E[V];re&&j.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),i=t.node.firstChild,E=void 0;i;i=E)E=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Fs(e,t,n,r){var i=Ha(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),Ga(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var E=Yn(n),I=0,j=t.widgets;I<j.length;++I){var H=j[I],V=a("div",[H.node],"CodeMirror-linewidget"+(H.className?" "+H.className:""));H.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(H,V,n,r),e.display.input.setUneditable(V),i&&H.above?E.insertBefore(V,n.gutter||n.text):E.appendChild(V),Kt(H,"redraw")}}function Ns(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function $n(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!m(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 Ar(e,t){for(var n=me(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 _i(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function br(e){return ce-e.display.nativeBarWidth}function en(e){return e.display.scroller.clientWidth-br(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-br(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&en(e);if(!t.measure.heights||r&&t.measure.width!=i){var E=t.measure.heights=[];if(r){t.measure.width=i;for(var I=t.text.firstChild.getClientRects(),j=0;j<I.length-1;j++){var H=I[j],V=I[j+1];Math.abs(H.bottom-V.bottom)>2&&E.push((H.bottom+V.top)/2-n.top)}}E.push(n.bottom-n.top)}}function Ya(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(gt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=rt(t);var n=gt(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function $a(e,t,n,r){return Er(e,En(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function En(e,t){var n=gt(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ka(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Er(e,t,n,r,i){t.before&&(n=-1);var E=n+(r||""),I;return t.cache.hasOwnProperty(E)?I=t.cache[E]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),I=Ws(e,t,n,r),I.bogus||(t.cache[E]=I)),{left:I.left,right:I.right,top:i?I.rtop:I.top,bottom:i?I.rbottom:I.bottom}}var Ja={left:0,right:0,top:0,bottom:0};function Qa(e,t,n){for(var r,i,E,I,j,H,V=0;V<e.length;V+=3)if(j=e[V],H=e[V+1],t<j?(i=0,E=1,I="left"):t<H?(i=t-j,E=i+1):(V==e.length-3||t==H&&e[V+3]>t)&&(E=H-j,i=E-1,t>=H&&(I="right")),i!=null){if(r=e[V+2],j==H&&n==(r.insertLeft?"left":"right")&&(I=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],I="left";if(n=="right"&&i==H-j)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],I="right";break}return{node:r,start:i,end:E,collapse:I,coverStart:j,coverEnd:H}}function js(e,t){var n=Ja;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=Qa(t.map,n,r),E=i.node,I=i.start,j=i.end,H=i.collapse,V;if(E.nodeType==3){for(var re=0;re<4;re++){for(;I&&Ae(t.line.text.charAt(i.coverStart+I));)--I;for(;i.coverStart+j<i.coverEnd&&Ae(t.line.text.charAt(i.coverStart+j));)++j;if(N&&k<9&&I==0&&j==i.coverEnd-i.coverStart?V=E.parentNode.getBoundingClientRect():V=js(g(E,I,j).getClientRects(),r),V.left||V.right||I==0)break;j=I,I=I-1,H="right"}N&&k<11&&(V=Ks(e.display.measure,V))}else{I>0&&(H=r="right");var ue;e.options.lineWrapping&&(ue=E.getClientRects()).length>1?V=ue[r=="right"?ue.length-1:0]:V=E.getBoundingClientRect()}if(N&&k<9&&!I&&(!V||!V.left&&!V.right)){var ge=E.parentNode.getClientRects()[0];ge?V={left:ge.left,right:ge.left+Tn(e.display),top:ge.top,bottom:ge.bottom}:V=Ja}for(var he=V.top-t.rect.top,Oe=V.bottom-t.rect.top,Me=(he+Oe)/2,Be=t.view.measure.heights,ze=0;ze<Be.length-1&&!(Me<Be[ze]);ze++);var Je=ze?Be[ze-1]:0,Ve=Be[ze],Qe={left:(H=="right"?V.right:V.left)-t.rect.left,right:(H=="left"?V.left:V.right)-t.rect.left,top:Je,bottom:Ve};return!V.left&&!V.right&&(Qe.bogus=!0),e.options.singleCursorHeightPerLine||(Qe.rtop=he,Qe.rbottom=Oe),Qe}function Ks(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Za(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function qa(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Za(e.display.view[t])}function Jn(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return x&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return x&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=$n(e.widgets[n]));return t}function Oi(e,t,n,r,i){if(!i){var E=na(t);n.top+=E,n.bottom+=E}if(r=="line")return n;r||(r="local");var I=Lt(t);if(r=="local"?I+=_i(e.display):I-=e.display.viewOffset,r=="page"||r=="window"){var j=e.display.lineSpace.getBoundingClientRect();I+=j.top+(r=="window"?0:to());var H=j.left+(r=="window"?0:eo());n.left+=H,n.right+=H}return n.top+=I,n.bottom+=I,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();else if(n=="local"||!n){var E=e.display.sizer.getBoundingClientRect();r+=E.left,i+=E.top}var I=e.display.lineSpace.getBoundingClientRect();return{left:r-I.left,top:i-I.top}}function ia(e,t,n,r,i){return r||(r=et(e.doc,t.line)),Oi(e,r,$a(e,r,t.ch,i),n)}function pr(e,t,n,r,i,E){r=r||et(e.doc,t.line),i||(i=En(e,r));function I(Oe,Me){var Be=Er(e,i,Oe,Me?"right":"left",E);return Me?Be.left=Be.right:Be.right=Be.left,Oi(e,r,Be,n)}var j=Ue(r,e.doc.direction),H=t.ch,V=t.sticky;if(H>=r.text.length?(H=r.text.length,V="before"):H<=0&&(H=0,V="after"),!j)return I(V=="before"?H-1:H,V=="before");function re(Oe,Me,Be){var ze=j[Me],Je=ze.level==1;return I(Be?Oe-1:Oe,Je!=Be)}var ue=je(j,H,V),ge=Xe,he=re(H,ue,V=="before");return ge!=null&&(he.other=re(H,ge,V!="before")),he}function no(e,t){var n=0;t=st(e.doc,t),e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=et(e.doc,t.line),i=Lt(r)+_i(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var E=Ne(e,t,n);return E.xRel=i,r&&(E.outside=r),E}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=Cr(r,n),E=r.first+r.size-1;if(i>E)return aa(r.first+r.size-1,et(r,E).text.length,null,1,1);t<0&&(t=0);for(var I=et(r,i);;){var j=Hs(e,I,i,t,n),H=Ua(I,j.ch+(j.xRel>0||j.outside>0?1:0));if(!H)return j;var V=H.find(1);if(V.line==i)return V;I=et(r,i=V.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,E=We(function(I){return Er(e,n,I-1).bottom<=r},i,0);return i=We(function(I){return Er(e,n,I).top>r},E,i),{begin:E,end:i}}function ao(e,t,n,r){n||(n=En(e,t));var i=Oi(e,t,Er(e,n,r),"line").top;return io(e,t,n,i)}function sa(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Hs(e,t,n,r,i){i-=Lt(t);var E=En(e,t),I=na(t),j=0,H=t.text.length,V=!0,re=Ue(t,e.doc.direction);if(re){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,E,re,r,i);V=ue.level!=1,j=V?ue.from:ue.to-1,H=V?ue.to:ue.from-1}var ge=null,he=null,Oe=We(function(at){var nt=Er(e,E,at);return nt.top+=I,nt.bottom+=I,sa(nt,r,i,!1)?(nt.top<=i&&nt.left<=r&&(ge=at,he=nt),!0):!1},j,H),Me,Be,ze=!1;if(he){var Je=r-he.left<he.right-r,Ve=Je==V;Oe=ge+(Ve?0:1),Be=Ve?"after":"before",Me=Je?he.left:he.right}else{!V&&(Oe==H||Oe==j)&&Oe++,Be=Oe==0?"after":Oe==t.text.length?"before":Er(e,E,Oe-(V?1:0)).bottom+I<=i==V?"after":"before";var Qe=pr(e,Ne(n,Oe,Be),"line",t,E);Me=Qe.left,ze=i<Qe.top?-1:i>=Qe.bottom?1:0}return Oe=Se(t.text,Oe,1),aa(n,Oe,Be,ze,r-Me)}function Gs(e,t,n,r,i,E,I){var j=We(function(ue){var ge=i[ue],he=ge.level!=1;return sa(pr(e,Ne(n,he?ge.to:ge.from,he?"before":"after"),"line",t,r),E,I,!0)},0,i.length-1),H=i[j];if(j>0){var V=H.level!=1,re=pr(e,Ne(n,V?H.from:H.to,V?"after":"before"),"line",t,r);sa(re,E,I,!0)&&re.top>I&&(H=i[j-1])}return H}function zs(e,t,n,r,i,E,I){var j=io(e,t,r,I),H=j.begin,V=j.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var re=null,ue=null,ge=0;ge<i.length;ge++){var he=i[ge];if(he.from>=V||he.to<=H)continue;var Oe=he.level!=1,Me=Er(e,r,Oe?Math.min(V,he.to)-1:Math.max(H,he.from)).right,Be=Me<E?E-Me+1e9:Me-E;(!re||ue>Be)&&(re=he,ue=Be)}return re||(re=i[i.length-1]),re.from<H&&(re={from:H,to:re.to,level:re.level}),re.to>V&&(re={from:re.from,to:V,level:re.level}),re}var tn;function xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(tn==null){tn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)tn.appendChild(document.createTextNode("x")),tn.appendChild(a("br"));tn.appendChild(document.createTextNode("x"))}l(e.measure,tn);var n=tn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function la(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,E=t.gutters.firstChild,I=0;E;E=E.nextSibling,++I){var j=e.display.gutterSpecs[I].className;n[j]=E.offsetLeft+E.clientLeft+i,r[j]=E.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Tn(e.display)-3);return function(i){if(St(e.doc,i))return 0;var E=0;if(i.widgets)for(var I=0;I<i.widgets.length;I++)i.widgets[I].height&&(E+=i.widgets[I].height);return n?E+(Math.ceil(i.text.length/r)||1)*t:E+t}}function da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&dr(r,i)})}function rn(e,t,n,r){var i=e.display;if(!n&&me(t).getAttribute("cm-not-content")=="true")return null;var E,I,j=i.lineSpace.getBoundingClientRect();try{E=t.clientX-j.left,I=t.clientY-j.top}catch(ue){return null}var H=oa(e,E,I),V;if(r&&H.xRel>0&&(V=et(e.doc,H.line).text).length==H.ch){var re=z(V,V.length,e.options.tabSize)-V.length;H=Ne(H.line,Math.max(0,Math.round((E-Xa(e.display).left)/Tn(e.display))-re))}return H}function nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Qt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)fr&&Et(e.doc,t)<i.viewTo&&Ur(e);else if(n<=i.viewFrom)fr&&xt(e.doc,n+r)>i.viewFrom?Ur(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Ur(e);else if(t<=i.viewFrom){var E=Ri(e,n,n+r,1);E?(i.view=i.view.slice(E.index),i.viewFrom=E.lineN,i.viewTo+=r):Ur(e)}else if(n>=i.viewTo){var I=Ri(e,t,t,-1);I?(i.view=i.view.slice(0,I.index),i.viewTo=I.lineN):Ur(e)}else{var j=Ri(e,t,t,-1),H=Ri(e,n,n+r,1);j&&H?(i.view=i.view.slice(0,j.index).concat(Ai(e,j.lineN,H.lineN)).concat(i.view.slice(H.index)),i.viewTo+=r):Ur(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function Nr(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 E=r.view[nn(e,t)];if(E.node==null)return;var I=E.changes||(E.changes=[]);ie(I,n)==-1&&I.push(n)}function Ur(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ri(e,t,n,r){var i=nn(e,t),E,I=e.display.view;if(!fr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var j=e.display.viewFrom,H=0;H<i;H++)j+=I[H].size;if(j!=t){if(r>0){if(i==I.length-1)return null;E=j+I[i].size-t,i++}else E=j-t;t+=E,n+=E}for(;Et(e.doc,n)!=n;){if(i==(r<0?0:I.length-1))return null;n+=r*I[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=Ai(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Ai(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Ai(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,nn(e,n)))),r.viewTo=n}function so(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Qn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),E=r.selection=document.createDocumentFragment(),I=0;I<n.sel.ranges.length;I++){if(!t&&I==n.sel.primIndex)continue;var j=n.sel.ranges[I];if(j.from().line>=e.display.viewTo||j.to().line<e.display.viewFrom)continue;var H=j.empty();(H||e.options.showCursorWhenSelecting)&&uo(e,j.head,i),H||Xs(e,j,E)}return r}function uo(e,t,n){var r=pr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var E=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));E.style.display="",E.style.left=r.other.left+"px",E.style.top=r.other.top+"px",E.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,E=document.createDocumentFragment(),I=Xa(e.display),j=I.left,H=Math.max(r.sizerWidth,en(e)-r.sizer.offsetLeft)-I.right,V=i.direction=="ltr";function re(Ve,Qe,at,nt){Qe<0&&(Qe=0),Qe=Math.round(Qe),nt=Math.round(nt),E.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
|
|
top: `+Qe+"px; width: "+(at==null?H-Ve:at)+`px;
|
|
height: `+(nt-Qe)+"px"))}function ue(Ve,Qe,at){var nt=et(i,Ve),ht=nt.text.length,Tt,Bt;function _t(Mt,er){return ia(e,Ne(Ve,Mt),"div",nt,er)}function ir(Mt,er,Ht){var Ft=ao(e,nt,null,Mt),kt=er=="ltr"==(Ht=="after")?"left":"right",Ot=Ht=="after"?Ft.begin:Ft.end-(/\s/.test(nt.text.charAt(Ft.end-1))?2:1);return _t(Ot,kt)[kt]}var qt=Ue(nt,i.direction);return Ge(qt,Qe||0,at==null?ht:at,function(Mt,er,Ht,Ft){var kt=Ht=="ltr",Ot=_t(Mt,kt?"left":"right"),tr=_t(er-1,kt?"right":"left"),In=Qe==null&&Mt==0,Gr=at==null&&er==ht,Xt=Ft==0,xr=!qt||Ft==qt.length-1;if(tr.top-Ot.top<=3){var jt=(V?In:Gr)&&Xt,Ia=(V?Gr:In)&&xr,Or=jt?j:(kt?Ot:tr).left,un=Ia?H:(kt?tr:Ot).right;re(Or,Ot.top,un-Or,Ot.bottom)}else{var dn,Jt,Fn,Fa;kt?(dn=V&&In&&Xt?j:Ot.left,Jt=V?H:ir(Mt,Ht,"before"),Fn=V?j:ir(er,Ht,"after"),Fa=V&&Gr&&xr?H:tr.right):(dn=V?ir(Mt,Ht,"before"):j,Jt=!V&&In&&Xt?H:Ot.right,Fn=!V&&Gr&&xr?j:tr.left,Fa=V?ir(er,Ht,"after"):H),re(dn,Ot.top,Jt-dn,Ot.bottom),Ot.bottom<tr.top&&re(j,Ot.bottom,null,tr.top),re(Fn,tr.top,Fa-Fn,tr.bottom)}(!Tt||Pi(Ot,Tt)<0)&&(Tt=Ot),Pi(tr,Tt)<0&&(Tt=tr),(!Bt||Pi(Ot,Bt)<0)&&(Bt=Ot),Pi(tr,Bt)<0&&(Bt=tr)}),{start:Tt,end:Bt}}var ge=t.from(),he=t.to();if(ge.line==he.line)ue(ge.line,ge.ch,he.ch);else{var Oe=et(i,ge.line),Me=et(i,he.line),Be=rt(Oe)==rt(Me),ze=ue(ge.line,ge.ch,Be?Oe.text.length+1:null).end,Je=ue(he.line,Be?0:null,he.ch).start;Be&&(ze.top<Je.top-2?(re(ze.right,ze.top,null,ze.bottom),re(j,Je.top,Je.left,Je.bottom)):re(ze.right,ze.top,Je.left-ze.right,ze.bottom)),ze.bottom<Je.top&&re(j,ze.bottom,null,Je.top)}n.appendChild(E)}function ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Sn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Sn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(_e(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),A&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ca(e)}function Sn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(_e(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Mi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],E=e.options.lineWrapping,I=void 0,j=0;if(i.hidden)continue;if(N&&k<8){var H=i.node.offsetTop+i.node.offsetHeight;I=H-n,n=H}else{var V=i.node.getBoundingClientRect();I=V.bottom-V.top,!E&&i.text.firstChild&&(j=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var re=i.line.height-I;if((re>.005||re<-.005)&&(dr(i.line,I),ho(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)ho(i.rest[ue]);if(j>e.display.sizerWidth){var ge=Math.ceil(j/Tn(e.display));ge>e.display.maxLineLength&&(e.display.maxLineLength=ge,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ki(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-_i(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,E=Cr(t,r),I=Cr(t,i);if(n&&n.ensure){var j=n.ensure.from.line,H=n.ensure.to.line;j<E?(E=j,I=Cr(t,Lt(et(t,j))+e.wrapper.clientHeight)):Math.min(H,t.lastLine())>=I&&(E=Cr(t,Lt(et(t,H))-e.wrapper.clientHeight),I=H)}return{from:E,to:Math.max(I,E+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&&!S){var E=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-_i(e.display))+`px;
|
|
height: `+(t.bottom-t.top+br(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(E),E.scrollIntoView(i),e.display.lineSpace.removeChild(E)}}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 E=0;E<5;E++){var I=!1,j=pr(e,t),H=!n||n==t?j:pr(e,n);i={left:Math.min(j.left,H.left),top:Math.min(j.top,H.top)-r,right:Math.max(j.left,H.left),bottom:Math.max(j.bottom,H.bottom)+r};var V=ha(e,i),re=e.doc.scrollTop,ue=e.doc.scrollLeft;if(V.scrollTop!=null&&(qn(e,V.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(I=!0)),V.scrollLeft!=null&&(an(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(I=!0)),!I)break}return i}function Js(e,t){var n=ha(e,t);n.scrollTop!=null&&qn(e,n.scrollTop),n.scrollLeft!=null&&an(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,E=ta(e),I={};t.bottom-t.top>E&&(t.bottom=t.top+E);var j=e.doc.height+ea(n),H=t.top<r,V=t.bottom>j-r;if(t.top<i)I.scrollTop=H?0:t.top;else if(t.bottom>i+E){var re=Math.min(t.top,(V?j:t.bottom)-E);re!=i&&(I.scrollTop=re)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,ge=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,he=en(e)-n.gutters.offsetWidth,Oe=t.right-t.left>he;return Oe&&(t.right=t.left+he),t.left<10?I.scrollLeft=0:t.left<ge?I.scrollLeft=Math.max(0,t.left+ue-(Oe?0:10)):t.right>he+ge-3&&(I.scrollLeft=t.right+(Oe?0:10)-he),I}function ma(e,t){if(t==null)return;Ii(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function wn(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Zn(e,t,n){(t!=null||n!=null)&&Ii(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ii(e),e.curOp.scrollToPos=t}function Ii(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Zn(e,i.scrollLeft,i.scrollTop)}function qn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||ga(e,{top:t}),po(e,t,!0),D&&ga(e),ri(e,100)}function po(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function an(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+br(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var on=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),xe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),xe(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,N&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};on.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var E=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+E)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},on.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},on.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},on.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Q,this.disableVert=new Q},on.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),E=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);E!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},on.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ti=function(){};ti.prototype.update=function(){return{bottom:0,right:0}},ti.prototype.setScrollLeft=function(){},ti.prototype.setScrollTop=function(){},ti.prototype.clear=function(){};function Cn(e,t){t||(t=ei(e));var n=e.display.barWidth,r=e.display.barHeight;go(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Mi(e),go(e,ei(e)),n=e.display.barWidth,r=e.display.barHeight}function go(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var vo={native:on,null:ti};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),xe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?an(e,t):qn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function sn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},_s(e.curOp)}function ln(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var E=0;E<t.length;E++)nl(t[E]);for(var I=0;I<t.length;I++)il(t[I])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&mr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Fi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Mi(t),e.barMeasure=ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$a(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+br(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-en(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&an(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==R();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Cn(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&an(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,st(r,e.scrollToPos.from),st(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var E=e.maybeHiddenMarkers,I=e.maybeUnhiddenMarkers;if(E)for(var j=0;j<E.length;++j)E[j].lines.length||_e(E[j],"hide");if(I)for(var H=0;H<I.length;++H)I[H].lines.length&&_e(I[H],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&_e(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function nr(e,t){if(e.curOp)return t();sn(e);try{return t()}finally{ln(e)}}function Nt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);sn(e);try{return t.apply(e,arguments)}finally{ln(e)}}}function $t(e){return function(){if(this.curOp)return e.apply(this,arguments);sn(this);try{return e.apply(this,arguments)}finally{ln(this)}}}function Ut(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);sn(t);try{return e.apply(this,arguments)}finally{ln(t)}}}function ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,B(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=rr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(E){if(r.line>=e.display.viewFrom){var I=E.styles,j=E.text.length>e.options.maxHighlightLength?ur(t.mode,r.state):null,H=bi(e,E,r,!0);j&&(r.state=j),E.styles=H.styles;var V=E.styleClasses,re=H.classes;re?E.styleClasses=re:V&&(E.styleClasses=null);for(var ue=!I||I.length!=E.styles.length||V!=re&&(!V||!re||V.bgClass!=re.bgClass||V.textClass!=re.textClass),ge=0;!ue&&ge<I.length;++ge)ue=I[ge]!=E.styles[ge];ue&&i.push(r.line),E.stateAfter=r.save(),r.nextLine()}else E.text.length<=e.options.maxHighlightLength&&mn(e,E.text,r),E.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ri(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&nr(e,function(){for(var E=0;E<i.length;E++)Nr(e,i[E],"text")})}var Fi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ki(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=en(e),this.force=n,this.dims=la(e),this.events=[]};Fi.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Fi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)_e.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=br(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=br(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=R();if(!t||!m(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&m(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==R())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&m(document.body,e.anchorNode)&&m(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Ur(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&so(e)==0)return!1;xo(e)&&(Ur(e),t.dims=la(e));var i=r.first+r.size,E=Math.max(t.visible.from-e.options.viewportMargin,r.first),I=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<E&&E-n.viewFrom<20&&(E=Math.max(r.first,n.viewFrom)),n.viewTo>I&&n.viewTo-I<20&&(I=Math.min(i,n.viewTo)),fr&&(E=Et(e.doc,E),I=xt(e.doc,I));var j=E!=n.viewFrom||I!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,E,I),n.viewOffset=Lt(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var H=so(e);if(!j&&H==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return H>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),H>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,j&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==en(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(e),n.top)}),t.visible=ki(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ki(e.display,e.doc,n));if(!pa(e,t))break;Mi(e);var i=ei(e);Qn(e),Cn(e,i),ya(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ga(e,t){var n=new Fi(e,t);if(pa(e,n)){Mi(e),bo(e,n);var r=ei(e);Qn(e),Cn(e,r),ya(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,E=r.lineDiv,I=E.firstChild;function j(Oe){var Me=Oe.nextSibling;return A&&s&&e.display.currentWheelTarget==Oe?Oe.style.display="none":Oe.parentNode.removeChild(Oe),Me}for(var H=r.view,V=r.viewFrom,re=0;re<H.length;re++){var ue=H[re];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=E){var ge=Fs(e,ue,V,n);E.insertBefore(ge,I)}else{for(;I!=ue.node;)I=j(I);var he=i&&t!=null&&t<=V&&ue.lineNumber;ue.changes&&(ie(ue.changes,"gutter")>-1&&(he=!1),Ka(e,ue,V,n)),he&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(Xr(e.options,V)))),I=ue.node.nextSibling}V+=ue.size}for(;I;)I=j(I)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+br(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,E=r+"px",I=0;I<n.length;I++)if(!n[I].hidden){e.options.fixedGutter&&(n[I].gutter&&(n[I].gutter.style.left=E),n[I].gutterBackground&&(n[I].gutterBackground.style.left=E));var j=n[I].alignable;if(j)for(var H=0;H<j.length;H++)j[H].style.left=E}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Xr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),E=i.firstChild.offsetWidth,I=i.offsetWidth-E;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(E,r.lineGutter.offsetWidth-I)+1,r.lineNumWidth=r.lineNumInnerWidth+I,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",va(e.display),!0}return!1}function ba(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var E=e[i],I=null;if(typeof E!="string"&&(I=E.style,E=E.className),E=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:E,style:I})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function To(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],E=i.className,I=i.style,j=t.appendChild(a("div",null,"CodeMirror-gutter "+E));I&&(j.style.cssText=I),E=="CodeMirror-linenumbers"&&(e.lineGutter=j,j.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",va(e)}function ni(e){To(e.display),Qt(e),Eo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var E=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[E],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ce+"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"),N&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!A&&!(D&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Ni=0,or=null;N?or=-.53:D?or=15:x?or=-.7:O&&(or=-1/3);function So(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=So(e);return t.x*=or,t.y*=or,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,E=e.display,I=E.scroller,j=I.scrollWidth>I.clientWidth,H=I.scrollHeight>I.clientHeight;if(!(r&&j||i&&H))return;if(i&&s&&A){e:for(var V=t.target,re=E.view;V!=I;V=V.parentNode)for(var ue=0;ue<re.length;ue++)if(re[ue].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!D&&!L&&or!=null){i&&H&&qn(e,Math.max(0,I.scrollTop+i*or)),an(e,Math.max(0,I.scrollLeft+r*or)),(!i||i&&H)&&Y(t),E.wheelStartX=null;return}if(i&&or!=null){var ge=i*or,he=e.doc.scrollTop,Oe=he+E.wrapper.clientHeight;ge<0?he=Math.max(0,he+ge-50):Oe=Math.min(e.doc.height,Oe+ge+50),ga(e,{top:he,bottom:Oe})}Ni<20&&(E.wheelStartX==null?(E.wheelStartX=I.scrollLeft,E.wheelStartY=I.scrollTop,E.wheelDX=r,E.wheelDY=i,setTimeout(function(){if(E.wheelStartX==null)return;var Me=I.scrollLeft-E.wheelStartX,Be=I.scrollTop-E.wheelStartY,ze=Be&&E.wheelDY&&Be/E.wheelDY||Me&&E.wheelDX&&Me/E.wheelDX;if(E.wheelStartX=E.wheelStartY=null,!ze)return;or=(or*Ni+ze)/(Ni+1),++Ni},200)):(E.wheelDX+=r,E.wheelDY+=i))}var sr=function(e,t){this.ranges=e,this.primIndex=t};sr.prototype.primary=function(){return this.ranges[this.primIndex]},sr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!He(n.anchor,r.anchor)||!He(n.head,r.head))return!1}return!0},sr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vt(Nn(this.ranges[t].anchor),Nn(this.ranges[t].head));return new sr(e,this.primIndex)},sr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},sr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(lt(t,r.from())>=0&<(e,r.to())<=0)return n}return-1};var vt=function(e,t){this.anchor=e,this.head=t};vt.prototype.from=function(){return Yr(this.anchor,this.head)},vt.prototype.to=function(){return hn(this.anchor,this.head)},vt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function gr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(ge,he){return lt(ge.from(),he.from())}),n=ie(t,i);for(var E=1;E<t.length;E++){var I=t[E],j=t[E-1],H=lt(j.to(),I.from());if(r&&!I.empty()?H>0:H>=0){var V=Yr(j.from(),I.from()),re=hn(j.to(),I.to()),ue=j.empty()?I.from()==I.head:j.from()==j.head;E<=n&&--n,t.splice(--E,2,new vt(ue?re:V,ue?V:re))}}return new sr(t,n)}function Br(e,t){return new sr([new vt(e,t||e)],0)}function jr(e){return e.text?Ne(e.from.line+e.text.length-1,ye(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(lt(e,t.from)<0)return e;if(lt(e,t.to)<=0)return jr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=jr(t).ch-t.to.ch),Ne(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new vt(Co(i.anchor,t),Co(i.head,t)))}return gr(e.cm,n,e.sel.primIndex)}function Lo(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),E=i,I=0;I<t.length;I++){var j=t[I],H=Lo(j.from,i,E),V=Lo(jr(j),i,E);if(i=j.to,E=V,n=="around"){var re=e.sel.ranges[I],ue=lt(re.head,re.anchor)<0;r[I]=new vt(ue?V:H,ue?H:V)}else r[I]=new vt(H,H)}return new sr(r,e.sel.primIndex)}function xa(e){e.doc.mode=Sr(e.options,e.doc.modeOption),ii(e)}function ii(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ri(e,100),e.state.modeGen++,e.curOp&&Qt(e)}function Do(e,t){return t.from.ch==0&&t.to.ch==0&&ye(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i(Je){return n?n[Je]:null}function E(Je,Ve,Qe){kr(Je,Ve,Qe,r),Kt(Je,"change",Je,t)}function I(Je,Ve){for(var Qe=[],at=Je;at<Ve;++at)Qe.push(new wt(V[at],i(at),r));return Qe}var j=t.from,H=t.to,V=t.text,re=et(e,j.line),ue=et(e,H.line),ge=ye(V),he=i(V.length-1),Oe=H.line-j.line;if(t.full)e.insert(0,I(0,V.length)),e.remove(V.length,e.size-V.length);else if(Do(e,t)){var Me=I(0,V.length-1);E(ue,ue.text,he),Oe&&e.remove(j.line,Oe),Me.length&&e.insert(j.line,Me)}else if(re==ue)if(V.length==1)E(re,re.text.slice(0,j.ch)+ge+re.text.slice(H.ch),he);else{var Be=I(1,V.length-1);Be.push(new wt(ge+re.text.slice(H.ch),he,r)),E(re,re.text.slice(0,j.ch)+V[0],i(0)),e.insert(j.line+1,Be)}else if(V.length==1)E(re,re.text.slice(0,j.ch)+V[0]+ue.text.slice(H.ch),i(0)),e.remove(j.line+1,Oe);else{E(re,re.text.slice(0,j.ch)+V[0],i(0)),E(ue,ge+ue.text.slice(H.ch),he);var ze=I(1,V.length-1);Oe>1&&e.remove(j.line+1,Oe-1),e.insert(j.line+1,ze)}Kt(e,"change",e,t)}function Wr(e,t,n){function r(i,E,I){if(i.linked)for(var j=0;j<i.linked.length;++j){var H=i.linked[j];if(H.doc==E)continue;var V=I&&H.sharedHist;if(n&&!V)continue;t(H.doc,V),r(H.doc,i,V)}}r(e,null,!0)}function Ao(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),_o(e),e.options.lineWrapping||mr(e),e.options.mode=t.modeOption,Qt(e)}function _o(e){(e.doc.direction=="rtl"?U:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){nr(e,function(){_o(e),Qt(e)})}function Ui(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Sa(e,t){var n={from:Nn(t.from),to:jr(t),text:wr(e,t.from,t.to)};return Po(e,n,t.from.line,t.to.line+1),Wr(e,function(r){return Po(r,n,t.from.line,t.to.line+1)},!0),n}function Oo(e){for(;e.length;){var t=ye(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Oo(e.done),ye(e.done);if(e.done.length&&!ye(e.done).ranges)return ye(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ye(e.done)}function Ro(e,t,n,r){var i=e.history;i.undone.length=0;var E=+new Date,I,j;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>E-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(I=ml(i,i.lastOp==r)))j=ye(I.changes),lt(t.from,t.to)==0&<(t.from,j.to)==0?j.to=jr(t):I.changes.push(Sa(e,t));else{var H=ye(i.done);for((!H||!H.ranges)&&Bi(e.sel,i.done),I={changes:[Sa(e,t)],generation:i.generation},i.done.push(I);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=E,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,j||_e(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,E=r&&r.origin;n==i.lastSelOp||E&&i.lastSelOrigin==E&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==E||pl(e,E,ye(i.done),t))?i.done[i.done.length-1]=t:Bi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=E,i.lastSelOp=n,r&&r.clearRedo!==!1&&Oo(i.undone)}function Bi(e,t){var n=ye(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Po(e,t,n,r){var i=t["spans_"+e.id],E=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(I){I.markedSpans&&((i||(i=t["spans_"+e.id]={}))[E]=I.markedSpans),++E})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Mo(e,t){var n=yl(e,t),r=Mr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var E=n[i],I=r[i];if(E&&I){e:for(var j=0;j<I.length;++j){for(var H=I[j],V=0;V<E.length;++V)if(E[V].marker==H.marker)continue e;E.push(H)}}else I&&(n[i]=I)}return n}function Ln(e,t,n){for(var r=[],i=0;i<e.length;++i){var E=e[i];if(E.ranges){r.push(n?sr.prototype.deepCopy.call(E):E);continue}var I=E.changes,j=[];r.push({changes:j});for(var H=0;H<I.length;++H){var V=I[H],re=void 0;if(j.push({from:V.from,to:V.to,text:V.text}),t)for(var ue in V)(re=ue.match(/^spans_(\d+)$/))&&(ie(t,Number(re[1]))>-1&&(ye(j)[ue]=V[ue],delete V[ue]))}}return r}function wa(e,t,n,r){if(r){var i=e.anchor;if(n){var E=lt(t,i)<0;E!=lt(n,i)<0?(i=t,t=n):E!=lt(t,n)<0&&(t=n)}return new vt(i,t)}else return new vt(n||t,t)}function ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vt(e,new sr([wa(e.sel.primary(),t,n,i)],0),r)}function ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),E=0;E<e.sel.ranges.length;E++)r[E]=wa(e.sel.ranges[E],t[E],null,i);var I=gr(e.cm,r,e.sel.primIndex);Vt(e,I,n)}function Ca(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Vt(e,gr(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){Vt(e,Br(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var E=0;E<i.length;E++)this.ranges[E]=new vt(st(e,i[E].anchor),st(e,i[E].head))},origin:n&&n.origin};return _e(e,"beforeSelectionChange",e,r),e.cm&&_e(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?gr(e.cm,r.ranges,r.ranges.length-1):t}function Fo(e,t,n){var r=e.history.done,i=ye(r);i&&i.ranges?(r[r.length-1]=t,Wi(e,t,n)):Vt(e,t,n)}function Vt(e,t,n){Wi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Wi(e,t,n){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(lt(t.primary().head,e.sel.primary().head)<0?-1:1);No(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&wn(e.cm)}function No(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ne(e.cm)),Kt(e,"cursorActivity",e)}function Uo(e){No(e,Bo(e,e.sel,null,!1))}function Bo(e,t,n,r){for(var i,E=0;E<t.ranges.length;E++){var I=t.ranges[E],j=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[E],H=Ki(e,I.anchor,j&&j.anchor,n,r),V=Ki(e,I.head,j&&j.head,n,r);(i||H!=I.anchor||V!=I.head)&&(i||(i=t.ranges.slice(0,E)),i[E]=new vt(H,V))}return i?gr(e.cm,i,t.primIndex):t}function Dn(e,t,n,r,i){var E=et(e,t.line);if(E.markedSpans)for(var I=0;I<E.markedSpans.length;++I){var j=E.markedSpans[I],H=j.marker,V="selectLeft"in H?!H.selectLeft:H.inclusiveLeft,re="selectRight"in H?!H.selectRight:H.inclusiveRight;if((j.from==null||(V?j.from<=t.ch:j.from<t.ch))&&(j.to==null||(re?j.to>=t.ch:j.to>t.ch))){if(i&&(_e(H,"beforeCursorEnter"),H.explicitlyCleared))if(E.markedSpans){--I;continue}else break;if(!H.atomic)continue;if(n){var ue=H.find(r<0?1:-1),ge=void 0;if((r<0?re:V)&&(ue=jo(e,ue,-r,ue&&ue.line==t.line?E:null)),ue&&ue.line==t.line&&(ge=lt(ue,n))&&(r<0?ge<0:ge>0))return Dn(e,ue,t,r,i)}var he=H.find(r<0?-1:1);return(r<0?V:re)&&(he=jo(e,he,r,he.line==t.line?E:null)),he?Dn(e,he,t,r,i):null}}return t}function Ki(e,t,n,r,i){var E=r||1,I=Dn(e,t,n,E,i)||!i&&Dn(e,t,n,E,!0)||Dn(e,t,n,-E,i)||!i&&Dn(e,t,n,-E,!0);return I||(e.cantEdit=!0,Ne(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?st(e,Ne(t.line-1)):null:n>0&&t.ch==(r||et(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 Wo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),pe)}function Ko(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,E,I,j){i&&(r.from=st(e,i)),E&&(r.to=st(e,E)),I&&(r.text=I),j!==void 0&&(r.origin=j)}),_e(e,"beforeChange",e,r),e.cm&&_e(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function An(e,t,n){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,An)(e,t,n);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Ko(e,t,!0),!t))return;var r=Ti&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ho(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ho(e,t)}function Ho(e,t){if(t.text.length==1&&t.text[0]==""&<(t.from,t.to)==0)return;var n=Ea(e,t);Ro(e,t,n,e.cm?e.cm.curOp.id:NaN),ai(e,t,n,Mr(e,t));var r=[];Wr(e,function(i,E){!E&&ie(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),ai(i,t,null,Mr(i,t))})}function Hi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,E,I=e.sel,j=t=="undo"?i.done:i.undone,H=t=="undo"?i.undone:i.done,V=0;V<j.length&&!(E=j[V],n?E.ranges&&!E.equals(e.sel):!E.ranges);V++);if(V==j.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(E=j.pop(),E.ranges){if(Bi(E,H),n&&!E.equals(e.sel)){Vt(e,E,{clearRedo:!1});return}I=E}else if(r){j.push(E);return}else break;var re=[];Bi(I,H),H.push({changes:re,generation:i.generation}),i.generation=E.generation||++i.maxGeneration;for(var ue=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),ge=function(Me){var Be=E.changes[Me];if(Be.origin=t,ue&&!Ko(e,Be,!1))return j.length=0,{};re.push(Sa(e,Be));var ze=Me?Ea(e,Be):ye(j);ai(e,Be,ze,Mo(e,Be)),!Me&&e.cm&&e.cm.scrollIntoView({from:Be.from,to:jr(Be)});var Je=[];Wr(e,function(Ve,Qe){!Qe&&ie(Je,Ve.history)==-1&&(Xo(Ve.history,Be),Je.push(Ve.history)),ai(Ve,Be,null,Mo(Ve,Be))})},he=E.changes.length-1;he>=0;--he){var Oe=ge(he);if(Oe)return Oe.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new sr(fe(e.sel.ranges,function(i){return new vt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Qt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Nr(e.cm,r,"gutter")}}function ai(e,t,n,r){if(e.cm&&!e.cm.curOp)return Nt(e.cm,ai)(e,t,n,r);if(t.to.line<e.first){Go(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Go(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[ye(t.text)],origin:t.origin}}var E=e.lastLine();t.to.line>E&&(t={from:t.from,to:Ne(E,et(e,E).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wr(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Wi(e,n,pe),e.cantEdit&&Ki(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,E=t.from,I=t.to,j=!1,H=E.line;e.options.lineWrapping||(H=gt(rt(et(r,E.line))),r.iter(H,I.line+1,function(he){if(he==i.maxLine)return j=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ne(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(H,E.line+t.text.length,function(he){var Oe=Gt(he);Oe>i.maxLineLength&&(i.maxLine=he,i.maxLineLength=Oe,i.maxLineChanged=!0,j=!1)}),j&&(e.curOp.updateMaxLine=!0)),Wn(r,E.line),ri(e,400);var V=t.text.length-(I.line-E.line)-1;t.full?Qt(e):E.line==I.line&&t.text.length==1&&!Do(e.doc,t)?Nr(e,E.line,"text"):Qt(e,E.line,I.line+1,V);var re=ae(e,"changes"),ue=ae(e,"change");if(ue||re){var ge={from:E,to:I,text:t.text,removed:t.removed,origin:t.origin};ue&&Kt(e,"change",e,ge),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ge)}e.display.selForContextMenu=null}function _n(e,t,n,r,i){var E;r||(r=n),lt(r,n)<0&&(E=[r,n],n=E[0],r=E[1]),typeof t=="string"&&(t=e.splitLines(t)),An(e,{from:n,to:r,text:t,origin:i})}function zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(e,t,n,r){for(var i=0;i<e.length;++i){var E=e[i],I=!0;if(E.ranges){E.copied||(E=e[i]=E.deepCopy(),E.copied=!0);for(var j=0;j<E.ranges.length;j++)zo(E.ranges[j].anchor,t,n,r),zo(E.ranges[j].head,t,n,r);continue}for(var H=0;H<E.changes.length;++H){var V=E.changes[H];if(n<V.from.line)V.from=Ne(V.from.line+r,V.from.ch),V.to=Ne(V.to.line+r,V.to.ch);else if(t<=V.to.line){I=!1;break}}I||(e.splice(0,i+1),i=0)}}function Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function oi(e,t,n,r){var i=t,E=t;return typeof t=="number"?E=et(e,$r(e,t)):i=gt(t),i==null?null:(r(E,i)&&e.cm&&Nr(e.cm,i,n),E)}function si(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}si.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,zt(i),Kt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function li(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}li.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var E=Math.min(t,i-e),I=r.height;if(r.removeInner(e,E),this.height-=I-r.height,i==E&&(this.children.splice(n--,1),r.parent=null),(t-=E)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof si))){var j=[];this.collapse(j),this.children=[new si(j)],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],E=i.chunkSize();if(e<=E){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var I=i.lines.length%25+25,j=I;j<i.lines.length;){var H=new si(i.lines.slice(j,j+=25));i.height-=H.height,this.children.splice(++r,0,H),H.parent=this}i.lines=i.lines.slice(0,I),this.maybeSpill()}break}e-=E}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new li(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ie(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new li(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<E){var I=Math.min(t,E-e);if(i.iterN(e,I,n))return!0;if((t-=I)==0)break;e=0}else e-=E}}};var ui=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};ui.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=gt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var E=$n(this);dr(n,Math.max(0,n.height-E)),e&&(nr(e,function(){Yo(e,n,-E),Nr(e,r,"widget")}),Kt(e,"lineWidgetCleared",e,this,r))},ui.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=$n(this)-t;if(!i)return;St(this.doc,r)||dr(r,r.height+i),n&&nr(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Kt(n,"lineWidgetChanged",n,e,gt(r))})},le(ui);function Yo(e,t,n){Lt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new ui(e,n,r),E=e.cm;return E&&i.noHScroll&&(E.display.alignWidgets=!0),oi(e,t,"widget",function(I){var j=I.widgets||(I.widgets=[]);if(i.insertAt==null?j.push(i):j.splice(Math.min(j.length-1,Math.max(0,i.insertAt)),0,i),i.line=I,E&&!St(e,I)){var H=Lt(I)<e.scrollTop;dr(I,I.height+$n(i)),H&&ma(E,i.height),E.curOp.forceUpdate=!0}return!0}),E&&Kt(E,"lineWidgetAdded",E,i,typeof t=="number"?t:gt(t)),i}var $o=0,Kr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++$o};Kr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&sn(e),ae(this,"clear")){var n=this.find();n&&Kt(this,"clear",n.from,n.to)}for(var r=null,i=null,E=0;E<this.lines.length;++E){var I=this.lines[E],j=Pr(I.markedSpans,this);e&&!this.collapsed?Nr(e,gt(I),"text"):e&&(j.to!=null&&(i=gt(I)),j.from!=null&&(r=gt(I))),I.markedSpans=Na(I.markedSpans,j),j.from==null&&this.collapsed&&!St(this.doc,I)&&e&&dr(I,xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var H=0;H<this.lines.length;++H){var V=rt(this.lines[H]),re=Gt(V);re>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Qt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Uo(e.doc)),e&&Kt(e,"markerCleared",e,this,r,i),t&&ln(e),this.parent&&this.parent.clear()},Kr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var E=this.lines[i],I=Pr(E.markedSpans,this);if(I.from!=null&&(n=Ne(t?E:gt(E),I.from),e==-1))return n;if(I.to!=null&&(r=Ne(t?E:gt(E),I.to),e==1))return r}return n&&{from:n,to:r}},Kr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;nr(r,function(){var i=t.line,E=gt(t.line),I=ra(r,E);if(I&&(Za(I),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!St(n.doc,i)&&n.height!=null){var j=n.height;n.height=null;var H=$n(n)-j;H&&dr(i,i.height+H)}Kt(r,"markerChanged",r,e)})},Kr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Kr.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},le(Kr);function On(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,On)(e,t,n,r,i);var E=new Kr(e,i),I=lt(t,n);if(r&&F(r,E,!1),I>0||I==0&&E.clearWhenEmpty!==!1)return E;if(E.replacedWith&&(E.collapsed=!0,E.widgetNode=v("span",[E.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||E.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(E.widgetNode.insertLeft=!0)),E.collapsed){if(Zi(e,t.line,t,n,E)||t.line!=n.line&&Zi(e,n.line,t,n,E))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}E.addToHistory&&Ro(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var j=t.line,H=e.cm,V;if(e.iter(j,n.line+1,function(ue){H&&E.collapsed&&!H.options.lineWrapping&&rt(ue)==H.display.maxLine&&(V=!0),E.collapsed&&j!=t.line&&dr(ue,0),Kn(ue,new gn(E,j==t.line?t.ch:null,j==n.line?n.ch:null)),++j}),E.collapsed&&e.iter(t.line,n.line+1,function(ue){St(e,ue)&&dr(ue,0)}),E.clearOnEnter&&xe(E,"beforeCursorEnter",function(){return E.clear()}),E.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),E.collapsed&&(E.id=++$o,E.atomic=!0),H){if(V&&(H.curOp.updateMaxLine=!0),E.collapsed)Qt(H,t.line,n.line+1);else if(E.className||E.startStyle||E.endStyle||E.css||E.attributes||E.title)for(var re=t.line;re<=n.line;re++)Nr(H,re,"text");E.atomic&&Uo(H.doc),Kt(H,"markerAdded",H,E)}return E}var di=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Kt(this,"clear")},di.prototype.find=function(e,t){return this.primary.find(e,t)},le(di);function Tl(e,t,n,r,i){r=F(r),r.shared=!1;var E=[On(e,t,n,r,i)],I=E[0],j=r.widgetNode;return Wr(e,function(H){j&&(r.widgetNode=j.cloneNode(!0)),E.push(On(H,st(H,t),st(H,n),r,i));for(var V=0;V<H.linked.length;++V)if(H.linked[V].isParent)return;I=ye(E)}),new di(E,I)}function Jo(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(),E=e.clipPos(i.from),I=e.clipPos(i.to);if(lt(E,I)){var j=On(e,E,I,r.primary,r.primary.type);r.markers.push(j),j.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],E=[i.primary.doc];Wr(i.primary.doc,function(H){return E.push(H)});for(var I=0;I<i.markers.length;I++){var j=i.markers[I];ie(E,j.doc)==-1&&(j.parent=null,i.markers.splice(I--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,Zt=function(e,t,n,r,i){if(!(this instanceof Zt))return new Zt(e,t,n,r,i);n==null&&(n=0),li.call(this,[new si([new wt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var E=Ne(n,0);this.sel=Br(E),this.history=new Ui(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ta(this,{from:E,to:E,text:e}),Vt(this,Br(E),pe)};Zt.prototype=De(li.prototype,{constructor:Zt,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ut(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;An(this,{from:t,to:Ne(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Zn(this.cm,0,0),Vt(this,Br(t),pe)}),replaceRange:function(e,t,n,r){t=st(this,t),n=n?st(this,n):t,_n(this,e,t,n,r)},getRange:function(e,t,n){var r=wr(this,st(this,e),st(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Rr(this,e))return et(this,e)},getLineNumber:function(e){return gt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=et(this,e)),rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return st(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:Ut(function(e,t,n){Io(this,st(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:Ut(function(e,t,n){Io(this,st(this,e),st(this,t||e),n)}),extendSelection:Ut(function(e,t,n){ji(this,st(this,e),t&&st(this,t),n)}),extendSelections:Ut(function(e,t){ko(this,Un(this,e),t)}),extendSelectionsBy:Ut(function(e,t){var n=fe(this.sel.ranges,e);ko(this,Un(this,n),t)}),setSelections:Ut(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new vt(st(this,e[i].anchor),st(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Vt(this,gr(this.cm,r,t),n)}),addSelection:Ut(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new vt(st(this,e),st(this,t||e))),Vt(this,gr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=wr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=wr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Ut(function(e,t,n){for(var r=[],i=this.sel,E=0;E<i.ranges.length;E++){var I=i.ranges[E];r[E]={from:I.from(),to:I.to(),text:this.splitLines(e[E]),origin:n}}for(var j=t&&t!="end"&&fl(this,r,t),H=r.length-1;H>=0;H--)An(this,r[H]);j?Fo(this,j):this.cm&&wn(this.cm)}),undo:Ut(function(){Hi(this,"undo")}),redo:Ut(function(){Hi(this,"redo")}),undoSelection:Ut(function(){Hi(this,"undo",!0)}),redoSelection:Ut(function(){Hi(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 Ui(this.history.maxGeneration),Wr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ln(this.history.done),undone:Ln(this.history.undone)}},setHistory:function(e){var t=this.history=new Ui(this.history.maxGeneration);t.done=Ln(e.done.slice(0),null,!0),t.undone=Ln(e.undone.slice(0),null,!0)},setGutterMarker:Ut(function(e,t,n){return oi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Fe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ut(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&oi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Fe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Rr(this,e))return null;if(t=e,e=et(this,e),!e)return null}else if(t=gt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Ut(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(y(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Ut(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",E=r[i];if(E)if(n==null)r[i]=null;else{var I=E.match(y(n));if(!I)return!1;var j=I.index+I[0].length;r[i]=E.slice(0,I.index)+(!I.index||j==E.length?"":" ")+E.slice(j)||null}else return!1;return!0})}),addLineWidget:Ut(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return On(this,st(this,e),st(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=st(this,e),On(this,e,e,n,"bookmark")},findMarksAt:function(e){e=st(this,e);var t=[],n=et(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=st(this,e),t=st(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(E){var I=E.markedSpans;if(I)for(var j=0;j<I.length;j++){var H=I[j];!(H.to!=null&&i==e.line&&e.ch>=H.to||H.from==null&&i!=e.line||H.from!=null&&i==t.line&&H.from>=t.ch)&&(!n||n(H.marker))&&r.push(H.marker.parent||H.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 E=i.text.length+r;if(E>e)return t=e,!0;e-=E,++n}),st(this,Ne(n,t))},indexFromPos:function(e){e=st(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Zt(fn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Zt(fn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,Jo(this)),r},unlinkDoc:function(e){if(e instanceof 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(Jo(this));break}if(e.history==this.history){var r=[e.id];Wr(e,function(i){return r.push(i.id)},!0),e.history=new Ui(null),e.history.done=Ln(this.history.done,r),e.history.undone=Ln(this.history.undone,r)}},iterLinkedDocs:function(e){Wr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Ut(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),Zt.prototype.eachLine=Zt.prototype.iter;var Qo=0;function Ll(e){var t=this;if(Zo(t),Ie(t,e)||Ar(t.display,e))return;Y(e),N&&(Qo=+new Date);var n=rn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,E=Array(i),I=0,j=function(){++I==i&&Nt(t,function(){n=st(t.doc,n);var he={from:n,to:n,text:t.doc.splitLines(E.filter(function(Oe){return Oe!=null}).join(t.doc.lineSeparator())),origin:"paste"};An(t.doc,he),Fo(t.doc,Br(st(t.doc,n),st(t.doc,jr(he))))})()},H=function(he,Oe){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,he.type)==-1){j();return}var Me=new FileReader;Me.onerror=function(){return j()},Me.onload=function(){var Be=Me.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Be)){j();return}E[Oe]=Be,j()},Me.readAsText(he)},V=0;V<r.length;V++)H(r[V],V);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 re=e.dataTransfer.getData("Text");if(re){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Wi(t.doc,Br(n,n)),ue)for(var ge=0;ge<ue.length;++ge)_n(t.doc,"",ue[ge].anchor,ue[ge].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(he){}}}function Dl(e,t){if(N&&(!e.state.draggingText||+new Date-Qo<100)){ee(t);return}if(Ie(e,t)||Ar(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==",L&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),L&&n.parentNode.removeChild(n)}}function Al(e,t){var n=rn(e,t);if(!n)return;var r=document.createDocumentFragment();uo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function Zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var E=0;E<n.length;E++)e(n[E])})}var es=!1;function _l(){if(es)return;Ol(),es=!0}function Ol(){var e;xe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Rl)},100))}),xe(window,"blur",function(){return qo(Sn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Hr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ci=0;ci<10;ci++)Hr[ci+48]=Hr[ci+96]=String(ci);for(var Gi=65;Gi<=90;Gi++)Hr[Gi]=String.fromCharCode(Gi);for(var fi=1;fi<=12;fi++)Hr[fi+111]=Hr[fi+63235]="F"+fi;var _r={};_r.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"},_r.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"},_r.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"},_r.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"]},_r.default=s?_r.macDefault:_r.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,E,I=0;I<t.length-1;I++){var j=t[I];if(/^(cmd|meta|m)$/i.test(j))E=!0;else if(/^a(lt)?$/i.test(j))n=!0;else if(/^(c|ctrl|control)$/i.test(j))r=!0;else if(/^s(hift)?$/i.test(j))i=!0;else throw new Error("Unrecognized modifier name: "+j)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),E&&(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=fe(n.split(" "),Pl),E=0;E<i.length;E++){var I=void 0,j=void 0;E==i.length-1?(j=i.join(" "),I=r):(j=i.slice(0,E+1).join(" "),I="...");var H=t[j];if(!H)t[j]=I;else if(H!=I)throw new Error("Inconsistent bindings for "+j)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Rn(e,t,n,r){t=zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Rn(e,t.fallthrough,n,r);for(var E=0;E<t.fallthrough.length;E++){var I=Rn(e,t.fallthrough[E],n,r);if(I)return I}}}function ts(e){var t=typeof e=="string"?e:Hr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ns(e,t){if(L&&e.keyCode==34&&e.char)return!1;var n=Hr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function zi(e){return typeof e=="string"?_r[e]:e}function Pn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var E=t(n[i]);r.length&<(E.from,ye(r).to)<=0;){var I=r.pop();if(lt(I.from,E.from)<0){E.from=I.from;break}}r.push(E)}nr(e,function(){for(var j=r.length-1;j>=0;j--)_n(e.doc,"",r[j].from,r[j].to,"+delete");wn(e)})}function La(e,t,n){var r=Se(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Da(e,t,n){var r=La(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Aa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var E=Ue(n,t.doc.direction);if(E){var I=i<0?ye(E):E[0],j=i<0==(I.level==1),H=j?"after":"before",V;if(I.level>0||t.doc.direction=="rtl"){var re=En(t,n);V=i<0?n.text.length-1:0;var ue=Er(t,re,V).top;V=We(function(ge){return Er(t,re,ge).top==ue},i<0==(I.level==1)?I.from:I.to-1,V),H=="before"&&(V=La(n,V,1))}else V=i<0?I.to:I.from;return new Ne(r,V,H)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Ue(t,e.doc.direction);if(!i)return Da(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 E=je(i,n.ch,n.sticky),I=i[E];if(e.doc.direction=="ltr"&&I.level%2==0&&(r>0?I.to>n.ch:I.from<n.ch))return Da(t,n,r);var j=function(ze,Je){return La(t,ze instanceof Ne?ze.ch:ze,Je)},H,V=function(ze){return e.options.lineWrapping?(H=H||En(e,t),ao(e,t,H,ze)):{begin:0,end:t.text.length}},re=V(n.sticky=="before"?j(n,-1):n.ch);if(e.doc.direction=="rtl"||I.level==1){var ue=I.level==1==r<0,ge=j(n,ue?1:-1);if(ge!=null&&(ue?ge<=I.to&&ge<=re.end:ge>=I.from&&ge>=re.begin)){var he=ue?"before":"after";return new Ne(n.line,ge,he)}}var Oe=function(ze,Je,Ve){for(var Qe=function(Tt,Bt){return Bt?new Ne(n.line,j(Tt,1),"before"):new Ne(n.line,Tt,"after")};ze>=0&&ze<i.length;ze+=Je){var at=i[ze],nt=Je>0==(at.level!=1),ht=nt?Ve.begin:j(Ve.end,-1);if(at.from<=ht&&ht<at.to)return Qe(ht,nt);if(ht=nt?at.from:j(at.to,-1),Ve.begin<=ht&&ht<Ve.end)return Qe(ht,nt)}},Me=Oe(E+r,r,re);if(Me)return Me;var Be=r>0?re.end:j(re.begin,-1);return Be!=null&&!(r>0&&Be==t.text.length)&&(Me=Oe(r>0?0:i.length-1,r,V(Be)),Me)?Me:null}var hi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Pn(e,function(t){if(t.empty()){var n=et(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to: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 Pn(e,function(t){return{from:Ne(t.from().line,0),to:st(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Pn(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},se)},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")},se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?as(e,t.head):r},se)},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 E=n[i].from(),I=z(e.getLine(E.line),E.ch,r);t.push(oe(r-I%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return nr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,E=et(e.doc,i.line).text;if(E){if(i.ch==E.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(E.charAt(i.ch-1)+E.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var I=et(e.doc,i.line-1).text;I&&(i=new Ne(i.line,1),e.replaceRange(E.charAt(0)+e.doc.lineSeparator()+I.charAt(I.length-1),Ne(i.line-1,I.length-1),i,"+transpose"))}}n.push(new vt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return nr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);wn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=et(e.doc,t),r=rt(n);return r!=n&&(t=gt(r)),Aa(!0,e,r,t,1)}function Il(e,t){var n=et(e.doc,t),r=ct(n);return r!=n&&(t=gt(r)),Aa(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=et(e.doc,n.line),i=Ue(r,e.doc.direction);if(!i||i[0].level==0){var E=Math.max(n.ch,r.text.search(/\S/)),I=t.line==n.line&&t.ch<=E&&t.ch;return Ne(n.line,I?0:E,n.sticky)}return n}function Vi(e,t,n){if(typeof t=="string"&&(t=hi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ce}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Rn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Rn(t,e.options.extraKeys,n,e)||Rn(t,e.options.keyMap,n,e)}var Nl=new Q;function mi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Kt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?mi(e,"Shift-"+n,t,function(r){return Vi(e,r,!0)})||mi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vi(e,r)}):mi(e,n,t,function(r){return Vi(e,r)}):!1}function Ul(e,t,n){return mi(e,"'"+n+"'",t,function(r){return Vi(e,r,!0)})}var _a=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=R(),Ie(t,e))return;N&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);L&&(_a=r?n:null,!r&&n==88&&!It&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}xe(document,"keyup",n),xe(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ie(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Ar(t.display,e)||Ie(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(L&&n==_a){_a=null,Y(e);return}if(L&&(!e.which||e.which<10)&&ss(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Ul(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Oa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Oa.prototype.compare=function(e,t,n){return this.time+jl>e&<(t,this.pos)==0&&n==this.button};var pi,gi;function Wl(e,t){var n=+new Date;return gi&&gi.compare(n,e,t)?(pi=gi=null,"triple"):pi&&pi.compare(n,e,t)?(gi=new Oa(n,e,t),pi=null,"double"):(pi=new Oa(n,e,t),gi=null,"single")}function cs(e){var t=this,n=t.display;if(Ie(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Ar(n,e)){A||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ra(t,e))return;var r=rn(t,e),i=Ee(e),E=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Kl(t,i,r,E,e))return;i==1?r?Gl(t,r,E,e):me(e)==n.scroller&&Y(e):i==2?(r&&ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):fo(t))}function Kl(e,t,n,r,i){var E="Click";return r=="double"?E="Double"+E:r=="triple"&&(E="Triple"+E),E=(t==1?"Left":t==2?"Middle":"Right")+E,mi(e,rs(E,i),i,function(I){if(typeof I=="string"&&(I=hi[I]),!I)return!1;var j=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),j=I(e,n)!=Ce}finally{e.state.suppressEdits=!1}return j})}function Hl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var E=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=E?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){N?setTimeout(B(co,e),0):e.curOp.focus=R();var i=Hl(e,n,r),E=e.doc.sel,I;e.options.dragDrop&&ke&&!e.isReadOnly()&&n=="single"&&(I=E.contains(t))>-1&&(lt((I=E.ranges[I]).from(),t)<0||t.xRel>0)&&(lt(I.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,E=!1,I=Nt(e,function(V){A&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",I),Ye(i.wrapper.ownerDocument,"mousemove",j),Ye(i.scroller,"dragstart",H),Ye(i.scroller,"drop",I),E||(Y(V),r.addNew||ji(e.doc,n,null,null,r.extend),A&&!O||N&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),j=function(V){E=E||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},H=function(){return E=!0};A&&(i.scroller.draggable=!0),e.state.draggingText=I,I.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),xe(i.wrapper.ownerDocument,"mouseup",I),xe(i.wrapper.ownerDocument,"mousemove",j),xe(i.scroller,"dragstart",H),xe(i.scroller,"drop",I),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new vt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new vt(Ne(t.line,0),st(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new vt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,E=e.doc;Y(t);var I,j,H=E.sel,V=H.ranges;if(r.addNew&&!r.extend?(j=E.sel.contains(n),j>-1?I=V[j]:I=new vt(n,n)):(I=E.sel.primary(),j=E.sel.primIndex),r.unit=="rectangle")r.addNew||(I=new vt(n,n)),n=rn(e,t,!0,!0),j=-1;else{var re=fs(e,n,r.unit);r.extend?I=wa(I,re.anchor,re.head,r.extend):I=re}r.addNew?j==-1?(j=V.length,Vt(E,gr(e,V.concat([I]),j),{scroll:!1,origin:"*mouse"})):V.length>1&&V[j].empty()&&r.unit=="char"&&!r.extend?(Vt(E,gr(e,V.slice(0,j).concat(V.slice(j+1)),0),{scroll:!1,origin:"*mouse"}),H=E.sel):Ca(E,j,I,Te):(j=0,Vt(E,new sr([I],0),Te),H=E.sel);var ue=n;function ge(Ve){if(lt(ue,Ve)==0)return;if(ue=Ve,r.unit=="rectangle"){for(var Qe=[],at=e.options.tabSize,nt=z(et(E,n.line).text,n.ch,at),ht=z(et(E,Ve.line).text,Ve.ch,at),Tt=Math.min(nt,ht),Bt=Math.max(nt,ht),_t=Math.min(n.line,Ve.line),ir=Math.min(e.lastLine(),Math.max(n.line,Ve.line));_t<=ir;_t++){var qt=et(E,_t).text,Mt=de(qt,Tt,at);Tt==Bt?Qe.push(new vt(Ne(_t,Mt),Ne(_t,Mt))):qt.length>Mt&&Qe.push(new vt(Ne(_t,Mt),Ne(_t,de(qt,Bt,at))))}Qe.length||Qe.push(new vt(n,n)),Vt(E,gr(e,H.ranges.slice(0,j).concat(Qe),j),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var er=I,Ht=fs(e,Ve,r.unit),Ft=er.anchor,kt;lt(Ht.anchor,Ft)>0?(kt=Ht.head,Ft=Yr(er.from(),Ht.anchor)):(kt=Ht.anchor,Ft=hn(er.to(),Ht.head));var Ot=H.ranges.slice(0);Ot[j]=Xl(e,new vt(st(E,Ft),kt)),Vt(E,gr(e,Ot,j),Te)}}var he=i.wrapper.getBoundingClientRect(),Oe=0;function Me(Ve){var Qe=++Oe,at=rn(e,Ve,!0,r.unit=="rectangle");if(!at)return;if(lt(at,ue)!=0){e.curOp.focus=R(),ge(at);var nt=ki(i,E);(at.line>=nt.to||at.line<nt.from)&&setTimeout(Nt(e,function(){Oe==Qe&&Me(Ve)}),150)}else{var ht=Ve.clientY<he.top?-20:Ve.clientY>he.bottom?20:0;ht&&setTimeout(Nt(e,function(){if(Oe!=Qe)return;i.scroller.scrollTop+=ht,Me(Ve)}),50)}}function Be(Ve){e.state.selectingText=!1,Oe=Infinity,Ve&&(Y(Ve),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",ze),Ye(i.wrapper.ownerDocument,"mouseup",Je),E.history.lastSelOrigin=null}var ze=Nt(e,function(Ve){Ve.buttons===0||!Ee(Ve)?Be(Ve):Me(Ve)}),Je=Nt(e,Be);e.state.selectingText=Je,xe(i.wrapper.ownerDocument,"mousemove",ze),xe(i.wrapper.ownerDocument,"mouseup",Je)}function Xl(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(lt(n,r)==0&&n.sticky==r.sticky)return t;var E=Ue(i);if(!E)return t;var I=je(E,n.ch,n.sticky),j=E[I];if(j.from!=n.ch&&j.to!=n.ch)return t;var H=I+(j.from==n.ch==(j.level!=1)?0:1);if(H==0||H==E.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=je(E,r.ch,r.sticky),ue=re-I||(r.ch-n.ch)*(j.level==1?-1:1);re==H-1||re==H?V=ue<0:V=ue>0}var ge=E[H+(V?-1:0)],he=V==(ge.level==1),Oe=he?ge.from:ge.to,Me=he?"after":"before";return n.ch==Oe&&n.sticky==Me?t:new vt(new Ne(n.line,Oe,Me),r)}function hs(e,t,n,r){var i,E;if(t.touches)i=t.touches[0].clientX,E=t.touches[0].clientY;else try{i=t.clientX,E=t.clientY}catch(ge){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var I=e.display,j=I.lineDiv.getBoundingClientRect();if(E>j.bottom||!ae(e,n))return J(t);E-=j.top-I.viewOffset;for(var H=0;H<e.display.gutterSpecs.length;++H){var V=I.gutters.childNodes[H];if(V&&V.getBoundingClientRect().right>=i){var re=Cr(e.doc,E),ue=e.display.gutterSpecs[H];return _e(e,n,e,re,ue.className,t),J(t)}}}function Ra(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Ar(e.display,t)||Yl(e,t))return;if(Ie(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Jn(e)}var Mn={toString:function(){return"CodeMirror.Init"}},gs={},Xi={};function $l(e){var t=e.optionHandlers;function n(r,i,E,I){e.defaults[r]=i,E&&(t[r]=I?function(j,H,V){V!=Mn&&E(j,H,V)}:E)}e.defineOption=n,e.Init=Mn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ii(r),Jn(r),Qt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var E=[],I=r.doc.first;r.doc.iter(function(H){for(var V=0;;){var re=H.text.indexOf(i,V);if(re==-1)break;V=re+i.length,E.push(Ne(I,re))}I++});for(var j=E.length-1;j>=0;j--)_n(r.doc,i,E[j],Ne(E[j].line,E[j].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,E){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),E!=Mn&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!T),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),ni(r)},!0),n("keyMap","default",function(r,i,E){var I=zi(i),j=E!=Mn&&zi(E);j&&j.detach&&j.detach(r,I),I.attach&&I.attach(r,j||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ba(i,r.options.lineNumbers),ni(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Cn(r)},!0),n("scrollbarStyle","native",function(r){yo(r),Cn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ba(r.options.gutters,i),ni(r)},!0),n("firstLineNumber",1,ni,!0),n("lineNumberFormatter",function(r){return r},ni,!0),n("showCursorWhenSelecting",!1,Qn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Sn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Qn,!0),n("singleCursorHeightPerLine",!0,Qn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ii,!0),n("addModeClass",!1,ii,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,ii,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Mn;if(!t!=!r){var i=e.display.dragFunctions,E=t?xe:Ye;E(e.display.scroller,"dragstart",i.start),E(e.display.scroller,"dragenter",i.enter),E(e.display.scroller,"dragover",i.over),E(e.display.scroller,"dragleave",i.leave),E(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),mr(e)),da(e),Qt(e),Jn(e),setTimeout(function(){return Cn(e)},100)}function Dt(e,t){var n=this;if(!(this instanceof Dt))return new Dt(e,t);this.options=t=t?F(t):{},F(gs,t,!1);var r=t.value;typeof r=="string"?r=new Zt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Dt.inputStyles[t.inputStyle](this),E=this.display=new dl(e,r,i,t);E.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Q,keySeq:null,specialChars:null},t.autofocus&&!o&&E.input.focus(),N&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),sn(this),this.curOp.forceUpdate=!0,Ao(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):Sn(this);for(var I in Xi)Xi.hasOwnProperty(I)&&Xi[I](this,t[I],Mn);xo(this),t.finishInit&&t.finishInit(this);for(var j=0;j<Pa.length;++j)Pa[j](this);ln(this),A&&t.lineWrapping&&getComputedStyle(E.lineDiv).textRendering=="optimizelegibility"&&(E.lineDiv.style.textRendering="auto")}Dt.defaults=gs,Dt.optionHandlers=Xi;function Zl(e){var t=e.display;xe(t.scroller,"mousedown",Nt(e,cs)),N&&k<11?xe(t.scroller,"dblclick",Nt(e,function(H){if(Ie(e,H))return;var V=rn(e,H);if(!V||Ra(e,H)||Ar(e.display,H))return;Y(H);var re=e.findWordAt(V);ji(e.doc,re.anchor,re.head)})):xe(t.scroller,"dblclick",function(H){return Ie(e,H)||Y(H)}),xe(t.scroller,"contextmenu",function(H){return ms(e,H)}),xe(t.input.getField(),"contextmenu",function(H){t.scroller.contains(H.target)||ms(e,H)});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 E(H){if(H.touches.length!=1)return!1;var V=H.touches[0];return V.radiusX<=1&&V.radiusY<=1}function I(H,V){if(V.left==null)return!0;var re=V.left-H.left,ue=V.top-H.top;return re*re+ue*ue>20*20}xe(t.scroller,"touchstart",function(H){if(!Ie(e,H)&&!E(H)&&!Ra(e,H)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},H.touches.length==1&&(t.activeTouch.left=H.touches[0].pageX,t.activeTouch.top=H.touches[0].pageY)}}),xe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),xe(t.scroller,"touchend",function(H){var V=t.activeTouch;if(V&&!Ar(t,H)&&V.left!=null&&!V.moved&&new Date-V.start<300){var re=e.coordsChar(t.activeTouch,"page"),ue;!V.prev||I(V,V.prev)?ue=new vt(re,re):!V.prev.prev||I(V,V.prev.prev)?ue=e.findWordAt(re):ue=new vt(Ne(re.line,0),st(e.doc,Ne(re.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),Y(H)}i()}),xe(t.scroller,"touchcancel",i),xe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qn(e,t.scroller.scrollTop),an(e,t.scroller.scrollLeft,!0),_e(e,"scroll",e))}),xe(t.scroller,"mousewheel",function(H){return wo(e,H)}),xe(t.scroller,"DOMMouseScroll",function(H){return wo(e,H)}),xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(H){Ie(e,H)||ee(H)},over:function(H){Ie(e,H)||(Al(e,H),ee(H))},start:function(H){return Dl(e,H)},drop:Nt(e,Ll),leave:function(H){Ie(e,H)||Zo(e)}};var j=t.input.getField();xe(j,"keyup",function(H){return us.call(e,H)}),xe(j,"keydown",Nt(e,ls)),xe(j,"keypress",Nt(e,ds)),xe(j,"focus",function(H){return fa(e,H)}),xe(j,"blur",function(H){return Sn(e,H)})}var Pa=[];Dt.defineInitHook=function(e){return Pa.push(e)};function vi(e,t,n,r){var i=e.doc,E;n==null&&(n="add"),n=="smart"&&(i.mode.indent?E=rr(e,t).state:n="prev");var I=e.options.tabSize,j=et(i,t),H=z(j.text,null,I);j.stateAfter&&(j.stateAfter=null);var V=j.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(j.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(E,j.text.slice(V.length),j.text),re==Ce||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=z(et(i,t-1).text,null,I):re=0:n=="add"?re=H+e.options.indentUnit:n=="subtract"?re=H-e.options.indentUnit:typeof n=="number"&&(re=H+n),re=Math.max(0,re);var ue="",ge=0;if(e.options.indentWithTabs)for(var he=Math.floor(re/I);he;--he)ge+=I,ue+=" ";if(ge<re&&(ue+=oe(re-ge)),ue!=V)return _n(i,ue,Ne(t,0),Ne(t,V.length),"+input"),j.stateAfter=null,!0;for(var Oe=0;Oe<i.sel.ranges.length;Oe++){var Me=i.sel.ranges[Oe];if(Me.head.line==t&&Me.head.ch<V.length){var Be=Ne(t,V.length);Ca(i,Oe,new vt(Be,Be));break}}}var vr=null;function Yi(e){vr=e}function Ma(e,t,n,r,i){var E=e.doc;e.display.shift=!1,r||(r=E.sel);var I=+new Date-200,j=i=="paste"||e.state.pasteIncoming>I,H=mt(t),V=null;if(j&&r.ranges.length>1)if(vr&&vr.text.join(`
|
|
`)==t){if(r.ranges.length%vr.text.length==0){V=[];for(var re=0;re<vr.text.length;re++)V.push(E.splitLines(vr.text[re]))}}else H.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=fe(H,function(ze){return[ze]}));for(var ue=e.curOp.updateInput,ge=r.ranges.length-1;ge>=0;ge--){var he=r.ranges[ge],Oe=he.from(),Me=he.to();he.empty()&&(n&&n>0?Oe=Ne(Oe.line,Oe.ch-n):e.state.overwrite&&!j?Me=Ne(Me.line,Math.min(et(E,Me.line).text.length,Me.ch+ye(H).length)):j&&vr&&vr.lineWise&&vr.text.join(`
|
|
`)==H.join(`
|
|
`)&&(Oe=Me=Ne(Oe.line,0)));var Be={from:Oe,to:Me,text:V?V[ge%V.length]:H,origin:i||(j?"paste":e.state.cutIncoming>I?"cut":"+input")};An(e.doc,Be),Kt(e,"inputRead",e,Be)}t&&!j&&ys(e,t),wn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&nr(t,function(){return Ma(t,n,0,null,"paste")}),!0}function ys(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var E=e.getModeAt(i.head),I=!1;if(E.electricChars){for(var j=0;j<E.electricChars.length;j++)if(t.indexOf(E.electricChars.charAt(j))>-1){I=vi(e,i.head.line,"smart");break}}else E.electricInput&&(E.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(I=vi(e,i.head.line,"smart")));I&&Kt(e,"electricInput",e,i.head.line)}}function bs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,E={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(E),t.push(e.getRange(E.anchor,E.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return A?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Es(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var E=this.options,I=E[r];if(E[r]==i&&r!="mode")return;E[r]=i,t.hasOwnProperty(r)&&Nt(this,t[r])(this,i,I),_e(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,E=0;E<i.length;++E)if(i[E]==r||i[E].name==r)return i.splice(E,1),!0},addOverlay:$t(function(r,i){var E=r.token?r:e.getMode(this.options,r);if(E.startState)throw new Error("Overlays may not be stateful.");Le(this.state.overlays,{mode:E,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(I){return I.priority}),this.state.modeGen++,Qt(this)}),removeOverlay:$t(function(r){for(var i=this.state.overlays,E=0;E<i.length;++E){var I=i[E].modeSpec;if(I==r||typeof r=="string"&&I.name==r){i.splice(E,1),this.state.modeGen++,Qt(this);return}}}),indentLine:$t(function(r,i,E){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Rr(this.doc,r)&&vi(this,r,i,E)}),indentSelection:$t(function(r){for(var i=this.doc.sel.ranges,E=-1,I=0;I<i.length;I++){var j=i[I];if(j.empty())j.head.line>E&&(vi(this,j.head.line,r,!0),E=j.head.line,I==this.doc.sel.primIndex&&wn(this));else{var H=j.from(),V=j.to(),re=Math.max(E,H.line);E=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ue=re;ue<E;++ue)vi(this,ue,r);var ge=this.doc.sel.ranges;H.ch==0&&i.length==ge.length&&ge[I].from().ch>0&&Ca(this.doc,I,new vt(H,ge[I].to()),pe)}}}),getTokenAt:function(r,i){return Dr(this,r,i)},getLineTokens:function(r,i){return Dr(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=st(this.doc,r);var i=Bn(this,et(this.doc,r.line)),E=0,I=(i.length-1)/2,j=r.ch,H;if(j==0)H=i[2];else for(;;){var V=E+I>>1;if((V?i[V*2-1]:0)>=j)I=V;else if(i[V*2+1]<j)E=V+1;else{H=i[V*2+2];break}}var re=H?H.indexOf("overlay "):-1;return re<0?H:re==0?null:H.slice(0,re-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 E=[];if(!n.hasOwnProperty(i))return E;var I=n[i],j=this.getModeAt(r);if(typeof j[i]=="string")I[j[i]]&&E.push(I[j[i]]);else if(j[i])for(var H=0;H<j[i].length;H++){var V=I[j[i][H]];V&&E.push(V)}else j.helperType&&I[j.helperType]?E.push(I[j.helperType]):I[j.name]&&E.push(I[j.name]);for(var re=0;re<I._global.length;re++){var ue=I._global[re];ue.pred(j,this)&&ie(E,ue.val)==-1&&E.push(ue.val)}return E},getStateAfter:function(r,i){var E=this.doc;return r=$r(E,r==null?E.first+E.size-1:r),rr(this,r+1,i).state},cursorCoords:function(r,i){var E,I=this.doc.sel.primary();return r==null?E=I.head:typeof r=="object"?E=st(this.doc,r):E=r?I.from():I.to(),pr(this,E,i||"page")},charCoords:function(r,i){return ia(this,st(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,Cr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,E){var I=!1,j;if(typeof r=="number"){var H=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>H&&(r=H,I=!0),j=et(this.doc,r)}else j=r;return Oi(this,j,{top:0,left:0},i||"page",E||I).top+(I?this.doc.height-Lt(j):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Tn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,E,I,j){var H=this.display;r=pr(this,st(this.doc,r));var V=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),H.sizer.appendChild(i),I=="over")V=r.top;else if(I=="above"||I=="near"){var ue=Math.max(H.wrapper.clientHeight,this.doc.height),ge=Math.max(H.sizer.clientWidth,H.lineSpace.clientWidth);(I=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(V=r.bottom),re+i.offsetWidth>ge&&(re=ge-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",j=="right"?(re=H.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(j=="left"?re=0:j=="middle"&&(re=(H.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),E&&Js(this,{left:re,top:V,right:re+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:$t(ls),triggerOnKeyPress:$t(ds),triggerOnKeyUp:us,triggerOnMouseDown:$t(cs),execCommand:function(r){if(hi.hasOwnProperty(r))return hi[r].call(null,this)},triggerElectric:$t(function(r){ys(this,r)}),findPosH:function(r,i,E,I){var j=1;i<0&&(j=-1,i=-i);for(var H=st(this.doc,r),V=0;V<i&&!(H=ka(this.doc,H,j,E,I),H.hitSide);++V);return H},moveH:$t(function(r,i){var E=this;this.extendSelectionsBy(function(I){return E.display.shift||E.doc.extend||I.empty()?ka(E.doc,I.head,r,i,E.options.rtlMoveVisually):r<0?I.from():I.to()},se)}),deleteH:$t(function(r,i){var E=this.doc.sel,I=this.doc;E.somethingSelected()?I.replaceSelection("",null,"+delete"):Pn(this,function(j){var H=ka(I,j.head,r,i,!1);return r<0?{from:H,to:j.head}:{from:j.head,to:H}})}),findPosV:function(r,i,E,I){var j=1,H=I;i<0&&(j=-1,i=-i);for(var V=st(this.doc,r),re=0;re<i;++re){var ue=pr(this,V,"div");if(H==null?H=ue.left:ue.left=H,V=Ts(this,ue,j,E),V.hitSide)break}return V},moveV:$t(function(r,i){var E=this,I=this.doc,j=[],H=!this.display.shift&&!I.extend&&I.sel.somethingSelected();if(I.extendSelectionsBy(function(re){if(H)return r<0?re.from():re.to();var ue=pr(E,re.head,"div");re.goalColumn!=null&&(ue.left=re.goalColumn),j.push(ue.left);var ge=Ts(E,ue,r,i);return i=="page"&&re==I.sel.primary()&&ma(E,ia(E,ge,"div").top-ue.top),ge},se),j.length)for(var V=0;V<I.sel.ranges.length;V++)I.sel.ranges[V].goalColumn=j[V]}),findWordAt:function(r){var i=this.doc,E=et(i,r.line).text,I=r.ch,j=r.ch;if(E){var H=this.getHelper(r,"wordChars");(r.sticky=="before"||j==E.length)&&I?--I:++j;for(var V=E.charAt(I),re=Re(V,H)?function(ue){return Re(ue,H)}:/\s/.test(V)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Re(ue)};I>0&&re(E.charAt(I-1));)--I;for(;j<E.length&&re(E.charAt(j));)++j}return new vt(Ne(r.line,I),Ne(r.line,j))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),_e(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==R()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$t(function(r,i){Zn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-br(this)-this.display.barHeight,width:r.scrollWidth-br(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:en(this)}},scrollIntoView:$t(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from: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?Qs(this,r):mo(this,r.from,r.to,r.margin)}),setSize:$t(function(r,i){var E=this,I=function(H){return typeof H=="number"||/^\d+$/.test(String(H))?H+"px":H};r!=null&&(this.display.wrapper.style.width=I(r)),i!=null&&(this.display.wrapper.style.height=I(i)),this.options.lineWrapping&&qa(this);var j=this.display.viewFrom;this.doc.iter(j,this.display.viewTo,function(H){if(H.widgets){for(var V=0;V<H.widgets.length;V++)if(H.widgets[V].noHScroll){Nr(E,j,"widget");break}}++j}),this.curOp.forceUpdate=!0,_e(this,"refresh",this)}),operation:function(r){return nr(this,r)},startOperation:function(){return sn(this)},endOperation:function(){return ln(this)},refresh:$t(function(){var r=this.display.cachedTextHeight;Qt(this),this.curOp.forceUpdate=!0,Jn(this),Zn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-xn(this.display))>.5||this.options.lineWrapping)&&da(this),_e(this,"refresh",this)}),swapDoc:$t(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Ao(this,r),Jn(this),this.display.input.reset(),Zn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Kt(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}},le(e),e.registerHelper=function(r,i,E){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=E},e.registerGlobalHelper=function(r,i,E,I){e.registerHelper(r,i,I),n[r]._global.push({pred:E,val:I})}}function ka(e,t,n,r,i){var E=t,I=n,j=et(e,t.line),H=i&&e.direction=="rtl"?-n:n;function V(){var Je=t.line+H;return Je<e.first||Je>=e.first+e.size?!1:(t=new Ne(Je,t.ch,t.sticky),j=et(e,Je))}function re(Je){var Ve;if(r=="codepoint"){var Qe=j.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Qe)?Ve=null:Ve=new Ne(t.line,Math.max(0,Math.min(j.text.length,t.ch+n*(Qe>=55296&&Qe<56320?2:1))),-n)}else i?Ve=kl(e.cm,j,t,n):Ve=Da(j,t,n);if(Ve==null)if(!Je&&V())t=Aa(i,e.cm,j,t.line,H);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var ue=null,ge=r=="group",he=e.cm&&e.cm.getHelper(t,"wordChars"),Oe=!0;!(n<0&&!re(!Oe));Oe=!1){var Me=j.text.charAt(t.ch)||`
|
|
`,Be=Re(Me,he)?"w":ge&&Me==`
|
|
`?"n":!ge||/\s/.test(Me)?null:"p";if(ge&&!Oe&&!Be&&(Be="s"),ue&&ue!=Be){n<0&&(n=1,re(),t.sticky="after");break}if(Be&&(ue=Be),n>0&&!re(!Oe))break}var ze=Ki(e,t,E,I,!0);return He(E,ze)&&(ze.hitSide=!0),ze}function Ts(e,t,n,r){var i=e.doc,E=t.left,I;if(r=="page"){var j=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),H=Math.max(j-.5*xn(e.display),3);I=(n>0?t.bottom:t.top)+n*H}else r=="line"&&(I=n>0?t.bottom+3:t.top-3);for(var V;!(V=oa(e,E,I),!V.outside);){if(n<0?I<=0:I>=i.height){V.hitSide=!0;break}I+=n*5}return V}var bt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};bt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function E(j){for(var H=j.target;H;H=H.parentNode){if(H==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(H.className))break}return!1}xe(i,"paste",function(j){if(!E(j)||Ie(r,j)||vs(j,r))return;k<=11&&setTimeout(Nt(r,function(){return t.updateFromDOM()}),20)}),xe(i,"compositionstart",function(j){t.composing={data:j.data,done:!1}}),xe(i,"compositionupdate",function(j){t.composing||(t.composing={data:j.data,done:!1})}),xe(i,"compositionend",function(j){t.composing&&(j.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),xe(i,"touchstart",function(){return n.forceCompositionEnd()}),xe(i,"input",function(){t.composing||t.readFromDOMSoon()});function I(j){if(!E(j)||Ie(r,j))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()}),j.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var H=bs(r);Yi({lineWise:!0,text:H.text}),j.type=="cut"&&r.operation(function(){r.setSelections(H.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(j.clipboardData){j.clipboardData.clearData();var V=vr.text.join(`
|
|
`);if(j.clipboardData.setData("Text",V),j.clipboardData.getData("Text")==V){j.preventDefault();return}}var re=xs(),ue=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),ue.value=vr.text.join(`
|
|
`);var ge=document.activeElement;X(ue),setTimeout(function(){r.display.lineSpace.removeChild(re),ge.focus(),ge==i&&n.showPrimarySelection()},50)}xe(i,"copy",I),xe(i,"cut",I)},bt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},bt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},bt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},bt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},bt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var E=$i(t,e.anchorNode,e.anchorOffset),I=$i(t,e.focusNode,e.focusOffset);if(E&&!E.bad&&I&&!I.bad&<(Yr(E,I),r)==0&<(hn(E,I),i)==0)return;var j=t.display.view,H=r.line>=t.display.viewFrom&&Ss(t,r)||{node:j[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ss(t,i);if(!V){var re=j[j.length-1].measure,ue=re.maps?re.maps[re.maps.length-1]:re.map;V={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!H||!V){e.removeAllRanges();return}var ge=e.rangeCount&&e.getRangeAt(0),he;try{he=g(H.node,H.offset,V.offset,V.node)}catch(Oe){}he&&(!D&&t.state.focused?(e.collapse(H.node,H.offset),he.collapsed||(e.removeAllRanges(),e.addRange(he))):(e.removeAllRanges(),e.addRange(he)),ge&&e.anchorNode==null?e.addRange(ge):D&&this.startGracePeriod()),this.rememberSelection()},bt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},bt.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},bt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},bt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return m(this.div,t)},bt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},bt.prototype.blur=function(){this.div.blur()},bt.prototype.getField=function(){return this.div},bt.prototype.supportsTouch=function(){return!0},bt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():nr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},bt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},bt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&x&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=$i(t,e.anchorNode,e.anchorOffset),r=$i(t,e.focusNode,e.focusOffset);n&&r&&nr(t,function(){Vt(t.doc,Br(n,r),pe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},bt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ne(r.line-1,et(e.doc,r.line-1).length)),i.ch==et(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 E,I,j;r.line==t.viewFrom||(E=nn(e,r.line))==0?(I=gt(t.view[0].line),j=t.view[0].node):(I=gt(t.view[E].line),j=t.view[E-1].node.nextSibling);var H=nn(e,i.line),V,re;if(H==t.view.length-1?(V=t.viewTo-1,re=t.lineDiv.lastChild):(V=gt(t.view[H+1].line)-1,re=t.view[H+1].node.previousSibling),!j)return!1;for(var ue=e.doc.splitLines(tu(e,j,re,I,V)),ge=wr(e.doc,Ne(I,0),Ne(V,et(e.doc,V).text.length));ue.length>1&&ge.length>1;)if(ye(ue)==ye(ge))ue.pop(),ge.pop(),V--;else if(ue[0]==ge[0])ue.shift(),ge.shift(),I++;else break;for(var he=0,Oe=0,Me=ue[0],Be=ge[0],ze=Math.min(Me.length,Be.length);he<ze&&Me.charCodeAt(he)==Be.charCodeAt(he);)++he;for(var Je=ye(ue),Ve=ye(ge),Qe=Math.min(Je.length-(ue.length==1?he:0),Ve.length-(ge.length==1?he:0));Oe<Qe&&Je.charCodeAt(Je.length-Oe-1)==Ve.charCodeAt(Ve.length-Oe-1);)++Oe;if(ue.length==1&&ge.length==1&&I==r.line)for(;he&&he>r.ch&&Je.charCodeAt(Je.length-Oe-1)==Ve.charCodeAt(Ve.length-Oe-1);)he--,Oe++;ue[ue.length-1]=Je.slice(0,Je.length-Oe).replace(/^\u200b+/,""),ue[0]=ue[0].slice(he).replace(/\u200b+$/,"");var at=Ne(I,he),nt=Ne(V,ge.length?ye(ge).length-Oe:0);if(ue.length>1||ue[0]||lt(at,nt))return _n(e.doc,ue,at,nt,"+input"),!0},bt.prototype.ensurePolled=function(){this.forceCompositionEnd()},bt.prototype.reset=function(){this.forceCompositionEnd()},bt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},bt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},bt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&nr(this.cm,function(){return Qt(e.cm)})},bt.prototype.setUneditable=function(e){e.contentEditable="false"},bt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Nt(this.cm,Ma)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},bt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},bt.prototype.onContextMenu=function(){},bt.prototype.resetPosition=function(){},bt.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Ya(n,r,t.line),E=Ue(r,e.doc.direction),I="left";if(E){var j=je(E,t.ch);I=j%2?"right":"left"}var H=Qa(i.map,t.ch,I);return H.offset=H.collapse=="right"?H.end:H.start,H}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var E="",I=!1,j=e.doc.lineSeparator(),H=!1;function V(he){return function(Oe){return Oe.id==he}}function re(){I&&(E+=j,H&&(E+=j),I=H=!1)}function ue(he){he&&(re(),E+=he)}function ge(he){if(he.nodeType==1){var Oe=he.getAttribute("cm-text");if(Oe){ue(Oe);return}var Me=he.getAttribute("cm-marker"),Be;if(Me){var ze=e.findMarks(Ne(r,0),Ne(i+1,0),V(+Me));ze.length&&(Be=ze[0].find(0))&&ue(wr(e.doc,Be.from,Be.to).join(j));return}if(he.getAttribute("contenteditable")=="false")return;var Je=/^(pre|div|p|li|table|br)$/i.test(he.nodeName);if(!/^br$/i.test(he.nodeName)&&he.textContent.length==0)return;Je&&re();for(var Ve=0;Ve<he.childNodes.length;Ve++)ge(he.childNodes[Ve]);/^(pre|p)$/i.test(he.nodeName)&&(H=!0),Je&&(I=!0)}else he.nodeType==3&&ue(he.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ge(t),t==n);)t=t.nextSibling,H=!1;return E}function $i(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return kn(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 E=e.display.view[i];if(E.node==r)return ru(E,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!m(r,t))return kn(Ne(gt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var E=e.rest?ye(e.rest):e.line;return kn(Ne(gt(E),E.text.length),i)}var I=t.nodeType==3?t:null,j=t;for(!I&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(I=t.firstChild,n&&(n=I.nodeValue.length));j.parentNode!=r;)j=j.parentNode;var H=e.measure,V=H.maps;function re(Be,ze,Je){for(var Ve=-1;Ve<(V?V.length:0);Ve++)for(var Qe=Ve<0?H.map:V[Ve],at=0;at<Qe.length;at+=3){var nt=Qe[at+2];if(nt==Be||nt==ze){var ht=gt(Ve<0?e.line:e.rest[Ve]),Tt=Qe[at]+Je;return(Je<0||nt!=Be)&&(Tt=Qe[at+(Je?1:0)]),Ne(ht,Tt)}}}var ue=re(I,j,n);if(ue)return kn(ue,i);for(var ge=j.nextSibling,he=I?I.nodeValue.length-n:0;ge;ge=ge.nextSibling){if(ue=re(ge,ge.firstChild,0),ue)return kn(Ne(ue.line,ue.ch-he),i);he+=ge.textContent.length}for(var Oe=j.previousSibling,Me=n;Oe;Oe=Oe.previousSibling){if(ue=re(Oe,Oe.firstChild,-1),ue)return kn(Ne(ue.line,ue.ch+Me),i);Me+=Oe.textContent.length}}var Pt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Q,this.hasSelection=!1,this.composing=null};Pt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(i.style.width="0px"),xe(i,"input",function(){N&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),xe(i,"paste",function(I){if(Ie(r,I)||vs(I,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function E(I){if(Ie(r,I))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var j=bs(r);Yi({lineWise:!0,text:j.text}),I.type=="cut"?r.setSelections(j.ranges,null,pe):(n.prevInput="",i.value=j.text.join(`
|
|
`),X(i))}else return;I.type=="cut"&&(r.state.cutIncoming=+new Date)}xe(i,"cut",E),xe(i,"copy",E),xe(e.scroller,"paste",function(I){if(Ar(e,I)||Ie(r,I))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var j=new Event("paste");j.clipboardData=I.clipboardData,i.dispatchEvent(j)}),xe(e.lineSpace,"selectstart",function(I){Ar(e,I)||Y(I)}),xe(i,"compositionstart",function(){var I=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:I,range:r.markText(I,r.getCursor("to"),{className:"CodeMirror-composing"})}}),xe(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Pt.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},Pt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Pt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=pr(e,n.sel.primary().head,"div"),E=t.wrapper.getBoundingClientRect(),I=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+I.top-E.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+I.left-E.left))}return r},Pt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Pt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&X(this.textarea),N&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",N&&k>=9&&(this.hasSelection=null))},Pt.prototype.getField=function(){return this.textarea},Pt.prototype.supportsTouch=function(){return!1},Pt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},Pt.prototype.blur=function(){this.textarea.blur()},Pt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Pt.prototype.receivedFocus=function(){this.slowPoll()},Pt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Pt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Pt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||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(N&&k>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var E=i.charCodeAt(0);if(E==8203&&!r&&(r="\u200B"),E==8666)return this.reset(),this.cm.execCommand("undo")}for(var I=0,j=Math.min(r.length,i.length);I<j&&r.charCodeAt(I)==i.charCodeAt(I);)++I;return nr(t,function(){Ma(t,i.slice(I),r.length-I,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Pt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Pt.prototype.onKeyPress=function(){N&&k>=9&&(this.hasSelection=null),this.fastPoll()},Pt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var E=rn(n,e),I=r.scroller.scrollTop;if(!E||L)return;var j=n.options.resetSelectionOnContextMenu;j&&n.doc.sel.contains(E)==-1&&Nt(n,Vt)(n.doc,Br(E),pe);var H=i.style.cssText,V=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
|
|
z-index: 1000; background: `+(N?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;A&&(ue=window.scrollY),r.input.focus(),A&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=he,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function ge(){if(i.selectionStart!=null){var Me=n.somethingSelected(),Be="\u200B"+(Me?i.value:"");i.value="\u21DA",i.value=Be,t.prevInput=Me?"":"\u200B",i.selectionStart=1,i.selectionEnd=Be.length,r.selForContextMenu=n.doc.sel}}function he(){if(t.contextMenuPending!=he)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=H,N&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=I),i.selectionStart!=null){(!N||N&&k<9)&&ge();var Me=0,Be=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Nt(n,Wo)(n):Me++<10?r.detectingSelectAll=setTimeout(Be,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Be,200)}}if(N&&k>=9&&ge(),w){ee(e);var Oe=function(){Ye(window,"mouseup",Oe),setTimeout(he,20)};xe(window,"mouseup",Oe)}else setTimeout(he,50)},Pt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Pt.prototype.setUneditable=function(){},Pt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?F(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=R();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=j.getValue()}var i;if(e.form&&(xe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var E=e.form;i=E.submit;try{var I=E.submit=function(){r(),E.submit=i,E.submit(),E.submit=I}}catch(H){}}t.finishInit=function(H){H.save=r,H.getTextArea=function(){return e},H.toTextArea=function(){H.toTextArea=isNaN,r(),e.parentNode.removeChild(H.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var j=Dt(function(H){return e.parentNode.insertBefore(H,e.nextSibling)},t);return j}function iu(e){e.off=Ye,e.on=xe,e.wheelEventPixels=cl,e.Doc=Zt,e.splitLines=mt,e.countColumn=z,e.findColumn=de,e.isWordChar=we,e.Pass=Ce,e.signal=_e,e.Line=wt,e.changeEnd=jr,e.scrollbarModel=vo,e.Pos=Ne,e.cmpPos=lt,e.modes=Wt,e.mimeModes=pt,e.resolveMode=lr,e.getMode=Sr,e.modeExtensions=hr,e.extendMode=yi,e.copyState=ur,e.startState=cn,e.innerMode=Vr,e.commands=hi,e.keyMap=_r,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=Rn,e.normalizeKeyMap=Ml,e.StringStream=Ct,e.SharedTextMarker=di,e.TextMarker=Kr,e.LineWidget=ui,e.e_preventDefault=Y,e.e_stopPropagation=$,e.e_stop=ee,e.addClass=U,e.contains=m,e.rmClass=h,e.keyNames=Hr}$l(Dt),ql(Dt);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in Zt.prototype)Zt.prototype.hasOwnProperty(Ji)&&ie(au,Ji)<0&&(Dt.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(Zt.prototype[Ji]));return le(Zt),Dt.inputStyles={textarea:Pt,contenteditable:bt},Dt.defineMode=function(e){!Dt.defaults.mode&&e!="null"&&(Dt.defaults.mode=e),Tr.apply(this,arguments)},Dt.defineMIME=zr,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){Zt.prototype[e]=t},Dt.fromTextArea=nu,iu(Dt),Dt.version="5.58.2",Dt})},Y1PL:function(ut,Ze,te){"use strict";te.r(Ze),te.d(Ze,"ResizableTextArea",function(){return ie});var Z=te("wx14"),G=te("1OyB"),D=te("vuIU"),K=te("Ji7U"),M=te("LK+K"),P=te("q1tI"),N=te("VTBJ"),k=te("rePB"),A=te("Zm9Q"),_=te("Kwbf"),x=te("c+Xe"),L=te("m+aA"),O=te("bdgK"),C=new Map;function S(pe){pe.forEach(function(Te){var se,de=Te.target;(se=C.get(de))===null||se===void 0||se.forEach(function(q){return q(de)})})}var b=new O.default(S),d=null,o=null;function s(pe,Te){C.has(pe)||(C.set(pe,new Set),b.observe(pe)),C.get(pe).add(Te)}function u(pe,Te){C.has(pe)&&(C.get(pe).delete(Te),C.get(pe).size||(b.unobserve(pe),C.delete(pe)))}var T=function(pe){Object(K.a)(se,pe);var Te=Object(M.a)(se);function se(){return Object(G.a)(this,se),Te.apply(this,arguments)}return Object(D.a)(se,[{key:"render",value:function(){return this.props.children}}]),se}(P.Component),f=P.createContext(null);function p(pe){var Te=pe.children,se=pe.onBatchResize,de=P.useRef(0),q=P.useRef([]),oe=P.useContext(f),ye=P.useCallback(function(fe,Le,ve){de.current+=1;var De=de.current;q.current.push({size:fe,element:Le,data:ve}),Promise.resolve().then(function(){De===de.current&&(se==null||se(q.current),q.current=[])}),oe==null||oe(fe,Le,ve)},[se,oe]);return P.createElement(f.Provider,{value:ye},Te)}function w(pe){var Te=pe.children,se=pe.disabled,de=P.useRef(null),q=P.useRef(null),oe=P.useContext(f),ye=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),fe=P.isValidElement(Te)&&Object(x.c)(Te),Le=fe?Te.ref:null,ve=P.useMemo(function(){return Object(x.a)(Le,de)},[Le,de]),De=P.useRef(pe);De.current=pe;var be=P.useCallback(function(we){var Re=De.current,Fe=Re.onResize,Pe=Re.data,Ae=we.getBoundingClientRect(),Se=Ae.width,We=Ae.height,Ge=we.offsetWidth,Xe=we.offsetHeight,je=Math.floor(Se),qe=Math.floor(We);if(ye.current.width!==je||ye.current.height!==qe||ye.current.offsetWidth!==Ge||ye.current.offsetHeight!==Xe){var Ue={width:je,height:qe,offsetWidth:Ge,offsetHeight:Xe};ye.current=Ue;var Ke=Ge===Math.round(Se)?Se:Ge,xe=Xe===Math.round(We)?We:Xe,$e=Object(N.a)(Object(N.a)({},Ue),{},{offsetWidth:Ke,offsetHeight:xe});oe==null||oe($e,we,Pe),Fe&&Promise.resolve().then(function(){Fe($e,we)})}},[]);return P.useEffect(function(){var we=Object(L.a)(de.current)||Object(L.a)(q.current);return we&&!se&&s(we,be),function(){return u(we,be)}},[de.current,se]),P.createElement(T,{ref:q},fe?P.cloneElement(Te,{ref:ve}):Te)}var y="rc-observer-key";function h(pe){var Te=pe.children,se=Object(A.a)(Te);return se.map(function(de,q){var oe=(de==null?void 0:de.key)||"".concat(y,"-").concat(q);return P.createElement(w,Object(Z.a)({},pe,{key:oe}),de)})}h.Collection=p;var c=h,l=te("bT9E"),a=te("TSYQ"),v=te.n(a),g=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,m=["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"],R={},U;function W(pe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(Te&&R[se])return R[se];var de=window.getComputedStyle(pe),q=de.getPropertyValue("box-sizing")||de.getPropertyValue("-moz-box-sizing")||de.getPropertyValue("-webkit-box-sizing"),oe=parseFloat(de.getPropertyValue("padding-bottom"))+parseFloat(de.getPropertyValue("padding-top")),ye=parseFloat(de.getPropertyValue("border-bottom-width"))+parseFloat(de.getPropertyValue("border-top-width")),fe=m.map(function(ve){return"".concat(ve,":").concat(de.getPropertyValue(ve))}).join(";"),Le={sizingStyle:fe,paddingSize:oe,borderSize:ye,boxSizing:q};return Te&&se&&(R[se]=Le),Le}function X(pe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,de=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),pe.getAttribute("wrap")?U.setAttribute("wrap",pe.getAttribute("wrap")):U.removeAttribute("wrap");var q=W(pe,Te),oe=q.paddingSize,ye=q.borderSize,fe=q.boxSizing,Le=q.sizingStyle;U.setAttribute("style","".concat(Le,";").concat(g)),U.value=pe.value||pe.placeholder||"";var ve=Number.MIN_SAFE_INTEGER,De=Number.MAX_SAFE_INTEGER,be=U.scrollHeight,we;if(fe==="border-box"?be+=ye:fe==="content-box"&&(be-=oe),se!==null||de!==null){U.value=" ";var Re=U.scrollHeight-oe;se!==null&&(ve=Re*se,fe==="border-box"&&(ve=ve+oe+ye),be=Math.max(ve,be)),de!==null&&(De=Re*de,fe==="border-box"&&(De=De+oe+ye),we=be>De?"":"hidden",be=Math.min(De,be))}return{height:be,minHeight:ve,maxHeight:De,overflowY:we,resize:"none"}}var B=te("Gytx"),F=te.n(B),z;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(z||(z={}));var Q=function(pe){Object(K.a)(se,pe);var Te=Object(M.a)(se);function se(de){var q;return Object(G.a)(this,se),q=Te.call(this,de),q.nextFrameActionId=void 0,q.resizeFrameId=void 0,q.textArea=void 0,q.saveTextArea=function(oe){q.textArea=oe},q.handleResize=function(oe){var ye=q.state.resizeStatus,fe=q.props,Le=fe.autoSize,ve=fe.onResize;if(ye!==z.NONE)return;typeof ve=="function"&&ve(oe),Le&&q.resizeOnNextFrame()},q.resizeOnNextFrame=function(){cancelAnimationFrame(q.nextFrameActionId),q.nextFrameActionId=requestAnimationFrame(q.resizeTextarea)},q.resizeTextarea=function(){var oe=q.props.autoSize;if(!oe||!q.textArea)return;var ye=oe.minRows,fe=oe.maxRows,Le=X(q.textArea,!1,ye,fe);q.setState({textareaStyles:Le,resizeStatus:z.RESIZING},function(){cancelAnimationFrame(q.resizeFrameId),q.resizeFrameId=requestAnimationFrame(function(){q.setState({resizeStatus:z.RESIZED},function(){q.resizeFrameId=requestAnimationFrame(function(){q.setState({resizeStatus:z.NONE}),q.fixFirefoxAutoScroll()})})})})},q.renderTextArea=function(){var oe=q.props,ye=oe.prefixCls,fe=ye===void 0?"rc-textarea":ye,Le=oe.autoSize,ve=oe.onResize,De=oe.className,be=oe.disabled,we=q.state,Re=we.textareaStyles,Fe=we.resizeStatus,Pe=Object(l.a)(q.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ae=v()(fe,De,Object(k.a)({},"".concat(fe,"-disabled"),be));"value"in Pe&&(Pe.value=Pe.value||"");var Se=Object(N.a)(Object(N.a)(Object(N.a)({},q.props.style),Re),Fe===z.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:q.handleResize,disabled:!(Le||ve)},P.createElement("textarea",Object(Z.a)({},Pe,{className:Ae,style:Se,ref:q.saveTextArea})))},q.state={textareaStyles:{},resizeStatus:z.NONE},q}return Object(D.a)(se,[{key:"componentDidUpdate",value:function(q){(q.value!==this.props.value||!F()(q.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 q=this.textArea.selectionStart,oe=this.textArea.selectionEnd;this.textArea.setSelectionRange(q,oe)}}catch(ye){}}},{key:"render",value:function(){return this.renderTextArea()}}]),se}(P.Component),ie=Q,ce=function(pe){Object(K.a)(se,pe);var Te=Object(M.a)(se);function se(de){var q;Object(G.a)(this,se),q=Te.call(this,de),q.resizableTextArea=void 0,q.focus=function(){q.resizableTextArea.textArea.focus()},q.saveTextArea=function(ye){q.resizableTextArea=ye},q.handleChange=function(ye){var fe=q.props.onChange;q.setValue(ye.target.value,function(){q.resizableTextArea.resizeTextarea()}),fe&&fe(ye)},q.handleKeyDown=function(ye){var fe=q.props,Le=fe.onPressEnter,ve=fe.onKeyDown;ye.keyCode===13&&Le&&Le(ye),ve&&ve(ye)};var oe=typeof de.value=="undefined"||de.value===null?de.defaultValue:de.value;return q.state={value:oe},q}return Object(D.a)(se,[{key:"setValue",value:function(q,oe){"value"in this.props||this.setState({value:q},oe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ie,Object(Z.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(q){return"value"in q?{value:q.value}:null}}]),se}(P.Component),Ce=Ze.default=ce},ZW9T:function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return T});var Z=te("k1fw"),G=te("miYZ"),D=te("tsqr"),K=te("rAM+"),M=te("tJVT"),P=te("PpiC"),N=te("q1tI"),k=te.n(N),A=te("bdgK");function _(f,p,w,y,h){var c=p.getWordUntilPosition(w),l={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=y.map(function(v){return{label:v,kind:f.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:l}});return h.map(function(v){a.push(Object(Z.a)(Object(Z.a)({},v),{},{range:l}))}),a}var x=function(f){var p={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(l,a){var v=_(f,l,a,w,[p]);return{suggestions:v}}});var y=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(l,a){var v=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=_(f,l,a,y,v);return{suggestions:g}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(l,a){var v=[p,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=_(f,l,a,h,v);return{suggestions:g}}})},L="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=te("LvDl");function C(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function S(){}var b=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=f;if(Array.isArray(f)){for(var w=0;w<f.length;w++){var y=d[f[w]];if(y)return y}return p[0]}return d[p]||p}var s=null,u=Ze.b=function(f){var p=f.width,w=p===void 0?"100%":p,y=f.height,h=y===void 0?"100%":y,c=f.value,l=f.language,a=l===void 0?"javascript":l,v=f.style,g=v===void 0?{}:v,m=f.options,R=m===void 0?{}:m,U=f.overrideServices,W=U===void 0?{}:U,X=f.theme,B=X===void 0?"vs-dark":X,F=f.onEditBlur,z=f.onSave,Q=f.autoHeight,ie=Q===void 0?!1:Q,ce=f.forbidCopy,Ce=ce===void 0?!1:ce,pe=f.onChange,Te=pe===void 0?S:pe,se=f.editorDidMount,de=se===void 0?S:se,q=f.onFocus,oe=q===void 0?S:q,ye=f.filename,fe=ye===void 0?"educoder.txt":ye,Le=Object(P.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ve=Object(N.useRef)(),De=Object(N.useRef)({}),be=Object(N.useRef)(),we=Object(N.useRef)(!1),Re=Object(N.useRef)(),Fe=Object(N.useState)(!1),Pe=Object(M.a)(Fe,2),Ae=Pe[0],Se=Pe[1];function We(){var J;return ve.current&&(J=new A.default(function(ee){var me=Object(K.a)(ee),Ee;try{for(me.s();!(Ee=me.n()).done;){var ke=Ee.value;(ke.target.offsetHeight>0||ke.target.offsetWidth>0)&&De.current.instance.layout()}}catch(tt){me.e(tt)}finally{me.f()}}),J.observe(ve.current)),J}function Ge(){D.b.warn(decodeURIComponent(L))}var Xe=function(){var ee=De.current.instance;if(c!=null&&ee&&Ae){var me=ee.getModel();me&&c!==me.getValue()&&(b=!0,me.setValue(c),ee.layout(),b=!1)}};Object(N.useEffect)(function(){be.current&&clearTimeout(be.current),be.current=setTimeout(function(){Xe()},500)},[c,Ae,De.current]);function je(){var J=De.current.instance;if(J){var ee=J.getSelection(),me=De.current.pastePos||{},Ee=new s.Range(me.startLineNumber||ee.endLineNumber,me.startColumn||ee.endColumn,me.endLineNumber||ee.endLineNumber,me.endColumn||ee.endColumn);setTimeout(function(){J.executeEdits("",[{range:Ee,text:""}])},300)}}function qe(J){(window.navigator.platform.match("Mac")?J.metaKey:J.ctrlKey)&&J.keyCode==83&&(J.preventDefault(),z())}var Ue=function(){if(ie&&De.current.instance){var ee=De.current.instance.getContentHeight();Y(ee<h?h:ee)}else Y(h)};function Ke(J){var ee=document.createEvent("MouseEvents");ee.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),J.dispatchEvent(ee)}function xe(J,ee){var me=window.URL||window.webkitURL||window,Ee=new Blob([ee]),ke=document.createElementNS("http://www.w3.org/1999/xhtml","a");ke.href=me.createObjectURL(Ee),ke.download=J,Ke(ke)}Object(N.useEffect)(function(){Ue()},[Ue]),Object(N.useEffect)(function(){ve.current&&!Ae&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(J){try{s=J,De.current.instance=s.editor.create(ve.current,{value:c,language:o(a),theme:B,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var ee=De.current.instance;if(de(ee,s),setTimeout(function(){Ue(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){xe(fe||"educoder.txt",ee.getValue())}})},500),De.current.subscription=ee.onDidChangeModelContent(function(Ee){we.current?clearTimeout(Re.current):(Ue(),Te(ee.getValue(),Ee)),Re.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||x(s),Ce&&(ee.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ge(),null}),ee.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ge(),null})),window.Monaco=s,F&&ee.onDidBlurEditorWidget(function(){F(ee.getValue())}),oe&&ee.onDidFocusEditorText(function(){oe(ee.getValue())}),Ce){ee.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ge(),null}),ee.onDidPaste(function(Ee){De.current.pastePos=Ee});try{window.addEventListener("paste",je)}catch(Ee){}}var me=We();return Se(!0),function(){var Ee=De.current.instance;Ee.dispose();var ke=Ee.getModel();ke&&ke.dispose(),De.current.subscription&&De.current.subscription.dispose(),Ce&&window.removeEventListener("paste",je),me.unobserve(ve.current)}}catch(Ee){}})},[]),Object(N.useEffect)(function(){var J=De.current.instance;if(J&&Ae)return document.addEventListener("keydown",qe,!1),function(){document.removeEventListener("keydown",qe)}},[z,Ae]),Object(N.useEffect)(function(){var J=De.current.instance;if(J&&Ae){var ee=o(a);s.editor.setModelLanguage(J.getModel(),ee),console.log("language:",a,J.getModel(),ee)}},[a,Ae]),Object(N.useEffect)(function(){var J=De.current.instance;J&&Ae&&s.editor.setTheme(B)},[B,Ae]),Object(N.useEffect)(function(){var J=De.current.instance;J&&Ae&&(J.updateOptions(Object(Z.a)({},R)),setTimeout(function(){J.getModel().updateOptions(Object(Z.a)({},R))},200))},[JSON.stringify(R),Ae]),Object(N.useEffect)(function(){var J=De.current.instance;J&&Ae&&J.layout()},[w,h,Ae]);var $e=Object(N.useState)(C(w)),Ye=Object(M.a)($e,2),_e=Ye[0],Ie=Ye[1],ne=Object(N.useState)(C(h)),ae=Object(M.a)(ne,2),le=ae[0],Y=ae[1],$=Object(Z.a)(Object(Z.a)({},g),{},{width:_e,height:le});return k.a.createElement("div",{className:"my-monaco-editor",ref:ve,style:$})};function T(f){var p=f.width,w=p===void 0?"100%":p,y=f.height,h=y===void 0?"100%":y,c=f.original,l=f.modified,a=f.language,v=f.options,g=v===void 0?{}:v,m=Object(N.useRef)(),R=Object(N.useState)(null),U=Object(M.a)(R,2),W=U[0],X=U[1];function B(ie){var ce;return m.current&&(ce=new A.default(function(Ce){var pe=Object(K.a)(Ce),Te;try{for(pe.s();!(Te=pe.n()).done;){var se=Te.value;(se.target.offsetHeight>0||se.target.offsetWidth>0)&&ie.layout()}}catch(de){pe.e(de)}finally{pe.f()}}),ce.observe(m.current)),ce}Object(N.useEffect)(function(){m.current&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(ie){s=ie;var ce=s.editor.createDiffEditor(m.current,Object(Z.a)(Object(Z.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},g),{},{wordWrap:!0}));X(ce);var Ce=B(ce);return function(){ce.dispose();var pe=ce.getModel();pe&&pe.dispose(),Ce.unobserve(m.current)}})},[]),Object(N.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(l,a)})},[c,l,a,W]);var F=C(w),z=C(h),Q={width:F,height:z};return k.a.createElement("div",{className:"my-diff-editor",ref:m,style:Q})}},ZpRC:function(ut,Ze,te){"use strict";function Z(x){return typeof x=="object"&&x!=null&&x.nodeType===1}function G(x,L){return(!L||x!=="hidden")&&x!=="visible"&&x!=="clip"}function D(x,L){if(x.clientHeight<x.scrollHeight||x.clientWidth<x.scrollWidth){var O=getComputedStyle(x,null);return G(O.overflowY,L)||G(O.overflowX,L)||function(C){var S=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!S&&(S.clientHeight<C.scrollHeight||S.clientWidth<C.scrollWidth)}(x)}return!1}function K(x,L,O,C,S,b,d,o){return b<x&&d>L||b>x&&d<L?0:b<=x&&o<=O||d>=L&&o>=O?b-x-C:d>L&&o<O||b<x&&o>O?d-L+S:0}var M=function(x,L){var O=window,C=L.scrollMode,S=L.block,b=L.inline,d=L.boundary,o=L.skipOverflowHiddenElements,s=typeof d=="function"?d:function(Re){return Re!==d};if(!Z(x))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,T=[],f=x;Z(f)&&s(f);){if((f=f.parentElement)===u){T.push(f);break}f!=null&&f===document.body&&D(f)&&!D(document.documentElement)||f!=null&&D(f,o)&&T.push(f)}for(var p=O.visualViewport?O.visualViewport.width:innerWidth,w=O.visualViewport?O.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=x.getBoundingClientRect(),l=c.height,a=c.width,v=c.top,g=c.right,m=c.bottom,R=c.left,U=S==="start"||S==="nearest"?v:S==="end"?m:v+l/2,W=b==="center"?R+a/2:b==="end"?g:R,X=[],B=0;B<T.length;B++){var F=T[B],z=F.getBoundingClientRect(),Q=z.height,ie=z.width,ce=z.top,Ce=z.right,pe=z.bottom,Te=z.left;if(C==="if-needed"&&v>=0&&R>=0&&m<=w&&g<=p&&v>=ce&&m<=pe&&R>=Te&&g<=Ce)return X;var se=getComputedStyle(F),de=parseInt(se.borderLeftWidth,10),q=parseInt(se.borderTopWidth,10),oe=parseInt(se.borderRightWidth,10),ye=parseInt(se.borderBottomWidth,10),fe=0,Le=0,ve="offsetWidth"in F?F.offsetWidth-F.clientWidth-de-oe:0,De="offsetHeight"in F?F.offsetHeight-F.clientHeight-q-ye:0;if(u===F)fe=S==="start"?U:S==="end"?U-w:S==="nearest"?K(h,h+w,w,q,ye,h+U,h+U+l,l):U-w/2,Le=b==="start"?W:b==="center"?W-p/2:b==="end"?W-p:K(y,y+p,p,de,oe,y+W,y+W+a,a),fe=Math.max(0,fe+h),Le=Math.max(0,Le+y);else{fe=S==="start"?U-ce-q:S==="end"?U-pe+ye+De:S==="nearest"?K(ce,pe,Q,q,ye+De,U,U+l,l):U-(ce+Q/2)+De/2,Le=b==="start"?W-Te-de:b==="center"?W-(Te+ie/2)+ve/2:b==="end"?W-Ce+oe+ve:K(Te,Ce,ie,de,oe+ve,W,W+a,a);var be=F.scrollLeft,we=F.scrollTop;U+=we-(fe=Math.max(0,Math.min(we+fe,F.scrollHeight-Q+De))),W+=be-(Le=Math.max(0,Math.min(be+Le,F.scrollWidth-ie+ve)))}X.push({el:F,top:fe,left:Le})}return X};function P(x){return x===Object(x)&&Object.keys(x).length!==0}function N(x,L){L===void 0&&(L="auto");var O="scrollBehavior"in document.body.style;x.forEach(function(C){var S=C.el,b=C.top,d=C.left;S.scroll&&O?S.scroll({top:b,left:d,behavior:L}):(S.scrollTop=b,S.scrollLeft=d)})}function k(x){return x===!1?{block:"end",inline:"nearest"}:P(x)?x:{block:"start",inline:"nearest"}}function A(x,L){var O=!x.ownerDocument.documentElement.contains(x);if(P(L)&&typeof L.behavior=="function")return L.behavior(O?[]:M(x,L));if(O)return;var C=k(L);return N(M(x,C),C.behavior)}var _=Ze.a=A},bT9E:function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return G});var Z=te("VTBJ");function G(D,K){var M=Object(Z.a)({},D);return Array.isArray(K)&&K.forEach(function(P){delete M[P]}),M}},c5Ni:function(ut,Ze,te){},dejd:function(ut,Ze,te){},dmUQ:function(ut,Ze,te){"use strict";var Z=te("Ff2n"),G=te("rePB"),D=te("1OyB"),K=te("vuIU"),M=te("Ji7U"),P=te("md7G"),N=te("foSv"),k=te("q1tI"),A=te.n(k),_=te("TSYQ"),x=te.n(_),L=te("4IlW");function O(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(l);a&&(g=g.filter(function(m){return Object.getOwnPropertyDescriptor(l,m).enumerable})),v.push.apply(v,g)}return v}function C(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?O(Object(v),!0).forEach(function(g){Object(G.a)(l,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):O(Object(v)).forEach(function(g){Object.defineProperty(l,g,Object.getOwnPropertyDescriptor(v,g))})}return l}function S(l){var a=b();return function(){var g=Object(N.a)(l),m;if(a){var R=Object(N.a)(this).constructor;m=Reflect.construct(g,arguments,R)}else m=g.apply(this,arguments);return Object(P.a)(this,m)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,T=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},w=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},y=function(l){Object(M.a)(v,l);var a=S(v);function v(g){var m;Object(D.a)(this,v),m=a.call(this,g),m.onKeyDown=function(W){var X=m.props,B=X.onKeyDown,F=X.onPressEnter;if(W.keyCode===L.a.UP){var z=m.getRatio(W);m.up(W,z,null),m.stop()}else if(W.keyCode===L.a.DOWN){var Q=m.getRatio(W);m.down(W,Q,null),m.stop()}else W.keyCode===L.a.ENTER&&F&&F(W);if(m.recordCursorPosition(),m.lastKeyCode=W.keyCode,B){for(var ie=arguments.length,ce=new Array(ie>1?ie-1:0),Ce=1;Ce<ie;Ce++)ce[Ce-1]=arguments[Ce];B.apply(void 0,[W].concat(ce))}},m.onKeyUp=function(W){var X=m.props.onKeyUp;if(m.stop(),m.recordCursorPosition(),X){for(var B=arguments.length,F=new Array(B>1?B-1:0),z=1;z<B;z++)F[z-1]=arguments[z];X.apply(void 0,[W].concat(F))}},m.onChange=function(W){var X=m.props.onChange;m.state.focused&&(m.inputting=!0),m.rawInput=m.props.parser(m.getValueFromEvent(W)),m.setState({inputValue:m.rawInput}),X(m.toNumber(m.rawInput))},m.onMouseUp=function(){var W=m.props.onMouseUp;m.recordCursorPosition(),W&&W.apply(void 0,arguments)},m.onFocus=function(){var W;m.setState({focused:!0}),(W=m.props).onFocus.apply(W,arguments)},m.onBlur=function(){var W=m.props.onBlur;m.inputting=!1,m.setState({focused:!1});var X=m.getCurrentValidValue(m.state.inputValue),B=m.setValue(X,d);if(W){var F=m.input.value,z=m.getInputDisplayValue({focus:!1,value:B});m.input.value=z&&Number(z),W.apply(void 0,arguments),m.input.value=F}},m.getRatio=function(W){var X=1;return W.metaKey||W.ctrlKey?X=.1:W.shiftKey&&(X=10),X},m.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},m.getPrecision=function(W){if(p(m.props.precision))return m.props.precision;var X=String(W);if(X.indexOf("e-")>=0)return parseInt(X.slice(X.indexOf("e-")+2),10);var B=0;return X.indexOf(".")>=0&&(B=X.length-X.indexOf(".")-1),B},m.getInputDisplayValue=function(W){var X=W||m.state,B=X.focused,F=X.inputValue,z=X.value,Q;B?Q=F:Q=m.toPrecisionAsStep(z),Q==null&&(Q="");var ie=m.formatWrapper(Q);return p(m.props.decimalSeparator)&&(ie=ie.toString().replace(".",m.props.decimalSeparator)),ie},m.recordCursorPosition=function(){try{m.cursorStart=m.input.selectionStart,m.cursorEnd=m.input.selectionEnd,m.currentValue=m.input.value,m.cursorBefore=m.input.value.substring(0,m.cursorStart),m.cursorAfter=m.input.value.substring(m.cursorEnd)}catch(W){}},m.restoreByAfter=function(W){if(W===void 0)return!1;var X=m.input.value,B=X.lastIndexOf(W);if(B===-1)return!1;var F=m.cursorBefore.length;return m.lastKeyCode===L.a.DELETE&&m.cursorBefore.charAt(F-1)===W[0]?(m.fixCaret(F,F),!0):B+W.length===X.length?(m.fixCaret(B,B),!0):!1},m.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(X,B){var F=W.substring(B);return m.restoreByAfter(F)})},m.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},m.stop=function(){m.autoStepTimer&&clearTimeout(m.autoStepTimer)},m.down=function(W,X,B){m.pressingUpOrDown=!0,m.step("down",W,X,B)},m.up=function(W,X,B){m.pressingUpOrDown=!0,m.step("up",W,X,B)},m.saveInput=function(W){m.input=W};var R=g.value;R===void 0&&(R=g.defaultValue),m.state={focused:g.autoFocus};var U=m.getValidValue(m.toNumber(R));return m.state=C(C({},m.state),{},{inputValue:m.toPrecisionAsStep(U),value:U}),m}return Object(K.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(m){var R=this.props,U=R.value,W=R.onChange,X=R.max,B=R.min,F=this.state.focused;if(m){if(!w(m.value,U)||!w(m.max,X)||!w(m.min,B)){var z=F?U:this.getValidValue(U),Q;this.pressingUpOrDown?Q=z:this.inputting?Q=this.rawInput:Q=this.toPrecisionAsStep(z),this.setState({value:z,inputValue:Q})}var ie="value"in this.props?U:this.state.value;"max"in this.props&&m.max!==X&&typeof ie=="number"&&ie>X&&W&&W(X),"min"in this.props&&m.min!==B&&typeof ie=="number"&&ie<B&&W&&W(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ce=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===L.a.BACKSPACE?ce=this.cursorStart-1:this.lastKeyCode===L.a.DELETE&&(ce=this.cursorStart):ce=this.input.value.length,this.fixCaret(ce,ce)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case L.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case L.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ce){}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(m){var R=m;return R===""?R="":this.isNotCompleteNumber(parseFloat(R))?R=this.state.value:R=this.getValidValue(R),this.toNumber(R)}},{key:"getValueFromEvent",value:function(m){var R=m.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(R=R.replace(this.props.decimalSeparator,".")),R}},{key:"getValidValue",value:function(m){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(m);return isNaN(W)?m:(W<R&&(W=R),W>U&&(W=U),W)}},{key:"setValue",value:function(m,R){var U=this.props.precision,W=this.isNotCompleteNumber(parseFloat(m))?null:parseFloat(m),X=this.state.value,B=X===void 0?null:X,F=this.state.inputValue,z=F===void 0?null:F,Q=typeof W=="number"?W.toFixed(U):"".concat(W),ie=W!==B||Q!=="".concat(z);return"value"in this.props?(z=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:z},R)):this.setState({value:W,inputValue:this.toPrecisionAsStep(m)},R),ie&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(m){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,W=U.precision,X=U.step;if(p(W))return W;var B=this.getPrecision(R),F=this.getPrecision(X),z=this.getPrecision(m);return m?Math.max(z,B+F):B+F}},{key:"getPrecisionFactor",value:function(m){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(m,R);return Math.pow(10,U)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(m){return this.props.formatter?this.props.formatter(m):m}},{key:"toPrecisionAsStep",value:function(m){if(this.isNotCompleteNumber(m)||m==="")return m;var R=Math.abs(this.getMaxPrecision(m));return isNaN(R)?m.toString():Number(m).toFixed(R)}},{key:"toNumber",value:function(m){var R=this.props.precision,U=this.state.focused,W=m&&m.length>16&&U;return this.isNotCompleteNumber(m)||W?m:p(R)?Math.round(m*Math.pow(10,R))/Math.pow(10,R):Number(m)}},{key:"upStep",value:function(m,R){var U=this.props.step,W=this.getPrecisionFactor(m,R),X=Math.abs(this.getMaxPrecision(m,R)),B=((W*m+W*U*R)/W).toFixed(X);return this.toNumber(B)}},{key:"downStep",value:function(m,R){var U=this.props.step,W=this.getPrecisionFactor(m,R),X=Math.abs(this.getMaxPrecision(m,R)),B=((W*m-W*U*R)/W).toFixed(X);return this.toNumber(B)}},{key:"step",value:function(m,R){var U=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,X=arguments.length>3?arguments[3]:void 0;this.stop(),R&&(R.persist(),R.preventDefault());var B=this.props;if(B.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var z=this["".concat(m,"Step")](F,W),Q=z>B.max||z<B.min;if(z>B.max?z=B.max:z<B.min&&(z=B.min),this.setValue(z,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),Q)return;this.autoStepTimer=setTimeout(function(){U[m](R,W,!0)},X?u:T)}},{key:"fixCaret",value:function(m,R){if(m===void 0||R===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,W=this.input.selectionEnd;(m!==U||R!==W)&&this.input.setSelectionRange(m,R)}catch(X){}}},{key:"render",value:function(){var m,R=this.props,U=R.prefixCls,W=R.disabled,X=R.readOnly,B=R.useTouch,F=R.autoComplete,z=R.upHandler,Q=R.downHandler,ie=R.className,ce=R.max,Ce=R.min,pe=R.style,Te=R.title,se=R.onMouseEnter,de=R.onMouseLeave,q=R.onMouseOver,oe=R.onMouseOut,ye=R.required,fe=R.onClick,Le=R.tabIndex,ve=R.type,De=R.placeholder,be=R.id,we=R.inputMode,Re=R.pattern,Fe=R.step,Pe=R.maxLength,Ae=R.autoFocus,Se=R.name,We=R.onPaste,Ge=R.onInput,Xe=Object(Z.a)(R,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),je=this.state,qe=je.value,Ue=je.focused,Ke=x()(U,(m={},Object(G.a)(m,ie,!!ie),Object(G.a)(m,"".concat(U,"-disabled"),W),Object(G.a)(m,"".concat(U,"-focused"),Ue),m)),xe={};Object.keys(Xe).forEach(function(ee){(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(xe[ee]=Xe[ee])});var $e=!X&&!W,Ye=this.getInputDisplayValue(null),_e=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=ce),Ie=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=Ce),ne=_e||W||X,ae=Ie||W||X,le=x()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(G.a)({},"".concat(U,"-handler-up-disabled"),ne)),Y=x()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(G.a)({},"".concat(U,"-handler-down-disabled"),ae)),$=B?{onTouchStart:ne?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ne?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=B?{onTouchStart:ae?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return A.a.createElement("div",{className:Ke,style:pe,title:Te,onMouseEnter:se,onMouseLeave:de,onMouseOver:q,onMouseOut:oe,onFocus:function(){return null},onBlur:function(){return null}},A.a.createElement("div",{className:"".concat(U,"-handler-wrap")},A.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":ne,className:le}),z||A.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),A.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:Y}),Q||A.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),A.a.createElement("div",{className:"".concat(U,"-input-wrap")},A.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":ce,"aria-valuenow":qe,required:ye,type:ve,placeholder:De,onPaste:We,onClick:fe,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Le,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:$e?this.onKeyDown:d,onKeyUp:$e?this.onKeyUp:d,autoFocus:Ae,maxLength:Pe,readOnly:X,disabled:W,max:ce,min:Ce,step:Fe,name:Se,title:Te,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:Re,inputMode:we,onInput:Ge},xe))))}}]),v}(A.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var h=y,c=Ze.a=h},gJ3r:function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return Z});var Z=[{value:"\u5317\u4EAC",label:"\u5317\u4EAC",children:[{value:"\u4E1C\u57CE",label:"\u4E1C\u57CE"},{value:"\u897F\u57CE",label:"\u897F\u57CE"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u4E30\u53F0",label:"\u4E30\u53F0"},{value:"\u77F3\u666F\u5C71",label:"\u77F3\u666F\u5C71"},{value:"\u6D77\u6DC0",label:"\u6D77\u6DC0"},{value:"\u95E8\u5934\u6C9F",label:"\u95E8\u5934\u6C9F"},{value:"\u623F\u5C71",label:"\u623F\u5C71"},{value:"\u901A\u5DDE",label:"\u901A\u5DDE"},{value:"\u987A\u4E49",label:"\u987A\u4E49"},{value:"\u660C\u5E73",label:"\u660C\u5E73"},{value:"\u5927\u5174",label:"\u5927\u5174"},{value:"\u5E73\u8C37",label:"\u5E73\u8C37"},{value:"\u6000\u67D4",label:"\u6000\u67D4"},{value:"\u5BC6\u4E91",label:"\u5BC6\u4E91"},{value:"\u5EF6\u5E86",label:"\u5EF6\u5E86"}]},{value:"\u4E0A\u6D77",label:"\u4E0A\u6D77",children:[{value:"\u5D07\u660E",label:"\u5D07\u660E"},{value:"\u9EC4\u6D66",label:"\u9EC4\u6D66"},{value:"\u5362\u6E7E",label:"\u5362\u6E7E"},{value:"\u5F90\u6C47",label:"\u5F90\u6C47"},{value:"\u957F\u5B81",label:"\u957F\u5B81"},{value:"\u9759\u5B89",label:"\u9759\u5B89"},{value:"\u666E\u9640",label:"\u666E\u9640"},{value:"\u95F8\u5317",label:"\u95F8\u5317"},{value:"\u8679\u53E3",label:"\u8679\u53E3"},{value:"\u6768\u6D66",label:"\u6768\u6D66"},{value:"\u95F5\u884C",label:"\u95F5\u884C"},{value:"\u5B9D\u5C71",label:"\u5B9D\u5C71"},{value:"\u5609\u5B9A",label:"\u5609\u5B9A"},{value:"\u6D66\u4E1C",label:"\u6D66\u4E1C"},{value:"\u91D1\u5C71",label:"\u91D1\u5C71"},{value:"\u677E\u6C5F",label:"\u677E\u6C5F"},{value:"\u9752\u6D66",label:"\u9752\u6D66"},{value:"\u5357\u6C47",label:"\u5357\u6C47"},{value:"\u5949\u8D24",label:"\u5949\u8D24"}]},{value:"\u5E7F\u4E1C",label:"\u5E7F\u4E1C",children:[{value:"\u5E7F\u5DDE",label:"\u5E7F\u5DDE"},{value:"\u6DF1\u5733",label:"\u6DF1\u5733"},{value:"\u73E0\u6D77",label:"\u73E0\u6D77"},{value:"\u4E1C\u839E",label:"\u4E1C\u839E"},{value:"\u4E2D\u5C71",label:"\u4E2D\u5C71"},{value:"\u4F5B\u5C71",label:"\u4F5B\u5C71"},{value:"\u60E0\u5DDE",label:"\u60E0\u5DDE"},{value:"\u6CB3\u6E90",label:"\u6CB3\u6E90"},{value:"\u6F6E\u5DDE",label:"\u6F6E\u5DDE"},{value:"\u6C5F\u95E8",label:"\u6C5F\u95E8"},{value:"\u63ED\u9633",label:"\u63ED\u9633"},{value:"\u8302\u540D",label:"\u8302\u540D"},{value:"\u6885\u5DDE",label:"\u6885\u5DDE"},{value:"\u6E05\u8FDC",label:"\u6E05\u8FDC"},{value:"\u6C55\u5934",label:"\u6C55\u5934"},{value:"\u6C55\u5C3E",label:"\u6C55\u5C3E"},{value:"\u97F6\u5173",label:"\u97F6\u5173"},{value:"\u987A\u5FB7",label:"\u987A\u5FB7"},{value:"\u9633\u6C5F",label:"\u9633\u6C5F"},{value:"\u4E91\u6D6E",label:"\u4E91\u6D6E"},{value:"\u6E5B\u6C5F",label:"\u6E5B\u6C5F"},{value:"\u8087\u5E86",label:"\u8087\u5E86"}]},{value:"\u6C5F\u82CF",label:"\u6C5F\u82CF",children:[{value:"\u5357\u4EAC",label:"\u5357\u4EAC"},{value:"\u5E38\u719F",label:"\u5E38\u719F"},{value:"\u5E38\u5DDE",label:"\u5E38\u5DDE"},{value:"\u6D77\u95E8",label:"\u6D77\u95E8"},{value:"\u6DEE\u5B89",label:"\u6DEE\u5B89"},{value:"\u6C5F\u90FD",label:"\u6C5F\u90FD"},{value:"\u6C5F\u9634",label:"\u6C5F\u9634"},{value:"\u6606\u5C71",label:"\u6606\u5C71"},{value:"\u8FDE\u4E91\u6E2F",label:"\u8FDE\u4E91\u6E2F"},{value:"\u5357\u901A",label:"\u5357\u901A"},{value:"\u542F\u4E1C",label:"\u542F\u4E1C"},{value:"\u6CAD\u9633",label:"\u6CAD\u9633"},{value:"\u5BBF\u8FC1",label:"\u5BBF\u8FC1"},{value:"\u82CF\u5DDE",label:"\u82CF\u5DDE"},{value:"\u592A\u4ED3",label:"\u592A\u4ED3"},{value:"\u6CF0\u5DDE",label:"\u6CF0\u5DDE"},{value:"\u540C\u91CC",label:"\u540C\u91CC"},{value:"\u65E0\u9521",label:"\u65E0\u9521"},{value:"\u5F90\u5DDE",label:"\u5F90\u5DDE"},{value:"\u76D0\u57CE",label:"\u76D0\u57CE"},{value:"\u626C\u5DDE",label:"\u626C\u5DDE"},{value:"\u5B9C\u5174",label:"\u5B9C\u5174"},{value:"\u4EEA\u5F81",label:"\u4EEA\u5F81"},{value:"\u5F20\u5BB6\u6E2F",label:"\u5F20\u5BB6\u6E2F"},{value:"\u9547\u6C5F",label:"\u9547\u6C5F"}]},{value:"\u91CD\u5E86",label:"\u91CD\u5E86",children:[{value:"\u4E07\u5DDE",label:"\u4E07\u5DDE"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u6E1D\u4E2D",label:"\u6E1D\u4E2D"},{value:"\u5927\u6E21\u53E3",label:"\u5927\u6E21\u53E3"},{value:"\u6C5F\u5317",label:"\u6C5F\u5317"},{value:"\u6C99\u576A\u575D",label:"\u6C99\u576A\u575D"},{value:"\u4E5D\u9F99\u5761",label:"\u4E5D\u9F99\u5761"},{value:"\u5357\u5CB8",label:"\u5357\u5CB8"},{value:"\u5317\u789A",label:"\u5317\u789A"},{value:"\u4E07\u76DB",label:"\u4E07\u76DB"},{value:"\u53CC\u6322",label:"\u53CC\u6322"},{value:"\u6E1D\u5317",label:"\u6E1D\u5317"},{value:"\u5DF4\u5357",label:"\u5DF4\u5357"},{value:"\u9ED4\u6C5F",label:"\u9ED4\u6C5F"},{value:"\u957F\u5BFF",label:"\u957F\u5BFF"},{value:"\u7DA6\u6C5F",label:"\u7DA6\u6C5F"},{value:"\u6F7C\u5357",label:"\u6F7C\u5357"},{value:"\u94DC\u6881",label:"\u94DC\u6881"},{value:"\u5927\u8DB3",label:"\u5927\u8DB3"},{value:"\u8363\u660C",label:"\u8363\u660C"},{value:"\u58C1\u5C71",label:"\u58C1\u5C71"},{value:"\u6881\u5E73",label:"\u6881\u5E73"},{value:"\u57CE\u53E3",label:"\u57CE\u53E3"},{value:"\u4E30\u90FD",label:"\u4E30\u90FD"},{value:"\u57AB\u6C5F",label:"\u57AB\u6C5F"},{value:"\u6B66\u9686",label:"\u6B66\u9686"},{value:"\u5FE0\u53BF",label:"\u5FE0\u53BF"},{value:"\u5F00\u53BF",label:"\u5F00\u53BF"},{value:"\u4E91\u9633",label:"\u4E91\u9633"},{value:"\u5949\u8282",label:"\u5949\u8282"},{value:"\u5DEB\u5C71",label:"\u5DEB\u5C71"},{value:"\u5DEB\u6EAA",label:"\u5DEB\u6EAA"},{value:"\u77F3\u67F1",label:"\u77F3\u67F1"},{value:"\u79C0\u5C71",label:"\u79C0\u5C71"},{value:"\u9149\u9633",label:"\u9149\u9633"},{value:"\u5F6D\u6C34",label:"\u5F6D\u6C34"},{value:"\u6C5F\u6D25",label:"\u6C5F\u6D25"},{value:"\u5408\u5DDD",label:"\u5408\u5DDD"},{value:"\u6C38\u5DDD",label:"\u6C38\u5DDD"},{value:"\u5357\u5DDD",label:"\u5357\u5DDD"}]},{value:"\u5B89\u5FBD",label:"\u5B89\u5FBD",children:[{value:"\u5408\u80A5",label:"\u5408\u80A5"},{value:"\u5B89\u5E86",label:"\u5B89\u5E86"},{value:"\u868C\u57E0",label:"\u868C\u57E0"},{value:"\u4EB3\u5DDE",label:"\u4EB3\u5DDE"},{value:"\u5DE2\u6E56",label:"\u5DE2\u6E56"},{value:"\u6EC1\u5DDE",label:"\u6EC1\u5DDE"},{value:"\u961C\u9633",label:"\u961C\u9633"},{value:"\u8D35\u6C60",label:"\u8D35\u6C60"},{value:"\u6DEE\u5317",label:"\u6DEE\u5317"},{value:"\u6DEE\u5316",label:"\u6DEE\u5316"},{value:"\u6DEE\u5357",label:"\u6DEE\u5357"},{value:"\u9EC4\u5C71",label:"\u9EC4\u5C71"},{value:"\u4E5D\u534E\u5C71",label:"\u4E5D\u534E\u5C71"},{value:"\u516D\u5B89",label:"\u516D\u5B89"},{value:"\u9A6C\u978D\u5C71",label:"\u9A6C\u978D\u5C71"},{value:"\u5BBF\u5DDE",label:"\u5BBF\u5DDE"},{value:"\u94DC\u9675",label:"\u94DC\u9675"},{value:"\u5C6F\u6EAA",label:"\u5C6F\u6EAA"},{value:"\u829C\u6E56",label:"\u829C\u6E56"},{value:"\u5BA3\u57CE",label:"\u5BA3\u57CE"}]},{value:"\u798F\u5EFA",label:"\u798F\u5EFA",children:[{value:"\u798F\u5DDE",label:"\u798F\u5DDE"},{value:"\u53A6\u95E8",label:"\u53A6\u95E8"},{value:"\u6CC9\u5DDE",label:"\u6CC9\u5DDE"},{value:"\u6F33\u5DDE",label:"\u6F33\u5DDE"},{value:"\u9F99\u5CA9",label:"\u9F99\u5CA9"},{value:"\u5357\u5E73",label:"\u5357\u5E73"},{value:"\u5B81\u5FB7",label:"\u5B81\u5FB7"},{value:"\u8386\u7530",label:"\u8386\u7530"},{value:"\u4E09\u660E",label:"\u4E09\u660E"}]},{value:"\u7518\u8083",label:"\u7518\u8083",children:[{value:"\u5170\u5DDE",label:"\u5170\u5DDE"},{value:"\u5609\u5CEA\u5173",label:"\u5609\u5CEA\u5173"},{value:"\u767D\u94F6",label:"\u767D\u94F6"},{value:"\u5B9A\u897F",label:"\u5B9A\u897F"},{value:"\u6566\u714C",label:"\u6566\u714C"},{value:"\u7518\u5357",label:"\u7518\u5357"},{value:"\u91D1\u660C",label:"\u91D1\u660C"},{value:"\u9152\u6CC9",label:"\u9152\u6CC9"},{value:"\u4E34\u590F",label:"\u4E34\u590F"},{value:"\u5E73\u51C9",label:"\u5E73\u51C9"},{value:"\u5929\u6C34",label:"\u5929\u6C34"},{value:"\u9647\u5357",label:"\u9647\u5357"},{value:"\u6B66\u5A01",label:"\u6B66\u5A01"},{value:"\u897F\u5CF0",label:"\u897F\u5CF0"},{value:"\u5F20\u6396",label:"\u5F20\u6396"}]},{value:"\u5E7F\u897F",label:"\u5E7F\u897F",children:[{value:"\u5357\u5B81",label:"\u5357\u5B81"},{value:"\u6765\u5BBE",label:"\u6765\u5BBE"},{value:"\u767E\u8272",label:"\u767E\u8272"},{value:"\u5317\u6D77",label:"\u5317\u6D77"},{value:"\u6842\u6797",label:"\u6842\u6797"},{value:"\u9632\u57CE\u6E2F",label:"\u9632\u57CE\u6E2F"},{value:"\u8D35\u6E2F",label:"\u8D35\u6E2F"},{value:"\u6CB3\u6C60",label:"\u6CB3\u6C60"},{value:"\u8D3A\u5DDE",label:"\u8D3A\u5DDE"},{value:"\u67F3\u5DDE",label:"\u67F3\u5DDE"},{value:"\u94A6\u5DDE",label:"\u94A6\u5DDE"},{value:"\u68A7\u5DDE",label:"\u68A7\u5DDE"},{value:"\u7389\u6797",label:"\u7389\u6797"}]},{value:"\u8D35\u5DDE",label:"\u8D35\u5DDE",children:[{value:"\u8D35\u9633",label:"\u8D35\u9633"},{value:"\u5B89\u987A",label:"\u5B89\u987A"},{value:"\u6BD5\u8282",label:"\u6BD5\u8282"},{value:"\u90FD\u5300",label:"\u90FD\u5300"},{value:"\u51EF\u91CC",label:"\u51EF\u91CC"},{value:"\u516D\u76D8\u6C34",label:"\u516D\u76D8\u6C34"},{value:"\u94DC\u4EC1",label:"\u94DC\u4EC1"},{value:"\u5174\u4E49",label:"\u5174\u4E49"},{value:"\u7389\u5C4F",label:"\u7389\u5C4F"},{value:"\u9075\u4E49",label:"\u9075\u4E49"}]},{value:"\u6D77\u5357",label:"\u6D77\u5357",children:[{value:"\u6D77\u53E3",label:"\u6D77\u53E3"},{value:"\u510B\u53BF",label:"\u510B\u53BF"},{value:"\u9675\u6C34",label:"\u9675\u6C34"},{value:"\u743C\u6D77",label:"\u743C\u6D77"},{value:"\u4E09\u4E9A",label:"\u4E09\u4E9A"},{value:"\u901A\u4EC0",label:"\u901A\u4EC0"},{value:"\u4E07\u5B81",label:"\u4E07\u5B81"}]},{value:"\u6CB3\u5317",label:"\u6CB3\u5317",children:[{value:"\u77F3\u5BB6\u5E84",label:"\u77F3\u5BB6\u5E84"},{value:"\u4FDD\u5B9A",label:"\u4FDD\u5B9A"},{value:"\u5317\u6234\u6CB3",label:"\u5317\u6234\u6CB3"},{value:"\u6CA7\u5DDE",label:"\u6CA7\u5DDE"},{value:"\u627F\u5FB7",label:"\u627F\u5FB7"},{value:"\u4E30\u6DA6",label:"\u4E30\u6DA6"},{value:"\u90AF\u90F8",label:"\u90AF\u90F8"},{value:"\u8861\u6C34",label:"\u8861\u6C34"},{value:"\u5ECA\u574A",label:"\u5ECA\u574A"},{value:"\u5357\u6234\u6CB3",label:"\u5357\u6234\u6CB3"},{value:"\u79E6\u7687\u5C9B",label:"\u79E6\u7687\u5C9B"},{value:"\u5510\u5C71",label:"\u5510\u5C71"},{value:"\u65B0\u57CE",label:"\u65B0\u57CE"},{value:"\u90A2\u53F0",label:"\u90A2\u53F0"},{value:"\u5F20\u5BB6\u53E3",label:"\u5F20\u5BB6\u53E3"}]},{value:"\u9ED1\u9F99\u6C5F",label:"\u9ED1\u9F99\u6C5F",children:[{value:"\u54C8\u5C14\u6EE8",label:"\u54C8\u5C14\u6EE8"},{value:"\u5317\u5B89",label:"\u5317\u5B89"},{value:"\u5927\u5E86",label:"\u5927\u5E86"},{value:"\u5927\u5174\u5B89\u5CAD",label:"\u5927\u5174\u5B89\u5CAD"},{value:"\u9E64\u5C97",label:"\u9E64\u5C97"},{value:"\u9ED1\u6CB3",label:"\u9ED1\u6CB3"},{value:"\u4F73\u6728\u65AF",label:"\u4F73\u6728\u65AF"},{value:"\u9E21\u897F",label:"\u9E21\u897F"},{value:"\u7261\u4E39\u6C5F",label:"\u7261\u4E39\u6C5F"},{value:"\u9F50\u9F50\u54C8\u5C14",label:"\u9F50\u9F50\u54C8\u5C14"},{value:"\u4E03\u53F0\u6CB3",label:"\u4E03\u53F0\u6CB3"},{value:"\u53CC\u9E2D\u5C71",label:"\u53CC\u9E2D\u5C71"},{value:"\u7EE5\u5316",label:"\u7EE5\u5316"},{value:"\u4F0A\u6625",label:"\u4F0A\u6625"}]},{value:"\u6CB3\u5357",label:"\u6CB3\u5357",children:[{value:"\u90D1\u5DDE",label:"\u90D1\u5DDE"},{value:"\u5B89\u9633",label:"\u5B89\u9633"},{value:"\u9E64\u58C1",label:"\u9E64\u58C1"},{value:"\u6F62\u5DDD",label:"\u6F62\u5DDD"},{value:"\u7126\u4F5C",label:"\u7126\u4F5C"},{value:"\u6D4E\u6E90",label:"\u6D4E\u6E90"},{value:"\u5F00\u5C01",label:"\u5F00\u5C01"},{value:"\u6F2F\u6CB3",label:"\u6F2F\u6CB3"},{value:"\u6D1B\u9633",label:"\u6D1B\u9633"},{value:"\u5357\u9633",label:"\u5357\u9633"},{value:"\u5E73\u9876\u5C71",label:"\u5E73\u9876\u5C71"},{value:"\u6FEE\u9633",label:"\u6FEE\u9633"},{value:"\u4E09\u95E8\u5CE1",label:"\u4E09\u95E8\u5CE1"},{value:"\u5546\u4E18",label:"\u5546\u4E18"},{value:"\u65B0\u4E61",label:"\u65B0\u4E61"},{value:"\u4FE1\u9633",label:"\u4FE1\u9633"},{value:"\u8BB8\u660C",label:"\u8BB8\u660C"},{value:"\u5468\u53E3",label:"\u5468\u53E3"},{value:"\u9A7B\u9A6C\u5E97",label:"\u9A7B\u9A6C\u5E97"}]},{value:"\u9999\u6E2F",label:"\u9999\u6E2F",children:[{value:"\u9999\u6E2F",label:"\u9999\u6E2F"},{value:"\u4E5D\u9F99",label:"\u4E5D\u9F99"},{value:"\u65B0\u754C",label:"\u65B0\u754C"}]},{value:"\u6E56\u5317",label:"\u6E56\u5317",children:[{value:"\u6B66\u6C49",label:"\u6B66\u6C49"},{value:"\u5929\u95E8",label:"\u5929\u95E8"},{value:"\u6069\u65BD",label:"\u6069\u65BD"},{value:"\u9102\u5DDE",label:"\u9102\u5DDE"},{value:"\u9EC4\u5188",label:"\u9EC4\u5188"},{value:"\u9EC4\u77F3",label:"\u9EC4\u77F3"},{value:"\u8346\u95E8",label:"\u8346\u95E8"},{value:"\u8346\u5DDE",label:"\u8346\u5DDE"},{value:"\u6F5C\u6C5F",label:"\u6F5C\u6C5F"},{value:"\u5341\u5830",label:"\u5341\u5830"},{value:"\u968F\u5DDE",label:"\u968F\u5DDE"},{value:"\u6B66\u7A74",label:"\u6B66\u7A74"},{value:"\u4ED9\u6843",label:"\u4ED9\u6843"},{value:"\u54B8\u5B81",label:"\u54B8\u5B81"},{value:"\u8944\u9633",label:"\u8944\u9633"},{value:"\u8944\u6A0A",label:"\u8944\u6A0A"},{value:"\u5B5D\u611F",label:"\u5B5D\u611F"},{value:"\u5B9C\u660C",label:"\u5B9C\u660C"}]},{value:"\u6E56\u5357",label:"\u6E56\u5357",children:[{value:"\u957F\u6C99",label:"\u957F\u6C99"},{value:"\u5E38\u5FB7",label:"\u5E38\u5FB7"},{value:"\u90F4\u5DDE",label:"\u90F4\u5DDE"},{value:"\u8861\u9633",label:"\u8861\u9633"},{value:"\u6000\u5316",label:"\u6000\u5316"},{value:"\u5409\u9996",label:"\u5409\u9996"},{value:"\u5A04\u5E95",label:"\u5A04\u5E95"},{value:"\u90B5\u9633",label:"\u90B5\u9633"},{value:"\u6E58\u6F6D",label:"\u6E58\u6F6D"},{value:"\u76CA\u9633",label:"\u76CA\u9633"},{value:"\u5CB3\u9633",label:"\u5CB3\u9633"},{value:"\u6C38\u5DDE",label:"\u6C38\u5DDE"},{value:"\u5F20\u5BB6\u754C",label:"\u5F20\u5BB6\u754C"},{value:"\u682A\u6D32",label:"\u682A\u6D32"}]},{value:"\u6C5F\u897F",label:"\u6C5F\u897F",children:[{value:"\u5357\u660C",label:"\u5357\u660C"},{value:"\u629A\u5DDE",label:"\u629A\u5DDE"},{value:"\u8D63\u5DDE",label:"\u8D63\u5DDE"},{value:"\u5409\u5B89",label:"\u5409\u5B89"},{value:"\u666F\u5FB7\u9547",label:"\u666F\u5FB7\u9547"},{value:"\u4E95\u5188\u5C71",label:"\u4E95\u5188\u5C71"},{value:"\u4E5D\u6C5F",label:"\u4E5D\u6C5F"},{value:"\u5E90\u5C71",label:"\u5E90\u5C71"},{value:"\u840D\u4E61",label:"\u840D\u4E61"},{value:"\u4E0A\u9976",label:"\u4E0A\u9976"},{value:"\u65B0\u4F59",label:"\u65B0\u4F59"},{value:"\u5B9C\u6625",label:"\u5B9C\u6625"},{value:"\u9E70\u6F6D",label:"\u9E70\u6F6D"}]},{value:"\u5409\u6797",label:"\u5409\u6797",children:[{value:"\u957F\u6625",label:"\u957F\u6625"},{value:"\u5409\u6797",label:"\u5409\u6797"},{value:"\u767D\u57CE",label:"\u767D\u57CE"},{value:"\u767D\u5C71",label:"\u767D\u5C71"},{value:"\u73F2\u6625",label:"\u73F2\u6625"},{value:"\u8FBD\u6E90",label:"\u8FBD\u6E90"},{value:"\u6885\u6CB3",label:"\u6885\u6CB3"},{value:"\u56DB\u5E73",label:"\u56DB\u5E73"},{value:"\u677E\u539F",label:"\u677E\u539F"},{value:"\u901A\u5316",label:"\u901A\u5316"},{value:"\u5EF6\u5409",label:"\u5EF6\u5409"}]},{value:"\u8FBD\u5B81",label:"\u8FBD\u5B81",children:[{value:"\u6C88\u9633",label:"\u6C88\u9633"},{value:"\u978D\u5C71",label:"\u978D\u5C71"},{value:"\u672C\u6EAA",label:"\u672C\u6EAA"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u5927\u8FDE",label:"\u5927\u8FDE"},{value:"\u4E39\u4E1C",label:"\u4E39\u4E1C"},{value:"\u629A\u987A",label:"\u629A\u987A"},{value:"\u961C\u65B0",label:"\u961C\u65B0"},{value:"\u846B\u82A6\u5C9B",label:"\u846B\u82A6\u5C9B"},{value:"\u9526\u5DDE",label:"\u9526\u5DDE"},{value:"\u8FBD\u9633",label:"\u8FBD\u9633"},{value:"\u76D8\u9526",label:"\u76D8\u9526"},{value:"\u94C1\u5CAD",label:"\u94C1\u5CAD"},{value:"\u8425\u53E3",label:"\u8425\u53E3"}]},{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8",children:[{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8"}]},{value:"\u5185\u8499\u53E4",label:"\u5185\u8499\u53E4",children:[{value:"\u547C\u548C\u6D69\u7279",label:"\u547C\u548C\u6D69\u7279"},{value:"\u963F\u62C9\u5584\u76DF",label:"\u963F\u62C9\u5584\u76DF"},{value:"\u5305\u5934",label:"\u5305\u5934"},{value:"\u8D64\u5CF0",label:"\u8D64\u5CF0"},{value:"\u4E1C\u80DC",label:"\u4E1C\u80DC"},{value:"\u6D77\u62C9\u5C14",label:"\u6D77\u62C9\u5C14"},{value:"\u96C6\u5B81",label:"\u96C6\u5B81"},{value:"\u4E34\u6CB3",label:"\u4E34\u6CB3"},{value:"\u901A\u8FBD",label:"\u901A\u8FBD"},{value:"\u4E4C\u6D77",label:"\u4E4C\u6D77"},{value:"\u4E4C\u5170\u6D69\u7279",label:"\u4E4C\u5170\u6D69\u7279"},{value:"\u9521\u6797\u6D69\u7279",label:"\u9521\u6797\u6D69\u7279"}]},{value:"\u5B81\u590F",label:"\u5B81\u590F",children:[{value:"\u94F6\u5DDD",label:"\u94F6\u5DDD"},{value:"\u56FA\u6E90",label:"\u56FA\u6E90"},{value:"\u77F3\u5634\u5C71",label:"\u77F3\u5634\u5C71"},{value:"\u5434\u5FE0",label:"\u5434\u5FE0"}]},{value:"\u9752\u6D77",label:"\u9752\u6D77",children:[{value:"\u897F\u5B81",label:"\u897F\u5B81"},{value:"\u5FB7\u4EE4\u54C8",label:"\u5FB7\u4EE4\u54C8"},{value:"\u683C\u5C14\u6728",label:"\u683C\u5C14\u6728"},{value:"\u5171\u548C",label:"\u5171\u548C"},{value:"\u6D77\u4E1C",label:"\u6D77\u4E1C"},{value:"\u6D77\u664F",label:"\u6D77\u664F"},{value:"\u739B\u6C81",label:"\u739B\u6C81"},{value:"\u540C\u4EC1",label:"\u540C\u4EC1"},{value:"\u7389\u6811",label:"\u7389\u6811"}]},{value:"\u5C71\u4E1C",label:"\u5C71\u4E1C",children:[{value:"\u6D4E\u5357",label:"\u6D4E\u5357"},{value:"\u6EE8\u5DDE",label:"\u6EE8\u5DDE"},{value:"\u5156\u5DDE",label:"\u5156\u5DDE"},{value:"\u5FB7\u5DDE",label:"\u5FB7\u5DDE"},{value:"\u4E1C\u8425",label:"\u4E1C\u8425"},{value:"\u83CF\u6CFD",label:"\u83CF\u6CFD"},{value:"\u6D4E\u5B81",label:"\u6D4E\u5B81"},{value:"\u83B1\u829C",label:"\u83B1\u829C"},{value:"\u804A\u57CE",label:"\u804A\u57CE"},{value:"\u4E34\u6C82",label:"\u4E34\u6C82"},{value:"\u84EC\u83B1",label:"\u84EC\u83B1"},{value:"\u9752\u5C9B",label:"\u9752\u5C9B"},{value:"\u66F2\u961C",label:"\u66F2\u961C"},{value:"\u65E5\u7167",label:"\u65E5\u7167"},{value:"\u6CF0\u5B89",label:"\u6CF0\u5B89"},{value:"\u6F4D\u574A",label:"\u6F4D\u574A"},{value:"\u5A01\u6D77",label:"\u5A01\u6D77"},{value:"\u70DF\u53F0",label:"\u70DF\u53F0"},{value:"\u67A3\u5E84",label:"\u67A3\u5E84"},{value:"\u6DC4\u535A",label:"\u6DC4\u535A"}]},{value:"\u5C71\u897F",label:"\u5C71\u897F",children:[{value:"\u592A\u539F",label:"\u592A\u539F"},{value:"\u5415\u6881",label:"\u5415\u6881"},{value:"\u957F\u6CBB",label:"\u957F\u6CBB"},{value:"\u5927\u540C",label:"\u5927\u540C"},{value:"\u5019\u9A6C",label:"\u5019\u9A6C"},{value:"\u664B\u57CE",label:"\u664B\u57CE"},{value:"\u79BB\u77F3",label:"\u79BB\u77F3"},{value:"\u4E34\u6C7E",label:"\u4E34\u6C7E"},{value:"\u5B81\u6B66",label:"\u5B81\u6B66"},{value:"\u6714\u5DDE",label:"\u6714\u5DDE"},{value:"\u5FFB\u5DDE",label:"\u5FFB\u5DDE"},{value:"\u9633\u6CC9",label:"\u9633\u6CC9"},{value:"\u6986\u6B21",label:"\u6986\u6B21"},{value:"\u664B\u4E2D",label:"\u664B\u4E2D"},{value:"\u8FD0\u57CE",label:"\u8FD0\u57CE"}]},{value:"\u9655\u897F",label:"\u9655\u897F",children:[{value:"\u897F\u5B89",label:"\u897F\u5B89"},{value:"\u5B89\u5EB7",label:"\u5B89\u5EB7"},{value:"\u5B9D\u9E21",label:"\u5B9D\u9E21"},{value:"\u6C49\u4E2D",label:"\u6C49\u4E2D"},{value:"\u6E2D\u5357",label:"\u6E2D\u5357"},{value:"\u5546\u5DDE",label:"\u5546\u5DDE"},{value:"\u7EE5\u5FB7",label:"\u7EE5\u5FB7"},{value:"\u94DC\u5DDD",label:"\u94DC\u5DDD"},{value:"\u54B8\u9633",label:"\u54B8\u9633"},{value:"\u5EF6\u5B89",label:"\u5EF6\u5B89"},{value:"\u6986\u6797",label:"\u6986\u6797"}]},{value:"\u56DB\u5DDD",label:"\u56DB\u5DDD",children:[{value:"\u6210\u90FD",label:"\u6210\u90FD"},{value:"\u5DF4\u4E2D",label:"\u5DF4\u4E2D"},{value:"\u8FBE\u5DDD",label:"\u8FBE\u5DDD"},{value:"\u5FB7\u9633",label:"\u5FB7\u9633"},{value:"\u90FD\u6C5F\u5830",label:"\u90FD\u6C5F\u5830"},{value:"\u5CE8\u7709\u5C71",label:"\u5CE8\u7709\u5C71"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u5E7F\u5B89",label:"\u5E7F\u5B89"},{value:"\u5E7F\u5143",label:"\u5E7F\u5143"},{value:"\u4E5D\u5BE8\u6C9F",label:"\u4E5D\u5BE8\u6C9F"},{value:"\u5EB7\u5B9A",label:"\u5EB7\u5B9A"},{value:"\u4E50\u5C71",label:"\u4E50\u5C71"},{value:"\u6CF8\u5DDE",label:"\u6CF8\u5DDE"},{value:"\u9A6C\u5C14\u5EB7",label:"\u9A6C\u5C14\u5EB7"},{value:"\u7EF5\u9633",label:"\u7EF5\u9633"},{value:"\u7709\u5C71",label:"\u7709\u5C71"},{value:"\u5357\u5145",label:"\u5357\u5145"},{value:"\u5185\u6C5F",label:"\u5185\u6C5F"},{value:"\u6500\u679D\u82B1",label:"\u6500\u679D\u82B1"},{value:"\u9042\u5B81",label:"\u9042\u5B81"},{value:"\u6C76\u5DDD",label:"\u6C76\u5DDD"},{value:"\u897F\u660C",label:"\u897F\u660C"},{value:"\u96C5\u5B89",label:"\u96C5\u5B89"},{value:"\u5B9C\u5BBE",label:"\u5B9C\u5BBE"},{value:"\u81EA\u8D21",label:"\u81EA\u8D21"},{value:"\u8D44\u9633",label:"\u8D44\u9633"}]},{value:"\u53F0\u6E7E",label:"\u53F0\u6E7E",children:[{value:"\u53F0\u5317",label:"\u53F0\u5317"},{value:"\u57FA\u9686",label:"\u57FA\u9686"},{value:"\u53F0\u5357",label:"\u53F0\u5357"},{value:"\u53F0\u4E2D",label:"\u53F0\u4E2D"},{value:"\u9AD8\u96C4",label:"\u9AD8\u96C4"},{value:"\u5C4F\u4E1C",label:"\u5C4F\u4E1C"},{value:"\u5357\u6295",label:"\u5357\u6295"},{value:"\u4E91\u6797",label:"\u4E91\u6797"},{value:"\u65B0\u7AF9",label:"\u65B0\u7AF9"},{value:"\u5F70\u5316",label:"\u5F70\u5316"},{value:"\u82D7\u6817",label:"\u82D7\u6817"},{value:"\u5609\u4E49",label:"\u5609\u4E49"},{value:"\u6843\u56ED",label:"\u6843\u56ED"},{value:"\u5B9C\u5170",label:"\u5B9C\u5170"},{value:"\u53F0\u4E1C",label:"\u53F0\u4E1C"},{value:"\u91D1\u95E8",label:"\u91D1\u95E8"},{value:"\u9A6C\u7956",label:"\u9A6C\u7956"},{value:"\u6F8E\u6E56",label:"\u6F8E\u6E56"}]},{value:"\u5929\u6D25",label:"\u5929\u6D25",children:[{value:"\u5929\u6D25",label:"\u5929\u6D25"},{value:"\u548C\u5E73",label:"\u548C\u5E73"},{value:"\u4E1C\u4E3D",label:"\u4E1C\u4E3D"},{value:"\u6CB3\u4E1C",label:"\u6CB3\u4E1C"},{value:"\u897F\u9752",label:"\u897F\u9752"},{value:"\u6CB3\u897F",label:"\u6CB3\u897F"},{value:"\u6D25\u5357",label:"\u6D25\u5357"},{value:"\u5357\u5F00",label:"\u5357\u5F00"},{value:"\u5317\u8FB0",label:"\u5317\u8FB0"},{value:"\u6CB3\u5317",label:"\u6CB3\u5317"},{value:"\u6B66\u6E05",label:"\u6B66\u6E05"},{value:"\u7EA2\u6322",label:"\u7EA2\u6322"},{value:"\u5858\u6CBD",label:"\u5858\u6CBD"},{value:"\u6C49\u6CBD",label:"\u6C49\u6CBD"},{value:"\u5927\u6E2F",label:"\u5927\u6E2F"},{value:"\u5B81\u6CB3",label:"\u5B81\u6CB3"},{value:"\u9759\u6D77",label:"\u9759\u6D77"},{value:"\u5B9D\u577B",label:"\u5B9D\u577B"},{value:"\u84DF\u53BF",label:"\u84DF\u53BF"}]},{value:"\u65B0\u7586",label:"\u65B0\u7586",children:[{value:"\u4E4C\u9C81\u6728\u9F50",label:"\u4E4C\u9C81\u6728\u9F50"},{value:"\u963F\u514B\u82CF",label:"\u963F\u514B\u82CF"},{value:"\u963F\u52D2\u6CF0",label:"\u963F\u52D2\u6CF0"},{value:"\u963F\u56FE\u4EC0",label:"\u963F\u56FE\u4EC0"},{value:"\u535A\u4E50",label:"\u535A\u4E50"},{value:"\u660C\u5409",label:"\u660C\u5409"},{value:"\u4E1C\u5C71",label:"\u4E1C\u5C71"},{value:"\u54C8\u5BC6",label:"\u54C8\u5BC6"},{value:"\u548C\u7530",label:"\u548C\u7530"},{value:"\u5580\u4EC0",label:"\u5580\u4EC0"},{value:"\u514B\u62C9\u739B\u4F9D",label:"\u514B\u62C9\u739B\u4F9D"},{value:"\u5E93\u8F66",label:"\u5E93\u8F66"},{value:"\u5E93\u5C14\u52D2",label:"\u5E93\u5C14\u52D2"},{value:"\u594E\u5C6F",label:"\u594E\u5C6F"},{value:"\u77F3\u6CB3\u5B50",label:"\u77F3\u6CB3\u5B50"},{value:"\u5854\u57CE",label:"\u5854\u57CE"},{value:"\u5410\u9C81\u756A",label:"\u5410\u9C81\u756A"},{value:"\u4F0A\u5B81",label:"\u4F0A\u5B81"}]},{value:"\u897F\u85CF",label:"\u897F\u85CF",children:[{value:"\u62C9\u8428",label:"\u62C9\u8428"},{value:"\u963F\u91CC",label:"\u963F\u91CC"},{value:"\u660C\u90FD",label:"\u660C\u90FD"},{value:"\u6797\u829D",label:"\u6797\u829D"},{value:"\u90A3\u66F2",label:"\u90A3\u66F2"},{value:"\u65E5\u5580\u5219",label:"\u65E5\u5580\u5219"},{value:"\u5C71\u5357",label:"\u5C71\u5357"}]},{value:"\u4E91\u5357",label:"\u4E91\u5357",children:[{value:"\u6606\u660E",label:"\u6606\u660E"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4FDD\u5C71",label:"\u4FDD\u5C71"},{value:"\u695A\u96C4",label:"\u695A\u96C4"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4E1C\u5DDD",label:"\u4E1C\u5DDD"},{value:"\u4E2A\u65E7",label:"\u4E2A\u65E7"},{value:"\u666F\u6D2A",label:"\u666F\u6D2A"},{value:"\u5F00\u8FDC",label:"\u5F00\u8FDC"},{value:"\u4E34\u6CA7",label:"\u4E34\u6CA7"},{value:"\u4E3D\u6C5F",label:"\u4E3D\u6C5F"},{value:"\u516D\u5E93",label:"\u516D\u5E93"},{value:"\u6F5E\u897F",label:"\u6F5E\u897F"},{value:"\u66F2\u9756",label:"\u66F2\u9756"},{value:"\u601D\u8305",label:"\u601D\u8305"},{value:"\u6587\u5C71",label:"\u6587\u5C71"},{value:"\u897F\u53CC\u7248\u7EB3",label:"\u897F\u53CC\u7248\u7EB3"},{value:"\u7389\u6EAA",label:"\u7389\u6EAA"},{value:"\u4E2D\u7538",label:"\u4E2D\u7538"},{value:"\u662D\u901A",label:"\u662D\u901A"}]},{value:"\u6D59\u6C5F",label:"\u6D59\u6C5F",children:[{value:"\u676D\u5DDE",label:"\u676D\u5DDE"},{value:"\u6E29\u5DDE",label:"\u6E29\u5DDE"},{value:"\u5B89\u5409",label:"\u5B89\u5409"},{value:"\u6148\u6EAA",label:"\u6148\u6EAA"},{value:"\u5B9A\u6D77",label:"\u5B9A\u6D77"},{value:"\u5949\u5316",label:"\u5949\u5316"},{value:"\u6D77\u76D0",label:"\u6D77\u76D0"},{value:"\u9EC4\u5CA9",label:"\u9EC4\u5CA9"},{value:"\u6E56\u5DDE",label:"\u6E56\u5DDE"},{value:"\u5609\u5174",label:"\u5609\u5174"},{value:"\u91D1\u534E",label:"\u91D1\u534E"},{value:"\u4E34\u5B89",label:"\u4E34\u5B89"},{value:"\u4E34\u6D77",label:"\u4E34\u6D77"},{value:"\u4E3D\u6C34",label:"\u4E3D\u6C34"},{value:"\u5B81\u6CE2",label:"\u5B81\u6CE2"},{value:"\u74EF\u6D77",label:"\u74EF\u6D77"},{value:"\u5E73\u6E56",label:"\u5E73\u6E56"},{value:"\u5343\u5C9B\u6E56",label:"\u5343\u5C9B\u6E56"},{value:"\u8862\u5DDE",label:"\u8862\u5DDE"},{value:"\u6C5F\u5C71",label:"\u6C5F\u5C71"},{value:"\u745E\u5B89",label:"\u745E\u5B89"},{value:"\u7ECD\u5174",label:"\u7ECD\u5174"},{value:"\u5D4A\u5DDE",label:"\u5D4A\u5DDE"},{value:"\u53F0\u5DDE",label:"\u53F0\u5DDE"},{value:"\u6E29\u5CAD",label:"\u6E29\u5CAD"},{value:"\u4F59\u59DA",label:"\u4F59\u59DA"},{value:"\u821F\u5C71",label:"\u821F\u5C71"}]},{value:"\u6D77\u5916",label:"\u6D77\u5916",children:[{value:"\u7F8E\u56FD",label:"\u7F8E\u56FD"},{value:"\u65E5\u672C",label:"\u65E5\u672C"},{value:"\u82F1\u56FD",label:"\u82F1\u56FD"},{value:"\u6CD5\u56FD",label:"\u6CD5\u56FD"},{value:"\u5FB7\u56FD",label:"\u5FB7\u56FD"},{value:"\u5176\u4ED6",label:"\u5176\u4ED6"}]}]},kSUc:function(ut,Ze,te){},lZu9:function(ut,Ze,te){(function(Z){Z(te("VrN/"),te("1eCo"),te("8EBN"))})(function(Z){"use strict";Z.defineMode("markdown",function(G,D){var K=Z.getMode(G,"text/html"),M=K.name=="null";function P(B){if(Z.findModeByName){var F=Z.findModeByName(B);F&&(B=F.mime||F.mimes[0])}var z=Z.getMode(G,B);return z.name=="null"?null:z}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var N={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 k in N)N.hasOwnProperty(k)&&D.tokenTypeOverrides[k]&&(N[k]=D.tokenTypeOverrides[k]);var A=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,L=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(B,F,z){return F.f=F.inline=z,z(B,F)}function u(B,F,z){return F.f=F.block=z,z(B,F)}function T(B){return!B||!/\S/.test(B.string)}function f(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==w){var F=M;if(!F){var z=Z.innerMode(K,B.htmlState);F=z.mode.name=="xml"&&z.state.tagStart===null&&!z.state.context&&z.state.tokenize.isInText}F&&(B.f=l,B.block=p,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function p(B,F){var z=B.column()===F.indentation,Q=T(F.prevLine.stream),ie=F.indentedCode,ce=F.prevLine.hr,Ce=F.list!==!1,pe=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var Te=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,Ce)){for(F.list=null;Te<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=Te-F.listStack[F.listStack.length-1])}var se=!Q&&!ce&&!F.prevLine.header&&(!Ce||!ie)&&!F.prevLine.fencedCodeEnd,de=(F.list===!1||ce||Q)&&F.indentation<=pe&&B.match(A),q=null;if(F.indentationDiff>=4&&(ie||F.prevLine.fencedCodeEnd||F.prevLine.header||Q))return B.skipToEnd(),F.indentedCode=!0,N.code;if(B.eatSpace())return null;if(z&&F.indentation<=pe&&(q=B.match(L))&&q[1].length<=6)return F.quote=0,F.header=q[1].length,F.thisLine.header=!0,D.highlightFormatting&&(F.formatting="header"),F.f=F.inline,h(F);if(F.indentation<=pe&&B.eat(">"))return F.quote=z?1:F.quote+1,D.highlightFormatting&&(F.formatting="quote"),B.eatSpace(),h(F);if(!de&&!F.setext&&z&&F.indentation<=pe&&(q=B.match(_))){var oe=q[1]?"ol":"ul";return F.indentation=Te+B.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,D.taskLists&&B.match(x,!1)&&(F.taskList=!0),F.f=F.inline,D.highlightFormatting&&(F.formatting=["list","list-"+oe]),h(F)}else{if(z&&F.indentation<=pe&&(q=B.match(S,!0)))return F.quote=0,F.fencedEndRE=new RegExp(q[1]+"+ *$"),F.localMode=D.fencedCodeBlockHighlighting&&P(q[2]||D.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=Z.startState(F.localMode)),F.f=F.block=y,D.highlightFormatting&&(F.formatting="code-block"),F.code=-1,h(F);if(F.setext||(!se||!Ce)&&!F.quote&&F.list===!1&&!F.code&&!de&&!b.test(B.string)&&(q=B.lookAhead(1))&&(q=q.match(O)))return F.setext?(F.header=F.setext,F.setext=0,B.skipToEnd(),D.highlightFormatting&&(F.formatting="header")):(F.header=q[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,h(F);if(de)return B.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,N.hr;if(B.peek()==="[")return s(B,F,R)}return s(B,F,F.inline)}function w(B,F){var z=K.token(B,F.htmlState);if(!M){var Q=Z.innerMode(K,F.htmlState);(Q.mode.name=="xml"&&Q.state.tagStart===null&&!Q.state.context&&Q.state.tokenize.isInText||F.md_inside&&B.current().indexOf(">")>-1)&&(F.f=l,F.block=p,F.htmlState=null)}return z}function y(B,F){var z=F.listStack[F.listStack.length-1]||0,Q=F.indentation<z,ie=z+3;if(F.fencedEndRE&&F.indentation<=ie&&(Q||B.match(F.fencedEndRE))){D.highlightFormatting&&(F.formatting="code-block");var ce;return Q||(ce=h(F)),F.localMode=F.localState=null,F.block=p,F.f=l,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,Q?u(B,F,F.block):ce}else return F.localMode?F.localMode.token(B,F.localState):(B.skipToEnd(),N.code)}function h(B){var F=[];if(B.formatting){F.push(N.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var z=0;z<B.formatting.length;z++)F.push(N.formatting+"-"+B.formatting[z]),B.formatting[z]==="header"&&F.push(N.formatting+"-"+B.formatting[z]+"-"+B.header),B.formatting[z]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?F.push(N.formatting+"-"+B.formatting[z]+"-"+B.quote):F.push("error"))}if(B.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(B.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(B.linkHref?F.push(N.linkHref,"url"):(B.strong&&F.push(N.strong),B.em&&F.push(N.em),B.strikethrough&&F.push(N.strikethrough),B.emoji&&F.push(N.emoji),B.linkText&&F.push(N.linkText),B.code&&F.push(N.code),B.image&&F.push(N.image),B.imageAltText&&F.push(N.imageAltText,"link"),B.imageMarker&&F.push(N.imageMarker)),B.header&&F.push(N.header,N.header+"-"+B.header),B.quote&&(F.push(N.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?F.push(N.quote+"-"+B.quote):F.push(N.quote+"-"+D.maxBlockquoteDepth)),B.list!==!1){var Q=(B.listStack.length-1)%3;Q?Q===1?F.push(N.list2):F.push(N.list3):F.push(N.list1)}return B.trailingSpaceNewLine?F.push("trailing-space-new-line"):B.trailingSpace&&F.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function c(B,F){return B.match(C,!0)?h(F):void 0}function l(B,F){var z=F.text(B,F);if(typeof z!="undefined")return z;if(F.list)return F.list=null,h(F);if(F.taskList){var Q=B.match(x,!0)[1]===" ";return Q?F.taskOpen=!0:F.taskClosed=!0,D.highlightFormatting&&(F.formatting="task"),F.taskList=!1,h(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&B.match(/^#+$/,!0))return D.highlightFormatting&&(F.formatting="header"),h(F);var ie=B.next();if(F.linkTitle){F.linkTitle=!1;var ce=ie;ie==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ce="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(B.match(new RegExp(Ce),!0))return N.linkHref}if(ie==="`"){var pe=F.formatting;D.highlightFormatting&&(F.formatting="code"),B.eatWhile("`");var Te=B.current().length;if(F.code==0&&(!F.quote||Te==1))return F.code=Te,h(F);if(Te==F.code){var se=h(F);return F.code=0,se}else return F.formatting=pe,h(F)}else if(F.code)return h(F);if(ie==="\\"&&(B.next(),D.highlightFormatting)){var de=h(F),q=N.formatting+"-escape";return de?de+" "+q:q}if(ie==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,D.highlightFormatting&&(F.formatting="image"),h(F);if(ie==="["&&F.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,D.highlightFormatting&&(F.formatting="image"),h(F);if(ie==="]"&&F.imageAltText){D.highlightFormatting&&(F.formatting="image");var de=h(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=v,de}if(ie==="["&&!F.image)return F.linkText&&B.match(/^.*?\]/)||(F.linkText=!0,D.highlightFormatting&&(F.formatting="link")),h(F);if(ie==="]"&&F.linkText){D.highlightFormatting&&(F.formatting="link");var de=h(F);return F.linkText=!1,F.inline=F.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?v:l,de}if(ie==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=a,D.highlightFormatting&&(F.formatting="link");var de=h(F);return de?de+=" ":de="",de+N.linkInline}if(ie==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=a,D.highlightFormatting&&(F.formatting="link");var de=h(F);return de?de+=" ":de="",de+N.linkEmail}if(D.xml&&ie==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var oe=B.string.indexOf(">",B.pos);if(oe!=-1){var ye=B.string.substring(B.start,oe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ye)&&(F.md_inside=!0)}return B.backUp(1),F.htmlState=Z.startState(K),u(B,F,w)}if(D.xml&&ie==="<"&&B.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var fe=1,Le=B.pos==1?" ":B.string.charAt(B.pos-2);fe<3&&B.eat(ie);)fe++;var ve=B.peek()||" ",De=!/\s/.test(ve)&&(!d.test(ve)||/\s/.test(Le)||d.test(Le)),be=!/\s/.test(Le)&&(!d.test(Le)||/\s/.test(ve)||d.test(ve)),we=null,Re=null;if(fe%2&&(!F.em&&De&&(ie==="*"||!be||d.test(Le))?we=!0:F.em==ie&&be&&(ie==="*"||!De||d.test(ve))&&(we=!1)),fe>1&&(!F.strong&&De&&(ie==="*"||!be||d.test(Le))?Re=!0:F.strong==ie&&be&&(ie==="*"||!De||d.test(ve))&&(Re=!1)),Re!=null||we!=null){D.highlightFormatting&&(F.formatting=we==null?"strong":Re==null?"em":"strong em"),we===!0&&(F.em=ie),Re===!0&&(F.strong=ie);var se=h(F);return we===!1&&(F.em=!1),Re===!1&&(F.strong=!1),se}}else if(ie===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return h(F);B.backUp(1)}if(D.strikethrough){if(ie==="~"&&B.eatWhile(ie)){if(F.strikethrough){D.highlightFormatting&&(F.formatting="strikethrough");var se=h(F);return F.strikethrough=!1,se}else if(B.match(/^[^\s]/,!1))return F.strikethrough=!0,D.highlightFormatting&&(F.formatting="strikethrough"),h(F)}else if(ie===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return h(F);B.backUp(2)}}if(D.emoji&&ie===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,D.highlightFormatting&&(F.formatting="emoji");var Fe=h(F);return F.emoji=!1,Fe}return ie===" "&&(B.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),h(F)}function a(B,F){var z=B.next();if(z===">"){F.f=F.inline=l,D.highlightFormatting&&(F.formatting="link");var Q=h(F);return Q?Q+=" ":Q="",Q+N.linkInline}return B.match(/^[^>]+/,!0),N.linkInline}function v(B,F){if(B.eatSpace())return null;var z=B.next();return z==="("||z==="["?(F.f=F.inline=m(z==="("?")":"]"),D.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,h(F)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function m(B){return function(F,z){var Q=F.next();if(Q===B){z.f=z.inline=l,D.highlightFormatting&&(z.formatting="link-string");var ie=h(z);return z.linkHref=!1,ie}return F.match(g[B]),z.linkHref=!0,h(z)}}function R(B,F){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=U,B.next(),D.highlightFormatting&&(F.formatting="link"),F.linkText=!0,h(F)):s(B,F,l)}function U(B,F){if(B.match(/^\]:/,!0)){F.f=F.inline=W,D.highlightFormatting&&(F.formatting="link");var z=h(F);return F.linkText=!1,z}return B.match(/^([^\]\\]|\\.)+/,!0),N.linkText}function W(B,F){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?F.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=l,N.linkHref+" url")}var X={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,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(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&Z.copyState(K,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?Z.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,F){if(F.formatting=!1,B!=F.thisLine.stream){if(F.header=0,F.hr=!1,B.match(/^\s*$/,!0))return f(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:B},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=w)){var z=B.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(F.indentation=z,F.indentationDiff=null,z>0)return null}}return F.f(B,F)},innerMode:function(B){return B.block==w?{state:B.htmlState,mode:K}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:X}},indent:function(B,F,z){return B.block==w&&K.indent?K.indent(B.htmlState,F,z):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,F,z):Z.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return X},"xml"),Z.defineMIME("text/markdown","markdown"),Z.defineMIME("text/x-markdown","markdown")})},m7e3:function(ut,Ze,te){ut.exports={flex_box_center:"flex_box_center___cDhGq",flex_space_between:"flex_space_between___3OXHk",flex_box_vertical_center:"flex_box_vertical_center___3g3vC",flex_box_center_end:"flex_box_center_end___2QmKm",flex_box_column:"flex_box_column___2Id0h",bg:"bg___1JEmc",title:"title___3bVR_",titleLeft:"titleLeft___2rmGK",titleRight:"titleRight___1YZFf",btns:"btns___2IVL7"}},osHv:function(ut,Ze,te){(function(Z){Z(te("VrN/"))})(function(Z){"use strict";var G=Z.Pos;function D(d,o){return d.line-o.line||d.ch-o.ch}var K="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",M=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+K+"]["+M+"]*)","g");function N(d,o,s,u){this.line=o,this.ch=s,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function k(d,o){var s=d.cm.getTokenTypeAt(G(d.line,o));return s&&/\btag\b/.test(s)}function A(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function _(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function x(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(A(d))continue;return}if(!k(d,o+1)){d.ch=o+1;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function L(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(_(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}P.lastIndex=o,d.ch=o;var s=P.exec(d.text);if(s&&s.index==o)return s}}function O(d){for(;;){P.lastIndex=d.ch;var o=P.exec(d.text);if(!o){if(A(d))continue;return}if(!k(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(_(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function S(d,o){for(var s=[];;){var u=O(d),T,f=d.line,p=d.ch-(u?u[0].length:0);if(!u||!(T=x(d)))return;if(T=="selfClose")continue;if(u[1]){for(var w=s.length-1;w>=0;--w)if(s[w]==u[2]){s.length=w;break}if(w<0&&(!o||o==u[2]))return{tag:u[2],from:G(f,p),to:G(d.line,d.ch)}}else s.push(u[2])}}function b(d,o){for(var s=[];;){var u=C(d);if(!u)return;if(u=="selfClose"){L(d);continue}var T=d.line,f=d.ch,p=L(d);if(!p)return;if(p[1])s.push(p[2]);else{for(var w=s.length-1;w>=0;--w)if(s[w]==p[2]){s.length=w;break}if(w<0&&(!o||o==p[2]))return{tag:p[2],from:G(d.line,d.ch),to:G(T,f)}}}}Z.registerHelper("fold","xml",function(d,o){for(var s=new N(d,o.line,0);;){var u=O(s);if(!u||s.line!=o.line)return;var T=x(s);if(!T)return;if(!u[1]&&T!="selfClose"){var f=G(s.line,s.ch),p=S(s,u[2]);return p&&D(p.from,f)>0?{from:f,to:p.from}:null}}}),Z.findMatchingTag=function(d,o,s){var u=new N(d,o.line,o.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var T=x(u),f=T&&G(u.line,u.ch),p=T&&L(u);if(!T||!p||D(u,o)>0)return;var w={from:G(u.line,u.ch),to:f,tag:p[2]};return T=="selfClose"?{open:w,close:null,at:"open"}:p[1]?{open:b(u,p[2]),close:w,at:"close"}:(u=new N(d,f.line,f.ch,s),{open:w,close:S(u,p[2]),at:"open"})},Z.findEnclosingTag=function(d,o,s,u){for(var T=new N(d,o.line,o.ch,s);;){var f=b(T,u);if(!f)break;var p=new N(d,o.line,o.ch,s),w=S(p,f.tag);if(w)return{open:f,close:w}}},Z.scanForClosingTag=function(d,o,s,u){var T=new N(d,o.line,o.ch,u?{from:0,to:u}:null);return S(T,s)}})},p5ED:function(ut,Ze,te){"use strict";var Z=te("+L6B"),G=te("2/Rp"),D=te("5Dmo"),K=te("3S7+"),M=te("k1fw"),P=te("tJVT"),N=te("q1tI"),k=te.n(N),A=te("vHTk"),_=te.n(A),x=te("yEEn"),L=te("ZW9T"),O=te("1vsH");Ze.a=function(C){var S=C.name,b=C.data,d=C.theme,o=C.type,s=C.filename,u=C.monacoEditor,T=C.className,f=C.style,p=C.close,w=C.onClose,y=C.hasMask,h=Object(N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(P.a)(h,2),l=c[0],a=c[1],v=Object(N.useState)(""),g=Object(P.a)(v,2),m=g[0],R=g[1],U=Object(N.useRef)();s&&(u.filename=s),Object(N.useEffect)(function(){var B,F,z=(B=document.cookie)===null||B===void 0||((F=B.replace(/\s/g,""))===null||F===void 0)?void 0:F.split(";");z==null||z.map(function(Q){var ie=Q.split("=");ie[0]==="_educoder_session"&&R(ie[1])})},[]);var W=function(){if(b.startsWith("http")||b.startsWith("/")){X();return}Object(O.x)(s||"educoder",b,s)},X=function(){Object(O.v)(s||S,b)};return console.log("data:",b,"fileanme:",s," name:",S),k.a.createElement("div",{style:Object(M.a)({},f||{}),className:"".concat(y&&_.a.bgBlack," ").concat(o?_.a.wrp:"hide")},p&&k.a.createElement("div",{className:_.a.close,ref:U},k.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},k.a.createElement("span",{onClick:X},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},k.a.createElement("span",{className:"",onClick:w},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(_.a[T]," ").concat(T," ").concat(_.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&k.a.createElement(L.b,u)),o==="audio"&&k.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),o==="video"&&k.a.createElement(k.a.Fragment,null,b!=null&&b.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),o==="pdf"&&k.a.createElement("embed",{className:_.a.embed,src:b}),o==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),o==="other"&&k.a.createElement("div",null,k.a.createElement(G.a,{type:"primary",size:"large",onClick:W},k.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&k.a.createElement(G.a,{type:"primary",size:"large",onClick:W},k.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ut,Ze,te){},"rAM+":function(ut,Ze,te){"use strict";te.d(Ze,"a",function(){return G});var Z=te("Qw5x");function G(D,K){var M;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(M=Object(Z.a)(D))||K&&D&&typeof D.length=="number"){M&&(D=M);var P=0,N=function(){};return{s:N,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(L){throw L},f:N}}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 k=!0,A=!1,_;return{s:function(){M=D[Symbol.iterator]()},n:function(){var L=M.next();return k=L.done,L},e:function(L){A=!0,_=L},f:function(){try{!k&&M.return!=null&&M.return()}finally{if(A)throw _}}}}},rUJ1:function(ut,Ze){const te=/[&<>"']/,Z=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},M=y=>K[y];function P(y,h){if(h){if(te.test(y))return y.replace(Z,M)}else if(G.test(y))return y.replace(D,M);return y}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(y){return y.replace(N,(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 A=/(^|[^\[])\^/g;function _(y,h){y=y.source||y,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(A,"$1"),y=y.replace(l,a),c),getRegex:()=>new RegExp(y,h)};return c}const x=/[^\w:]/g,L=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(y,h,c){if(y){let l;try{l=decodeURIComponent(k(c)).replace(x,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!L.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},S=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,h){C[" "+y]||(S.test(y)?C[" "+y]=y+"/":C[" "+y]=f(y,"/",!0)),y=C[" "+y];const c=y.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:y.replace(b,"$1")+h:h.charAt(0)==="/"?c?h:y.replace(d,"$1")+h:y+h}const s={exec:function(){}};function u(y){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(y[l]=c[l])}return y}function T(y,h){const c=y.replace(/\|/g,(v,g,m)=>{let R=!1,U=g;for(;--U>=0&&m[U]==="\\";)R=!R;return R?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function f(y,h,c){const l=y.length;if(l===0)return"";let a=0;for(;a<l;){const v=y.charAt(l-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return y.substr(0,l-a)}function p(y,h){if(y.indexOf(h[1])===-1)return-1;const c=y.length;let l=0,a=0;for(;a<c;a++)if(y[a]==="\\")a++;else if(y[a]===h[0])l++;else if(y[a]===h[1]&&(l--,l<0))return a;return-1}function w(y){y&&y.sanitize&&!y.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ut.exports={escape:P,unescape:k,edit:_,cleanUrl:O,resolveUrl:o,noopTest:s,merge:u,splitCells:T,rtrim:f,findClosingBracket:p,checkSanitizeDeprecation:w}},uK0f:function(ut,Ze,te){(function(Z,G){ut.exports=G()})(this,function(){"use strict";function Z(G,D,K){K=K||{},K.childrenKeyName=K.childrenKeyName||"children";var M=G||[],P=[],N=0;do{var k=M.filter(function(A){return D(A,N)})[0];if(!k)break;P.push(k),M=k[K.childrenKeyName]||[],N+=1}while(M.length>0);return P}return Z})},ulZh:function(ut,Ze,te){typeof window!="undefined"&&function(G,D){ut.exports=D()}(this,function(){return function(Z){var G={};function D(K){if(G[K])return G[K].exports;var M=G[K]={i:K,l:!1,exports:{}};return Z[K].call(M.exports,M,M.exports,D),M.l=!0,M.exports}return D.m=Z,D.c=G,D.d=function(K,M,P){D.o(K,M)||Object.defineProperty(K,M,{enumerable:!0,get:P})},D.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},D.t=function(K,M){if(M&1&&(K=D(K)),M&8)return K;if(M&4&&typeof K=="object"&&K&&K.__esModule)return K;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:K}),M&2&&typeof K!="string")for(var N in K)D.d(P,N,function(k){return K[k]}.bind(null,N));return P},D.n=function(K){var M=K&&K.__esModule?function(){return K.default}:function(){return K};return D.d(M,"a",M),M},D.o=function(K,M){return Object.prototype.hasOwnProperty.call(K,M)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Z,G,D){"use strict";var K=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function N(x,L,O){this.fn=x,this.context=L,this.once=O||!1}function k(x,L,O,C,S){if(typeof O!="function")throw new TypeError("The listener must be a function");var b=new N(O,C||x,S),d=M?M+L:L;return x._events[d]?x._events[d].fn?x._events[d]=[x._events[d],b]:x._events[d].push(b):(x._events[d]=b,x._eventsCount++),x}function A(x,L){--x._eventsCount===0?x._events=new P:delete x._events[L]}function _(){this._events=new P,this._eventsCount=0}_.prototype.eventNames=function(){var L=[],O,C;if(this._eventsCount===0)return L;for(C in O=this._events)K.call(O,C)&&L.push(M?C.slice(1):C);return Object.getOwnPropertySymbols?L.concat(Object.getOwnPropertySymbols(O)):L},_.prototype.listeners=function(L){var O=M?M+L:L,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var S=0,b=C.length,d=new Array(b);S<b;S++)d[S]=C[S].fn;return d},_.prototype.listenerCount=function(L){var O=M?M+L:L,C=this._events[O];return C?C.fn?1:C.length:0},_.prototype.emit=function(L,O,C,S,b,d){var o=M?M+L:L;if(!this._events[o])return!1;var s=this._events[o],u=arguments.length,T,f;if(s.fn){s.once&&this.removeListener(L,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,O),!0;case 3:return s.fn.call(s.context,O,C),!0;case 4:return s.fn.call(s.context,O,C,S),!0;case 5:return s.fn.call(s.context,O,C,S,b),!0;case 6:return s.fn.call(s.context,O,C,S,b,d),!0}for(f=1,T=new Array(u-1);f<u;f++)T[f-1]=arguments[f];s.fn.apply(s.context,T)}else{var p=s.length,w;for(f=0;f<p;f++){s[f].once&&this.removeListener(L,s[f].fn,void 0,!0);switch(u){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,O);break;case 3:s[f].fn.call(s[f].context,O,C);break;case 4:s[f].fn.call(s[f].context,O,C,S);break;default:if(!T)for(w=1,T=new Array(u-1);w<u;w++)T[w-1]=arguments[w];s[f].fn.apply(s[f].context,T)}}}return!0},_.prototype.on=function(L,O,C){return k(this,L,O,C,!1)},_.prototype.once=function(L,O,C){return k(this,L,O,C,!0)},_.prototype.removeListener=function(L,O,C,S){var b=M?M+L:L;if(!this._events[b])return this;if(!O)return A(this,b),this;var d=this._events[b];if(d.fn)d.fn===O&&(!S||d.once)&&(!C||d.context===C)&&A(this,b);else{for(var o=0,s=[],u=d.length;o<u;o++)(d[o].fn!==O||S&&!d[o].once||C&&d[o].context!==C)&&s.push(d[o]);s.length?this._events[b]=s.length===1?s[0]:s:A(this,b)}return this},_.prototype.removeAllListeners=function(L){var O;return L?(O=M?M+L:L,this._events[O]&&A(this,O)):(this._events=new P,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=M,_.EventEmitter=_,Z.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(Z,G,D){(function(K){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,A={buildAbsoluteURL:function(_,x,L){if(L=L||{},_=_.trim(),x=x.trim(),!x){if(!L.alwaysNormalize)return _;var O=A.parseURL(_);if(!O)throw new Error("Error trying to parse base URL.");return O.path=A.normalizePath(O.path),A.buildURLFromParts(O)}var C=A.parseURL(x);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return L.alwaysNormalize?(C.path=A.normalizePath(C.path),A.buildURLFromParts(C)):x;var S=A.parseURL(_);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var b=P.exec(S.path);S.netLoc=b[1],S.path=b[2]}S.netLoc&&!S.path&&(S.path="/");var d={scheme:S.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=S.netLoc,C.path[0]!=="/"))if(!C.path)d.path=S.path,C.params||(d.params=S.params,C.query||(d.query=S.query));else{var o=S.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=A.normalizePath(s)}return d.path===null&&(d.path=L.alwaysNormalize?A.normalizePath(C.path):C.path),A.buildURLFromParts(d)},parseURL:function(_){var x=M.exec(_);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(N,"");_.length!==(_=_.replace(k,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};Z.exports=A})(this)},"./node_modules/webworkify-webpack/index.js":function(Z,G,D){function K(L){var O={};function C(b){if(O[b])return O[b].exports;var d=O[b]={i:b,l:!1,exports:{}};return L[b].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=L,C.c=O,C.i=function(b){return b},C.d=function(b,d,o){C.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},C.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return C.d(d,"a",d),d},C.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},C.p="/",C.oe=function(b){throw console.error(b),b};var S=C(C.s=ENTRY_MODULE);return S.default||S}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function N(L){return(L+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(L){return!isNaN(1*L)}function A(L,O,C){var S={};S[C]=[];var b=O.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return S;for(var o=d[1],s=new RegExp("(\\\\n|\\W)"+N(o)+P,"g"),u;u=s.exec(b);){if(u[3]==="dll-reference")continue;S[C].push(u[3])}for(s=new RegExp("\\("+N(o)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");u=s.exec(b);)L[u[2]]||(S[C].push(u[1]),L[u[2]]=D(u[1]).m),S[u[2]]=S[u[2]]||[],S[u[2]].push(u[4]);for(var T=Object.keys(S),f=0;f<T.length;f++)for(var p=0;p<S[T[f]].length;p++)k(S[T[f]][p])&&(S[T[f]][p]=1*S[T[f]][p]);return S}function _(L){var O=Object.keys(L);return O.reduce(function(C,S){return C||L[S].length>0},!1)}function x(L,O){for(var C={main:[O]},S={main:[]},b={main:{}};_(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var s=d[o],u=C[s],T=u.pop();if(b[s]=b[s]||{},b[s][T]||!L[s][T])continue;b[s][T]=!0,S[s]=S[s]||[],S[s].push(T);for(var f=A(L,L[s][T],s),p=Object.keys(f),w=0;w<p.length;w++)C[p[w]]=C[p[w]]||[],C[p[w]]=C[p[w]].concat(f[p[w]])}return S}Z.exports=function(L,O){O=O||{};var C={main:D.m},S=O.all?{main:Object.keys(C.main)}:x(C,L),b="";Object.keys(S).filter(function(T){return T!=="main"}).forEach(function(T){for(var f=0;S[T][f];)f++;S[T].push(f),C[T][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+T+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+S[T].map(function(p){return""+JSON.stringify(p)+": "+C[T][p].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(L))+")({"+S.main.map(function(T){return""+JSON.stringify(T)+": "+C.main[T].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(O.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"hlsDefaultConfig",function(){return w}),D.d(G,"mergeConfig",function(){return h}),D.d(G,"enableStreamingMode",function(){return c});var K=D("./src/controller/abr-controller.ts"),M=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),N=D("./src/controller/subtitle-stream-controller.ts"),k=D("./src/controller/subtitle-track-controller.ts"),A=D("./src/controller/buffer-controller.ts"),_=D("./src/controller/timeline-controller.ts"),x=D("./src/controller/cap-level-controller.ts"),L=D("./src/controller/fps-controller.ts"),O=D("./src/controller/eme-controller.ts"),C=D("./src/controller/cmcd-controller.ts"),S=D("./src/utils/xhr-loader.ts"),b=D("./src/utils/fetch-loader.ts"),d=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function u(){return u=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(l[g]=v[g])}return l},u.apply(this,arguments)}function T(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(l);a&&(g=g.filter(function(m){return Object.getOwnPropertyDescriptor(l,m).enumerable})),v.push.apply(v,g)}return v}function f(l){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?T(Object(v),!0).forEach(function(g){p(l,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(v)):T(Object(v)).forEach(function(g){Object.defineProperty(l,g,Object.getOwnPropertyDescriptor(v,g))})}return l}function p(l,a,v){return a in l?Object.defineProperty(l,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):l[a]=v,l}var w=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:A.default,capLevelController:x.default,fpsController:L.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:k.default,timelineController:_.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:O.default,cmcdController:C.default});function y(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},l,a)}function c(l){var a=l.loader;if(a!==b.default&&a!==S.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var v=Object(b.fetchSupported)();v&&(l.loader=b.default,l.progressive=!0,l.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/polyfills/number.ts"),M=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),k=D("./src/errors.ts"),A=D("./src/types/loader.ts"),_=D("./src/utils/logger.ts");function x(C,S){for(var b=0;b<S.length;b++){var d=S[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function L(C,S,b){return S&&x(C.prototype,S),b&&x(C,b),C}var O=function(){function C(b){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=b;var d=b.config;this.bwEstimator=new M.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var S=C.prototype;return S.registerListeners=function(){var d=this.hls;d.on(P.Events.FRAG_LOADING,this.onFragLoading,this),d.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(P.Events.FRAG_LOADING,this.onFragLoading,this),d.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(d,o){var s=o.frag;if(s.type===A.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(d,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,T=s.config,f=s.media;if(!d||!f)return;var p=o?o.stats:d.stats,w=o?o.duration:d.duration;if(p.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||f.paused||!f.playbackRate||!f.readyState)return;var y=performance.now()-p.loading.start,h=Math.abs(f.playbackRate);if(y<=500*w/h)return;var c=s.levels,l=s.minAutoLevel,a=c[d.level],v=p.total||Math.max(p.loaded,Math.round(w*a.maxBitrate/8)),g=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/y),m=(v-p.loaded)/g,R=f.currentTime,U=(N.BufferHelper.bufferInfo(f,R,T.maxBufferHole).end-R)/h;if(U>=2*w/h||m<=U)return;var W=Number.POSITIVE_INFINITY,X;for(X=d.level-1;X>l;X--){var B=c[X].maxBitrate;if(W=w*B/(8*.8*g),W<U)break}if(W>=m)return;var F=this.bwEstimator.getEstimate();_.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 "+X+`
|
|
Current BW estimate: `+(Object(K.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+m.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=X,this.bwEstimator.sample(y,p.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:p})},S.onFragLoaded=function(d,o){var s=o.frag,u=o.part;if(s.type===A.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(s.sn)){var T=u?u.stats:s.stats,f=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[s.level],w=(p.loaded?p.loaded.bytes:0)+T.loaded,y=(p.loaded?p.loaded.duration:0)+f;p.loaded={bytes:w,duration:y},p.realBitrate=Math.round(8*w/y)}if(s.bitrateTest){var h={stats:T,frag:s,part:u,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},S.onFragBuffered=function(d,o){var s=o.frag,u=o.part,T=u?u.stats:s.stats;if(T.aborted)return;if(s.type!==A.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=T.parsing.end-T.loading.start;this.bwEstimator.sample(f,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},S.onError=function(d,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.maxAutoLevel,T=s.config,f=s.minAutoLevel,p=s.media,w=o?o.duration:d?d.duration:0,y=p?p.currentTime:0,h=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,l=(N.BufferHelper.bufferInfo(p,y,T.maxBufferHole).end-y)/h,a=this.findBestLevel(c,f,u,l,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(a>=0)return a;_.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=w?Math.min(w,T.maxStarvationDelay):T.maxStarvationDelay,g=T.abrBandWidthFactor,m=T.abrBandWidthUpFactor;if(!l){var R=this.bitrateTestDelay;if(R){var U=w?Math.min(w,T.maxLoadingDelay):T.maxLoadingDelay;v=U-R,_.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),g=m=1}}return a=this.findBestLevel(c,f,u,l+v,g,m),Math.max(a,0)},S.findBestLevel=function(d,o,s,u,T,f){for(var p,w=this.fragCurrent,y=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(p=l.details)!==null&&p!==void 0&&p.live),v=l==null?void 0:l.codecSet,g=y?y.duration:w?w.duration:0,m=s;m>=o;m--){var R=c[m];if(!R||v&&R.codecSet!==v)continue;var U=R.details,W=(y?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||g,X=void 0;m<=h?X=T*d:X=f*d;var B=c[m].maxBitrate,F=B*W/X;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(X)+"/"+B+"/"+W+"/"+u+"/"+F),X>B&&(!F||a&&!this.bitrateTestDelay||F<u))return m}return-1},L(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),C}();G.default=O},"./src/controller/audio-stream-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),A=D("./src/types/level.ts"),_=D("./src/types/loader.ts"),x=D("./src/loader/fragment.ts"),L=D("./src/demux/chunk-cache.ts"),O=D("./src/demux/transmuxer-interface.ts"),C=D("./src/types/transmuxer.ts"),S=D("./src/controller/fragment-finders.ts"),b=D("./src/utils/discontinuities.ts"),d=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},s.apply(this,arguments)}function u(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,T(w,y)}function T(w,y){return T=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},T(w,y)}var f=100,p=function(w){u(y,w);function y(c,l){var a;return a=w.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=y.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(P.Events.ERROR,this.onError,this),l.on(P.Events.BUFFER_RESET,this.onBufferReset,this),l.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(P.Events.ERROR,this.onError,this),l.off(P.Events.BUFFER_RESET,this.onBufferReset,this),l.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var v=a.frag,g=a.id,m=a.initPTS;if(g==="main"){var R=v.cc;this.initPTS[v.cc]=m,this.log("InitPTS for cc: "+R+" found from main: "+m),this.videoTrackCC=R,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var l,a=this.levels,v=this.trackId,g=a==null||((l=a[v])===null||l===void 0)?void 0:l.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var m,R=performance.now(),U=this.retryDate;(!U||R>=U||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var X=W.frag,B=W.part,F=W.cache,z=W.complete;if(this.initPTS[X.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var Q=F.flush(),ie={frag:X,part:B,payload:Q,networkDetails:null};this._handleFragmentLoadProgress(ie),z&&w.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+X.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ce=this.getLoadPosition(),Ce=N.BufferHelper.bufferInfo(this.mediaBuffer,ce,this.config.maxBufferHole),pe=Object(S.fragmentWithinToleranceTest)(Ce.end,this.config.maxFragLookUpTolerance,X);pe<0&&(o.logger.log("Waiting fragment cc ("+X.cc+") @ "+X.start+" cancelled because another fragment at "+Ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.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=M.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,v=this.hls,g=this.levels,m=this.media,R=this.trackId,U=v.config;if(!g||!g[R])return;if(!m&&(this.startFragRequested||!U.startFragPrefetch))return;var W=g[R],X=W.details;if(!X||X.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(X)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(B===null)return;var F=B.len,z=this.getMaxBufferLength(),Q=this.audioSwitch;if(F>=z&&!Q)return;if(!Q&&this._streamEnded(B,X)){v.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ie=X.fragments,ce=ie[0].start,Ce=B.end;if(Q){var pe=this.getLoadPosition();Ce=pe,X.PTSKnown&&pe<ce&&((B.end>ce||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),m.currentTime=ce+.05))}var Te=this.getNextFragment(Ce,X);if(!Te){this.bufferFlushed=!0;return}((l=Te.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=Te.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Te,X):this.loadFragment(Te,X,Ce)},h.getMaxBufferLength=function(){var l=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(g){return new A.Level(g)})},h.onAudioTrackSwitching=function(l,a){var v=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(f):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var v,g=this.levels,m=a.details,R=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+m.startSN+","+m.endSN+"],duration:"+m.totalduration);var U=g[R],W=0;if(m.live||(v=U.details)!==null&&v!==void 0&&v.live){var X=this.mainDetails;if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed||!X)return;!U.details&&m.hasProgramDateTime&&X.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(m,X),W=m.fragments[0].start):W=this.alignPlaylists(m,U.details)}U.details=m,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!m.live)&&this.setStartPosition(U.details,W),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(m)&&(this.state=M.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,v=l.frag,g=l.part,m=l.payload,R=this.config,U=this.trackId,W=this.levels;if(!W){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 X=W[U];console.assert(X,"Audio track is defined on fragment load progress");var B=X.details;console.assert(B,"Audio track details are defined on fragment load progress");var F=R.defaultAudioCodec||X.audioCodec||"mp4a.40.2",z=this.transmuxer;z||(z=this.transmuxer=new O.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Q=this.initPTS[v.cc],ie=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Q!==void 0){var ce=!1,Ce=g?g.index:-1,pe=Ce!==-1,Te=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,m.byteLength,Ce,pe);z.push(m,ie,F,"",v,g,B.totalduration,ce,Te,Q)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+U);var se=this.waitingData=this.waitingData||{frag:v,part:g,cache:new L.default,complete:!1},de=se.cache;de.push(new Uint8Array(m)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var v=a.frag,g=a.part;if(v.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(g?" p: "+g.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,g)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=a.fatal?M.State.ERROR:M.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===M.State.PARSING||this.state===M.State.PARSED)){var v=!0,g=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);g&&g.len>.5&&(v=!this.reduceMaxBufferLength(g.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var v=a.type;v===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,v="audio",g=this.hls,m=l.remuxResult,R=l.chunkMeta,U=this.getCurrentContext(R);if(!U){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var W=U.frag,X=U.part,B=m.audio,F=m.text,z=m.id3,Q=m.initSegment;if(this.fragContextChanged(W))return;if(this.state=M.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),Q!=null&&Q.tracks&&(this._bufferInitSegment(Q.tracks,W,R),g.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:v,tracks:Q.tracks})),B){var ie=B.startPTS,ce=B.endPTS,Ce=B.startDTS,pe=B.endDTS;X&&(X.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:ce,startDTS:Ce,endDTS:pe}),W.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,ie,ce,Ce,pe),this.bufferFragmentData(B,W,X,R)}if(z!=null&&(a=z.samples)!==null&&a!==void 0&&a.length){var Te=s({frag:W,id:v},z);g.trigger(P.Events.FRAG_PARSING_METADATA,Te)}if(F){var se=s({frag:W,id:v},F);g.trigger(P.Events.FRAG_PARSING_USERDATA,se)}},h._bufferInitSegment=function(l,a,v){if(this.state!==M.State.PARSING)return;l.video&&delete l.video;var g=l.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,l);var m=g.initSegment;if(m!=null&&m.byteLength){var R={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:m};this.hls.trigger(P.Events.BUFFER_APPENDING,R)}this.tick()},h.loadFragment=function(l,a,v){var g=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||g===k.FragmentState.NOT_LOADED||g===k.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(K.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=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,l,a,v)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},y}(M.default);G.default=p},"./src/controller/audio-track-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function k(O,C){for(var S=0;S<C.length;S++){var b=C[S];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(O,b.key,b)}}function A(O,C,S){return C&&k(O.prototype,C),S&&k(O,S),O}function _(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,x(O,C)}function x(O,C){return x=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},x(O,C)}var L=function(O){_(C,O);function C(b){var d;return d=O.call(this,b,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var S=C.prototype;return S.registerListeners=function(){var d=this.hls;d.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(K.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(K.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},S.onAudioTrackLoaded=function(d,o){var s=o.id,u=o.details,T=this.tracksInGroup[s];if(!T){this.warn("Invalid audio track id "+s);return}var f=T.details;T.details=o.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,f))},S.onLevelLoading=function(d,o){this.switchLevel(o.level)},S.onLevelSwitching=function(d,o){this.switchLevel(o.level)},S.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!u.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var T={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},S.onError=function(d,o){if(O.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===N.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},S.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],T=u.id,f=u.groupId,p=f===void 0?"":f,w=u.name,y=u.type,h=u.url;if(this.trackId=d,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:p,name:w,type:y,url:h}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},S.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(d){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var u=o[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},S.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,u=o.groupId,T=o.url;if(d)try{T=d.addDirectives(T)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:T,id:s,groupId:u,deliveryDirectives:d||null})}},A(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}(P.default);G.default=L},"./src/controller/base-playlist-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return A});var K=D("./src/polyfills/number.ts"),M=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),N=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),A=function(){function _(L,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=N.logger.log.bind(N.logger,O+":"),this.warn=N.logger.warn.bind(N.logger,O+":"),this.hls=L}var x=_.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(O,C){C.fatal&&C.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(O,C){var S=C==null?void 0:C.renditionReports;if(S)for(var b=0;b<S.length;b++){var d=S[b],o=""+d.URI;if(o===O.substr(-o.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var T=Math.min(C.age-C.partTarget,C.targetduration);u!==void 0&&T>C.partTarget&&(u+=1)}if(Object(K.isFiniteNumber)(s))return new M.HlsUrlParameters(s,Object(K.isFiniteNumber)(u)?u:void 0,M.HlsSkip.No)}}},x.loadPlaylist=function(O){},x.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},x.playlistLoaded=function(O,C,S){var b=this,d=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||S!=null&&S.live){if(d.reloaded(S),S&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),S&&d.fragments.length>0&&Object(P.mergeDetails)(S,d),!this.canLoad||!d.live)return;var u,T=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var p=this.hls.config.lowLatencyMode,w=d.lastPartSn,y=d.endSN,h=d.lastPartIndex,c=h!==-1,l=w===y,a=p?0:h;c?(T=l?y+1:w,f=l?a:h+1):T=y+1;var v=d.age,g=v+d.ageHeader,m=Math.min(g-d.partTarget,d.targetduration*1.5);if(m>0){if(S&&m>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+m+" with playlist age: "+d.age),m=0;else{var R=Math.floor(m/d.targetduration);if(T+=R,f!==void 0){var U=Math.round(m%d.targetduration/d.partTarget);f+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+m+" skip sn "+R+" to part "+f)}d.tuneInGoal=m}if(u=this.getDeliveryDirectives(d,C.deliveryDirectives,T,f),p||!l){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,C.deliveryDirectives,T,f);var W=Object(P.computeReloadInterval)(d,o);T!==void 0&&d.canBlockReload&&(W-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(u)},W)}else this.clearTimer()},x.getDeliveryDirectives=function(O,C,S,b){var d=Object(M.getSkipValue)(O,S);return C!=null&&C.skip&&O.deltaUpdateFailed&&(S=C.msn,b=C.part,d=M.HlsSkip.No),new M.HlsUrlParameters(S,b,d)},x.retryLoadingOrFail=function(O){var C=this,S=this.hls.config,b=this.retryCount<S.levelLoadingMaxRetry;if(b){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)*S.levelLoadingRetryDelay,S.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 b},_}()},"./src/controller/base-stream-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"State",function(){return y}),D.d(G,"default",function(){return h});var K=D("./src/polyfills/number.ts"),M=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),N=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/logger.ts"),A=D("./src/events.ts"),_=D("./src/errors.ts"),x=D("./src/types/transmuxer.ts"),L=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/discontinuities.ts"),C=D("./src/controller/fragment-finders.ts"),S=D("./src/controller/level-helper.ts"),b=D("./src/loader/fragment-loader.ts"),d=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function u(c,l){for(var a=0;a<l.length;a++){var v=l[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function T(c,l,a){return l&&u(c.prototype,l),a&&u(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function p(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,w(c,l)}function w(c,l){return w=Object.setPrototypeOf||function(v,g){return v.__proto__=g,v},w(c,l)}var y={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){p(l,c);function l(v,g,m){var R;return R=c.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=y.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=m,R.log=k.logger.log.bind(k.logger,m+":"),R.warn=k.logger.warn.bind(k.logger,m+":"),R.hls=v,R.fragmentLoader=new b.default(v.config),R.fragmentTracker=g,R.config=v.config,R.decrypter=new d.default(v,v.config),v.on(A.Events.KEY_LOADED,R.onKeyLoaded,f(R)),R}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(g,m){var R=this.fragCurrent,U=this.fragmentTracker;if(!m.live&&R&&R.sn===m.endSN&&!g.nextStart){var W=U.getState(R);return W===P.FragmentState.PARTIAL||W===P.FragmentState.OK}return!1},a.onMediaAttached=function(g,m){var R=this.media=this.mediaBuffer=m.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var g=this.config,m=this.fragCurrent,R=this.media,U=this.mediaBuffer,W=this.state,X=R?R.currentTime:0,B=N.BufferHelper.bufferInfo(U||R,X,g.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(X)?X.toFixed(3):X)+", state: "+W),W===y.ENDED)this.resetLoadingState();else if(m&&!B.len){var F=g.maxFragLookUpTolerance,z=m.start-F,Q=m.start+m.duration+F,ie=X>Q;(X<z||ie)&&(ie&&m.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),m.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=X),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=X),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,m){if(this.state!==y.KEY_LOADING||m.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var R=this.levels[m.frag.level].details;R&&this.loadFragment(m.frag,R,m.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(A.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,m){this.log("Loading key for "+g.sn+" of ["+m.startSN+"-"+m.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=y.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(A.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,m,R){this._loadFragForPlayback(g,m,R)},a._loadFragForPlayback=function(g,m,R){var U=this,W=function(B){if(U.fragContextChanged(g)){U.warn("Fragment "+g.sn+(B.part?" p: "+B.part.index:"")+" of level "+g.level+" was dropped during download."),U.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,U._handleFragmentLoadProgress(B)};this._doFragLoad(g,m,R,W).then(function(X){if(!X)return;U.fragLoadError=0;var B=U.state;if(U.fragContextChanged(g)){(B===y.FRAG_LOADING||B===y.BACKTRACKING||!U.fragCurrent&&B===y.PARSING)&&(U.fragmentTracker.removeFragment(g),U.state=y.IDLE);return}if("payload"in X&&(U.log("Loaded fragment "+g.sn+" of level "+g.level),U.hls.trigger(A.Events.FRAG_LOADED,X),U.state===y.BACKTRACKING)){U.fragmentTracker.backtrack(g,X),U.resetFragmentLoading(g);return}U._handleFragmentLoadComplete(X)}).catch(function(X){U.warn(X),U.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,m,R){if(R===void 0&&(R=null),!(g-m))return;var U={startOffset:g,endOffset:m,type:R};this.fragLoadError=0,this.hls.trigger(A.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(g){var m=this;this._doFragLoad(g).then(function(R){if(!R||m.fragContextChanged(g)||!m.levels)throw new Error("init load aborted");return R}).then(function(R){var U=m.hls,W=R.payload,X=g.decryptdata;if(W&&W.byteLength>0&&X&&X.key&&X.iv&&X.method==="AES-128"){var B=self.performance.now();return m.decrypter.webCryptoDecrypt(new Uint8Array(W),X.key.buffer,X.iv.buffer).then(function(F){var z=self.performance.now();return U.trigger(A.Events.FRAG_DECRYPTED,{frag:g,payload:F,stats:{tstart:B,tdecrypt:z}}),R.payload=F,R})}return R}).then(function(R){var U=m.fragCurrent,W=m.hls,X=m.levels;if(!X)throw new Error("init load aborted, missing levels");var B=X[g.level].details;console.assert(B,"Level details are defined when init segment is loaded");var F=g.stats;m.state=y.IDLE,m.fragLoadError=0,g.data=new Uint8Array(R.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),R.frag===U&&W.trigger(A.Events.FRAG_BUFFERED,{stats:F,frag:U,part:null,id:g.type}),m.tick()}).catch(function(R){m.warn(R),m.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var m=this.fragCurrent;return!g||!m||g.level!==m.level||g.sn!==m.sn||g.urlId!==m.urlId},a.fragBufferedComplete=function(g,m){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(m?" part: "+m.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(N.BufferHelper.getBuffered(R))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var m=this.transmuxer;if(!m)return;var R=g.frag,U=g.part,W=g.partsLoaded,X=!W||W.length===0||W.some(function(F){return!F}),B=new x.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,U?U.index:-1,!X);m.flush(B)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,m,R,U){var W=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(g.start,R||0),this.config.lowLatencyMode&&m){var X=m.partList;if(X&&U){R>g.end&&m.fragmentHint&&(g=m.fragmentHint);var B=this.getNextPart(X,g,R);if(B>-1){var F=X[B];return this.log("Loading part sn: "+g.sn+" p: "+F.index+" cc: "+g.cc+" of playlist ["+m.startSN+"-"+m.endSN+"] parts [0-"+B+"-"+(X.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=y.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:g,part:X[B],targetBufferTime:R}),this.doFragPartsLoad(g,X,B,U).catch(function(z){return W.handleFragLoadError(z)})}else if(!g.url||this.loadedEndOfParts(X,R))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(m?"of ["+m.startSN+"-"+m.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(R.toFixed(3))),Object(K.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=y.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:g,targetBufferTime:R}),this.fragmentLoader.load(g,U).catch(function(z){return W.handleFragLoadError(z)})},a.doFragPartsLoad=function(g,m,R,U){var W=this;return new Promise(function(X,B){var F=[],z=function Q(ie){var ce=m[ie];W.fragmentLoader.loadPart(g,ce,U).then(function(Ce){F[ce.index]=Ce;var pe=Ce.part;W.hls.trigger(A.Events.FRAG_LOADED,Ce);var Te=m[ie+1];if(Te&&Te.fragment===g)Q(ie+1);else return X({frag:g,part:pe,partsLoaded:F})}).catch(B)};z(R)})},a.handleFragLoadError=function(g){var m=g.data;return m&&m.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(m.frag,m.part):this.hls.trigger(A.Events.ERROR,m),null},a._handleTransmuxerFlush=function(g){var m=this.getCurrentContext(g);if(!m||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var R=m.frag,U=m.part,W=m.level,X=self.performance.now();R.stats.parsing.end=X,U&&(U.stats.parsing.end=X),this.updateLevelTiming(R,U,W,g.partial)},a.getCurrentContext=function(g){var m=this.levels,R=g.level,U=g.sn,W=g.part;if(!m||!m[R])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+R+". The current chunk will not be buffered."),null;var X=m[R],B=W>-1?Object(S.getPartWith)(X,U,W):null,F=B?B.fragment:Object(S.getFragmentWithSN)(X,U,this.fragCurrent);return F?{frag:F,part:B,level:X}:null},a.bufferFragmentData=function(g,m,R,U){if(!g||this.state!==y.PARSING)return;var W=g.data1,X=g.data2,B=W;if(W&&X&&(B=Object(L.appendUint8Array)(W,X)),!B||!B.length)return;var F={type:g.type,frag:m,part:R,chunkMeta:U,parent:m.type,data:B};this.hls.trigger(A.Events.BUFFER_APPENDING,F),g.dropped&&g.independent&&!R&&this.flushBufferGap(m)},a.flushBufferGap=function(g){var m=this.media;if(!m)return;if(!N.BufferHelper.isBuffered(m,m.currentTime)){this.flushMainBuffer(0,g.start);return}var R=m.currentTime,U=N.BufferHelper.bufferInfo(m,R,0),W=g.duration,X=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),B=Math.max(Math.min(g.start-X,U.end-X),R+X);g.start-B>X&&this.flushMainBuffer(B,g.start)},a.getFwdBufferInfo=function(g,m){var R=this.config,U=this.getLoadPosition();if(!Object(K.isFiniteNumber)(U))return null;var W=N.BufferHelper.bufferInfo(g,U,R.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var X=this.fragmentTracker.getBufferedFrag(U,m);if(X&&W.nextStart<X.end)return N.BufferHelper.bufferInfo(g,U,Math.max(W.nextStart,R.maxBufferHole))}return W},a.getMaxBufferLength=function(g){var m=this.config,R;return g?R=Math.max(8*m.maxBufferSize/g,m.maxBufferLength):R=m.maxBufferLength,Math.min(R,m.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var m=this.config,R=g||m.maxBufferLength;return m.maxMaxBufferLength>=R?(m.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+m.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,m){var R,U,W=m.fragments,X=W.length;if(!X)return null;var B=this.config,F=W[0].start,z;if(m.live){var Q=B.initialLiveManifestSize;if(X<Q)return this.warn("Not enough fragments to start playback (have: "+X+", need: "+Q+")"),null;!m.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(z=this.getInitialLiveFragment(m,W),this.startPosition=z?this.hls.liveSyncPosition||z.start:g)}else g<=F&&(z=W[0]);if(!z){var ie=B.lowLatencyMode?m.partEnd:m.fragmentEnd;z=this.getFragmentAtPosition(g,ie,m)}return(R=z)!==null&&R!==void 0&&R.initSegment&&!((U=z)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(z=z.initSegment),z},a.getNextPart=function(g,m,R){for(var U=-1,W=!1,X=!0,B=0,F=g.length;B<F;B++){var z=g[B];if(X=X&&!z.independent,U>-1&&R<z.start)break;var Q=z.loaded;!Q&&(W||z.independent||X)&&z.fragment===m&&(U=B),W=Q}return U},a.loadedEndOfParts=function(g,m){var R=g[g.length-1];return R&&m>R.start&&R.loaded},a.getInitialLiveFragment=function(g,m){var R=this.fragPrevious,U=null;if(R){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),U=Object(C.findFragmentByPDT)(m,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var W=R.sn+1;if(W>=g.startSN&&W<=g.endSN){var X=m[W-g.startSN];R.cc===X.cc&&(U=X,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(C.findFragWithCC)(m,R.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(U=this.getFragmentAtPosition(B,this.bitrateTest?g.fragmentEnd:g.edge,g))}return U},a.getFragmentAtPosition=function(g,m,R){var U=this.config,W=this.fragPrevious,X=R.fragments,B=R.endSN,F=R.fragmentHint,z=U.maxFragLookUpTolerance,Q=!!(U.lowLatencyMode&&R.partList&&F);Q&&F&&!this.bitrateTest&&(X=X.concat(F),B=F.sn);var ie;if(g<m){var ce=g>m-z?0:z;ie=Object(C.findFragmentByPTS)(W,X,g,ce)}else ie=X[X.length-1];if(ie){var Ce=ie.sn-R.startSN,pe=W&&ie.level===W.level,Te=X[Ce+1],se=this.fragmentTracker.getState(ie);if(se===P.FragmentState.BACKTRACKED){ie=null;for(var de=Ce;X[de]&&this.fragmentTracker.getState(X[de])===P.FragmentState.BACKTRACKED;)W?ie=X[de--]:ie=X[--de];ie||(ie=Te)}else W&&ie.sn===W.sn&&!Q&&(pe&&(ie.sn<B&&this.fragmentTracker.getState(Te)!==P.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+Te.sn),ie=Te):ie=null))}return ie},a.synchronizeToLiveEdge=function(g){var m=this.config,R=this.media;if(!R)return;var U=this.hls.liveSyncPosition,W=R.currentTime,X=g.fragments[0].start,B=g.edge,F=W>=X-m.maxFragLookUpTolerance&&W<=B;if(U!==null&&R.duration>U&&(W<U||!F)){var z=m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:m.liveMaxLatencyDurationCount*g.targetduration;(!F&&R.readyState<4||W<B-z)&&(this.loadedmetadata||(this.nextLoadPosition=U),R.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+U.toFixed(3)),R.currentTime=U))}},a.alignPlaylists=function(g,m){var R=this.levels,U=this.levelLastLoaded,W=this.fragPrevious,X=U!==null?R[U]:null,B=g.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var F=g.fragments[0].start,z=!m,Q=g.alignedSliding&&Object(K.isFiniteNumber)(F);if(z||!Q&&!F){Object(O.alignStream)(W,X,g);var ie=g.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(m?m.startSN:"na")+"->"+g.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+B),ie}return F},a.waitForCdnTuneIn=function(g){var m=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*m)},a.setStartPosition=function(g,m){var R=this.startPosition;if(R<m&&(R=-1),R===-1||this.lastCurrentTime===-1){var U=g.startTimeOffset;Object(K.isFiniteNumber)(U)?(R=m+U,U<0&&(R+=g.totalduration),R=Math.min(Math.max(m,R),m+g.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+R),this.startPosition=R):g.live?R=this.hls.liveSyncPosition||m:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},a.getLoadPosition=function(){var g=this.media,m=0;return this.loadedmetadata&&g?m=g.currentTime:this.nextLoadPosition&&(m=this.nextLoadPosition),m},a.handleFragLoadAborted=function(g,m){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(m?" part"+m.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(g,m){if(m.fatal)return;var R=m.frag;if(!R||R.type!==g)return;var U=this.fragCurrent;console.assert(U&&R.sn===U.sn&&R.level===U.level&&R.urlId===U.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var X=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+g+" "+R.level+" failed to load, retrying in "+X+"ms"),this.retryDate=self.performance.now()+X,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else m.levelRetry?(g===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(k.logger.error(m.details+" reaches max retry, redispatch as fatal ..."),m.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(g,m,R){if(!g)return;var U=N.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(m,U,R),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var m=this.levels?this.levels[g].details:null;if(m!=null&&m.live)return this.startPosition=-1,this.setStartPosition(m,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(g,m,R,U){var W=this,X=R.details;console.assert(!!X,"level.details must be defined");var B=Object.keys(g.elementaryStreams).reduce(function(F,z){var Q=g.elementaryStreams[z];if(Q){var ie=Q.endPTS-Q.startPTS;if(ie<=0)return W.warn("Could not parse fragment "+g.sn+" "+z+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),F||!1;var ce=U?0:Object(S.updateFragPTSDTS)(X,g,Q.startPTS,Q.endPTS,Q.startDTS,Q.endDTS);return W.hls.trigger(A.Events.LEVEL_PTS_UPDATED,{details:X,level:R,drift:ce,type:z,frag:g,start:Q.startPTS,end:Q.endPTS}),!0}return F},!1);B?(this.state=y.PARSED,this.hls.trigger(A.Events.FRAG_PARSED,{frag:g,part:m})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(l,[{key:"state",get:function(){return this._state},set:function(g){var m=this._state;m!==g&&(this._state=g,this.log(m+"->"+g))}}]),l}(M.default)},"./src/controller/buffer-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C});var K=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),P=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),k=D("./src/utils/buffer-helper.ts"),A=D("./src/utils/mediasource-helper.ts"),_=D("./src/loader/fragment.ts"),x=D("./src/controller/buffer-operation-queue.ts"),L=Object(A.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function S(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,u=o.media,T=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),s.trigger(M.Events.MEDIA_ATTACHED,{media:u})),T&&T.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=S.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var o=this.hls;o.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(M.Events.BUFFER_RESET,this.onBufferReset,this),o.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(M.Events.BUFFER_EOS,this.onBufferEos,this),o.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(M.Events.FRAG_PARSED,this.onFragParsed,this),o.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(M.Events.BUFFER_RESET,this.onBufferReset,this),o.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(M.Events.BUFFER_EOS,this.onBufferEos,this),o.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(M.Events.FRAG_PARSED,this.onFragParsed,this),o.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(o,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(o,s){var u=this.media=s.media;if(u&&L){var T=this.mediaSource=new L;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(T),this._objectUrl=u.src}},b.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(T){P.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(M.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var u=o.sourceBuffer[s];try{u&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[s]=void 0)}catch(T){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",T)}}),this._initSourceBuffer()},b.onBufferCodecs=function(o,s){var u=this,T=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(T){var p=u.tracks[f];if(p&&typeof p.buffer.changeType=="function"){var w=s[f],y=w.codec,h=w.levelCodec,c=w.container,l=(p.levelCodec||p.codec).replace(O,"$1"),a=(h||y).replace(O,"$1");if(l!==a){var v=c+";codecs="+(h||y);u.appendChangeType(f,v)}}}else u.pendingTracks[f]=s[f]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(o,s){var u=this,T=this.operationQueue,f={execute:function(){var w=u.sourceBuffer[o];w&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),w.changeType(s)),T.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};T.append(f,o)},b.onBufferAppending=function(o,s){var u=this,T=this.hls,f=this.operationQueue,p=this.tracks,w=s.data,y=s.type,h=s.frag,c=s.part,l=s.chunkMeta,a=l.buffering[y],v=self.performance.now();a.start=v;var g=h.stats.buffering,m=c?c.stats.buffering:null;g.start===0&&(g.start=v),m&&m.start===0&&(m.start=v);var R=p.audio,U=y==="audio"&&l.id===1&&(R==null?void 0:R.container)==="audio/mpeg",W={execute:function(){if(a.executeStart=self.performance.now(),U){var B=u.sourceBuffer[y];if(B){var F=h.start-B.timestampOffset;Math.abs(F)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+F+") sn: "+h.sn+")"),B.timestampOffset=h.start)}}u.appendExecutor(w,y)},onStart:function(){},onComplete:function(){var B=self.performance.now();a.executeEnd=a.end=B,g.first===0&&(g.first=B),m&&m.first===0&&(m.first=B);var F=u.sourceBuffer,z={};for(var Q in F)z[Q]=k.BufferHelper.getBuffered(F[Q]);u.appendError=0,u.hls.trigger(M.Events.BUFFER_APPENDED,{type:y,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:z})},onError:function(B){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",B);var F={type:N.ErrorTypes.MEDIA_ERROR,parent:h.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=N.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,F.details=N.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>T.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),T.trigger(M.Events.ERROR,F)}};f.append(W,y)},b.onBufferFlushing=function(o,s){var u=this,T=this.operationQueue,f=function(w){return{execute:u.removeExecutor.bind(u,w,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(M.Events.BUFFER_FLUSHED,{type:w})},onError:function(h){P.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",h)}}};s.type?T.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(p){T.append(f(p),p)})},b.onFragParsed=function(o,s){var u=this,T=s.frag,f=s.part,p=[],w=f?f.elementaryStreams:T.elementaryStreams;w[_.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(w[_.ElementaryStreamTypes.AUDIO]&&p.push("audio"),w[_.ElementaryStreamTypes.VIDEO]&&p.push("video"));var y=function(){var c=self.performance.now();T.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var l=f?f.stats:T.stats;u.hls.trigger(M.Events.FRAG_BUFFERED,{frag:T,part:f,stats:l,id:T.type})};p.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(y,p)},b.onFragChanged=function(o,s){this.flushBackBuffer()},b.onBufferEos=function(o,s){var u=this,T=this.getSourceBufferTypes().reduce(function(f,p){var w=u.sourceBuffer[p];return(!s.type||s.type===p)&&(w&&!w.ended&&(w.ended=!0,P.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),f&&!!(!w||w.ended)},!0);T&&this.blockBuffers(function(){var f=u.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},b.onLevelUpdated=function(o,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var o=this.hls,s=this.details,u=this.media,T=this.sourceBuffer;if(!u||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var p=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(K.isFiniteNumber)(p)||p<0)return;var w=u.currentTime,y=s.levelTargetDuration,h=Math.max(p,y),c=Math.floor(w/y)*y-h;f.forEach(function(l){var a=T[l];if(a){var v=k.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,u=this.media,T=this.mediaSource,f=o.fragments[0].start+o.totalduration,p=u.duration,w=Object(K.isFiniteNumber)(T.duration)?T.duration:0;o.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(o)):(f>w&&f>p||!Object(K.isFiniteNumber)(p))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),T.duration=f)},b.updateSeekableRange=function(o){var s=this.mediaSource,u=o.fragments,T=u.length;if(T&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,u[0].start),p=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,p)}},b.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,T=Object.keys(u).length;if(T&&!o||T===2){this.createSourceBuffers(u),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(p){s.executeNext(p)})}},b.createSourceBuffers=function(o){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var f in o)if(!s[f]){var p=o[f];if(!p)throw Error("source buffer exists for track "+f+", however track does not");var w=p.levelCodec||p.codec,y=p.container+";codecs="+w;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var h=s[f]=u.addSourceBuffer(y),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:w,container:p.container,levelCodec:p.levelCodec,id:p.id},T++}catch(l){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:y})}}T&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(o){var s=this.operationQueue,u=s.current(o);u.onStart()},b._onSBUpdateEnd=function(o){var s=this.operationQueue,u=s.current(o);u.onComplete(),s.shiftAndExecuteNext(o)},b._onSBUpdateError=function(o,s){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(s)},b.removeExecutor=function(o,s,u){var T=this.media,f=this.mediaSource,p=this.operationQueue,w=this.sourceBuffer,y=w[o];if(!T||!f||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var h=Object(K.isFiniteNumber)(T.duration)?T.duration:Infinity,c=Object(K.isFiniteNumber)(f.duration)?f.duration:Infinity,l=Math.max(0,s),a=Math.min(u,h,c);a>l?(P.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(l,a)):p.shiftAndExecuteNext(o)},b.appendExecutor=function(o,s){var u=this.operationQueue,T=this.sourceBuffer,f=T[s];if(!f){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(o)},b.blockBuffers=function(o,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var T=this.operationQueue,f=s.map(function(p){return T.appendBlocker(p)});Promise.all(f).then(function(){o(),s.forEach(function(p){var w=u.sourceBuffer[p];(!w||!w.updating)&&T.shiftAndExecuteNext(p)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(o,s,u){var T=this.sourceBuffer[o];if(!T)return;var f=u.bind(this,o);this.listeners[o].push({event:s,listener:f}),T.addEventListener(s,f)},b.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(u){s.removeEventListener(u.event,u.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return M});var K=D("./src/utils/logger.ts"),M=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var N=P.prototype;return N.append=function(A,_){var x=this.queues[_];x.push(A),x.length===1&&this.buffers[_]&&this.executeNext(_)},N.insertAbort=function(A,_){var x=this.queues[_];x.unshift(A),this.executeNext(_)},N.appendBlocker=function(A){var _,x=new Promise(function(O){_=O}),L={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(L,A),x},N.executeNext=function(A){var _=this.buffers,x=this.queues,L=_[A],O=x[A];if(O.length){var C=O[0];try{C.execute()}catch(S){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(S),(!L||!L.updating)&&(O.shift(),this.executeNext(A))}}},N.shiftAndExecuteNext=function(A){this.queues[A].shift(),this.executeNext(A)},N.current=function(A){return this.queues[A][0]},P}()},"./src/controller/cap-level-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/events.ts");function M(k,A){for(var _=0;_<A.length;_++){var x=A[_];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(k,x.key,x)}}function P(k,A,_){return A&&M(k.prototype,A),_&&M(k,_),k}var N=function(){function k(_){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=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var A=k.prototype;return A.setStreamController=function(x){this.streamController=x},A.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},A.registerListeners=function(){var x=this.hls;x.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.unregisterListener=function(){var x=this.hls;x.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.onFpsDropLevelCapping=function(x,L){k.isLevelAllowed(L.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(L.droppedLevel)},A.onMediaAttaching=function(x,L){this.media=L.media instanceof HTMLVideoElement?L.media:null},A.onManifestParsed=function(x,L){var O=this.hls;this.restrictedLevels=[],this.firstLevel=L.firstLevel,O.config.capLevelToPlayerSize&&L.video&&this.startCapping()},A.onBufferCodecs=function(x,L){var O=this.hls;O.config.capLevelToPlayerSize&&L.video&&this.startCapping()},A.onMediaDetaching=function(){this.stopCapping()},A.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var L=this.hls;L.autoLevelCapping=this.getMaxLevel(x.length-1),L.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=L.autoLevelCapping}}},A.getMaxLevel=function(x){var L=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(S,b){return k.isLevelAllowed(b,L.restrictedLevels)&&b<=x});return this.clientRect=null,k.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},A.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()},A.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},A.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,L={width:0,height:0};if(x){var O=x.getBoundingClientRect();L.width=O.width,L.height=O.height,!L.width&&!L.height&&(L.width=O.right-O.left||x.width||0,L.height=O.bottom-O.top||x.height||0)}return this.clientRect=L,L},k.isLevelAllowed=function(x,L){return L===void 0&&(L=[]),L.indexOf(x)===-1},k.getMaxLevelByMediaSize=function(x,L,O){if(!x||!x.length)return-1;for(var C=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},S=x.length-1,b=0;b<x.length;b+=1){var d=x[b];if((d.width>=L||d.height>=O)&&C(d,x[b+1])){S=b;break}}return S},P(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(L){}return x}}]),k}();G.default=N},"./src/controller/cmcd-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C});var K=D("./src/events.ts"),M=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),N=D("./src/utils/logger.ts");function k(S,b){for(var d=0;d<b.length;d++){var o=b[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function A(S,b,d){return b&&k(S.prototype,b),d&&k(S,d),S}function _(S,b){var d=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(d)return(d=d.call(S)).next.bind(d);if(Array.isArray(S)||(d=x(S))||b&&S&&typeof S.length=="number"){d&&(S=d);var o=0;return function(){return o>=S.length?{done:!0}:{done:!1,value:S[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 x(S,b){if(!S)return;if(typeof S=="string")return L(S,b);var d=Object.prototype.toString.call(S).slice(8,-1);if(d==="Object"&&S.constructor&&(d=S.constructor.name),d==="Map"||d==="Set")return Array.from(S);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return L(S,b)}function L(S,b){(b==null||b>S.length)&&(b=S.length);for(var d=0,o=new Array(b);d<b;d++)o[d]=S[d];return o}function O(){return O=Object.assign||function(S){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(S[o]=d[o])}return S},O.apply(this,arguments)}var C=function(){function S(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(T){try{o.apply(T,{ot:M.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){N.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(T){try{var f=T.frag,p=o.hls.levels[f.level],w=o.getObjectType(f),y={d:f.duration*1e3,ot:w};(w===M.CMCDObjectType.VIDEO||w===M.CMCDObjectType.AUDIO||w==M.CMCDObjectType.MUXED)&&(y.br=p.bitrate/1e3,y.tb=o.getTopBandwidth(w),y.bl=o.getBufferLength(w)),o.apply(T,y)}catch(h){N.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||S.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var b=S.prototype;return b.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(o,s){var u,T;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(T=s.tracks.video)===null||T===void 0?void 0:T.buffer},b.createData=function(){var o;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(o,s){s===void 0&&(s={}),O(s,this.createData());var u=s.ot===M.CMCDObjectType.INIT||s.ot===M.CMCDObjectType.VIDEO||s.ot===M.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var T=S.toHeaders(s);if(!Object.keys(T).length)return;o.headers||(o.headers={}),O(o.headers,T)}else{var f=S.toQuery(s);if(!f)return;o.url=S.appendQueryToUri(o.url,f)}},b.getObjectType=function(o){var s=o.type;return s==="subtitle"?M.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?M.CMCDObjectType.INIT:s==="audio"?M.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(o){for(var s=0,u=o===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=_(u),f;!(f=T()).done;){var p=f.value;p.bitrate>s&&(s=p.bitrate)}return s>0?s:NaN},b.getBufferLength=function(o){var s=this.hls.media,u=o===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var T=P.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return T.len*1e3},b.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,u=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new u(p)}var f=T.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,y,h){s(w),this.loader.load(w,y,h)},A(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},b.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,u=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new u(p)}var f=T.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,y,h){s(w),this.loader.load(w,y,h)},A(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},S.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},S.serialize=function(o){for(var s=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},T=function(U){return Math.round(U)},f=function(U){return T(U/100)*100},p=function(U){return encodeURIComponent(U)},w={br:T,d:T,bl:f,dl:f,mtp:f,nor:p,rtp:f,tb:T},y=Object.keys(o||{}).sort(),h=_(y),c;!(c=h()).done;){var l=c.value,a=o[l];if(!u(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var v=w[l];v&&(a=v(a));var g=typeof a,m=void 0;l==="ot"||l==="sf"||l==="st"?m=l+"="+a:g==="boolean"?m=l:g==="number"?m=l+"="+a:m=l+"="+JSON.stringify(a),s.push(m)}return s.join(",")},S.toHeaders=function(o){for(var s=Object.keys(o),u={},T=["Object","Request","Session","Status"],f=[{},{},{},{}],p={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},w=0,y=s;w<y.length;w++){var h=y[w],c=p[h]!=null?p[h]:1;f[c][h]=o[h]}for(var l=0;l<f.length;l++){var a=S.serialize(f[l]);a&&(u["CMCD-"+T[l]]=a)}return u},S.toQuery=function(o){return"CMCD="+encodeURIComponent(S.serialize(o))},S.appendQueryToUri=function(o,s){if(!s)return o;var u=o.includes("?")?"&":"?";return""+o+u+s},S}()},"./src/controller/eme-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),N=D("./src/utils/mediakeys-helper.ts");function k(C,S){for(var b=0;b<S.length;b++){var d=S[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function A(C,S,b){return S&&k(C.prototype,S),b&&k(C,b),C}var _=3,x=function(S,b,d){var o={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),b.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[o]},L=function(S,b,d,o){switch(S){case N.KeySystems.WIDEVINE:return x(b,d,o);default:throw new Error("Unknown key-system: "+S)}},O=function(){function C(b){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=b,this._config=b.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var S=C.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(d){switch(d){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},S._attemptKeySystemAccess=function(d,o,s){var u=this,T=L(d,o,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,T);this.mediaKeysPromise=f.then(function(p){return u._onMediaKeySystemAccessObtained(d,p)}),f.catch(function(p){P.logger.error('Failed to obtain key-system "'+d+'" access:',p)})},S._onMediaKeySystemAccessObtained=function(d,o){var s=this;P.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var T=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return u.mediaKeys=f,P.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),f});return T.catch(function(f){P.logger.error("Failed to create media-keys:",f)}),T},S._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},S._onNewMediaKeySession=function(d){var o=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){o._onKeySessionMessage(d,s.message)},!1)},S._onKeySessionMessage=function(d,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},S.onMediaEncrypted=function(d){var o=this;if(P.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(T){if(!o._media)return;o._attemptSetMediaKeys(T),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},S._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){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(d,o){var s=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var T=u.mediaKeysSession;if(!T){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,T.generateRequest(d,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(f){P.logger.error("Error generating key-session request:",f),s.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(d,o,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,s);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,u,d),T=void 0}catch(f){P.logger.error(f)}try{u.readyState||u.open("POST",d,!0),T&&T.call(this.hls,u,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return u},S._onLicenseRequestReadyStageChange=function(d,o,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var T=d.response,f=this._licenseResponseCallback;if(f)try{T=f.call(this.hls,d,o)}catch(w){P.logger.error(w)}u(T)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=_-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(s,u)}break}},S._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},S._requestLicense=function(d,o){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),T=this._createLicenseXhr(u,d,o);P.logger.log("Sending license request to URL: "+u);var f=this._generateLicenseRequestChallenge(s,d);T.send(f)}catch(p){P.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var s=o.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),u=o.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,s,u)},A(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();G.default=O},"./src/controller/fps-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),M=D("./src/utils/logger.ts"),P=function(){function N(A){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=A,this.registerListeners()}var k=N.prototype;return k.setStreamController=function(_){this.streamController=_},k.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(_,x){var L=this.hls.config;if(L.capLevelOnFPSDrop){var O=x.media instanceof self.HTMLVideoElement?x.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),L.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(_,x,L){var O=performance.now();if(x){if(this.lastTime){var C=O-this.lastTime,S=L-this.lastDroppedFrames,b=x-this.lastDecodedFrames,d=1e3*S/C,o=this.hls;if(o.trigger(K.Events.FPS_DROP,{currentDropped:S,currentDecoded:b,totalDroppedFrames:L}),d>0&&S>o.config.fpsDroppedMonitoringThreshold*b){var s=o.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=L,this.lastDecodedFrames=x}},k.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var x=_.getVideoPlaybackQuality();this.checkFPS(_,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},N}();G.default=P},"./src/controller/fragment-finders.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"findFragmentByPDT",function(){return P}),D.d(G,"findFragmentByPTS",function(){return N}),D.d(G,"fragmentWithinToleranceTest",function(){return k}),D.d(G,"pdtWithinToleranceTest",function(){return A}),D.d(G,"findFragWithCC",function(){return _});var K=D("./src/polyfills/number.ts"),M=D("./src/utils/binary-search.ts");function P(x,L,O){if(L===null||!Array.isArray(x)||!x.length||!Object(K.isFiniteNumber)(L))return null;var C=x[0].programDateTime;if(L<(C||0))return null;var S=x[x.length-1].endProgramDateTime;if(L>=(S||0))return null;O=O||0;for(var b=0;b<x.length;++b){var d=x[b];if(A(L,O,d))return d}return null}function N(x,L,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var S=null;if(x?S=L[x.sn-L[0].sn+1]||null:O===0&&L[0].start===0&&(S=L[0]),S&&k(O,C,S)===0)return S;var b=M.default.search(L,k.bind(null,O,C));return b||S}function k(x,L,O){x===void 0&&(x=0),L===void 0&&(L=0);var C=Math.min(L,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=x?1:O.start-C>x&&O.start?-1:0}function A(x,L,O){var C=Math.min(L,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,S=O.endProgramDateTime||0;return S-C>x}function _(x,L){return M.default.search(x,function(O){return O.cc<L?1:O.cc>L?-1:0})}},"./src/controller/fragment-tracker.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"FragmentState",function(){return P}),D.d(G,"FragmentTracker",function(){return N});var K=D("./src/events.ts"),M=D("./src/types/loader.ts"),P;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(P||(P={}));var N=function(){function _(L){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=L,this._registerListeners()}var x=_.prototype;return x._registerListeners=function(){var O=this.hls;O.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var O=this.hls;O.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(O,C){if(C===M.PlaylistLevelType.MAIN){var S=this.activeFragment,b=this.activeParts;if(!S)return null;if(b)for(var d=b.length;d--;){var o=b[d],s=o?o.end:S.appendedPTS;if(o.start<=O&&s!==void 0&&O<=s)return d>9&&(this.activeParts=b.slice(d-9)),o}else if(S.start<=O&&S.appendedPTS!==void 0&&O<=S.appendedPTS)return S}return this.getBufferedFrag(O,C)},x.getBufferedFrag=function(O,C){for(var S=this.fragments,b=Object.keys(S),d=b.length;d--;){var o=S[b[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=O&&O<=s.end)return s}}return null},x.detectEvictedFragments=function(O,C,S){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(!o.buffered){o.body.type===S&&b.removeFragment(o.body);return}var s=o.range[O];if(!s)return;s.time.some(function(u){var T=!b.isTimeBuffered(u.startPTS,u.endPTS,C);return T&&b.removeFragment(o.body),T})})},x.detectPartialFragments=function(O){var C=this,S=this.timeRanges,b=O.frag,d=O.part;if(!S||b.sn==="initSegment")return;var o=A(b),s=this.fragments[o];if(!s)return;Object.keys(S).forEach(function(u){var T=b.elementaryStreams[u];if(!T)return;var f=S[u],p=d!==null||T.partial===!0;s.range[u]=C.getBufferedTimes(b,d,p,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},x.fragBuffered=function(O){var C=A(O),S=this.fragments[C];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},x.getBufferedTimes=function(O,C,S,b){for(var d={time:[],partial:S},o=C?C.start:O.start,s=C?C.end:O.end,u=O.minEndPTS||s,T=O.maxStartPTS||o,f=0;f<b.length;f++){var p=b.start(f)-this.bufferPadding,w=b.end(f)+this.bufferPadding;if(T>=p&&u<=w){d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});break}else if(o<w&&s>p)d.partial=!0,d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});else if(s<=p)break}return d},x.getPartialFragment=function(O){var C=null,S,b,d,o=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(T){var f=u[T];if(!f)return;k(f)&&(b=f.body.start-s,d=f.body.end+s,O>=b&&O<=d&&(S=Math.min(O-b,d-O),o<=S&&(C=f.body,o=S)))}),C},x.getState=function(O){var C=A(O),S=this.fragments[C];return S?S.buffered?k(S)?P.PARTIAL:P.OK:S.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},x.backtrack=function(O,C){var S=A(O),b=this.fragments[S];if(!b||b.backtrack)return null;var d=b.backtrack=C||b.loaded;return b.loaded=null,d},x.getBacktrackData=function(O){var C=A(O),S=this.fragments[C];if(S){var b,d=S.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(O)}return null},x.isTimeBuffered=function(O,C,S){for(var b,d,o=0;o<S.length;o++){if(b=S.start(o)-this.bufferPadding,d=S.end(o)+this.bufferPadding,O>=b&&C<=d)return!0;if(C<=b)return!1}return!1},x.onFragLoaded=function(O,C){var S=C.frag,b=C.part;if(S.sn==="initSegment"||S.bitrateTest||b)return;var d=A(S);this.fragments[d]={body:S,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(O,C){var S=this,b=C.frag,d=C.part,o=C.timeRanges;if(b.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var T=o[u];if(S.detectEvictedFragments(u,T),!d)for(var f=0;f<T.length;f++)b.appendedPTS=Math.max(T.end(f),b.appendedPTS||0)})},x.onFragBuffered=function(O,C){this.detectPartialFragments(C)},x.hasFragment=function(O){var C=A(O);return!!this.fragments[C]},x.removeFragmentsInRange=function(O,C,S){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(o.buffered){var s=o.body;s.type===S&&s.start<C&&s.end>O&&b.removeFragment(s)}})},x.removeFragment=function(O){var C=A(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function k(_){var x,L;return _.buffered&&(((x=_.range.video)===null||x===void 0?void 0:x.partial)||((L=_.range.audio)===null||L===void 0?void 0:L.partial))}function A(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"STALL_MINIMUM_DURATION_MS",function(){return k}),D.d(G,"MAX_START_GAP_JUMP",function(){return A}),D.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),D.d(G,"SKIP_BUFFER_RANGE_START",function(){return x}),D.d(G,"default",function(){return L});var K=D("./src/utils/buffer-helper.ts"),M=D("./src/errors.ts"),P=D("./src/events.ts"),N=D("./src/utils/logger.ts"),k=250,A=2,_=.1,x=.05,L=function(){function O(S,b,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=S,this.media=b,this.fragmentTracker=d,this.hls=o}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(b){var d=this.config,o=this.media,s=this.stalled,u=o.currentTime,T=o.seeking,f=this.seeking&&!T,p=!this.seeking&&T;if(this.seeking=T,u!==b){if(this.moved=!0,s!==null){if(this.stallReported){var w=self.performance.now()-s;N.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!K.BufferHelper.getBuffered(o).length)return;var y=K.BufferHelper.bufferInfo(o,u,0),h=y.len>0,c=y.nextStart||0;if(!h&&!c)return;if(T){var l=y.len>A,a=!c||c-u>A&&!this.fragmentTracker.getPartialFragment(u);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,g=Math.max(c,y.start||0)-u,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=m==null||((v=m.details)===null||v===void 0)?void 0:v.live,U=R?m.details.targetduration*2:A;if(g>0&&g<=U){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(s===null){this.stalled=W;return}var X=W-s;!T&&X>=k&&this._reportStall(y.len);var B=K.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(B,X)},C._tryFixBufferStall=function(b,d){var o=this.config,s=this.fragmentTracker,u=this.media,T=u.currentTime,f=s.getPartialFragment(T);if(f){var p=this._trySkipBufferHole(f);if(p)return}b.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(b){var d=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},C._trySkipBufferHole=function(b){for(var d=this.config,o=this.hls,s=this.media,u=s.currentTime,T=0,f=K.BufferHelper.getBuffered(s),p=0;p<f.length;p++){var w=f.start(p);if(u+d.maxBufferHole>=T&&u<w){var y=Math.max(w+x,s.currentTime+_);return N.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+y),this.moved=!0,this.stalled=null,s.currentTime=y,b&&o.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+y,frag:b}),y}T=f.end(p)}return 0},C._tryNudgeBuffer=function(){var b=this.config,d=this.hls,o=this.media,s=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<b.nudgeMaxRetry){var T=s+u*b.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+s+" to "+T),o.currentTime=T,d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),N=.25,k=function(){function A(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var _=A.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var L=this.hls;L.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),L.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var L=this.hls;L.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),L.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(L,O){this.media=O.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(L){if(!this.media)return;for(var O=0;O<L.length;O++){var C=L[O];if(C.kind==="metadata"&&C.label==="id3")return Object(M.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(L,O){if(!this.media)return;var C=O.frag,S=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<S.length;d++){var o=P.getID3Frames(S[d].data);if(o){var s=S[d].pts,u=d<S.length-1?S[d+1].pts:C.end,T=u-s;T<=0&&(u=s+N);for(var f=0;f<o.length;f++){var p=o[f];if(!P.isTimeStampFrame(p)){var w=new b(s,u,"");w.value=p,this.id3Track.addCue(w)}}}}},_.onBufferFlushing=function(L,O){var C=O.startOffset,S=O.endOffset,b=O.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(M.removeCuesInRange)(d,C,S)}},A}();G.default=k},"./src/controller/latency-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return A});var K=D("./src/errors.ts"),M=D("./src/events.ts"),P=D("./src/utils/logger.ts");function N(_,x){for(var L=0;L<x.length;L++){var O=x[L];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(_,O.key,O)}}function k(_,x,L){return x&&N(_.prototype,x),L&&N(_,L),_}var A=function(){function _(L){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=L,this.config=L.config,this.registerListeners()}var x=_.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(M.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(M.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(M.Events.ERROR,this.onError)},x.onMediaAttached=function(O,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(O,C){var S=C.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(O,C){if(C.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var b=this.config,d=b.lowLatencyMode,o=b.maxLiveSyncPlaybackRate;if(!d||o===1)return;var s=this.targetLatency;if(s===null)return;var u=S-s,T=Math.min(this.maxLatency,s+C.targetduration),f=u<T;if(C.live&&f&&u>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;O.playbackRate=Math.min(p,Math.max(1,w))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},x.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},x.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},k(_,[{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,S=O.partHoldBack,b=O.targetduration,d=this.config,o=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,T=this.hls.userConfig,f=u&&S||C;(T.liveSyncDuration||T.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:s*b);var p=b,w=1;return f+Math.min(this.stallCount*w,p)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,S=this.levelDetails;if(O===null||C===null||S===null)return null;var b=S.edge,d=O-C-this.edgeStalled,o=b-S.totalduration,s=b-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(o,d),s)}},{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 S=O.buffered.length;return S?O.buffered.end(S-1):C.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return d});var K=D("./src/types/level.ts"),M=D("./src/events.ts"),P=D("./src/errors.ts"),N=D("./src/utils/codecs.ts"),k=D("./src/controller/level-helper.ts"),A=D("./src/controller/base-playlist-controller.ts"),_=D("./src/types/loader.ts");function x(){return x=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var T in u)Object.prototype.hasOwnProperty.call(u,T)&&(o[T]=u[T])}return o},x.apply(this,arguments)}function L(o,s){for(var u=0;u<s.length;u++){var T=s[u];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function O(o,s,u){return s&&L(o.prototype,s),u&&L(o,u),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,S(o,s)}function S(o,s){return S=Object.setPrototypeOf||function(T,f){return T.__proto__=f,T},S(o,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(s,o);function s(T){var f;return f=o.call(this,T,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var u=s.prototype;return u._registerListeners=function(){var f=this.hls;f.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(M.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var f=this.hls;f.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var f=this._levels;f.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(f,p){var w=[],y=[],h=[],c,l={},a,v=!1,g=!1,m=!1;if(p.levels.forEach(function(X){var B=X.attrs;v=v||!!(X.width&&X.height),g=g||!!X.videoCodec,m=m||!!X.audioCodec,b&&X.audioCodec&&X.audioCodec.indexOf("mp4a.40.34")!==-1&&(X.audioCodec=void 0);var F=X.bitrate+"-"+X.attrs.RESOLUTION+"-"+X.attrs.CODECS;a=l[F],a?a.url.push(X.url):(a=new K.Level(X),l[F]=a,w.push(a)),B&&(B.AUDIO&&Object(k.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(k.addGroupId)(a,"text",B.SUBTITLES))}),(v||g)&&m&&(w=w.filter(function(X){var B=X.videoCodec,F=X.width,z=X.height;return!!B||!!(F&&z)})),w=w.filter(function(X){var B=X.audioCodec,F=X.videoCodec;return(!B||Object(N.isCodecSupportedInMp4)(B,"audio"))&&(!F||Object(N.isCodecSupportedInMp4)(F,"video"))}),p.audioTracks&&(y=p.audioTracks.filter(function(X){return!X.audioCodec||Object(N.isCodecSupportedInMp4)(X.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(y)),p.subtitles&&(h=p.subtitles,Object(k.assignTrackIdsByGroup)(h)),w.length>0){c=w[0].bitrate,w.sort(function(X,B){return X.bitrate-B.bitrate}),this._levels=w;for(var R=0;R<w.length;R++)if(w[R].bitrate===c){this._firstLevel=R,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+c);break}var U=m&&!g,W={levels:w,audioTracks:y,subtitleTracks:h,firstLevel:this._firstLevel,stats:p.stats,audio:m,video:g,altAudio:!U&&y.some(function(X){return!!X.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(f,p){if(o.prototype.onError.call(this,f,p),p.fatal)return;var w=p.context,y=this._levels[this.currentLevelIndex];if(w&&(w.type===_.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&w.groupId===y.audioGroupIds[y.urlId]||w.type===_.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&w.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(p.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=p.frag.level)):l=p.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(c=!1),l=w.level),h=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:l=p.level,h=!0;break}l!==void 0&&this.recoverLevel(p,l,h,c)},u.recoverLevel=function(f,p,w,y){var h=f.details,c=this._levels[p];if(c.loadError++,w){var l=this.retryLoadingOrFail(f);if(l)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var v=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),f.levelRetry=!0,this.hls.nextAutoLevel=v)}}},u.redundantFailover=function(f){var p=this._levels[f],w=p.url.length;if(w>1){var y=(p.urlId+1)%w;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(h){h.urlId=y}),this.level=f}},u.onFragLoaded=function(f,p){var w=p.frag;if(w!==void 0&&w.type===_.PlaylistLevelType.MAIN){var y=this._levels[w.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},u.onLevelLoaded=function(f,p){var w,y=p.level,h=p.details,c=this._levels[y];if(!c){var l;this.warn("Invalid level index "+y),(l=p.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(y,p,c.details)):(w=p.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(h.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(f,p){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var y=-1,h=this.hls.audioTracks[p.id].groupId,c=0;c<w.audioGroupIds.length;c++)if(w.audioGroupIds[c]===h){y=c;break}y!==w.urlId&&(w.urlId=y,this.startLoad())}},u.loadPlaylist=function(f){var p=this.currentLevelIndex,w=this._levels[p];if(this.canLoad&&w&&w.url.length>0){var y=w.urlId,h=w.url[y];if(f)try{h=f.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+p+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+y+" "+h),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:h,level:p,id:y,deliveryDirectives:f||null})}},u.removeLevel=function(f,p){var w=function(c,l){return l!==p},y=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&p!==void 0?(h.url=h.url.filter(w),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(w)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(w)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=y,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:y})},O(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var p,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===f&&(p=w[f])!==null&&p!==void 0&&p.details)return;if(f<0||f>=w.length){var y=f<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:y,reason:"invalid level idx"}),y)return;f=Math.min(f,w.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=w[h],l=w[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=x({},l,{level:f,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var v=l.details;if(!v||v.live){var g=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),s}(A.default)},"./src/controller/level-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"addGroupId",function(){return P}),D.d(G,"assignTrackIdsByGroup",function(){return N}),D.d(G,"updatePTS",function(){return k}),D.d(G,"updateFragPTSDTS",function(){return _}),D.d(G,"mergeDetails",function(){return x}),D.d(G,"mapPartIntersection",function(){return L}),D.d(G,"mapFragmentIntersection",function(){return O}),D.d(G,"adjustSliding",function(){return C}),D.d(G,"addSliding",function(){return S}),D.d(G,"computeReloadInterval",function(){return b}),D.d(G,"getFragmentWithSN",function(){return d}),D.d(G,"getPartWith",function(){return o});var K=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts");function P(s,u,T){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(T);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(T);break}}function N(s){var u={};s.forEach(function(T){var f=T.groupId||"";T.id=u[f]=u[f]||0,u[f]++})}function k(s,u,T){var f=s[u],p=s[T];A(f,p)}function A(s,u){var T=u.startPTS;if(Object(K.isFiniteNumber)(T)){var f=0,p;u.sn>s.sn?(f=T-s.start,p=s):(f=s.start-T,p=u),p.duration!==f&&(p.duration=f)}else if(u.sn>s.sn){var w=s.cc===u.cc;w&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function _(s,u,T,f,p,w){var y=f-T;y<=0&&(M.logger.warn("Fragment should have a positive duration",u),f=T+u.duration,w=p+u.duration);var h=T,c=f,l=u.startPTS,a=u.endPTS;if(Object(K.isFiniteNumber)(l)){var v=Math.abs(l-T);Object(K.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(v,u.deltaPTS):u.deltaPTS=v,h=Math.max(T,l),T=Math.min(T,l),p=Math.min(p,u.startDTS),c=Math.min(f,a),f=Math.max(f,a),w=Math.max(w,u.endDTS)}u.duration=f-T;var g=T-u.start;u.appendedPTS=f,u.start=u.startPTS=T,u.maxStartPTS=h,u.startDTS=p,u.endPTS=f,u.minEndPTS=c,u.endDTS=w;var m=u.sn;if(!s||m<s.startSN||m>s.endSN)return 0;var R,U=m-s.startSN,W=s.fragments;for(W[U]=u,R=U;R>0;R--)A(W[R],W[R-1]);for(R=U;R<W.length-1;R++)A(W[R],W[R+1]);return s.fragmentHint&&A(W[W.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function x(s,u){for(var T=null,f=s.fragments,p=f.length-1;p>=0;p--){var w=f[p].initSegment;if(w){T=w;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var y=0,h;if(O(s,u,function(R,U){R.relurl&&(y=R.cc-U.cc),Object(K.isFiniteNumber)(R.startPTS)&&Object(K.isFiniteNumber)(R.endPTS)&&(U.start=U.startPTS=R.startPTS,U.startDTS=R.startDTS,U.appendedPTS=R.appendedPTS,U.maxStartPTS=R.maxStartPTS,U.endPTS=R.endPTS,U.endDTS=R.endDTS,U.minEndPTS=R.minEndPTS,U.duration=R.endPTS-R.startPTS,U.duration&&(h=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=R.elementaryStreams,U.loader=R.loader,U.stats=R.stats,U.urlId=R.urlId,R.initSegment&&(U.initSegment=R.initSegment,T=R.initSegment)}),T){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(R){var U;(!R.initSegment||R.initSegment.relurl===((U=T)===null||U===void 0?void 0:U.relurl))&&(R.initSegment=T)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(R){return!R}),u.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=u.skippedSegments;l--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(y){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=y}u.skippedSegments&&(u.startCC=u.fragments[0].cc),L(s.partList,u.partList,function(R,U){U.elementaryStreams=R.elementaryStreams,U.stats=R.stats}),h?_(u,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(s,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var g=u.advancedDateTime;if(u.advanced&&g){var m=u.edge;u.driftStart||(u.driftStartTime=g,u.driftStart=m),u.driftEndTime=g,u.driftEnd=m}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function L(s,u,T){if(s&&u)for(var f=0,p=0,w=s.length;p<=w;p++){var y=s[p],h=u[p+f];y&&h&&y.index===h.index&&y.fragment.sn===h.fragment.sn?T(y,h):f--}}function O(s,u,T){for(var f=u.skippedSegments,p=Math.max(s.startSN,u.startSN)-u.startSN,w=(s.fragmentHint?1:0)+(f?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,y=u.startSN-s.startSN,h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,l=p;l<=w;l++){var a=c[y+l],v=h[l];f&&!v&&l<f&&(v=u.fragments[l]=a),a&&v&&T(a,v)}}function C(s,u){var T=u.startSN+u.skippedSegments-s.startSN,f=s.fragments;if(T<0||T>=f.length)return;S(u,f[T].start)}function S(s,u){if(u){for(var T=s.fragments,f=s.skippedSegments;f<T.length;f++)T[f].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function b(s,u){var T=1e3*s.levelTargetDuration,f=T/2,p=s.age,w=p>0&&p<T*3,y=u.loading.end-u.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(w){var l=333*s.misses;h=Math.max(Math.min(f,y*2),l),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=f;else w?(c=Math.min(c||T/2,p),s.availabilityDelay=c,h=c+T-p):h=T-y;return Math.round(h)}function d(s,u,T){if(!s||!s.details)return null;var f=s.details,p=f.fragments[u-f.startSN];return p||(p=f.fragmentHint,p&&p.sn===u?p:u<f.startSN&&T&&T.sn===u?T:null)}function o(s,u,T){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var p=f.length;p--;){var w=f[p];if(w.index===T&&w.fragment.sn===u)return w}return null}},"./src/controller/stream-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return f});var K=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),N=D("./src/events.ts"),k=D("./src/utils/buffer-helper.ts"),A=D("./src/controller/fragment-tracker.ts"),_=D("./src/types/loader.ts"),x=D("./src/loader/fragment.ts"),L=D("./src/demux/transmuxer-interface.ts"),O=D("./src/types/transmuxer.ts"),C=D("./src/controller/gap-controller.ts"),S=D("./src/errors.ts"),b=D("./src/utils/logger.ts");function d(p,w){for(var y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(p,h.key,h)}}function o(p,w,y){return w&&d(p.prototype,w),y&&d(p,y),p}function s(p,w){p.prototype=Object.create(w.prototype),p.prototype.constructor=p,u(p,w)}function u(p,w){return u=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},u(p,w)}var T=100,f=function(p){s(w,p);function w(h,c){var l;return l=p.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 y=w.prototype;return y._registerListeners=function(){var c=this.hls;c.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(N.Events.ERROR,this.onError,this),c.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var c=this.hls;c.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(N.Events.ERROR,this.onError,this),c.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(T),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=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.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=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var g,m=self.performance.now(),R=this.retryDate;(!R||m>=R||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var c,l,a=this.hls,v=this.levelLastLoaded,g=this.levels,m=this.media,R=a.config,U=a.nextLoadLevel;if(v===null||!m&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[U])return;var W=g[U];this.level=a.nextLoadLevel=U;var X=W.details;if(!X||this.state===M.State.WAITING_LEVEL||X.live&&this.levelLastLoaded!==U){this.state=M.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:m,_.PlaylistLevelType.MAIN);if(B===null)return;var F=B.len,z=this.getMaxBufferLength(W.maxBitrate);if(F>=z)return;if(this._streamEnded(B,X)){var Q={};this.altAudio&&(Q.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,Q),this.state=M.State.ENDED;return}var ie=B.end,ce=this.getNextFragment(ie,X);if(this.couldBacktrack&&!this.fragPrevious&&ce&&ce.sn!=="initSegment"){var Ce=ce.sn-X.startSN;Ce>1&&(ce=X.fragments[Ce-1],this.fragmentTracker.removeFragment(ce))}if(ce&&this.fragmentTracker.getState(ce)===A.FragmentState.OK&&this.nextLoadPosition>ie){var pe=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(m,pe,_.PlaylistLevelType.MAIN),ce=this.getNextFragment(this.nextLoadPosition,X)}if(!ce)return;ce.initSegment&&!ce.initSegment.data&&!this.bitrateTest&&(ce=ce.initSegment),((c=ce.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=ce.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ce,X):this.loadFragment(ce,X,ie)},y.loadFragment=function(c,l,a){var v,g=this.fragmentTracker.getState(c);if(this.fragCurrent=c,g===A.FragmentState.BACKTRACKED){var m=this.fragmentTracker.getBacktrackData(c);if(m){this._handleFragmentLoadProgress(m),this._handleFragmentLoadComplete(m);return}else g=A.FragmentState.NOT_LOADED}g===A.FragmentState.NOT_LOADED||g===A.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,p.prototype.loadFragment.call(this,c,l,a)):g===A.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()},y.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,_.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},y.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,_.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,v=this.getAppendedFrag(l.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!l.paused&&c){var g=this.hls.nextLoadLevel,m=c[g],R=this.fragLastKbps;R&&this.fragCurrent?a=this.fragCurrent.duration*m.maxBitrate/(1e3*R)+1:a=0}else a=0;var U=this.getBufferedFrag(l.currentTime+a);if(U){var W=this.followingBufferedFrag(U);if(W){this.abortCurrentFrag();var X=W.maxStartPTS?W.maxStartPTS:W.start,B=W.duration,F=Math.max(U.end,X+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(c,l){p.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},y.onMediaAttached=function(c,l){p.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)},y.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(K.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(c,l){var a=!1,v=!1,g;l.levels.forEach(function(m){g=m.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(P.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},y.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var v=a[l.level];(!v.details||v.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(v.details))&&(this.state=M.State.WAITING_LEVEL)},y.onLevelLoaded=function(c,l){var a,v=this.levels,g=l.level,m=l.details,R=m.totalduration;if(!v){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+m.startSN+","+m.endSN+"], cc ["+m.startCC+", "+m.endCC+"] duration:"+R);var U=this.fragCurrent;U&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==l.level&&U.loader&&(this.state=M.State.IDLE,U.loader.abort()));var W=v[g],X=0;if(m.live||(a=W.details)!==null&&a!==void 0&&a.live){if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed)return;X=this.alignPlaylists(m,W.details)}if(W.details=m,this.levelLastLoaded=g,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:m,level:g}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(m))return;this.state=M.State.IDLE}this.startFragRequested?m.live&&this.synchronizeToLiveEdge(m):this.setStartPosition(m,X),this.tick()},y._handleFragmentLoadProgress=function(c){var l,a=c.frag,v=c.part,g=c.payload,m=this.levels;if(!m){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var R=m[a.level],U=R.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var W=R.videoCodec,X=U.PTSKnown||!U.live,B=(l=a.initSegment)===null||l===void 0?void 0:l.data,F=this._getAudioCodec(R),z=this.transmuxer=this.transmuxer||new L.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Q=v?v.index:-1,ie=Q!==-1,ce=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,Q,ie),Ce=this.initPTS[a.cc];z.push(g,B,F,W,a,v,U.totalduration,X,ce,Ce)},y.onAudioTrackSwitching=function(c,l){var a=this.altAudio,v=!!l.url,g=l.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var m=this.fragCurrent;m!=null&&m.loader&&(this.log("Switching to main audio track, cancel main fragment load"),m.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;a&&R.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:g})}},y.onAudioTrackSwitched=function(c,l){var a=l.id,v=!!this.hls.audioTracks[a].url;if(v){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=v,this.tick()},y.onBufferCreated=function(c,l){var a=l.tracks,v,g,m=!1;for(var R in a){var U=a[R];if(U.id==="main"){if(g=R,v=U,R==="video"){var W=a[R];W&&(this.videoBuffer=W.buffer)}}else m=!0}m&&v?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(c,l){var a=l.frag,v=l.part;if(a&&a.type!==_.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===M.State.PARSED&&(this.state=M.State.IDLE);return}var g=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},y.onError=function(c,l){switch(l.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,l);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=M.State.ERROR):!l.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,_.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}},y.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(c,l){var a=l.type;if(a!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,_.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(c,l){this.levels=l.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+l);return}var v=k.BufferHelper.getBuffered(c),g=v.length?v.start(0):0,m=g-a;m>0&&(m<this.config.maxBufferHole||m<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+m+" to match buffer start"),a+=m,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},y._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},y._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=M.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var g=c.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),v.trigger(N.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(c){var l,a="main",v=this.hls,g=c.remuxResult,m=c.chunkMeta,R=this.getCurrentContext(m);if(!R){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 U=R.frag,W=R.part,X=R.level,B=g.video,F=g.text,z=g.id3,Q=g.initSegment,ie=this.altAudio?void 0:g.audio;if(this.fragContextChanged(U))return;if(this.state=M.State.PARSING,Q){Q.tracks&&(this._bufferInitSegment(X,Q.tracks,U,m),v.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:Q.tracks}));var ce=Q.initPTS,Ce=Q.timescale;Object(K.isFiniteNumber)(ce)&&(this.initPTS[U.cc]=ce,v.trigger(N.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ce,timescale:Ce}))}if(B&&g.independent!==!1){if(X.details){var pe=B.startPTS,Te=B.endPTS,se=B.startDTS,de=B.endDTS;if(W)W.elementaryStreams[B.type]={startPTS:pe,endPTS:Te,startDTS:se,endDTS:de};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var q=this.getLoadPosition()+this.config.maxBufferHole;if(q<pe){this.backtrack(U);return}U.setElementaryStreamInfo(B.type,U.start,Te,U.start,de,!0)}U.setElementaryStreamInfo(B.type,pe,Te,se,de),this.bufferFragmentData(B,U,W,m)}}else if(g.independent===!1){this.backtrack(U);return}if(ie){var oe=ie.startPTS,ye=ie.endPTS,fe=ie.startDTS,Le=ie.endDTS;W&&(W.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:ye,startDTS:fe,endDTS:Le}),U.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,oe,ye,fe,Le),this.bufferFragmentData(ie,U,W,m)}if(z!=null&&(l=z.samples)!==null&&l!==void 0&&l.length){var ve={frag:U,id:a,samples:z.samples};v.trigger(N.Events.FRAG_PARSING_METADATA,ve)}if(F){var De={frag:U,id:a,samples:F.samples};v.trigger(N.Events.FRAG_PARSING_USERDATA,De)}},y._bufferInitSegment=function(c,l,a,v){var g=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var m=l.audio,R=l.video,U=l.audiovideo;if(m){var W=c.audioCodec,X=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),m.metadata.channelCount!==1&&X.indexOf("firefox")===-1&&(W="mp4a.40.5")),X.indexOf("android")!==-1&&m.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),c.audioCodec&&c.audioCodec!==W&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+W+'"'),m.levelCodec=W,m.id="main",this.log("Init audio buffer, container:"+m.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(c.audioCodec||"")+"/"+m.codec+"]")}R&&(R.levelCodec=c.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+R.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(B){var F=l[B],z=F.initSegment;z!=null&&z.byteLength&&g.hls.trigger(N.Events.BUFFER_APPENDING,{type:B,data:z,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},y.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=M.State.BACKTRACKING},y.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var v=this.fragPlaying,g=l.level;(!v||l.sn!==v.sn||v.level!==g||l.urlId!==v.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:l}),(!v||v.level!==g)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=l)}}},o(w,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"SubtitleStreamController",function(){return s});var K=D("./src/events.ts"),M=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),N=D("./src/controller/fragment-finders.ts"),k=D("./src/utils/discontinuities.ts"),A=D("./src/controller/level-helper.ts"),_=D("./src/controller/fragment-tracker.ts"),x=D("./src/controller/base-stream-controller.ts"),L=D("./src/types/loader.ts"),O=D("./src/types/level.ts");function C(u,T){for(var f=0;f<T.length;f++){var p=T[f];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}function S(u,T,f){return T&&C(u.prototype,T),f&&C(u,f),u}function b(u,T){u.prototype=Object.create(T.prototype),u.prototype.constructor=u,d(u,T)}function d(u,T){return d=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},d(u,T)}var o=500,s=function(u){b(T,u);function T(p,w){var y;return y=u.call(this,p,w,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var f=T.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var w=this.hls;w.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(K.Events.ERROR,this.onError,this),w.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var w=this.hls;w.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(K.Events.ERROR,this.onError,this),w.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(w,y){this.mainDetails=y.details},f.onSubtitleFragProcessed=function(w,y){var h=y.frag,c=y.success;if(this.fragPrevious=h,this.state=x.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,v=h.start,g=0;g<l.length;g++)if(v>=l[g].start&&v<=l[g].end){a=l[g];break}var m=h.start+h.duration;a?a.end=m:(a={start:v,end:m},l.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(w,y){var h=y.startOffset,c=y.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var v=a[l].details,g=v.targetduration,m=c-g;if(m<=0)return;y.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(R){for(var U=0;U<R.length;){if(R[U].end<=m){R.shift();continue}else if(R[U].start<m)R[U].start=m;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(h,m,L.PlaylistLevelType.SUBTITLE)}},f.onError=function(w,y){var h,c=y.frag;if(!c||c.type!==L.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},f.onSubtitleTracksUpdated=function(w,y){var h=this,c=y.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},f.onSubtitleTrackSwitch=function(w,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(w,y){var h,c=y.details,l=y.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var g=v[a];if(l>=v.length||l!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=g.details)!==null&&h!==void 0&&h.live){var m=this.mainDetails;if(c.deltaUpdateFailed||!m)return;var R=m.fragments[0];if(!g.details)c.hasProgramDateTime&&m.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,m):R&&Object(A.addSliding)(c,R.start);else{var U=this.alignPlaylists(c,g.details);U===0&&R&&Object(A.addSliding)(c,R.start)}}if(g.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var W=Object(N.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},f._handleFragmentLoadComplete=function(w){var y=w.frag,h=w.payload,c=y.decryptdata,l=this.hls;if(this.fragContextChanged(y))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(v){var g=performance.now();l.trigger(K.Events.FRAG_DECRYPTED,{frag:y,payload:v,stats:{tstart:a,tdecrypt:g}})})}},f.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var w,y=this.currentTrackId,h=this.levels;if(!h.length||!h[y]||!h[y].details)return;var c=h[y].details,l=c.targetduration,a=this.config,v=this.media,g=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-l,a.maxBufferHole),m=g.end,R=g.len,U=this.getMaxBufferLength()+l;if(R>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var W=c.fragments,X=W.length,B=c.edge,F,z=this.fragPrevious;if(m<B){var Q=a.maxFragLookUpTolerance;z&&c.hasProgramDateTime&&(F=Object(N.findFragmentByPDT)(W,z.endProgramDateTime,Q)),F||(F=Object(N.findFragmentByPTS)(z,W,m,Q),!F&&z&&z.start<W[0].start&&(F=W[0]))}else F=W[X-1];(w=F)!==null&&w!==void 0&&w.encrypted?(M.logger.log("Loading key for "+F.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===_.FragmentState.NOT_LOADED&&this.loadFragment(F,c,m)}},f.loadFragment=function(w,y,h){this.fragCurrent=w,u.prototype.loadFragment.call(this,w,y,h)},S(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(x.default)},"./src/controller/subtitle-track-controller.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function k(C,S){for(var b=0;b<S.length;b++){var d=S[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function A(C,S,b){return S&&k(C.prototype,S),b&&k(C,b),C}function _(C,S){C.prototype=Object.create(S.prototype),C.prototype.constructor=C,x(C,S)}function x(C,S){return x=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},x(C,S)}var L=function(C){_(S,C);function S(d){var o;return o=C.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var b=S.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},b.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(K.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(K.Events.ERROR,this.onError,this)},b.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=O(this.media.textTracks);o.forEach(function(s){Object(M.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(o,s){var u=s.id,T=s.details,f=this.trackId,p=this.tracksInGroup[f];if(!p){this.warn("Invalid subtitle track id "+u);return}var w=p.details;p.details=s.details,this.log("subtitle track "+u+" loaded ["+T.startSN+"-"+T.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,w))},b.onLevelLoading=function(o,s){this.switchLevel(s.level)},b.onLevelSwitching=function(o,s){this.switchLevel(s.level)},b.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(y){return!u||y.groupId===u});this.tracksInGroup=f;var p=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=u;var w={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,w),p!==-1&&this.setSubtitleTrack(p,T)}},b.findTrackId=function(o){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var T=s[u];if((!this.selectDefaultTrack||T.default)&&(!o||o===T.name))return T.id}return-1},b.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===N.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,T=s.groupId,f=s.url;if(o)try{f=o.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:f,id:u,groupId:T,deliveryDirectives:o||null})}},b.toggleTrackModes=function(o){var s=this,u=this.media,T=this.subtitleDisplay,f=this.trackId;if(!u)return;var p=O(u.textTracks),w=p.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(p).forEach(function(c){c.mode="disabled"});else{var y=w[f];y&&(y.mode="disabled")}var h=w[o];h&&(h.mode=T?"showing":"hidden")},b.setSubtitleTrack=function(o,s){var u,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=T[o])!==null&&u!==void 0&&u.details)||o<-1||o>=T.length)return;this.clearTimer();var f=T[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var p=f.id,w=f.groupId,y=w===void 0?"":w,h=f.name,c=f.type,l=f.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:y,name:h,type:c,url:l});var a=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:o})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=O(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")o=u;else if(s[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},A(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),S}(P.default);function O(C){for(var S=[],b=0;b<C.length;b++){var d=C[b];d.kind==="subtitles"&&d.label&&S.push(C[b])}return S}G.default=L},"./src/controller/timeline-controller.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"TimelineController",function(){return O});var K=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),N=D("./src/utils/output-filter.ts"),k=D("./src/utils/webvtt-parser.ts"),A=D("./src/utils/texttrack-utils.ts"),_=D("./src/utils/imsc1-ttml-parser.ts"),x=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts"),O=function(){function d(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new N.default(this,"textTrack1"),T=new N.default(this,"textTrack2"),f=new N.default(this,"textTrack3"),p=new N.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,T),this.cea608Parser2=new P.default(3,f,p)}s.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(M.Events.FRAG_LOADING,this.onFragLoading,this),s.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var u=this.hls;u.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,T,f,p,w){for(var y=!1,h=w.length;h--;){var c=w[h],l=S(c[0],c[1],T,f);if(l>=0&&(c[0]=Math.min(c[0],T),c[1]=Math.max(c[1],f),y=!0,l/(f-T)>.5))return}if(y||w.push([T,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,T,f,p)}else{var v=this.Cues.newCue(null,T,f,p);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:v,track:u})}},o.onInitPtsFound=function(u,T){var f=this,p=T.frag,w=T.id,y=T.initPTS,h=T.timescale,c=this.unparsedVttFrags;w==="main"&&(this.initPTS[p.cc]=y,this.timescale[p.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){f.onFragLoaded(M.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(u){var T=this.media;if(T)for(var f=0;f<T.textTracks.length;f++){var p=T.textTracks[f];if(p[u])return p}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var T=this.captionsProperties,f=this.captionsTracks,p=this.media,w=T[u],y=w.label,h=w.languageCode,c=this.getExistingTrack(u);if(c)f[u]=c,Object(A.clearCurrentCues)(f[u]),Object(A.sendAddTrackEvent)(f[u],p);else{var l=this.createTextTrack("captions",y,h);l&&(l[u]=!0,f[u]=l)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var T=this.captionsProperties[u];if(!T)return;var f=T.label,p={_id:u,label:f,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[u]=p,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(u,T,f){var p=this.media;return p?p.addTextTrack(u,T,f):void 0},o.onMediaAttaching=function(u,T){this.media=T.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(T){Object(A.clearCurrentCues)(u[T]),delete u[T]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var T=u.textTracks;if(T)for(var f=0;f<T.length;f++)Object(A.clearCurrentCues)(T[f])},o.onSubtitleTracksUpdated=function(u,T){var f=this;this.textTracks=[];var p=T.subtitleTracks||[],w=p.some(function(l){return l.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var y=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var v;if(a<h.length){for(var g=null,m=0;m<h.length;m++)if(C(h[m],l)){g=h[m];break}g&&(v=g)}v?Object(A.clearCurrentCues)(v):(v=f.createTextTrack("subtitles",l.name,l.lang),v&&(v.mode="disabled")),v&&(v.groupId=l.groupId,f.textTracks.push(v))})}else if(!y&&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(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,T){var f=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(p){var w=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!w)return;var y="textTrack"+w[1],h=f.captionsProperties[y];if(!h)return;h.label=p.name,p.lang&&(h.languageCode=p.lang),h.media=p})},o.onFragLoading=function(u,T){var f=this.cea608Parser1,p=this.cea608Parser2,w=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(f&&p))return;if(T.frag.type===x.PlaylistLevelType.MAIN){var h,c,l=T.frag.sn,a=(h=T==null||((c=T.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===w+1||l===w&&a===y+1||(f.reset(),p.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(u,T){var f=T.frag,p=T.payload,w=this.initPTS,y=this.unparsedVttFrags;if(f.type===x.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(K.isFiniteNumber)(w[f.cc])){y.push(T),w.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],l=this.vttCCs;l[f.cc]||(l[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===_.IMSC1_CODEC?this._parseIMSC1(f,p):this._parseVTTs(f,p,l)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,T){var f=this,p=this.hls;Object(_.parseIMSC1)(T,this.initPTS[u.cc],this.timescale[u.cc],function(w){f._appendCues(w,u.level),p.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(w){L.logger.log("Failed to parse IMSC1: "+w),p.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:w})})},o._parseVTTs=function(u,T,f){var p=this,w=this.hls;Object(k.parseWebVTT)(T,this.initPTS[u.cc],this.timescale[u.cc],f,u.cc,u.start,function(y){p._appendCues(y,u.level),w.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(y){p._fallbackToIMSC1(u,T),L.logger.log("Failed to parse VTT cue: "+y),w.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:y})})},o._fallbackToIMSC1=function(u,T){var f=this,p=this.tracks[u.level];p.textCodec||Object(_.parseIMSC1)(T,this.initPTS[u.cc],this.timescale[u.cc],function(){p.textCodec=_.IMSC1_CODEC,f._parseIMSC1(u,T)},function(){p.textCodec="wvtt"})},o._appendCues=function(u,T){var f=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[T];if(p.mode==="disabled")return;u.forEach(function(h){return Object(A.addCueToTrack)(p,h)})}else{var w=this.tracks[T],y=w.default?"default":"subtitles"+T;f.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:u,track:y})}},o.onFragDecrypted=function(u,T){var f=T.frag;if(f.type===x.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(M.Events.FRAG_LOADED,T)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,T){var f=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(f&&p))return;for(var w=0;w<T.samples.length;w++){var y=T.samples[w].bytes;if(y){var h=this.extractCea608Data(y);f.addData(T.samples[w].pts,h[0]),p.addData(T.samples[w].pts,h[1])}}},o.onBufferFlushing=function(u,T){var f=T.startOffset,p=T.endOffset,w=T.endOffsetSubtitles,y=T.type,h=this.media;if(!h||h.currentTime<p)return;if(!y||y==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(A.removeCuesInRange)(c[a],f,p)})}if(this.config.renderTextTracksNatively&&(f===0&&w!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(A.removeCuesInRange)(l[a],f,w)})}},o.extractCea608Data=function(u){for(var T=u[0]&31,f=2,p=[[],[]],w=0;w<T;w++){var y=u[f++],h=127&u[f++],c=127&u[f++],l=(4&y)!==0,a=3&y;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(p[a].push(h),p[a].push(c)))}return p},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function S(d,o,s,u){return Math.min(o,u)-Math.max(d,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return K});var K=function(){function M(N,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=k}var P=M.prototype;return P.decrypt=function(k,A){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},A,k)},M}()},"./src/crypt/aes-decryptor.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"removePadding",function(){return M}),D.d(G,"default",function(){return P});var K=D("./src/utils/typed-array.ts");function M(N){var k=N.byteLength,A=k&&new DataView(N.buffer).getUint8(k-1);return A?Object(K.sliceUint8)(N,0,k-A):N}var P=function(){function N(){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 k=N.prototype;return k.uint8ArrayToUint32Array_=function(_){for(var x=new DataView(_),L=new Uint32Array(4),O=0;O<4;O++)L[O]=x.getUint32(O*4);return L},k.initTable=function(){var _=this.sBox,x=this.invSBox,L=this.subMix,O=L[0],C=L[1],S=L[2],b=L[3],d=this.invSubMix,o=d[0],s=d[1],u=d[2],T=d[3],f=new Uint32Array(256),p=0,w=0,y=0;for(y=0;y<256;y++)y<128?f[y]=y<<1:f[y]=y<<1^283;for(y=0;y<256;y++){var h=w^w<<1^w<<2^w<<3^w<<4;h=h>>>8^h&255^99,_[p]=h,x[h]=p;var c=f[p],l=f[c],a=f[l],v=f[h]*257^h*16843008;O[p]=v<<24|v>>>8,C[p]=v<<16|v>>>16,S[p]=v<<8|v>>>24,b[p]=v,v=a*16843009^l*65537^c*257^p*16843008,o[h]=v<<24|v>>>8,s[h]=v<<16|v>>>16,u[h]=v<<8|v>>>24,T[h]=v,p?(p=c^f[f[f[a^c]]],w^=f[f[w]]):p=w=1}},k.expandKey=function(_){for(var x=this.uint8ArrayToUint32Array_(_),L=!0,O=0;O<x.length&&L;)L=x[O]===this.key[O],O++;if(L)return;this.key=x;var C=this.keySize=x.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var S=this.ksRows=(C+6+1)*4,b,d,o=this.keySchedule=new Uint32Array(S),s=this.invKeySchedule=new Uint32Array(S),u=this.sBox,T=this.rcon,f=this.invSubMix,p=f[0],w=f[1],y=f[2],h=f[3],c,l;for(b=0;b<S;b++){if(b<C){c=o[b]=x[b];continue}l=c,b%C===0?(l=l<<8|l>>>24,l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255],l^=T[b/C|0]<<24):C>6&&b%C===4&&(l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255]),o[b]=c=(o[b-C]^l)>>>0}for(d=0;d<S;d++)b=S-d,d&3?l=o[b]:l=o[b-4],d<4||b<=4?s[d]=l:s[d]=p[u[l>>>24]]^w[u[l>>>16&255]]^y[u[l>>>8&255]]^h[u[l&255]],s[d]=s[d]>>>0},k.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},k.decrypt=function(_,x,L){for(var O=this.keySize+6,C=this.invKeySchedule,S=this.invSBox,b=this.invSubMix,d=b[0],o=b[1],s=b[2],u=b[3],T=this.uint8ArrayToUint32Array_(L),f=T[0],p=T[1],w=T[2],y=T[3],h=new Int32Array(_),c=new Int32Array(h.length),l,a,v,g,m,R,U,W,X,B,F,z,Q,ie,ce=this.networkToHostOrderSwap;x<h.length;){for(X=ce(h[x]),B=ce(h[x+1]),F=ce(h[x+2]),z=ce(h[x+3]),m=X^C[0],R=z^C[1],U=F^C[2],W=B^C[3],Q=4,ie=1;ie<O;ie++)l=d[m>>>24]^o[R>>16&255]^s[U>>8&255]^u[W&255]^C[Q],a=d[R>>>24]^o[U>>16&255]^s[W>>8&255]^u[m&255]^C[Q+1],v=d[U>>>24]^o[W>>16&255]^s[m>>8&255]^u[R&255]^C[Q+2],g=d[W>>>24]^o[m>>16&255]^s[R>>8&255]^u[U&255]^C[Q+3],m=l,R=a,U=v,W=g,Q=Q+4;l=S[m>>>24]<<24^S[R>>16&255]<<16^S[U>>8&255]<<8^S[W&255]^C[Q],a=S[R>>>24]<<24^S[U>>16&255]<<16^S[W>>8&255]<<8^S[m&255]^C[Q+1],v=S[U>>>24]<<24^S[W>>16&255]<<16^S[m>>8&255]<<8^S[R&255]^C[Q+2],g=S[W>>>24]<<24^S[m>>16&255]<<16^S[R>>8&255]<<8^S[U&255]^C[Q+3],c[x]=ce(l^f),c[x+1]=ce(g^p),c[x+2]=ce(v^w),c[x+3]=ce(a^y),f=X,p=B,w=F,y=z,x=x+4}return c.buffer},N}()},"./src/crypt/decrypter.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return x});var K=D("./src/crypt/aes-crypto.ts"),M=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),N=D("./src/utils/logger.ts"),k=D("./src/utils/mp4-tools.ts"),A=D("./src/utils/typed-array.ts"),_=16,x=function(){function L(C,S,b){var d=b===void 0?{}:b,o=d.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=S,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=L.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var b=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(S,b,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),b,d);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),b,d).then(o)},O.softwareDecrypt=function(S,b,d){var o=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(S=Object(k.appendUint8Array)(u,S),this.remainderData=null);var T=this.getValidChunk(S);if(!T.length)return null;o&&(d=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new P.default),f.expandKey(b);var p=s;return this.currentResult=f.decrypt(T.buffer,0,d),this.currentIV=Object(A.sliceUint8)(T,-16).buffer,p||null},O.webCryptoDecrypt=function(S,b,d){var o=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new M.default(s,b)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var T=new K.default(s,d);return T.decrypt(S.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,S,b,d)})},O.onWebCryptoError=function(S,b,d,o){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,o)},O.getValidChunk=function(S){var b=S,d=S.length-S.length%_;return d!==S.length&&(b=Object(A.sliceUint8)(S,0,d),this.remainderData=Object(A.sliceUint8)(S,d)),b},O.logOnce=function(S){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},L}()},"./src/crypt/fast-aes-key.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return K});var K=function(){function M(N,k){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=k}var P=M.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),N=D("./src/demux/id3.ts");function k(x,L){x.prototype=Object.create(L.prototype),x.prototype.constructor=x,A(x,L)}function A(x,L){return A=Object.setPrototypeOf||function(C,S){return C.__proto__=S,C},A(x,L)}var _=function(x){k(L,x);function L(C,S){var b;return b=x.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=C,b.config=S,b}var O=L.prototype;return O.resetInitSegment=function(S,b,d){x.prototype.resetInitSegment.call(this,S,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},L.probe=function(S){if(!S)return!1;for(var b=N.getID3Data(S,0)||[],d=b.length,o=S.length;d<o;d++)if(M.probe(S,d))return P.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(S,b){return M.canParse(S,b)},O.appendFrame=function(S,b,d){M.initTrackConfig(S,this.observer,b,d,S.manifestCodec);var o=M.appendFrame(S,b,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},L}(K.default);_.minProbeByteLength=9,G.default=_},"./src/demux/adts.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"getAudioConfig",function(){return N}),D.d(G,"isHeaderPattern",function(){return k}),D.d(G,"getHeaderLength",function(){return A}),D.d(G,"getFullFrameLength",function(){return _}),D.d(G,"canGetFrameLength",function(){return x}),D.d(G,"isHeader",function(){return L}),D.d(G,"canParse",function(){return O}),D.d(G,"probe",function(){return C}),D.d(G,"initTrackConfig",function(){return S}),D.d(G,"getFrameDuration",function(){return b}),D.d(G,"parseFrameHeader",function(){return d}),D.d(G,"appendFrame",function(){return o});var K=D("./src/utils/logger.ts"),M=D("./src/errors.ts"),P=D("./src/events.ts");function N(s,u,T,f){var p,w,y,h,c=navigator.userAgent.toLowerCase(),l=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((u[T+2]&192)>>>6)+1;var v=(u[T+2]&60)>>>2;if(v>a.length-1){s.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return y=(u[T+2]&1)<<2,y|=(u[T+3]&192)>>>6,K.logger.log("manifest codec:"+f+", ADTS type:"+p+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(p=5,h=new Array(4),w=v-3):(p=2,h=new Array(2),w=v):c.indexOf("android")!==-1?(p=2,h=new Array(2),w=v):(p=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&v>=6?w=v-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(v>=6&&y===1||/vivaldi/i.test(c))||!f&&y===1)&&(p=2,h=new Array(2)),w=v)),h[0]=p<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=y<<3,p===5&&(h[1]|=(w&14)>>1,h[2]=(w&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:y,codec:"mp4a.40."+p,manifestCodec:l}}function k(s,u){return s[u]===255&&(s[u+1]&246)===240}function A(s,u){return s[u+1]&1?7:9}function _(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function x(s,u){return u+5<s.length}function L(s,u){return u+1<s.length&&k(s,u)}function O(s,u){return x(s,u)&&k(s,u)&&_(s,u)<=s.length-u}function C(s,u){if(L(s,u)){var T=A(s,u);if(u+T>=s.length)return!1;var f=_(s,u);if(f<=T)return!1;var p=u+f;return p===s.length||L(s,p)}return!1}function S(s,u,T,f,p){if(!s.samplerate){var w=N(u,T,f,p);if(!w)return;s.config=w.config,s.samplerate=w.samplerate,s.channelCount=w.channelCount,s.codec=w.codec,s.manifestCodec=w.manifestCodec,K.logger.log("parsed codec:"+s.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function b(s){return 1024*9e4/s}function d(s,u,T,f,p){var w=A(s,u),y=_(s,u);if(y-=w,y>0){var h=T+f*p;return{headerLength:w,frameLength:y,stamp:h}}}function o(s,u,T,f,p){var w=b(s.samplerate),y=d(u,T,f,p,w);if(y){var h=y.frameLength,c=y.headerLength,l=y.stamp,a=c+h,v=Math.max(0,T+a-u.length),g;v?(g=new Uint8Array(a-c),g.set(u.subarray(T+c,u.length),0)):g=u.subarray(T+c,T+a);var m={unit:g,pts:l};return v||s.samples.push(m),{sample:m,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"initPTSFn",function(){return _});var K=D("./src/polyfills/number.ts"),M=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),N=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/typed-array.ts"),A=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var L=x.prototype;return L.resetInitSegment=function(C,S,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},L.resetTimeStamp=function(){},L.resetContiguity=function(){},L.canParse=function(C,S){return!1},L.appendFrame=function(C,S,b){},L.demux=function(C,S){this.cachedData&&(C=Object(N.appendUint8Array)(this.cachedData,C),this.cachedData=null);var b=M.getID3Data(C,0),d=b?b.length:0,o,s,u=this._audioTrack,T=this._id3Track,f=b?M.getTimeStamp(b):void 0,p=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(f,S)),b&&b.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;d<p;){if(this.canParse(C,d)){var w=this.appendFrame(u,C,d);w?(this.frameIndex++,s=w.sample.pts,d+=w.length,o=d):d=p}else M.canParse(C,d)?(b=M.getID3Data(C,d),T.samples.push({pts:s,dts:s,data:b}),d+=b.length,o=d):d++;if(d===p&&o!==p){var y=Object(k.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:T,textTrack:Object(P.dummyTrack)()}},L.demuxSampleAes=function(C,S,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},L.flush=function(C){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},L.destroy=function(){},x}(),_=function(L,O){return Object(K.isFiniteNumber)(L)?L*90:O*9e4};G.default=A},"./src/demux/chunk-cache.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return K});var K=function(){function P(){this.chunks=[],this.dataLength=0}var N=P.prototype;return N.push=function(A){this.chunks.push(A),this.dataLength+=A.length},N.flush=function(){var A=this.chunks,_=this.dataLength,x;if(A.length)A.length===1?x=A[0]:x=M(A,_);else return new Uint8Array(0);return this.reset(),x},N.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,N){for(var k=new Uint8Array(N),A=0,_=0;_<P.length;_++){var x=P[_];k.set(x,A),A+=x.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/utils/logger.ts"),M=function(){function P(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var N=P.prototype;return N.loadWord=function(){var A=this.data,_=this.bytesAvailable,x=A.byteLength-_,L=new Uint8Array(4),O=Math.min(4,_);if(O===0)throw new Error("no bytes available");L.set(A.subarray(x,x+O)),this.word=new DataView(L.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},N.skipBits=function(A){var _;this.bitsAvailable>A?(this.word<<=A,this.bitsAvailable-=A):(A-=this.bitsAvailable,_=A>>3,A-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=A,this.bitsAvailable-=A)},N.readBits=function(A){var _=Math.min(this.bitsAvailable,A),x=this.word>>>32-_;return A>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=A-_,_>0&&this.bitsAvailable?x<<_|this.readBits(_):x},N.skipLZ=function(){var A;for(A=0;A<this.bitsAvailable;++A)if((this.word&2147483648>>>A)!==0)return this.word<<=A,this.bitsAvailable-=A,A;return this.loadWord(),A+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var A=this.skipLZ();return this.readBits(A+1)-1},N.readEG=function(){var A=this.readUEG();return 1&A?1+A>>>1:-1*(A>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(A){for(var _=8,x=8,L,O=0;O<A;O++)x!==0&&(L=this.readEG(),x=(_+L+256)%256),_=x===0?_:x},N.readSPS=function(){var A=0,_=0,x=0,L=0,O,C,S,b=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),T=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);b();var w=b();if(d(5),u(3),b(),f(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var y=o();if(y===3&&u(1),f(),f(),u(1),s())for(C=y!==3?8:12,S=0;S<C;S++)s()&&(S<6?p(16):p(64))}f();var h=o();if(h===0)o();else if(h===1)for(u(1),T(),T(),O=o(),S=0;S<O;S++)T();f(),u(1);var c=o(),l=o(),a=d(1);a===0&&u(1),u(1),s()&&(A=o(),_=o(),x=o(),L=o());var v=[1,1];if(s()&&s()){var g=b();switch(g){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-A*2-_*2),height:(2-a)*(l+1)*16-(a?2:4)*(x+L),pixelRatio:v}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();G.default=M},"./src/demux/id3.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isHeader",function(){return K}),D.d(G,"isFooter",function(){return M}),D.d(G,"getID3Data",function(){return P}),D.d(G,"canParse",function(){return k}),D.d(G,"getTimeStamp",function(){return A}),D.d(G,"isTimeStampFrame",function(){return _}),D.d(G,"getID3Frames",function(){return L}),D.d(G,"decodeFrame",function(){return O}),D.d(G,"utf8ArrayToStr",function(){return o}),D.d(G,"testables",function(){return s});var K=function(p,w){return w+10<=p.length&&(p[w]===73&&p[w+1]===68&&p[w+2]===51&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},M=function(p,w){return w+10<=p.length&&(p[w]===51&&p[w+1]===68&&p[w+2]===73&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},P=function(p,w){for(var y=w,h=0;K(p,w);){h+=10;var c=N(p,w+6);h+=c,M(p,w+10)&&(h+=10),w+=h}return h>0?p.subarray(y,y+h):void 0},N=function(p,w){var y=0;return y=(p[w]&127)<<21,y|=(p[w+1]&127)<<14,y|=(p[w+2]&127)<<7,y|=p[w+3]&127,y},k=function(p,w){return K(p,w)&&N(p,w+6)+10<=p.length-w},A=function(p){for(var w=L(p),y=0;y<w.length;y++){var h=w[y];if(_(h))return d(h)}return},_=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},x=function(p){var w=String.fromCharCode(p[0],p[1],p[2],p[3]),y=N(p,4),h=10;return{type:w,size:y,data:p.subarray(h,h+y)}},L=function(p){for(var w=0,y=[];K(p,w);){var h=N(p,w+6);w+=10;for(var c=w+h;w+8<c;){var l=x(p.subarray(w)),a=O(l);a&&y.push(a),w+=l.size+10}M(p,w)&&(w+=10)}return y},O=function(p){return p.type==="PRIV"?C(p):p.type[0]==="W"?b(p):S(p)},C=function(p){if(p.size<2)return;var w=o(p.data,!0),y=new Uint8Array(p.data.subarray(w.length+1));return{key:p.type,info:w,data:y.buffer}},S=function(p){if(p.size<2)return;if(p.type==="TXXX"){var w=1,y=o(p.data.subarray(w),!0);w+=y.length+1;var h=o(p.data.subarray(w));return{key:p.type,info:y,data:h}}var c=o(p.data.subarray(1));return{key:p.type,data:c}},b=function(p){if(p.type==="WXXX"){if(p.size<2)return;var w=1,y=o(p.data.subarray(w),!0);w+=y.length+1;var h=o(p.data.subarray(w));return{key:p.type,info:y,data:h}}var c=o(p.data);return{key:p.type,data:c}},d=function(p){if(p.data.byteLength===8){var w=new Uint8Array(p.data),y=w[3]&1,h=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return h/=45,y&&(h+=4772185884e-2),Math.round(h)}return},o=function(p,w){w===void 0&&(w=!1);var y=T();if(y){var h=y.decode(p);if(w){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=p.length,a,v,g,m="",R=0;R<l;){if(a=p[R++],a===0&&w)return m;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:m+=String.fromCharCode(a);break;case 12:case 13:v=p[R++],m+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=p[R++],g=p[R++],m+=String.fromCharCode((a&15)<<12|(v&63)<<6|(g&63)<<0);break;default:}}return m},s={decodeTextFrame:S},u;function T(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),N=D("./src/demux/mpegaudio.ts");function k(x,L){x.prototype=Object.create(L.prototype),x.prototype.constructor=x,A(x,L)}function A(x,L){return A=Object.setPrototypeOf||function(C,S){return C.__proto__=S,C},A(x,L)}var _=function(x){k(L,x);function L(){return x.apply(this,arguments)||this}var O=L.prototype;return O.resetInitSegment=function(S,b,d){x.prototype.resetInitSegment.call(this,S,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},L.probe=function(S){if(!S)return!1;for(var b=M.getID3Data(S,0)||[],d=b.length,o=S.length;d<o;d++)if(N.probe(S,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(S,b){return N.canParse(S,b)},O.appendFrame=function(S,b,d){return this.initPTS===null?void 0:N.appendFrame(S,b,d,this.initPTS,this.frameIndex)},L}(K.default);_.minProbeByteLength=4,G.default=_},"./src/demux/mp4demuxer.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/utils/mp4-tools.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function N(A,_){this.remainderData=null,this.config=void 0,this.config=_}var k=N.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},N.probe=function(_){return Object(K.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},k.demux=function(_){var x=_,L=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(K.appendUint8Array)(this.remainderData,_));var O=Object(K.segmentValidRange)(x);this.remainderData=O.remainder,L.samples=O.valid||new Uint8Array}else L.samples=x;return{audioTrack:Object(M.dummyTrack)(),avcTrack:L,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var _=Object(M.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:_,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(_,x,L){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},N}();P.minProbeByteLength=1024,G.default=P},"./src/demux/mpegaudio.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"appendFrame",function(){return A}),D.d(G,"parseHeader",function(){return _}),D.d(G,"isHeaderPattern",function(){return x}),D.d(G,"isHeader",function(){return L}),D.d(G,"canParse",function(){return O}),D.d(G,"probe",function(){return C});var K=null,M=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function A(S,b,d,o,s){if(d+24>b.length)return;var u=_(b,d);if(u&&d+u.frameLength<=b.length){var T=u.samplesPerFrame*9e4/u.sampleRate,f=o+s*T,p={unit:b.subarray(d,d+u.frameLength),pts:f,dts:f};return S.config=[],S.channelCount=u.channelCount,S.samplerate=u.sampleRate,S.samples.push(p),{sample:p,length:u.frameLength,missing:0}}}function _(S,b){var d=S[b+1]>>3&3,o=S[b+1]>>1&3,s=S[b+2]>>4&15,u=S[b+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var T=S[b+2]>>1&1,f=S[b+3]>>6,p=d===3?3-o:o===3?3:4,w=M[p*14+s-1]*1e3,y=d===3?0:d===2?1:2,h=P[y*3+u],c=f===3?1:2,l=N[d][o],a=k[o],v=l*8*a,g=Math.floor(l*w/h+T)*a;if(K===null){var m=navigator.userAgent||"",R=m.match(/Chrome\/(\d+)/i);K=R?parseInt(R[1]):0}var U=!!K&&K<=87;return U&&o===2&&w>=224e3&&f===0&&(S[b+3]=S[b+3]|128),{sampleRate:h,channelCount:c,frameLength:g,samplesPerFrame:v}}}function x(S,b){return S[b]===255&&(S[b+1]&224)===224&&(S[b+1]&6)!==0}function L(S,b){return b+1<S.length&&x(S,b)}function O(S,b){var d=4;return x(S,b)&&d<=S.length-b}function C(S,b){if(b+1<S.length&&x(S,b)){var d=4,o=_(S,b),s=d;o!=null&&o.frameLength&&(s=o.frameLength);var u=b+s;return u===S.length||L(S,u)}return!1}},"./src/demux/sample-aes.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/crypt/decrypter.ts"),M=D("./src/demux/tsdemuxer.ts"),P=function(){function N(A,_,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new K.default(A,_,{removePKCS7Padding:!1})}var k=N.prototype;return k.decryptBuffer=function(_,x){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,x)},k.decryptAacSample=function(_,x,L,O){var C=_[x].unit,S=C.subarray(16,C.length-C.length%16),b=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),d=this;this.decryptBuffer(b,function(o){var s=new Uint8Array(o);C.set(s,16),O||d.decryptAacSamples(_,x+1,L)})},k.decryptAacSamples=function(_,x,L){for(;;x++){if(x>=_.length){L();return}if(_[x].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(_,x,L,O),!O)return}},k.getAvcEncryptedData=function(_){for(var x=Math.floor((_.length-48)/160)*16+16,L=new Int8Array(x),O=0,C=32;C<=_.length-16;C+=160,O+=16)L.set(_.subarray(C,C+16),O);return L},k.getAvcDecryptedUnit=function(_,x){for(var L=new Uint8Array(x),O=0,C=32;C<=_.length-16;C+=160,O+=16)_.set(L.subarray(O,O+16),C);return _},k.decryptAvcSample=function(_,x,L,O,C,S){var b=Object(M.discardEPB)(C.data),d=this.getAvcEncryptedData(b),o=this;this.decryptBuffer(d.buffer,function(s){C.data=o.getAvcDecryptedUnit(b,s),S||o.decryptAvcSamples(_,x,L+1,O)})},k.decryptAvcSamples=function(_,x,L,O){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,L=0){if(x>=_.length){O();return}for(var C=_[x].units;!(L>=C.length);L++){var S=C[L];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(_,x,L,O,S,b),!b)return}}},N}();G.default=P},"./src/demux/transmuxer-interface.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C});var K=D("./node_modules/webworkify-webpack/index.js"),M=D.n(K),P=D("./src/events.ts"),N=D("./src/demux/transmuxer.ts"),k=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),_=D("./src/utils/mediasource-helper.ts"),x=D("./node_modules/eventemitter3/index.js"),L=D.n(x),O=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function S(d,o,s,u){var T=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=u;var f=d.config,p=function(l,a){a=a||{},a.frag=T.frag,a.id=T.id,d.trigger(l,a)};this.observer=new x.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,p),this.observer.on(P.Events.ERROR,p);var w={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var h;try{h=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(P.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:w,vendor:y,id:o,config:JSON.stringify(f)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new N.default(this.observer,w,f,y,o),this.worker=null}}else this.transmuxer=new N.default(this.observer,w,f,y,o)}var b=S.prototype;return b.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},b.push=function(o,s,u,T,f,p,w,y,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,g=p?p.start:f.start,m=f.decryptdata,R=this.frag,U=!(R&&f.cc===R.cc),W=!(R&&h.level===R.level),X=R?h.sn-R.sn:-1,B=this.part?h.part-this.part.index:1,F=!W&&(X===1||X===0&&B===1),z=self.performance.now();(W||X||f.stats.parsing.start===0)&&(f.stats.parsing.start=z),p&&(B||!F)&&(p.stats.parsing.start=z);var Q=new N.TransmuxState(U,F,y,W,g);if(!F||U){k.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+F+`
|
|
accurateTimeOffset: `+y+`
|
|
timeOffset: `+g);var ie=new N.TransmuxConfig(u,T,s,w,c);this.configureTransmuxer(ie)}if(this.frag=f,this.part=p,v)v.postMessage({cmd:"demux",data:o,decryptdata:m,chunkMeta:h,state:Q},o instanceof ArrayBuffer?[o]:[]);else if(a){var ce=a.push(o,m,h,Q);Object(N.isPromise)(ce)?ce.then(function(Ce){l.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(ce)}},b.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:o});else if(u){var f=u.flush(o);Object(N.isPromise)(f)?f.then(function(p){s.handleFlushResult(p,o)}):this.handleFlushResult(f,o)}},b.handleFlushResult=function(o,s){var u=this;o.forEach(function(T){u.handleTransmuxComplete(T)}),this.onFlush(s)},b.onWorkerMessage=function(o){var s=o.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(o){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},b.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},S}()},"./src/demux/transmuxer-worker.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return A});var K=D("./src/demux/transmuxer.ts"),M=D("./src/events.ts"),P=D("./src/utils/logger.ts"),N=D("./node_modules/eventemitter3/index.js"),k=D.n(N);function A(C){var S=new N.EventEmitter,b=function(o,s){C.postMessage({event:o,data:s})};S.on(M.Events.FRAG_DECRYPTED,b),S.on(M.Events.ERROR,b),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new K.default(S,o.typeSupported,s,o.vendor,o.id),Object(P.enableLogs)(s.debug),b("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var u=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(K.isPromise)(u)?u.then(function(p){_(C,p)}):_(C,u);break}case"flush":{var T=o.chunkMeta,f=C.transmuxer.flush(T);Object(K.isPromise)(f)?f.then(function(p){L(C,p,T)}):L(C,f,T);break}default:break}})}function _(C,S){if(O(S.remuxResult))return;var b=[],d=S.remuxResult,o=d.audio,s=d.video;o&&x(b,o),s&&x(b,s),C.postMessage({event:"transmuxComplete",data:S},b)}function x(C,S){S.data1&&C.push(S.data1.buffer),S.data2&&C.push(S.data2.buffer)}function L(C,S,b){S.forEach(function(d){_(C,d)}),C.postMessage({event:"flush",data:b})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"isPromise",function(){return f}),D.d(G,"TransmuxConfig",function(){return p}),D.d(G,"TransmuxState",function(){return w});var K=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),N=D("./src/demux/aacdemuxer.ts"),k=D("./src/demux/mp4demuxer.ts"),A=D("./src/demux/tsdemuxer.ts"),_=D("./src/demux/mp3demuxer.ts"),x=D("./src/remux/mp4-remuxer.ts"),L=D("./src/remux/passthrough-remuxer.ts"),O=D("./src/demux/chunk-cache.ts"),C=D("./src/utils/mp4-tools.ts"),S=D("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(y){S.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:A.default,remux:x.default},{demux:k.default,remux:L.default},{demux:N.default,remux:x.default},{demux:_.default,remux:x.default}],o=1024;d.forEach(function(y){var h=y.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function y(c,l,a,v,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new O.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=v,this.id=g}var h=y.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,v,g){var m=this,R=v.transmuxing;R.executeStart=b();var U=new Uint8Array(l),W=this.cache,X=this.config,B=this.currentTransmuxState,F=this.transmuxConfig;g&&(this.currentTransmuxState=g);var z=u(U,a);if(z&&z.method==="AES-128"){var Q=this.getDecrypter();if(X.enableSoftwareAES){var ie=Q.softwareDecrypt(U,z.key.buffer,z.iv.buffer);if(!ie)return R.executeEnd=b(),T(v);U=new Uint8Array(ie)}else return this.decryptionPromise=Q.webCryptoDecrypt(U,z.key.buffer,z.iv.buffer).then(function(we){var Re=m.push(we,null,v);return m.decryptionPromise=null,Re}),this.decryptionPromise}var ce=g||B,Ce=ce.contiguous,pe=ce.discontinuity,Te=ce.trackSwitch,se=ce.accurateTimeOffset,de=ce.timeOffset,q=F.audioCodec,oe=F.videoCodec,ye=F.defaultInitPts,fe=F.duration,Le=F.initSegmentData;if((pe||Te)&&this.resetInitSegment(Le,q,oe,fe),pe&&this.resetInitialTimestamp(ye),Ce||this.resetContiguity(),this.needsProbing(U,pe,Te)){if(W.dataLength){var ve=W.flush();U=Object(C.appendUint8Array)(ve,U)}this.configureTransmuxer(U,F)}var De=this.transmux(U,z,de,se,v),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,R.executeEnd=b(),De},h.flush=function(l){var a=this,v=l.transmuxing;v.executeStart=b();var g=this.decrypter,m=this.cache,R=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(l)});var W=[],X=R.timeOffset;if(g){var B=g.flush();B&&W.push(this.push(B,null,l))}var F=m.dataLength;m.reset();var z=this.demuxer,Q=this.remuxer;if(!z||!Q)return F>=o&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=b(),[T(l)];var ie=z.flush(X);return f(ie)?ie.then(function(ce){return a.flushRemux(W,ce,l),W}):(this.flushRemux(W,ie,l),W)},h.flushRemux=function(l,a,v){var g=a.audioTrack,m=a.avcTrack,R=a.id3Track,U=a.textTrack,W=this.currentTransmuxState,X=W.accurateTimeOffset,B=W.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var F=this.remuxer.remux(g,m,R,U,B,X,!0,this.id);l.push({remuxResult:F,chunkMeta:v}),v.transmuxing.executeEnd=b()},h.resetInitialTimestamp=function(l){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(l),v.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,v,g){var m=this.demuxer,R=this.remuxer;if(!m||!R)return;m.resetInitSegment(a,v,g),R.resetInitSegment(l,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,v,g,m){var R;return a&&a.method==="SAMPLE-AES"?R=this.transmuxSampleAes(l,a,v,g,m):R=this.transmuxUnencrypted(l,v,g,m),R},h.transmuxUnencrypted=function(l,a,v,g){var m=this.demuxer.demux(l,a,!1,!this.config.progressive),R=m.audioTrack,U=m.avcTrack,W=m.id3Track,X=m.textTrack,B=this.remuxer.remux(R,U,W,X,a,v,!1,this.id);return{remuxResult:B,chunkMeta:g}},h.transmuxSampleAes=function(l,a,v,g,m){var R=this;return this.demuxer.demuxSampleAes(l,a,v).then(function(U){var W=R.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,v,g,!1,R.id);return{remuxResult:W,chunkMeta:m}})},h.configureTransmuxer=function(l,a){for(var v=this.config,g=this.observer,m=this.typeSupported,R=this.vendor,U=a.audioCodec,W=a.defaultInitPts,X=a.duration,B=a.initSegmentData,F=a.videoCodec,z,Q=0,ie=d.length;Q<ie;Q++)if(d[Q].demux.probe(l)){z=d[Q];break}z||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),z={demux:k.default,remux:L.default});var ce=this.demuxer,Ce=this.remuxer,pe=z.remux,Te=z.demux;(!Ce||!(Ce instanceof pe))&&(this.remuxer=new pe(g,v,m,R)),(!ce||!(ce instanceof Te))&&(this.demuxer=new Te(g,v,m),this.probe=Te.probe),this.resetInitSegment(B,U,F,X),this.resetInitialTimestamp(W)},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 P.default(this.observer,this.config)),l},y}();function u(y,h){var c=null;return y.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var T=function(h){return{remuxResult:{},chunkMeta:h}};function f(y){return"then"in y&&y.then instanceof Function}var p=function(h,c,l,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=v},w=function(h,c,l,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"discardEPB",function(){return T});var K=D("./src/demux/adts.ts"),M=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),N=D("./src/demux/id3.ts"),k=D("./src/demux/sample-aes.ts"),A=D("./src/events.ts"),_=D("./src/utils/mp4-tools.ts"),x=D("./src/utils/logger.ts"),L=D("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function f(w,y,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=w,this.config=y,this.typeSupported=h}f.probe=function(y){var h=f.syncOffset(y);return h<0?!1:(h&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(y){for(var h=Math.min(1e3,y.length-3*188),c=0;c<h;){if(y[c]===71&&y[c+188]===71&&y[c+2*188]===71)return c;c++}return-1},f.createTrack=function(y,h){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:O[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?h:void 0}};var p=f.prototype;return p.resetInitSegment=function(y,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=h,this._duration=c},p.resetTimeStamp=function(){},p.resetContiguity=function(){var y=this._audioTrack,h=this._avcTrack,c=this._id3Track;y&&(y.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(y,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,g=this._audioTrack,m=this._id3Track,R=v.pid,U=v.pesData,W=g.pid,X=m.pid,B=g.pesData,F=m.pesData,z=!1,Q=this.pmtParsed,ie=this._pmtId,ce=y.length;if(this.remainderData&&(y=Object(_.appendUint8Array)(this.remainderData,y),ce=y.length,this.remainderData=null),ce<188&&!l)return this.remainderData=y,{audioTrack:g,avcTrack:v,id3Track:m,textTrack:this._txtTrack};var Ce=Math.max(0,f.syncOffset(y));ce-=(ce+Ce)%188,ce<y.byteLength&&!l&&(this.remainderData=new Uint8Array(y.buffer,ce,y.buffer.byteLength-ce));for(var pe=Ce;pe<ce;pe+=188)if(y[pe]===71){var Te=!!(y[pe+1]&64),se=((y[pe+1]&31)<<8)+y[pe+2],de=(y[pe+3]&48)>>4,q=void 0;if(de>1){if(q=pe+5+y[pe+4],q===pe+188)continue}else q=pe+4;switch(se){case R:Te&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(y.subarray(q,pe+188)),U.size+=pe+188-q);break;case W:Te&&(B&&(a=o(B))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),B={data:[],size:0}),B&&(B.data.push(y.subarray(q,pe+188)),B.size+=pe+188-q);break;case X:Te&&(F&&(a=o(F))&&this.parseID3PES(a),F={data:[],size:0}),F&&(F.data.push(y.subarray(q,pe+188)),F.size+=pe+188-q);break;case 0:Te&&(q+=y[q]+1),ie=this._pmtId=b(y,q);break;case ie:{Te&&(q+=y[q]+1);var oe=d(y,q,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);R=oe.avc,R>0&&(v.pid=R),W=oe.audio,W>0&&(g.pid=W,g.isAAC=oe.isAAC),X=oe.id3,X>0&&(m.pid=X),z&&!Q&&(x.logger.log("reparse from beginning"),z=!1,pe=Ce-188),Q=this.pmtParsed=!0;break}case 17:case 8191:break;default:z=!0;break}}else this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=U,g.pesData=B,m.pesData=F;var ye={audioTrack:g,avcTrack:v,id3Track:m,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(ye),ye},p.flush=function(){var y=this.remainderData;this.remainderData=null;var h;return y?h=this.demux(y,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},p.extractRemainingSamples=function(y){var h=y.audioTrack,c=y.avcTrack,l=y.id3Track,a=c.pesData,v=h.pesData,g=l.pesData,m;a&&(m=o(a))?(this.parseAVCPES(m,!0),c.pesData=null):c.pesData=a,v&&(m=o(v))?(h.isAAC?this.parseAACPES(m):this.parseMPEGPES(m),h.pesData=null):(v!=null&&v.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),g&&(m=o(g))?(this.parseID3PES(m),l.pesData=null):l.pesData=g},p.demuxSampleAes=function(y,h,c){var l=this.demux(y,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,h);return this.decrypt(l,a)},p.decrypt=function(y,h){return new Promise(function(c){var l=y.audioTrack,a=y.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(y)}):c(y)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(y)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(y,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(y.data),v=!1,g=this.avcSample,m,R=!1;y.data=null,g&&a.length&&!l.audFound&&(s(g,l),g=this.avcSample=S(!1,y.pts,y.dts,"")),a.forEach(function(U){switch(U.type){case 1:{m=!0,g||(g=c.avcSample=S(!0,y.pts,y.dts,"")),v&&(g.debug+="NDR "),g.frame=!0;var W=U.data;if(R&&W.length>4){var X=new P.default(W).readSliceType();(X===2||X===4||X===7||X===9)&&(g.key=!0)}break}case 5:m=!0,g||(g=c.avcSample=S(!0,y.pts,y.dts,"")),v&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{m=!0,v&&g&&(g.debug+="SEI ");var B=new P.default(T(U.data));B.readUByte();for(var F=0,z=0,Q=!1,ie=0;!Q&&B.bytesAvailable>1;){F=0;do ie=B.readUByte(),F+=ie;while(ie===255);z=0;do ie=B.readUByte(),z+=ie;while(ie===255);if(F===4&&B.bytesAvailable!==0){Q=!0;var ce=B.readUByte();if(ce===181){var Ce=B.readUShort();if(Ce===49){var pe=B.readUInt();if(pe===1195456820){var Te=B.readUByte();if(Te===3){for(var se=B.readUByte(),de=B.readUByte(),q=31&se,oe=[se,de],ye=0;ye<q;ye++)oe.push(B.readUByte()),oe.push(B.readUByte()),oe.push(B.readUByte());u(c._txtTrack.samples,{type:3,pts:y.pts,bytes:oe})}}}}}else if(F===5&&B.bytesAvailable!==0){if(Q=!0,z>16){for(var fe=[],Le=0;Le<16;Le++)fe.push(B.readUByte().toString(16)),(Le===3||Le===5||Le===7||Le===9)&&fe.push("-");for(var ve=z-16,De=new Uint8Array(ve),be=0;be<ve;be++)De[be]=B.readUByte();u(c._txtTrack.samples,{pts:y.pts,payloadType:F,uuid:fe.join(""),userData:Object(N.utf8ArrayToStr)(De),userDataBytes:De})}}else if(z<B.bytesAvailable)for(var we=0;we<z;we++)B.readUByte()}break}case 7:if(m=!0,R=!0,v&&g&&(g.debug+="SPS "),!l.sps){var Re=new P.default(U.data),Fe=Re.readSPS();l.width=Fe.width,l.height=Fe.height,l.pixelRatio=Fe.pixelRatio,l.sps=[U.data],l.duration=c._duration;for(var Pe=U.data.subarray(1,4),Ae="avc1.",Se=0;Se<3;Se++){var We=Pe[Se].toString(16);We.length<2&&(We="0"+We),Ae+=We}l.codec=Ae}break;case 8:m=!0,v&&g&&(g.debug+="PPS "),l.pps||(l.pps=[U.data]);break;case 9:m=!1,l.audFound=!0,g&&s(g,l),g=c.avcSample=S(!1,y.pts,y.dts,v?"AUD ":"");break;case 12:m=!1;break;default:m=!1,g&&(g.debug+="unknown NAL "+U.type+" ");break}if(g&&m){var Ge=g.units;Ge.push(U)}}),h&&g&&(s(g,l),this.avcSample=null)},p.getLastNalUnit=function(){var y,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((y=h)!==null&&y!==void 0&&y.units){var a=h.units;c=a[a.length-1]}return c},p.parseAVCNALu=function(y){var h=y.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,v=[],g=0,m,R,U,W=-1,X=0;for(l===-1&&(W=0,X=y[0]&31,l=0,g=1);g<h;){if(m=y[g++],!l){l=m?0:1;continue}if(l===1){l=m?0:2;continue}if(!m)l=3;else if(m===1){if(W>=0){var B={data:y.subarray(W,g-l-1),type:X};v.push(B)}else{var F=this.getLastNalUnit();if(F&&(a&&g<=4-a&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-a))),R=g-l-1,R>0)){var z=new Uint8Array(F.data.byteLength+R);z.set(F.data,0),z.set(y.subarray(0,R),F.data.byteLength),F.data=z,F.state=0}}g<h?(U=y[g]&31,W=g,X=U,l=0):l=-1}else l=0}if(W>=0&&l>=0){var Q={data:y.subarray(W,h),type:X,state:l};v.push(Q)}if(v.length===0){var ie=this.getLastNalUnit();if(ie){var ce=new Uint8Array(ie.data.byteLength+y.byteLength);ce.set(ie.data,0),ce.set(y,ie.data.byteLength),ie.data=ce}}return c.naluState=l,v},p.parseAACPES=function(y){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=y.data;if(l){this.aacOverFlow=null;var v=l.sample.unit.byteLength,g=Math.min(l.missing,v),m=v-g;l.sample.unit.set(a.subarray(0,g),m),c.samples.push(l.sample),h=l.missing}var R,U;for(R=h,U=a.length;R<U-1&&!K.isHeader(a,R);R++);if(R!==h){var W,X;if(R<U-1?(W="AAC PES did not start with ADTS header,offset:"+R,X=!1):(W="no ADTS header found in AAC PES",X=!0),x.logger.warn("parsing error:"+W),this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:X,reason:W}),X)return}K.initTrackConfig(c,this.observer,a,R,this.audioCodec);var B;if(y.pts!==void 0)B=y.pts;else if(l){var F=K.getFrameDuration(c.samplerate);B=l.sample.pts+F}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var z=0;R<U;)if(K.isHeader(a,R)){if(R+5<U){var Q=K.appendFrame(c,a,R,B,z);if(Q)if(Q.missing)this.aacOverFlow=Q;else{R+=Q.length,z++;continue}}break}else R++},p.parseMPEGPES=function(y){var h=y.data,c=h.length,l=0,a=0,v=y.pts;if(v===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(M.isHeader(h,a)){var g=M.appendFrame(this._audioTrack,h,a,v,l);if(g)a+=g.length,l++;else break}else a++},p.parseID3PES=function(y){if(y.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},f}();C.minProbeByteLength=188;function S(f,p,w,y){return{key:f,frame:!1,pts:p,dts:w,units:[],debug:y,length:0}}function b(f,p){return(f[p+10]&31)<<8|f[p+11]}function d(f,p,w,y){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[p+1]&15)<<8|f[p+2],l=p+3+c-4,a=(f[p+10]&15)<<8|f[p+11];for(p+=12+a;p<l;){var v=(f[p+1]&31)<<8|f[p+2];switch(f[p]){case 207:if(!y){x.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(!y){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:w?h.audio===-1&&(h.audio=v,h.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((f[p+3]&15)<<8|f[p+4])+5}return h}function o(f){var p=0,w,y,h,c,l,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}w=a[0];var g=(w[0]<<16)+(w[1]<<8)+w[2];if(g===1){if(y=(w[4]<<8)+w[5],y&&y>f.size-6)return null;var m=w[7];m&192&&(c=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,m&64?(l=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,c-l>60*9e4&&(x.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=w[8];var R=h+9;if(f.size<=R)return null;f.size-=R;for(var U=new Uint8Array(f.size),W=0,X=a.length;W<X;W++){w=a[W];var B=w.byteLength;if(R)if(R>B){R-=B;continue}else w=w.subarray(R),B-=R,R=0;U.set(w,p),p+=B}return y&&(y-=h+3),{data:U,pts:c,dts:l,len:y}}return null}function s(f,p){if(f.units.length&&f.frame){if(f.pts===void 0){var w=p.samples,y=w.length;if(y){var h=w[y-1];f.pts=h.pts,f.dts=h.dts}else{p.dropped++;return}}p.samples.push(f)}f.debug.length&&x.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function u(f,p){var w=f.length;if(w>0){if(p.pts>=f[w-1].pts)f.push(p);else for(var y=w-1;y>=0;y--)if(p.pts<f[y].pts){f.splice(y,0,p);break}}else f.push(p)}function T(f){for(var p=f.byteLength,w=[],y=1;y<p-2;)f[y]===0&&f[y+1]===0&&f[y+2]===3?(w.push(y+2),y+=2):y++;if(w.length===0)return f;var h=p-w.length,c=new Uint8Array(h),l=0;for(y=0;y<h;l++,y++)l===w[0]&&(l++,w.shift()),c[y]=f[l];return c}G.default=C},"./src/errors.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"ErrorTypes",function(){return K}),D.d(G,"ErrorDetails",function(){return M});var K;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(K||(K={}));var M;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"Events",function(){return K});var K;(function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return f});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(K),P=D("./src/loader/playlist-loader.ts"),N=D("./src/loader/key-loader.ts"),k=D("./src/controller/id3-track-controller.ts"),A=D("./src/controller/latency-controller.ts"),_=D("./src/controller/level-controller.ts"),x=D("./src/controller/fragment-tracker.ts"),L=D("./src/controller/stream-controller.ts"),O=D("./src/is-supported.ts"),C=D("./src/utils/logger.ts"),S=D("./src/config.ts"),b=D("./node_modules/eventemitter3/index.js"),d=D.n(b),o=D("./src/events.ts"),s=D("./src/errors.ts");function u(p,w){for(var y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(p,h.key,h)}}function T(p,w,y){return w&&u(p.prototype,w),y&&u(p,y),p}var f=function(){p.isSupported=function(){return Object(O.isSupported)()};function p(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(S.mergeConfig)(p.DefaultConfig,y);this.userConfig=y,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(S.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,v=h.fpsController,g=this.abrController=new c(this),m=this.bufferController=new l(this),R=this.capLevelController=new a(this),U=new v(this),W=new P.default(this),X=new N.default(this),B=new k.default(this),F=this.levelController=new _.default(this),z=new x.FragmentTracker(this),Q=this.streamController=new L.default(this,z);R.setStreamController(Q),U.setStreamController(Q);var ie=[F,Q];this.networkControllers=ie;var ce=[W,X,g,m,R,U,B,z];this.audioTrackController=this.createController(h.audioTrackController,null,ie),this.createController(h.audioStreamController,z,ie),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ie),this.createController(h.subtitleStreamController,z,ie),this.createController(h.timelineController,null,ce),this.emeController=this.createController(h.emeController,null,ce),this.cmcdController=this.createController(h.cmcdController,null,ce),this.latencyController=this.createController(A.default,null,ce),this.coreComponents=ce}var w=p.prototype;return w.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},w.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},w.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},w.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},w.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},w.listeners=function(h){return this._emitter.listeners(h)},w.emit=function(h,c,l){return this._emitter.emit(h,c,l)},w.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},w.listenerCount=function(h){return this._emitter.listenerCount(h)},w.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},w.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},w.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=K.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},w.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},w.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},w.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},w.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},T(p,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:S.hlsDefaultConfig},set:function(h){p.defaultConfig=h}}]),p}();f.defaultConfig=void 0},"./src/is-supported.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isSupported",function(){return P}),D.d(G,"changeTypeSupported",function(){return N});var K=D("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(K.getMediaSource)();if(!k)return!1;var A=M(),_=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!A||A.prototype&&typeof A.prototype.appendBuffer=="function"&&typeof A.prototype.remove=="function";return!!_&&!!x}function N(){var k,A=M();return typeof(A==null||((k=A.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return C}),D.d(G,"LoadError",function(){return b});var K=D("./src/polyfills/number.ts"),M=D("./src/errors.ts");function P(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,x(d,o)}function N(d){var o=typeof Map=="function"?new Map:void 0;return N=function(u){if(u===null||!_(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,T)}function T(){return k(u,arguments,L(this).constructor)}return T.prototype=Object.create(u.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),x(T,u)},N(d)}function k(d,o,s){return A()?k=Reflect.construct:k=function(T,f,p){var w=[null];w.push.apply(w,f);var y=Function.bind.apply(T,w),h=new y;return p&&x(h,p.prototype),h},k.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function _(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function x(d,o){return x=Object.setPrototypeOf||function(u,T){return u.__proto__=T,u},x(d,o)}function L(d){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},L(d)}var O=Math.pow(2,17),C=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,T){var f=this,p=u.url;if(!p)return Promise.reject(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var w=this.config,y=w.fLoader,h=w.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=u.loader=y?new y(w):new h(w),v=S(u),g={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:O};u.stats=a.stats,a.load(v,g,{onSuccess:function(R,U,W,X){f.resetLoader(u,a),c({frag:u,part:null,payload:R.data,networkDetails:X})},onError:function(R,U,W){f.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:R,networkDetails:W}))},onAbort:function(R,U,W){f.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:W}))},onTimeout:function(R,U,W){f.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:W}))},onProgress:function(R,U,W,X){T&&T({frag:u,part:null,payload:W,networkDetails:X})}})})},o.loadPart=function(u,T,f){var p=this;this.abort();var w=this.config,y=w.fLoader,h=w.loader;return new Promise(function(c,l){p.loader&&p.loader.destroy();var a=p.loader=u.loader=y?new y(w):new h(w),v=S(u,T),g={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:O};T.stats=a.stats,a.load(v,g,{onSuccess:function(R,U,W,X){p.resetLoader(u,a),p.updateStatsFromPart(u,T);var B={frag:u,part:T,payload:R.data,networkDetails:X};f(B),c(B)},onError:function(R,U,W){p.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:T,response:R,networkDetails:W}))},onAbort:function(R,U,W){u.stats.aborted=T.stats.aborted,p.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:T,networkDetails:W}))},onTimeout:function(R,U,W){p.resetLoader(u,a),l(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:T,networkDetails:W}))}})})},o.updateStatsFromPart=function(u,T){var f=u.stats,p=T.stats,w=p.total;if(f.loaded+=p.loaded,w){var y=Math.round(u.duration/T.duration),h=Math.min(Math.round(f.loaded/w),y),c=y-h,l=c*Math.round(f.loaded/h);f.total=f.loaded+l}else f.total=Math.max(f.loaded,f.total);var a=f.loading,v=p.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(u,T){u.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},d}();function S(d,o){o===void 0&&(o=null);var s=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},T=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(K.isFiniteNumber)(T)&&Object(K.isFiniteNumber)(f)&&(u.rangeStart=T,u.rangeEnd=f),u}var b=function(d){P(o,d);function o(s){for(var u,T=arguments.length,f=new Array(T>1?T-1:0),p=1;p<T;p++)f[p-1]=arguments[p];return u=d.call.apply(d,[this].concat(f))||this,u.data=void 0,u.data=s,u}return o}(N(Error))},"./src/loader/fragment.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"ElementaryStreamTypes",function(){return C}),D.d(G,"BaseSegment",function(){return S}),D.d(G,"Fragment",function(){return b}),D.d(G,"Part",function(){return d});var K=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(M),N=D("./src/utils/logger.ts"),k=D("./src/loader/level-key.ts"),A=D("./src/loader/load-stats.ts");function _(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,x(o,s)}function x(o,s){return x=Object.setPrototypeOf||function(T,f){return T.__proto__=f,T},x(o,s)}function L(o,s){for(var u=0;u<s.length;u++){var T=s[u];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function O(o,s,u){return s&&L(o.prototype,s),u&&L(o,u),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var S=function(){function o(u){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[C.AUDIO]=null,T[C.VIDEO]=null,T[C.AUDIOVIDEO]=null,T),this.baseurl=u}var s=o.prototype;return s.setByteRange=function(T,f){var p=T.split("@",2),w=[];p.length===1?w[0]=f?f.byteRangeEndOffset:0:w[0]=parseInt(p[1]),w[1]=parseInt(p[0])+w[0],this._byteRange=w},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(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),o}(),b=function(o){_(s,o);function s(T,f){var p;return p=o.call(this,f)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new A.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=T,p}var u=s.prototype;return u.createInitializationVector=function(f){for(var p=new Uint8Array(16),w=12;w<16;w++)p[w]=f>>8*(15-w)&255;return p},u.setDecryptDataFromLevelKey=function(f,p){var w=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(w=k.LevelKey.fromURI(f.uri),w.method=f.method,w.iv=this.createInitializationVector(p),w.keyFormat="identity"),w},u.setElementaryStreamInfo=function(f,p,w,y,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[f];if(!a){l[f]={startPTS:p,endPTS:w,startDTS:y,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,h)},u.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null},O(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var f=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(S),d=function(o){_(s,o);function s(u,T,f,p,w){var y;y=o.call(this,f)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new A.LoadStats,y.duration=u.decimalFloatingPoint("DURATION"),y.gap=u.bool("GAP"),y.independent=u.bool("INDEPENDENT"),y.relurl=u.enumeratedString("URI"),y.fragment=T,y.index=p;var h=u.enumeratedString("BYTERANGE");return h&&y.setByteRange(h,w),w&&(y.fragOffset=w.fragOffset+w.duration),y}return O(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),s}(S)},"./src/loader/key-loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return N});var K=D("./src/events.ts"),M=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),N=function(){function k(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var A=k.prototype;return A._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},A._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},A.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var L=this.loaders[x];L&&L.destroy()}this.loaders={}},A.onKeyLoading=function(x,L){var O=L.frag,C=O.type,S=this.loaders[C];if(!O.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=O.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(S&&(P.logger.warn("abort previous key loader for type:"+C),S.abort()),!b){P.logger.warn("key uri is falsy");return}var o=d.loader,s=O.loader=this.loaders[C]=new o(d);this.decrypturl=b,this.decryptkey=null;var u={url:b,frag:O,responseType:"arraybuffer"},T={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,T,f)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:O}))},A.loadsuccess=function(x,L,O){var C=O.frag;if(!C.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(x.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:C})},A.loaderror=function(x,L){var O=L.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:x})},A.loadtimeout=function(x,L){var O=L.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(K.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},k}()},"./src/loader/level-details.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"LevelDetails",function(){return k});var K=D("./src/polyfills/number.ts");function M(A,_){for(var x=0;x<_.length;x++){var L=_[x];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(A,L.key,L)}}function P(A,_,x){return _&&M(A.prototype,_),x&&M(A,x),A}var N=10,k=function(){function A(x){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=x}var _=A.prototype;return _.reloaded=function(L){if(!L){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-L.lastPartSn,C=this.lastPartIndex-L.lastPartIndex;this.updated=this.endSN!==L.endSN||!!C||!!O,this.advanced=this.endSN>L.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(L.misses*.6):this.misses=L.misses+1,this.availabilityDelay=L.availabilityDelay},P(A,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var L=this.driftEndTime-this.driftStartTime;if(L>0){var O=this.driftEnd-this.driftStart;return O*1e3/L}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var L;return(L=this.fragments)!==null&&L!==void 0&&L.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 L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),A}()},"./src/loader/level-key.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"LevelKey",function(){return k});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(K);function P(A,_){for(var x=0;x<_.length;x++){var L=_[x];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(A,L.key,L)}}function N(A,_,x){return _&&P(A.prototype,_),x&&P(A,x),A}var k=function(){A.fromURL=function(x,L){return new A(x,L)},A.fromURI=function(x){return new A(x)};function A(_,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(K.buildAbsoluteURL)(_,x,{alwaysNormalize:!0}):this._uri=_}return N(A,[{key:"uri",get:function(){return this._uri}}]),A}()},"./src/loader/load-stats.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"LoadStats",function(){return K});var K=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s});var K=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(M),N=D("./src/loader/fragment.ts"),k=D("./src/loader/level-details.ts"),A=D("./src/loader/level-key.ts"),_=D("./src/utils/attr-list.ts"),x=D("./src/utils/logger.ts"),L=D("./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,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var y,h;return d.test((y=(h=M.parseURL(w))===null||h===void 0?void 0:h.path)!=null?y:"")}var s=function(){function w(){}return w.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},w.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},w.resolve=function(h,c){return M.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(h,c){var l=[],a={},v=!1;O.lastIndex=0;for(var g;(g=O.exec(h))!=null;)if(g[1]){var m=new _.AttrList(g[1]),R={attrs:m,bitrate:m.decimalInteger("AVERAGE-BANDWIDTH")||m.decimalInteger("BANDWIDTH"),name:m.NAME,url:w.resolve(g[2],c)},U=m.decimalResolution("RESOLUTION");U&&(R.width=U.width,R.height=U.height),u((m.CODECS||"").split(/[ ,]+/).filter(function(X){return X}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=w.convertAVC1ToAVCOTI(R.videoCodec)),l.push(R)}else if(g[3]){var W=new _.AttrList(g[3]);W["DATA-ID"]&&(v=!0,a[W["DATA-ID"]]=W)}return{levels:l,sessionData:v?a:null}},w.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var v,g=[],m=0;for(C.lastIndex=0;(v=C.exec(h))!==null;){var R=new _.AttrList(v[1]);if(R.TYPE===l){var U={attrs:R,bitrate:0,id:m++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:l,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?w.resolve(R.URI,c):""};if(a.length){var W=w.findGroup(a,U.groupId)||a[0];T(U,W,"audioCodec"),T(U,W,"textCodec")}g.push(U)}}return g},w.parseLevelPlaylist=function(h,c,l,a,v){var g=new k.LevelDetails(c),m=g.fragments,R=null,U=0,W=0,X=0,B=0,F=null,z=new N.Fragment(a,c),Q,ie,ce,Ce=-1,pe=!1;for(S.lastIndex=0,g.m3u8=h;(Q=S.exec(h))!==null;){pe&&(pe=!1,z=new N.Fragment(a,c),z.start=X,z.sn=U,z.cc=B,z.level=l,R&&(z.initSegment=R,z.rawProgramDateTime=R.rawProgramDateTime));var Te=Q[1];if(Te){z.duration=parseFloat(Te);var se=(" "+Q[2]).slice(1);z.title=se||null,z.tagList.push(se?["INF",Te,se]:["INF",Te])}else if(Q[3])Object(K.isFiniteNumber)(z.duration)&&(z.start=X,ce&&(z.levelkey=ce),z.sn=U,z.level=l,z.cc=B,z.urlId=v,m.push(z),z.relurl=(" "+Q[3]).slice(1),p(z,F),F=z,X+=z.duration,U++,W=0,pe=!0);else if(Q[4]){var de=(" "+Q[4]).slice(1);F?z.setByteRange(de,F):z.setByteRange(de)}else if(Q[5])z.rawProgramDateTime=(" "+Q[5]).slice(1),z.tagList.push(["PROGRAM-DATE-TIME",z.rawProgramDateTime]),Ce===-1&&(Ce=m.length);else{if(Q=Q[0].match(b),!Q){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<Q.length&&!(typeof Q[ie]!="undefined");ie++);var q=(" "+Q[ie]).slice(1),oe=(" "+Q[ie+1]).slice(1),ye=Q[ie+2]?(" "+Q[ie+2]).slice(1):"";switch(q){case"PLAYLIST-TYPE":g.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":U=g.startSN=parseInt(oe);break;case"SKIP":{var fe=new _.AttrList(oe),Le=fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(Le)){g.skippedSegments=Le;for(var ve=Le;ve--;)m.unshift(null);U+=Le}var De=fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");De&&(g.recentlyRemovedDateranges=De.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(oe);break;case"VERSION":g.version=parseInt(oe);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(oe||ye)&&z.tagList.push(ye?[oe,ye]:[oe]);break;case"DIS":B++;case"GAP":z.tagList.push([q]);break;case"BITRATE":z.tagList.push([q,oe]);break;case"DISCONTINUITY-SEQ":B=parseInt(oe);break;case"KEY":{var be,we=new _.AttrList(oe),Re=we.enumeratedString("METHOD"),Fe=we.URI,Pe=we.hexadecimalInteger("IV"),Ae=we.enumeratedString("KEYFORMATVERSIONS"),Se=we.enumeratedString("KEYID"),We=(be=we.enumeratedString("KEYFORMAT"))!=null?be:"identity",Ge=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ge.indexOf(We)>-1){x.logger.warn("Keyformat "+We+" is not supported from the manifest");continue}else if(We!=="identity")continue;Re&&(ce=A.LevelKey.fromURL(c,Fe),Fe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ce.method=Re,ce.keyFormat=We,Se&&(ce.keyID=Se),Ae&&(ce.keyFormatVersions=Ae),ce.iv=Pe));break}case"START":{var Xe=new _.AttrList(oe),je=Xe.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(je)&&(g.startTimeOffset=je);break}case"MAP":{var qe=new _.AttrList(oe);z.relurl=qe.URI,qe.BYTERANGE&&z.setByteRange(qe.BYTERANGE),z.level=l,z.sn="initSegment",ce&&(z.levelkey=ce),z.initSegment=null,R=z,pe=!0;break}case"SERVER-CONTROL":{var Ue=new _.AttrList(oe);g.canBlockReload=Ue.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Ue.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Ue.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Ue.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Ue.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ke=new _.AttrList(oe);g.partTarget=Ke.decimalFloatingPoint("PART-TARGET");break}case"PART":{var xe=g.partList;xe||(xe=g.partList=[]);var $e=W>0?xe[xe.length-1]:void 0,Ye=W++,_e=new N.Part(new _.AttrList(oe),z,c,Ye,$e);xe.push(_e),z.duration+=_e.duration;break}case"PRELOAD-HINT":{var Ie=new _.AttrList(oe);g.preloadHint=Ie;break}case"RENDITION-REPORT":{var ne=new _.AttrList(oe);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ne);break}default:x.logger.warn("line parsed but not handled: "+Q);break}}}F&&!F.relurl?(m.pop(),X-=F.duration,g.partList&&(g.fragmentHint=F)):g.partList&&(p(z,F),z.cc=B,g.fragmentHint=z);var ae=m.length,le=m[0],Y=m[ae-1];if(X+=g.skippedSegments*g.targetduration,X>0&&ae&&Y){g.averagetargetduration=X/ae;var $=Y.sn;g.endSN=$!=="initSegment"?$:0,le&&(g.startCC=le.cc,le.initSegment||g.fragments.every(function(J){return J.relurl&&o(J.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),z=new N.Fragment(a,c),z.relurl=Y.relurl,z.level=l,z.sn="initSegment",le.initSegment=z,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(X+=g.fragmentHint.duration),g.totalduration=X,g.endCC=B,Ce>0&&f(m,Ce),g},w}();function u(w,y){["video","audio","text"].forEach(function(h){var c=w.filter(function(a){return Object(L.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[h+"Codec"]=l.length>0?l[0]:c[0],w=w.filter(function(a){return c.indexOf(a)===-1})}}),y.unknownCodecs=w}function T(w,y,h){var c=y[h];c&&(w[h]=c)}function f(w,y){for(var h=w[y],c=y;c--;){var l=w[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function p(w,y){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):y!=null&&y.programDateTime&&(w.programDateTime=y.endProgramDateTime),Object(K.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),P=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),k=D("./src/utils/mp4-tools.ts"),A=D("./src/loader/m3u8-parser.ts"),_=D("./src/types/loader.ts"),x=D("./src/utils/attr-list.ts");function L(S){var b=S.type;switch(b){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function O(S,b){var d=S.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var C=function(){function S(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=S.prototype;return b.registerListeners=function(){var o=this.hls;o.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(o){var s=this.hls.config,u=s.pLoader,T=s.loader,f=u||T,p=new f(s);return o.loader=p,this.loaders[o.type]=p,p},b.getInternalLoader=function(o){return this.loaders[o.type]},b.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},b.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(o,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},b.onLevelLoading=function(o,s){var u=s.id,T=s.level,f=s.url,p=s.deliveryDirectives;this.load({id:u,groupId:null,level:T,responseType:"text",type:_.PlaylistContextType.LEVEL,url:f,deliveryDirectives:p})},b.onAudioTrackLoading=function(o,s){var u=s.id,T=s.groupId,f=s.url,p=s.deliveryDirectives;this.load({id:u,groupId:T,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:p})},b.onSubtitleTrackLoading=function(o,s){var u=s.id,T=s.groupId,f=s.url,p=s.deliveryDirectives;this.load({id:u,groupId:T,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:p})},b.load=function(o){var s,u=this.hls.config,T=this.getInternalLoader(o);if(T){var f=T.context;if(f&&f.url===o.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),T.abort()}var p,w,y,h;switch(o.type){case _.PlaylistContextType.MANIFEST:p=u.manifestLoadingMaxRetry,w=u.manifestLoadingTimeOut,y=u.manifestLoadingRetryDelay,h=u.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:p=0,w=u.levelLoadingTimeOut;break;default:p=u.levelLoadingMaxRetry,w=u.levelLoadingTimeOut,y=u.levelLoadingRetryDelay,h=u.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===_.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===_.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===_.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(w=Math.min(Math.max(l*3,a*.8)*1e3,w))}}var v={timeout:w,maxRetry:p,retryDelay:y,maxRetryDelay:h,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(o,v,g)},b.loadsuccess=function(o,s,u,T){if(T===void 0&&(T=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,s,u,T);return}this.resetInternalLoader(u.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",T);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,u,T):this.handleMasterPlaylist(o,s,u,T)},b.loaderror=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,o)},b.loadtimeout=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},b.handleMasterPlaylist=function(o,s,u,T){var f=this.hls,p=o.data,w=O(o,u),y=A.default.parseMasterPlaylist(p,w),h=y.levels,c=y.sessionData;if(!h.length){this.handleManifestParsingError(o,u,"no level found in manifest",T);return}var l=h.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=h.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),v=A.default.parseMasterPlaylistMedia(p,w,"AUDIO",l),g=A.default.parseMasterPlaylistMedia(p,w,"SUBTITLES",a),m=A.default.parseMasterPlaylistMedia(p,w,"CLOSED-CAPTIONS");if(v.length){var R=v.some(function(U){return!U.url});!R&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(N.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 x.AttrList({}),bitrate:0,url:""}))}f.trigger(M.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:g,captions:m,url:w,stats:s,networkDetails:T,sessionData:c})},b.handleTrackOrLevelPlaylist=function(o,s,u,T){var f=this.hls,p=u.id,w=u.level,y=u.type,h=O(o,u),c=Object(K.isFiniteNumber)(p)?p:0,l=Object(K.isFiniteNumber)(w)?w:c,a=L(u),v=A.default.parseLevelPlaylist(o.data,h,l,a,c);if(!v.fragments.length){f.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(y===_.PlaylistContextType.MANIFEST){var g={attrs:new x.AttrList({}),bitrate:0,details:v,name:"",url:h};f.trigger(M.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:h,stats:s,networkDetails:T,sessionData:null})}if(s.parsing.end=performance.now(),v.needSidxRanges){var m,R=(m=v.fragments[0].initSegment)===null||m===void 0?void 0:m.url;this.load({url:R,isSidxRequest:!0,type:y,level:w,levelDetails:v,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=v,this.handlePlaylistLoaded(o,s,u,T)},b.handleSidxRequest=function(o,s){var u=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var T=u.references,f=s.levelDetails;T.forEach(function(p,w){var y=p.info,h=f.fragments[w];h.byteRange.length===0&&h.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),h.initSegment&&h.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(o,s,u,T){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:s,networkDetails:T})},b.handleNetworkError=function(o,s,u,T){u===void 0&&(u=!1),N.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=P.ErrorDetails.UNKNOWN,p=!1,w=this.getInternalLoader(o);switch(o.type){case _.PlaylistContextType.MANIFEST:f=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case _.PlaylistContextType.LEVEL:f=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case _.PlaylistContextType.AUDIO_TRACK:f=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:f=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}w&&this.resetInternalLoader(o.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:f,fatal:p,url:o.url,loader:w,context:o,networkDetails:s};T&&(y.response=T),this.hls.trigger(M.Events.ERROR,y)},b.handlePlaylistLoaded=function(o,s,u,T){var f=u.type,p=u.level,w=u.id,y=u.groupId,h=u.loader,c=u.levelDetails,l=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",T);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:c,level:p||0,id:w||0,stats:s,networkDetails:T,deliveryDirectives:l});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:c,id:w||0,groupId:y||"",stats:s,networkDetails:T,deliveryDirectives:l});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:c,id:w||0,groupId:y||"",stats:s,networkDetails:T,deliveryDirectives:l});break}},S}();G.default=C},"./src/polyfills/number.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isFiniteNumber",function(){return K}),D.d(G,"MAX_SAFE_INTEGER",function(){return M});var K=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Z,G,D){"use strict";D.r(G);var K=function(){function M(){}return M.getSilentFrame=function(N,k){switch(N){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===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(k===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(k===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(k===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(k===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},M}();G.default=K},"./src/remux/mp4-generator.ts":function(Z,G,D){"use strict";D.r(G);var K=Math.pow(2,32)-1,M=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in P.types)P.types.hasOwnProperty(k)&&(P.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var A=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]),_=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:A,audio:_};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=L,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,O,S,O,C),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,x))},P.box=function(k){for(var A=8,_=arguments.length,x=new Array(_>1?_-1:0),L=1;L<_;L++)x[L-1]=arguments[L];for(var O=x.length,C=O;O--;)A+=x[O].byteLength;var S=new Uint8Array(A);for(S[0]=A>>24&255,S[1]=A>>16&255,S[2]=A>>8&255,S[3]=A&255,S.set(k,4),O=0,A=8;O<C;O++)S.set(x[O],A),A+=x[O].byteLength;return S},P.hdlr=function(k){return P.box(P.types.hdlr,P.HDLR_TYPES[k])},P.mdat=function(k){return P.box(P.types.mdat,k)},P.mdhd=function(k,A){A*=k;var _=Math.floor(A/(K+1)),x=Math.floor(A%(K+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,_>>24,_>>16&255,_>>8&255,_&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},P.mdia=function(k){return P.box(P.types.mdia,P.mdhd(k.timescale,k.duration),P.hdlr(k.type),P.minf(k))},P.mfhd=function(k){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},P.minf=function(k){return k.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(k)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(k))},P.moof=function(k,A,_){return P.box(P.types.moof,P.mfhd(k),P.traf(_,A))},P.moov=function(k){for(var A=k.length,_=[];A--;)_[A]=P.trak(k[A]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(_).concat(P.mvex(k)))},P.mvex=function(k){for(var A=k.length,_=[];A--;)_[A]=P.trex(k[A]);return P.box.apply(null,[P.types.mvex].concat(_))},P.mvhd=function(k,A){A*=k;var _=Math.floor(A/(K+1)),x=Math.floor(A%(K+1)),L=new Uint8Array([1,0,0,0,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,_>>24,_>>16&255,_>>8&255,_&255,x>>24,x>>16&255,x>>8&255,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,L)},P.sdtp=function(k){var A=k.samples||[],_=new Uint8Array(4+A.length),x,L;for(x=0;x<A.length;x++)L=A[x].flags,_[x+4]=L.dependsOn<<4|L.isDependedOn<<2|L.hasRedundancy;return P.box(P.types.sdtp,_)},P.stbl=function(k){return P.box(P.types.stbl,P.stsd(k),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(k){var A=[],_=[],x,L,O;for(x=0;x<k.sps.length;x++)L=k.sps[x],O=L.byteLength,A.push(O>>>8&255),A.push(O&255),A=A.concat(Array.prototype.slice.call(L));for(x=0;x<k.pps.length;x++)L=k.pps[x],O=L.byteLength,_.push(O>>>8&255),_.push(O&255),_=_.concat(Array.prototype.slice.call(L));var C=P.box(P.types.avcC,new Uint8Array([1,A[3],A[4],A[5],252|3,224|k.sps.length].concat(A).concat([k.pps.length]).concat(_))),S=k.width,b=k.height,d=k.pixelRatio[0],o=k.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,S>>8&255,S&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(k){var A=k.config.length;return new Uint8Array([0,0,0,0,3,23+A,0,1,0,4,15+A,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([A]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var A=k.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var A=k.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]))},P.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(k)):P.box(P.types.stsd,P.STSD,P.mp4a(k)):P.box(P.types.stsd,P.STSD,P.avc1(k))},P.tkhd=function(k){var A=k.id,_=k.duration*k.timescale,x=k.width,L=k.height,O=Math.floor(_/(K+1)),C=Math.floor(_%(K+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,A>>24&255,A>>16&255,A>>8&255,A&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,x>>8&255,x&255,0,0,L>>8&255,L&255,0,0]))},P.traf=function(k,A){var _=P.sdtp(k),x=k.id,L=Math.floor(A/(K+1)),O=Math.floor(A%(K+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,L>>24,L>>16&255,L>>8&255,L&255,O>>24,O>>16&255,O>>8&255,O&255])),P.trun(k,_.length+16+20+8+16+8+8),_)},P.trak=function(k){return k.duration=k.duration||4294967295,P.box(P.types.trak,P.tkhd(k),P.mdia(k))},P.trex=function(k){var A=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,A){var _=k.samples||[],x=_.length,L=12+16*x,O=new Uint8Array(L),C,S,b,d,o,s;for(A+=8+L,O.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0),C=0;C<x;C++)S=_[C],b=S.duration,d=S.size,o=S.flags,s=S.cts,O.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return P.box(P.types.trun,O)},P.initSegment=function(k){P.types||P.init();var A=P.moov(k),_=new Uint8Array(P.FTYP.byteLength+A.byteLength);return _.set(P.FTYP),_.set(A,P.FTYP.byteLength),_},P}();M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0,G.default=M},"./src/remux/mp4-remuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"normalizePts",function(){return u});var K=D("./src/polyfills/number.ts"),M=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),N=D("./src/events.ts"),k=D("./src/errors.ts"),A=D("./src/utils/logger.ts"),_=D("./src/types/loader.ts"),x=D("./src/utils/timescale-conversion.ts");function L(){return L=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},L.apply(this,arguments)}var O=10*1e3,C=1024,S=1152,b=null,d=null,o=!1,s=function(){function w(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,b===null){var v=navigator.userAgent||"",g=v.match(/Chrome\/(\d+)/i);b=g?parseInt(g[1]):0}if(d===null){var m=navigator.userAgent.match(/Safari\/(\d+)/i);d=m?parseInt(m[1]):0}o=!!b&&b<75||!!d&&d<600}var y=w.prototype;return y.destroy=function(){},y.resetTimeStamp=function(c){A.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},y.resetNextTimestamp=function(){A.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){A.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(v,g){var m=g.pts-v;return m<-4294967296?(l=!0,u(v,g.pts)):m>0?v:g.pts},c[0].pts);return l&&A.logger.debug("PTS rollover detected"),a},y.remux=function(c,l,a,v,g,m,R,U){var W,X,B,F,z,Q,ie=g,ce=g,Ce=c.pid>-1,pe=l.pid>-1,Te=l.samples.length,se=c.samples.length>0,de=Te>1,q=(!Ce||se)&&(!pe||de)||this.ISGenerated||R;if(q){this.ISGenerated||(B=this.generateIS(c,l,g));var oe=this.isVideoContiguous,ye=-1;if(de&&(ye=T(l.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(Q=!0,ye>0){A.logger.warn("[mp4-remuxer]: Dropped "+ye+" out of "+Te+" video samples due to a missing keyframe");var fe=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(ye),l.dropped+=ye,ce+=(l.samples[0].pts-fe)/(l.timescale||9e4)}else ye===-1&&(A.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),Q=!1);if(this.ISGenerated){if(se&&de){var Le=this.getVideoStartPts(l.samples),ve=u(c.samples[0].pts,Le)-Le,De=ve/l.inputTimeScale;ie+=Math.max(0,De),ce+=Math.max(0,-De)}if(se){if(c.samplerate||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(c,l,g)),X=this.remuxAudio(c,ie,this.isAudioContiguous,m,pe||de||U===_.PlaylistLevelType.AUDIO?ce:void 0),de){var be=X?X.endPTS-X.startPTS:0;l.inputTimeScale||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(c,l,g)),W=this.remuxVideo(l,ce,oe,be)}}else de&&(W=this.remuxVideo(l,ce,oe,0));W&&(W.firstKeyFrame=ye,W.independent=ye!==-1)}}return this.ISGenerated&&(a.samples.length&&(z=this.remuxID3(a,g)),v.samples.length&&(F=this.remuxText(v,g))),{audio:X,video:W,initSegment:B,independent:Q,text:F,id3:z}},y.generateIS=function(c,l,a){var v=c.samples,g=l.samples,m=this.typeSupported,R={},U=!Object(K.isFiniteNumber)(this._initPTS),W="audio/mp4",X,B,F;if(U&&(X=B=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(m.mpeg?(W="audio/mpeg",c.codec=""):m.mp3&&(c.codec="mp3")),R.audio={id:"audio",container:W,codec:c.codec,initSegment:!c.isAAC&&m.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(F=c.inputTimeScale,X=B=v[0].pts-Math.round(F*a))),l.sps&&l.pps&&g.length&&(l.timescale=l.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:P.default.initSegment([l]),metadata:{width:l.width,height:l.height}},U)){F=l.inputTimeScale;var z=this.getVideoStartPts(g),Q=Math.round(F*a);B=Math.min(B,u(g[0].dts,z)-Q),X=Math.min(X,z-Q)}if(Object.keys(R).length)return this.ISGenerated=!0,U&&(this._initPTS=X,this._initDTS=B),{tracks:R,initPTS:X,timescale:F}},y.remuxVideo=function(c,l,a,v){var g=c.inputTimeScale,m=c.samples,R=[],U=m.length,W=this._initPTS,X=this.nextAvcDts,B=8,F,z,Q,ie=Number.POSITIVE_INFINITY,ce=Number.NEGATIVE_INFINITY,Ce=0,pe=!1;if(!a||X===null){var Te=l*g,se=m[0].pts-u(m[0].dts,m[0].pts);X=Te-se}for(var de=0;de<U;de++){var q=m[de];if(q.pts=u(q.pts-W,X),q.dts=u(q.dts-W,X),q.dts>q.pts){var oe=9e4*.2;Ce=Math.max(Math.min(Ce,q.pts-q.dts),-1*oe)}q.dts<m[de>0?de-1:de].dts&&(pe=!0)}pe&&m.sort(function(At,mt){var ot=At.dts-mt.dts,It=At.pts-mt.pts;return ot||It}),z=m[0].dts,Q=m[m.length-1].dts;var ye=Math.round((Q-z)/(U-1));if(Ce<0){if(Ce<ye*-2){A.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-ye,!0)+" ms");for(var fe=Ce,Le=0;Le<U;Le++)m[Le].dts=fe=Math.max(fe,m[Le].pts-ye),m[Le].pts=Math.max(fe,m[Le].pts)}else{A.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(Ce,!0)+" ms to overcome this issue");for(var ve=0;ve<U;ve++)m[ve].dts=m[ve].dts+Ce}z=m[0].dts}if(a){var De=z-X,be=De>ye,we=De<-1;if(be||we){be?A.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(De,!0)+" ms ("+De+"dts) hole between fragments detected, filling it"):A.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-De,!0)+" ms ("+De+"dts) overlapping between fragments detected"),z=X;var Re=m[0].pts-De;m[0].dts=z,m[0].pts=Re,A.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(Re,!0)+"/"+Object(x.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(De,!0)+" ms")}}o&&(z=Math.max(0,z));for(var Fe=0,Pe=0,Ae=0;Ae<U;Ae++){for(var Se=m[Ae],We=Se.units,Ge=We.length,Xe=0,je=0;je<Ge;je++)Xe+=We[je].data.length;Pe+=Xe,Fe+=Ge,Se.length=Xe,Se.dts=Math.max(Se.dts,z),Se.pts=Math.max(Se.pts,Se.dts,0),ie=Math.min(Se.pts,ie),ce=Math.max(Se.pts,ce)}Q=m[U-1].dts;var qe=Pe+4*Fe+8,Ue;try{Ue=new Uint8Array(qe)}catch(At){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating video mdat "+qe});return}var Ke=new DataView(Ue.buffer);Ke.setUint32(0,qe),Ue.set(P.default.types.mdat,4);for(var xe=0;xe<U;xe++){for(var $e=m[xe],Ye=$e.units,_e=0,Ie=0,ne=Ye.length;Ie<ne;Ie++){var ae=Ye[Ie],le=ae.data,Y=ae.data.byteLength;Ke.setUint32(B,Y),B+=4,Ue.set(le,B),B+=Y,_e+=4+Y}if(xe<U-1)F=m[xe+1].dts-$e.dts;else{var $=this.config,J=$e.dts-m[xe>0?xe-1:xe].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var ee=Math.floor($.maxBufferHole*g),me=(v?ie+v*g:this.nextAudioPts)-$e.pts;me>ee?(F=me-J,F<0&&(F=J),A.logger.log("[mp4-remuxer]: It is approximately "+me/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=J}else F=J}var Ee=Math.round($e.pts-$e.dts);R.push(new f($e.key,F,_e,Ee))}if(R.length&&b&&b<70){var ke=R[0].flags;ke.dependsOn=2,ke.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=X=Q+F,this.isVideoContiguous=!0;var tt=P.default.moof(c.sequenceNumber++,z,L({},c,{samples:R})),dt="video",it={data1:tt,data2:Ue,startPTS:ie/g,endPTS:(ce+F)/g,startDTS:z/g,endDTS:X/g,type:dt,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ue.length,"MDAT length must not be zero"),it},y.remuxAudio=function(c,l,a,v,g){var m=c.inputTimeScale,R=c.samplerate?c.samplerate:m,U=m/R,W=c.isAAC?C:S,X=W*U,B=this._initPTS,F=!c.isAAC&&this.typeSupported.mpeg,z=[],Q=c.samples,ie=F?0:8,ce=this.nextAudioPts||-1,Ce=l*m;if(this.isAudioContiguous=a=a||Q.length&&ce>0&&(v&&Math.abs(Ce-ce)<9e3||Math.abs(u(Q[0].pts-B,Ce)-ce)<20*X),Q.forEach(function(le){le.pts=u(le.pts-B,Ce)}),!a||ce<0){if(Q=Q.filter(function(le){return le.pts>=0}),!Q.length)return;g===0?ce=0:v?ce=Math.max(0,Ce):ce=Q[0].pts}if(c.isAAC)for(var pe=g!==void 0,Te=this.config.maxAudioFramesDrift,se=0,de=ce;se<Q.length;se++){var q=Q[se],oe=q.pts,ye=oe-de,fe=Math.abs(1e3*ye/m);if(ye<=-Te*X&&pe)se===0&&(A.logger.warn("Audio frame @ "+(oe/m).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ye/m)+" ms."),this.nextAudioPts=ce=de=oe);else if(ye>=Te*X&&fe<O&&pe){var Le=Math.round(ye/X);de=oe-Le*X,de<0&&(Le--,de+=X),se===0&&(this.nextAudioPts=ce=de),A.logger.warn("[mp4-remuxer]: Injecting "+Le+" audio frame @ "+(de/m).toFixed(3)+"s due to "+Math.round(1e3*ye/m)+" ms gap.");for(var ve=0;ve<Le;ve++){var De=Math.max(de,0),be=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);be||(A.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),be=q.unit.subarray()),Q.splice(se,0,{unit:be,pts:De}),de+=X,se++}}q.pts=de,de+=X}for(var we=null,Re=null,Fe,Pe=0,Ae=Q.length;Ae--;)Pe+=Q[Ae].unit.byteLength;for(var Se=0,We=Q.length;Se<We;Se++){var Ge=Q[Se],Xe=Ge.unit,je=Ge.pts;if(Re!==null){var qe=z[Se-1];qe.duration=Math.round((je-Re)/U)}else if(a&&c.isAAC&&(je=ce),we=je,Pe>0){Pe+=ie;try{Fe=new Uint8Array(Pe)}catch(le){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Pe,reason:"fail allocating audio mdat "+Pe});return}if(!F){var Ue=new DataView(Fe.buffer);Ue.setUint32(0,Pe),Fe.set(P.default.types.mdat,4)}}else return;Fe.set(Xe,ie);var Ke=Xe.byteLength;ie+=Ke,z.push(new f(!0,W,Ke,0)),Re=je}var xe=z.length;if(!xe)return;var $e=z[z.length-1];this.nextAudioPts=ce=Re+U*$e.duration;var Ye=F?new Uint8Array(0):P.default.moof(c.sequenceNumber++,we/U,L({},c,{samples:z}));c.samples=[];var _e=we/m,Ie=ce/m,ne="audio",ae={data1:Ye,data2:Fe,startPTS:_e,endPTS:Ie,startDTS:_e,endDTS:Ie,type:ne,hasAudio:!0,hasVideo:!1,nb:xe};return this.isAudioContiguous=!0,console.assert(Fe.length,"MDAT length must not be zero"),ae},y.remuxEmptyAudio=function(c,l,a,v){var g=c.inputTimeScale,m=c.samplerate?c.samplerate:g,R=g/m,U=this.nextAudioPts,W=(U!==null?U:v.startDTS*g)+this._initDTS,X=v.endDTS*g+this._initDTS,B=R*C,F=Math.ceil((X-W)/B),z=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(A.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){A.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Q=[],ie=0;ie<F;ie++){var ce=W+ie*B;Q.push({unit:z,pts:ce,dts:ce})}return c.samples=Q,this.remuxAudio(c,l,a,!1)},y.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,g=this._initPTS,m=this._initDTS,R=0;R<a;R++){var U=c.samples[R];U.pts=u(U.pts-g,l*v)/v,U.dts=u(U.dts-m,l*v)/v}var W=c.samples;return c.samples=[],{samples:W}},y.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,g=this._initPTS,m=0;m<a;m++){var R=c.samples[m];R.pts=u(R.pts-g,l*v)/v}c.samples.sort(function(W,X){return W.pts-X.pts});var U=c.samples;return c.samples=[],{samples:U}},w}();function u(w,y){var h;if(y===null)return w;for(y<w?h=-8589934592:h=8589934592;Math.abs(w-y)>4294967296;)w+=h;return w}function T(w){for(var y=0;y<w.length;y++)if(w[y].key)return y;return-1}var f=function(y,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 p(y)},p=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/polyfills/number.ts"),M=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),N=D("./src/utils/logger.ts"),k=function(){function x(){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 L=x.prototype;return L.destroy=function(){},L.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},L.resetNextTimestamp=function(){this.lastEndDTS=null},L.resetInitSegment=function(C,S,b){this.audioCodec=S,this.videoCodec=b,this.generateInitSegment(C),this.emitInitSegment=!0},L.generateInitSegment=function(C){var S=this.audioCodec,b=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(M.parseInitSegment)(C);S||(S=_(d.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=_(d.video,P.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:S+","+b,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:S,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:b,initSegment:C,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},L.remux=function(C,S,b,d,o){var s=this.initPTS,u=this.lastEndDTS,T={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(K.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var f=S.samples;if(!f||!f.length)return T;var p={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(f),w=this.initData),!w||!w.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(s)||(this.initPTS=p.initPTS=s=A(w,f,u));var y=Object(M.getDuration)(f,w),h=u,c=y+h;Object(M.offsetStartDTS)(w,f,s),y>0?this.lastEndDTS=c:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!w.audio,a=!!w.video,v="";l&&(v+="audio"),a&&(v+="video");var g={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:l,hasVideo:a,nb:1,dropped:0};return T.audio=g.type==="audio"?g:void 0,T.video=g.type!=="audio"?g:void 0,T.text=d,T.id3=b,T.initSegment=p,T},x}(),A=function(L,O,C){return Object(M.getStartDTS)(L,O)-C};function _(x,L){var O=x==null?void 0:x.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||L===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=k},"./src/task-loop.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return K});var K=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=M.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},M}()},"./src/types/cmcd.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"CMCDVersion",function(){return K}),D.d(G,"CMCDObjectType",function(){return M}),D.d(G,"CMCDStreamingFormat",function(){return P}),D.d(G,"CMCDStreamType",function(){return N});var K=1,M;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(M||(M={}));var P;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(P||(P={}));var N;(function(k){k.VOD="v",k.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"HlsSkip",function(){return P}),D.d(G,"getSkipValue",function(){return N}),D.d(G,"HlsUrlParameters",function(){return k}),D.d(G,"Level",function(){return A});function K(_,x){for(var L=0;L<x.length;L++){var O=x[L];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(_,O.key,O)}}function M(_,x,L){return x&&K(_.prototype,x),L&&K(_,L),_}var P;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(P||(P={}));function N(_,x){var L=_.canSkipUntil,O=_.canSkipDateRanges,C=_.endSN,S=x!==void 0?x-C:0;return L&&S<L?O?P.v2:P.Yes:P.No}var k=function(){function _(L,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=L,this.part=O,this.skip=C}var x=_.prototype;return x.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()},_}(),A=function(){function _(x){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=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(L){return L}).join(",").replace(/\.[^.,]+/g,"")}return M(_,[{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(L){var O=L%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),_}()},"./src/types/loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"PlaylistContextType",function(){return K}),D.d(G,"PlaylistLevelType",function(){return M});var K;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"ChunkMetadata",function(){return K});var K=function(N,k,A,_,x,L){_===void 0&&(_=0),x===void 0&&(x=-1),L===void 0&&(L=!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=M(),this.buffering={audio:M(),video:M(),audiovideo:M()},this.level=N,this.sn=k,this.id=A,this.size=_,this.part=x,this.partial=L};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"AttrList",function(){return P});var K=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function N(A){typeof A=="string"&&(A=N.parseAttrList(A));for(var _ in A)A.hasOwnProperty(_)&&(this[_]=A[_])}var k=N.prototype;return k.decimalInteger=function(_){var x=parseInt(this[_],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},k.hexadecimalInteger=function(_){if(this[_]){var x=(this[_]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var L=new Uint8Array(x.length/2),O=0;O<x.length/2;O++)L[O]=parseInt(x.slice(O*2,O*2+2),16);return L}else return null},k.hexadecimalIntegerAsNumber=function(_){var x=parseInt(this[_],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},k.decimalFloatingPoint=function(_){return parseFloat(this[_])},k.optionalFloat=function(_,x){var L=this[_];return L?parseFloat(L):x},k.enumeratedString=function(_){return this[_]},k.bool=function(_){return this[_]==="YES"},k.decimalResolution=function(_){var x=K.exec(this[_]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},N.parseAttrList=function(_){var x,L={},O='"';for(M.lastIndex=0;(x=M.exec(_))!==null;){var C=x[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),L[x[1]]=C}return L},N}()},"./src/utils/binary-search.ts":function(Z,G,D){"use strict";D.r(G);var K={search:function(P,N){for(var k=0,A=P.length-1,_=null,x=null;k<=A;){_=(k+A)/2|0,x=P[_];var L=N(x);if(L>0)k=_+1;else if(L<0)A=_-1;else return x}return null}};G.default=K},"./src/utils/buffer-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"BufferHelper",function(){return P});var K=D("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function N(){}return N.isBuffered=function(A,_){try{if(A){for(var x=N.getBuffered(A),L=0;L<x.length;L++)if(_>=x.start(L)&&_<=x.end(L))return!0}}catch(O){}return!1},N.bufferInfo=function(A,_,x){try{if(A){var L=N.getBuffered(A),O=[],C;for(C=0;C<L.length;C++)O.push({start:L.start(C),end:L.end(C)});return this.bufferedInfo(O,_,x)}}catch(S){}return{len:0,start:_,end:_,nextStart:void 0}},N.bufferedInfo=function(A,_,x){_=Math.max(0,_),A.sort(function(p,w){var y=p.start-w.start;return y||w.end-p.end});var L=[];if(x)for(var O=0;O<A.length;O++){var C=L.length;if(C){var S=L[C-1].end;A[O].start-S<x?A[O].end>S&&(L[C-1].end=A[O].end):L.push(A[O])}else L.push(A[O])}else L=A;for(var b=0,d,o=_,s=_,u=0;u<L.length;u++){var T=L[u].start,f=L[u].end;if(_+x>=T&&_<f)o=T,s=f,b=s-_;else if(_+x<T){d=T;break}}return{len:b,start:o||0,end:s||0,nextStart:d}},N.getBuffered=function(A){try{return A.buffered}catch(_){return K.logger.log("failed to get media.buffered",_),M}},N}()},"./src/utils/cea-608-parser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"Row",function(){return s}),D.d(G,"CaptionScreen",function(){return u});var K=D("./src/utils/logger.ts"),M={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},P=function(c){var l=c;return M.hasOwnProperty(c)&&(l=M[c]),String.fromCharCode(l)},N=15,k=100,A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},L={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 S=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,v){this.verboseLevel>=a&&K.logger.log(this.time+" ["+a+"] "+v)},h}(),b=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,v,g,m){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=v||!1,this.background=g||"black",this.flash=m||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],g=0;g<v.length;g++){var m=v[g];a.hasOwnProperty(m)&&(this[m]=a[m])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,v,g,m,R){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,v,g,m,R)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var v=!0,g=0;g<k;g++)if(!this.chars[g].equals(a.chars[g])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<k;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<k;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>k&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var g=this.pos+1;g<v+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=P(a);if(this.pos>=k){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<k;v++)this.chars[v].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],v=!0,g=0;g<k;g++){var m=this.chars[g].uchar;m!==" "&&(v=!1),a.push(m)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},h}(),u=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<N;a++)this.rows.push(new s(l));this.logger=l,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<N;a++)this.rows[a].clear();this.currRow=N-1},c.equals=function(a){for(var v=!0,g=0;g<N;g++)if(!this.rows[g].equals(a.rows[g])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<N;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<N;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var g=0;g<N;g++)this.rows[g].clear();var m=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var U=R.rows[m].cueStartTime,W=this.logger.time;if(U&&W!==null&&U<W)for(var X=0;X<this.nrRollUpRows;X++)this.rows[v-this.nrRollUpRows+X+1].copy(R.rows[m+X])}}this.currRow=v;var B=this.rows[this.currRow];if(a.indent!==null){var F=a.indent,z=Math.max(F-1,0);B.setCursor(a.indent),a.color=B.chars[z].penState.foreground}var Q={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Q)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],g="",m=-1,R=0;R<N;R++){var U=this.rows[R].getTextString();U&&(m=R+1,a?v.push("Row "+m+": '"+U+"'"):v.push(U.trim()))}return v.length>0&&(a?g="["+v.join(" | ")+"]":g=v.join(`
|
|
`)),g},c.getTextAndFormat=function(){return this.rows},h}(),T=function(){function h(l,a,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(v),this.nonDisplayedMemory=new u(v),this.lastOutputScreen=new u(v),this.currRollUpRow=this.displayedMemory.rows[N-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[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var g=Math.floor(a/2)-16,m=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=m[g]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),f=function(){function h(l,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new S;this.channels=[null,new T(l,a,g),new T(l+1,v,g)],this.cmdHistory=y(),this.logger=g}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var g,m,R,U=!1;this.logger.time=a;for(var W=0;W<v.length;W+=2){if(m=v[W]&127,R=v[W+1]&127,m===0&&R===0)continue;if(this.logger.log(C.DATA,"["+b([v[W],v[W+1]])+"] -> ("+b([m,R])+")"),g=this.parseCmd(m,R),g||(g=this.parseMidrow(m,R)),g||(g=this.parsePAC(m,R)),g||(g=this.parseBackgroundAttributes(m,R)),!g&&(U=this.parseChars(m,R),U)){var X=this.currentChannel;if(X&&X>0){var B=this.channels[X];B.insertChars(U)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!U&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+b([m,R])+" orig: "+b([v[W],v[W+1]]))}},c.parseCmd=function(a,v){var g=this.cmdHistory,m=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,R=(a===23||a===31)&&v>=33&&v<=35;if(!(m||R))return!1;if(w(a,v,g))return p(null,null,g),this.logger.log(C.DEBUG,"Repeated command ("+b([a,v])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,W=this.channels[U];return a===20||a===21||a===28||a===29?v===32?W.ccRCL():v===33?W.ccBS():v===34?W.ccAOF():v===35?W.ccAON():v===36?W.ccDER():v===37?W.ccRU(2):v===38?W.ccRU(3):v===39?W.ccRU(4):v===40?W.ccFON():v===41?W.ccRDC():v===42?W.ccTR():v===43?W.ccRTD():v===44?W.ccEDM():v===45?W.ccCR():v===46?W.ccENM():v===47&&W.ccEOC():W.ccTO(v-32),p(a,v,g),this.currentChannel=U,!0},c.parseMidrow=function(a,v){var g=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var m=this.channels[g];return m?(m.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+b([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var g,m=this.cmdHistory,R=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,U=(a===16||a===24)&&v>=64&&v<=95;if(!(R||U))return!1;if(w(a,v,m))return p(null,null,m),!0;var W=a<=23?1:2;v>=64&&v<=95?g=W===1?A[a]:x[a]:g=W===1?_[a]:L[a];var X=this.channels[W];return X?(X.setPAC(this.interpretPAC(g,v)),p(a,v,m),this.currentChannel=W,!0):!1},c.interpretPAC=function(a,v){var g,m={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?g=v-96:g=v-64,m.underline=(g&1)===1,g<=13?m.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(m.italics=!0,m.color="white"):m.indent=Math.floor((g-16)/2)*4,m},c.parseChars=function(a,v){var g,m=null,R=null;if(a>=25?(g=2,R=a-8):(g=1,R=a),R>=17&&R<=19){var U;R===17?U=v+80:R===18?U=v+112:U=v+144,this.logger.log(C.INFO,"Special char '"+P(U)+"' in channel "+g),m=[U]}else a>=32&&a<=127&&(m=v===0?[a]:[a,v]);if(m){var W=b(m);this.logger.log(C.DEBUG,"Char codes = "+W.join(",")),p(a,v,this.cmdHistory)}return m},c.parseBackgroundAttributes=function(a,v){var g=(a===16||a===24)&&v>=32&&v<=47,m=(a===23||a===31)&&v>=45&&v<=47;if(!(g||m))return!1;var R,U={};a===16||a===24?(R=Math.floor((v-32)/2),U.background=O[R],v%2===1&&(U.background=U.background+"_semi")):v===45?U.background="transparent":(U.foreground="black",v===47&&(U.underline=!0));var W=a<=23?1:2,X=this.channels[W];return X.setBkgData(U),p(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=y()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var g=this.channels[v];g&&g.cueSplitAtTime(a)}},h}();function p(h,c,l){l.a=h,l.b=c}function w(h,c,l){return l.a===h&&l.b===c}function y(){return{a:null,b:null}}G.default=f},"./src/utils/codecs.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"isCodecType",function(){return M}),D.d(G,"isCodecSupportedInMp4",function(){return P});var K={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function M(N,k){var A=K[k];return!!A&&A[N.slice(0,4)]===!0}function P(N,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/utils/vttparser.ts"),M=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),N=/\s/,k={newCue:function(_,x,L,O){for(var C=[],S,b,d,o,s,u=self.VTTCue||self.TextTrackCue,T=0;T<O.rows.length;T++)if(S=O.rows[T],d=!0,o=0,s="",!S.isEmpty()){for(var f=0;f<S.chars.length;f++)N.test(S.chars[f].uchar)&&d?o++:(s+=S.chars[f].uchar,d=!1);S.cueStartTime=x,x===L&&(L+=1e-4),o>=16?o--:o++;var p=Object(K.fixLineBreaks)(s.trim()),w=Object(M.generateCueId)(x,L,p);(!_||!_.cues||!_.cues.getCueById(w))&&(b=new u(x,L,p),b.id=w,b.line=T+1,b.align="left",b.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(b))}return _&&C.length&&(C.sort(function(y,h){return y.line==="auto"||h.line==="auto"?0:y.line>8&&h.line>8?h.line-y.line:y.line-h.line}),C.forEach(function(y){return Object(P.addCueToTrack)(_,y)})),C}};G.default=k},"./src/utils/discontinuities.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"findFirstFragWithCC",function(){return N}),D.d(G,"shouldAlignOnDiscontinuities",function(){return k}),D.d(G,"findDiscontinuousReferenceFrag",function(){return A}),D.d(G,"adjustSlidingStart",function(){return x}),D.d(G,"alignStream",function(){return L}),D.d(G,"alignPDT",function(){return C}),D.d(G,"alignFragmentByPDTDelta",function(){return S}),D.d(G,"alignMediaPlaylistByPDT",function(){return b});var K=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function N(d,o){for(var s=null,u=0,T=d.length;u<T;u++){var f=d[u];if(f&&f.cc===o){s=f;break}}return s}function k(d,o,s){return!!(o.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function A(d,o){var s=d.fragments,u=o.fragments;if(!u.length||!s.length){M.logger.log("No fragments to align");return}var T=N(s,u[0].cc);if(!T||T&&!T.startPTS){M.logger.log("No frag in previous level to align on");return}return T}function _(d,o){if(d){var s=d.start+o;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function x(d,o){for(var s=o.fragments,u=0,T=s.length;u<T;u++)_(s[u],d);o.fragmentHint&&_(o.fragmentHint,d),o.alignedSliding=!0}function L(d,o,s){if(!o)return;O(d,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(P.adjustSliding)(o.details,s)}function O(d,o,s){if(k(d,s,o)){var u=A(s.details,o);u&&Object(K.isFiniteNumber)(u.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),x(u.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,T=(u-s)/1e3+o.fragments[0].start;T&&Object(K.isFiniteNumber)(T)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+T.toFixed(3)+" "+d.url+" "),x(T,d))}function S(d,o){var s=d.programDateTime;if(!s)return;var u=(s-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function b(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=o.fragments[0].start,T=s-u*1e3;d.fragments.forEach(function(f){S(f,T)}),d.fragmentHint&&S(d.fragmentHint,T),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/utils/ewma.ts"),M=function(){function P(k,A,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(k),this.fast_=new K.default(A)}var N=P.prototype;return N.update=function(A,_){var x=this.slow_,L=this.fast_;this.slow_.halfLife!==A&&(this.slow_=new K.default(A,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new K.default(_,L.getEstimate(),L.getTotalWeight()))},N.sample=function(A,_){A=Math.max(A,this.minDelayMs_);var x=8*_,L=A/1e3,O=x/L;this.fast_.sample(L,O),this.slow_.sample(L,O)},N.canEstimate=function(){var A=this.fast_;return A&&A.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},P}();G.default=M},"./src/utils/ewma.ts":function(Z,G,D){"use strict";D.r(G);var K=function(){function M(N,k,A){k===void 0&&(k=0),A===void 0&&(A=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=k,this.totalWeight_=A}var P=M.prototype;return P.sample=function(k,A){var _=Math.pow(this.alpha_,k);this.estimate_=A*(1-_)+_*this.estimate_,this.totalWeight_+=k},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},M}();G.default=K},"./src/utils/fetch-loader.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"fetchSupported",function(){return S});var K=D("./src/polyfills/number.ts"),M=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function N(u,T){u.prototype=Object.create(T.prototype),u.prototype.constructor=u,L(u,T)}function k(u){var T=typeof Map=="function"?new Map:void 0;return k=function(p){if(p===null||!x(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(p))return T.get(p);T.set(p,w)}function w(){return A(p,arguments,O(this).constructor)}return w.prototype=Object.create(p.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),L(w,p)},k(u)}function A(u,T,f){return _()?A=Reflect.construct:A=function(w,y,h){var c=[null];c.push.apply(c,y);var l=Function.bind.apply(w,c),a=new l;return h&&L(a,h.prototype),a},A.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function x(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function L(u,T){return L=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},L(u,T)}function O(u){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},O(u)}function C(){return C=Object.assign||function(u){for(var T=1;T<arguments.length;T++){var f=arguments[T];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(u[p]=f[p])}return u},C.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var b=function(){function u(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new M.LoadStats}var T=u.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(p,w,y){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(p,this.controller.signal),a=y.onProgress,v=p.responseType==="arraybuffer",g=v?"byteLength":"length";this.context=p,this.config=w,this.callbacks=y,this.request=this.fetchSetup(p,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),y.onTimeout(c,p,h.response)},w.timeout),self.fetch(this.request).then(function(m){if(h.response=h.loader=m,!m.ok){var R=m.status,U=m.statusText;throw new s(U||"fetch, bad network response",R,m)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(m.headers.get("Content-Length")||"0"),a&&Object(K.isFiniteNumber)(w.highWaterMark)?h.loadProgressively(m,c,p,w.highWaterMark,a):v?m.arrayBuffer():m.text()}).then(function(m){var R=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=m[g];var U={url:R.url,data:m};a&&!Object(K.isFiniteNumber)(w.highWaterMark)&&a(c,p,m,R),y.onSuccess(U,c,p,R)}).catch(function(m){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var R=m.code||0;y.onError({code:R,text:m.message},p,m.details)})},T.getCacheAge=function(){var p=null;if(this.response){var w=this.response.headers.get("age");p=w?parseFloat(w):null}return p},T.loadProgressively=function(p,w,y,h,c){h===void 0&&(h=0);var l=new P.default,a=p.body.getReader(),v=function g(){return a.read().then(function(m){if(m.done)return l.dataLength&&c(w,y,l.flush(),p),Promise.resolve(new ArrayBuffer(0));var R=m.value,U=R.length;return w.loaded+=U,U<h||l.dataLength?(l.push(R),l.dataLength>=h&&c(w,y,l.flush(),p)):c(w,y,R,p),g()}).catch(function(){return Promise.reject()})};return v()},u}();function d(u,T){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(C({},u.headers))};return u.rangeEnd&&f.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),f}function o(u,T){return new self.Request(u.url,T)}var s=function(u){N(T,u);function T(f,p,w){var y;return y=u.call(this,f)||this,y.code=void 0,y.details=void 0,y.code=p,y.details=w,y}return T}(k(Error));G.default=b},"./src/utils/imsc1-ttml-parser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"IMSC1_CODEC",function(){return x}),D.d(G,"parseIMSC1",function(){return S});var K=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),N=D("./src/demux/id3.ts"),k=D("./src/utils/timescale-conversion.ts"),A=D("./src/utils/webvtt-parser.ts");function _(){return _=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},_.apply(this,arguments)}var x="stpp.ttml.im1t",L=/^(\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 S(h,c,l,a,v){var g=Object(K.findBox)(new Uint8Array(h),["mdat"]);if(g.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var m=g[0],R=Object(N.utf8ArrayToStr)(new Uint8Array(h,m.start,m.end-m.start)),U=Object(k.toTimescaleFromScale)(c,1,l);try{a(b(R,U))}catch(W){v(W)}}function b(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(g).reduce(function(B,F){return B[F]=v.getAttribute("ttp:"+F)||g[F],B},{}),R=v.getAttribute("xml:space")!=="preserve",U=o(d(v,"styling","style")),W=o(d(v,"layout","region")),X=d(v,"body","[begin]");return[].map.call(X,function(B){var F=s(B,R);if(!F||!B.hasAttribute("begin"))return null;var z=p(B.getAttribute("begin"),m),Q=p(B.getAttribute("dur"),m),ie=p(B.getAttribute("end"),m);if(z===null)throw f(B);if(ie===null){if(Q===null)throw f(B);ie=z+Q}var ce=new P.default(z-c,ie-c,F);ce.id=Object(A.generateCueId)(ce.startTime,ce.endTime,ce.text);var Ce=W[B.getAttribute("region")],pe=U[B.getAttribute("style")];ce.position=10,ce.size=80;var Te=u(Ce,pe),se=Te.textAlign;if(se){var de=C[se];de&&(ce.lineAlign=de),ce.align=se}return _(ce,Te),ce}).filter(function(B){return B!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,v){var g;return a.nodeName==="br"&&v?l+`
|
|
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?s(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function u(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,g){var m=T(c,l,g)||T(h,l,g);return m&&(v[g]=m),v},{})}function T(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function p(h,c){if(!h)return null;var l=Object(M.parseTimeStamp)(h);return l===null&&(L.test(h)?l=w(h,c):O.test(h)&&(l=y(h,c))),l}function w(h,c){var l=L.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function y(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(Z,G,D){"use strict";D.r(G),D.d(G,"enableLogs",function(){return A}),D.d(G,"logger",function(){return _});var K=function(){},M={trace:K,debug:K,log:K,warn:K,info:K,error:K},P=M;function N(x){var L=self.console[x];return L?L.bind(self.console,"["+x+"] >"):K}function k(x){for(var L=arguments.length,O=new Array(L>1?L-1:0),C=1;C<L;C++)O[C-1]=arguments[C];O.forEach(function(S){P[S]=x[S]?x[S].bind(x):N(S)})}function A(x){if(self.console&&x===!0||typeof x=="object"){k(x,"debug","log","info","warn","error");try{P.log()}catch(L){P=M}}else P=M}var _=P},"./src/utils/mediakeys-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"KeySystems",function(){return K}),D.d(G,"requestMediaKeySystemAccess",function(){return M});var K;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(K||(K={}));var M=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"bin2str",function(){return k}),D.d(G,"readUint16",function(){return A}),D.d(G,"readUint32",function(){return _}),D.d(G,"writeUint32",function(){return x}),D.d(G,"findBox",function(){return L}),D.d(G,"parseSegmentIndex",function(){return O}),D.d(G,"parseInitSegment",function(){return C}),D.d(G,"getStartDTS",function(){return S}),D.d(G,"getDuration",function(){return b}),D.d(G,"computeRawDurationFromSamples",function(){return d}),D.d(G,"offsetStartDTS",function(){return o}),D.d(G,"segmentValidRange",function(){return s}),D.d(G,"appendUint8Array",function(){return u});var K=D("./src/utils/typed-array.ts"),M=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,N=[].push;function k(T){return String.fromCharCode.apply(null,T)}function A(T,f){"data"in T&&(f+=T.start,T=T.data);var p=T[f]<<8|T[f+1];return p<0?65536+p:p}function _(T,f){"data"in T&&(f+=T.start,T=T.data);var p=T[f]<<24|T[f+1]<<16|T[f+2]<<8|T[f+3];return p<0?4294967296+p:p}function x(T,f,p){"data"in T&&(f+=T.start,T=T.data),T[f]=p>>24,T[f+1]=p>>16&255,T[f+2]=p>>8&255,T[f+3]=p&255}function L(T,f){var p=[];if(!f.length)return p;var w,y,h;"data"in T?(w=T.data,y=T.start,h=T.end):(w=T,y=0,h=w.byteLength);for(var c=y;c<h;){var l=_(w,c),a=k(w.subarray(c+4,c+8)),v=l>1?c+l:h;if(a===f[0])if(f.length===1)p.push({data:w,start:c+8,end:v});else{var g=L({data:w,start:c+8,end:v},f.slice(1));g.length&&N.apply(p,g)}c=v}return p}function O(T){var f=L(T,["moov"]),p=f[0],w=p?p.end:null,y=L(T,["sidx"]);if(!y||!y[0])return null;var h=[],c=y[0],l=c.data[0],a=l===0?8:16,v=_(c,a);a+=4;var g=0,m=0;l===0?a+=8:a+=16,a+=2;var R=c.end+m,U=A(c,a);a+=2;for(var W=0;W<U;W++){var X=a,B=_(c,X);X+=4;var F=B&2147483647,z=(B&2147483648)>>>31;if(z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Q=_(c,X);X+=4,h.push({referenceSize:F,subsegmentDuration:Q,info:{duration:Q/v,start:R,end:R+F-1}}),R+=F,X+=4,a=X}return{earliestPresentationTime:g,timescale:v,version:l,referencesCount:U,references:h,moovEndOffset:w}}function C(T){for(var f=[],p=L(T,["moov","trak"]),w=0;w<p.length;w++){var y=p[w],h=L(y,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=_(h,l),v=L(y,["mdia","mdhd"])[0];if(v){c=v.data[v.start],l=c===0?12:20;var g=_(v,l),m=L(y,["mdia","hdlr"])[0];if(m){var R=k(m.data.subarray(m.start+8,m.start+12)),U={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[R];if(U){var W=L(y,["mdia","minf","stbl","stsd"])[0],X=void 0;W&&(X=k(W.data.subarray(W.start+12,W.start+16))),f[a]={timescale:g,type:U},f[U]={timescale:g,id:a,codec:X}}}}}}var B=L(T,["moov","mvex","trex"]);return B.forEach(function(F){var z=_(F,4),Q=f[z];Q&&(Q.default={duration:_(F,12),flags:_(F,20)})}),f}function S(T,f){return L(f,["moof","traf"]).reduce(function(p,w){var y=L(w,["tfdt"])[0],h=y.data[y.start],c=L(w,["tfhd"]).reduce(function(l,a){var v=_(a,4),g=T[v];if(g){var m=_(y,4);h===1&&(m*=Math.pow(2,32),m+=_(y,8));var R=g.timescale||9e4,U=m/R;if(isFinite(U)&&(l===null||U<l))return U}return l},null);return c!==null&&isFinite(c)&&(p===null||c<p)?c:p},null)||0}function b(T,f){for(var p=0,w=0,y=0,h=L(T,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=L(l,["tfhd"])[0],v=_(a,4),g=f[v];if(!g)continue;var m=g.default,R=_(a,0)|(m==null?void 0:m.flags),U=m==null?void 0:m.duration;R&8&&(R&2?U=_(a,12):U=_(a,8));for(var W=g.timescale||9e4,X=L(l,["trun"]),B=0;B<X.length;B++){if(U){var F=_(X[B],4);p=U*F}else p=d(X[B]);g.type===M.ElementaryStreamTypes.VIDEO?w+=p/W:g.type===M.ElementaryStreamTypes.AUDIO&&(y+=p/W)}}if(w===0&&y===0){var z=O(T);if(z!=null&&z.references)return z.references.reduce(function(Q,ie){return Q+ie.info.duration||0},0)}return w||y}function d(T){var f=_(T,0),p=8;f&1&&(p+=4),f&4&&(p+=4);for(var w=0,y=_(T,4),h=0;h<y;h++){if(f&256){var c=_(T,p);w+=c,p+=4}f&512&&(p+=4),f&1024&&(p+=4),f&2048&&(p+=4)}return w}function o(T,f,p){L(f,["moof","traf"]).forEach(function(w){L(w,["tfhd"]).forEach(function(y){var h=_(y,4),c=T[h];if(!c)return;var l=c.timescale||9e4;L(w,["tfdt"]).forEach(function(a){var v=a.data[a.start],g=_(a,4);if(v===0)x(a,4,g-p*l);else{g*=Math.pow(2,32),g+=_(a,8),g-=p*l,g=Math.max(g,0);var m=Math.floor(g/(P+1)),R=Math.floor(g%(P+1));x(a,4,m),x(a,8,R)}})})})}function s(T){var f={valid:null,remainder:null},p=L(T,["moof"]);if(p){if(p.length<2)return f.remainder=T,f}else return f;var w=p[p.length-1];return f.valid=Object(K.sliceUint8)(T,0,w.start-8),f.remainder=Object(K.sliceUint8)(T,w.start-8),f}function u(T,f){var p=new Uint8Array(T.length+f.length);return p.set(T),p.set(f,T.length),p}},"./src/utils/output-filter.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"default",function(){return K});var K=function(){function M(N,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=k}var P=M.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(k,A,_){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=A,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"sendAddTrackEvent",function(){return M}),D.d(G,"addCueToTrack",function(){return P}),D.d(G,"clearCurrentCues",function(){return N}),D.d(G,"removeCuesInRange",function(){return k}),D.d(G,"getCuesInRange",function(){return _});var K=D("./src/utils/logger.ts");function M(x,L){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=x,L.dispatchEvent(O)}function P(x,L){var O=x.mode;if(O==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(L.id))try{if(x.addCue(L),!x.cues.getCueById(L.id))throw new Error("addCue is failed for: "+L)}catch(S){K.logger.debug("[texttrack-utils]: "+S);var C=new self.TextTrackCue(L.startTime,L.endTime,L.text);C.id=L.id,x.addCue(C)}O==="disabled"&&(x.mode=O)}function N(x){var L=x.mode;if(L==="disabled"&&(x.mode="hidden"),x.cues)for(var O=x.cues.length;O--;)x.removeCue(x.cues[O]);L==="disabled"&&(x.mode=L)}function k(x,L,O){var C=x.mode;if(C==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var S=_(x.cues,L,O),b=0;b<S.length;b++)x.removeCue(S[b]);C==="disabled"&&(x.mode=C)}function A(x,L){if(L<x[0].startTime)return 0;var O=x.length-1;if(L>x[O].endTime)return-1;for(var C=0,S=O;C<=S;){var b=Math.floor((S+C)/2);if(L<x[b].startTime)S=b-1;else if(L>x[b].startTime&&C<O)C=b+1;else return b}return x[C].startTime-L<L-x[S].startTime?C:S}function _(x,L,O){var C=[],S=A(x,L);if(S>-1)for(var b=S,d=x.length;b<d;b++){var o=x[b];if(o.startTime>=L&&o.endTime<=O)C.push(o);else if(o.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(Z,G,D){"use strict";D.r(G);var K={toString:function(P){for(var N="",k=P.length,A=0;A<k;A++)N+="["+P.start(A).toFixed(3)+","+P.end(A).toFixed(3)+"]";return N}};G.default=K},"./src/utils/timescale-conversion.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"toTimescaleFromBase",function(){return M}),D.d(G,"toTimescaleFromScale",function(){return P}),D.d(G,"toMsFromMpegTsClock",function(){return N}),D.d(G,"toMpegTsClockFromTimescale",function(){return k});var K=9e4;function M(A,_,x,L){x===void 0&&(x=1),L===void 0&&(L=!1);var O=A*_*x;return L?Math.round(O):O}function P(A,_,x,L){return x===void 0&&(x=1),L===void 0&&(L=!1),M(A,_,1/x,L)}function N(A,_){return _===void 0&&(_=!1),M(A,1e3,1/K,_)}function k(A,_){return _===void 0&&(_=1),M(A,K,1/_)}},"./src/utils/typed-array.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"sliceUint8",function(){return K});function K(M,P,N){return Uint8Array.prototype.slice?M.slice(P,N):new Uint8Array(Array.prototype.slice.call(M,P,N))}},"./src/utils/vttcue.ts":function(Z,G,D){"use strict";D.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],M=["start","middle","end","left","right"];function P(x,L){if(typeof L!="string")return!1;if(!Array.isArray(x))return!1;var O=L.toLowerCase();return~x.indexOf(O)?O:!1}function N(x){return P(K,x)}function k(x){return P(M,x)}function A(x){for(var L=arguments.length,O=new Array(L>1?L-1:0),C=1;C<L;C++)O[C-1]=arguments[C];for(var S=1;S<arguments.length;S++){var b=arguments[S];for(var d in b)x[d]=b[d]}return x}function _(x,L,O){var C=this,S={enumerable:!0};C.hasBeenReset=!1;var b="",d=!1,o=x,s=L,u=O,T=null,f="",p=!0,w="auto",y="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",A({},S,{get:function(){return b},set:function(g){b=""+g}})),Object.defineProperty(C,"pauseOnExit",A({},S,{get:function(){return d},set:function(g){d=!!g}})),Object.defineProperty(C,"startTime",A({},S,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",A({},S,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",A({},S,{get:function(){return u},set:function(g){u=""+g,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",A({},S,{get:function(){return T},set:function(g){T=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",A({},S,{get:function(){return f},set:function(g){var m=N(g);if(m===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",A({},S,{get:function(){return p},set:function(g){p=!!g,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",A({},S,{get:function(){return w},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",A({},S,{get:function(){return y},set:function(g){var m=k(g);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");y=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",A({},S,{get:function(){return h},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");h=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",A({},S,{get:function(){return c},set:function(g){var m=k(g);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",A({},S,{get:function(){return l},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",A({},S,{get:function(){return a},set:function(g){var m=k(g);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");a=m,this.hasBeenReset=!0}})),C.displayState=void 0}return _.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(Z,G,D){"use strict";D.r(G),D.d(G,"parseTimeStamp",function(){return P}),D.d(G,"fixLineBreaks",function(){return L}),D.d(G,"VTTParser",function(){return O});var K=D("./src/utils/vttcue.ts"),M=function(){function C(){}var S=C.prototype;return S.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function P(C){function S(d,o,s,u){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(u||0)}var b=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?S(b[2],b[3],0,b[4]):S(b[1],b[2],b[3],b[4]):null}var N=function(){function C(){this.values=Object.create(null)}var S=C.prototype;return S.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},S.get=function(d,o,s){return s?this.has(d)?this.values[d]:o[s]:this.has(d)?this.values[d]:o},S.has=function(d){return d in this.values},S.alt=function(d,o,s){for(var u=0;u<s.length;++u)if(o===s[u]){this.set(d,o);break}},S.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},S.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},C}();function k(C,S,b,d){var o=d?C.split(d):[C];for(var s in o){if(typeof o[s]!="string")continue;var u=o[s].split(b);if(u.length!==2)continue;var T=u[0],f=u[1];S(T,f)}}var A=new K.default(0,0,""),_=A.align==="middle"?"middle":"center";function x(C,S,b){var d=C;function o(){var T=P(C);if(T===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),T}function s(T,f){var p=new N;k(T,function(h,c){var l;switch(h){case"region":for(var a=b.length-1;a>=0;a--)if(b[a].id===c){p.set(h,b[a].region);break}break;case"vertical":p.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),p.integer(h,l[0]),p.percent(h,l[0])&&p.set("snapToLines",!1),p.alt(h,l[0],["auto"]),l.length===2&&p.alt("lineAlign",l[1],["start",_,"end"]);break;case"position":l=c.split(","),p.percent(h,l[0]),l.length===2&&p.alt("positionAlign",l[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":p.percent(h,c);break;case"align":p.alt(h,c,["start",_,"end","left","right"]);break}},/:/,/\s/),f.region=p.get("region",null),f.vertical=p.get("vertical","");var w=p.get("line","auto");w==="auto"&&A.line===-1&&(w=-1),f.line=w,f.lineAlign=p.get("lineAlign","start"),f.snapToLines=p.get("snapToLines",!0),f.size=p.get("size",100),f.align=p.get("align",_);var y=p.get("position","auto");y==="auto"&&A.position===50&&(y=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=y}function u(){C=C.replace(/^\s+/,"")}if(u(),S.startTime=o(),u(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),u(),S.endTime=o(),u(),s(C,S)}function L(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new M,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=C.prototype;return S.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function s(){var y=o.buffer,h=0;for(y=L(y);h<y.length&&y[h]!=="\r"&&y[h]!==`
|
|
`;)++h;var c=y.substr(0,h);return y[h]==="\r"&&++h,y[h]===`
|
|
`&&++h,o.buffer=y.substr(h),c}function u(y){k(y,function(h,c){},/:/)}try{var T="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;T=s();var f=T.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:T=s();switch(o.state){case"HEADER":/:/.test(T)?u(T):T||(o.state="ID");continue;case"NOTE":T||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){o.state="NOTE";break}if(!T)continue;if(o.cue=new K.default(0,0,""),o.state="CUE",T.indexOf("-->")===-1){o.cue.id=T;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{x(T,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=T.indexOf("-->")!==-1;if(!T||w&&(p=!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+=T}continue;case"BADCUE":T||(o.state="ID")}}}catch(y){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.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(Z,G,D){"use strict";D.r(G),D.d(G,"generateCueId",function(){return O}),D.d(G,"parseWebVTT",function(){return S});var K=D("./src/polyfills/number.ts"),M=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),N=D("./src/utils/timescale-conversion.ts"),k=D("./src/remux/mp4-remuxer.ts"),A=/\r\n|\n\r|\n|\r/g,_=function(d,o,s){return s===void 0&&(s=0),d.substr(s,o.length)===o},x=function(d){var o=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),T=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(o)||!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(u)||!Object(K.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*u,o+=60*60*1e3*T,o},L=function(d){for(var o=5381,s=d.length;s;)o=o*33^d.charCodeAt(--s);return(o>>>0).toString()};function O(b,d,o){return L(b.toString())+L(d.toString())+L(o)}var C=function(d,o,s){var u=d[o],T=d[u.prevCC];if(!T||!T.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(f=T)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=u.start-T.start,u.new=!1,u=T,T=d[u.prevCC]}d.presentationOffset=s};function S(b,d,o,s,u,T,f,p){var w=new M.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(A,`
|
|
`).split(`
|
|
`),h=[],c=Object(N.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,v=0,g,m=!0,R=!1;w.oncue=function(U){var W=s[u],X=s.ccOffset,B=(a-c)/9e4;if(W!=null&&W.new&&(v!==void 0?X=s.ccOffset=W.start:C(s,u,B)),B&&(X=B-s.presentationOffset),R){var F=U.endTime-U.startTime,z=Object(k.normalizePts)((U.startTime+X-v)*9e4,T*9e4)/9e4;U.startTime=z,U.endTime=z+F}var Q=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(Q)),U.id||(U.id=O(U.startTime,U.endTime,Q)),U.endTime>0&&h.push(U)},w.onparsingerror=function(U){g=U},w.onflush=function(){if(g){p(g);return}f(h)},y.forEach(function(U){if(m)if(_(U,"X-TIMESTAMP-MAP=")){m=!1,R=!0,U.substr(16).split(",").forEach(function(W){_(W,"LOCAL:")?l=W.substr(6):_(W,"MPEGTS:")&&(a=parseInt(W.substr(7)))});try{v=x(l)/1e3}catch(W){R=!1,g=W}return}else U===""&&(m=!1);w.parse(U+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(Z,G,D){"use strict";D.r(G);var K=D("./src/utils/logger.ts"),M=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,N=function(){function k(_){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=_?_.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var A=k.prototype;return A.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},A.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},A.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},A.load=function(x,L,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=L,this.callbacks=O,this.retryDelay=L.retryDelay,this.loadInternal()},A.loadInternal=function(){var x=this.config,L=this.context;if(!x)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var S=this.xhrSetup;try{if(S)try{S(O,L.url)}catch(o){O.open("GET",L.url,!0),S(O,L.url)}O.readyState||O.open("GET",L.url,!0);var b=this.context.headers;if(b)for(var d in b)O.setRequestHeader(d,b[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},L,O);return}L.rangeEnd&&O.setRequestHeader("Range","bytes="+L.rangeStart+"-"+(L.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=L.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),O.send()},A.readystatechange=function(){var x=this.context,L=this.loader,O=this.stats;if(!x||!L)return;var C=L.readyState,S=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){L.onreadystatechange=null,L.onprogress=null;var b=L.status;if(b>=200&&b<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(x.responseType==="arraybuffer"?(d=L.response,o=d.byteLength):(d=L.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(O,x,d,L),!this.callbacks)return;var u={url:L.responseURL,data:d};this.callbacks.onSuccess(u,O,x,L)}else O.retry>=S.maxRetry||b>=400&&b<499?(K.logger.error(b+" while loading "+x.url),this.callbacks.onError({code:b,text:L.statusText},x,L)):(K.logger.warn(b+" while loading "+x.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,S.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},A.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},A.loadprogress=function(x){var L=this.stats;L.loaded=x.loaded,x.lengthComputable&&(L.total=x.total)},A.getCacheAge=function(){var x=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var L=this.loader.getResponseHeader("age");x=L?parseFloat(L):null}return x},k}();G.default=N}}).default})},vHTk:function(ut,Ze,te){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|