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

139 lines
777 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[78,5,7,16,20],{"+NIl":function(rt,Qe,J){(function($){$(J("VrN/"))})(function($){"use strict";$.defineMode("stex",function(K,A){"use strict";function W(S,x){S.cmdState.push(x)}function M(S){return S.cmdState.length>0?S.cmdState[S.cmdState.length-1]:null}function P(S){var x=S.cmdState.pop();x&&x.closeBracket()}function I(S){for(var x=S.cmdState,b=x.length-1;b>=0;b--){var d=x[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function k(S,x,b){return function(){this.name=S,this.bracketNo=0,this.style=x,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 O={};O.importmodule=k("importmodule","tag",["string","builtin"]),O.documentclass=k("documentclass","tag",["","atom"]),O.usepackage=k("usepackage","tag",["atom"]),O.begin=k("begin","tag",["atom"]),O.end=k("end","tag",["atom"]),O.label=k("label","tag",["atom"]),O.ref=k("ref","tag",["atom"]),O.eqref=k("eqref","tag",["atom"]),O.cite=k("cite","tag",["atom"]),O.bibitem=k("bibitem","tag",["atom"]),O.Bibitem=k("Bibitem","tag",["atom"]),O.RBibitem=k("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(S,x){S.f=x}function p(S,x){var b;if(S.match(/^\\[a-zA-Z@]+/)){var d=S.current().slice(1);return b=O.hasOwnProperty(d)?O[d]:O.DEFAULT,b=new b,W(x,b),D(x,R),b.style}if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/\\]/))return"tag";if(S.match("\\["))return D(x,function(l,s){return y(l,s,"\\]")}),"keyword";if(S.match("\\("))return D(x,function(l,s){return y(l,s,"\\)")}),"keyword";if(S.match("$$"))return D(x,function(l,s){return y(l,s,"$$")}),"keyword";if(S.match("$"))return D(x,function(l,s){return y(l,s,"$")}),"keyword";var a=S.next();if(a=="%")return S.skipToEnd(),"comment";if(a=="}"||a=="]"){if(b=M(x),b)b.closeBracket(a),D(x,R);else return"error";return"bracket"}else return a=="{"||a=="["?(b=O.DEFAULT,b=new b,W(x,b),"bracket"):/\d/.test(a)?(S.eatWhile(/[\w.%]/),"atom"):(S.eatWhile(/[\w\-_]/),b=I(x),b.name=="begin"&&(b.argument=S.current()),b.styleIdentifier())}function y(S,x,b){if(S.eatSpace())return null;if(b&&S.match(b))return D(x,p),"keyword";if(S.match(/^\\[a-zA-Z@]+/))return"tag";if(S.match(/^[a-zA-Z]+/))return"variable-2";if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/]/))return"tag";if(S.match(/^[\^_&]/))return"tag";if(S.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(S.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=S.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(S.skipToEnd(),"comment"):"error"}function R(S,x){var b=S.peek(),d;return b=="{"||b=="["?(d=M(x),d.openBracket(b),S.eat(b),D(x,p),"bracket"):/[ \t\r]/.test(b)?(S.eat(b),null):(D(x,p),P(x),p(S,x))}return{startState:function(){var S=A.inMathMode?function(x,b){return y(x,b)}:p;return{cmdState:[],f:S}},copyState:function(S){return{cmdState:S.cmdState.slice(),f:S.f}},token:function(S,x){return x.f(S,x)},blankLine:function(S){S.f=p,S.cmdState.length=0},lineComment:"%"}}),$.defineMIME("text/x-stex","stex"),$.defineMIME("text/x-latex","stex")})},"+ua5":function(rt,Qe,J){},"19Vz":function(rt,Qe,J){(function($){$(J("VrN/"))})(function($){$.defineOption("placeholder","",function(k,O,D){var p=D&&D!=$.Init;if(O&&!p)k.on("blur",M),k.on("change",P),k.on("swapDoc",P),$.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){W(k)}),P(k);else if(!O&&p){k.off("blur",M),k.off("change",P),k.off("swapDoc",P),$.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),K(k);var y=k.getWrapperElement();y.className=y.className.replace(" CodeMirror-empty","")}O&&!k.hasFocus()&&M(k)});function K(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function A(k){K(k);var O=k.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=k.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var D=k.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),O.appendChild(D),k.display.lineSpace.insertBefore(O,k.display.lineSpace.firstChild)}function W(k){setTimeout(function(){var O=!1,D=k.getInputField();D.nodeName=="TEXTAREA"?O=!D.value:k.lineCount()==1&&(O=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),O?A(k):K(k)},20)}function M(k){I(k)&&A(k)}function P(k){var O=k.getWrapperElement(),D=I(k);O.className=O.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?A(k):K(k)}function I(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(rt,Qe,J){(function($){$(J("VrN/"))})(function($){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};$.defineMode("xml",function(W,M){var P=W.indentUnit,I={},k=M.htmlMode?K:A;for(var O in k)I[O]=k[O];for(var O in M)I[O]=M[O];var D,p;function y(o,E){function v(U){return E.tokenize=U,U(o,E)}var c=o.next();if(c=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?v(x("atom","]]>")):null:o.match("--")?v(x("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),v(b(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),E.tokenize=x("meta","?>"),"meta"):(D=o.eat("/")?"closeTag":"openTag",E.tokenize=R,"tag bracket");if(c=="&"){var _;return o.eat("#")?o.eat("x")?_=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):_=o.eatWhile(/[\d]/)&&o.eat(";"):_=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),_?"atom":"error"}else return o.eatWhile(/[^&<]/),null}y.isInText=!0;function R(o,E){var v=o.next();if(v==">"||v=="/"&&o.eat(">"))return E.tokenize=y,D=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return D="equals",null;if(v=="<"){E.tokenize=y,E.state=s,E.tagName=E.tagStart=null;var c=E.tokenize(o,E);return c?c+" tag error":"tag error"}else return/[\'\"]/.test(v)?(E.tokenize=S(v),E.stringStartCol=o.column(),E.tokenize(o,E)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function S(o){var E=function(v,c){for(;!v.eol();)if(v.next()==o){c.tokenize=R;break}return"string"};return E.isInAttribute=!0,E}function x(o,E){return function(v,c){for(;!v.eol();){if(v.match(E)){c.tokenize=y;break}v.next()}return o}}function b(o){return function(E,v){for(var c;(c=E.next())!=null;){if(c=="<")return v.tokenize=b(o+1),v.tokenize(E,v);if(c==">")if(o==1){v.tokenize=y;break}else return v.tokenize=b(o-1),v.tokenize(E,v)}return"meta"}}function d(o,E,v){this.prev=o.context,this.tagName=E,this.indent=o.indented,this.startOfLine=v,(I.doNotIndent.hasOwnProperty(E)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,E){for(var v;;){if(!o.context)return;if(v=o.context.tagName,!I.contextGrabbers.hasOwnProperty(v)||!I.contextGrabbers[v].hasOwnProperty(E))return;a(o)}}function s(o,E,v){return o=="openTag"?(v.tagStart=E.column(),C):o=="closeTag"?g:s}function C(o,E,v){return o=="word"?(v.tagName=E.current(),p="tag",T):I.allowMissingTagName&&o=="endTag"?(p="tag bracket",T(o,E,v)):(p="error",C)}function g(o,E,v){if(o=="word"){var c=E.current();return v.context&&v.context.tagName!=c&&I.implicitlyClosed.hasOwnProperty(v.context.tagName)&&a(v),v.context&&v.context.tagName==c||I.matchClosing===!1?(p="tag",h):(p="tag error",L)}else return I.allowMissingTagName&&o=="endTag"?(p="tag bracket",h(o,E,v)):(p="error",L)}function h(o,E,v){return o!="endTag"?(p="error",h):(a(v),s)}function L(o,E,v){return p="error",h(o,E,v)}function T(o,E,v){if(o=="word")return p="attribute",m;if(o=="endTag"||o=="selfcloseTag"){var c=v.tagName,_=v.tagStart;return v.tagName=v.tagStart=null,o=="selfcloseTag"||I.autoSelfClosers.hasOwnProperty(c)?l(v,c):(l(v,c),v.context=new d(v,c,_==v.indented)),s}return p="error",T}function m(o,E,v){return o=="equals"?f:(I.allowMissing||(p="error"),T(o,E,v))}function f(o,E,v){return o=="string"?u:o=="word"&&I.allowUnquoted?(p="string",T):(p="error",T(o,E,v))}function u(o,E,v){return o=="string"?u:T(o,E,v)}return{startState:function(o){var E={tokenize:y,state:s,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(E.baseIndent=o),E},token:function(o,E){if(!E.tagName&&o.sol()&&(E.indented=o.indentation()),o.eatSpace())return null;D=null;var v=E.tokenize(o,E);return(v||D)&&v!="comment"&&(p=null,E.state=E.state(D||v,o,E),p&&(v=p=="error"?v+" error":p)),v},indent:function(o,E,v){var c=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+P;if(c&&c.noIndent)return $.Pass;if(o.tokenize!=R&&o.tokenize!=y)return v?v.match(/^(\s*)/)[0].length:0;if(o.tagName)return I.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+P*(I.multilineTagIndentFactor||1);if(I.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var _=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(_&&_[1])for(;c;)if(c.tagName==_[2]){c=c.prev;break}else if(I.implicitlyClosed.hasOwnProperty(c.tagName))c=c.prev;else break;else if(_)for(;c;){var U=I.contextGrabbers[c.tagName];if(U&&U.hasOwnProperty(_[2]))c=c.prev;else break}for(;c&&c.prev&&!c.startOfLine;)c=c.prev;return c?c.indent+P:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:I.htmlMode?"html":"xml",helperType:I.htmlMode?"html":"xml",skipAttribute:function(o){o.state==f&&(o.state=T)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var E=[],v=o.context;v;v=v.prev)v.tagName&&E.push(v.tagName);return E.reverse()}}}),$.defineMIME("text/xml","xml"),$.defineMIME("application/xml","xml"),$.mimeModes.hasOwnProperty("text/html")||$.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3Rgl":function(rt,Qe,J){"use strict";J.r(Qe);var $=J("+L6B"),K=J("2/Rp"),A=J("6UJt"),W=J("DFOY"),M=J("/zsF"),P=J("PArb"),I=J("5NDa"),k=J("5rEg"),O=J("OaEy"),D=J("2fM7"),p=J("14J3"),y=J("BMrR"),R=J("jCWc"),S=J("kPKH"),x=J("sPJy"),b=J("bE4q"),d=J("miYZ"),a=J("tsqr"),l=J("k1fw"),s=J("9og8"),C=J("y8nQ"),g=J("Vl3Y"),h=J("tJVT"),L=J("PpiC"),T=J("B9cy"),m=J("Ol7k"),f=J("lUTK"),u=J("BvKs"),o=J("WmNS"),E=J.n(o),v=J("cDcd"),c=J.n(v),_=J("Ot1p"),U=J("Ty5D"),B=J("9kvl"),z=J("55Ip"),j=J("gJ3r"),F=J("m7e3"),X=J.n(F),te=u.a.SubMenu,ae=m.a.Content,ce=m.a.Sider,Te=function(he){var ee,re,Z,ne,me,de,Se,ye=he.graduation,Ie=he.globalSetting,Ee=he.loading,De=he.user,Re=he.dispatch,ke=Object(L.a)(he,["graduation","globalSetting","loading","user","dispatch"]),Ne=Object(U.i)(),Pe=Object(U.h)(),Ce=De.userInfo,Je=g.a.useForm(),Xe=Object(h.a)(Je,1),We=Xe[0],He=ye.addTopicData,et=function(){var Be=Object(s.a)(E.a.mark(function Ge(){var xe,Ze,Ve;return E.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return xe=We.getFieldsValue(),Ze=Object(l.a)({},xe),Ze.city&&(Ze.province=Ze.city[0],Ze.city=Ze.city[1]),Me.next=5,Re({type:"graduation/addTopic",payload:{coursesId:Ne.coursesId,attachment_ids:[],graduation_topic:Ze}});case 5:Ve=Me.sent,Ve.status?a.b.error(Ve.message):B.d.push("/classrooms/".concat(Ne.coursesId,"/graduation_topics/").concat(Ne.categoryId));case 7:case"end":return Me.stop()}},Ge)}));return function(){return Be.apply(this,arguments)}}();return Object(v.useEffect)(function(){Re({type:"graduation/addTopicDefaultData",payload:Object(l.a)({},Ne)})},[Ne.coursesId]),c.a.createElement("section",{className:"edu-container"},c.a.createElement("section",{className:"animated fadeIn"},c.a.createElement("aside",{className:"mt10"},Ce&&c.a.createElement(b.a,{separator:">"},c.a.createElement(b.a.Item,null,c.a.createElement(z.a,{to:"".concat(Ce.first_category_url)},Ce==null||((ee=Ce.course)===null||ee===void 0)?void 0:ee.course_name)),c.a.createElement(b.a.Item,null,c.a.createElement(z.a,{to:"/classrooms/".concat(Ne.coursesId,"/graduation_topics/").concat(Ne.categoryId)},"\u6BD5\u8BBE\u9009\u9898")),c.a.createElement(b.a.Item,null,"\u65B0\u5EFA"))),c.a.createElement("aside",{className:[X.a.title,"mt20"].join(" ")},c.a.createElement(y.a,{style:{width:"100%"}},c.a.createElement(S.a,{flex:"1"},c.a.createElement("strong",{className:"font20 ml5"},"\u65B0\u5EFA\u6BD5\u8BBE\u9009\u9898")),c.a.createElement(S.a,null,c.a.createElement(z.a,{className:"font16 c-light-black",to:"/classrooms/".concat(Ne.coursesId,"/exercise")},"\u8FD4\u56DE"))))),c.a.createElement("section",{className:[X.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},c.a.createElement(g.a,{layout:"vertical",form:We,scrollToFirstError:!0,onFinish:function(){var Be=Object(s.a)(E.a.mark(function Ge(xe){return E.a.wrap(function(Ve){for(;;)switch(Ve.prev=Ve.next){case 0:et();case 1:case"end":return Ve.stop()}},Ge)}));return function(Ge){return Be.apply(this,arguments)}}()},c.a.createElement(g.a.Item,{name:"tea_id",label:"\u6307\u5BFC\u8001\u5E08\uFF1A",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08"}]},c.a.createElement(D.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08",style:{width:200}},(re=He.teacher_list)===null||re===void 0?void 0:re.map(function(Be,Ge){return c.a.createElement(D.a.Option,{value:Be.id,key:Ge},Be.name)}))),c.a.createElement(g.a.Item,{name:"name",label:"\u9009\u9898\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},c.a.createElement(k.a,{maxLength:60,size:"large",placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),c.a.createElement(P.a,null),c.a.createElement(g.a.Item,{label:"\u9009\u9898\u7B80\u4ECB",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}]},c.a.createElement(_.a,{watch:!0,placeholder:"\u8BF7\u7B80\u8981\u8BF4\u660E\u9009\u9898\u5185\u5BB9\uFF0C\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"})),c.a.createElement(y.a,{gutter:[20,0]},c.a.createElement(S.a,{flex:"1"},c.a.createElement(g.a.Item,{name:"topic_type"},c.a.createElement(D.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u7C7B\u578B"},(Z=He.topic_type)===null||Z===void 0?void 0:Z.map(function(Be,Ge){return c.a.createElement(D.a.Option,{value:Be.id,key:Ge},Be.name)})))),c.a.createElement(S.a,{flex:"1"},c.a.createElement(g.a.Item,{name:"topic_source"},c.a.createElement(D.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6765\u6E90"},(ne=He.topic_source)===null||ne===void 0?void 0:ne.map(function(Be,Ge){return c.a.createElement(D.a.Option,{value:Be.id,key:Ge},Be.name)})))),c.a.createElement(S.a,{flex:"1"},c.a.createElement(g.a.Item,{name:"topic_property_first"},c.a.createElement(D.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D281"},(me=He.topic_property_first)===null||me===void 0?void 0:me.map(function(Be,Ge){return c.a.createElement(D.a.Option,{value:Be.id,key:Ge},Be.name)})))),c.a.createElement(S.a,{flex:"1"},c.a.createElement(g.a.Item,{name:"topic_property_second"},c.a.createElement(D.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D282"},(de=He.topic_property_second)===null||de===void 0?void 0:de.map(function(Be,Ge){return c.a.createElement(D.a.Option,{value:Be.id,key:Ge},Be.name)})))),c.a.createElement(S.a,{flex:"150px"})),c.a.createElement(P.a,null),c.a.createElement(g.a.Item,{name:"source_unit",label:"\u9009\u9898\u6765\u6E90\u5355\u4F4D\uFF1A"},c.a.createElement(k.a,{width:"200",size:"large",style:{width:200},placeholder:"\u8BF7\u586B\u5199\u6765\u6E90\u5355\u4F4D"})),c.a.createElement(g.a.Item,{name:"topic_repeat",label:"\u9009\u9898\u91CD\u590D\u60C5\u51B5\uFF1A"},c.a.createElement(D.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u91CD\u590D\u60C5\u51B5",style:{width:200}},(Se=He.topic_repeat)===null||Se===void 0?void 0:Se.map(function(Be,Ge){return c.a.createElement(D.a.Option,{value:Be.id,key:Ge},Be.name)}))),c.a.createElement(g.a.Item,{name:"city",label:"\u8C03\u7814\u6216\u5B9E\u4E60\u5730\u70B9\uFF1A"},c.a.createElement(W.a,{size:"large",style:{width:200},options:j.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730"})))),c.a.createElement("aside",{className:X.a.btns},c.a.createElement(K.a,{type:"primary",onClick:function(){We.submit()}},"\u4FDD\u5B58"),c.a.createElement(z.a,{to:"/classrooms/".concat(Ne.coursesId,"/graduation_topics/").concat(Ne.categoryId)},"\u53D6\u6D88")))};Qe.default=Object(B.a)(function(ge){var he=ge.graduation,ee=ge.loading,re=ge.user,Z=ge.globalSetting;return{graduation:he,globalSetting:Z,user:re,loading:ee.effects}})(Te)},"55Ip":function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return l});var $=J("Ty5D"),K=J("dI71"),A=J("cDcd"),W=J.n(A),M=J("YS25"),P=J("17x9"),I=J.n(P),k=J("wx14"),O=J("zLVn"),D=J("9R94"),p=function(f){Object(K.a)(u,f);function u(){for(var E,v=arguments.length,c=new Array(v),_=0;_<v;_++)c[_]=arguments[_];return E=f.call.apply(f,[this].concat(c))||this,E.history=Object(M.a)(E.props),E}var o=u.prototype;return o.render=function(){return W.a.createElement($.c,{history:this.history,children:this.props.children})},u}(W.a.Component),y=function(f){Object(K.a)(u,f);function u(){for(var E,v=arguments.length,c=new Array(v),_=0;_<v;_++)c[_]=arguments[_];return E=f.call.apply(f,[this].concat(c))||this,E.history=Object(M.b)(E.props),E}var o=u.prototype;return o.render=function(){return W.a.createElement($.c,{history:this.history,children:this.props.children})},u}(W.a.Component),R=function(u,o){return typeof u=="function"?u(o):u},S=function(u,o){return typeof u=="string"?Object(M.c)(u,null,null,o):u},x=function(u){return u},b=W.a.forwardRef;typeof b=="undefined"&&(b=x);function d(f){return!!(f.metaKey||f.altKey||f.ctrlKey||f.shiftKey)}var a=b(function(f,u){var o=f.innerRef,E=f.navigate,v=f.onClick,c=Object(O.a)(f,["innerRef","navigate","onClick"]),_=c.target,U=Object(k.a)({},c,{onClick:function(z){try{v&&v(z)}catch(j){throw z.preventDefault(),j}!z.defaultPrevented&&z.button===0&&(!_||_==="_self")&&!d(z)&&(z.preventDefault(),E())}});return x!==b?U.ref=u||o:U.ref=o,W.a.createElement("a",U)}),l=b(function(f,u){var o=f.component,E=o===void 0?a:o,v=f.replace,c=f.to,_=f.innerRef,U=Object(O.a)(f,["component","replace","to","innerRef"]);return W.a.createElement($.e.Consumer,null,function(B){B||Object(D.a)(!1);var z=B.history,j=S(R(c,B.location),B.location),F=j?z.createHref(j):"",X=Object(k.a)({},U,{href:F,navigate:function(){var ae=R(c,B.location),ce=v?z.replace:z.push;ce(ae)}});return x!==b?X.ref=u||_:X.innerRef=_,W.a.createElement(E,X)})});if(!1)var s,C;var g=function(u){return u},h=W.a.forwardRef;typeof h=="undefined"&&(h=g);function L(){for(var f=arguments.length,u=new Array(f),o=0;o<f;o++)u[o]=arguments[o];return u.filter(function(E){return E}).join(" ")}var T=h(function(f,u){var o=f["aria-current"],E=o===void 0?"page":o,v=f.activeClassName,c=v===void 0?"active":v,_=f.activeStyle,U=f.className,B=f.exact,z=f.isActive,j=f.location,F=f.sensitive,X=f.strict,te=f.style,ae=f.to,ce=f.innerRef,Te=Object(O.a)(f,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return W.a.createElement($.e.Consumer,null,function(ge){ge||Object(D.a)(!1);var he=j||ge.location,ee=S(R(ae,he),he),re=ee.pathname,Z=re&&re.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ne=Z?Object($.f)(he.pathname,{path:Z,exact:B,sensitive:F,strict:X}):null,me=!!(z?z(ne,he):ne),de=me?L(U,c):U,Se=me?Object(k.a)({},te,{},_):te,ye=Object(k.a)({"aria-current":me&&E||null,className:de,style:Se,to:ee},Te);return g!==h?ye.ref=u||ce:ye.innerRef=ce,W.a.createElement(l,ye)})});if(!1)var m},"7Cbv":function(rt,Qe,J){"use strict";var $=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function A(){if(!$)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $(K)}var W=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function M(R){return typeof R=="string"&&W.test(R)}for(var P=M,I=[],k=0;k<256;++k)I.push((k+256).toString(16).substr(1));function O(R){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(I[R[S+0]]+I[R[S+1]]+I[R[S+2]]+I[R[S+3]]+"-"+I[R[S+4]]+I[R[S+5]]+"-"+I[R[S+6]]+I[R[S+7]]+"-"+I[R[S+8]]+I[R[S+9]]+"-"+I[R[S+10]]+I[R[S+11]]+I[R[S+12]]+I[R[S+13]]+I[R[S+14]]+I[R[S+15]]).toLowerCase();if(!P(x))throw TypeError("Stringified UUID is invalid");return x}var D=O;function p(R,S,x){R=R||{};var b=R.random||(R.rng||A)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,S){x=x||0;for(var d=0;d<16;++d)S[x+d]=b[d];return S}return D(b)}var y=Qe.a=p},"7ahc":function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return C});var $=J("k1fw"),K=J("0Owb"),A=J("+L6B"),W=J("2/Rp"),M=J("y8nQ"),P=J("Vl3Y"),I=J("tJVT"),k=J("OaEy"),O=J("2fM7"),D=J("cDcd"),p=J.n(D),y=J("VrN/"),R=J.n(y),S=J("p77/"),x=J.n(S),b=J("c5Ni"),d=J.n(b),a=O.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},s={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Qe.b=function(g){var h=g.callback,L=g.onCancel,T=Object(D.useState)("python"),m=Object(I.a)(T,2),f=m[0],u=m[1];function o(v){u(s[v][1])}function E(v){h(v)}return p.a.createElement(P.a,Object(K.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),p.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},p.a.createElement(O.a,{onChange:o},Object.keys(s).map(function(v){return p.a.createElement(a,{key:v,value:v},s[v][0])}))),p.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},p.a.createElement(C,{mode:f})),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(W.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function C(g){var h=g.value,L=g.onChange,T=g.mode,m=g.options,f=m===void 0?{}:m,u=Object(D.useRef)(),o=Object(D.useState)(),E=Object(I.a)(o,2),v=E[0],c=E[1];return Object(D.useEffect)(function(){if(v){function _(U){var B=U.getValue();L&&L(B)}return v.on("change",_),function(){v.off("change",_)}}},[v,L]),Object(D.useEffect)(function(){v&&v.setOption("mode",T)},[v,T]),Object(D.useEffect)(function(){v&&((h!==v.getValue()||h==="")&&setTimeout(function(){v.setValue(h||" ")},300))},[v,h]),Object(D.useEffect)(function(){if(u.current&&!v){var _=R.a.fromTextArea(u.current,Object($.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));c(_)}},[u.current,v]),p.a.createElement("div",{className:"my-codemirror-container"},p.a.createElement("textarea",{ref:u}))}},"8EBN":function(rt,Qe,J){(function($){$(J("VrN/"))})(function($){"use strict";$.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 K=0;K<$.modeInfo.length;K++){var A=$.modeInfo[K];A.mimes&&(A.mime=A.mimes[0])}$.findModeByMIME=function(W){W=W.toLowerCase();for(var M=0;M<$.modeInfo.length;M++){var P=$.modeInfo[M];if(P.mime==W)return P;if(P.mimes){for(var I=0;I<P.mimes.length;I++)if(P.mimes[I]==W)return P}}if(/\+xml$/.test(W))return $.findModeByMIME("application/xml");if(/\+json$/.test(W))return $.findModeByMIME("application/json")},$.findModeByExtension=function(W){W=W.toLowerCase();for(var M=0;M<$.modeInfo.length;M++){var P=$.modeInfo[M];if(P.ext){for(var I=0;I<P.ext.length;I++)if(P.ext[I]==W)return P}}},$.findModeByFileName=function(W){for(var M=0;M<$.modeInfo.length;M++){var P=$.modeInfo[M];if(P.file&&P.file.test(W))return P}var I=W.lastIndexOf("."),k=I>-1&&W.substring(I+1,W.length);if(k)return $.findModeByExtension(k)},$.findModeByName=function(W){W=W.toLowerCase();for(var M=0;M<$.modeInfo.length;M++){var P=$.modeInfo[M];if(P.name.toLowerCase()==W)return P;if(P.alias){for(var I=0;I<P.alias.length;I++)if(P.alias[I].toLowerCase()==W)return P}}}})},"8hTe":function(rt,Qe,J){rt.exports={button:"button___1wy9m"}},"9Bee":function(rt,Qe,J){"use strict";var $=J("DYRE"),K=J("zeV3"),A=J("+L6B"),W=J("2/Rp"),M=J("k1fw"),P=J("tJVT"),I=J("cDcd"),k=J.n(I),O=J("vg9a"),D=J("DlQD"),p=J.n(D),y=J("rUJ1");function R(he,ee){var re=he.match(/^(\s+)(?:```)/);if(re===null)return ee;var Z=re[1];return ee.split(`
`).map(function(ne){var me=ne.match(/^\s+/);if(me===null)return ne;var de=Object(P.a)(me,1),Se=de[0];return Se.length>=Z.length?ne.slice(Z.length):ne}).join(`
`)}var S=[],x=["<ul>"],b=new p.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){S.length=0,x=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(he,ee,re,Z){if(ee>=he.length||he[ee].level<=re)return ee;var ne=he[ee];Z.push("<li><a href='#"+ne.anchor+"'>"+ne.text+"</a>"),ee++;var me=[];return ee=s(he,ee,ne.level,me),me.length>0&&(Z.push("<ul>"),me.forEach(function(de){Z.push(de)}),Z.push("</ul>")),Z.push("</li>"),ee=s(he,ee,re,Z),ee}function C(){return s(S,0,0,x),x.push("</ul>"),x.join("")}var g={heading:function(ee){var re=d.exec(ee);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},fences:function(ee){var re=this.rules.block.fences.exec(ee);if(re){var Z=re[0],ne=R(Z,re[3]||""),me=re[2]?re[2].trim():re[2];if(["latex","katex","math"].indexOf(me)>=0){var de=T(),Se=ne;ne=de,m[de]={type:"block",expression:Se}}return{type:"code",raw:Z,lang:me,text:ne}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,L=0,T=function(){return"__special_katext_id_".concat(L++,"__")},m={};function f(){return m}function u(){L=0,m={}}function o(he){return he=he.replace(h,function(ee,re){var Z=T();return m[Z]={type:"inline",expression:re},Z}),he}var E=b.listitem;b.listitem=function(he){return E(o(he))};var v=b.paragraph;b.paragraph=function(he){return v(o(he))};var c=b.tablecell;b.tablecell=function(he,ee){return c(o(he),ee)},b.code=function(he,ee,re){var Z=(ee||"").match(/\S*/)[0];return Z?["latex","katex","math"].indexOf(Z)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ee,'">').concat(re?he:Object(y.escape)(he,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(re?he:Object(y.escape)(he,!0))+"</code></pre>"},b.heading=function(he,ee,re){var Z=this.options.headerPrefix+re.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return S.push({anchor:Z,level:ee,text:he}),"<h"+ee+' id="'+Z+'">'+he+"</h"+ee+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:g,renderer:b});var _=p.a,U=J("SJMd"),B=J("ulZh"),z=J.n(B),j=J("m3rI"),F=J("Oy/b"),X=J("p5ED"),te=J("8hTe"),ae=J.n(te),ce=/<pre[^>]*>/g;function Te(he){var ee=document.createElement("div");return ee.innerHTML=he,ee.childNodes.length===0?"":ee.childNodes[0].nodeValue}var ge=Qe.a=function(he){var ee=he.value,re=ee===void 0?"":ee,Z=he.edit,ne=Z===void 0?!1:Z,me=he.className,de=he.showTextOnly,Se=he.showLines,ye=he.replaces,Ie=he.zoomImg,Ee=he.hasMask,De=he.style,Re=De===void 0?{}:De,ke=he.stylesPrev,Ne=ke===void 0?{}:ke,Pe=String(re),Ce=Object(I.useRef)(),Je=Object(I.useRef)(),Xe=Object(I.useState)(""),We=Object(P.a)(Xe,2),He=We[0],et=We[1],Be=Object(I.useState)("office"),Ge=Object(P.a)(Be,2),xe=Ge[0],Ze=Ge[1],Ve=Object(I.useMemo)(function(){try{var ue=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Pe=Pe.replace(ue,"("+j.a.API_SERVER+"/api/attachments/").replace(Y,'"'+j.a.API_SERVER+"/api/attachments/").replace(Q,'"'+j.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(Le){}var q=_(Pe),oe=f();if(Pe.match(/\[TOC\]/)&&(q=q.replace("<p>[TOC]</p>",C()),a()),q=q.replace(/(__special_katext_id_\d+__)/g,function(Le,_e){var ze=oe[_e],it=ze.type,Ae=ze.expression;return Object(F.renderToString)(Te(Ae)||"",{displayMode:it==="block",throwOnError:!1,output:"html"})}),q=q.replace(/▁/g,"\u2581\u2581\u2581"),u(),de){var be=document.createElement("div");return be.innerHTML=q,be.innerText}return setTimeout(function(){return fe()},500),q},[Pe]),we=Object(I.useRef)();l.WebkitLineClamp=Se,Se&&(Re=Object(M.a)(Object(M.a)({},Re),l));function Me(ue){var Y=ue.target;if(Y.tagName.toUpperCase()==="IMG"){if(Ie){var Q=Y.getAttribute("src");et(Q),Ze("image")}}else if(Y.tagName.toUpperCase()==="A"){var q=Y.getAttribute("href");if(q.indexOf("office")>-1)ue.preventDefault(),et(q),Ze("office");else if(q.indexOf("application/pdf")>-1)ue.preventDefault(),et(q),Ze("pdf");else if(q.indexOf("text/html")>-1)ue.preventDefault(),et(q),Ze("html");else if(q.startsWith("#")){ue.preventDefault();var oe=document.getElementById(q.replace("#",""));oe&&oe.scrollIntoView(!0)}}}var fe=function(){var Y,Q=(Y=we.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");Q==null||Q.forEach(function(q){if(q.oncontextmenu=function(){return!1},q.src.indexOf(".m3u8")>-1&&!q.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var oe=new z.a;oe.loadSource(q.src),oe.attachMedia(q)}}})};Object(I.useEffect)(function(){if(we.current&&Ve&&(Ve.match(ce)&&window.PR.prettyPrint()),we.current)return we.current.addEventListener("click",Me),function(){we.current.removeEventListener("click",Me),u(),a()}},[Ve,we.current,Me]);var le=function(Y){if(!ne)return;Y.target.nodeName==="IMG"?(Ce.current.style.display="flex",Ce.current.style.width=Y.target.clientWidth+"px",Ce.current.style.height=Y.target.clientHeight+"px",Ce.current.style.top=Y.target.offsetTop+"px",Ce.current.style.left=Y.target.offsetLeft+"px",Je.current.src=Y.target.getAttribute("src")):Ce.current.style.display="none"};return k.a.createElement("div",{style:{position:"relative"}},k.a.createElement("div",{ref:we,style:Object(M.a)({},Re),className:"".concat(me||""," markdown-body ").concat(ae.a.mdBody),onMouseOver:le,dangerouslySetInnerHTML:{__html:Ve}}),k.a.createElement("div",{ref:Ce,className:ae.a.button},k.a.createElement(K.a,null,k.a.createElement(W.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),k.a.createElement(W.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),k.a.createElement("img",{ref:Je,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),k.a.createElement(X.a,{close:!0,data:He,type:He!=null&&He.length?xe:"",style:Object(M.a)({},Ne),onClose:function(){return et("")}}))}},"9VGf":function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return A});var $=J("cDcd"),K=J.n($);function A(W,M){var P=Object($.useRef)();Object($.useEffect)(function(){P.current=W}),Object($.useEffect)(function(){function I(){P.current()}if(M!==null){var k=setInterval(I,M);return function(){return clearInterval(k)}}},[M])}},BU3w:function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return P});var $=J("MNnm"),K="rc-util-key";function A(I){if(I.attachTo)return I.attachTo;var k=document.querySelector("head");return k||document.body}function W(I){var k,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object($.a)())return null;var D=document.createElement("style");if((k=O.csp)===null||k===void 0?void 0:k.nonce){var p;D.nonce=(p=O.csp)===null||p===void 0?void 0:p.nonce}D.innerHTML=I;var y=A(O),R=y.firstChild;return O.prepend&&y.prepend?y.prepend(D):O.prepend&&R?y.insertBefore(D,R):y.appendChild(D),D}var M=new Map;function P(I,k){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=A(O);if(!M.has(D)){var p=W("",O),y=p.parentNode;M.set(D,y),y.removeChild(p)}var R=Array.from(M.get(D).children).find(function(a){return a.tagName==="STYLE"&&a[K]===k});if(R){var S,x;if(((S=O.csp)===null||S===void 0?void 0:S.nonce)&&R.nonce!==((x=O.csp)===null||x===void 0?void 0:x.nonce)){var b;R.nonce=(b=O.csp)===null||b===void 0?void 0:b.nonce}return R.innerHTML!==I&&(R.innerHTML=I),R}var d=W(I,O);return d[K]=k,d}},Bd2K:function(rt,Qe,J){(function($){$(J("VrN/"),J("osHv"))})(function($){$.defineOption("autoCloseTags",!1,function(O,D,p){if(p!=$.Init&&p&&O.removeKeyMap("autoCloseTags"),!D)return;var y={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(y["'/'"]=function(R){return P(R)}),(typeof D!="object"||D.whenOpening!==!1)&&(y["'>'"]=function(R){return W(R)}),O.addKeyMap(y)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function W(O){if(O.getOption("disableInput"))return $.Pass;for(var D=O.listSelections(),p=[],y=O.getOption("autoCloseTags"),R=0;R<D.length;R++){if(!D[R].empty())return $.Pass;var S=D[R].head,x=O.getTokenAt(S),b=$.innerMode(O.getMode(),x.state),d=b.state,a=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),l=a&&a.name;if(!l)return $.Pass;var s=b.mode.configuration=="html",C=typeof y=="object"&&y.dontCloseTags||s&&K,g=typeof y=="object"&&y.indentTags||s&&A;x.end>S.ch&&(l=l.slice(0,l.length-x.end+S.ch));var h=l.toLowerCase();if(!l||x.type=="string"&&(x.end!=S.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&a.close||x.string.indexOf("/")==S.ch-x.start-1||C&&I(C,h)>-1||k(O,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],l,S,!0))return $.Pass;var L=typeof y=="object"&&y.emptyTags;if(L&&I(L,l)>-1){p[R]={text:"/>",newPos:$.Pos(S.line,S.ch+2)};continue}var T=g&&I(g,h)>-1;p[R]={indent:T,text:">"+(T?`
`:"")+"</"+l+">",newPos:T?$.Pos(S.line+1,0):$.Pos(S.line,S.ch+1)}}for(var m=typeof y=="object"&&y.dontIndentOnAutoClose,R=D.length-1;R>=0;R--){var f=p[R];O.replaceRange(f.text,D[R].head,D[R].anchor,"+insert");var u=O.listSelections().slice(0);u[R]={head:f.newPos,anchor:f.newPos},O.setSelections(u),!m&&f.indent&&(O.indentLine(f.newPos.line,null,!0),O.indentLine(f.newPos.line+1,null,!0))}}function M(O,D){for(var p=O.listSelections(),y=[],R=D?"/":"</",S=O.getOption("autoCloseTags"),x=typeof S=="object"&&S.dontIndentOnSlash,b=0;b<p.length;b++){if(!p[b].empty())return $.Pass;var d=p[b].head,a=O.getTokenAt(d),l=$.innerMode(O.getMode(),a.state),s=l.state;if(D&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=d.ch-1))return $.Pass;var C,g=l.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(g&&l.mode.name=="javascript")C=R+"script";else if(g&&l.mode.name=="css")C=R+"style";else{var h=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(s);if(!h||h.length&&k(O,h,h[h.length-1],d))return $.Pass;C=R+h[h.length-1]}O.getLine(d.line).charAt(a.end)!=">"&&(C+=">"),y[b]=C}if(O.replaceSelections(y),p=O.listSelections(),!x)for(var b=0;b<p.length;b++)(b==p.length-1||p[b].head.line<p[b+1].head.line)&&O.indentLine(p[b].head.line)}function P(O){return O.getOption("disableInput")?$.Pass:M(O,!0)}$.commands.closeTag=function(O){return M(O)};function I(O,D){if(O.indexOf)return O.indexOf(D);for(var p=0,y=O.length;p<y;++p)if(O[p]==D)return p;return-1}function k(O,D,p,y,R){if(!$.scanForClosingTag)return!1;var S=Math.min(O.lastLine()+1,y.line+500),x=$.scanForClosingTag(O,y,null,S);if(!x||x.tag!=p)return!1;for(var b=R?1:0,d=D.length-1;d>=0&&D[d]==p;d--)++b;y=x.to;for(var d=1;d<b;d++){var a=$.scanForClosingTag(O,y,null,S);if(!a||a.tag!=p)return!1;y=a.to}return!0}})},BjJ7:function(rt,Qe,J){"use strict";J.d(Qe,"d",function(){return K}),J.d(Qe,"c",function(){return A}),J.d(Qe,"e",function(){return W}),J.d(Qe,"b",function(){return M}),J.d(Qe,"a",function(){return I});var $=J("m3rI");function K(k){var O=!0;if(k.length>0){for(var D=0;D<k.length;D++)if(k[D].compile_success==0||!k[D].compile_success){O=!1;break}}else O=!1;return O}function A(k){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],p=0;p<k.length;p++){var y=k[p],R=O?"".concat(O,"/").concat(y.name):"".concat(y.name);D.push({title:y.name,isLeaf:!(y.type==="tree"),key:R})}return D}function W(k,O,D){for(var p=0;p<k.length;p++){var y=k[p];if(y.key===O){y.children=D;break}y.children&&W(y.children,O,D)}return k}function M(k,O,D){var p;return function(){var y=this,R=arguments,S=function(){p=null,D||k.apply(y,R)},x=D&&!p;clearTimeout(p),p=setTimeout(S,O),x&&k.apply(y,R)}}var P=!0,I=$.a.API_SERVER},"C+DQ":function(rt,Qe,J){},D1Df:function(rt,Qe,J){"use strict";function $(c){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$=function(U){return typeof U}:$=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},$(c)}function K(){return K=Object.assign||function(c){for(var _=1;_<arguments.length;_++){var U=arguments[_];for(var B in U)Object.prototype.hasOwnProperty.call(U,B)&&(c[B]=U[B])}return c},K.apply(this,arguments)}function A(c,_){var U=Object.keys(c);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(c);_&&(B=B.filter(function(z){return Object.getOwnPropertyDescriptor(c,z).enumerable})),U.push.apply(U,B)}return U}function W(c){for(var _=1;_<arguments.length;_++){var U=arguments[_]!=null?arguments[_]:{};_%2?A(U,!0).forEach(function(B){x(c,B,U[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(U)):A(U).forEach(function(B){Object.defineProperty(c,B,Object.getOwnPropertyDescriptor(U,B))})}return c}function M(c,_){if(c==null)return{};var U=P(c,_),B,z;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(c);for(z=0;z<j.length;z++){if(B=j[z],_.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(c,B))continue;U[B]=c[B]}}return U}function P(c,_){if(c==null)return{};var U={},B=Object.keys(c),z,j;for(j=0;j<B.length;j++){if(z=B[j],_.indexOf(z)>=0)continue;U[z]=c[z]}return U}function I(c,_){if(!(c instanceof _))throw new TypeError("Cannot call a class as a function")}function k(c,_){for(var U=0;U<_.length;U++){var B=_[U];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(c,B.key,B)}}function O(c,_,U){return _&&k(c.prototype,_),U&&k(c,U),c}function D(c,_){return _&&($(_)==="object"||typeof _=="function")?_:y(c)}function p(c){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},p(c)}function y(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function R(c,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(_&&_.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),_&&S(c,_)}function S(c,_){return S=Object.setPrototypeOf||function(B,z){return B.__proto__=z,B},S(c,_)}function x(c,_,U){return _ in c?Object.defineProperty(c,_,{value:U,enumerable:!0,configurable:!0,writable:!0}):c[_]=U,c}var b=J("cDcd"),d=J("17x9"),a=J("H38U"),l=J("aRTE");function s(c){for(var _="",U=0;U<c.length;U++){var B=c.charCodeAt(U);B<128?_+=String.fromCharCode(B):B<2048?(_+=String.fromCharCode(192|B>>6),_+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(_+=String.fromCharCode(224|B>>12),_+=String.fromCharCode(128|B>>6&63),_+=String.fromCharCode(128|B&63)):(U++,B=65536+((B&1023)<<10|c.charCodeAt(U)&1023),_+=String.fromCharCode(240|B>>18),_+=String.fromCharCode(128|B>>12&63),_+=String.fromCharCode(128|B>>6&63),_+=String.fromCharCode(128|B&63))}return _}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},g={},h=4,L=.1;function T(c){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return c.forEach(function(B,z){var j=null;B.forEach(function(F,X){if(!F&&j!==null){U.push("M".concat(j+_," ").concat(z+_,"h").concat(X-j,"v1H").concat(j+_,"z")),j=null;return}if(X===B.length-1){if(!F)return;j===null?U.push("M".concat(X+_,",").concat(z+_," h1v1H").concat(X+_,"z")):U.push("M".concat(j+_,",").concat(z+_," h").concat(X+1-j,"v1H").concat(j+_,"z"));return}F&&j===null&&(j=X)})}),U.join("")}function m(c,_){return c.slice().map(function(U,B){return B<_.y||B>=_.y+_.h?U:U.map(function(z,j){return j<_.x||j>=_.x+_.w?z:!1})})}function f(c,_){var U=c.imageSettings,B=c.size,z=c.includeMargin;if(U==null)return null;var j=z?h:0,F=_.length+j*2,X=Math.floor(B*L),te=F/B,ae=(U.width||X)*te,ce=(U.height||X)*te,Te=U.x==null?_.length/2-ae/2:U.x*te,ge=U.y==null?_.length/2-ce/2:U.y*te,he=null;if(U.excavate){var ee=Math.floor(Te),re=Math.floor(ge),Z=Math.ceil(ae+Te-ee),ne=Math.ceil(ce+ge-re);he={x:ee,y:re,w:Z,h:ne}}return{x:Te,y:ge,h:ce,w:ae,excavation:he}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(c){return!1}return!0}(),o=function(c){R(_,c);function _(){var U,B;I(this,_);for(var z=arguments.length,j=new Array(z),F=0;F<z;F++)j[F]=arguments[F];return B=D(this,(U=p(_)).call.apply(U,[this].concat(j))),x(y(B),"_canvas",void 0),x(y(B),"_image",void 0),x(y(B),"state",{imgLoaded:!1}),x(y(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return O(_,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,te=B.fgColor,ae=B.includeMargin,ce=B.imageSettings,Te=new a(-1,l[F]);if(Te.addData(s(z)),Te.make(),this._canvas!=null){var ge=this._canvas,he=ge.getContext("2d");if(!he)return;var ee=Te.modules;if(ee===null)return;var re=ae?h:0,Z=ee.length+re*2,ne=f(this.props,ee);ce!=null&&ne!=null&&(ne.excavation!=null&&(ee=m(ee,ne.excavation)));var me=window.devicePixelRatio||1;ge.height=ge.width=j*me;var de=j/Z*me;he.scale(de,de),he.fillStyle=X,he.fillRect(0,0,Z,Z),he.fillStyle=te,u?he.fill(new Path2D(T(ee,re))):ee.forEach(function(Se,ye){Se.forEach(function(Ie,Ee){Ie&&he.fillRect(Ee+re,ye+re,1,1)})}),this.state.imgLoaded&&this._image&&ne!=null&&he.drawImage(this._image,ne.x+re,ne.y+re,ne.w,ne.h)}}},{key:"render",value:function(){var B=this,z=this.props,j=z.value,F=z.size,X=z.level,te=z.bgColor,ae=z.fgColor,ce=z.style,Te=z.includeMargin,ge=z.imageSettings,he=M(z,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),ee=W({height:F,width:F},ce),re=null,Z=ge&&ge.src;return ge!=null&&Z!=null&&(re=b.createElement("img",{src:Z,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(me){return B._image=me}})),b.createElement(b.Fragment,null,b.createElement("canvas",K({style:ee,height:F,width:F,ref:function(me){return B._canvas=me}},he)),re)}}]),_}(b.PureComponent);x(o,"defaultProps",C);var E=function(c){R(_,c);function _(){return I(this,_),D(this,p(_).apply(this,arguments))}return O(_,[{key:"render",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,te=B.fgColor,ae=B.includeMargin,ce=B.imageSettings,Te=M(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),ge=new a(-1,l[F]);ge.addData(s(z)),ge.make();var he=ge.modules;if(he===null)return null;var ee=ae?h:0,re=he.length+ee*2,Z=f(this.props,he),ne=null;ce!=null&&Z!=null&&(Z.excavation!=null&&(he=m(he,Z.excavation)),ne=b.createElement("image",{xlinkHref:ce.src,height:Z.h,width:Z.w,x:Z.x+ee,y:Z.y+ee,preserveAspectRatio:"none"}));var me=T(he,ee);return b.createElement("svg",K({shapeRendering:"crispEdges",height:j,width:j,viewBox:"0 0 ".concat(re," ").concat(re)},Te),b.createElement("path",{fill:X,d:"M0,0 h".concat(re,"v").concat(re,"H0z")}),b.createElement("path",{fill:te,d:me}),ne)}}]),_}(b.PureComponent);x(E,"defaultProps",C);var v=function(_){var U=_.renderAs,B=M(_,["renderAs"]),z=U==="svg"?E:o;return b.createElement(z,B)};v.defaultProps=W({renderAs:"canvas"},C),rt.exports=v},DlQD:function(rt,Qe,J){(function($,K){rt.exports=K()})(this,function(){"use strict";function $(fe,le){for(var ue=0;ue<le.length;ue++){var Y=le[ue];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(fe,Y.key,Y)}}function K(fe,le,ue){return le&&$(fe.prototype,le),ue&&$(fe,ue),fe}function A(fe,le){if(!fe)return;if(typeof fe=="string")return W(fe,le);var ue=Object.prototype.toString.call(fe).slice(8,-1);if(ue==="Object"&&fe.constructor&&(ue=fe.constructor.name),ue==="Map"||ue==="Set")return Array.from(fe);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return W(fe,le)}function W(fe,le){(le==null||le>fe.length)&&(le=fe.length);for(var ue=0,Y=new Array(le);ue<le;ue++)Y[ue]=fe[ue];return Y}function M(fe,le){var ue;if(typeof Symbol=="undefined"||fe[Symbol.iterator]==null){if(Array.isArray(fe)||(ue=A(fe))||le&&fe&&typeof fe.length=="number"){ue&&(fe=ue);var Y=0;return function(){return Y>=fe.length?{done:!0}:{done:!1,value:fe[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 ue=fe[Symbol.iterator](),ue.next.bind(ue)}function P(fe,le){return le={exports:{}},fe(le,le.exports),le.exports}var I=P(function(fe){function le(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ue(Y){fe.exports.defaults=Y}fe.exports={defaults:le(),getDefaults:le,changeDefaults:ue}}),k=I.defaults,O=I.getDefaults,D=I.changeDefaults,p=/[&<>"']/,y=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},b=function(le){return x[le]};function d(fe,le){if(le){if(p.test(fe))return fe.replace(y,b)}else if(R.test(fe))return fe.replace(S,b);return fe}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(fe){return fe.replace(a,function(le,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var s=/(^|[^\[])\^/g;function C(fe,le){fe=fe.source||fe,le=le||"";var ue={replace:function(Q,q){return q=q.source||q,q=q.replace(s,"$1"),fe=fe.replace(Q,q),ue},getRegex:function(){return new RegExp(fe,le)}};return ue}var g=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(fe,le,ue){if(fe){var Y;try{Y=decodeURIComponent(l(ue)).replace(g,"").toLowerCase()}catch(Q){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}le&&!h.test(ue)&&(ue=o(le,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(Q){return null}return ue}var T={},m=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(fe,le){T[" "+fe]||(m.test(fe)?T[" "+fe]=fe+"/":T[" "+fe]=_(fe,"/",!0)),fe=T[" "+fe];var ue=fe.indexOf(":")===-1;return le.substring(0,2)==="//"?ue?le:fe.replace(f,"$1")+le:le.charAt(0)==="/"?ue?le:fe.replace(u,"$1")+le:fe+le}var E={exec:function(){}};function v(fe){for(var le=1,ue,Y;le<arguments.length;le++){ue=arguments[le];for(Y in ue)Object.prototype.hasOwnProperty.call(ue,Y)&&(fe[Y]=ue[Y])}return fe}function c(fe,le){var ue=fe.replace(/\|/g,function(q,oe,be){for(var Le=!1,_e=oe;--_e>=0&&be[_e]==="\\";)Le=!Le;return Le?"|":" |"}),Y=ue.split(/ \|/),Q=0;if(Y.length>le)Y.splice(le);else for(;Y.length<le;)Y.push("");for(;Q<Y.length;Q++)Y[Q]=Y[Q].trim().replace(/\\\|/g,"|");return Y}function _(fe,le,ue){var Y=fe.length;if(Y===0)return"";for(var Q=0;Q<Y;){var q=fe.charAt(Y-Q-1);if(q===le&&!ue)Q++;else if(q!==le&&ue)Q++;else break}return fe.substr(0,Y-Q)}function U(fe,le){if(fe.indexOf(le[1])===-1)return-1;for(var ue=fe.length,Y=0,Q=0;Q<ue;Q++)if(fe[Q]==="\\")Q++;else if(fe[Q]===le[0])Y++;else if(fe[Q]===le[1]&&(Y--,Y<0))return Q;return-1}function B(fe){fe&&fe.sanitize&&!fe.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 z={escape:d,unescape:l,edit:C,cleanUrl:L,resolveUrl:o,noopTest:E,merge:v,splitCells:c,rtrim:_,findClosingBracket:U,checkSanitizeDeprecation:B},j=I.defaults,F=z.rtrim,X=z.splitCells,te=z.escape,ae=z.findClosingBracket;function ce(fe,le,ue){var Y=le.href,Q=le.title?te(le.title):null,q=fe[1].replace(/\\([\[\]])/g,"$1");return fe[0].charAt(0)!=="!"?{type:"link",raw:ue,href:Y,title:Q,text:q}:{type:"image",raw:ue,href:Y,title:Q,text:te(q)}}function Te(fe,le){var ue=fe.match(/^(\s+)(?:```)/);if(ue===null)return le;var Y=ue[1];return le.split(`
`).map(function(Q){var q=Q.match(/^\s+/);if(q===null)return Q;var oe=q[0];return oe.length>=Y.length?Q.slice(Y.length):Q}).join(`
`)}var ge=function(){function fe(ue){this.options=ue||j}var le=fe.prototype;return le.space=function(Y){var Q=this.rules.block.newline.exec(Y);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
`}},le.code=function(Y,Q){var q=this.rules.block.code.exec(Y);if(q){var oe=Q[Q.length-1];if(oe&&oe.type==="paragraph")return{raw:q[0],text:q[0].trimRight()};var be=q[0].replace(/^ {4}/gm,"");return{type:"code",raw:q[0],codeBlockStyle:"indented",text:this.options.pedantic?be:F(be,`
`)}}},le.fences=function(Y){var Q=this.rules.block.fences.exec(Y);if(Q){var q=Q[0],oe=Te(q,Q[3]||"");return{type:"code",raw:q,lang:Q[2]?Q[2].trim():Q[2],text:oe}}},le.heading=function(Y){var Q=this.rules.block.heading.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},le.nptable=function(Y){var Q=this.rules.block.nptable.exec(Y);if(Q){var q={type:"table",header:X(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[],raw:Q[0]};if(q.header.length===q.align.length){var oe=q.align.length,be;for(be=0;be<oe;be++)/^ *-+: *$/.test(q.align[be])?q.align[be]="right":/^ *:-+: *$/.test(q.align[be])?q.align[be]="center":/^ *:-+ *$/.test(q.align[be])?q.align[be]="left":q.align[be]=null;for(oe=q.cells.length,be=0;be<oe;be++)q.cells[be]=X(q.cells[be],q.header.length);return q}}},le.hr=function(Y){var Q=this.rules.block.hr.exec(Y);if(Q)return{type:"hr",raw:Q[0]}},le.blockquote=function(Y){var Q=this.rules.block.blockquote.exec(Y);if(Q){var q=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:q}}},le.list=function(Y){var Q=this.rules.block.list.exec(Y);if(Q){for(var q=Q[0],oe=Q[2],be=oe.length>1,Le=oe[oe.length-1]===")",_e={type:"list",raw:q,ordered:be,start:be?+oe.slice(0,-1):"",loose:!1,items:[]},ze=Q[0].match(this.rules.block.item),it=!1,Ae,ct,at,tt,xt,Et,Rt,At=ze.length,pt=0;pt<At;pt++)Ae=ze[pt],q=Ae,ct=Ae.length,Ae=Ae.replace(/^ *([*+-]|\d+[.)]) */,""),~Ae.indexOf(`
`)&&(ct-=Ae.length,Ae=this.options.pedantic?Ae.replace(/^ {1,4}/gm,""):Ae.replace(new RegExp("^ {1,"+ct+"}","gm"),"")),pt!==At-1&&(at=this.rules.block.bullet.exec(ze[pt+1])[0],(be?at.length===1||!Le&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==oe)&&(tt=ze.slice(pt+1).join(`
`),_e.raw=_e.raw.substring(0,_e.raw.length-tt.length),pt=At-1)),xt=it||/\n\n(?!\s*$)/.test(Ae),pt!==At-1&&(it=Ae.charAt(Ae.length-1)===`
`,xt||(xt=it)),xt&&(_e.loose=!0),Et=/^\[[ xX]\] /.test(Ae),Rt=void 0,Et&&(Rt=Ae[1]!==" ",Ae=Ae.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:q,task:Et,checked:Rt,loose:xt,text:Ae});return _e}},le.html=function(Y){var Q=this.rules.block.html.exec(Y);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):te(Q[0]):Q[0]}},le.def=function(Y){var Q=this.rules.block.def.exec(Y);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var q=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:q,raw:Q[0],href:Q[2],title:Q[3]}}},le.table=function(Y){var Q=this.rules.block.table.exec(Y);if(Q){var q={type:"table",header:X(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[]};if(q.header.length===q.align.length){q.raw=Q[0];var oe=q.align.length,be;for(be=0;be<oe;be++)/^ *-+: *$/.test(q.align[be])?q.align[be]="right":/^ *:-+: *$/.test(q.align[be])?q.align[be]="center":/^ *:-+ *$/.test(q.align[be])?q.align[be]="left":q.align[be]=null;for(oe=q.cells.length,be=0;be<oe;be++)q.cells[be]=X(q.cells[be].replace(/^ *\| *| *\| *$/g,""),q.header.length);return q}}},le.lheading=function(Y){var Q=this.rules.block.lheading.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},le.paragraph=function(Y){var Q=this.rules.block.paragraph.exec(Y);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
`?Q[1].slice(0,-1):Q[1]}},le.text=function(Y,Q){var q=this.rules.block.text.exec(Y);if(q){var oe=Q[Q.length-1];return oe&&oe.type==="text"?{raw:q[0],text:q[0]}:{type:"text",raw:q[0],text:q[0]}}},le.escape=function(Y){var Q=this.rules.inline.escape.exec(Y);if(Q)return{type:"escape",raw:Q[0],text:te(Q[1])}},le.tag=function(Y,Q,q){var oe=this.rules.inline.tag.exec(Y);if(oe)return!Q&&/^<a /i.test(oe[0])?Q=!0:Q&&/^<\/a>/i.test(oe[0])&&(Q=!1),!q&&/^<(pre|code|kbd|script)(\s|>)/i.test(oe[0])?q=!0:q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(oe[0])&&(q=!1),{type:this.options.sanitize?"text":"html",raw:oe[0],inLink:Q,inRawBlock:q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):te(oe[0]):oe[0]}},le.link=function(Y){var Q=this.rules.inline.link.exec(Y);if(Q){var q=ae(Q[2],"()");if(q>-1){var oe=Q[0].indexOf("!")===0?5:4,be=oe+Q[1].length+q;Q[2]=Q[2].substring(0,q),Q[0]=Q[0].substring(0,be).trim(),Q[3]=""}var Le=Q[2],_e="";if(this.options.pedantic){var ze=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);ze?(Le=ze[1],_e=ze[3]):_e=""}else _e=Q[3]?Q[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var it=ce(Q,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},Q[0]);return it}},le.reflink=function(Y,Q){var q;if((q=this.rules.inline.reflink.exec(Y))||(q=this.rules.inline.nolink.exec(Y))){var oe=(q[2]||q[1]).replace(/\s+/g," ");if(oe=Q[oe.toLowerCase()],!oe||!oe.href){var be=q[0].charAt(0);return{type:"text",raw:be,text:be}}var Le=ce(q,oe,q[0]);return Le}},le.strong=function(Y,Q,q){q===void 0&&(q="");var oe=this.rules.inline.strong.start.exec(Y);if(oe&&(!oe[1]||oe[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){Q=Q.slice(-1*Y.length);var be=oe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Le;(oe=be.exec(Q))!=null;)if(Le=this.rules.inline.strong.middle.exec(Q.slice(0,oe.index+3)),Le)return{type:"strong",raw:Y.slice(0,Le[0].length),text:Y.slice(2,Le[0].length-2)}}},le.em=function(Y,Q,q){q===void 0&&(q="");var oe=this.rules.inline.em.start.exec(Y);if(oe&&(!oe[1]||oe[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){Q=Q.slice(-1*Y.length);var be=oe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Le;(oe=be.exec(Q))!=null;)if(Le=this.rules.inline.em.middle.exec(Q.slice(0,oe.index+2)),Le)return{type:"em",raw:Y.slice(0,Le[0].length),text:Y.slice(1,Le[0].length-1)}}},le.codespan=function(Y){var Q=this.rules.inline.code.exec(Y);if(Q){var q=Q[2].replace(/\n/g," "),oe=/[^ ]/.test(q),be=q.startsWith(" ")&&q.endsWith(" ");return oe&&be&&(q=q.substring(1,q.length-1)),q=te(q,!0),{type:"codespan",raw:Q[0],text:q}}},le.br=function(Y){var Q=this.rules.inline.br.exec(Y);if(Q)return{type:"br",raw:Q[0]}},le.del=function(Y){var Q=this.rules.inline.del.exec(Y);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},le.autolink=function(Y,Q){var q=this.rules.inline.autolink.exec(Y);if(q){var oe,be;return q[2]==="@"?(oe=te(this.options.mangle?Q(q[1]):q[1]),be="mailto:"+oe):(oe=te(q[1]),be=oe),{type:"link",raw:q[0],text:oe,href:be,tokens:[{type:"text",raw:oe,text:oe}]}}},le.url=function(Y,Q){var q;if(q=this.rules.inline.url.exec(Y)){var oe,be;if(q[2]==="@")oe=te(this.options.mangle?Q(q[0]):q[0]),be="mailto:"+oe;else{var Le;do Le=q[0],q[0]=this.rules.inline._backpedal.exec(q[0])[0];while(Le!==q[0]);oe=te(q[0]),q[1]==="www."?be="http://"+oe:be=oe}return{type:"link",raw:q[0],text:oe,href:be,tokens:[{type:"text",raw:oe,text:oe}]}}},le.inlineText=function(Y,Q,q){var oe=this.rules.inline.text.exec(Y);if(oe){var be;return Q?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):te(oe[0]):oe[0]:be=te(this.options.smartypants?q(oe[0]):oe[0]),{type:"text",raw:oe[0],text:be}}},fe}(),he=z.noopTest,ee=z.edit,re=z.merge,Z={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Z._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Z._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Z.def=ee(Z.def).replace("label",Z._label).replace("title",Z._title).getRegex(),Z.bullet=/(?:[*+-]|\d{1,9}[.)])/,Z.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Z.item=ee(Z.item,"gm").replace(/bull/g,Z.bullet).getRegex(),Z.list=ee(Z.list).replace(/bull/g,Z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Z.def.source+")").getRegex(),Z._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",Z._comment=/<!--(?!-?>)[\s\S]*?-->/,Z.html=ee(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z.paragraph=ee(Z._paragraph).replace("hr",Z.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",Z._tag).getRegex(),Z.blockquote=ee(Z.blockquote).replace("paragraph",Z.paragraph).getRegex(),Z.normal=re({},Z),Z.gfm=re({},Z.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*|$)"}),Z.gfm.nptable=ee(Z.gfm.nptable).replace("hr",Z.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",Z._tag).getRegex(),Z.gfm.table=ee(Z.gfm.table).replace("hr",Z.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",Z._tag).getRegex(),Z.pedantic=re({},Z.normal,{html:ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Z._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:he,paragraph:ee(Z.normal._paragraph).replace("hr",Z.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ne._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ne.punctuation=ee(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex(),ne._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ne._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ne.em.start=ee(ne.em.start).replace(/punctuation/g,ne._punctuation).getRegex(),ne.em.middle=ee(ne.em.middle).replace(/punctuation/g,ne._punctuation).replace(/overlapSkip/g,ne._overlapSkip).getRegex(),ne.em.endAst=ee(ne.em.endAst,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.em.endUnd=ee(ne.em.endUnd,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.start=ee(ne.strong.start).replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.middle=ee(ne.strong.middle).replace(/punctuation/g,ne._punctuation).replace(/blockSkip/g,ne._blockSkip).getRegex(),ne.strong.endAst=ee(ne.strong.endAst,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.endUnd=ee(ne.strong.endUnd,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.blockSkip=ee(ne._blockSkip,"g").getRegex(),ne.overlapSkip=ee(ne._overlapSkip,"g").getRegex(),ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ne._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])?)+(?![-_])/,ne.autolink=ee(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex(),ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ne.tag=ee(ne.tag).replace("comment",Z._comment).replace("attribute",ne._attribute).getRegex(),ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ne._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ne.link=ee(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex(),ne.reflink=ee(ne.reflink).replace("label",ne._label).getRegex(),ne.reflinkSearch=ee(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex(),ne.normal=re({},ne),ne.pedantic=re({},ne.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:ee(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()}),ne.gfm=re({},ne.normal,{escape:ee(ne.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ne.gfm.url=ee(ne.gfm.url,"i").replace("email",ne.gfm._extended_email).getRegex(),ne.breaks=re({},ne.gfm,{br:ee(ne.br).replace("{2,}","*").getRegex(),text:ee(ne.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var me={block:Z,inline:ne},de=I.defaults,Se=me.block,ye=me.inline;function Ie(fe){return fe.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 Ee(fe){var le="",ue,Y,Q=fe.length;for(ue=0;ue<Q;ue++)Y=fe.charCodeAt(ue),Math.random()>.5&&(Y="x"+Y.toString(16)),le+="&#"+Y+";";return le}var De=function(){function fe(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||de,this.options.tokenizer=this.options.tokenizer||new ge,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Se.normal,inline:ye.normal};this.options.pedantic?(Y.block=Se.pedantic,Y.inline=ye.pedantic):this.options.gfm&&(Y.block=Se.gfm,this.options.breaks?Y.inline=ye.breaks:Y.inline=ye.gfm),this.tokenizer.rules=Y}fe.lex=function(Y,Q){var q=new fe(Q);return q.lex(Y)};var le=fe.prototype;return le.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},le.blockTokens=function(Y,Q,q){Q===void 0&&(Q=[]),q===void 0&&(q=!0),Y=Y.replace(/^ +$/gm,"");for(var oe,be,Le,_e;Y;){if(oe=this.tokenizer.space(Y)){Y=Y.substring(oe.raw.length),oe.type&&Q.push(oe);continue}if(oe=this.tokenizer.code(Y,Q)){Y=Y.substring(oe.raw.length),oe.type?Q.push(oe):(_e=Q[Q.length-1],_e.raw+=`
`+oe.raw,_e.text+=`
`+oe.text);continue}if(oe=this.tokenizer.fences(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(oe=this.tokenizer.heading(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(oe=this.tokenizer.nptable(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(oe=this.tokenizer.hr(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(oe=this.tokenizer.blockquote(Y)){Y=Y.substring(oe.raw.length),oe.tokens=this.blockTokens(oe.text,[],q),Q.push(oe);continue}if(oe=this.tokenizer.list(Y)){for(Y=Y.substring(oe.raw.length),Le=oe.items.length,be=0;be<Le;be++)oe.items[be].tokens=this.blockTokens(oe.items[be].text,[],!1);Q.push(oe);continue}if(oe=this.tokenizer.html(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(q&&(oe=this.tokenizer.def(Y))){Y=Y.substring(oe.raw.length),this.tokens.links[oe.tag]||(this.tokens.links[oe.tag]={href:oe.href,title:oe.title});continue}if(oe=this.tokenizer.table(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(oe=this.tokenizer.lheading(Y)){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(q&&(oe=this.tokenizer.paragraph(Y))){Y=Y.substring(oe.raw.length),Q.push(oe);continue}if(oe=this.tokenizer.text(Y,Q)){Y=Y.substring(oe.raw.length),oe.type?Q.push(oe):(_e=Q[Q.length-1],_e.raw+=`
`+oe.raw,_e.text+=`
`+oe.text);continue}if(Y){var ze="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return Q},le.inline=function(Y){var Q,q,oe,be,Le,_e,ze=Y.length;for(Q=0;Q<ze;Q++){_e=Y[Q];switch(_e.type){case"paragraph":case"text":case"heading":{_e.tokens=[],this.inlineTokens(_e.text,_e.tokens);break}case"table":{for(_e.tokens={header:[],cells:[]},be=_e.header.length,q=0;q<be;q++)_e.tokens.header[q]=[],this.inlineTokens(_e.header[q],_e.tokens.header[q]);for(be=_e.cells.length,q=0;q<be;q++)for(Le=_e.cells[q],_e.tokens.cells[q]=[],oe=0;oe<Le.length;oe++)_e.tokens.cells[q][oe]=[],this.inlineTokens(Le[oe],_e.tokens.cells[q][oe]);break}case"blockquote":{this.inline(_e.tokens);break}case"list":{for(be=_e.items.length,q=0;q<be;q++)this.inline(_e.items[q].tokens);break}}}return Y},le.inlineTokens=function(Y,Q,q,oe,be){Q===void 0&&(Q=[]),q===void 0&&(q=!1),oe===void 0&&(oe=!1),be===void 0&&(be="");var Le,_e=Y,ze;if(this.tokens.links){var it=Object.keys(this.tokens.links);if(it.length>0)for(;(ze=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)it.includes(ze[0].slice(ze[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,ze.index)+"["+"a".repeat(ze[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ze=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,ze.index)+"["+"a".repeat(ze[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Le=this.tokenizer.escape(Y)){Y=Y.substring(Le.raw.length),Q.push(Le);continue}if(Le=this.tokenizer.tag(Y,q,oe)){Y=Y.substring(Le.raw.length),q=Le.inLink,oe=Le.inRawBlock,Q.push(Le);continue}if(Le=this.tokenizer.link(Y)){Y=Y.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,oe)),Q.push(Le);continue}if(Le=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,oe)),Q.push(Le);continue}if(Le=this.tokenizer.strong(Y,_e,be)){Y=Y.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],q,oe),Q.push(Le);continue}if(Le=this.tokenizer.em(Y,_e,be)){Y=Y.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],q,oe),Q.push(Le);continue}if(Le=this.tokenizer.codespan(Y)){Y=Y.substring(Le.raw.length),Q.push(Le);continue}if(Le=this.tokenizer.br(Y)){Y=Y.substring(Le.raw.length),Q.push(Le);continue}if(Le=this.tokenizer.del(Y)){Y=Y.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],q,oe),Q.push(Le);continue}if(Le=this.tokenizer.autolink(Y,Ee)){Y=Y.substring(Le.raw.length),Q.push(Le);continue}if(!q&&(Le=this.tokenizer.url(Y,Ee))){Y=Y.substring(Le.raw.length),Q.push(Le);continue}if(Le=this.tokenizer.inlineText(Y,oe,Ie)){Y=Y.substring(Le.raw.length),be=Le.raw.slice(-1),Q.push(Le);continue}if(Y){var Ae="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Ae);break}else throw new Error(Ae)}}return Q},K(fe,null,[{key:"rules",get:function(){return{block:Se,inline:ye}}}]),fe}(),Re=I.defaults,ke=z.cleanUrl,Ne=z.escape,Pe=function(){function fe(ue){this.options=ue||Re}var le=fe.prototype;return le.code=function(Y,Q,q){var oe=(Q||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(Y,oe);be!=null&&be!==Y&&(q=!0,Y=be)}return oe?'<pre><code class="'+this.options.langPrefix+Ne(oe,!0)+'">'+(q?Y:Ne(Y,!0))+`</code></pre>
`:"<pre><code>"+(q?Y:Ne(Y,!0))+`</code></pre>
`},le.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},le.html=function(Y){return Y},le.heading=function(Y,Q,q,oe){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+oe.slug(q)+'">'+Y+"</h"+Q+`>
`:"<h"+Q+">"+Y+"</h"+Q+`>
`},le.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},le.list=function(Y,Q,q){var oe=Q?"ol":"ul",be=Q&&q!==1?' start="'+q+'"':"";return"<"+oe+be+`>
`+Y+"</"+oe+`>
`},le.listitem=function(Y){return"<li>"+Y+`</li>
`},le.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function(Y){return"<p>"+Y+`</p>
`},le.table=function(Y,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+Q+`</table>
`},le.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},le.tablecell=function(Y,Q){var q=Q.header?"th":"td",oe=Q.align?"<"+q+' align="'+Q.align+'">':"<"+q+">";return oe+Y+"</"+q+`>
`},le.strong=function(Y){return"<strong>"+Y+"</strong>"},le.em=function(Y){return"<em>"+Y+"</em>"},le.codespan=function(Y){return"<code>"+Y+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function(Y){return"<del>"+Y+"</del>"},le.link=function(Y,Q,q){if(Y=ke(this.options.sanitize,this.options.baseUrl,Y),Y===null)return q;var oe='<a href="'+Ne(Y)+'"';return Q&&(oe+=' title="'+Q+'"'),oe+=">"+q+"</a>",oe},le.image=function(Y,Q,q){if(Y=ke(this.options.sanitize,this.options.baseUrl,Y),Y===null)return q;var oe='<img src="'+Y+'" alt="'+q+'"';return Q&&(oe+=' title="'+Q+'"'),oe+=this.options.xhtml?"/>":">",oe},le.text=function(Y){return Y},fe}(),Ce=function(){function fe(){}var le=fe.prototype;return le.strong=function(Y){return Y},le.em=function(Y){return Y},le.codespan=function(Y){return Y},le.del=function(Y){return Y},le.html=function(Y){return Y},le.text=function(Y){return Y},le.link=function(Y,Q,q){return""+q},le.image=function(Y,Q,q){return""+q},le.br=function(){return""},fe}(),Je=function(){function fe(){this.seen={}}var le=fe.prototype;return le.slug=function(Y){var Q=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var q=Q;do this.seen[q]++,Q=q+"-"+this.seen[q];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},fe}(),Xe=I.defaults,We=z.unescape,He=function(){function fe(ue){this.options=ue||Xe,this.options.renderer=this.options.renderer||new Pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ce,this.slugger=new Je}fe.parse=function(Y,Q){var q=new fe(Q);return q.parse(Y)};var le=fe.prototype;return le.parse=function(Y,Q){Q===void 0&&(Q=!0);var q="",oe,be,Le,_e,ze,it,Ae,ct,at,tt,xt,Et,Rt,At,pt,or,Kt,Ft,Tr=Y.length;for(oe=0;oe<Tr;oe++){tt=Y[oe];switch(tt.type){case"space":continue;case"hr":{q+=this.renderer.hr();continue}case"heading":{q+=this.renderer.heading(this.parseInline(tt.tokens),tt.depth,We(this.parseInline(tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{q+=this.renderer.code(tt.text,tt.lang,tt.escaped);continue}case"table":{for(ct="",Ae="",_e=tt.header.length,be=0;be<_e;be++)Ae+=this.renderer.tablecell(this.parseInline(tt.tokens.header[be]),{header:!0,align:tt.align[be]});for(ct+=this.renderer.tablerow(Ae),at="",_e=tt.cells.length,be=0;be<_e;be++){for(it=tt.tokens.cells[be],Ae="",ze=it.length,Le=0;Le<ze;Le++)Ae+=this.renderer.tablecell(this.parseInline(it[Le]),{header:!1,align:tt.align[Le]});at+=this.renderer.tablerow(Ae)}q+=this.renderer.table(ct,at);continue}case"blockquote":{at=this.parse(tt.tokens),q+=this.renderer.blockquote(at);continue}case"list":{for(xt=tt.ordered,Et=tt.start,Rt=tt.loose,_e=tt.items.length,at="",be=0;be<_e;be++)pt=tt.items[be],or=pt.checked,Kt=pt.task,At="",pt.task&&(Ft=this.renderer.checkbox(or),Rt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Ft+" "+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=Ft+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Ft}):At+=Ft),At+=this.parse(pt.tokens,Rt),at+=this.renderer.listitem(At,Kt,or);q+=this.renderer.list(at,xt,Et);continue}case"html":{q+=this.renderer.html(tt.text);continue}case"paragraph":{q+=this.renderer.paragraph(this.parseInline(tt.tokens));continue}case"text":{for(at=tt.tokens?this.parseInline(tt.tokens):tt.text;oe+1<Tr&&Y[oe+1].type==="text";)tt=Y[++oe],at+=`
`+(tt.tokens?this.parseInline(tt.tokens):tt.text);q+=Q?this.renderer.paragraph(at):at;continue}default:{var vr='Token with "'+tt.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return q},le.parseInline=function(Y,Q){Q=Q||this.renderer;var q="",oe,be,Le=Y.length;for(oe=0;oe<Le;oe++){be=Y[oe];switch(be.type){case"escape":{q+=Q.text(be.text);break}case"html":{q+=Q.html(be.text);break}case"link":{q+=Q.link(be.href,be.title,this.parseInline(be.tokens,Q));break}case"image":{q+=Q.image(be.href,be.title,be.text);break}case"strong":{q+=Q.strong(this.parseInline(be.tokens,Q));break}case"em":{q+=Q.em(this.parseInline(be.tokens,Q));break}case"codespan":{q+=Q.codespan(be.text);break}case"br":{q+=Q.br();break}case"del":{q+=Q.del(this.parseInline(be.tokens,Q));break}case"text":{q+=Q.text(be.text);break}default:{var _e='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(_e);return}else throw new Error(_e)}}}return q},fe}(),et=z.merge,Be=z.checkSanitizeDeprecation,Ge=z.escape,xe=I.getDefaults,Ze=I.changeDefaults,Ve=I.defaults;function we(fe,le,ue){if(typeof fe=="undefined"||fe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof fe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(fe)+", string expected");if(typeof le=="function"&&(ue=le,le=null),le=et({},we.defaults,le||{}),Be(le),ue){var Y=le.highlight,Q;try{Q=De.lex(fe,le)}catch(Le){return ue(Le)}var q=function(_e){var ze;if(!_e)try{ze=He.parse(Q,le)}catch(it){_e=it}return le.highlight=Y,_e?ue(_e):ue(null,ze)};if(!Y||Y.length<3)return q();if(delete le.highlight,!Q.length)return q();var oe=0;we.walkTokens(Q,function(Le){Le.type==="code"&&(oe++,setTimeout(function(){Y(Le.text,Le.lang,function(_e,ze){if(_e)return q(_e);ze!=null&&ze!==Le.text&&(Le.text=ze,Le.escaped=!0),oe--,oe===0&&q()})},0))}),oe===0&&q();return}try{var be=De.lex(fe,le);return le.walkTokens&&we.walkTokens(be,le.walkTokens),He.parse(be,le)}catch(Le){if(Le.message+=`
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+Ge(Le.message+"",!0)+"</pre>";throw Le}}we.options=we.setOptions=function(fe){return et(we.defaults,fe),Ze(we.defaults),we},we.getDefaults=xe,we.defaults=Ve,we.use=function(fe){var le=et({},fe);if(fe.renderer&&function(){var Y=we.defaults.renderer||new Pe,Q=function(be){var Le=Y[be];Y[be]=function(){for(var _e=arguments.length,ze=new Array(_e),it=0;it<_e;it++)ze[it]=arguments[it];var Ae=fe.renderer[be].apply(Y,ze);return Ae===!1&&(Ae=Le.apply(Y,ze)),Ae}};for(var q in fe.renderer)Q(q);le.renderer=Y}(),fe.tokenizer&&function(){var Y=we.defaults.tokenizer||new ge,Q=function(be){var Le=Y[be];Y[be]=function(){for(var _e=arguments.length,ze=new Array(_e),it=0;it<_e;it++)ze[it]=arguments[it];var Ae=fe.tokenizer[be].apply(Y,ze);return Ae===!1&&(Ae=Le.apply(Y,ze)),Ae}};for(var q in fe.tokenizer)Q(q);le.tokenizer=Y}(),fe.walkTokens){var ue=we.defaults.walkTokens;le.walkTokens=function(Y){fe.walkTokens(Y),ue&&ue(Y)}}we.setOptions(le)},we.walkTokens=function(fe,le){for(var ue=M(fe),Y;!(Y=ue()).done;){var Q=Y.value;le(Q);switch(Q.type){case"table":{for(var q=M(Q.tokens.header),oe;!(oe=q()).done;){var be=oe.value;we.walkTokens(be,le)}for(var Le=M(Q.tokens.cells),_e;!(_e=Le()).done;)for(var ze=_e.value,it=M(ze),Ae;!(Ae=it()).done;){var ct=Ae.value;we.walkTokens(ct,le)}break}case"list":{we.walkTokens(Q.items,le);break}default:Q.tokens&&we.walkTokens(Q.tokens,le)}}},we.Parser=He,we.parser=He.parse,we.Renderer=Pe,we.TextRenderer=Ce,we.Lexer=De,we.lexer=De.lex,we.Tokenizer=ge,we.Slugger=Je,we.parse=we;var Me=we;return Me})},ELLl:function(rt,Qe,J){(function($){$(J("VrN/"))})(function($){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=$.Pos;$.defineOption("autoCloseBrackets",!1,function(x,b,d){d&&d!=$.Init&&(x.removeKeyMap(M),x.state.closeBrackets=null),b&&(P(W(b,"pairs")),x.state.closeBrackets=b,x.addKeyMap(M))});function W(x,b){return b=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[b]!=null?x[b]:K[b]}var M={Backspace:O,Enter:D};function P(x){for(var b=0;b<x.length;b++){var d=x.charAt(b),a="'"+d+"'";M[a]||(M[a]=I(d))}}P(K.pairs+"`");function I(x){return function(b){return y(b,x)}}function k(x){var b=x.state.closeBrackets;if(!b||b.override)return b;var d=x.getModeAt(x.getCursor());return d.closeBrackets||b}function O(x){var b=k(x);if(!b||x.getOption("disableInput"))return $.Pass;for(var d=W(b,"pairs"),a=x.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return $.Pass;var s=R(x,a[l].head);if(!s||d.indexOf(s)%2!=0)return $.Pass}for(var l=a.length-1;l>=0;l--){var C=a[l].head;x.replaceRange("",A(C.line,C.ch-1),A(C.line,C.ch+1),"+delete")}}function D(x){var b=k(x),d=b&&W(b,"explode");if(!d||x.getOption("disableInput"))return $.Pass;for(var a=x.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return $.Pass;var s=R(x,a[l].head);if(!s||d.indexOf(s)%2!=0)return $.Pass}x.operation(function(){var C=x.lineSeparator()||`
`;x.replaceSelection(C+C,null),x.execCommand("goCharLeft"),a=x.listSelections();for(var g=0;g<a.length;g++){var h=a[g].head.line;x.indentLine(h,null,!0),x.indentLine(h+1,null,!0)}})}function p(x){var b=$.cmpPos(x.anchor,x.head)>0;return{anchor:new A(x.anchor.line,x.anchor.ch+(b?-1:1)),head:new A(x.head.line,x.head.ch+(b?1:-1))}}function y(x,b){var d=k(x);if(!d||x.getOption("disableInput"))return $.Pass;var a=W(d,"pairs"),l=a.indexOf(b);if(l==-1)return $.Pass;for(var s=W(d,"closeBefore"),C=W(d,"triples"),g=a.charAt(l+1)==b,h=x.listSelections(),L=l%2==0,T,m=0;m<h.length;m++){var f=h[m],u=f.head,o,E=x.getRange(u,A(u.line,u.ch+1));if(L&&!f.empty())o="surround";else if((g||!L)&&E==b)g&&S(x,u)?o="both":C.indexOf(b)>=0&&x.getRange(u,A(u.line,u.ch+3))==b+b+b?o="skipThree":o="skip";else if(g&&u.ch>1&&C.indexOf(b)>=0&&x.getRange(A(u.line,u.ch-2),u)==b+b){if(u.ch>2&&/\bstring/.test(x.getTokenTypeAt(A(u.line,u.ch-2))))return $.Pass;o="addFour"}else if(g){var v=u.ch==0?" ":x.getRange(A(u.line,u.ch-1),u);if(!$.isWordChar(E)&&v!=b&&!$.isWordChar(v))o="both";else return $.Pass}else if(L&&(E.length===0||/\s/.test(E)||s.indexOf(E)>-1))o="both";else return $.Pass;if(!T)T=o;else if(T!=o)return $.Pass}var c=l%2?a.charAt(l-1):b,_=l%2?b:a.charAt(l+1);x.operation(function(){if(T=="skip")x.execCommand("goCharRight");else if(T=="skipThree")for(var U=0;U<3;U++)x.execCommand("goCharRight");else if(T=="surround"){for(var B=x.getSelections(),U=0;U<B.length;U++)B[U]=c+B[U]+_;x.replaceSelections(B,"around"),B=x.listSelections().slice();for(var U=0;U<B.length;U++)B[U]=p(B[U]);x.setSelections(B)}else T=="both"?(x.replaceSelection(c+_,null),x.triggerElectric(c+_),x.execCommand("goCharLeft")):T=="addFour"&&(x.replaceSelection(c+c+c+c,"before"),x.execCommand("goCharRight"))})}function R(x,b){var d=x.getRange(A(b.line,b.ch-1),A(b.line,b.ch+1));return d.length==2?d:null}function S(x,b){var d=x.getTokenAt(A(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(x.getTokenTypeAt(b)))}})},H38U:function(rt,Qe,J){var $=J("f4xo"),K=J("rcnY"),A=J("wU8J"),W=J("Iq15"),M=J("dWSS");function P(k,O){this.typeNumber=k,this.errorCorrectLevel=O,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var I=P.prototype;I.addData=function(k){var O=new $(k);this.dataList.push(O),this.dataCache=null},I.isDark=function(k,O){if(k<0||this.moduleCount<=k||O<0||this.moduleCount<=O)throw new Error(k+","+O);return this.modules[k][O]},I.getModuleCount=function(){return this.moduleCount},I.make=function(){if(this.typeNumber<1){var k=1;for(k=1;k<40;k++){for(var O=K.getRSBlocks(k,this.errorCorrectLevel),D=new A,p=0,y=0;y<O.length;y++)p+=O[y].dataCount;for(var y=0;y<this.dataList.length;y++){var R=this.dataList[y];D.put(R.mode,4),D.put(R.getLength(),W.getLengthInBits(R.mode,k)),R.write(D)}if(D.getLengthInBits()<=p*8)break}this.typeNumber=k}this.makeImpl(!1,this.getBestMaskPattern())},I.makeImpl=function(k,O){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var D=0;D<this.moduleCount;D++){this.modules[D]=new Array(this.moduleCount);for(var p=0;p<this.moduleCount;p++)this.modules[D][p]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(k,O),this.typeNumber>=7&&this.setupTypeNumber(k),this.dataCache==null&&(this.dataCache=P.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,O)},I.setupPositionProbePattern=function(k,O){for(var D=-1;D<=7;D++){if(k+D<=-1||this.moduleCount<=k+D)continue;for(var p=-1;p<=7;p++){if(O+p<=-1||this.moduleCount<=O+p)continue;0<=D&&D<=6&&(p==0||p==6)||0<=p&&p<=6&&(D==0||D==6)||2<=D&&D<=4&&2<=p&&p<=4?this.modules[k+D][O+p]=!0:this.modules[k+D][O+p]=!1}}},I.getBestMaskPattern=function(){for(var k=0,O=0,D=0;D<8;D++){this.makeImpl(!0,D);var p=W.getLostPoint(this);(D==0||k>p)&&(k=p,O=D)}return O},I.createMovieClip=function(k,O,D){var p=k.createEmptyMovieClip(O,D),y=1;this.make();for(var R=0;R<this.modules.length;R++)for(var S=R*y,x=0;x<this.modules[R].length;x++){var b=x*y,d=this.modules[R][x];d&&(p.beginFill(0,100),p.moveTo(b,S),p.lineTo(b+y,S),p.lineTo(b+y,S+y),p.lineTo(b,S+y),p.endFill())}return p},I.setupTimingPattern=function(){for(var k=8;k<this.moduleCount-8;k++){if(this.modules[k][6]!=null)continue;this.modules[k][6]=k%2==0}for(var O=8;O<this.moduleCount-8;O++){if(this.modules[6][O]!=null)continue;this.modules[6][O]=O%2==0}},I.setupPositionAdjustPattern=function(){for(var k=W.getPatternPosition(this.typeNumber),O=0;O<k.length;O++)for(var D=0;D<k.length;D++){var p=k[O],y=k[D];if(this.modules[p][y]!=null)continue;for(var R=-2;R<=2;R++)for(var S=-2;S<=2;S++)R==-2||R==2||S==-2||S==2||R==0&&S==0?this.modules[p+R][y+S]=!0:this.modules[p+R][y+S]=!1}},I.setupTypeNumber=function(k){for(var O=W.getBCHTypeNumber(this.typeNumber),D=0;D<18;D++){var p=!k&&(O>>D&1)==1;this.modules[Math.floor(D/3)][D%3+this.moduleCount-8-3]=p}for(var D=0;D<18;D++){var p=!k&&(O>>D&1)==1;this.modules[D%3+this.moduleCount-8-3][Math.floor(D/3)]=p}},I.setupTypeInfo=function(k,O){for(var D=this.errorCorrectLevel<<3|O,p=W.getBCHTypeInfo(D),y=0;y<15;y++){var R=!k&&(p>>y&1)==1;y<6?this.modules[y][8]=R:y<8?this.modules[y+1][8]=R:this.modules[this.moduleCount-15+y][8]=R}for(var y=0;y<15;y++){var R=!k&&(p>>y&1)==1;y<8?this.modules[8][this.moduleCount-y-1]=R:y<9?this.modules[8][15-y-1+1]=R:this.modules[8][15-y-1]=R}this.modules[this.moduleCount-8][8]=!k},I.mapData=function(k,O){for(var D=-1,p=this.moduleCount-1,y=7,R=0,S=this.moduleCount-1;S>0;S-=2)for(S==6&&S--;;){for(var x=0;x<2;x++)if(this.modules[p][S-x]==null){var b=!1;R<k.length&&(b=(k[R]>>>y&1)==1);var d=W.getMask(O,p,S-x);d&&(b=!b),this.modules[p][S-x]=b,y--,y==-1&&(R++,y=7)}if(p+=D,p<0||this.moduleCount<=p){p-=D,D=-D;break}}},P.PAD0=236,P.PAD1=17,P.createData=function(k,O,D){for(var p=K.getRSBlocks(k,O),y=new A,R=0;R<D.length;R++){var S=D[R];y.put(S.mode,4),y.put(S.getLength(),W.getLengthInBits(S.mode,k)),S.write(y)}for(var x=0,R=0;R<p.length;R++)x+=p[R].dataCount;if(y.getLengthInBits()>x*8)throw new Error("code length overflow. ("+y.getLengthInBits()+">"+x*8+")");for(y.getLengthInBits()+4<=x*8&&y.put(0,4);y.getLengthInBits()%8!=0;)y.putBit(!1);for(;!(y.getLengthInBits()>=x*8);){if(y.put(P.PAD0,8),y.getLengthInBits()>=x*8)break;y.put(P.PAD1,8)}return P.createBytes(y,p)},P.createBytes=function(k,O){for(var D=0,p=0,y=0,R=new Array(O.length),S=new Array(O.length),x=0;x<O.length;x++){var b=O[x].dataCount,d=O[x].totalCount-b;p=Math.max(p,b),y=Math.max(y,d),R[x]=new Array(b);for(var a=0;a<R[x].length;a++)R[x][a]=255&k.buffer[a+D];D+=b;var l=W.getErrorCorrectPolynomial(d),s=new M(R[x],l.getLength()-1),C=s.mod(l);S[x]=new Array(l.getLength()-1);for(var a=0;a<S[x].length;a++){var g=a+C.getLength()-S[x].length;S[x][a]=g>=0?C.get(g):0}}for(var h=0,a=0;a<O.length;a++)h+=O[a].totalCount;for(var L=new Array(h),T=0,a=0;a<p;a++)for(var x=0;x<O.length;x++)a<R[x].length&&(L[T++]=R[x][a]);for(var a=0;a<y;a++)for(var x=0;x<O.length;x++)a<S[x].length&&(L[T++]=S[x][a]);return L},rt.exports=P},HmJG:function(rt,Qe,J){},Iq15:function(rt,Qe,J){var $=J("nVVt"),K=J("dWSS"),A=J("dQei"),W={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},M={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(P){for(var I=P<<10;M.getBCHDigit(I)-M.getBCHDigit(M.G15)>=0;)I^=M.G15<<M.getBCHDigit(I)-M.getBCHDigit(M.G15);return(P<<10|I)^M.G15_MASK},getBCHTypeNumber:function(P){for(var I=P<<12;M.getBCHDigit(I)-M.getBCHDigit(M.G18)>=0;)I^=M.G18<<M.getBCHDigit(I)-M.getBCHDigit(M.G18);return P<<12|I},getBCHDigit:function(P){for(var I=0;P!=0;)I++,P>>>=1;return I},getPatternPosition:function(P){return M.PATTERN_POSITION_TABLE[P-1]},getMask:function(P,I,k){switch(P){case W.PATTERN000:return(I+k)%2==0;case W.PATTERN001:return I%2==0;case W.PATTERN010:return k%3==0;case W.PATTERN011:return(I+k)%3==0;case W.PATTERN100:return(Math.floor(I/2)+Math.floor(k/3))%2==0;case W.PATTERN101:return I*k%2+I*k%3==0;case W.PATTERN110:return(I*k%2+I*k%3)%2==0;case W.PATTERN111:return(I*k%3+(I+k)%2)%2==0;default:throw new Error("bad maskPattern:"+P)}},getErrorCorrectPolynomial:function(P){for(var I=new K([1],0),k=0;k<P;k++)I=I.multiply(new K([1,A.gexp(k)],0));return I},getLengthInBits:function(P,I){if(1<=I&&I<10)switch(P){case $.MODE_NUMBER:return 10;case $.MODE_ALPHA_NUM:return 9;case $.MODE_8BIT_BYTE:return 8;case $.MODE_KANJI:return 8;default:throw new Error("mode:"+P)}else if(I<27)switch(P){case $.MODE_NUMBER:return 12;case $.MODE_ALPHA_NUM:return 11;case $.MODE_8BIT_BYTE:return 16;case $.MODE_KANJI:return 10;default:throw new Error("mode:"+P)}else if(I<41)switch(P){case $.MODE_NUMBER:return 14;case $.MODE_ALPHA_NUM:return 13;case $.MODE_8BIT_BYTE:return 16;case $.MODE_KANJI:return 12;default:throw new Error("mode:"+P)}else throw new Error("type:"+I)},getLostPoint:function(P){for(var I=P.getModuleCount(),k=0,O=0;O<I;O++)for(var D=0;D<I;D++){for(var p=0,y=P.isDark(O,D),R=-1;R<=1;R++){if(O+R<0||I<=O+R)continue;for(var S=-1;S<=1;S++){if(D+S<0||I<=D+S)continue;if(R==0&&S==0)continue;y==P.isDark(O+R,D+S)&&p++}}p>5&&(k+=3+p-5)}for(var O=0;O<I-1;O++)for(var D=0;D<I-1;D++){var x=0;P.isDark(O,D)&&x++,P.isDark(O+1,D)&&x++,P.isDark(O,D+1)&&x++,P.isDark(O+1,D+1)&&x++,(x==0||x==4)&&(k+=3)}for(var O=0;O<I;O++)for(var D=0;D<I-6;D++)P.isDark(O,D)&&!P.isDark(O,D+1)&&P.isDark(O,D+2)&&P.isDark(O,D+3)&&P.isDark(O,D+4)&&!P.isDark(O,D+5)&&P.isDark(O,D+6)&&(k+=40);for(var D=0;D<I;D++)for(var O=0;O<I-6;O++)P.isDark(O,D)&&!P.isDark(O+1,D)&&P.isDark(O+2,D)&&P.isDark(O+3,D)&&P.isDark(O+4,D)&&!P.isDark(O+5,D)&&P.isDark(O+6,D)&&(k+=40);for(var b=0,D=0;D<I;D++)for(var O=0;O<I;O++)P.isDark(O,D)&&b++;var d=Math.abs(100*b/I/I-50)/5;return k+=d*10,k}};rt.exports=M},LdHM:function(rt,Qe,J){"use strict";J.d(Qe,"b",function(){return s}),J.d(Qe,"a",function(){return g});var $=J("1OyB"),K=J("vuIU"),A=J("Ji7U"),W=J("LK+K"),M=J("cDcd"),P=J("rePB"),I=J("Ff2n"),k=J("ODXe"),O=J("4IlW"),D=J("bX4T"),p=J("YrtM"),y=J("TSYQ"),R=J.n(y),S=J("+nKL"),x=J("8OUc"),b=function(X,te){var ae=X.prefixCls,ce=X.id,Te=X.flattenOptions,ge=X.childrenAsData,he=X.values,ee=X.searchValue,re=X.multiple,Z=X.defaultActiveFirstOption,ne=X.height,me=X.itemHeight,de=X.notFoundContent,Se=X.open,ye=X.menuItemSelectedIcon,Ie=X.virtual,Ee=X.onSelect,De=X.onToggleOpen,Re=X.onActiveValue,ke=X.onScroll,Ne=X.onMouseEnter,Pe="".concat(ae,"-item"),Ce=Object(p.a)(function(){return Te},[Se,Te],function(Me,fe){return fe[0]&&Me[1]!==fe[1]}),Je=M.useRef(null),Xe=function(fe){fe.preventDefault()},We=function(fe){Je.current&&Je.current.scrollTo({index:fe})},He=function(fe){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Ce.length,Y=0;Y<ue;Y+=1){var Q=(fe+Y*le+ue)%ue,q=Ce[Q],oe=q.group,be=q.data;if(!oe&&!be.disabled)return Q}return-1},et=M.useState(function(){return He(0)}),Be=Object(k.a)(et,2),Ge=Be[0],xe=Be[1],Ze=function(fe){xe(fe);var le=Ce[fe];if(!le){Re(null,-1);return}Re(le.data.value,fe)};M.useEffect(function(){Ze(Z!==!1?He(0):-1)},[Ce.length,ee]),M.useEffect(function(){var Me=setTimeout(function(){if(!re&&Se&&he.size===1){var fe=Array.from(he)[0],le=Ce.findIndex(function(ue){var Y=ue.data;return Y.value===fe});Ze(le),We(le)}});return function(){return clearTimeout(Me)}},[Se]);var Ve=function(fe){fe!==void 0&&Ee(fe,{selected:!he.has(fe)}),re||De(!1)};if(M.useImperativeHandle(te,function(){return{onKeyDown:function(fe){var le=fe.which;switch(le){case O.a.UP:case O.a.DOWN:{var ue=0;if(le===O.a.UP?ue=-1:le===O.a.DOWN&&(ue=1),ue!==0){var Y=He(Ge+ue,ue);We(Y),Ze(Y)}break}case O.a.ENTER:{var Q=Ce[Ge];Q&&!Q.data.disabled?Ve(Q.data.value):Ve(void 0),Se&&fe.preventDefault();break}case O.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(fe){We(fe)}}}),Ce.length===0)return M.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),className:"".concat(Pe,"-empty"),onMouseDown:Xe},de);function we(Me){var fe=Ce[Me];if(!fe)return null;var le=fe.data||{},ue=le.value,Y=le.label,Q=le.children,q=Object(D.a)(le,!0),oe=ge?Q:Y;return fe?M.createElement("div",Object.assign({"aria-label":typeof oe=="string"?oe:null},q,{key:Me,role:"option",id:"".concat(ce,"_list_").concat(Me),"aria-selected":he.has(ue)}),ue):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),style:{height:0,width:0,overflow:"hidden"}},we(Ge-1),we(Ge),we(Ge+1)),M.createElement(S.a,{itemKey:"key",ref:Je,data:Ce,height:ne,itemHeight:me,fullHeight:!1,onMouseDown:Xe,onScroll:ke,virtual:Ie,onMouseEnter:Ne},function(Me,fe){var le,ue=Me.group,Y=Me.groupOption,Q=Me.data,q=Q.label,oe=Q.key;if(ue)return M.createElement("div",{className:R()(Pe,"".concat(Pe,"-group"))},q!==void 0?q:oe);var be=Q.disabled,Le=Q.value,_e=Q.title,ze=Q.children,it=Q.style,Ae=Q.className,ct=Object(I.a)(Q,["disabled","value","title","children","style","className"]),at=he.has(Le),tt="".concat(Pe,"-option"),xt=R()(Pe,tt,Ae,(le={},Object(P.a)(le,"".concat(tt,"-grouped"),Y),Object(P.a)(le,"".concat(tt,"-active"),Ge===fe&&!be),Object(P.a)(le,"".concat(tt,"-disabled"),be),Object(P.a)(le,"".concat(tt,"-selected"),at),le)),Et=ge?ze:q,Rt=!ye||typeof ye=="function"||at;return M.createElement("div",Object.assign({},ct,{"aria-selected":at,className:xt,title:_e,onMouseMove:function(){if(Ge===fe||be)return;Ze(fe)},onClick:function(){be||Ve(Le)},style:it}),M.createElement("div",{className:"".concat(tt,"-content")},Et||Le),M.isValidElement(ye)||at,Rt&&M.createElement(x.a,{className:"".concat(Pe,"-option-state"),customizeIcon:ye,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},d=M.forwardRef(b);d.displayName="OptionList";var a=d,l=function(){return null};l.isSelectOption=!0;var s=l,C=function(){return null};C.isSelectOptGroup=!0;var g=C,h=J("VTBJ"),L=J("Zm9Q");function T(F){var X=F.key,te=F.props,ae=te.children,ce=te.value,Te=Object(I.a)(te,["children","value"]);return Object(h.a)({key:X,value:ce!==void 0?ce:X,children:ae},Te)}function m(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(F).map(function(te,ae){if(!M.isValidElement(te)||!te.type)return null;var ce=te.type.isSelectOptGroup,Te=te.key,ge=te.props,he=ge.children,ee=Object(I.a)(ge,["children"]);return X||!ce?T(te):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ae:Te,"__"),label:Te},ee),{},{options:m(he)})}).filter(function(te){return te})}var f=J("2Qr1"),u=J("qNPg"),o=J("U8pU"),E=J("Kwbf"),v=J("WKfj");function c(F){var X=F.mode,te=F.options,ae=F.children,ce=F.backfill,Te=F.allowClear,ge=F.placeholder,he=F.getInputElement,ee=F.showSearch,re=F.onSearch,Z=F.defaultOpen,ne=F.autoFocus,me=F.labelInValue,de=F.value,Se=F.inputValue,ye=F.optionLabelProp,Ie=X==="multiple"||X==="tags",Ee=ee!==void 0?ee:Ie||X==="combobox",De=te||m(ae);if(Object(E.a)(X!=="tags"||De.every(function(Pe){return!Pe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Re=De.some(function(Pe){return Pe.options?Pe.options.some(function(Ce){return typeof("value"in Ce?Ce.value:Ce.key)=="number"}):typeof("value"in Pe?Pe.value:Pe.key)=="number"});Object(E.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(X!=="combobox"||!ye,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(X==="combobox"||!ce,"`backfill` only works with `combobox` mode."),Object(E.a)(X==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(E.b)(X!=="combobox"||!he||!Te||!ge,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),re&&!Ee&&X!=="combobox"&&X!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!Z||ne,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var ke=Object(v.d)(de);Object(E.a)(!me||ke.every(function(Pe){return Object(o.a)(Pe)==="object"&&("key"in Pe||"value"in Pe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!Ie||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var Ne=null;Object(L.a)(ae).some(function(Pe){if(!M.isValidElement(Pe)||!Pe.type)return!1;var Ce=Pe.type;if(Ce.isSelectOption)return!1;if(Ce.isSelectOptGroup){var Je=Object(L.a)(Pe.props.children).every(function(Xe){return!M.isValidElement(Xe)||!Pe.type||Xe.type.isSelectOption?!0:(Ne=Xe.type,!1)});return!Je}return Ne=Ce,!0}),Ne&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ne.displayName||Ne.name||Ne,"`.")),Object(E.a)(Se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var _=c,U=Object(u.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:m,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:_,fillOptionsWithMissingValue:f.a}),B=function(F){Object(A.a)(te,F);var X=Object(W.a)(te);function te(){var ae;return Object($.a)(this,te),ae=X.apply(this,arguments),ae.selectRef=M.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(K.a)(te,[{key:"render",value:function(){return M.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),te}(M.Component);B.Option=s,B.OptGroup=g;var z=B,j=Qe.c=z},M8RZ:function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return O});var $=J("fWQN"),K=J("mtLc"),A=J("yKVA"),W=J("879j"),M=J("cDcd"),P=J.n(M),I=J("faye"),k=J.n(I),O=function(D){Object(A.a)(y,D);var p=Object(W.a)(y);function y(R){var S;Object($.a)(this,y),S=p.call(this,R);var x=window.document;return S.node=x.createElement("div"),x.body.appendChild(S.node),S}return Object(K.a)(y,[{key:"render",value:function(){var S=this.props.children;return Object(I.createPortal)(S,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),y}(P.a.Component)},Ot1p:function(rt,Qe,J){"use strict";var $=J("2qtc"),K=J("kLXV"),A=J("rAM+"),W=J("miYZ"),M=J("tsqr"),P=J("9og8"),I=J("tJVT"),k=J("jrin"),O=J("WmNS"),D=J.n(O),p=J("cDcd"),y=J.n(p),R=J("VrN/"),S=J.n(R),x=J("bdgK"),b=J("p77/"),d=J("Bd2K"),a=J("ELLl"),l=J("19Vz"),s=J("lZu9"),C=J("+NIl"),g=J("kSUc"),h=J("9Bee"),L=function(Ae){var ct=Ae.value,at=ct===void 0?"":ct,tt=Ae.className,xt=Ae.showTextOnly,Et=Ae.showLines,Rt=Ae.style,At=Rt===void 0?{}:Rt,pt=Object(p.useMemo)(function(){return""},[at]);return y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},T=J("Q9mQ"),m=J("diRs"),f=J("0Owb"),u=J("dejd"),o=J("C+DQ"),E=J("D1Df"),v=J.n(E),c=J("1vsH"),_=J("m3rI"),U=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function B(Ae){var ct=Ae.onActionCallback,at=Ae.title,tt=Ae.icon,xt=Ae.actionName,Et=Ae.className,Rt=Et===void 0?"":Et,At=Ae.children;function pt(){ct(xt)}return y.a.createElement("a",{title:at,className:Rt,onClick:pt},y.a.createElement("i",{className:"md-iconfont ".concat(tt)}),At)}var z=function(Ae){var ct=Ae.watch,at=Ae.showNullButton,tt=Ae.onActionCallback,xt=Ae.fullScreen,Et=Ae.insertTemp,Rt=Ae.hidetoolBar,At=Ae.uuid,pt=Ae.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(c.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.G)("_educoder_session"),"&key=").concat(At,"&api=").concat(encodeURIComponent(_.a.PROXY_SERVER)));var or=[].concat(U,[{title:"".concat(ct?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ct?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return y.a.createElement("ul",{className:"markdown-toolbar-container"},!Rt&&or.map(function(Kt,Ft){return y.a.createElement("li",{key:Ft},Kt.actionName?y.a.createElement(B,Object(f.a)({},Kt,{onActionCallback:tt})):y.a.createElement("span",{className:"v-line"}))}),at?y.a.createElement("li",null,y.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:tt},y.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&y.a.createElement("li",null,y.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:tt},y.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),y.a.createElement("li",null,y.a.createElement(m.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:y.a.createElement("div",null,y.a.createElement(v.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(c.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.G)("_educoder_session"),"&key=").concat(At,"&api=").concat(encodeURIComponent(_.a.PROXY_SERVER))}))},y.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),y.a.createElement("li",{className:"btn-full-screen"},y.a.createElement(B,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:tt})))},j=J("M8RZ"),F=J("+L6B"),X=J("2/Rp"),te=J("y8nQ"),ae=J("Vl3Y"),ce=J("5NDa"),Te=J("5rEg"),ge={labelCol:{span:4},wrapperCol:{span:20}},he=function(Ae){var ct=Ae.callback,at=Ae.onCancel;function tt(xt){ct(xt)}return y.a.createElement(ae.a,Object(f.a)({},ge,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:tt}),y.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},y.a.createElement(Te.a,null)),y.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},y.a.createElement(Te.a,null)),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(X.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},ee=J("7ahc"),re=J("k1fw"),Z=J("HmJG"),ne=J("BjJ7"),me=ae.a.useForm,de={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},ye=function(Ae){var ct=Ae.callback,at=Ae.onCancel,tt=me(),xt=Object(I.a)(tt,1),Et=xt[0],Rt=useRef();function At(Kt){ct(Object(re.a)(Object(re.a)({},Kt),{},{name:Rt.current}))}function pt(Kt,Ft){if(Kt.status===-1){M.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Ft.type})}function or(Kt){var Ft=Kt.target.files[0];Rt.current=Ft.name,Ee(Ft,pt)}return y.a.createElement(ae.a,Object(f.a)({form:Et},Se,{className:"upload-image-panel",onFinish:At}),y.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},y.a.createElement("div",{className:"flex-container"},y.a.createElement(ae.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},y.a.createElement(Te.a,{style:de})),y.a.createElement(Ie,{onFileChange:or}))),y.a.createElement(ae.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},y.a.createElement(Te.a,{style:{width:264}})),y.a.createElement(ae.a.Item,{style:{textAlign:"right"}},y.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(X.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function Ie(Ae){var ct=Ae.onFileChange;return y.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",y.a.createElement("input",{type:"file",onChange:ct}))}function Ee(Ae,ct){if(!Ae)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Ae),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var tt=new window.XMLHttpRequest;tt.withCredentials=!0,tt.addEventListener("load",function(xt){ct(JSON.parse(xt.target.responseText),Ae)},!1),tt.addEventListener("error",function(xt){console.error(xt)},!1),tt.open("POST","".concat(ne.a,"/api/attachments.json")),tt.send(at)}var De=J("giR+"),Re=J("fyUT"),ke=J("7Kak"),Ne=J("9yH6"),Pe=Ne.a.Group,Ce={margin:"0 8px"},Je=function(Ae){var ct=Ae.callback,at=Ae.onCancel;function tt(xt){ct(xt)}return y.a.createElement(ae.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:tt},y.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},y.a.createElement("span",{style:Ce},"\u5355\u5143\u683C\u6570\uFF1A"),y.a.createElement("span",{style:Ce},"\u884C\u6570"),y.a.createElement(ae.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},y.a.createElement(Re.a,null)),y.a.createElement("span",{style:Ce},"\u5217\u6570"),y.a.createElement(ae.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},y.a.createElement(Re.a,null))),y.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},y.a.createElement("span",{style:Ce},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),y.a.createElement(ae.a.Item,{name:"align"},y.a.createElement(Pe,null,y.a.createElement(Ne.a,{value:"default"},y.a.createElement("i",{className:"fa fa-align-justify"})),y.a.createElement(Ne.a,{value:"left"},y.a.createElement("i",{className:"fa fa-align-left"})),y.a.createElement(Ne.a,{value:"center"},y.a.createElement("i",{className:"fa fa-align-center"})),y.a.createElement(Ne.a,{value:"right"},y.a.createElement("i",{className:"fa fa-align-right"}))))),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(X.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},Xe=J("ErOA"),We=J("7Cbv"),He="link",et="upload-image",Be="code-block",Ge="add-table",xe="------------",Ze={default:xe,left:":".concat(xe),center:":".concat(xe,":"),right:"".concat(xe,":")},Ve=J("9VGf"),we,Me;function fe(){}var le=0,ue=1e4,Y="\u2581",Q=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function q(Ae){return/^\d+$/.test(Ae)?"".concat(Ae,"px"):Ae}var oe=navigator.platform.toUpperCase().indexOf("MAC")>=0,be=oe?"Cmd":"Ctrl",Le=["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"],_e=(we={},Object(k.a)(we,be+"-B","bold"),Object(k.a)(we,be+"-I","italic"),we),ze=(Me={},Object(k.a)(Me,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(k.a)(Me,Be,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(k.a)(Me,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(k.a)(Me,Ge,"\u6DFB\u52A0\u8868\u683C"),Me),it=Qe.a=function(Ae){var ct=Ae.defaultValue,at=ct===void 0?"":ct,tt=Ae.onChange,xt=Ae.width,Et=xt===void 0?"100%":xt,Rt=Ae.height,At=Rt===void 0?400:Rt,pt=Ae.miniToolbar,or=pt===void 0?!1:pt,Kt=Ae.isFocus,Ft=Kt===void 0?!1:Kt,Tr=Ae.watch,vr=Ae.insertTemp,wi=Ae.mode,mr=wi===void 0?"markdown":wi,vn=Ae.id,Jr=vn===void 0?"markdown-editor-id":vn,Mt=Ae.showResizeBar,st=Mt===void 0?!1:Mt,Sr=Ae.noStorage,Vn=Sr===void 0?!1:Sr,cr=Ae.showNullButton,St=cr===void 0?!1:cr,wr=Ae.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Ae.fullScreen,Fe=yn===void 0?!1:yn,ft=Ae.onBlur,qr=Ae.onCMBeforeChange,en=Ae.onFullScreen,tn=Ae.className,bn=tn===void 0?"":tn,Xn=Ae.disablePaste,mt=Xn===void 0?!1:Xn,Ci=Ae.placeholder,Li=Ci===void 0?"":Ci,rn=Ae.values,sr=rn===void 0?"":rn,Ai=Object(p.useState)(null),Yn=Object(I.a)(Ai,2),je=Yn[0],$n=Yn[1],Di=Object(p.useState)(at),En=Object(I.a)(Di,2),nn=En[0],Nr=En[1],_i=Object(p.useState)(Tr),Qn=Object(I.a)(_i,2),_r=Qn[0],Oi=Qn[1],Ri=Object(p.useState)(Fe),pr=Object(I.a)(Ri,2),Cr=pr[0],Pi=pr[1],xn=Object(p.useState)(""),Ur=Object(I.a)(xn,2),Fr=Ur[0],Br=Ur[1],aa=Object(p.useState)(0),Mi=Object(I.a)(aa,2),Or=Mi[0],Tn=Mi[1],oa=Object(p.useState)(At),Jn=Object(I.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(p.useState)(!1),wn=Object(I.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(p.useRef)(Object(We.a)()),ki=Object(p.useRef)(!1),qn=Object(p.useRef)(),$t=Object(p.useRef)(),jr=Object(p.useRef)(),Ln=Object(p.useRef)(),Wr=Object(p.useRef)(),Ii=function(){var ot=Object(P.a)(D.a.mark(function ht(){var ut,vt;return D.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:return _t.next=2,Object(Xe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=_t.sent,vt!=null&&(ut=vt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",je,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?je.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?je.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?je.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):je.replaceSelection("[".concat(yt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return _t.stop()}},ht)}));return function(){return ot.apply(this,arguments)}}();Object(p.useEffect)(function(){Nr(sr),je==null||je.setValue(sr)},[sr]),Object(p.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(p.useEffect)(function(){if($t.current){var ot=S.a.fromTextArea($t.current,{mode:mr,lineNumbers:!or,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Ft&&ot.focus();function ht(ut,vt){if(mt){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var _t=Tt.types.toString(),yt=Tt.items;if(_t==="Files"||Tt.types.indexOf("Files")>-1){if(vt.preventDefault(),mr=="stex")return;try{var It,Wt=yt[1];((It=yt[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=yt[0]);var bt=Wt.getAsFile(),Pr=bt.name.split(".").pop();Ee(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Le.includes(Pr)?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ot.on("paste",ht),ot.on("dragleave",function(ut,vt){jr.current.classList.remove("mouse-hover-md")}),ot.on("dragover",function(ut,vt){jr.current.classList.add("mouse-hover-md")}),ot.on("drop",function(ut,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var _t=function(Wt){var bt=Tt[Wt],Pr=bt.name.split(".").pop();Ee(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Le.includes(Pr)?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},yt=0;yt<Tt.length;yt++)_t(yt)}}),$n(ot),function(){ot.off("paste",ht)}}},[]);var yr=Object(p.useCallback)(function(){if(jr.current)try{}catch(ot){console.log(ot,"---- to set md editor body height")}},[Zn,jr,Cr]);Object(p.useEffect)(function(){function ot(){var ut=new x.default(function(vt){var Tt=Object(A.a)(vt),_t;try{for(Tt.s();!(_t=Tt.n()).done;){var yt=_t.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(yr(),je.setSize("100%","100%"),je.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return ut.observe($t.current.parentElement),ut}if(je){var ht=ot();return function(){ht.unobserve($t.current.parentElement)}}},[je,yr]),Object(p.useEffect)(function(){if(je){for(var ot=[],ht=function(){var yt=vt[ut];Tt=Object(I.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(k.a)({},It,function(){An(Wt)});ot.push(bt),je.addKeyMap(bt)},ut=0,vt=Object.entries(_e);ut<vt.length;ut++){var Tt;ht()}return qn.current=setInterval(function(){ki.current&&Ii()},4e3),function(){clearInterval(qn.current);var _t=Object(A.a)(ot),yt;try{for(_t.s();!(yt=_t.n()).done;){var It=yt.value;je.removeKeyMap(It)}}catch(Wt){_t.e(Wt)}finally{_t.f()}}}},[je]),Object(p.useEffect)(function(){Fe!==Cr&&Pi(Fe)},[Fe]),Object(Ve.a)(function(){if(!Vn&&Or>0){var ot=new Date().getTime(),ht=window.sessionStorage.getItem(Jr);ot>=Or+ue&&(!ht||ht!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},ue),Object(p.useEffect)(function(){Oi(Tr)},[je,Tr]),Object(p.useEffect)(function(){je&&(Ft&&je.focus())},[je,Ft]),Object(p.useEffect)(function(){if(_r&&je){var ot=je.getScrollerElement();function ht(ut){var vt=ut.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return ot.addEventListener("scroll",ht),function(){ot.removeEventListener("scroll",ht)}}},[je,_r]),Object(p.useEffect)(function(){if(je&&qr){function ot(ht,ut){qr(ht,ut)}return je.on("beforeChange",ot),function(){je.off("beforeChange",ot)}}},[je,qr]),Object(p.useEffect)(function(){if(je&&ft){function ot(){ft(je.getValue())}return je.on("blur",ot),function(){je.off("blur",ot)}}},[je,ft]),Object(p.useEffect)(function(){if(je){function ot(ht){var ut=ht.getValue();Nr(ut),Tn(new Date().getTime()),ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),tt&&tt(ut)}return je.on("change",ot),function(){je.off("change",ot)}}},[je,tt]),Object(p.useEffect)(function(){je&&(at==null?(je.setValue(""),Nr("")):at!==je.getValue()&&(je.setValue(at),Nr(at),je.setCursor(je.lineCount(),0)))},[je,at]);var An=Object(p.useCallback)(function(ot){var ht=je.getCursor(),ut=je.getSelection(),vt=ut.split(`
`);switch(ot){case"bold":return je.replaceSelection("**"+ut+"**"),ut===""&&je.setCursor(ht.line,ht.ch+2),je.focus();case"italic":return je.replaceSelection("*"+ut+"*"),ut===""&&je.setCursor(ht.line,ht.ch+1),je.focus();case"code":return je.replaceSelection("`"+ut+"`"),ut===""&&je.setCursor(ht.line,ht.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+ut+"$$`"),ut===""&&je.setCursor(ht.line,ht.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+ut+"\n```"),je.setCursor(ht.line+1,ut.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
`),je.focus();case"list-ul":return ut===""?je.replaceSelection("- "+ut):je.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
`)),je.focus();case"list-ol":return ut===""?je.replaceSelection("1. "+ut):je.replaceSelection(vt.map(function(Tt,_t){return Tt===""?"":"".concat(_t+1,". ").concat(Tt)}).join(`
`)),je.focus();case"add-null-ch":return ut===""&&je.setCursor(ht.line,ht.ch+1),je.replaceSelection(Y),je.focus();case"inster-template-1":return ut===""&&je.setCursor(ht.line,ht.ch),je.replaceSelection(Q),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return Oi(!_r),je.focus();case"trigger-full-screen":return Pi(!Cr),je.focus();case He:Br(He);return;case Be:Br(Be);return;case et:Br(et);return;case Ge:Br(Ge);return;default:throw new Error}},[je,_r,Cr]),lr=Object(p.useCallback)(function(ot){Br("");switch(Fr){case He:var ht=ot.title,ut=ot.link;return je.replaceSelection("[".concat(ht,"](").concat(ut,")")),je.focus();case Be:var vt=ot.language,Tt=ot.content;return je.replaceSelection(["```"+vt,Tt,"```"].join(`
`)),je.focus();case et:var _t=ot.src,yt=ot.alt;return yt?je.replaceSelection("![ ".concat(yt," ]( ").concat(_t,' "').concat(yt,'" )')):je.replaceSelection("![,](".concat(_t,")")),je.focus();case Ge:for(var It=ot.row,Wt=ot.col,bt=ot.align,Pr=`
`,Ct=0;Ct<It;Ct++){for(var Zt=[],Dt=[],gr=0;gr<Wt;gr++)Ct===1&&Dt.push(Ze[bt]),Zt.push(" ");Ct===1&&(Pr+="| ".concat(Dt.join(" | "),` |
`)),Pr+="| ".concat(Zt.join(Wt===1?"":" | "),` |
`)}return je.replaceSelection(Pr+`
`),je.focus();default:throw new Error}},[je,Fr]),Dn=Object(p.useMemo)(function(){switch(Fr){case He:return y.a.createElement(he,{callback:lr,onCancel:Rr});case Be:return y.a.createElement(ee.b,{callback:lr,onCancel:Rr});case et:return y.a.createElement(ye,{callback:lr,onCancel:Rr});case Ge:return y.a.createElement(Je,{callback:lr,onCancel:Rr});default:return null}},[Fr]);function Rr(){Br("")}Object(p.useEffect)(function(){if(Ln.current){var ot=Ln.current,ht=!1,ut=0;function vt(yt){ht=!0,ut=yt.pageY}function Tt(){ht=!1}function _t(yt){if(ht){var It=yt.pageY-ut;It<0&&(It=0),It>300&&(It=300);var Wt=At+It+"px";an(Wt)}}return ot.addEventListener("mousedown",vt),document.addEventListener("mousemove",_t),document.addEventListener("mouseup",Tt),function(){ot.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",Tt)}}},[je,Ln]),Object(p.useEffect)(function(){an(At)},[At]);var Hr=q(Et),la=q(Zn),ua={width:Hr,height:la},$a=Object(p.useMemo)(function(){if(Or){var ot=new Date(Or),ht=ot.getHours(),ut=ot.getMinutes(),vt=ot.getSeconds();return ht=ht<10?"0"+ht:ht,ut=ut<10?"0"+ut:ut,vt=vt<10?"0"+vt:vt,"".concat(ht,":").concat(ut,":").concat(vt)}return 0},[Or]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),je.setValue(window.sessionStorage.getItem(Jr))}function Ni(ot,ht){var ut=je.getValue();ut=ut.replace(ot,ht),Nr(ut),je==null||je.setValue(ut)}return y.a.createElement(p.Fragment,null,y.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},y.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(_r?"on-preview":""," ").concat(or?"mini":""," ").concat(Cr?"full-screen":""),style:ua},y.a.createElement(z,{insertTemp:vr,watch:_r,fullScreen:Cr,showNullButton:St,onActionCallback:An,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){ki.current=!0}}),y.a.createElement("div",{className:"markdown-editor-body"},y.a.createElement("div",{className:"codemirror-container"},y.a.createElement("textarea",{ref:$t,placeholder:Li})),_r?y.a.createElement("div",{ref:Wr,className:"preview-container"},mr==="stex"&&y.a.createElement(L,{value:nn}),mr!=="stex"&&y.a.createElement(h.a,{edit:!0,value:nn,replaces:Ni})):null))),st?y.a.createElement("a",{ref:Ln,className:"editor-resize"}):null,y.a.createElement(j.a,null,ze[Fr]?y.a.createElement(K.a,{centered:!0,title:ze[Fr],visible:!0,onCancel:Rr,footer:null,className:"markdown-popup-form"},Dn):null))}},RxwV:function(rt,Qe,J){"use strict";var $=J("cDcd"),K=J("uciX"),A=J("2W6z"),W=J.n(A),M=J("4IlW"),P=J("uK0f"),I=J.n(P);function k(ee,re){if(ee===re)return!0;if(!ee||!re)return!1;var Z=ee.length;if(re.length!==Z)return!1;for(var ne=0;ne<Z;ne++)if(ee[ne]!==re[ne])return!1;return!0}function O(ee){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(Z){return typeof Z}:O=function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},O(ee)}function D(ee,re){if(!(ee instanceof re))throw new TypeError("Cannot call a class as a function")}function p(ee,re){for(var Z=0;Z<re.length;Z++){var ne=re[Z];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(ee,ne.key,ne)}}function y(ee,re,Z){return re&&p(ee.prototype,re),Z&&p(ee,Z),ee}function R(ee,re){if(typeof re!="function"&&re!==null)throw new TypeError("Super expression must either be null or a function");ee.prototype=Object.create(re&&re.prototype,{constructor:{value:ee,writable:!0,configurable:!0}}),re&&S(ee,re)}function S(ee,re){return S=Object.setPrototypeOf||function(ne,me){return ne.__proto__=me,ne},S(ee,re)}function x(ee){var re=a();return function(){var Z=l(ee),ne;if(re){var me=l(this).constructor;ne=Reflect.construct(Z,arguments,me)}else ne=Z.apply(this,arguments);return b(this,ne)}}function b(ee,re){return re&&(O(re)==="object"||typeof re=="function")?re:d(ee)}function d(ee){if(ee===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ee}function a(){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(ee){return!1}}function l(ee){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(Z){return Z.__proto__||Object.getPrototypeOf(Z)},l(ee)}var s=function(){var ee=function(re){R(ne,re);var Z=x(ne);function ne(){var me;return D(this,ne),me=Z.apply(this,arguments),me.menuItems={},me.saveMenuItem=function(de){return function(Se){me.menuItems[de]=Se}},me}return y(ne,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(de){!de.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(de){var Se=this.props,ye=Se.fieldNames,Ie=Se.defaultFieldNames;return ye[de]||Ie[de]}},{key:"getOption",value:function(de,Se){var ye=this.props,Ie=ye.prefixCls,Ee=ye.expandTrigger,De=ye.expandIcon,Re=ye.loadingIcon,ke=this.props.onSelect.bind(this,de,Se),Ne=this.props.onItemDoubleClick.bind(this,de,Se),Pe={onClick:ke,onDoubleClick:Ne},Ce="".concat(Ie,"-menu-item"),Je=null,Xe=de[this.getFieldName("children")]&&de[this.getFieldName("children")].length>0;(Xe||de.isLeaf===!1)&&(Ce+=" ".concat(Ie,"-menu-item-expand"),de.loading||(Je=$.createElement("span",{className:"".concat(Ie,"-menu-item-expand-icon")},De))),Ee==="hover"&&(Xe||de.isLeaf===!1)&&(Pe={onMouseEnter:this.delayOnSelect.bind(this,ke),onMouseLeave:this.delayOnSelect.bind(this),onClick:ke}),this.isActiveOption(de,Se)&&(Ce+=" ".concat(Ie,"-menu-item-active"),Pe.ref=this.saveMenuItem(Se)),de.disabled&&(Ce+=" ".concat(Ie,"-menu-item-disabled"));var We=null;de.loading&&(Ce+=" ".concat(Ie,"-menu-item-loading"),We=Re||null);var He="";return"title"in de?He=de.title:typeof de[this.getFieldName("label")]=="string"&&(He=de[this.getFieldName("label")]),$.createElement("li",Object.assign({key:de[this.getFieldName("value")],className:Ce,title:He},Pe,{role:"menuitem",onMouseDown:function(Be){return Be.preventDefault()}}),de[this.getFieldName("label")],Je,We)}},{key:"getActiveOptions",value:function(de){var Se=this,ye=this.props.options,Ie=de||this.props.activeValue;return I()(ye,function(Ee,De){return Ee[Se.getFieldName("value")]===Ie[De]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var de=this,Se=this.props.options,ye=this.getActiveOptions().map(function(Ie){return Ie[de.getFieldName("children")]}).filter(function(Ie){return!!Ie});return ye.unshift(Se),ye}},{key:"delayOnSelect",value:function(de){for(var Se=this,ye=arguments.length,Ie=new Array(ye>1?ye-1:0),Ee=1;Ee<ye;Ee++)Ie[Ee-1]=arguments[Ee];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof de=="function"&&(this.delayTimer=window.setTimeout(function(){de(Ie),Se.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var de=this.getShowOptions().length,Se=0;Se<de;Se++){var ye=this.menuItems[Se];ye&&ye.parentElement&&(ye.parentElement.scrollTop=ye.offsetTop)}}},{key:"isActiveOption",value:function(de,Se){var ye=this.props.activeValue,Ie=ye===void 0?[]:ye;return Ie[Se]===de[this.getFieldName("value")]}},{key:"render",value:function(){var de=this,Se=this.props,ye=Se.prefixCls,Ie=Se.dropdownMenuColumnStyle;return $.createElement("div",null,this.getShowOptions().map(function(Ee,De){return $.createElement("ul",{className:"".concat(ye,"-menu"),key:De,style:Ie},Ee.map(function(Re){return de.getOption(Re,De)}))}))}}]),ne}($.Component);return ee.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},ee}(),C=s,g={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}}},h=g;function L(ee){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?L=function(Z){return typeof Z}:L=function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},L(ee)}function T(ee,re){if(ee==null)return{};var Z=m(ee,re),ne,me;if(Object.getOwnPropertySymbols){var de=Object.getOwnPropertySymbols(ee);for(me=0;me<de.length;me++){if(ne=de[me],re.indexOf(ne)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ee,ne))continue;Z[ne]=ee[ne]}}return Z}function m(ee,re){if(ee==null)return{};var Z={},ne=Object.keys(ee),me,de;for(de=0;de<ne.length;de++){if(me=ne[de],re.indexOf(me)>=0)continue;Z[me]=ee[me]}return Z}function f(ee){return v(ee)||E(ee)||o(ee)||u()}function u(){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 o(ee,re){if(!ee)return;if(typeof ee=="string")return c(ee,re);var Z=Object.prototype.toString.call(ee).slice(8,-1);if(Z==="Object"&&ee.constructor&&(Z=ee.constructor.name),Z==="Map"||Z==="Set")return Array.from(ee);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return c(ee,re)}function E(ee){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ee))return Array.from(ee)}function v(ee){if(Array.isArray(ee))return c(ee)}function c(ee,re){(re==null||re>ee.length)&&(re=ee.length);for(var Z=0,ne=new Array(re);Z<re;Z++)ne[Z]=ee[Z];return ne}function _(ee,re){if(!(ee instanceof re))throw new TypeError("Cannot call a class as a function")}function U(ee,re){for(var Z=0;Z<re.length;Z++){var ne=re[Z];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(ee,ne.key,ne)}}function B(ee,re,Z){return re&&U(ee.prototype,re),Z&&U(ee,Z),ee}function z(ee,re){if(typeof re!="function"&&re!==null)throw new TypeError("Super expression must either be null or a function");ee.prototype=Object.create(re&&re.prototype,{constructor:{value:ee,writable:!0,configurable:!0}}),re&&j(ee,re)}function j(ee,re){return j=Object.setPrototypeOf||function(ne,me){return ne.__proto__=me,ne},j(ee,re)}function F(ee){var re=ae();return function(){var Z=ce(ee),ne;if(re){var me=ce(this).constructor;ne=Reflect.construct(Z,arguments,me)}else ne=Z.apply(this,arguments);return X(this,ne)}}function X(ee,re){return re&&(L(re)==="object"||typeof re=="function")?re:te(ee)}function te(ee){if(ee===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ee}function ae(){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(ee){return!1}}function ce(ee){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(Z){return Z.__proto__||Object.getPrototypeOf(Z)},ce(ee)}var Te=function(){var ee=function(re){z(ne,re);var Z=F(ne);function ne(me){var de;_(this,ne),de=Z.call(this,me),de.setPopupVisible=function(ye){var Ie=de.state.value;"popupVisible"in de.props||de.setState({popupVisible:ye}),ye&&!de.state.popupVisible&&de.setState({activeValue:Ie}),de.props.onPopupVisibleChange(ye)},de.handleChange=function(ye,Ie,Ee){var De=Ie.visible;(Ee.type!=="keydown"||Ee.keyCode===M.a.ENTER)&&(de.props.onChange(ye.map(function(Re){return Re[de.getFieldName("value")]}),ye),de.setPopupVisible(De))},de.handlePopupVisibleChange=function(ye){de.setPopupVisible(ye)},de.handleMenuSelect=function(ye,Ie,Ee){var De=de.trigger.getRootDomNode();De&&De.focus&&De.focus();var Re=de.props,ke=Re.changeOnSelect,Ne=Re.loadData,Pe=Re.expandTrigger;if(!ye||ye.disabled)return;var Ce=de.state.activeValue;Ce=Ce.slice(0,Ie+1),Ce[Ie]=ye[de.getFieldName("value")];var Je=de.getActiveOptions(Ce);if(ye.isLeaf===!1&&!ye[de.getFieldName("children")]&&Ne){ke&&de.handleChange(Je,{visible:!0},Ee),de.setState({activeValue:Ce}),Ne(Je);return}var Xe={};!ye[de.getFieldName("children")]||!ye[de.getFieldName("children")].length?(de.handleChange(Je,{visible:!1},Ee),Xe.value=Ce):ke&&(Ee.type==="click"||Ee.type==="keydown")&&(Pe==="hover"?de.handleChange(Je,{visible:!1},Ee):de.handleChange(Je,{visible:!0},Ee),Xe.value=Ce),Xe.activeValue=Ce,("value"in de.props||Ee.type==="keydown"&&Ee.keyCode!==M.a.ENTER)&&delete Xe.value,de.setState(Xe)},de.handleItemDoubleClick=function(){var ye=de.props.changeOnSelect;ye&&de.setPopupVisible(!1)},de.handleKeyDown=function(ye){var Ie=de.props.children;if(Ie&&Ie.props.onKeyDown){Ie.props.onKeyDown(ye);return}var Ee=f(de.state.activeValue),De=Ee.length-1<0?0:Ee.length-1,Re=de.getCurrentLevelOptions(),ke=Re.map(function(Je){return Je[de.getFieldName("value")]}).indexOf(Ee[De]);if(ye.keyCode!==M.a.DOWN&&ye.keyCode!==M.a.UP&&ye.keyCode!==M.a.LEFT&&ye.keyCode!==M.a.RIGHT&&ye.keyCode!==M.a.ENTER&&ye.keyCode!==M.a.SPACE&&ye.keyCode!==M.a.BACKSPACE&&ye.keyCode!==M.a.ESC&&ye.keyCode!==M.a.TAB)return;if(!de.state.popupVisible&&ye.keyCode!==M.a.BACKSPACE&&ye.keyCode!==M.a.LEFT&&ye.keyCode!==M.a.RIGHT&&ye.keyCode!==M.a.ESC&&ye.keyCode!==M.a.TAB){de.setPopupVisible(!0);return}if(ye.keyCode===M.a.DOWN||ye.keyCode===M.a.UP){ye.preventDefault();var Ne=ke;Ne!==-1?ye.keyCode===M.a.DOWN?(Ne+=1,Ne=Ne>=Re.length?0:Ne):(Ne-=1,Ne=Ne<0?Re.length-1:Ne):Ne=0,Ee[De]=Re[Ne][de.getFieldName("value")]}else if(ye.keyCode===M.a.LEFT||ye.keyCode===M.a.BACKSPACE)ye.preventDefault(),Ee.splice(Ee.length-1,1);else if(ye.keyCode===M.a.RIGHT)ye.preventDefault(),Re[ke]&&Re[ke][de.getFieldName("children")]&&Ee.push(Re[ke][de.getFieldName("children")][0][de.getFieldName("value")]);else if(ye.keyCode===M.a.ESC||ye.keyCode===M.a.TAB){de.setPopupVisible(!1);return}(!Ee||Ee.length===0)&&de.setPopupVisible(!1);var Pe=de.getActiveOptions(Ee),Ce=Pe[Pe.length-1];de.handleMenuSelect(Ce,Pe.length-1,ye),de.props.onKeyDown&&de.props.onKeyDown(ye)},de.saveTrigger=function(ye){de.trigger=ye};var Se=[];return"value"in me?Se=me.value||[]:"defaultValue"in me&&(Se=me.defaultValue||[]),W()(!("filedNames"in me),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),de.state={popupVisible:me.popupVisible,activeValue:Se,value:Se,prevProps:me},de.defaultFieldNames={label:"label",value:"value",children:"children"},de}return B(ne,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(de){var Se=this.defaultFieldNames,ye=this.props,Ie=ye.fieldNames,Ee=ye.filedNames;return"filedNames"in this.props?Ee[de]||Se[de]:Ie[de]||Se[de]}},{key:"getFieldNames",value:function(){var de=this.props,Se=de.fieldNames,ye=de.filedNames;return"filedNames"in this.props?ye:Se}},{key:"getCurrentLevelOptions",value:function(){var de=this,Se=this.props.options,ye=Se===void 0?[]:Se,Ie=this.state.activeValue,Ee=Ie===void 0?[]:Ie,De=I()(ye,function(Re,ke){return Re[de.getFieldName("value")]===Ee[ke]},{childrenKeyName:this.getFieldName("children")});return De[De.length-2]?De[De.length-2][this.getFieldName("children")]:f(ye).filter(function(Re){return!Re.disabled})}},{key:"getActiveOptions",value:function(de){var Se=this;return I()(this.props.options||[],function(ye,Ie){return ye[Se.getFieldName("value")]===de[Ie]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var de=this.props,Se=de.prefixCls,ye=de.transitionName,Ie=de.popupClassName,Ee=de.options,De=Ee===void 0?[]:Ee,Re=de.disabled,ke=de.builtinPlacements,Ne=de.popupPlacement,Pe=de.children,Ce=de.dropdownRender,Je=T(de,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Xe=$.createElement("div",null),We="";De&&De.length>0?Xe=$.createElement(C,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):We=" ".concat(Se,"-menus-empty");var He=Xe;return Ce&&(He=Ce(Xe)),$.createElement(K.a,Object.assign({ref:this.saveTrigger},Je,{popupPlacement:Ne,builtinPlacements:ke,popupTransitionName:ye,action:Re?[]:["click"],popupVisible:Re?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(Se,"-menus"),popupClassName:Ie+We,popup:He}),$.cloneElement(Pe,{onKeyDown:this.handleKeyDown,tabIndex:Re?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(de,Se){var ye=Se.prevProps,Ie=ye===void 0?{}:ye,Ee={prevProps:de};return"value"in de&&!k(Ie.value,de.value)&&(Ee.value=de.value||[],"loadData"in de||(Ee.activeValue=de.value||[])),"popupVisible"in de&&(Ee.popupVisible=de.popupVisible),Ee}}]),ne}($.Component);return ee.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:h,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},ee}(),ge=Te,he=Qe.a=ge},SJMd:function(rt,Qe){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var J,$,K,A=!1,W,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,I;(function(){var k=window,O=["break,continue,do,else,for,if,return,while"],D=[O,"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"],p=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],y=[p,"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"],R=[p,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],S=[p,"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"],x="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=[p,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[O,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[O,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],s=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[y,S,R,b,d,a,l,s],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",L="kwd",T="com",m="typ",f="lit",u="pun",o="pln",E="tag",v="dec",c="src",_="atn",U="atv",B="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(Ee){for(var De=0,Re=!1,ke=!1,Ne=0,Pe=Ee.length;Ne<Pe;++Ne){var Ce=Ee[Ne];if(Ce.ignoreCase)ke=!0;else if(/[a-z]/i.test(Ce.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,ke=!1;break}}var Je={b:8,t:9,n:10,v:11,f:12,r:13};function Xe(Ge){var xe=Ge.charCodeAt(0);if(xe!==92)return xe;var Ze=Ge.charAt(1);return xe=Je[Ze],xe||("0"<=Ze&&Ze<="7"?parseInt(Ge.substring(1),8):Ze==="u"||Ze==="x"?parseInt(Ge.substring(2),16):Ge.charCodeAt(1))}function We(Ge){if(Ge<32)return(Ge<16?"\\x0":"\\x")+Ge.toString(16);var xe=String.fromCharCode(Ge);return xe==="\\"||xe==="-"||xe==="]"||xe==="^"?"\\"+xe:xe}function He(Ge){var xe=Ge.substring(1,Ge.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ze=[],Ve=xe[0]==="^",we=["["];Ve&&we.push("^");for(var Me=Ve?1:0,fe=xe.length;Me<fe;++Me){var le=xe[Me];if(/\\[bdsw]/i.test(le))we.push(le);else{var ue=Xe(le),Y;Me+2<fe&&xe[Me+1]==="-"?(Y=Xe(xe[Me+2]),Me+=2):Y=ue,Ze.push([ue,Y]),Y<65||ue>122||(Y<65||ue>90||Ze.push([Math.max(65,ue)|32,Math.min(Y,90)|32]),Y<97||ue>122||Ze.push([Math.max(97,ue)&~32,Math.min(Y,122)&~32]))}}Ze.sort(function(be,Le){return be[0]-Le[0]||Le[1]-be[1]});for(var Q=[],q=[],Me=0;Me<Ze.length;++Me){var oe=Ze[Me];oe[0]<=q[1]+1?q[1]=Math.max(q[1],oe[1]):Q.push(q=oe)}for(var Me=0;Me<Q.length;++Me){var oe=Q[Me];we.push(We(oe[0])),oe[1]>oe[0]&&(oe[1]+1>oe[0]&&we.push("-"),we.push(We(oe[1])))}return we.push("]"),we.join("")}function et(Ge){for(var xe=Ge.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ze=xe.length,Ve=[],we=0,Me=0;we<Ze;++we){var fe=xe[we];if(fe==="(")++Me;else if(fe.charAt(0)==="\\"){var le=+fe.substring(1);le&&(le<=Me?Ve[le]=-1:xe[we]=We(le))}}for(var we=1;we<Ve.length;++we)Ve[we]===-1&&(Ve[we]=++De);for(var we=0,Me=0;we<Ze;++we){var fe=xe[we];if(fe==="(")++Me,Ve[Me]||(xe[we]="(?:");else if(fe.charAt(0)==="\\"){var le=+fe.substring(1);le&&le<=Me&&(xe[we]="\\"+Ve[le])}}for(var we=0;we<Ze;++we)xe[we]==="^"&&xe[we+1]!=="^"&&(xe[we]="");if(Ge.ignoreCase&&Re)for(var we=0;we<Ze;++we){var fe=xe[we],ue=fe.charAt(0);fe.length>=2&&ue==="["?xe[we]=He(fe):ue!=="\\"&&(xe[we]=fe.replace(/[a-zA-Z]/g,function(q){var oe=q.charCodeAt(0);return"["+String.fromCharCode(oe&~32,oe|32)+"]"}))}return xe.join("")}for(var Be=[],Ne=0,Pe=Ee.length;Ne<Pe;++Ne){var Ce=Ee[Ne];if(Ce.global||Ce.multiline)throw new Error(""+Ce);Be.push("(?:"+et(Ce)+")")}return new RegExp(Be.join("|"),ke?"gi":"g")}function F(Ee,De){var Re=/(?:^|\s)nocode(?:\s|$)/,ke=[],Ne=0,Pe=[],Ce=0;function Je(Xe){var We=Xe.nodeType;if(We==1){if(Re.test(Xe.className))return;for(var He=Xe.firstChild;He;He=He.nextSibling)Je(He);var et=Xe.nodeName.toLowerCase();(et==="br"||et==="li")&&(ke[Ce]=`
`,Pe[Ce<<1]=Ne++,Pe[Ce++<<1|1]=Xe)}else if(We==3||We==4){var Be=Xe.nodeValue;Be.length&&(De?Be=Be.replace(/\r\n?/g,`
`):Be=Be.replace(/[ \t\r\n]+/g," "),ke[Ce]=Be,Pe[Ce<<1]=Ne,Ne+=Be.length,Pe[Ce++<<1|1]=Xe)}}return Je(Ee),{sourceCode:ke.join("").replace(/\n$/,""),spans:Pe}}function X(Ee,De,Re,ke,Ne){if(!Re)return;var Pe={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:De,decorations:null};ke(Pe),Ne.push.apply(Ne,Pe.decorations)}var te=/\S/;function ae(Ee){for(var De=void 0,Re=Ee.firstChild;Re;Re=Re.nextSibling){var ke=Re.nodeType;De=ke===1?De?Ee:Re:ke===3&&te.test(Re.nodeValue)?Ee:De}return De===Ee?void 0:De}function ce(Ee,De){var Re={},ke;(function(){for(var Ce=Ee.concat(De),Je=[],Xe={},We=0,He=Ce.length;We<He;++We){var et=Ce[We],Be=et[3];if(Be)for(var Ge=Be.length;--Ge>=0;)Re[Be.charAt(Ge)]=et;var xe=et[1],Ze=""+xe;Xe.hasOwnProperty(Ze)||(Je.push(xe),Xe[Ze]=null)}Je.push(/[\0-\uffff]/),ke=j(Je)})();var Ne=De.length,Pe=function(Ce){for(var Je=Ce.sourceCode,Xe=Ce.basePos,We=Ce.sourceNode,He=[Xe,o],et=0,Be=Je.match(ke)||[],Ge={},xe=0,Ze=Be.length;xe<Ze;++xe){var Ve=Be[xe],we=Ge[Ve],Me=void 0,fe;if(typeof we=="string")fe=!1;else{var le=Re[Ve.charAt(0)];if(le)Me=Ve.match(le[1]),we=le[0];else{for(var ue=0;ue<Ne;++ue)if(le=De[ue],Me=Ve.match(le[1]),Me){we=le[0];break}Me||(we=o)}fe=we.length>=5&&we.substring(0,5)==="lang-",fe&&!(Me&&typeof Me[1]=="string")&&(fe=!1,we=c),fe||(Ge[Ve]=we)}var Y=et;if(et+=Ve.length,!fe)He.push(Xe+Y,we);else{var Q=Me[1],q=Ve.indexOf(Q),oe=q+Q.length;Me[2]&&(oe=Ve.length-Me[2].length,q=oe-Q.length);var be=we.substring(5);X(We,Xe+Y,Ve.substring(0,q),Pe,He),X(We,Xe+Y+q,Q,ne(be,Q),He),X(We,Xe+Y+oe,Ve.substring(oe),Pe,He)}}Ce.decorations=He};return Pe}function Te(Ee){var De=[],Re=[];Ee.tripleQuotedStrings?De.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?De.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Re.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=Ee.hashComments;ke&&(Ee.cStyleComments?(ke>1?De.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([T,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Re.push([T,/^\/\/[^\r\n]*/,null]),Re.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ne=Ee.regexLiterals;if(Ne){var Pe=Ne>1?"":`
\r`,Ce=Pe?".":"[\\S\\s]",Je="/(?=[^/*"+Pe+"])(?:[^/\\x5B\\x5C"+Pe+"]|\\x5C"+Ce+"|\\x5B(?:[^\\x5C\\x5D"+Pe+"]|\\x5C"+Ce+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+z+"("+Je+")")])}var Xe=Ee.types;Xe&&Re.push([m,Xe]);var We=(""+Ee.keywords).replace(/^ | $/g,"");We.length&&Re.push([L,new RegExp("^(?:"+We.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([o,/^\s+/,null,` \r
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(He+="(?!s*/)"),Re.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[u,new RegExp(He),null]),ce(De,Re)}var ge=Te({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(Ee,De,Re){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Ne=/\r\n?|\n/,Pe=Ee.ownerDocument,Ce=Pe.createElement("li");Ee.firstChild;)Ce.appendChild(Ee.firstChild);var Je=[Ce];function Xe(xe){var Ze=xe.nodeType;if(Ze==1&&!ke.test(xe.className))if(xe.nodeName==="br")We(xe),xe.parentNode&&xe.parentNode.removeChild(xe);else for(var Ve=xe.firstChild;Ve;Ve=Ve.nextSibling)Xe(Ve);else if((Ze==3||Ze==4)&&Re){var we=xe.nodeValue,Me=we.match(Ne);if(Me){var fe=we.substring(0,Me.index);xe.nodeValue=fe;var le=we.substring(Me.index+Me[0].length);if(le){var ue=xe.parentNode;ue.insertBefore(Pe.createTextNode(le),xe.nextSibling)}We(xe),fe||xe.parentNode.removeChild(xe)}}}function We(xe){for(;!xe.nextSibling;)if(xe=xe.parentNode,!xe)return;function Ze(Me,fe){var le=fe?Me.cloneNode(!1):Me,ue=Me.parentNode;if(ue){var Y=Ze(ue,1),Q=Me.nextSibling;Y.appendChild(le);for(var q=Q;q;q=Q)Q=q.nextSibling,Y.appendChild(q)}return le}for(var Ve=Ze(xe.nextSibling,0),we;(we=Ve.parentNode)&&we.nodeType===1;)Ve=we;Je.push(Ve)}for(var He=0;He<Je.length;++He)Xe(Je[He]);De===(De|0)&&Je[0].setAttribute("value",De);var et=Pe.createElement("ol");et.className="linenums";for(var Be=Math.max(0,De-1|0)||0,He=0,Ge=Je.length;He<Ge;++He)Ce=Je[He],Ce.className="L"+(He+Be)%10,Ce.firstChild||Ce.appendChild(Pe.createTextNode("\xA0")),et.appendChild(Ce);Ee.appendChild(et)}function ee(Ee){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var Re=/\n/g,ke=Ee.sourceCode,Ne=ke.length,Pe=0,Ce=Ee.spans,Je=Ce.length,Xe=0,We=Ee.decorations,He=We.length,et=0;We[He]=Ne;var Be,Ge;for(Ge=Be=0;Ge<He;)We[Ge]!==We[Ge+2]?(We[Be++]=We[Ge++],We[Be++]=We[Ge++]):Ge+=2;for(He=Be,Ge=Be=0;Ge<He;){for(var xe=We[Ge],Ze=We[Ge+1],Ve=Ge+2;Ve+2<=He&&We[Ve+1]===Ze;)Ve+=2;We[Be++]=xe,We[Be++]=Ze,Ge=Ve}He=We.length=Be;var we=Ee.sourceNode,Me="";we&&(Me=we.style.display,we.style.display="none");try{for(var fe=null;Xe<Je;){var le=Ce[Xe],ue=Ce[Xe+2]||Ne,Y=We[et+2]||Ne,Ve=Math.min(ue,Y),Q=Ce[Xe+1],q;if(Q.nodeType!==1&&(q=ke.substring(Pe,Ve))){De&&(q=q.replace(Re,"\r")),Q.nodeValue=q;var oe=Q.ownerDocument,be=oe.createElement("span");be.className=We[et+1];var Le=Q.parentNode;Le.replaceChild(be,Q),be.appendChild(Q),Pe<ue&&(Ce[Xe+1]=Q=oe.createTextNode(ke.substring(Ve,ue)),Le.insertBefore(Q,be.nextSibling))}Pe=Ve,Pe>=ue&&(Xe+=2),Pe>=Y&&(et+=2)}}finally{we&&(we.style.display=Me)}}var re={};function Z(Ee,De){for(var Re=De.length;--Re>=0;){var ke=De[Re];re.hasOwnProperty(ke)?k.console&&console.warn("cannot override language handler %s",ke):re[ke]=Ee}}function ne(Ee,De){return Ee&&re.hasOwnProperty(Ee)||(Ee=/^\s*</.test(De)?"default-markup":"default-code"),re[Ee]}Z(ge,["default-code"]),Z(ce([],[[o,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Z(ce([[o,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[_,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Z(ce([],[[U,/^[\s\S]+/]]),["uq.val"]),Z(Te({keywords:y,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),Z(Te({keywords:"null,true,false"}),["json"]),Z(Te({keywords:S,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),Z(Te({keywords:R,cStyleComments:!0}),["java"]),Z(Te({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Z(Te({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Z(Te({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Z(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Z(Te({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Z(Te({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Z(ce([],[[h,/^[\s\S]+/]]),["regex"]);function me(Ee){var De=Ee.langExtension;try{var Re=F(Ee.sourceNode,Ee.pre),ke=Re.sourceCode;Ee.sourceCode=ke,Ee.spans=Re.spans,Ee.basePos=0,ne(De,ke)(Ee),ee(Ee)}catch(Ne){k.console&&console.log(Ne&&Ne.stack||Ne)}}function de(Ee,De,Re){var ke=Re||!1,Ne=De||null,Pe=document.createElement("div");Pe.innerHTML="<pre>"+Ee+"</pre>",Pe=Pe.firstChild,ke&&he(Pe,ke,!0);var Ce={langExtension:Ne,numberLines:ke,sourceNode:Pe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return me(Ce),Pe.innerHTML}function Se(Ee,De){var Re=De||document.body,ke=Re.ownerDocument||document;function Ne(le){return Re.getElementsByTagName(le)}for(var Pe=[Ne("pre"),Ne("code"),Ne("xmp")],Ce=[],Je=0;Je<Pe.length;++Je)for(var Xe=0,We=Pe[Je].length;Xe<We;++Xe)Ce.push(Pe[Je][Xe]);Pe=null;var He=Date;He.now||(He={now:function(){return+new Date}});var et=0,Be=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ge=/\bprettyprint\b/,xe=/\bprettyprinted\b/,Ze=/pre|xmp/i,Ve=/^code$/i,we=/^(?:pre|code|xmp)$/i,Me={};function fe(){for(var le=k.PR_SHOULD_USE_CONTINUATION?He.now()+250:Infinity;et<Ce.length&&He.now()<le;et++){for(var ue=Ce[et],Y=Me,Q=ue;Q=Q.previousSibling;){var q=Q.nodeType,oe=(q===7||q===8)&&Q.nodeValue;if(oe?!/^\??prettify\b/.test(oe):q!==3||/\S/.test(Q.nodeValue))break;if(oe){Y={},oe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(At,pt,or){Y[pt]=or});break}}var be=ue.className;if((Y!==Me||Ge.test(be))&&!xe.test(be)){for(var Le=!1,_e=ue.parentNode;_e;_e=_e.parentNode){var ze=_e.tagName;if(we.test(ze)&&_e.className&&Ge.test(_e.className)){Le=!0;break}}if(!Le){ue.className+=" prettyprinted";var it=Y.lang;if(!it){it=be.match(Be);var Ae;!it&&(Ae=ae(ue))&&Ve.test(Ae.tagName)&&(it=Ae.className.match(Be)),it&&(it=it[1])}var ct;if(Ze.test(ue.tagName))ct=1;else{var at=ue.currentStyle,tt=ke.defaultView,xt=at?at.whiteSpace:tt&&tt.getComputedStyle?tt.getComputedStyle(ue,null).getPropertyValue("white-space"):0;ct=xt&&xt.substring(0,3)==="pre"}var Et=Y.linenums;(Et=Et==="true"||+Et)||(Et=be.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&he(ue,Et,ct);var Rt={langExtension:it,sourceNode:ue,numberLines:Et,pre:ct,sourceCode:null,basePos:null,spans:null,decorations:null};me(Rt)}}}et<Ce.length?k.setTimeout(fe,250):typeof Ee=="function"&&Ee()}fe()}var ye=k.PR={createSimpleLexer:ce,registerLangHandler:Z,sourceDecorator:Te,PR_ATTRIB_NAME:_,PR_ATTRIB_VALUE:U,PR_COMMENT:T,PR_DECLARATION:v,PR_KEYWORD:L,PR_LITERAL:f,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:u,PR_SOURCE:c,PR_STRING:h,PR_TAG:E,PR_TYPE:m,prettyPrintOne:A?k.prettyPrintOne=de:P=de,prettyPrint:I=A?k.prettyPrint=Se:I=Se},Ie=k.define;typeof Ie=="function"&&Ie.amd&&Ie("google-code-prettify",[],function(){return ye})})()},"VrN/":function(rt,Qe,J){(function($,K){rt.exports=K()})(this,function(){"use strict";var $=navigator.userAgent,K=navigator.platform,A=/gecko\/\d/i.test($),W=/MSIE \d/.test($),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($),P=/Edge\/(\d+)/.exec($),I=W||M||P,k=I&&(W?document.documentMode||6:+(P||M)[1]),O=!P&&/WebKit\//.test($),D=O&&/Qt\/\d+\.\d+/.test($),p=!P&&/Chrome\//.test($),y=/Opera\//.test($),R=/Apple Computer/.test(navigator.vendor),S=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test($),x=/PhantomJS/.test($),b=!P&&/AppleWebKit/.test($)&&/Mobile\/\w+/.test($),d=/Android/.test($),a=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test($),l=b||/Mac/.test(K),s=/\bCrOS\b/.test($),C=/win/i.test(K),g=y&&$.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(y=!1,O=!0);var h=l&&(D||y&&(g==null||g<12.11)),L=A||I&&k>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var n=e.className,r=T(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return f(e).appendChild(t)}function o(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var w=0;w<t.length;++w)i.appendChild(t[w]);return i}function E(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var v;document.createRange?v=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:v=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 c(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 _(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}var z=function(e){e.select()};b?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:I&&(z=function(e){try{e.select()}catch(t){}});function j(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 X(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var w=r||0,N=i||0;;){var H=e.indexOf(" ",w);if(H<0||H>=t)return N+(t-w);N+=H-w,N+=n-N%n,w=H+1}}var te=function(){this.id=null,this.f=null,this.time=0,this.handler=j(this.onTimeout,this)};te.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},te.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 ae(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ce=50,Te={toString:function(){return"CodeMirror.Pass"}},ge={scroll:!1},he={origin:"*mouse"},ee={origin:"+move"};function re(e,t,n){for(var r=0,i=0;;){var w=e.indexOf(" ",r);w==-1&&(w=e.length);var N=w-r;if(w==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=w-r,i+=n-i%n,r=w+1,i>=t)return r}}var Z=[""];function ne(e){for(;Z.length<=e;)Z.push(me(Z)+" ");return Z[e]}function me(e){return e[e.length-1]}function de(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Se(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ye(){}function Ie(e,t){var n;return Object.create?n=Object.create(e):(ye.prototype=e,n=new ye),t&&F(t,n),n}var Ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ee.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ne=/[\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 Pe(e){return e.charCodeAt(0)>=768&&Ne.test(e)}function Ce(e,t,n){for(;(n<0?t>0:t<e.length)&&Pe(e.charAt(t));)t+=n;return t}function Je(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,w=r<0?Math.ceil(i):Math.floor(i);if(w==t)return e(w)?t:n;e(w)?n=w:t=w+r}}function Xe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,w=0;w<e.length;++w){var N=e[w];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",w),i=!0)}i||r(t,n,"ltr")}var We=null;function He(e,t,n){var r;We=null;for(var i=0;i<e.length;++i){var w=e[i];if(w.from<t&&w.to>t)return i;w.to==t&&(w.from!=w.to&&n=="before"?r=i:We=i),w.from==t&&(w.from!=w.to&&n!="before"?r=i:We=i)}return r!=null?r:We}var et=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]/,w=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function G(V,ie,se){this.level=V,this.from=ie,this.to=se}return function(V,ie){var se=ie=="ltr"?"L":"R";if(V.length==0||ie=="ltr"&&!r.test(V))return!1;for(var ve=V.length,pe=[],Oe=0;Oe<ve;++Oe)pe.push(n(V.charCodeAt(Oe)));for(var Ue=0,Ke=se;Ue<ve;++Ue){var Ye=pe[Ue];Ye=="m"?pe[Ue]=Ke:Ke=Ye}for(var qe=0,$e=se;qe<ve;++qe){var nt=pe[qe];nt=="1"&&$e=="r"?pe[qe]="n":w.test(nt)&&($e=nt,nt=="r"&&(pe[qe]="R"))}for(var dt=1,lt=pe[0];dt<ve-1;++dt){var gt=pe[dt];gt=="+"&&lt=="1"&&pe[dt+1]=="1"?pe[dt]="1":gt==","&&lt==pe[dt+1]&&(lt=="1"||lt=="n")&&(pe[dt]=lt),lt=gt}for(var Ot=0;Ot<ve;++Ot){var Vt=pe[Ot];if(Vt==",")pe[Ot]="N";else if(Vt=="%"){var kt=void 0;for(kt=Ot+1;kt<ve&&pe[kt]=="%";++kt);for(var dr=Ot&&pe[Ot-1]=="!"||kt<ve&&pe[kt]=="1"?"1":"N",nr=Ot;nr<kt;++nr)pe[nr]=dr;Ot=kt-1}}for(var Bt=0,ir=se;Bt<ve;++Bt){var Yt=pe[Bt];ir=="L"&&Yt=="1"?pe[Bt]="L":w.test(Yt)&&(ir=Yt)}for(var Ht=0;Ht<ve;++Ht)if(i.test(pe[Ht])){var jt=void 0;for(jt=Ht+1;jt<ve&&i.test(pe[jt]);++jt);for(var Nt=(Ht?pe[Ht-1]:se)=="L",ar=(jt<ve?pe[jt]:se)=="L",Gn=Nt==ar?Nt?"L":"R":se,Qr=Ht;Qr<jt;++Qr)pe[Qr]=Gn;Ht=jt-1}for(var Jt=[],Dr,Xt=0;Xt<ve;)if(N.test(pe[Xt])){var Xa=Xt;for(++Xt;Xt<ve&&N.test(pe[Xt]);++Xt);Jt.push(new G(0,Xa,Xt))}else{var Ir=Xt,pn=Jt.length,gn=ie=="rtl"?1:0;for(++Xt;Xt<ve&&pe[Xt]!="L";++Xt);for(var er=Ir;er<Xt;)if(H.test(pe[er])){Ir<er&&(Jt.splice(pn,0,new G(1,Ir,er)),pn+=gn);var zn=er;for(++er;er<Xt&&H.test(pe[er]);++er);Jt.splice(pn,0,new G(2,zn,er)),pn+=gn,Ir=er}else++er;Ir<Xt&&Jt.splice(pn,0,new G(1,Ir,Xt))}return ie=="ltr"&&(Jt[0].level==1&&(Dr=V.match(/^\s+/))&&(Jt[0].from=Dr[0].length,Jt.unshift(new G(0,0,Dr[0].length))),me(Jt).level==1&&(Dr=V.match(/\s+$/))&&(me(Jt).to-=Dr[0].length,Jt.push(new G(0,ve-Dr[0].length,ve)))),ie=="rtl"?Jt.reverse():Jt}}();function Be(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var Ge=[],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]||Ge).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||Ge}function Ve(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 w=ae(i,n);w>-1&&(r[t]=i.slice(0,w).concat(i.slice(w+1)))}}}function we(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Me(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),we(e,n||t.type,e,t),q(t)||t.codemirrorIgnore}function fe(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)ae(n,t[r])==-1&&n.push(t[r])}function le(e,t){return Ze(e,t).length>0}function ue(e){e.prototype.on=function(t,n){xe(this,t,n)},e.prototype.off=function(t,n){Ve(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function q(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function oe(e){Y(e),Q(e)}function be(e){return e.target||e.srcElement}function Le(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var _e=function(){if(I&&k<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),ze;function it(e){if(ze==null){var t=o("span","\u200B");u(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ze=t.offsetWidth<=1&&t.offsetHeight>2&&!(I&&k<8))}var n=ze?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ae;function ct(e){if(Ae!=null)return Ae;var t=u(e,document.createTextNode("A\u062EA")),n=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:Ae=r.right-n.right<3}var at=`
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 w=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=w.indexOf("\r");N!=-1?(n.push(w.slice(0,N)),t+=N+1):(n.push(w),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},tt=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},xt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Rt(e){if(Et!=null)return Et;var t=u(e,o("span","x")),n=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var At={},pt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),At[e]=t}function Kt(e,t){pt[e]=t}function Ft(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=Ie(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ft("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ft("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Ft(t);var n=At[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var w in i){if(!i.hasOwnProperty(w))continue;r.hasOwnProperty(w)&&(r["_"+w]=r[w]),r[w]=i[w]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};F(t,n)}function mr(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 vn(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 Jr(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=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};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.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},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var w=this.string.slice(this.pos).match(e);return w&&w.index>0?null:(w&&t!==!1&&(this.pos+=w[0].length),w)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function st(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],w=i.chunkSize();if(t<w){n=i;break}t-=w}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(w){var N=w.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function cr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function St(e){if(e.parent==null)return null;for(var t=e.parent,n=ae(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 wr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],w=i.height;if(t<w){e=i;continue e}t-=w,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var H=e.lines[N],G=H.height;if(t<G)break;t-=G}return n+N}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function yn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function en(e){return Fe(e.line,e.ch)}function tn(e,t){return ft(e,t)<0?t:e}function bn(e,t){return ft(e,t)<0?e:t}function Xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,st(e,n).text.length):Ci(t,st(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Li(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=mt(e,t[r]);return n}var rn=function(e,t){this.state=e,this.lookAhead=t},sr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},sr.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}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,mr(e.mode,t.state),n,t.lookAhead):new sr(e,mr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?mr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Ai(e,t,n,r){var i=[e.state.modeGen],w={};Qn(e,t.text,e.doc.mode,n,function(V,ie){return i.push(V,ie)},w,r);for(var N=n.state,H=function(V){n.baseTokens=i;var ie=e.state.overlays[V],se=1,ve=0;n.state=!0,Qn(e,t.text,ie.mode,n,function(pe,Oe){for(var Ue=se;ve<pe;){var Ke=i[se];Ke>pe&&i.splice(se,1,pe,i[se+1],Ke),se+=2,ve=Math.min(pe,Ke)}if(!Oe)return;if(ie.opaque)i.splice(Ue,se-Ue,pe,"overlay "+Oe),se=Ue+2;else for(;Ue<se;Ue+=2){var Ye=i[Ue+1];i[Ue+1]=(Ye?Ye+" ":"")+"overlay "+Oe}},w),n.state=N,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)H(G);return{styles:i,classes:w.bgClass||w.textClass?w:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=je(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&mr(e.doc.mode,r.state),w=Ai(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=w.styles,w.classes?t.styleClasses=w.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 je(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var w=_r(e,t,n),N=w>r.first&&st(r,w-1).stateAfter,H=N?sr.fromSaved(r,N,w):new sr(r,Jr(r.mode),w);return r.iter(w,t,function(G){$n(e,G.text,H);var V=H.line;G.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function $n(e,t,n,r){var i=e.doc.mode,w=new Mt(t,e.options.tabSize,n);for(w.start=w.pos=r||0,t==""&&Di(i,n.state);!w.eol();)En(i,w,n.state),w.start=w.pos}function Di(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function En(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vn(e,n).mode);var w=e.token(t,n);if(t.pos>t.start)return w}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Nr(e,t,n,r){var i=e.doc,w=i.mode,N;t=mt(i,t);var H=st(i,t.line),G=je(e,t.line,n),V=new Mt(H.text,e.options.tabSize,G),ie;for(r&&(ie=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,N=En(w,V,G.state),r&&ie.push(new nn(V,N,mr(i.mode,G.state)));return r?ie:new nn(V,N,G.state)}function _i(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 Qn(e,t,n,r,i,w,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var G=0,V=null,ie=new Mt(t,e.options.tabSize,r),se,ve=e.options.addModeClass&&[null];for(t==""&&_i(Di(n,r.state),w);!ie.eol();){if(ie.pos>e.options.maxHighlightLength?(H=!1,N&&$n(e,t,r,ie.pos),ie.pos=t.length,se=null):se=_i(En(n,ie,r.state,ve),w),ve){var pe=ve[0].name;pe&&(se="m-"+(se?pe+" "+se:pe))}if(!H||V!=se){for(;G<ie.start;)G=Math.min(ie.start,G+5e3),i(G,V);V=se}ie.start=ie.pos}for(;G<ie.pos;){var Oe=Math.min(ie.pos,G+5e3);i(Oe,V),G=Oe}}function _r(e,t,n){for(var r,i,w=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=w.first)return w.first;var G=st(w,H-1),V=G.stateAfter;if(V&&(!n||H+(V instanceof rn?V.lookAhead:0)<=w.modeFrontier))return H;var ie=X(G.text,null,e.options.tabSize);(i==null||r>ie)&&(i=H-1,r=ie)}return i}function Oi(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=st(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ri=!1,pr=!1;function Cr(){Ri=!0}function Pi(){pr=!0}function xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Ur(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Fr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Br(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var w=e[i],N=w.marker,H=w.from==null||(N.inclusiveLeft?w.from<=t:w.from<t);if(H||w.from==t&&N.type=="bookmark"&&(!n||!w.marker.insertLeft)){var G=w.to==null||(N.inclusiveRight?w.to>=t:w.to>t);(r||(r=[])).push(new xn(N,w.from,G?null:w.to))}}return r}function Mi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var w=e[i],N=w.marker,H=w.to==null||(N.inclusiveRight?w.to>=t:w.to>t);if(H||w.from==t&&N.type=="bookmark"&&(!n||w.marker.insertLeft)){var G=w.from==null||(N.inclusiveLeft?w.from<=t:w.from<t);(r||(r=[])).push(new xn(N,G?null:w.from-t,w.to==null?null:w.to-t))}}return r}function Or(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&st(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&st(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,w=t.to.ch,N=ft(t.from,t.to)==0,H=aa(n,i,N),G=Mi(r,w,N),V=t.text.length==1,ie=me(t.text).length+(V?i:0);if(H)for(var se=0;se<H.length;++se){var ve=H[se];if(ve.to==null){var pe=Ur(G,ve.marker);pe?V&&(ve.to=pe.to==null?null:pe.to+ie):ve.to=i}}if(G)for(var Oe=0;Oe<G.length;++Oe){var Ue=G[Oe];if(Ue.to!=null&&(Ue.to+=ie),Ue.from==null){var Ke=Ur(H,Ue.marker);Ke||(Ue.from=ie,V&&(H||(H=[])).push(Ue))}else Ue.from+=ie,V&&(H||(H=[])).push(Ue)}H&&(H=Tn(H)),G&&G!=H&&(G=Tn(G));var Ye=[H];if(!V){var qe=t.text.length-2,$e;if(qe>0&&H)for(var nt=0;nt<H.length;++nt)H[nt].to==null&&($e||($e=[])).push(new xn(H[nt].marker,null,null));for(var dt=0;dt<qe;++dt)Ye.push($e);Ye.push(G)}return Ye}function Tn(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 oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(pe){if(pe.markedSpans)for(var Oe=0;Oe<pe.markedSpans.length;++Oe){var Ue=pe.markedSpans[Oe].marker;Ue.readOnly&&(!r||ae(r,Ue)==-1)&&(r||(r=[])).push(Ue)}}),!r)return null;for(var i=[{from:t,to:n}],w=0;w<r.length;++w)for(var N=r[w],H=N.find(0),G=0;G<i.length;++G){var V=i[G];if(ft(V.to,H.from)<0||ft(V.from,H.to)>0)continue;var ie=[G,1],se=ft(V.from,H.from),ve=ft(V.to,H.to);(se<0||!N.inclusiveLeft&&!se)&&ie.push({from:V.from,to:H.from}),(ve>0||!N.inclusiveRight&&!ve)&&ie.push({from:H.to,to:V.to}),i.splice.apply(i,ie),G+=ie.length-3}return i}function Jn(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 Zn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function an(e){return e.inclusiveLeft?-1:0}function Sn(e){return e.inclusiveRight?1:0}function wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),w=ft(r.from,i.from)||an(e)-an(t);if(w)return-w;var N=ft(r.to,i.to)||Sn(e)-Sn(t);return N||t.id-e.id}function sa(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=void 0,w=0;w<n.length;++w)i=n[w],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function Cn(e){return sa(e,!0)}function on(e){return sa(e,!1)}function ki(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var w=n[i];w.marker.collapsed&&(w.from==null||w.from<t)&&(w.to==null||w.to>t)&&(!r||wn(r,w.marker)<0)&&(r=w.marker)}return r}function qn(e,t,n,r,i){var w=st(e,t),N=pr&&w.markedSpans;if(N)for(var H=0;H<N.length;++H){var G=N[H];if(!G.marker.collapsed)continue;var V=G.marker.find(0),ie=ft(V.from,n)||an(G.marker)-an(i),se=ft(V.to,r)||Sn(G.marker)-Sn(i);if(ie>=0&&se<=0||ie<=0&&se>=0)continue;if(ie<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?ft(V.to,n)>=0:ft(V.to,n)>0)||ie>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?ft(V.from,r)<=0:ft(V.from,r)<0))return!0}}function $t(e){for(var t;t=Cn(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function Ln(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=st(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=st(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return St(n)+1}function yr(e,t){var n=pr&&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&&An(e,t,r))return!0}}function An(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return An(e,r.line,Ur(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,w=0;w<t.markedSpans.length;++w)if(i=t.markedSpans[w],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&An(e,t,i))return!0}function lr(e){e=$t(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var w=n.parent;w;n=w,w=n.parent)for(var N=0;N<w.children.length;++N){var H=w.children[N];if(H==n)break;t+=H.height}return t}function Dn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Cn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=on(r);){var w=n.find(0,!0);t-=r.text.length-w.from.ch,r=w.to.line,t+=r.text.length-w.to.ch}return t}function Rr(e){var t=e.display,n=e.doc;t.maxLine=st(n,n.first),t.maxLineLength=Dn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Dn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return St(this)},ue(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ni(e,t){var n=E("span",null,null,O?"padding-right: .1px":null),r={pre:E("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 w=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=ht,ct(e.display.measure)&&(N=Be(w,e.doc.direction))&&(r.addToken=vt(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&St(w);_t(w,r,Yn(e,w,H)),w.styleClasses&&(w.styleClasses.bgClass&&(r.bgClass=B(w.styleClasses.bgClass,r.bgClass||"")),w.styleClasses.textClass&&(r.textClass=B(w.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(it(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(O){var G=r.content.lastChild;(/\bcm-tab\b/.test(G.className)||G.querySelector&&G.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return we(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function ot(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ht(e,t,n,r,i,w,N){if(!t)return;var H=e.splitSpaces?ut(t,e.trailingSpace):t,G=e.cm.state.specialChars,V=!1,ie;if(!G.test(t))e.col+=t.length,ie=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,ie),I&&k<9&&(V=!0),e.pos+=t.length;else{ie=document.createDocumentFragment();for(var se=0;;){G.lastIndex=se;var ve=G.exec(t),pe=ve?ve.index-se:t.length-se;if(pe){var Oe=document.createTextNode(H.slice(se,se+pe));I&&k<9?ie.appendChild(o("span",[Oe])):ie.appendChild(Oe),e.map.push(e.pos,e.pos+pe,Oe),e.col+=pe,e.pos+=pe}if(!ve)break;se+=pe+1;var Ue=void 0;if(ve[0]==" "){var Ke=e.cm.options.tabSize,Ye=Ke-e.col%Ke;Ue=ie.appendChild(o("span",ne(Ye),"cm-tab")),Ue.setAttribute("role","presentation"),Ue.setAttribute("cm-text"," "),e.col+=Ye}else ve[0]=="\r"||ve[0]==`
`?(Ue=ie.appendChild(o("span",ve[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ue.setAttribute("cm-text",ve[0]),e.col+=1):(Ue=e.cm.options.specialCharPlaceholder(ve[0]),Ue.setAttribute("cm-text",ve[0]),I&&k<9?ie.appendChild(o("span",[Ue])):ie.appendChild(Ue),e.col+=1);e.map.push(e.pos,e.pos+1,Ue),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||V||w||N){var qe=n||"";r&&(qe+=r),i&&(qe+=i);var $e=o("span",[ie],qe,w);if(N)for(var nt in N)N.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&$e.setAttribute(nt,N[nt]);return e.content.appendChild($e)}e.content.appendChild(ie)}function ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var w=e.charAt(i);w==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(w="\xA0"),r+=w,n=w==" "}return r}function vt(e,t){return function(n,r,i,w,N,H,G){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,ie=V+r.length;;){for(var se=void 0,ve=0;ve<t.length&&!(se=t[ve],se.to>V&&se.from<=V);ve++);if(se.to>=ie)return e(n,r,i,w,N,H,G);e(n,r.slice(0,se.to-V),i,w,null,H,G),w=null,r=r.slice(se.to-V),V=se.to}}}function Tt(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 _t(e,t,n){var r=e.markedSpans,i=e.text,w=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(w,w=n[N]),da(n[N+1],t.cm.options));return}for(var H=i.length,G=0,V=1,ie="",se,ve,pe=0,Oe,Ue,Ke,Ye,qe;;){if(pe==G){Oe=Ue=Ke=ve="",qe=null,Ye=null,pe=Infinity;for(var $e=[],nt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],gt=lt.marker;if(gt.type=="bookmark"&&lt.from==G&&gt.widgetNode)$e.push(gt);else if(lt.from<=G&&(lt.to==null||lt.to>G||gt.collapsed&&lt.to==G&&lt.from==G)){if(lt.to!=null&&lt.to!=G&&pe>lt.to&&(pe=lt.to,Ue=""),gt.className&&(Oe+=" "+gt.className),gt.css&&(ve=(ve?ve+";":"")+gt.css),gt.startStyle&&lt.from==G&&(Ke+=" "+gt.startStyle),gt.endStyle&&lt.to==pe&&(nt||(nt=[])).push(gt.endStyle,lt.to),gt.title&&((qe||(qe={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(qe||(qe={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!Ye||wn(Ye.marker,gt)<0)&&(Ye=lt)}else lt.from>G&&pe>lt.from&&(pe=lt.from)}if(nt)for(var Vt=0;Vt<nt.length;Vt+=2)nt[Vt+1]==pe&&(Ue+=" "+nt[Vt]);if(!Ye||Ye.from==G)for(var kt=0;kt<$e.length;++kt)Tt(t,0,$e[kt]);if(Ye&&(Ye.from||0)==G){if(Tt(t,(Ye.to==null?H+1:Ye.to)-G,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==G&&(Ye=!1)}}if(G>=H)break;for(var dr=Math.min(H,pe);;){if(ie){var nr=G+ie.length;if(!Ye){var Bt=nr>dr?ie.slice(0,dr-G):ie;t.addToken(t,Bt,se?se+Oe:Oe,Ke,G+Bt.length==pe?Ue:"",ve,qe)}if(nr>=dr){ie=ie.slice(dr-G),G=dr;break}G=nr,Ke=""}ie=i.slice(w,w=n[V++]),se=da(n[V++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=Ln(t),this.size=this.rest?St(me(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,w=t;w<n;w=i){var N=new yt(e.doc,st(e.doc,w),w);i=w+N.size,r.push(N)}return r}var Wt=null;function bt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function Pr(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 Ct(e,t){var n=e.ownsGroup;if(!n)return;try{Pr(n)}finally{Wt=null,t(n)}}var Zt=null;function Dt(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Wt?i=Wt.delayedCallbacks:Zt?i=Zt:(i=Zt=[],setTimeout(gr,0));for(var w=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)w(N)}function gr(){var e=Zt;Zt=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var w=t.changes[i];w=="text"?ks(e,t):w=="gutter"?qa(e,t,n,r):w=="class"?ca(e,t):w=="widget"&&Is(e,t,r)}t.changes=null}function ei(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),I&&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=ei(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ni(e,t)}function ks(e,t){var n=t.text.className,r=Za(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,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ms(e,t),t.line.wrapClass?ei(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 qa(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=ei(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var w=t.line.gutterMarkers;if(e.options.lineNumbers||w){var N=ei(t),H=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!w||!w["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(o("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),w)for(var G=0;G<e.display.gutterSpecs.length;++G){var V=e.display.gutterSpecs[G].className,ie=w.hasOwnProperty(V)&&w[V];ie&&H.appendChild(o("div",[ie],"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=T("CodeMirror-linewidget"),i=t.node.firstChild,w=void 0;i;i=w)w=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Ns(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var w=ei(n),N=0,H=t.widgets;N<H.length;++N){var G=H[N],V=o("div",[G.node],"CodeMirror-linewidget"+(G.className?" "+G.className:""));G.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Us(G,V,n,r),e.display.input.setUneditable(V),i&&G.above?w.insertBefore(V,n.gutter||n.text):w.appendChild(V),Dt(G,"redraw")}}function Us(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 ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!c(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Mr(e,t){for(var n=be(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ui(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,o("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Lr(e){return ce-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var w=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),H=0;H<N.length-1;H++){var G=N[H],V=N[H+1];Math.abs(G.bottom-V.bottom)>2&&w.push((G.bottom+V.top)/2-n.top)}}w.push(n.bottom-n.top)}}function no(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(St(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=St(t),r=e.display.externalMeasured=new yt(e.doc,t,n);r.lineN=n;var i=r.built=Ni(e,r);return r.text=i.pre,u(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Ar(e,_n(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function _n(e,t){var n=St(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Ar(e,t,n,r,i){t.before&&(n=-1);var w=n+(r||""),N;return t.cache.hasOwnProperty(w)?N=t.cache[w]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[w]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,w,N,H,G,V=0;V<e.length;V+=3)if(H=e[V],G=e[V+1],t<H?(i=0,w=1,N="left"):t<G?(i=t-H,w=i+1):(V==e.length-3||t==G&&e[V+3]>t)&&(w=G-H,i=w-1,t>=G&&(N="right")),i!=null){if(r=e[V+2],H==G&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],N="left";if(n=="right"&&i==G-H)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],N="right";break}return{node:r,start:i,end:w,collapse:N,coverStart:H,coverEnd:G}}function js(e,t){var n=ao;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=oo(t.map,n,r),w=i.node,N=i.start,H=i.end,G=i.collapse,V;if(w.nodeType==3){for(var ie=0;ie<4;ie++){for(;N&&Pe(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&Pe(t.line.text.charAt(i.coverStart+H));)++H;if(I&&k<9&&N==0&&H==i.coverEnd-i.coverStart?V=w.parentNode.getBoundingClientRect():V=js(v(w,N,H).getClientRects(),r),V.left||V.right||N==0)break;H=N,N=N-1,G="right"}I&&k<11&&(V=Hs(e.display.measure,V))}else{N>0&&(G=r="right");var se;e.options.lineWrapping&&(se=w.getClientRects()).length>1?V=se[r=="right"?se.length-1:0]:V=w.getBoundingClientRect()}if(I&&k<9&&!N&&(!V||!V.left&&!V.right)){var ve=w.parentNode.getClientRects()[0];ve?V={left:ve.left,right:ve.left+Rn(e.display),top:ve.top,bottom:ve.bottom}:V=ao}for(var pe=V.top-t.rect.top,Oe=V.bottom-t.rect.top,Ue=(pe+Oe)/2,Ke=t.view.measure.heights,Ye=0;Ye<Ke.length-1&&!(Ue<Ke[Ye]);Ye++);var qe=Ye?Ke[Ye-1]:0,$e=Ke[Ye],nt={left:(G=="right"?V.right:V.left)-t.rect.left,right:(G=="left"?V.left:V.right)-t.rect.left,top:qe,bottom:$e};return!V.left&&!V.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=pe,nt.rbottom=Oe),nt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function so(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 lo(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ri(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return p&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return p&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ti(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var w=pa(t);n.top+=w,n.bottom+=w}if(r=="line")return n;r||(r="local");var N=lr(t);if(r=="local"?N+=Ui(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:co());var G=H.left+(r=="window"?0:uo());n.left+=G,n.right+=G}return n.top+=N,n.bottom+=N,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var w=e.display.sizer.getBoundingClientRect();r+=w.left,i+=w.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ga(e,t,n,r,i){return r||(r=st(e.doc,t.line)),Fi(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,w){r=r||st(e.doc,t.line),i||(i=_n(e,r));function N(Oe,Ue){var Ke=Ar(e,i,Oe,Ue?"right":"left",w);return Ue?Ke.left=Ke.right:Ke.right=Ke.left,Fi(e,r,Ke,n)}var H=Be(r,e.doc.direction),G=t.ch,V=t.sticky;if(G>=r.text.length?(G=r.text.length,V="before"):G<=0&&(G=0,V="after"),!H)return N(V=="before"?G-1:G,V=="before");function ie(Oe,Ue,Ke){var Ye=H[Ue],qe=Ye.level==1;return N(Ke?Oe-1:Oe,qe!=Ke)}var se=He(H,G,V),ve=We,pe=ie(G,se,V=="before");return ve!=null&&(pe.other=ie(G,ve,V!="before")),pe}function ho(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=Rn(e.display)*t.ch);var r=st(e.doc,t.line),i=lr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var w=Fe(e,t,n);return w.xRel=i,r&&(w.outside=r),w}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),w=r.first+r.size-1;if(i>w)return va(r.first+r.size-1,st(r,w).text.length,null,1,1);t<0&&(t=0);for(var N=st(r,i);;){var H=Ks(e,N,i,t,n),G=ki(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!G)return H;var V=G.find(1);if(V.line==i)return V;N=st(r,i=V.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,w=Je(function(N){return Ar(e,n,N-1).bottom<=r},i,0);return i=Je(function(N){return Ar(e,n,N).top>r},w,i),{begin:w,end:i}}function po(e,t,n,r){n||(n=_n(e,t));var i=Fi(e,t,Ar(e,n,r),"line").top;return mo(e,t,n,i)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=lr(t);var w=_n(e,t),N=pa(t),H=0,G=t.text.length,V=!0,ie=Be(t,e.doc.direction);if(ie){var se=(e.options.lineWrapping?zs:Gs)(e,t,n,w,ie,r,i);V=se.level!=1,H=V?se.from:se.to-1,G=V?se.to:se.from-1}var ve=null,pe=null,Oe=Je(function(dt){var lt=Ar(e,w,dt);return lt.top+=N,lt.bottom+=N,ba(lt,r,i,!1)?(lt.top<=i&&lt.left<=r&&(ve=dt,pe=lt),!0):!1},H,G),Ue,Ke,Ye=!1;if(pe){var qe=r-pe.left<pe.right-r,$e=qe==V;Oe=ve+($e?0:1),Ke=$e?"after":"before",Ue=qe?pe.left:pe.right}else{!V&&(Oe==G||Oe==H)&&Oe++,Ke=Oe==0?"after":Oe==t.text.length?"before":Ar(e,w,Oe-(V?1:0)).bottom+N<=i==V?"after":"before";var nt=br(e,Fe(n,Oe,Ke),"line",t,w);Ue=nt.left,Ye=i<nt.top?-1:i>=nt.bottom?1:0}return Oe=Ce(t.text,Oe,1),va(n,Oe,Ke,Ye,r-Ue)}function Gs(e,t,n,r,i,w,N){var H=Je(function(se){var ve=i[se],pe=ve.level!=1;return ba(br(e,Fe(n,pe?ve.to:ve.from,pe?"before":"after"),"line",t,r),w,N,!0)},0,i.length-1),G=i[H];if(H>0){var V=G.level!=1,ie=br(e,Fe(n,V?G.from:G.to,V?"after":"before"),"line",t,r);ba(ie,w,N,!0)&&ie.top>N&&(G=i[H-1])}return G}function zs(e,t,n,r,i,w,N){var H=mo(e,t,r,N),G=H.begin,V=H.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var ie=null,se=null,ve=0;ve<i.length;ve++){var pe=i[ve];if(pe.from>=V||pe.to<=G)continue;var Oe=pe.level!=1,Ue=Ar(e,r,Oe?Math.min(V,pe.to)-1:Math.max(G,pe.from)).right,Ke=Ue<w?w-Ue+1e9:Ue-w;(!ie||se>Ke)&&(ie=pe,se=Ke)}return ie||(ie=i[i.length-1]),ie.from<G&&(ie={from:G,to:ie.to,level:ie.level}),ie.to>V&&(ie={from:ie.from,to:V,level:ie.level}),ie}var ln;function On(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(o("br"));ln.appendChild(document.createTextNode("x"))}u(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function Rn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");u(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,w=t.gutters.firstChild,N=0;w;w=w.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=w.offsetLeft+w.clientLeft+i,r[H]=w.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=On(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Rn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var w=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(w+=i.widgets[N].height);return n?w+(Math.ceil(i.text.length/r)||1)*t:w+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&cr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&be(t).getAttribute("cm-not-content")=="true")return null;var w,N,H=i.lineSpace.getBoundingClientRect();try{w=t.clientX-H.left,N=t.clientY-H.top}catch(se){return null}var G=ya(e,w,N),V;if(r&&G.xRel>0&&(V=st(e.doc,G.line).text).length==G.ch){var ie=X(V,V.length,e.options.tabSize)-V.length;G=Fe(G.line,Math.max(0,Math.round((w-ro(e.display).left)/Rn(e.display))-ie))}return G}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function tr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)pr&&Wr(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)pr&&Ii(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var w=Bi(e,n,n+r,1);w?(i.view=i.view.slice(w.index),i.viewFrom=w.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Bi(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var H=Bi(e,t,t,-1),G=Bi(e,n,n+r,1);H&&G?(i.view=i.view.slice(0,H.index).concat(It(e,H.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):Gr(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var w=r.view[dn(e,t)];if(w.node==null)return;var N=w.changes||(w.changes=[]);ae(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),w,N=e.display.view;if(!pr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,G=0;G<i;G++)H+=N[G].size;if(H!=t){if(r>0){if(i==N.length-1)return null;w=H+N[i].size-t,i++}else w=H-t;t+=w,n+=w}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(It(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(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 ni(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),w=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var G=H.empty();(G||e.options.showCursorWhenSelecting)&&bo(e,H.head,i),G||Xs(e,H,w)}return r}function bo(e,t,n){var r=br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var w=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));w.style.display="",w.style.left=r.other.left+"px",w.style.top=r.other.top+"px",w.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,w=document.createDocumentFragment(),N=ro(e.display),H=N.left,G=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-N.right,V=i.direction=="ltr";function ie($e,nt,dt,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),w.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
top: `+nt+"px; width: "+(dt==null?G-$e:dt)+`px;
height: `+(lt-nt)+"px"))}function se($e,nt,dt){var lt=st(i,$e),gt=lt.text.length,Ot,Vt;function kt(Bt,ir){return ga(e,Fe($e,Bt),"div",lt,ir)}function dr(Bt,ir,Yt){var Ht=po(e,lt,null,Bt),jt=ir=="ltr"==(Yt=="after")?"left":"right",Nt=Yt=="after"?Ht.begin:Ht.end-(/\s/.test(lt.text.charAt(Ht.end-1))?2:1);return kt(Nt,jt)[jt]}var nr=Be(lt,i.direction);return Xe(nr,nt||0,dt==null?gt:dt,function(Bt,ir,Yt,Ht){var jt=Yt=="ltr",Nt=kt(Bt,jt?"left":"right"),ar=kt(ir-1,jt?"right":"left"),Gn=nt==null&&Bt==0,Qr=dt==null&&ir==gt,Jt=Ht==0,Dr=!nr||Ht==nr.length-1;if(ar.top-Nt.top<=3){var Xt=(V?Gn:Qr)&&Jt,Xa=(V?Qr:Gn)&&Dr,Ir=Xt?H:(jt?Nt:ar).left,pn=Xa?G:(jt?ar:Nt).right;ie(Ir,Nt.top,pn-Ir,Nt.bottom)}else{var gn,er,zn,Ya;jt?(gn=V&&Gn&&Jt?H:Nt.left,er=V?G:dr(Bt,Yt,"before"),zn=V?H:dr(ir,Yt,"after"),Ya=V&&Qr&&Dr?G:ar.right):(gn=V?dr(Bt,Yt,"before"):H,er=!V&&Gn&&Jt?G:Nt.right,zn=!V&&Qr&&Dr?H:ar.left,Ya=V?dr(ir,Yt,"after"):G),ie(gn,Nt.top,er-gn,Nt.bottom),Nt.bottom<ar.top&&ie(H,Nt.bottom,null,ar.top),ie(zn,ar.top,Ya-zn,ar.bottom)}(!Ot||ji(Nt,Ot)<0)&&(Ot=Nt),ji(ar,Ot)<0&&(Ot=ar),(!Vt||ji(Nt,Vt)<0)&&(Vt=Nt),ji(ar,Vt)<0&&(Vt=ar)}),{start:Ot,end:Vt}}var ve=t.from(),pe=t.to();if(ve.line==pe.line)se(ve.line,ve.ch,pe.ch);else{var Oe=st(i,ve.line),Ue=st(i,pe.line),Ke=$t(Oe)==$t(Ue),Ye=se(ve.line,ve.ch,Ke?Oe.text.length+1:null).end,qe=se(pe.line,Ke?0:null,pe.ch).start;Ke&&(Ye.top<qe.top-2?(ie(Ye.right,Ye.top,null,Ye.bottom),ie(H,qe.top,qe.left,qe.bottom)):ie(Ye.right,Ye.top,qe.left-Ye.right,Ye.bottom)),Ye.bottom<qe.top&&ie(H,Ye.bottom,null,qe.top)}n.appendChild(w)}function Sa(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()||Pn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(we(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(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Pn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(we(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],w=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(I&&k<8){var G=i.node.offsetTop+i.node.offsetHeight;N=G-n,n=G}else{var V=i.node.getBoundingClientRect();N=V.bottom-V.top,!w&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var ie=i.line.height-N;if((ie>.005||ie<-.005)&&(cr(i.line,N),To(i.line),i.rest))for(var se=0;se<i.rest.length;se++)To(i.rest[se]);if(H>e.display.sizerWidth){var ve=Math.ceil(H/Rn(e.display));ve>e.display.maxLineLength&&(e.display.maxLineLength=ve,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(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 Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ui(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,w=wr(t,r),N=wr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,G=n.ensure.to.line;H<w?(w=H,N=wr(t,lr(st(t,H))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=N&&(w=wr(t,lr(st(t,G))-e.wrapper.clientHeight),N=G)}return{from:w,to:Math.max(N,w+1)}}function Ys(e,t){if(Me(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&&!x){var w=o("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Ui(e.display))+`px;
height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(w),w.scrollIntoView(i),e.display.lineSpace.removeChild(w)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var w=0;w<5;w++){var N=!1,H=br(e,t),G=!n||n==t?H:br(e,n);i={left:Math.min(H.left,G.left),top:Math.min(H.top,G.top)-r,right:Math.max(H.left,G.left),bottom:Math.max(H.bottom,G.bottom)+r};var V=Ca(e,i),ie=e.doc.scrollTop,se=e.doc.scrollLeft;if(V.scrollTop!=null&&(ai(e,V.scrollTop),Math.abs(e.doc.scrollTop-ie)>1&&(N=!0)),V.scrollLeft!=null&&(cn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-se)>1&&(N=!0)),!N)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=On(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,w=ha(e),N={};t.bottom-t.top>w&&(t.bottom=t.top+w);var H=e.doc.height+fa(n),G=t.top<r,V=t.bottom>H-r;if(t.top<i)N.scrollTop=G?0:t.top;else if(t.bottom>i+w){var ie=Math.min(t.top,(V?H:t.bottom)-w);ie!=i&&(N.scrollTop=ie)}var se=e.options.fixedGutter?0:n.gutters.offsetWidth,ve=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-se,pe=sn(e)-n.gutters.offsetWidth,Oe=t.right-t.left>pe;return Oe&&(t.right=t.left+pe),t.left<10?N.scrollLeft=0:t.left<ve?N.scrollLeft=Math.max(0,t.left+se-(Oe?0:10)):t.right>pe+ve-3&&(N.scrollLeft=t.right+(Oe?0:10)-pe),N}function La(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Mn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(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});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||Da(e,{top:t}),wo(e,t,!0),A&&Da(e),li(e,100)}function wo(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 cn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),xe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),xe(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,I&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.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 w=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+w)+"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}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=l&&!S?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new te,this.disableVert=new te},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),w=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);w!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function kn(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(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 Lo={native:fn,null:si};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Lo[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"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(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},bt(e.curOp)}function mn(e){var t=e.curOp;t&&Ct(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 w=0;w<t.length;w++)nl(t[w]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Rr(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 Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(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&&cn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&kn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&cn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var w=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(w)for(var H=0;H<w.length;++H)w[H].lines.length||we(w[H],"hide");if(N)for(var G=0;G<N.length;++G)N[G].lines.length&&we(N[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&we(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ur(e,t){if(e.curOp)return t();hn(e);try{return t()}finally{mn(e)}}function Gt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hn(e);try{return t.apply(e,arguments)}finally{mn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);hn(this);try{return e.apply(this,arguments)}finally{mn(this)}}}function zt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hn(t);try{return e.apply(this,arguments)}finally{mn(t)}}}function li(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,j(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=je(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(w){if(r.line>=e.display.viewFrom){var N=w.styles,H=w.text.length>e.options.maxHighlightLength?mr(t.mode,r.state):null,G=Ai(e,w,r,!0);H&&(r.state=H),w.styles=G.styles;var V=w.styleClasses,ie=G.classes;ie?w.styleClasses=ie:V&&(w.styleClasses=null);for(var se=!N||N.length!=w.styles.length||V!=ie&&(!V||!ie||V.bgClass!=ie.bgClass||V.textClass!=ie.textClass),ve=0;!se&&ve<N.length;++ve)se=N[ve]!=w.styles[ve];se&&i.push(r.line),w.stateAfter=r.save(),r.nextLine()}else w.text.length<=e.options.maxHighlightLength&&$n(e,w.text,r),w.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var w=0;w<i.length;w++)Kr(e,i[w],"text")})}var Gi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=sn(e),this.force=n,this.dims=Ea(e),this.events=[]};Gi.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)we.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=_();if(!t||!c(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&c(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==_())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&c(document.body,e.anchorNode)&&c(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 Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&vo(e)==0)return!1;Oo(e)&&(Gr(e),t.dims=Ea(e));var i=r.first+r.size,w=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<w&&w-n.viewFrom<20&&(w=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),pr&&(w=Wr(e.doc,w),N=Ii(e.doc,N));var H=w!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,w,N),n.viewOffset=lr(st(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=vo(e);if(!H&&G==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return G>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),G>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!Aa(e,t))break;Wi(e);var i=oi(e);ni(e),kn(e,i),Oa(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 Da(e,t){var n=new Gi(e,t);if(Aa(e,n)){Wi(e),Do(e,n);var r=oi(e);ni(e),kn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,w=r.lineDiv,N=w.firstChild;function H(Oe){var Ue=Oe.nextSibling;return O&&l&&e.display.currentWheelTarget==Oe?Oe.style.display="none":Oe.parentNode.removeChild(Oe),Ue}for(var G=r.view,V=r.viewFrom,ie=0;ie<G.length;ie++){var se=G[ie];if(!se.hidden)if(!se.node||se.node.parentNode!=w){var ve=Ns(e,se,V,n);w.insertBefore(ve,N)}else{for(;N!=se.node;)N=H(N);var pe=i&&t!=null&&t<=V&&se.lineNumber;se.changes&&(ae(se.changes,"gutter")>-1&&(pe=!1),Ja(e,se,V,n)),pe&&(f(se.lineNumber),se.lineNumber.appendChild(document.createTextNode(yn(e.options,V)))),N=se.node.nextSibling}V+=se.size}for(;N;)N=H(N)}function _a(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function _o(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,w=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=w),n[N].gutterBackground&&(n[N].gutterBackground.style.left=w));var H=n[N].alignable;if(H)for(var G=0;G<H.length;G++)H[G].style.left=w}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=yn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),w=i.firstChild.offsetWidth,N=i.offsetWidth-w;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(w,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",_a(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var w=e[i],N=null;if(typeof w!="string"&&(N=w.style,w=w.className),w=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:w,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],w=i.className,N=i.style,H=t.appendChild(o("div",null,"CodeMirror-gutter "+w));N&&(H.style.cssText=N),w=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",_a(e)}function ui(e){Ro(e.display),tr(e),_o(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=E("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=E("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var w=E("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[w],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+ce+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),I&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!O&&!(A&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Ro(i),n.init(i)}var zi=0,fr=null;I?fr=-.53:A?fr=15:p?fr=-.7:R&&(fr=-1/3);function Po(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=Po(e);return t.x*=fr,t.y*=fr,t}function Mo(e,t){var n=Po(t),r=n.x,i=n.y,w=e.display,N=w.scroller,H=N.scrollWidth>N.clientWidth,G=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&G))return;if(i&&l&&O){e:for(var V=t.target,ie=w.view;V!=N;V=V.parentNode)for(var se=0;se<ie.length;se++)if(ie[se].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!A&&!y&&fr!=null){i&&G&&ai(e,Math.max(0,N.scrollTop+i*fr)),cn(e,Math.max(0,N.scrollLeft+r*fr)),(!i||i&&G)&&Y(t),w.wheelStartX=null;return}if(i&&fr!=null){var ve=i*fr,pe=e.doc.scrollTop,Oe=pe+w.wrapper.clientHeight;ve<0?pe=Math.max(0,pe+ve-50):Oe=Math.min(e.doc.height,Oe+ve+50),Da(e,{top:pe,bottom:Oe})}zi<20&&(w.wheelStartX==null?(w.wheelStartX=N.scrollLeft,w.wheelStartY=N.scrollTop,w.wheelDX=r,w.wheelDY=i,setTimeout(function(){if(w.wheelStartX==null)return;var Ue=N.scrollLeft-w.wheelStartX,Ke=N.scrollTop-w.wheelStartY,Ye=Ke&&w.wheelDY&&Ke/w.wheelDY||Ue&&w.wheelDX&&Ue/w.wheelDX;if(w.wheelStartX=w.wheelStartY=null,!Ye)return;fr=(fr*zi+Ye)/(zi+1),++zi},200)):(w.wheelDX+=r,w.wheelDY+=i))}var hr=function(e,t){this.ranges=e,this.primIndex=t};hr.prototype.primary=function(){return this.ranges[this.primIndex]},hr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(en(this.ranges[t].anchor),en(this.ranges[t].head));return new hr(e,this.primIndex)},hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},hr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return bn(this.anchor,this.head)},wt.prototype.to=function(){return tn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(ve,pe){return ft(ve.from(),pe.from())}),n=ae(t,i);for(var w=1;w<t.length;w++){var N=t[w],H=t[w-1],G=ft(H.to(),N.from());if(r&&!N.empty()?G>0:G>=0){var V=bn(H.from(),N.from()),ie=tn(H.to(),N.to()),se=H.empty()?N.from()==N.head:H.from()==H.head;w<=n&&--n,t.splice(--w,2,new wt(se?ie:V,se?V:ie))}}return new hr(t,n)}function zr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Fe(e.from.line+e.text.length-1,me(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Fe(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(ko(i.anchor,t),ko(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),w=i,N=0;N<t.length;N++){var H=t[N],G=Io(H.from,i,w),V=Io(Vr(H),i,w);if(i=H.to,w=V,n=="around"){var ie=e.sel.ranges[N],se=ft(ie.head,ie.anchor)<0;r[N]=new wt(se?V:G,se?G:V)}else r[N]=new wt(G,G)}return new hr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Tr(e.options,e.doc.modeOption),di(e)}function di(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,li(e,100),e.state.modeGen++,e.curOp&&tr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&me(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,r){function i(qe){return n?n[qe]:null}function w(qe,$e,nt){la(qe,$e,nt,r),Dt(qe,"change",qe,t)}function N(qe,$e){for(var nt=[],dt=qe;dt<$e;++dt)nt.push(new Hr(V[dt],i(dt),r));return nt}var H=t.from,G=t.to,V=t.text,ie=st(e,H.line),se=st(e,G.line),ve=me(V),pe=i(V.length-1),Oe=G.line-H.line;if(t.full)e.insert(0,N(0,V.length)),e.remove(V.length,e.size-V.length);else if(No(e,t)){var Ue=N(0,V.length-1);w(se,se.text,pe),Oe&&e.remove(H.line,Oe),Ue.length&&e.insert(H.line,Ue)}else if(ie==se)if(V.length==1)w(ie,ie.text.slice(0,H.ch)+ve+ie.text.slice(G.ch),pe);else{var Ke=N(1,V.length-1);Ke.push(new Hr(ve+ie.text.slice(G.ch),pe,r)),w(ie,ie.text.slice(0,H.ch)+V[0],i(0)),e.insert(H.line+1,Ke)}else if(V.length==1)w(ie,ie.text.slice(0,H.ch)+V[0]+se.text.slice(G.ch),i(0)),e.remove(H.line+1,Oe);else{w(ie,ie.text.slice(0,H.ch)+V[0],i(0)),w(se,ve+se.text.slice(G.ch),pe);var Ye=N(1,V.length-1);Oe>1&&e.remove(H.line+1,Oe-1),e.insert(H.line+1,Ye)}Dt(e,"change",e,t)}function Xr(e,t,n){function r(i,w,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var G=i.linked[H];if(G.doc==w)continue;var V=N&&G.sharedHist;if(n&&!V)continue;t(G.doc,V),r(G.doc,i,V)}}r(e,null,!0)}function Uo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Ma(e),Fo(e),e.options.lineWrapping||Rr(e),e.options.mode=t.modeOption,tr(e)}function Fo(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){Fo(e),tr(e)})}function Vi(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 Ia(e,t){var n={from:en(t.from),to:Vr(t),text:Sr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=me(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(e.done),me(e.done);if(e.done.length&&!me(e.done).ranges)return me(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),me(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var w=+new Date,N,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>w-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))H=me(N.changes),ft(t.from,t.to)==0&&ft(t.from,H.to)==0?H.to=Vr(t):N.changes.push(Ia(e,t));else{var G=me(i.done);for((!G||!G.ranges)&&Xi(e.sel,i.done),N={changes:[Ia(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=w,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||we(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,w=r&&r.origin;n==i.lastSelOp||w&&i.lastSelOrigin==w&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==w||pl(e,w,me(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=w,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=me(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],w=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[w]=N.markedSpans),++w})}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 Ho(e,t){var n=yl(e,t),r=Or(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var w=n[i],N=r[i];if(w&&N){e:for(var H=0;H<N.length;++H){for(var G=N[H],V=0;V<w.length;++V)if(w[V].marker==G.marker)continue e;w.push(G)}}else N&&(n[i]=N)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var w=e[i];if(w.ranges){r.push(n?hr.prototype.deepCopy.call(w):w);continue}var N=w.changes,H=[];r.push({changes:H});for(var G=0;G<N.length;++G){var V=N[G],ie=void 0;if(H.push({from:V.from,to:V.to,text:V.text}),t)for(var se in V)(ie=se.match(/^spans_(\d+)$/))&&(ae(t,Number(ie[1]))>-1&&(me(H)[se]=V[se],delete V[se]))}}return r}function Na(e,t,n,r){if(r){var i=e.anchor;if(n){var w=ft(t,i)<0;w!=ft(n,i)<0?(i=t,t=n):w!=ft(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new hr([Na(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),w=0;w<e.sel.ranges.length;w++)r[w]=Na(e.sel.ranges[w],t[w],null,i);var N=Er(e.cm,r,e.sel.primIndex);Qt(e,N,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qt(e,Er(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Qt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var w=0;w<i.length;w++)this.ranges[w]=new wt(mt(e,i[w].anchor),mt(e,i[w].head))},origin:n&&n.origin};return we(e,"beforeSelectionChange",e,r),e.cm&&we(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=me(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Qt(e,t,n)}function Qt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Mn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,fe(e.cm)),Dt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,w=0;w<t.ranges.length;w++){var N=t.ranges[w],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[w],G=Qi(e,N.anchor,H&&H.anchor,n,r),V=Qi(e,N.head,H&&H.head,n,r);(i||G!=N.anchor||V!=N.head)&&(i||(i=t.ranges.slice(0,w)),i[w]=new wt(G,V))}return i?Er(e.cm,i,t.primIndex):t}function Nn(e,t,n,r,i){var w=st(e,t.line);if(w.markedSpans)for(var N=0;N<w.markedSpans.length;++N){var H=w.markedSpans[N],G=H.marker,V="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,ie="selectRight"in G?!G.selectRight:G.inclusiveRight;if((H.from==null||(V?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(ie?H.to>=t.ch:H.to>t.ch))){if(i&&(we(G,"beforeCursorEnter"),G.explicitlyCleared))if(w.markedSpans){--N;continue}else break;if(!G.atomic)continue;if(n){var se=G.find(r<0?1:-1),ve=void 0;if((r<0?ie:V)&&(se=$o(e,se,-r,se&&se.line==t.line?w:null)),se&&se.line==t.line&&(ve=ft(se,n))&&(r<0?ve<0:ve>0))return Nn(e,se,t,r,i)}var pe=G.find(r<0?-1:1);return(r<0?V:ie)&&(pe=$o(e,pe,r,pe.line==t.line?w:null)),pe?Nn(e,pe,t,r,i):null}}return t}function Qi(e,t,n,r,i){var w=r||1,N=Nn(e,t,n,w,i)||!i&&Nn(e,t,n,w,!0)||Nn(e,t,n,-w,i)||!i&&Nn(e,t,n,-w,!0);return N||(e.cantEdit=!0,Fe(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?mt(e,Fe(t.line-1)):null:n>0&&t.ch==(r||st(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Qo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),ge)}function Jo(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,w,N,H){i&&(r.from=mt(e,i)),w&&(r.to=mt(e,w)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),we(e,"beforeChange",e,r),e.cm&&we(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 Un(e,t,n){if(e.cm){if(!e.cm.curOp)return Gt(e.cm,Un)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ri&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Or(e,t));var r=[];Xr(e,function(i,w){!w&&ae(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Or(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,w,N=e.sel,H=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,V=0;V<H.length&&!(w=H[V],n?w.ranges&&!w.equals(e.sel):!w.ranges);V++);if(V==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(w=H.pop(),w.ranges){if(Xi(w,G),n&&!w.equals(e.sel)){Qt(e,w,{clearRedo:!1});return}N=w}else if(r){H.push(w);return}else break;var ie=[];Xi(N,G),G.push({changes:ie,generation:i.generation}),i.generation=w.generation||++i.maxGeneration;for(var se=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),ve=function(Ue){var Ke=w.changes[Ue];if(Ke.origin=t,se&&!Jo(e,Ke,!1))return H.length=0,{};ie.push(Ia(e,Ke));var Ye=Ue?Pa(e,Ke):me(H);ci(e,Ke,Ye,Ho(e,Ke)),!Ue&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Vr(Ke)});var qe=[];Xr(e,function($e,nt){!nt&&ae(qe,$e.history)==-1&&(rs($e.history,Ke),qe.push($e.history)),ci($e,Ke,null,Ho($e,Ke))})},pe=w.changes.length-1;pe>=0;--pe){var Oe=ve(pe);if(Oe)return Oe.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(de(e.sel.ranges,function(i){return new wt(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return Gt(e.cm,ci)(e,t,n,r);if(t.to.line<e.first){qo(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);qo(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[me(t.text)],origin:t.origin}}var w=e.lastLine();t.to.line>w&&(t={from:t.from,to:Fe(w,st(e,w).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):ka(e,t,r),$i(e,n,ge),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,w=t.from,N=t.to,H=!1,G=w.line;e.options.lineWrapping||(G=St($t(st(r,w.line))),r.iter(G,N.line+1,function(pe){if(pe==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&fe(e),ka(r,t,n,go(e)),e.options.lineWrapping||(r.iter(G,w.line+t.text.length,function(pe){var Oe=Dn(pe);Oe>i.maxLineLength&&(i.maxLine=pe,i.maxLineLength=Oe,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),Oi(r,w.line),li(e,400);var V=t.text.length-(N.line-w.line)-1;t.full?tr(e):w.line==N.line&&t.text.length==1&&!No(e.doc,t)?Kr(e,w.line,"text"):tr(e,w.line,N.line+1,V);var ie=le(e,"changes"),se=le(e,"change");if(se||ie){var ve={from:w,to:N,text:t.text,removed:t.removed,origin:t.origin};se&&Dt(e,"change",e,ve),ie&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ve)}e.display.selForContextMenu=null}function Fn(e,t,n,r,i){var w;r||(r=n),ft(r,n)<0&&(w=[r,n],n=w[0],r=w[1]),typeof t=="string"&&(t=e.splitLines(t)),Un(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var w=e[i],N=!0;if(w.ranges){w.copied||(w=e[i]=w.deepCopy(),w.copied=!0);for(var H=0;H<w.ranges.length;H++)es(w.ranges[H].anchor,t,n,r),es(w.ranges[H].head,t,n,r);continue}for(var G=0;G<w.changes.length;++G){var V=w.changes[G];if(n<V.from.line)V.from=Fe(V.from.line+r,V.from.ch),V.to=Fe(V.to.line+r,V.to.ch);else if(t<=V.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function fi(e,t,n,r){var i=t,w=t;return typeof t=="number"?w=st(e,Xn(e,t)):i=St(t),i==null?null:(r(w,i)&&e.cm&&Kr(e.cm,i,n),w)}function hi(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}hi.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,ua(i),Dt(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 mi(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}mi.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 w=Math.min(t,i-e),N=r.height;if(r.removeInner(e,w),this.height-=N-r.height,i==w&&(this.children.splice(n--,1),r.parent=null),(t-=w)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var H=[];this.collapse(H),this.children=[new hi(H)],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],w=i.chunkSize();if(e<=w){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,H=N;H<i.lines.length;){var G=new hi(i.lines.slice(H,H+=25));i.height-=G.height,this.children.splice(++r,0,G),G.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=w}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new mi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ae(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new mi(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],w=i.chunkSize();if(e<w){var N=Math.min(t,w-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=w}}};var pi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};pi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=St(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 w=ti(this);cr(n,Math.max(0,n.height-w)),e&&(ur(e,function(){ns(e,n,-w),Kr(e,r,"widget")}),Dt(e,"lineWidgetCleared",e,this,r))},pi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ti(this)-t;if(!i)return;yr(this.doc,r)||cr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Dt(n,"lineWidgetChanged",n,e,St(r))})},ue(pi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&La(e,n)}function xl(e,t,n,r){var i=new pi(e,n,r),w=e.cm;return w&&i.noHScroll&&(w.display.alignWidgets=!0),fi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,w&&!yr(e,N)){var G=lr(N)<e.scrollTop;cr(N,N.height+ti(i)),G&&La(w,i.height),w.curOp.forceUpdate=!0}return!0}),w&&Dt(w,"lineWidgetAdded",w,i,typeof t=="number"?t:St(t)),i}var is=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hn(e),le(this,"clear")){var n=this.find();n&&Dt(this,"clear",n.from,n.to)}for(var r=null,i=null,w=0;w<this.lines.length;++w){var N=this.lines[w],H=Ur(N.markedSpans,this);e&&!this.collapsed?Kr(e,St(N),"text"):e&&(H.to!=null&&(i=St(N)),H.from!=null&&(r=St(N))),N.markedSpans=Fr(N.markedSpans,H),H.from==null&&this.collapsed&&!yr(this.doc,N)&&e&&cr(N,On(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var V=$t(this.lines[G]),ie=Dn(V);ie>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=ie,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Dt(e,"markerCleared",e,this,r,i),t&&mn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var w=this.lines[i],N=Ur(w.markedSpans,this);if(N.from!=null&&(n=Fe(t?w:St(w),N.from),e==-1))return n;if(N.to!=null&&(r=Fe(t?w:St(w),N.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ur(r,function(){var i=t.line,w=St(t.line),N=ma(r,w);if(N&&(so(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var G=ti(n)-H;G&&cr(i,i.height+G)}Dt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ae(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Yr);function Bn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Gt(e.cm,Bn)(e,t,n,r,i);var w=new Yr(e,i),N=ft(t,n);if(r&&F(r,w,!1),N>0||N==0&&w.clearWhenEmpty!==!1)return w;if(w.replacedWith&&(w.collapsed=!0,w.widgetNode=E("span",[w.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||w.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(w.widgetNode.insertLeft=!0)),w.collapsed){if(qn(e,t.line,t,n,w)||t.line!=n.line&&qn(e,n.line,t,n,w))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pi()}w.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,G=e.cm,V;if(e.iter(H,n.line+1,function(se){G&&w.collapsed&&!G.options.lineWrapping&&$t(se)==G.display.maxLine&&(V=!0),w.collapsed&&H!=t.line&&cr(se,0),Br(se,new xn(w,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),w.collapsed&&e.iter(t.line,n.line+1,function(se){yr(e,se)&&cr(se,0)}),w.clearOnEnter&&xe(w,"beforeCursorEnter",function(){return w.clear()}),w.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),w.collapsed&&(w.id=++is,w.atomic=!0),G){if(V&&(G.curOp.updateMaxLine=!0),w.collapsed)tr(G,t.line,n.line+1);else if(w.className||w.startStyle||w.endStyle||w.css||w.attributes||w.title)for(var ie=t.line;ie<=n.line;ie++)Kr(G,ie,"text");w.atomic&&Xo(G.doc),Dt(G,"markerAdded",G,w)}return w}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};gi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Dt(this,"clear")},gi.prototype.find=function(e,t){return this.primary.find(e,t)},ue(gi);function Tl(e,t,n,r,i){r=F(r),r.shared=!1;var w=[Bn(e,t,n,r,i)],N=w[0],H=r.widgetNode;return Xr(e,function(G){H&&(r.widgetNode=H.cloneNode(!0)),w.push(Bn(G,mt(G,t),mt(G,n),r,i));for(var V=0;V<G.linked.length;++V)if(G.linked[V].isParent)return;N=me(w)}),new gi(w,N)}function as(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),w=e.clipPos(i.from),N=e.clipPos(i.to);if(ft(w,N)){var H=Bn(e,w,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],w=[i.primary.doc];Xr(i.primary.doc,function(G){return w.push(G)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];ae(w,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),mi.call(this,[new hi([new Hr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var w=Fe(n,0);this.sel=zr(w),this.history=new Vi(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)),ka(this,{from:w,to:w,text:e}),Qt(this,zr(w),ge)};rr.prototype=Ie(mi.prototype,{constructor:rr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:zt(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;Un(this,{from:t,to:Fe(n,st(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ii(this.cm,0,0),Qt(this,zr(t),ge)}),replaceRange:function(e,t,n,r){t=mt(this,t),n=n?mt(this,n):t,Fn(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(this,mt(this,e),mt(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(Zr(this,e))return st(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=st(this,e)),$t(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(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:zt(function(e,t,n){Go(this,mt(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:zt(function(e,t,n){Go(this,mt(this,e),mt(this,t||e),n)}),extendSelection:zt(function(e,t,n){Yi(this,mt(this,e),t&&mt(this,t),n)}),extendSelections:zt(function(e,t){Ko(this,Li(this,e),t)}),extendSelectionsBy:zt(function(e,t){var n=de(this.sel.ranges,e);Ko(this,Li(this,n),t)}),setSelections:zt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(mt(this,e[i].anchor),mt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qt(this,Er(this.cm,r,t),n)}),addSelection:zt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(mt(this,e),mt(this,t||e))),Qt(this,Er(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=Sr(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=Sr(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:zt(function(e,t,n){for(var r=[],i=this.sel,w=0;w<i.ranges.length;w++){var N=i.ranges[w];r[w]={from:N.from(),to:N.to(),text:this.splitLines(e[w]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),G=r.length-1;G>=0;G--)Un(this,r[G]);H?zo(this,H):this.cm&&Mn(this.cm)}),undo:zt(function(){Ji(this,"undo")}),redo:zt(function(){Ji(this,"redo")}),undoSelection:zt(function(){Ji(this,"undo",!0)}),redoSelection:zt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=In(e.done.slice(0),null,!0),t.undone=In(e.undone.slice(0),null,!0)},setGutterMarker:zt(function(e,t,n){return fi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ke(i)&&(r.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ke(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=st(this,e),!e)return null}else if(t=St(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:zt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(T(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:zt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",w=r[i];if(w)if(n==null)r[i]=null;else{var N=w.match(T(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=w.slice(0,N.index)+(!N.index||H==w.length?"":" ")+w.slice(H)||null}else return!1;return!0})}),addLineWidget:zt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(this,mt(this,e),mt(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=mt(this,e),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=mt(this,e);var t=[],n=st(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=mt(this,e),t=mt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(w){var N=w.markedSpans;if(N)for(var H=0;H<N.length;H++){var G=N[H];!(G.to!=null&&i==e.line&&e.ch>=G.to||G.from==null&&i!=e.line||G.from!=null&&i==t.line&&G.from>=t.ch)&&(!n||n(G.marker))&&r.push(G.marker.parent||G.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 w=i.text.length+r;if(w>e)return t=e,!0;e-=w,++n}),mt(this,Fe(n,t))},indexFromPos:function(e){e=mt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(Vn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(Vn(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,as(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(as(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=In(this.history.done,r),e.history.undone=In(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):at(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:zt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var os=0;function Ll(e){var t=this;if(ss(t),Me(t,e)||Mr(t.display,e))return;Y(e),I&&(os=+new Date);var n=un(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,w=Array(i),N=0,H=function(){++N==i&&Gt(t,function(){n=mt(t.doc,n);var pe={from:n,to:n,text:t.doc.splitLines(w.filter(function(Oe){return Oe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Un(t.doc,pe),zo(t.doc,zr(mt(t.doc,n),mt(t.doc,Vr(pe))))})()},G=function(pe,Oe){if(t.options.allowDropFileTypes&&ae(t.options.allowDropFileTypes,pe.type)==-1){H();return}var Ue=new FileReader;Ue.onerror=function(){return H()},Ue.onload=function(){var Ke=Ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){H();return}w[Oe]=Ke,H()},Ue.readAsText(pe)},V=0;V<r.length;V++)G(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 ie=e.dataTransfer.getData("Text");if(ie){var se;if(t.state.draggingText&&!t.state.draggingText.copy&&(se=t.listSelections()),$i(t.doc,zr(n,n)),se)for(var ve=0;ve<se.length;++ve)Fn(t.doc,"",se[ve].anchor,se[ve].head,"drag");t.replaceSelection(ie,"around","paste"),t.display.input.focus()}}catch(pe){}}}function Al(e,t){if(I&&(!e.state.draggingText||+new Date-os<100)){oe(t);return}if(Me(e,t)||Mr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",y&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),y&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=un(e,t);if(!n)return;var r=document.createDocumentFragment();bo(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(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 w=0;w<n.length;w++)e(n[w])})}var us=!1;function _l(){if(us)return;Ol(),us=!0}function Ol(){var e;xe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),xe(window,"blur",function(){return ls(Pn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},vi=0;vi<10;vi++)$r[vi+48]=$r[vi+96]=String(vi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var yi=1;yi<=12;yi++)$r[yi+111]=$r[yi+63235]="F"+yi;var kr={};kr.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"},kr.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"},kr.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"},kr.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"]},kr.default=l?kr.macDefault:kr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,w,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))w=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),w&&(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=de(n.split(" "),Pl),w=0;w<i.length;w++){var N=void 0,H=void 0;w==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,w+1).join(" "),N="...");var G=t[H];if(!G)t[H]=N;else if(G!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var V in t)e[V]=t[V];return e}function jn(e,t,n,r){t=qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jn(e,t.fallthrough,n,r);for(var w=0;w<t.fallthrough.length;w++){var N=jn(e,t.fallthrough[w],n,r);if(N)return N}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(y&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function qi(e){return typeof e=="string"?kr[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var w=t(n[i]);r.length&&ft(w.from,me(r).to)<=0;){var N=r.pop();if(ft(N.from,w.from)<0){w.from=N.from;break}}r.push(w)}ur(e,function(){for(var H=r.length-1;H>=0;H--)Fn(e.doc,"",r[H].from,r[H].to,"+delete");Mn(e)})}function Fa(e,t,n){var r=Ce(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var w=Be(n,t.doc.direction);if(w){var N=i<0?me(w):w[0],H=i<0==(N.level==1),G=H?"after":"before",V;if(N.level>0||t.doc.direction=="rtl"){var ie=_n(t,n);V=i<0?n.text.length-1:0;var se=Ar(t,ie,V).top;V=Je(function(ve){return Ar(t,ie,ve).top==se},i<0==(N.level==1)?N.from:N.to-1,V),G=="before"&&(V=Fa(n,V,1))}else V=i<0?N.to:N.from;return new Fe(r,V,G)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Be(t,e.doc.direction);if(!i)return Ba(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 w=He(i,n.ch,n.sticky),N=i[w];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Ba(t,n,r);var H=function(Ye,qe){return Fa(t,Ye instanceof Fe?Ye.ch:Ye,qe)},G,V=function(Ye){return e.options.lineWrapping?(G=G||_n(e,t),po(e,t,G,Ye)):{begin:0,end:t.text.length}},ie=V(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var se=N.level==1==r<0,ve=H(n,se?1:-1);if(ve!=null&&(se?ve<=N.to&&ve<=ie.end:ve>=N.from&&ve>=ie.begin)){var pe=se?"before":"after";return new Fe(n.line,ve,pe)}}var Oe=function(Ye,qe,$e){for(var nt=function(Ot,Vt){return Vt?new Fe(n.line,H(Ot,1),"before"):new Fe(n.line,Ot,"after")};Ye>=0&&Ye<i.length;Ye+=qe){var dt=i[Ye],lt=qe>0==(dt.level!=1),gt=lt?$e.begin:H($e.end,-1);if(dt.from<=gt&&gt<dt.to)return nt(gt,lt);if(gt=lt?dt.from:H(dt.to,-1),$e.begin<=gt&&gt<$e.end)return nt(gt,lt)}},Ue=Oe(w+r,r,ie);if(Ue)return Ue;var Ke=r>0?ie.end:H(ie.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Ue=Oe(r>0?0:i.length-1,r,V(Ke)),Ue)?Ue:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ge)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=st(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Wn(e,function(t){return{from:Fe(t.from().line,0),to:mt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Wn(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 Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(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")},ee)},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")},ee)},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/)?ms(e,t.head):r},ee)},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 w=n[i].from(),N=X(e.getLine(w.line),w.ch,r);t.push(ne(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,w=st(e.doc,i.line).text;if(w){if(i.ch==w.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(w.charAt(i.ch-1)+w.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=st(e.doc,i.line-1).text;N&&(i=new Fe(i.line,1),e.replaceRange(w.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Fe(i.line-1,N.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(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);Mn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=st(e.doc,t),r=$t(n);return r!=n&&(t=St(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=st(e.doc,t),r=jr(n);return r!=n&&(t=St(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=st(e.doc,n.line),i=Be(r,e.doc.direction);if(!i||i[0].level==0){var w=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=w&&t.ch;return Fe(n.line,N?0:w,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=bi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=jn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&jn(t,e.options.extraKeys,n,e)||jn(t,e.options.keyMap,n,e)}var Ul=new te;function Ei(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Dt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ei(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Ei(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Ei(e,n,t,function(r){return ea(e,r)}):!1}function Fl(e,t,n){return Ei(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=_(),Me(t,e))return;I&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);y&&(Wa=r?n:null,!r&&n==88&&!xt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!l&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(m(t,"CodeMirror-crosshair"),Ve(document,"keyup",n),Ve(document,"mouseover",n))}xe(document,"keyup",n),xe(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Me(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Mr(t.display,e)||Me(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(y&&n==Wa){Wa=null,Y(e);return}if(y&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var xi,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(xi=Ti=null,"triple"):xi&&xi.compare(n,e,t)?(Ti=new Ha(n,e,t),xi=null,"double"):(xi=new Ha(n,e,t),Ti=null,"single")}function Es(e){var t=this,n=t.display;if(Me(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Mr(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=Le(e),w=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,w,e))return;i==1?r?Gl(t,r,w,e):be(e)==n.scroller&&Y(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var w="Click";return r=="double"?w="Double"+w:r=="triple"&&(w="Triple"+w),w=(t==1?"Left":t==2?"Middle":"Right")+w,Ei(e,cs(w,i),i,function(N){if(typeof N=="string"&&(N=bi[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var w=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=w?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){I?setTimeout(j(Eo,e),0):e.curOp.focus=_();var i=Kl(e,n,r),w=e.doc.sel,N;e.options.dragDrop&&_e&&!e.isReadOnly()&&n=="single"&&(N=w.contains(t))>-1&&(ft((N=w.ranges[N]).from(),t)<0||t.xRel>0)&&(ft(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,w=!1,N=Gt(e,function(V){O&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ve(i.wrapper.ownerDocument,"mouseup",N),Ve(i.wrapper.ownerDocument,"mousemove",H),Ve(i.scroller,"dragstart",G),Ve(i.scroller,"drop",N),w||(Y(V),r.addNew||Yi(e.doc,n,null,null,r.extend),O&&!R||I&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(V){w=w||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},G=function(){return w=!0};O&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),xe(i.wrapper.ownerDocument,"mouseup",N),xe(i.wrapper.ownerDocument,"mousemove",H),xe(i.scroller,"dragstart",G),xe(i.scroller,"drop",N),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Fe(t.line,0),mt(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,w=e.doc;Y(t);var N,H,G=w.sel,V=G.ranges;if(r.addNew&&!r.extend?(H=w.sel.contains(n),H>-1?N=V[H]:N=new wt(n,n)):(N=w.sel.primary(),H=w.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new wt(n,n)),n=un(e,t,!0,!0),H=-1;else{var ie=xs(e,n,r.unit);r.extend?N=Na(N,ie.anchor,ie.head,r.extend):N=ie}r.addNew?H==-1?(H=V.length,Qt(w,Er(e,V.concat([N]),H),{scroll:!1,origin:"*mouse"})):V.length>1&&V[H].empty()&&r.unit=="char"&&!r.extend?(Qt(w,Er(e,V.slice(0,H).concat(V.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),G=w.sel):Ua(w,H,N,he):(H=0,Qt(w,new hr([N],0),he),G=w.sel);var se=n;function ve($e){if(ft(se,$e)==0)return;if(se=$e,r.unit=="rectangle"){for(var nt=[],dt=e.options.tabSize,lt=X(st(w,n.line).text,n.ch,dt),gt=X(st(w,$e.line).text,$e.ch,dt),Ot=Math.min(lt,gt),Vt=Math.max(lt,gt),kt=Math.min(n.line,$e.line),dr=Math.min(e.lastLine(),Math.max(n.line,$e.line));kt<=dr;kt++){var nr=st(w,kt).text,Bt=re(nr,Ot,dt);Ot==Vt?nt.push(new wt(Fe(kt,Bt),Fe(kt,Bt))):nr.length>Bt&&nt.push(new wt(Fe(kt,Bt),Fe(kt,re(nr,Vt,dt))))}nt.length||nt.push(new wt(n,n)),Qt(w,Er(e,G.ranges.slice(0,H).concat(nt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var ir=N,Yt=xs(e,$e,r.unit),Ht=ir.anchor,jt;ft(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Nt=G.ranges.slice(0);Nt[H]=Xl(e,new wt(mt(w,Ht),jt)),Qt(w,Er(e,Nt,H),he)}}var pe=i.wrapper.getBoundingClientRect(),Oe=0;function Ue($e){var nt=++Oe,dt=un(e,$e,!0,r.unit=="rectangle");if(!dt)return;if(ft(dt,se)!=0){e.curOp.focus=_(),ve(dt);var lt=Hi(i,w);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(Gt(e,function(){Oe==nt&&Ue($e)}),150)}else{var gt=$e.clientY<pe.top?-20:$e.clientY>pe.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Oe!=nt)return;i.scroller.scrollTop+=gt,Ue($e)}),50)}}function Ke($e){e.state.selectingText=!1,Oe=Infinity,$e&&(Y($e),i.input.focus()),Ve(i.wrapper.ownerDocument,"mousemove",Ye),Ve(i.wrapper.ownerDocument,"mouseup",qe),w.history.lastSelOrigin=null}var Ye=Gt(e,function($e){$e.buttons===0||!Le($e)?Ke($e):Ue($e)}),qe=Gt(e,Ke);e.state.selectingText=qe,xe(i.wrapper.ownerDocument,"mousemove",Ye),xe(i.wrapper.ownerDocument,"mouseup",qe)}function Xl(e,t){var n=t.anchor,r=t.head,i=st(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var w=Be(i);if(!w)return t;var N=He(w,n.ch,n.sticky),H=w[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var G=N+(H.from==n.ch==(H.level!=1)?0:1);if(G==0||G==w.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ie=He(w,r.ch,r.sticky),se=ie-N||(r.ch-n.ch)*(H.level==1?-1:1);ie==G-1||ie==G?V=se<0:V=se>0}var ve=w[G+(V?-1:0)],pe=V==(ve.level==1),Oe=pe?ve.from:ve.to,Ue=pe?"after":"before";return n.ch==Oe&&n.sticky==Ue?t:new wt(new Fe(n.line,Oe,Ue),r)}function Ts(e,t,n,r){var i,w;if(t.touches)i=t.touches[0].clientX,w=t.touches[0].clientY;else try{i=t.clientX,w=t.clientY}catch(ve){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var N=e.display,H=N.lineDiv.getBoundingClientRect();if(w>H.bottom||!le(e,n))return q(t);w-=H.top-N.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var V=N.gutters.childNodes[G];if(V&&V.getBoundingClientRect().right>=i){var ie=wr(e.doc,w),se=e.display.gutterSpecs[G];return we(e,n,e,ie,se.className,t),q(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(Mr(e.display,t)||Yl(e,t))return;if(Me(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,w,N){e.defaults[r]=i,w&&(t[r]=N?function(H,G,V){V!=Hn&&w(H,G,V)}:w)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var w=[],N=r.doc.first;r.doc.iter(function(G){for(var V=0;;){var ie=G.text.indexOf(i,V);if(ie==-1)break;V=ie+i.length,w.push(Fe(N,ie))}N++});for(var H=w.length-1;H>=0;H--)Fn(r.doc,i,w[H],Fe(w[H].line,w[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,w){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),w!=Hn&&r.refresh()}),n("specialCharPlaceholder",ot,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,w){var N=qi(i),H=w!=Hn&&qi(w);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),ui(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return kn(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),kn(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=Ra(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Pn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!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,di,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Hn;if(!t!=!r){var i=e.display.dragFunctions,w=t?xe:Ve;w(e.display.scroller,"dragstart",i.start),w(e.display.scroller,"dragenter",i.enter),w(e.display.scroller,"dragover",i.over),w(e.display.scroller,"dragleave",i.leave),w(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(m(e.display.wrapper,"CodeMirror-wrap"),Rr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return kn(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?F(t):{},F(Cs,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Pt.inputStyles[t.inputStyle](this),w=this.display=new dl(e,r,i,t);w.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(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 te,keySeq:null,specialChars:null},t.autofocus&&!a&&w.input.focus(),I&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),hn(this),this.curOp.forceUpdate=!0,Uo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Pn(this);for(var N in ta)ta.hasOwnProperty(N)&&ta[N](this,t[N],Hn);Oo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ga.length;++H)Ga[H](this);mn(this),O&&t.lineWrapping&&getComputedStyle(w.lineDiv).textRendering=="optimizelegibility"&&(w.lineDiv.style.textRendering="auto")}Pt.defaults=Cs,Pt.optionHandlers=ta;function Zl(e){var t=e.display;xe(t.scroller,"mousedown",Gt(e,Es)),I&&k<11?xe(t.scroller,"dblclick",Gt(e,function(G){if(Me(e,G))return;var V=un(e,G);if(!V||Ka(e,G)||Mr(e.display,G))return;Y(G);var ie=e.findWordAt(V);Yi(e.doc,ie.anchor,ie.head)})):xe(t.scroller,"dblclick",function(G){return Me(e,G)||Y(G)}),xe(t.scroller,"contextmenu",function(G){return Ss(e,G)}),xe(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||Ss(e,G)});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 w(G){if(G.touches.length!=1)return!1;var V=G.touches[0];return V.radiusX<=1&&V.radiusY<=1}function N(G,V){if(V.left==null)return!0;var ie=V.left-G.left,se=V.top-G.top;return ie*ie+se*se>20*20}xe(t.scroller,"touchstart",function(G){if(!Me(e,G)&&!w(G)&&!Ka(e,G)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},G.touches.length==1&&(t.activeTouch.left=G.touches[0].pageX,t.activeTouch.top=G.touches[0].pageY)}}),xe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),xe(t.scroller,"touchend",function(G){var V=t.activeTouch;if(V&&!Mr(t,G)&&V.left!=null&&!V.moved&&new Date-V.start<300){var ie=e.coordsChar(t.activeTouch,"page"),se;!V.prev||N(V,V.prev)?se=new wt(ie,ie):!V.prev.prev||N(V,V.prev.prev)?se=e.findWordAt(ie):se=new wt(Fe(ie.line,0),mt(e.doc,Fe(ie.line+1,0))),e.setSelection(se.anchor,se.head),e.focus(),Y(G)}i()}),xe(t.scroller,"touchcancel",i),xe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),we(e,"scroll",e))}),xe(t.scroller,"mousewheel",function(G){return Mo(e,G)}),xe(t.scroller,"DOMMouseScroll",function(G){return Mo(e,G)}),xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){Me(e,G)||oe(G)},over:function(G){Me(e,G)||(Dl(e,G),oe(G))},start:function(G){return Al(e,G)},drop:Gt(e,Ll),leave:function(G){Me(e,G)||ss(e)}};var H=t.input.getField();xe(H,"keyup",function(G){return ys.call(e,G)}),xe(H,"keydown",Gt(e,vs)),xe(H,"keypress",Gt(e,bs)),xe(H,"focus",function(G){return wa(e,G)}),xe(H,"blur",function(G){return Pn(e,G)})}var Ga=[];Pt.defineInitHook=function(e){return Ga.push(e)};function Si(e,t,n,r){var i=e.doc,w;n==null&&(n="add"),n=="smart"&&(i.mode.indent?w=je(e,t).state:n="prev");var N=e.options.tabSize,H=st(i,t),G=X(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var V=H.text.match(/^\s*/)[0],ie;if(!r&&!/\S/.test(H.text))ie=0,n="not";else if(n=="smart"&&(ie=i.mode.indent(w,H.text.slice(V.length),H.text),ie==Te||ie>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ie=X(st(i,t-1).text,null,N):ie=0:n=="add"?ie=G+e.options.indentUnit:n=="subtract"?ie=G-e.options.indentUnit:typeof n=="number"&&(ie=G+n),ie=Math.max(0,ie);var se="",ve=0;if(e.options.indentWithTabs)for(var pe=Math.floor(ie/N);pe;--pe)ve+=N,se+=" ";if(ve<ie&&(se+=ne(ie-ve)),se!=V)return Fn(i,se,Fe(t,0),Fe(t,V.length),"+input"),H.stateAfter=null,!0;for(var Oe=0;Oe<i.sel.ranges.length;Oe++){var Ue=i.sel.ranges[Oe];if(Ue.head.line==t&&Ue.head.ch<V.length){var Ke=Fe(t,V.length);Ua(i,Oe,new wt(Ke,Ke));break}}}var xr=null;function ra(e){xr=e}function za(e,t,n,r,i){var w=e.doc;e.display.shift=!1,r||(r=w.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,G=at(t),V=null;if(H&&r.ranges.length>1)if(xr&&xr.text.join(`
`)==t){if(r.ranges.length%xr.text.length==0){V=[];for(var ie=0;ie<xr.text.length;ie++)V.push(w.splitLines(xr.text[ie]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=de(G,function(Ye){return[Ye]}));for(var se=e.curOp.updateInput,ve=r.ranges.length-1;ve>=0;ve--){var pe=r.ranges[ve],Oe=pe.from(),Ue=pe.to();pe.empty()&&(n&&n>0?Oe=Fe(Oe.line,Oe.ch-n):e.state.overwrite&&!H?Ue=Fe(Ue.line,Math.min(st(w,Ue.line).text.length,Ue.ch+me(G).length)):H&&xr&&xr.lineWise&&xr.text.join(`
`)==G.join(`
`)&&(Oe=Ue=Fe(Oe.line,0)));var Ke={from:Oe,to:Ue,text:V?V[ve%V.length]:G,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};Un(e.doc,Ke),Dt(e,"inputRead",e,Ke)}t&&!H&&As(e,t),Mn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=se),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ls(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return za(t,n,0,null,"paste")}),!0}function As(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 w=e.getModeAt(i.head),N=!1;if(w.electricChars){for(var H=0;H<w.electricChars.length;H++)if(t.indexOf(w.electricChars.charAt(H))>-1){N=Si(e,i.head.line,"smart");break}}else w.electricInput&&(w.electricInput.test(st(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Si(e,i.head.line,"smart")));N&&Dt(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,w={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(w),t.push(e.getRange(w.anchor,w.head))}return{text:t,ranges:n}}function _s(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),_s(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var w=this.options,N=w[r];if(w[r]==i&&r!="mode")return;w[r]=i,t.hasOwnProperty(r)&&Gt(this,t[r])(this,i,N),we(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,w=0;w<i.length;++w)if(i[w]==r||i[w].name==r)return i.splice(w,1),!0},addOverlay:qt(function(r,i){var w=r.token?r:e.getMode(this.options,r);if(w.startState)throw new Error("Overlays may not be stateful.");Se(this.state.overlays,{mode:w,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,w=0;w<i.length;++w){var N=i[w].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(w,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,w){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&Si(this,r,i,w)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,w=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>w&&(Si(this,H.head.line,r,!0),w=H.head.line,N==this.doc.sel.primIndex&&Mn(this));else{var G=H.from(),V=H.to(),ie=Math.max(w,G.line);w=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var se=ie;se<w;++se)Si(this,se,r);var ve=this.doc.sel.ranges;G.ch==0&&i.length==ve.length&&ve[N].from().ch>0&&Ua(this.doc,N,new wt(G,ve[N].to()),ge)}}}),getTokenAt:function(r,i){return Nr(this,r,i)},getLineTokens:function(r,i){return Nr(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=mt(this.doc,r);var i=Yn(this,st(this.doc,r.line)),w=0,N=(i.length-1)/2,H=r.ch,G;if(H==0)G=i[2];else for(;;){var V=w+N>>1;if((V?i[V*2-1]:0)>=H)N=V;else if(i[V*2+1]<H)w=V+1;else{G=i[V*2+2];break}}var ie=G?G.indexOf("overlay "):-1;return ie<0?G:ie==0?null:G.slice(0,ie-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var w=[];if(!n.hasOwnProperty(i))return w;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&w.push(N[H[i]]);else if(H[i])for(var G=0;G<H[i].length;G++){var V=N[H[i][G]];V&&w.push(V)}else H.helperType&&N[H.helperType]?w.push(N[H.helperType]):N[H.name]&&w.push(N[H.name]);for(var ie=0;ie<N._global.length;ie++){var se=N._global[ie];se.pred(H,this)&&ae(w,se.val)==-1&&w.push(se.val)}return w},getStateAfter:function(r,i){var w=this.doc;return r=Xn(w,r==null?w.first+w.size-1:r),je(this,r+1,i).state},cursorCoords:function(r,i){var w,N=this.doc.sel.primary();return r==null?w=N.head:typeof r=="object"?w=mt(this.doc,r):w=r?N.from():N.to(),br(this,w,i||"page")},charCoords:function(r,i){return ga(this,mt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,w){var N=!1,H;if(typeof r=="number"){var G=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>G&&(r=G,N=!0),H=st(this.doc,r)}else H=r;return Fi(this,H,{top:0,left:0},i||"page",w||N).top+(N?this.doc.height-lr(H):0)},defaultTextHeight:function(){return On(this.display)},defaultCharWidth:function(){return Rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,w,N,H){var G=this.display;r=br(this,mt(this.doc,r));var V=r.bottom,ie=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),N=="over")V=r.top;else if(N=="above"||N=="near"){var se=Math.max(G.wrapper.clientHeight,this.doc.height),ve=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>se)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=se&&(V=r.bottom),ie+i.offsetWidth>ve&&(ie=ve-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",H=="right"?(ie=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?ie=0:H=="middle"&&(ie=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ie+"px"),w&&Qs(this,{left:ie,top:V,right:ie+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:qt(vs),triggerOnKeyPress:qt(bs),triggerOnKeyUp:ys,triggerOnMouseDown:qt(Es),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:qt(function(r){As(this,r)}),findPosH:function(r,i,w,N){var H=1;i<0&&(H=-1,i=-i);for(var G=mt(this.doc,r),V=0;V<i&&!(G=Va(this.doc,G,H,w,N),G.hitSide);++V);return G},moveH:qt(function(r,i){var w=this;this.extendSelectionsBy(function(N){return w.display.shift||w.doc.extend||N.empty()?Va(w.doc,N.head,r,i,w.options.rtlMoveVisually):r<0?N.from():N.to()},ee)}),deleteH:qt(function(r,i){var w=this.doc.sel,N=this.doc;w.somethingSelected()?N.replaceSelection("",null,"+delete"):Wn(this,function(H){var G=Va(N,H.head,r,i,!1);return r<0?{from:G,to:H.head}:{from:H.head,to:G}})}),findPosV:function(r,i,w,N){var H=1,G=N;i<0&&(H=-1,i=-i);for(var V=mt(this.doc,r),ie=0;ie<i;++ie){var se=br(this,V,"div");if(G==null?G=se.left:se.left=G,V=Rs(this,se,H,w),V.hitSide)break}return V},moveV:qt(function(r,i){var w=this,N=this.doc,H=[],G=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ie){if(G)return r<0?ie.from():ie.to();var se=br(w,ie.head,"div");ie.goalColumn!=null&&(se.left=ie.goalColumn),H.push(se.left);var ve=Rs(w,se,r,i);return i=="page"&&ie==N.sel.primary()&&La(w,ga(w,ve,"div").top-se.top),ve},ee),H.length)for(var V=0;V<N.sel.ranges.length;V++)N.sel.ranges[V].goalColumn=H[V]}),findWordAt:function(r){var i=this.doc,w=st(i,r.line).text,N=r.ch,H=r.ch;if(w){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||H==w.length)&&N?--N:++H;for(var V=w.charAt(N),ie=Re(V,G)?function(se){return Re(se,G)}:/\s/.test(V)?function(se){return/\s/.test(se)}:function(se){return!/\s/.test(se)&&!Re(se)};N>0&&ie(w.charAt(N-1));)--N;for(;H<w.length&&ie(w.charAt(H));)++H}return new wt(Fe(r.line,N),Fe(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),we(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==_()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Lr(this)-this.display.barHeight,width:r.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sn(this)}},scrollIntoView:qt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var w=this,N=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&lo(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(G){if(G.widgets){for(var V=0;V<G.widgets.length;V++)if(G.widgets[V].noHScroll){Kr(w,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,we(this,"refresh",this)}),operation:function(r){return ur(this,r)},startOperation:function(){return hn(this)},endOperation:function(){return mn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ri(this),ii(this,this.doc.scrollLeft,this.doc.scrollTop),_a(this.display),(r==null||Math.abs(r-On(this.display))>.5||this.options.lineWrapping)&&Ta(this),we(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Uo(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Dt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ue(e),e.registerHelper=function(r,i,w){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=w},e.registerGlobalHelper=function(r,i,w,N){e.registerHelper(r,i,N),n[r]._global.push({pred:w,val:N})}}function Va(e,t,n,r,i){var w=t,N=n,H=st(e,t.line),G=i&&e.direction=="rtl"?-n:n;function V(){var qe=t.line+G;return qe<e.first||qe>=e.first+e.size?!1:(t=new Fe(qe,t.ch,t.sticky),H=st(e,qe))}function ie(qe){var $e;if(r=="codepoint"){var nt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(nt)?$e=null:$e=new Fe(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else i?$e=kl(e.cm,H,t,n):$e=Ba(H,t,n);if($e==null)if(!qe&&V())t=ja(i,e.cm,H,t.line,G);else return!1;else t=$e;return!0}if(r=="char"||r=="codepoint")ie();else if(r=="column")ie(!0);else if(r=="word"||r=="group")for(var se=null,ve=r=="group",pe=e.cm&&e.cm.getHelper(t,"wordChars"),Oe=!0;!(n<0&&!ie(!Oe));Oe=!1){var Ue=H.text.charAt(t.ch)||`
`,Ke=Re(Ue,pe)?"w":ve&&Ue==`
`?"n":!ve||/\s/.test(Ue)?null:"p";if(ve&&!Oe&&!Ke&&(Ke="s"),se&&se!=Ke){n<0&&(n=1,ie(),t.sticky="after");break}if(Ke&&(se=Ke),n>0&&!ie(!Oe))break}var Ye=Qi(e,t,w,N,!0);return qr(w,Ye)&&(Ye.hitSide=!0),Ye}function Rs(e,t,n,r){var i=e.doc,w=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(H-.5*On(e.display),3);N=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var V;!(V=ya(e,w,N),!V.outside);){if(n<0?N<=0:N>=i.height){V.hitSide=!0;break}N+=n*5}return V}var Lt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new te,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Lt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;_s(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function w(H){for(var G=H.target;G;G=G.parentNode){if(G==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(G.className))break}return!1}xe(i,"paste",function(H){if(!w(H)||Me(r,H)||Ls(H,r))return;k<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),xe(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),xe(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),xe(i,"compositionend",function(H){t.composing&&(H.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 N(H){if(!w(H)||Me(r,H))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=Ds(r);ra({lineWise:!0,text:G.text}),H.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,ge),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var V=xr.text.join(`
`);if(H.clipboardData.setData("Text",V),H.clipboardData.getData("Text")==V){H.preventDefault();return}}var ie=Os(),se=ie.firstChild;r.display.lineSpace.insertBefore(ie,r.display.lineSpace.firstChild),se.value=xr.text.join(`
`);var ve=document.activeElement;z(se),setTimeout(function(){r.display.lineSpace.removeChild(ie),ve.focus(),ve==i&&n.showPrimarySelection()},50)}xe(i,"copy",N),xe(i,"cut",N)},Lt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Lt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Lt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Lt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Lt.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 w=na(t,e.anchorNode,e.anchorOffset),N=na(t,e.focusNode,e.focusOffset);if(w&&!w.bad&&N&&!N.bad&&ft(bn(w,N),r)==0&&ft(tn(w,N),i)==0)return;var H=t.display.view,G=r.line>=t.display.viewFrom&&Ps(t,r)||{node:H[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ps(t,i);if(!V){var ie=H[H.length-1].measure,se=ie.maps?ie.maps[ie.maps.length-1]:ie.map;V={node:se[se.length-1],offset:se[se.length-2]-se[se.length-3]}}if(!G||!V){e.removeAllRanges();return}var ve=e.rangeCount&&e.getRangeAt(0),pe;try{pe=v(G.node,G.offset,V.offset,V.node)}catch(Oe){}pe&&(!A&&t.state.focused?(e.collapse(G.node,G.offset),pe.collapsed||(e.removeAllRanges(),e.addRange(pe))):(e.removeAllRanges(),e.addRange(pe)),ve&&e.anchorNode==null?e.addRange(ve):A&&this.startGracePeriod()),this.rememberSelection()},Lt.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)},Lt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Lt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Lt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return c(this.div,t)},Lt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Lt.prototype.blur=function(){this.div.blur()},Lt.prototype.getField=function(){return this.div},Lt.prototype.supportsTouch=function(){return!0},Lt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ur(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)},Lt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Lt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&p&&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=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&ur(t,function(){Qt(t.doc,zr(n,r),ge),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Lt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Fe(r.line-1,st(e.doc,r.line-1).length)),i.ch==st(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var w,N,H;r.line==t.viewFrom||(w=dn(e,r.line))==0?(N=St(t.view[0].line),H=t.view[0].node):(N=St(t.view[w].line),H=t.view[w-1].node.nextSibling);var G=dn(e,i.line),V,ie;if(G==t.view.length-1?(V=t.viewTo-1,ie=t.lineDiv.lastChild):(V=St(t.view[G+1].line)-1,ie=t.view[G+1].node.previousSibling),!H)return!1;for(var se=e.doc.splitLines(tu(e,H,ie,N,V)),ve=Sr(e.doc,Fe(N,0),Fe(V,st(e.doc,V).text.length));se.length>1&&ve.length>1;)if(me(se)==me(ve))se.pop(),ve.pop(),V--;else if(se[0]==ve[0])se.shift(),ve.shift(),N++;else break;for(var pe=0,Oe=0,Ue=se[0],Ke=ve[0],Ye=Math.min(Ue.length,Ke.length);pe<Ye&&Ue.charCodeAt(pe)==Ke.charCodeAt(pe);)++pe;for(var qe=me(se),$e=me(ve),nt=Math.min(qe.length-(se.length==1?pe:0),$e.length-(ve.length==1?pe:0));Oe<nt&&qe.charCodeAt(qe.length-Oe-1)==$e.charCodeAt($e.length-Oe-1);)++Oe;if(se.length==1&&ve.length==1&&N==r.line)for(;pe&&pe>r.ch&&qe.charCodeAt(qe.length-Oe-1)==$e.charCodeAt($e.length-Oe-1);)pe--,Oe++;se[se.length-1]=qe.slice(0,qe.length-Oe).replace(/^\u200b+/,""),se[0]=se[0].slice(pe).replace(/\u200b+$/,"");var dt=Fe(N,pe),lt=Fe(V,ve.length?me(ve).length-Oe:0);if(se.length>1||se[0]||ft(dt,lt))return Fn(e.doc,se,dt,lt,"+input"),!0},Lt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Lt.prototype.reset=function(){this.forceCompositionEnd()},Lt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Lt.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)},Lt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ur(this.cm,function(){return tr(e.cm)})},Lt.prototype.setUneditable=function(e){e.contentEditable="false"},Lt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Gt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Lt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Lt.prototype.onContextMenu=function(){},Lt.prototype.resetPosition=function(){},Lt.prototype.needsContentAttribute=!0;function Ps(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=st(e.doc,t.line),i=no(n,r,t.line),w=Be(r,e.doc.direction),N="left";if(w){var H=He(w,t.ch);N=H%2?"right":"left"}var G=oo(i.map,t.ch,N);return G.offset=G.collapse=="right"?G.end:G.start,G}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 w="",N=!1,H=e.doc.lineSeparator(),G=!1;function V(pe){return function(Oe){return Oe.id==pe}}function ie(){N&&(w+=H,G&&(w+=H),N=G=!1)}function se(pe){pe&&(ie(),w+=pe)}function ve(pe){if(pe.nodeType==1){var Oe=pe.getAttribute("cm-text");if(Oe){se(Oe);return}var Ue=pe.getAttribute("cm-marker"),Ke;if(Ue){var Ye=e.findMarks(Fe(r,0),Fe(i+1,0),V(+Ue));Ye.length&&(Ke=Ye[0].find(0))&&se(Sr(e.doc,Ke.from,Ke.to).join(H));return}if(pe.getAttribute("contenteditable")=="false")return;var qe=/^(pre|div|p|li|table|br)$/i.test(pe.nodeName);if(!/^br$/i.test(pe.nodeName)&&pe.textContent.length==0)return;qe&&ie();for(var $e=0;$e<pe.childNodes.length;$e++)ve(pe.childNodes[$e]);/^(pre|p)$/i.test(pe.nodeName)&&(G=!0),qe&&(N=!0)}else pe.nodeType==3&&se(pe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ve(t),t==n);)t=t.nextSibling,G=!1;return w}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var w=e.display.view[i];if(w.node==r)return ru(w,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!c(r,t))return Kn(Fe(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var w=e.rest?me(e.rest):e.line;return Kn(Fe(St(w),w.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var G=e.measure,V=G.maps;function ie(Ke,Ye,qe){for(var $e=-1;$e<(V?V.length:0);$e++)for(var nt=$e<0?G.map:V[$e],dt=0;dt<nt.length;dt+=3){var lt=nt[dt+2];if(lt==Ke||lt==Ye){var gt=St($e<0?e.line:e.rest[$e]),Ot=nt[dt]+qe;return(qe<0||lt!=Ke)&&(Ot=nt[dt+(qe?1:0)]),Fe(gt,Ot)}}}var se=ie(N,H,n);if(se)return Kn(se,i);for(var ve=H.nextSibling,pe=N?N.nodeValue.length-n:0;ve;ve=ve.nextSibling){if(se=ie(ve,ve.firstChild,0),se)return Kn(Fe(se.line,se.ch-pe),i);pe+=ve.textContent.length}for(var Oe=H.previousSibling,Ue=n;Oe;Oe=Oe.previousSibling){if(se=ie(Oe,Oe.firstChild,-1),se)return Kn(Fe(se.line,se.ch+Ue),i);Ue+=Oe.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new te,this.hasSelection=!1,this.composing=null};Ut.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(i.style.width="0px"),xe(i,"input",function(){I&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),xe(i,"paste",function(N){if(Me(r,N)||Ls(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function w(N){if(Me(r,N))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Ds(r);ra({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,ge):(n.prevInput="",i.value=H.text.join(`
`),z(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}xe(i,"cut",w),xe(i,"copy",w),xe(e.scroller,"paste",function(N){if(Mr(e,N)||Me(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),xe(e.lineSpace,"selectstart",function(N){Mr(e,N)||Y(N)}),xe(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),xe(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),w=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-w.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-w.left))}return r},Ut.prototype.showSelection=function(e){var t=this.cm,n=t.display;u(n.cursorDiv,e.cursors),u(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ut.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&z(this.textarea),I&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",I&&k>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||_()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ut.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Ut.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||tt(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(I&&k>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var w=i.charCodeAt(0);if(w==8203&&!r&&(r="\u200B"),w==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,H=Math.min(r.length,i.length);N<H&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return ur(t,function(){za(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){I&&k>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var w=un(n,e),N=r.scroller.scrollTop;if(!w||y)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(w)==-1&&Gt(n,Qt)(n.doc,zr(w),ge);var G=i.style.cssText,V=t.wrapper.style.cssText,ie=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ie.top-5)+"px; left: "+(e.clientX-ie.left-5)+`px;
z-index: 1000; background: `+(I?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var se;O&&(se=window.scrollY),r.input.focus(),O&&window.scrollTo(null,se),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=pe,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function ve(){if(i.selectionStart!=null){var Ue=n.somethingSelected(),Ke="\u200B"+(Ue?i.value:"");i.value="\u21DA",i.value=Ke,t.prevInput=Ue?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ke.length,r.selForContextMenu=n.doc.sel}}function pe(){if(t.contextMenuPending!=pe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=G,I&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!I||I&&k<9)&&ve();var Ue=0,Ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Gt(n,Qo)(n):Ue++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(I&&k>=9&&ve(),L){oe(e);var Oe=function(){Ve(window,"mouseup",Oe),setTimeout(pe,20)};xe(window,"mouseup",Oe)}else setTimeout(pe,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?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=_();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(xe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var w=e.form;i=w.submit;try{var N=w.submit=function(){r(),w.submit=i,w.submit(),w.submit=N}}catch(G){}}t.finishInit=function(G){G.save=r,G.getTextArea=function(){return e},G.toTextArea=function(){G.toTextArea=isNaN,r(),e.parentNode.removeChild(G.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=Pt(function(G){return e.parentNode.insertBefore(G,e.nextSibling)},t);return H}function iu(e){e.off=Ve,e.on=xe,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=at,e.countColumn=X,e.findColumn=re,e.isWordChar=De,e.Pass=Te,e.signal=we,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Lo,e.Pos=Fe,e.cmpPos=ft,e.modes=At,e.mimeModes=pt,e.resolveMode=Ft,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=mr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=kr,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=Ml,e.StringStream=Mt,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=pi,e.e_preventDefault=Y,e.e_stopPropagation=Q,e.e_stop=oe,e.addClass=U,e.contains=c,e.rmClass=m,e.keyNames=$r}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&ae(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return ue(rr),Pt.inputStyles={textarea:Ut,contenteditable:Lt},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),or.apply(this,arguments)},Pt.defineMIME=Kt,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){rr.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(rt,Qe,J){"use strict";J.r(Qe),J.d(Qe,"ResizableTextArea",function(){return ae});var $=J("wx14"),K=J("1OyB"),A=J("vuIU"),W=J("Ji7U"),M=J("LK+K"),P=J("cDcd"),I=J("VTBJ"),k=J("rePB"),O=J("Zm9Q"),D=J("Kwbf"),p=J("c+Xe"),y=J("m+aA"),R=J("bdgK"),S=new Map;function x(ge){ge.forEach(function(he){var ee,re=he.target;(ee=S.get(re))===null||ee===void 0||ee.forEach(function(Z){return Z(re)})})}var b=new R.default(x),d=null,a=null;function l(ge,he){S.has(ge)||(S.set(ge,new Set),b.observe(ge)),S.get(ge).add(he)}function s(ge,he){S.has(ge)&&(S.get(ge).delete(he),S.get(ge).size||(b.unobserve(ge),S.delete(ge)))}var C=function(ge){Object(W.a)(ee,ge);var he=Object(M.a)(ee);function ee(){return Object(K.a)(this,ee),he.apply(this,arguments)}return Object(A.a)(ee,[{key:"render",value:function(){return this.props.children}}]),ee}(P.Component),g=P.createContext(null);function h(ge){var he=ge.children,ee=ge.onBatchResize,re=P.useRef(0),Z=P.useRef([]),ne=P.useContext(g),me=P.useCallback(function(de,Se,ye){re.current+=1;var Ie=re.current;Z.current.push({size:de,element:Se,data:ye}),Promise.resolve().then(function(){Ie===re.current&&(ee==null||ee(Z.current),Z.current=[])}),ne==null||ne(de,Se,ye)},[ee,ne]);return P.createElement(g.Provider,{value:me},he)}function L(ge){var he=ge.children,ee=ge.disabled,re=P.useRef(null),Z=P.useRef(null),ne=P.useContext(g),me=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=P.isValidElement(he)&&Object(p.c)(he),Se=de?he.ref:null,ye=P.useMemo(function(){return Object(p.a)(Se,re)},[Se,re]),Ie=P.useRef(ge);Ie.current=ge;var Ee=P.useCallback(function(De){var Re=Ie.current,ke=Re.onResize,Ne=Re.data,Pe=De.getBoundingClientRect(),Ce=Pe.width,Je=Pe.height,Xe=De.offsetWidth,We=De.offsetHeight,He=Math.floor(Ce),et=Math.floor(Je);if(me.current.width!==He||me.current.height!==et||me.current.offsetWidth!==Xe||me.current.offsetHeight!==We){var Be={width:He,height:et,offsetWidth:Xe,offsetHeight:We};me.current=Be;var Ge=Xe===Math.round(Ce)?Ce:Xe,xe=We===Math.round(Je)?Je:We,Ze=Object(I.a)(Object(I.a)({},Be),{},{offsetWidth:Ge,offsetHeight:xe});ne==null||ne(Ze,De,Ne),ke&&Promise.resolve().then(function(){ke(Ze,De)})}},[]);return P.useEffect(function(){var De=Object(y.a)(re.current)||Object(y.a)(Z.current);return De&&!ee&&l(De,Ee),function(){return s(De,Ee)}},[re.current,ee]),P.createElement(C,{ref:Z},de?P.cloneElement(he,{ref:ye}):he)}var T="rc-observer-key";function m(ge){var he=ge.children,ee=Object(O.a)(he);return ee.map(function(re,Z){var ne=(re==null?void 0:re.key)||"".concat(T,"-").concat(Z);return P.createElement(L,Object($.a)({},ge,{key:ne}),re)})}m.Collection=h;var f=m,u=J("bT9E"),o=J("TSYQ"),E=J.n(o),v=`
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
`,c=["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"],_={},U;function B(ge){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=ge.getAttribute("id")||ge.getAttribute("data-reactid")||ge.getAttribute("name");if(he&&_[ee])return _[ee];var re=window.getComputedStyle(ge),Z=re.getPropertyValue("box-sizing")||re.getPropertyValue("-moz-box-sizing")||re.getPropertyValue("-webkit-box-sizing"),ne=parseFloat(re.getPropertyValue("padding-bottom"))+parseFloat(re.getPropertyValue("padding-top")),me=parseFloat(re.getPropertyValue("border-bottom-width"))+parseFloat(re.getPropertyValue("border-top-width")),de=c.map(function(ye){return"".concat(ye,":").concat(re.getPropertyValue(ye))}).join(";"),Se={sizingStyle:de,paddingSize:ne,borderSize:me,boxSizing:Z};return he&&ee&&(_[ee]=Se),Se}function z(ge){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,re=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)),ge.getAttribute("wrap")?U.setAttribute("wrap",ge.getAttribute("wrap")):U.removeAttribute("wrap");var Z=B(ge,he),ne=Z.paddingSize,me=Z.borderSize,de=Z.boxSizing,Se=Z.sizingStyle;U.setAttribute("style","".concat(Se,";").concat(v)),U.value=ge.value||ge.placeholder||"";var ye=Number.MIN_SAFE_INTEGER,Ie=Number.MAX_SAFE_INTEGER,Ee=U.scrollHeight,De;if(de==="border-box"?Ee+=me:de==="content-box"&&(Ee-=ne),ee!==null||re!==null){U.value=" ";var Re=U.scrollHeight-ne;ee!==null&&(ye=Re*ee,de==="border-box"&&(ye=ye+ne+me),Ee=Math.max(ye,Ee)),re!==null&&(Ie=Re*re,de==="border-box"&&(Ie=Ie+ne+me),De=Ee>Ie?"":"hidden",Ee=Math.min(Ie,Ee))}return{height:Ee,minHeight:ye,maxHeight:Ie,overflowY:De,resize:"none"}}var j=J("Gytx"),F=J.n(j),X;(function(ge){ge[ge.NONE=0]="NONE",ge[ge.RESIZING=1]="RESIZING",ge[ge.RESIZED=2]="RESIZED"})(X||(X={}));var te=function(ge){Object(W.a)(ee,ge);var he=Object(M.a)(ee);function ee(re){var Z;return Object(K.a)(this,ee),Z=he.call(this,re),Z.nextFrameActionId=void 0,Z.resizeFrameId=void 0,Z.textArea=void 0,Z.saveTextArea=function(ne){Z.textArea=ne},Z.handleResize=function(ne){var me=Z.state.resizeStatus,de=Z.props,Se=de.autoSize,ye=de.onResize;if(me!==X.NONE)return;typeof ye=="function"&&ye(ne),Se&&Z.resizeOnNextFrame()},Z.resizeOnNextFrame=function(){cancelAnimationFrame(Z.nextFrameActionId),Z.nextFrameActionId=requestAnimationFrame(Z.resizeTextarea)},Z.resizeTextarea=function(){var ne=Z.props.autoSize;if(!ne||!Z.textArea)return;var me=ne.minRows,de=ne.maxRows,Se=z(Z.textArea,!1,me,de);Z.setState({textareaStyles:Se,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(Z.resizeFrameId),Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:X.RESIZED},function(){Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:X.NONE}),Z.fixFirefoxAutoScroll()})})})})},Z.renderTextArea=function(){var ne=Z.props,me=ne.prefixCls,de=me===void 0?"rc-textarea":me,Se=ne.autoSize,ye=ne.onResize,Ie=ne.className,Ee=ne.disabled,De=Z.state,Re=De.textareaStyles,ke=De.resizeStatus,Ne=Object(u.a)(Z.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Pe=E()(de,Ie,Object(k.a)({},"".concat(de,"-disabled"),Ee));"value"in Ne&&(Ne.value=Ne.value||"");var Ce=Object(I.a)(Object(I.a)(Object(I.a)({},Z.props.style),Re),ke===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(f,{onResize:Z.handleResize,disabled:!(Se||ye)},P.createElement("textarea",Object($.a)({},Ne,{className:Pe,style:Ce,ref:Z.saveTextArea})))},Z.state={textareaStyles:{},resizeStatus:X.NONE},Z}return Object(A.a)(ee,[{key:"componentDidUpdate",value:function(Z){(Z.value!==this.props.value||!F()(Z.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 Z=this.textArea.selectionStart,ne=this.textArea.selectionEnd;this.textArea.setSelectionRange(Z,ne)}}catch(me){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ee}(P.Component),ae=te,ce=function(ge){Object(W.a)(ee,ge);var he=Object(M.a)(ee);function ee(re){var Z;Object(K.a)(this,ee),Z=he.call(this,re),Z.resizableTextArea=void 0,Z.focus=function(){Z.resizableTextArea.textArea.focus()},Z.saveTextArea=function(me){Z.resizableTextArea=me},Z.handleChange=function(me){var de=Z.props.onChange;Z.setValue(me.target.value,function(){Z.resizableTextArea.resizeTextarea()}),de&&de(me)},Z.handleKeyDown=function(me){var de=Z.props,Se=de.onPressEnter,ye=de.onKeyDown;me.keyCode===13&&Se&&Se(me),ye&&ye(me)};var ne=typeof re.value=="undefined"||re.value===null?re.defaultValue:re.value;return Z.state={value:ne},Z}return Object(A.a)(ee,[{key:"setValue",value:function(Z,ne){"value"in this.props||this.setState({value:Z},ne)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ae,Object($.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Z){return"value"in Z?{value:Z.value}:null}}]),ee}(P.Component),Te=Qe.default=ce},ZW9T:function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return g});var $=J("k1fw"),K=J("miYZ"),A=J("tsqr"),W=J("rAM+"),M=J("tJVT"),P=J("PpiC"),I=J("cDcd"),k=J.n(I),O=J("bdgK");function D(h,L,T,m,f){var u=L.getWordUntilPosition(T),o={startLineNumber:T.lineNumber,endLineNumber:T.lineNumber,startColumn:u.startColumn,endColumn:u.endColumn},E=m.map(function(v){return{label:v,kind:h.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return f.map(function(v){E.push(Object($.a)(Object($.a)({},v),{},{range:o}))}),E}var p=function(h){var L={label:"ifelse",kind:h.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},T=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];h.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(o,E){var v=D(h,o,E,T,[L]);return{suggestions:v}}});var m=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];h.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(o,E){var v=[{label:"print",kind:h.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],c=D(h,o,E,m,v);return{suggestions:c}}});var f=["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"];h.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(o,E){var v=[L,{label:"main",kind:h.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:h.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:h.languages.CompletionItemInsertTextRule.InsertAsSnippet}],c=D(h,o,E,f,v);return{suggestions:c}}})},y="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",R=J("LvDl"),S=J("+ua5");function x(h){return/^\d+$/.test(h)?"".concat(h,"px"):h}function b(){}var d=!1,a={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function l(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],L=h;if(Array.isArray(h)){for(var T=0;T<h.length;T++){var m=a[h[T]];if(m)return m}return L[0]}return a[L]||L}var s=null,C=Qe.b=function(h){var L=h.width,T=L===void 0?"100%":L,m=h.height,f=m===void 0?"100%":m,u=h.value,o=h.language,E=o===void 0?"javascript":o,v=h.style,c=v===void 0?{}:v,_=h.options,U=_===void 0?{}:_,B=h.overrideServices,z=B===void 0?{}:B,j=h.theme,F=j===void 0?"vs-dark":j,X=h.onEditBlur,te=h.onSave,ae=h.autoHeight,ce=ae===void 0?!1:ae,Te=h.forbidCopy,ge=Te===void 0?!1:Te,he=h.onChange,ee=he===void 0?b:he,re=h.editorDidMount,Z=re===void 0?b:re,ne=h.onFocus,me=ne===void 0?b:ne,de=h.filename,Se=de===void 0?"educoder.txt":de,ye=h.errorLine,Ie=h.errorContent,Ee=Ie===void 0?"":Ie,De=Object(P.a)(h,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Re=Object(I.useRef)(),ke=Object(I.useRef)({}),Ne=Object(I.useRef)(),Pe=Object(I.useRef)(!1),Ce=Object(I.useRef)(),Je=Object(I.useState)(!1),Xe=Object(M.a)(Je,2),We=Xe[0],He=Xe[1];function et(){var _e;return Re.current&&(_e=new O.default(function(ze){var it=Object(W.a)(ze),Ae;try{for(it.s();!(Ae=it.n()).done;){var ct=Ae.value;(ct.target.offsetHeight>0||ct.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(at){it.e(at)}finally{it.f()}}),_e.observe(Re.current)),_e}function Be(){A.b.warn(decodeURIComponent(y))}var Ge=function(){var ze=ke.current.instance;if(u!=null&&ze&&We){var it=ze.getModel();it&&u!==it.getValue()&&(d=!0,it.setValue(u),ze.layout(),d=!1)}};Object(I.useEffect)(function(){Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){Ge()},500)},[u,We,ke.current]),Object(I.useEffect)(function(){if(ye&&ke.current&&ke.current.instance){var _e=ke.current.instance;_e.changeViewZones(function(it){var Ae=document.createElement("div");Ae.style.padding="10px 20px",Ae.style.width="calc(100% - 20px)",Ae.className="my-error-line-wrp",Ae.innerHTML=Ee,it.addZone({afterLineNumber:ye||11,heightInLines:3,domNode:Ae})});var ze={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};_e.addOverlayWidget(ze),_e.revealPositionInCenter({lineNumber:20,column:1})}},[ye,ke.current,We]);function xe(){var _e=ke.current.instance;if(_e){var ze=_e.getSelection(),it=ke.current.pastePos||{},Ae=new s.Range(it.startLineNumber||ze.endLineNumber,it.startColumn||ze.endColumn,it.endLineNumber||ze.endLineNumber,it.endColumn||ze.endColumn);setTimeout(function(){_e.executeEdits("",[{range:Ae,text:""}])},300)}}function Ze(_e){(window.navigator.platform.match("Mac")?_e.metaKey:_e.ctrlKey)&&_e.keyCode==83&&(_e.preventDefault(),te())}var Ve=function(){if(ce&&ke.current.instance){var ze=ke.current.instance.getContentHeight();be(ze<f?f:ze)}else be(f)};function we(_e){var ze=document.createEvent("MouseEvents");ze.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),_e.dispatchEvent(ze)}function Me(_e,ze){var it=window.URL||window.webkitURL||window,Ae=new Blob([ze]),ct=document.createElementNS("http://www.w3.org/1999/xhtml","a");ct.href=it.createObjectURL(Ae),ct.download=_e,we(ct)}Object(I.useEffect)(function(){Ve()},[Ve]),Object(I.useEffect)(function(){Re.current&&!We&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(_e){try{s=_e,ke.current.instance=s.editor.create(Re.current,{value:u,language:l(E),theme:F,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},z);var ze=ke.current.instance;if(Z(ze,s),setTimeout(function(){Ve(),ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Me(Se||"educoder.txt",ze.getValue())}})},500),ke.current.subscription=ze.onDidChangeModelContent(function(Ae){Pe.current?clearTimeout(Ce.current):(Ve(),ee(ze.getValue(),Ae)),Ce.current=setTimeout(function(){Pe.current=!1},500)}),window.Monaco||p(s),ge&&(ze.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Be(),null}),ze.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Be(),null})),window.Monaco=s,X&&ze.onDidBlurEditorWidget(function(){X(ze.getValue())}),me&&ze.onDidFocusEditorText(function(){me(ze.getValue())}),ge){ze.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Be(),null}),ze.onDidPaste(function(Ae){ke.current.pastePos=Ae});try{window.addEventListener("paste",xe)}catch(Ae){}}var it=et();return He(!0),function(){var Ae=ke.current.instance;Ae.dispose();var ct=Ae.getModel();ct&&ct.dispose(),ke.current.subscription&&ke.current.subscription.dispose(),ge&&window.removeEventListener("paste",xe),it.unobserve(Re.current)}}catch(Ae){}})},[]),Object(I.useEffect)(function(){var _e=ke.current.instance;if(_e&&We)return document.addEventListener("keydown",Ze,!1),function(){document.removeEventListener("keydown",Ze)}},[te,We]),Object(I.useEffect)(function(){var _e=ke.current.instance;if(_e&&We){var ze=l(E);s.editor.setModelLanguage(_e.getModel(),ze),console.log("language:",E,_e.getModel(),ze)}},[E,We]),Object(I.useEffect)(function(){var _e=ke.current.instance;_e&&We&&s.editor.setTheme(F)},[F,We]),Object(I.useEffect)(function(){var _e=ke.current.instance;_e&&We&&(_e.updateOptions(Object($.a)({},U)),setTimeout(function(){_e.getModel().updateOptions(Object($.a)({},U))},200))},[JSON.stringify(U),We]),Object(I.useEffect)(function(){var _e=ke.current.instance;_e&&We&&_e.layout()},[T,f,We]);var fe=Object(I.useState)(x(T)),le=Object(M.a)(fe,2),ue=le[0],Y=le[1],Q=Object(I.useState)(x(f)),q=Object(M.a)(Q,2),oe=q[0],be=q[1],Le=Object($.a)(Object($.a)({},c),{},{width:ue,height:oe});return k.a.createElement("div",{className:"my-monaco-editor",ref:Re,style:Le})};function g(h){var L=h.width,T=L===void 0?"100%":L,m=h.height,f=m===void 0?"100%":m,u=h.original,o=h.modified,E=h.language,v=h.options,c=v===void 0?{}:v,_=Object(I.useRef)(),U=Object(I.useState)(null),B=Object(M.a)(U,2),z=B[0],j=B[1];function F(ce){var Te;return _.current&&(Te=new O.default(function(ge){var he=Object(W.a)(ge),ee;try{for(he.s();!(ee=he.n()).done;){var re=ee.value;(re.target.offsetHeight>0||re.target.offsetWidth>0)&&ce.layout()}}catch(Z){he.e(Z)}finally{he.f()}}),Te.observe(_.current)),Te}Object(I.useEffect)(function(){_.current&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ce){s=ce;var Te=s.editor.createDiffEditor(_.current,Object($.a)(Object($.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},c),{},{wordWrap:!0}));j(Te);var ge=F(Te);return function(){Te.dispose();var he=Te.getModel();he&&he.dispose(),ge.unobserve(_.current)}})},[]),Object(I.useEffect)(function(){z&&z.setModel({original:s.editor.createModel(u,E),modified:s.editor.createModel(o,E)})},[u,o,E,z]);var X=x(T),te=x(f),ae={width:X,height:te};return k.a.createElement("div",{className:"my-diff-editor",ref:_,style:ae})}},ZpRC:function(rt,Qe,J){"use strict";function $(p){return typeof p=="object"&&p!=null&&p.nodeType===1}function K(p,y){return(!y||p!=="hidden")&&p!=="visible"&&p!=="clip"}function A(p,y){if(p.clientHeight<p.scrollHeight||p.clientWidth<p.scrollWidth){var R=getComputedStyle(p,null);return K(R.overflowY,y)||K(R.overflowX,y)||function(S){var x=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(S);return!!x&&(x.clientHeight<S.scrollHeight||x.clientWidth<S.scrollWidth)}(p)}return!1}function W(p,y,R,S,x,b,d,a){return b<p&&d>y||b>p&&d<y?0:b<=p&&a<=R||d>=y&&a>=R?b-p-S:d>y&&a<R||b<p&&a>R?d-y+x:0}var M=function(p,y){var R=window,S=y.scrollMode,x=y.block,b=y.inline,d=y.boundary,a=y.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Re){return Re!==d};if(!$(p))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,C=[],g=p;$(g)&&l(g);){if((g=g.parentElement)===s){C.push(g);break}g!=null&&g===document.body&&A(g)&&!A(document.documentElement)||g!=null&&A(g,a)&&C.push(g)}for(var h=R.visualViewport?R.visualViewport.width:innerWidth,L=R.visualViewport?R.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,f=p.getBoundingClientRect(),u=f.height,o=f.width,E=f.top,v=f.right,c=f.bottom,_=f.left,U=x==="start"||x==="nearest"?E:x==="end"?c:E+u/2,B=b==="center"?_+o/2:b==="end"?v:_,z=[],j=0;j<C.length;j++){var F=C[j],X=F.getBoundingClientRect(),te=X.height,ae=X.width,ce=X.top,Te=X.right,ge=X.bottom,he=X.left;if(S==="if-needed"&&E>=0&&_>=0&&c<=L&&v<=h&&E>=ce&&c<=ge&&_>=he&&v<=Te)return z;var ee=getComputedStyle(F),re=parseInt(ee.borderLeftWidth,10),Z=parseInt(ee.borderTopWidth,10),ne=parseInt(ee.borderRightWidth,10),me=parseInt(ee.borderBottomWidth,10),de=0,Se=0,ye="offsetWidth"in F?F.offsetWidth-F.clientWidth-re-ne:0,Ie="offsetHeight"in F?F.offsetHeight-F.clientHeight-Z-me:0;if(s===F)de=x==="start"?U:x==="end"?U-L:x==="nearest"?W(m,m+L,L,Z,me,m+U,m+U+u,u):U-L/2,Se=b==="start"?B:b==="center"?B-h/2:b==="end"?B-h:W(T,T+h,h,re,ne,T+B,T+B+o,o),de=Math.max(0,de+m),Se=Math.max(0,Se+T);else{de=x==="start"?U-ce-Z:x==="end"?U-ge+me+Ie:x==="nearest"?W(ce,ge,te,Z,me+Ie,U,U+u,u):U-(ce+te/2)+Ie/2,Se=b==="start"?B-he-re:b==="center"?B-(he+ae/2)+ye/2:b==="end"?B-Te+ne+ye:W(he,Te,ae,re,ne+ye,B,B+o,o);var Ee=F.scrollLeft,De=F.scrollTop;U+=De-(de=Math.max(0,Math.min(De+de,F.scrollHeight-te+Ie))),B+=Ee-(Se=Math.max(0,Math.min(Ee+Se,F.scrollWidth-ae+ye)))}z.push({el:F,top:de,left:Se})}return z};function P(p){return p===Object(p)&&Object.keys(p).length!==0}function I(p,y){y===void 0&&(y="auto");var R="scrollBehavior"in document.body.style;p.forEach(function(S){var x=S.el,b=S.top,d=S.left;x.scroll&&R?x.scroll({top:b,left:d,behavior:y}):(x.scrollTop=b,x.scrollLeft=d)})}function k(p){return p===!1?{block:"end",inline:"nearest"}:P(p)?p:{block:"start",inline:"nearest"}}function O(p,y){var R=!p.ownerDocument.documentElement.contains(p);if(P(y)&&typeof y.behavior=="function")return y.behavior(R?[]:M(p,y));if(R)return;var S=k(y);return I(M(p,S),S.behavior)}var D=Qe.a=O},aRTE:function(rt,Qe){rt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return K});var $=J("VTBJ");function K(A,W){var M=Object($.a)({},A);return Array.isArray(W)&&W.forEach(function(P){delete M[P]}),M}},c5Ni:function(rt,Qe,J){},dQei:function(rt,Qe){for(var J={glog:function(K){if(K<1)throw new Error("glog("+K+")");return J.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return J.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},$=0;$<8;$++)J.EXP_TABLE[$]=1<<$;for(var $=8;$<256;$++)J.EXP_TABLE[$]=J.EXP_TABLE[$-4]^J.EXP_TABLE[$-5]^J.EXP_TABLE[$-6]^J.EXP_TABLE[$-8];for(var $=0;$<255;$++)J.LOG_TABLE[J.EXP_TABLE[$]]=$;rt.exports=J},dWSS:function(rt,Qe,J){var $=J("dQei");function K(A,W){if(A.length==null)throw new Error(A.length+"/"+W);for(var M=0;M<A.length&&A[M]==0;)M++;this.num=new Array(A.length-M+W);for(var P=0;P<A.length-M;P++)this.num[P]=A[P+M]}K.prototype={get:function(A){return this.num[A]},getLength:function(){return this.num.length},multiply:function(A){for(var W=new Array(this.getLength()+A.getLength()-1),M=0;M<this.getLength();M++)for(var P=0;P<A.getLength();P++)W[M+P]^=$.gexp($.glog(this.get(M))+$.glog(A.get(P)));return new K(W,0)},mod:function(A){if(this.getLength()-A.getLength()<0)return this;for(var W=$.glog(this.get(0))-$.glog(A.get(0)),M=new Array(this.getLength()),P=0;P<this.getLength();P++)M[P]=this.get(P);for(var P=0;P<A.getLength();P++)M[P]^=$.gexp($.glog(A.get(P))+W);return new K(M,0).mod(A)}},rt.exports=K},dejd:function(rt,Qe,J){},dmUQ:function(rt,Qe,J){"use strict";var $=J("Ff2n"),K=J("rePB"),A=J("1OyB"),W=J("vuIU"),M=J("Ji7U"),P=J("md7G"),I=J("foSv"),k=J("cDcd"),O=J.n(k),D=J("TSYQ"),p=J.n(D),y=J("4IlW");function R(u,o){var E=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);o&&(v=v.filter(function(c){return Object.getOwnPropertyDescriptor(u,c).enumerable})),E.push.apply(E,v)}return E}function S(u){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?R(Object(E),!0).forEach(function(v){Object(K.a)(u,v,E[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(E)):R(Object(E)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(E,v))})}return u}function x(u){var o=b();return function(){var v=Object(I.a)(u),c;if(o){var _=Object(I.a)(this).constructor;c=Reflect.construct(v,arguments,_)}else c=v.apply(this,arguments);return Object(P.a)(this,c)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(u){return!1}}function d(){}function a(u){u.preventDefault()}var l=function(o){return o.replace(/[^\w.-]+/g,"")},s=200,C=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(o){return o!=null},L=function(o,E){return E===o||typeof E=="number"&&typeof o=="number"&&isNaN(E)&&isNaN(o)},T=function(u){Object(M.a)(E,u);var o=x(E);function E(v){var c;Object(A.a)(this,E),c=o.call(this,v),c.onKeyDown=function(B){var z=c.props,j=z.onKeyDown,F=z.onPressEnter;if(B.keyCode===y.a.UP){var X=c.getRatio(B);c.up(B,X,null),c.stop()}else if(B.keyCode===y.a.DOWN){var te=c.getRatio(B);c.down(B,te,null),c.stop()}else B.keyCode===y.a.ENTER&&F&&F(B);if(c.recordCursorPosition(),c.lastKeyCode=B.keyCode,j){for(var ae=arguments.length,ce=new Array(ae>1?ae-1:0),Te=1;Te<ae;Te++)ce[Te-1]=arguments[Te];j.apply(void 0,[B].concat(ce))}},c.onKeyUp=function(B){var z=c.props.onKeyUp;if(c.stop(),c.recordCursorPosition(),z){for(var j=arguments.length,F=new Array(j>1?j-1:0),X=1;X<j;X++)F[X-1]=arguments[X];z.apply(void 0,[B].concat(F))}},c.onChange=function(B){var z=c.props.onChange;c.state.focused&&(c.inputting=!0),c.rawInput=c.props.parser(c.getValueFromEvent(B)),c.setState({inputValue:c.rawInput}),z(c.toNumber(c.rawInput))},c.onMouseUp=function(){var B=c.props.onMouseUp;c.recordCursorPosition(),B&&B.apply(void 0,arguments)},c.onFocus=function(){var B;c.setState({focused:!0}),(B=c.props).onFocus.apply(B,arguments)},c.onBlur=function(){var B=c.props.onBlur;c.inputting=!1,c.setState({focused:!1});var z=c.getCurrentValidValue(c.state.inputValue),j=c.setValue(z,d);if(B){var F=c.input.value,X=c.getInputDisplayValue({focus:!1,value:j});c.input.value=X&&Number(X),B.apply(void 0,arguments),c.input.value=F}},c.getRatio=function(B){var z=1;return B.metaKey||B.ctrlKey?z=.1:B.shiftKey&&(z=10),z},c.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},c.getPrecision=function(B){if(h(c.props.precision))return c.props.precision;var z=String(B);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var j=0;return z.indexOf(".")>=0&&(j=z.length-z.indexOf(".")-1),j},c.getInputDisplayValue=function(B){var z=B||c.state,j=z.focused,F=z.inputValue,X=z.value,te;j?te=F:te=c.toPrecisionAsStep(X),te==null&&(te="");var ae=c.formatWrapper(te);return h(c.props.decimalSeparator)&&(ae=ae.toString().replace(".",c.props.decimalSeparator)),ae},c.recordCursorPosition=function(){try{c.cursorStart=c.input.selectionStart,c.cursorEnd=c.input.selectionEnd,c.currentValue=c.input.value,c.cursorBefore=c.input.value.substring(0,c.cursorStart),c.cursorAfter=c.input.value.substring(c.cursorEnd)}catch(B){}},c.restoreByAfter=function(B){if(B===void 0)return!1;var z=c.input.value,j=z.lastIndexOf(B);if(j===-1)return!1;var F=c.cursorBefore.length;return c.lastKeyCode===y.a.DELETE&&c.cursorBefore.charAt(F-1)===B[0]?(c.fixCaret(F,F),!0):j+B.length===z.length?(c.fixCaret(j,j),!0):!1},c.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(z,j){var F=B.substring(j);return c.restoreByAfter(F)})},c.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},c.stop=function(){c.autoStepTimer&&clearTimeout(c.autoStepTimer)},c.down=function(B,z,j){c.pressingUpOrDown=!0,c.step("down",B,z,j)},c.up=function(B,z,j){c.pressingUpOrDown=!0,c.step("up",B,z,j)},c.saveInput=function(B){c.input=B};var _=v.value;_===void 0&&(_=v.defaultValue),c.state={focused:v.autoFocus};var U=c.getValidValue(c.toNumber(_));return c.state=S(S({},c.state),{},{inputValue:c.toPrecisionAsStep(U),value:U}),c}return Object(W.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(c){var _=this.props,U=_.value,B=_.onChange,z=_.max,j=_.min,F=this.state.focused;if(c){if(!L(c.value,U)||!L(c.max,z)||!L(c.min,j)){var X=F?U:this.getValidValue(U),te;this.pressingUpOrDown?te=X:this.inputting?te=this.rawInput:te=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:te})}var ae="value"in this.props?U:this.state.value;"max"in this.props&&c.max!==z&&typeof ae=="number"&&ae>z&&B&&B(z),"min"in this.props&&c.min!==j&&typeof ae=="number"&&ae<j&&B&&B(j)}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===y.a.BACKSPACE?ce=this.cursorStart-1:this.lastKeyCode===y.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 y.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case y.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(c){var _=c;return _===""?_="":this.isNotCompleteNumber(parseFloat(_))?_=this.state.value:_=this.getValidValue(_),this.toNumber(_)}},{key:"getValueFromEvent",value:function(c){var _=c.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(_=_.replace(this.props.decimalSeparator,".")),_}},{key:"getValidValue",value:function(c){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(c);return isNaN(B)?c:(B<_&&(B=_),B>U&&(B=U),B)}},{key:"setValue",value:function(c,_){var U=this.props.precision,B=this.isNotCompleteNumber(parseFloat(c))?null:parseFloat(c),z=this.state.value,j=z===void 0?null:z,F=this.state.inputValue,X=F===void 0?null:F,te=typeof B=="number"?B.toFixed(U):"".concat(B),ae=B!==j||te!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},_)):this.setState({value:B,inputValue:this.toPrecisionAsStep(c)},_),ae&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(c){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,B=U.precision,z=U.step;if(h(B))return B;var j=this.getPrecision(_),F=this.getPrecision(z),X=this.getPrecision(c);return c?Math.max(X,j+F):j+F}},{key:"getPrecisionFactor",value:function(c){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(c,_);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(c){return this.props.formatter?this.props.formatter(c):c}},{key:"toPrecisionAsStep",value:function(c){if(this.isNotCompleteNumber(c)||c==="")return c;var _=Math.abs(this.getMaxPrecision(c));return isNaN(_)?c.toString():Number(c).toFixed(_)}},{key:"toNumber",value:function(c){var _=this.props.precision,U=this.state.focused,B=c&&c.length>16&&U;return this.isNotCompleteNumber(c)||B?c:h(_)?Math.round(c*Math.pow(10,_))/Math.pow(10,_):Number(c)}},{key:"upStep",value:function(c,_){var U=this.props.step,B=this.getPrecisionFactor(c,_),z=Math.abs(this.getMaxPrecision(c,_)),j=((B*c+B*U*_)/B).toFixed(z);return this.toNumber(j)}},{key:"downStep",value:function(c,_){var U=this.props.step,B=this.getPrecisionFactor(c,_),z=Math.abs(this.getMaxPrecision(c,_)),j=((B*c-B*U*_)/B).toFixed(z);return this.toNumber(j)}},{key:"step",value:function(c,_){var U=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),_&&(_.persist(),_.preventDefault());var j=this.props;if(j.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var X=this["".concat(c,"Step")](F,B),te=X>j.max||X<j.min;if(X>j.max?X=j.max:X<j.min&&(X=j.min),this.setValue(X,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),te)return;this.autoStepTimer=setTimeout(function(){U[c](_,B,!0)},z?s:C)}},{key:"fixCaret",value:function(c,_){if(c===void 0||_===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,B=this.input.selectionEnd;(c!==U||_!==B)&&this.input.setSelectionRange(c,_)}catch(z){}}},{key:"render",value:function(){var c,_=this.props,U=_.prefixCls,B=_.disabled,z=_.readOnly,j=_.useTouch,F=_.autoComplete,X=_.upHandler,te=_.downHandler,ae=_.className,ce=_.max,Te=_.min,ge=_.style,he=_.title,ee=_.onMouseEnter,re=_.onMouseLeave,Z=_.onMouseOver,ne=_.onMouseOut,me=_.required,de=_.onClick,Se=_.tabIndex,ye=_.type,Ie=_.placeholder,Ee=_.id,De=_.inputMode,Re=_.pattern,ke=_.step,Ne=_.maxLength,Pe=_.autoFocus,Ce=_.name,Je=_.onPaste,Xe=_.onInput,We=Object($.a)(_,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),He=this.state,et=He.value,Be=He.focused,Ge=p()(U,(c={},Object(K.a)(c,ae,!!ae),Object(K.a)(c,"".concat(U,"-disabled"),B),Object(K.a)(c,"".concat(U,"-focused"),Be),c)),xe={};Object.keys(We).forEach(function(oe){(oe.substr(0,5)==="data-"||oe.substr(0,5)==="aria-"||oe==="role")&&(xe[oe]=We[oe])});var Ze=!z&&!B,Ve=this.getInputDisplayValue(null),we=(et||et===0)&&(isNaN(et)||Number(et)>=ce),Me=(et||et===0)&&(isNaN(et)||Number(et)<=Te),fe=we||B||z,le=Me||B||z,ue=p()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(K.a)({},"".concat(U,"-handler-up-disabled"),fe)),Y=p()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(K.a)({},"".concat(U,"-handler-down-disabled"),le)),Q=j?{onTouchStart:fe?d:this.up,onTouchEnd:this.stop}:{onMouseDown:fe?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},q=j?{onTouchStart:le?d:this.down,onTouchEnd:this.stop}:{onMouseDown:le?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:Ge,style:ge,title:he,onMouseEnter:ee,onMouseLeave:re,onMouseOver:Z,onMouseOut:ne,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(U,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":fe,className:ue}),X||O.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:a})),O.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:Y}),te||O.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:a}))),O.a.createElement("div",{className:"".concat(U,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ce,"aria-valuenow":et,required:me,type:ye,placeholder:Ie,onPaste:Je,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:Se,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:Pe,maxLength:Ne,readOnly:z,disabled:B,max:ce,min:Te,step:ke,name:Ce,title:he,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:Re,inputMode:De,onInput:Xe},xe))))}}]),E}(O.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var m=T,f=Qe.a=m},f4xo:function(rt,Qe,J){var $=J("nVVt");function K(A){this.mode=$.MODE_8BIT_BYTE,this.data=A}K.prototype={getLength:function(A){return this.data.length},write:function(A){for(var W=0;W<this.data.length;W++)A.put(this.data.charCodeAt(W),8)}},rt.exports=K},gJ3r:function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return $});var $=[{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(rt,Qe,J){},lZu9:function(rt,Qe,J){(function($){$(J("VrN/"),J("1eCo"),J("8EBN"))})(function($){"use strict";$.defineMode("markdown",function(K,A){var W=$.getMode(K,"text/html"),M=W.name=="null";function P(j){if($.findModeByName){var F=$.findModeByName(j);F&&(j=F.mime||F.mimes[0])}var X=$.getMode(K,j);return X.name=="null"?null:X}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var I={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 I)I.hasOwnProperty(k)&&A.tokenTypeOverrides[k]&&(I[k]=A.tokenTypeOverrides[k]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,p=/^\[(x| )\](?=\s)/i,y=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,S=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \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]/,a=" ";function l(j,F,X){return F.f=F.inline=X,X(j,F)}function s(j,F,X){return F.f=F.block=X,X(j,F)}function C(j){return!j||!/\S/.test(j.string)}function g(j){if(j.linkTitle=!1,j.linkHref=!1,j.linkText=!1,j.em=!1,j.strong=!1,j.strikethrough=!1,j.quote=0,j.indentedCode=!1,j.f==L){var F=M;if(!F){var X=$.innerMode(W,j.htmlState);F=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}F&&(j.f=u,j.block=h,j.htmlState=null)}return j.trailingSpace=0,j.trailingSpaceNewLine=!1,j.prevLine=j.thisLine,j.thisLine={stream:null},null}function h(j,F){var X=j.column()===F.indentation,te=C(F.prevLine.stream),ae=F.indentedCode,ce=F.prevLine.hr,Te=F.list!==!1,ge=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var he=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,Te)){for(F.list=null;he<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=he-F.listStack[F.listStack.length-1])}var ee=!te&&!ce&&!F.prevLine.header&&(!Te||!ae)&&!F.prevLine.fencedCodeEnd,re=(F.list===!1||ce||te)&&F.indentation<=ge&&j.match(O),Z=null;if(F.indentationDiff>=4&&(ae||F.prevLine.fencedCodeEnd||F.prevLine.header||te))return j.skipToEnd(),F.indentedCode=!0,I.code;if(j.eatSpace())return null;if(X&&F.indentation<=ge&&(Z=j.match(y))&&Z[1].length<=6)return F.quote=0,F.header=Z[1].length,F.thisLine.header=!0,A.highlightFormatting&&(F.formatting="header"),F.f=F.inline,m(F);if(F.indentation<=ge&&j.eat(">"))return F.quote=X?1:F.quote+1,A.highlightFormatting&&(F.formatting="quote"),j.eatSpace(),m(F);if(!re&&!F.setext&&X&&F.indentation<=ge&&(Z=j.match(D))){var ne=Z[1]?"ol":"ul";return F.indentation=he+j.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,A.taskLists&&j.match(p,!1)&&(F.taskList=!0),F.f=F.inline,A.highlightFormatting&&(F.formatting=["list","list-"+ne]),m(F)}else{if(X&&F.indentation<=ge&&(Z=j.match(x,!0)))return F.quote=0,F.fencedEndRE=new RegExp(Z[1]+"+ *$"),F.localMode=A.fencedCodeBlockHighlighting&&P(Z[2]||A.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=$.startState(F.localMode)),F.f=F.block=T,A.highlightFormatting&&(F.formatting="code-block"),F.code=-1,m(F);if(F.setext||(!ee||!Te)&&!F.quote&&F.list===!1&&!F.code&&!re&&!b.test(j.string)&&(Z=j.lookAhead(1))&&(Z=Z.match(R)))return F.setext?(F.header=F.setext,F.setext=0,j.skipToEnd(),A.highlightFormatting&&(F.formatting="header")):(F.header=Z[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,m(F);if(re)return j.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,I.hr;if(j.peek()==="[")return l(j,F,_)}return l(j,F,F.inline)}function L(j,F){var X=W.token(j,F.htmlState);if(!M){var te=$.innerMode(W,F.htmlState);(te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText||F.md_inside&&j.current().indexOf(">")>-1)&&(F.f=u,F.block=h,F.htmlState=null)}return X}function T(j,F){var X=F.listStack[F.listStack.length-1]||0,te=F.indentation<X,ae=X+3;if(F.fencedEndRE&&F.indentation<=ae&&(te||j.match(F.fencedEndRE))){A.highlightFormatting&&(F.formatting="code-block");var ce;return te||(ce=m(F)),F.localMode=F.localState=null,F.block=h,F.f=u,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,te?s(j,F,F.block):ce}else return F.localMode?F.localMode.token(j,F.localState):(j.skipToEnd(),I.code)}function m(j){var F=[];if(j.formatting){F.push(I.formatting),typeof j.formatting=="string"&&(j.formatting=[j.formatting]);for(var X=0;X<j.formatting.length;X++)F.push(I.formatting+"-"+j.formatting[X]),j.formatting[X]==="header"&&F.push(I.formatting+"-"+j.formatting[X]+"-"+j.header),j.formatting[X]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?F.push(I.formatting+"-"+j.formatting[X]+"-"+j.quote):F.push("error"))}if(j.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(j.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(j.linkHref?F.push(I.linkHref,"url"):(j.strong&&F.push(I.strong),j.em&&F.push(I.em),j.strikethrough&&F.push(I.strikethrough),j.emoji&&F.push(I.emoji),j.linkText&&F.push(I.linkText),j.code&&F.push(I.code),j.image&&F.push(I.image),j.imageAltText&&F.push(I.imageAltText,"link"),j.imageMarker&&F.push(I.imageMarker)),j.header&&F.push(I.header,I.header+"-"+j.header),j.quote&&(F.push(I.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?F.push(I.quote+"-"+j.quote):F.push(I.quote+"-"+A.maxBlockquoteDepth)),j.list!==!1){var te=(j.listStack.length-1)%3;te?te===1?F.push(I.list2):F.push(I.list3):F.push(I.list1)}return j.trailingSpaceNewLine?F.push("trailing-space-new-line"):j.trailingSpace&&F.push("trailing-space-"+(j.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function f(j,F){return j.match(S,!0)?m(F):void 0}function u(j,F){var X=F.text(j,F);if(typeof X!="undefined")return X;if(F.list)return F.list=null,m(F);if(F.taskList){var te=j.match(p,!0)[1]===" ";return te?F.taskOpen=!0:F.taskClosed=!0,A.highlightFormatting&&(F.formatting="task"),F.taskList=!1,m(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&j.match(/^#+$/,!0))return A.highlightFormatting&&(F.formatting="header"),m(F);var ae=j.next();if(F.linkTitle){F.linkTitle=!1;var ce=ae;ae==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(j.match(new RegExp(Te),!0))return I.linkHref}if(ae==="`"){var ge=F.formatting;A.highlightFormatting&&(F.formatting="code"),j.eatWhile("`");var he=j.current().length;if(F.code==0&&(!F.quote||he==1))return F.code=he,m(F);if(he==F.code){var ee=m(F);return F.code=0,ee}else return F.formatting=ge,m(F)}else if(F.code)return m(F);if(ae==="\\"&&(j.next(),A.highlightFormatting)){var re=m(F),Z=I.formatting+"-escape";return re?re+" "+Z:Z}if(ae==="!"&&j.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,A.highlightFormatting&&(F.formatting="image"),m(F);if(ae==="["&&F.imageMarker&&j.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,A.highlightFormatting&&(F.formatting="image"),m(F);if(ae==="]"&&F.imageAltText){A.highlightFormatting&&(F.formatting="image");var re=m(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=E,re}if(ae==="["&&!F.image)return F.linkText&&j.match(/^.*?\]/)||(F.linkText=!0,A.highlightFormatting&&(F.formatting="link")),m(F);if(ae==="]"&&F.linkText){A.highlightFormatting&&(F.formatting="link");var re=m(F);return F.linkText=!1,F.inline=F.f=j.match(/\(.*?\)| ?\[.*?\]/,!1)?E:u,re}if(ae==="<"&&j.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,A.highlightFormatting&&(F.formatting="link");var re=m(F);return re?re+=" ":re="",re+I.linkInline}if(ae==="<"&&j.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,A.highlightFormatting&&(F.formatting="link");var re=m(F);return re?re+=" ":re="",re+I.linkEmail}if(A.xml&&ae==="<"&&j.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ne=j.string.indexOf(">",j.pos);if(ne!=-1){var me=j.string.substring(j.start,ne);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(me)&&(F.md_inside=!0)}return j.backUp(1),F.htmlState=$.startState(W),s(j,F,L)}if(A.xml&&ae==="<"&&j.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var de=1,Se=j.pos==1?" ":j.string.charAt(j.pos-2);de<3&&j.eat(ae);)de++;var ye=j.peek()||" ",Ie=!/\s/.test(ye)&&(!d.test(ye)||/\s/.test(Se)||d.test(Se)),Ee=!/\s/.test(Se)&&(!d.test(Se)||/\s/.test(ye)||d.test(ye)),De=null,Re=null;if(de%2&&(!F.em&&Ie&&(ae==="*"||!Ee||d.test(Se))?De=!0:F.em==ae&&Ee&&(ae==="*"||!Ie||d.test(ye))&&(De=!1)),de>1&&(!F.strong&&Ie&&(ae==="*"||!Ee||d.test(Se))?Re=!0:F.strong==ae&&Ee&&(ae==="*"||!Ie||d.test(ye))&&(Re=!1)),Re!=null||De!=null){A.highlightFormatting&&(F.formatting=De==null?"strong":Re==null?"em":"strong em"),De===!0&&(F.em=ae),Re===!0&&(F.strong=ae);var ee=m(F);return De===!1&&(F.em=!1),Re===!1&&(F.strong=!1),ee}}else if(ae===" "&&(j.eat("*")||j.eat("_"))){if(j.peek()===" ")return m(F);j.backUp(1)}if(A.strikethrough){if(ae==="~"&&j.eatWhile(ae)){if(F.strikethrough){A.highlightFormatting&&(F.formatting="strikethrough");var ee=m(F);return F.strikethrough=!1,ee}else if(j.match(/^[^\s]/,!1))return F.strikethrough=!0,A.highlightFormatting&&(F.formatting="strikethrough"),m(F)}else if(ae===" "&&j.match(/^~~/,!0)){if(j.peek()===" ")return m(F);j.backUp(2)}}if(A.emoji&&ae===":"&&j.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,A.highlightFormatting&&(F.formatting="emoji");var ke=m(F);return F.emoji=!1,ke}return ae===" "&&(j.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),m(F)}function o(j,F){var X=j.next();if(X===">"){F.f=F.inline=u,A.highlightFormatting&&(F.formatting="link");var te=m(F);return te?te+=" ":te="",te+I.linkInline}return j.match(/^[^>]+/,!0),I.linkInline}function E(j,F){if(j.eatSpace())return null;var X=j.next();return X==="("||X==="["?(F.f=F.inline=c(X==="("?")":"]"),A.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,m(F)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function c(j){return function(F,X){var te=F.next();if(te===j){X.f=X.inline=u,A.highlightFormatting&&(X.formatting="link-string");var ae=m(X);return X.linkHref=!1,ae}return F.match(v[j]),X.linkHref=!0,m(X)}}function _(j,F){return j.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=U,j.next(),A.highlightFormatting&&(F.formatting="link"),F.linkText=!0,m(F)):l(j,F,u)}function U(j,F){if(j.match(/^\]:/,!0)){F.f=F.inline=B,A.highlightFormatting&&(F.formatting="link");var X=m(F);return F.linkText=!1,X}return j.match(/^([^\]\\]|\\.)+/,!0),I.linkText}function B(j,F){return j.eatSpace()?null:(j.match(/^[^\s]+/,!0),j.peek()===void 0?F.linkTitle=!0:j.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=u,I.linkHref+" url")}var z={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:u,text:f,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(j){return{f:j.f,prevLine:j.prevLine,thisLine:j.thisLine,block:j.block,htmlState:j.htmlState&&$.copyState(W,j.htmlState),indentation:j.indentation,localMode:j.localMode,localState:j.localMode?$.copyState(j.localMode,j.localState):null,inline:j.inline,text:j.text,formatting:!1,linkText:j.linkText,linkTitle:j.linkTitle,linkHref:j.linkHref,code:j.code,em:j.em,strong:j.strong,strikethrough:j.strikethrough,emoji:j.emoji,header:j.header,setext:j.setext,hr:j.hr,taskList:j.taskList,list:j.list,listStack:j.listStack.slice(0),quote:j.quote,indentedCode:j.indentedCode,trailingSpace:j.trailingSpace,trailingSpaceNewLine:j.trailingSpaceNewLine,md_inside:j.md_inside,fencedEndRE:j.fencedEndRE}},token:function(j,F){if(F.formatting=!1,j!=F.thisLine.stream){if(F.header=0,F.hr=!1,j.match(/^\s*$/,!0))return g(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:j},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=L)){var X=j.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(F.indentation=X,F.indentationDiff=null,X>0)return null}}return F.f(j,F)},innerMode:function(j){return j.block==L?{state:j.htmlState,mode:W}:j.localState?{state:j.localState,mode:j.localMode}:{state:j,mode:z}},indent:function(j,F,X){return j.block==L&&W.indent?W.indent(j.htmlState,F,X):j.localState&&j.localMode.indent?j.localMode.indent(j.localState,F,X):$.Pass},blankLine:g,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),$.defineMIME("text/markdown","markdown"),$.defineMIME("text/x-markdown","markdown")})},m7e3:function(rt,Qe,J){rt.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"}},nVVt:function(rt,Qe){rt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(rt,Qe,J){(function($){$(J("VrN/"))})(function($){"use strict";var K=$.Pos;function A(d,a){return d.line-a.line||d.ch-a.ch}var W="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=W+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+W+"]["+M+"]*)","g");function I(d,a,l,s){this.line=a,this.ch=l,this.cm=d,this.text=d.getLine(a),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function k(d,a){var l=d.cm.getTokenTypeAt(K(d.line,a));return l&&/\btag\b/.test(l)}function O(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function D(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function p(d){for(;;){var a=d.text.indexOf(">",d.ch);if(a==-1){if(O(d))continue;return}if(!k(d,a+1)){d.ch=a+1;continue}var l=d.text.lastIndexOf("/",a),s=l>-1&&!/\S/.test(d.text.slice(l+1,a));return d.ch=a+1,s?"selfClose":"regular"}}function y(d){for(;;){var a=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(a==-1){if(D(d))continue;return}if(!k(d,a+1)){d.ch=a;continue}P.lastIndex=a,d.ch=a;var l=P.exec(d.text);if(l&&l.index==a)return l}}function R(d){for(;;){P.lastIndex=d.ch;var a=P.exec(d.text);if(!a){if(O(d))continue;return}if(!k(d,a.index+1)){d.ch=a.index+1;continue}return d.ch=a.index+a[0].length,a}}function S(d){for(;;){var a=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(a==-1){if(D(d))continue;return}if(!k(d,a+1)){d.ch=a;continue}var l=d.text.lastIndexOf("/",a),s=l>-1&&!/\S/.test(d.text.slice(l+1,a));return d.ch=a+1,s?"selfClose":"regular"}}function x(d,a){for(var l=[];;){var s=R(d),C,g=d.line,h=d.ch-(s?s[0].length:0);if(!s||!(C=p(d)))return;if(C=="selfClose")continue;if(s[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==s[2]){l.length=L;break}if(L<0&&(!a||a==s[2]))return{tag:s[2],from:K(g,h),to:K(d.line,d.ch)}}else l.push(s[2])}}function b(d,a){for(var l=[];;){var s=S(d);if(!s)return;if(s=="selfClose"){y(d);continue}var C=d.line,g=d.ch,h=y(d);if(!h)return;if(h[1])l.push(h[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==h[2]){l.length=L;break}if(L<0&&(!a||a==h[2]))return{tag:h[2],from:K(d.line,d.ch),to:K(C,g)}}}}$.registerHelper("fold","xml",function(d,a){for(var l=new I(d,a.line,0);;){var s=R(l);if(!s||l.line!=a.line)return;var C=p(l);if(!C)return;if(!s[1]&&C!="selfClose"){var g=K(l.line,l.ch),h=x(l,s[2]);return h&&A(h.from,g)>0?{from:g,to:h.from}:null}}}),$.findMatchingTag=function(d,a,l){var s=new I(d,a.line,a.ch,l);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var C=p(s),g=C&&K(s.line,s.ch),h=C&&y(s);if(!C||!h||A(s,a)>0)return;var L={from:K(s.line,s.ch),to:g,tag:h[2]};return C=="selfClose"?{open:L,close:null,at:"open"}:h[1]?{open:b(s,h[2]),close:L,at:"close"}:(s=new I(d,g.line,g.ch,l),{open:L,close:x(s,h[2]),at:"open"})},$.findEnclosingTag=function(d,a,l,s){for(var C=new I(d,a.line,a.ch,l);;){var g=b(C,s);if(!g)break;var h=new I(d,a.line,a.ch,l),L=x(h,g.tag);if(L)return{open:g,close:L}}},$.scanForClosingTag=function(d,a,l,s){var C=new I(d,a.line,a.ch,s?{from:0,to:s}:null);return x(C,l)}})},p5ED:function(rt,Qe,J){"use strict";var $=J("+L6B"),K=J("2/Rp"),A=J("5Dmo"),W=J("3S7+"),M=J("k1fw"),P=J("tJVT"),I=J("cDcd"),k=J.n(I),O=J("vHTk"),D=J.n(O),p=J("yEEn"),y=J("ZW9T"),R=J("1vsH");Qe.a=function(S){var x=S.name,b=S.data,d=S.theme,a=S.type,l=S.filename,s=S.monacoEditor,C=S.className,g=S.style,h=S.close,L=S.onClose,T=S.hasMask,m=Object(I.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(P.a)(m,2),u=f[0],o=f[1],E=Object(I.useState)(""),v=Object(P.a)(E,2),c=v[0],_=v[1],U,B=1024*1024,z=10*B,j=Object(I.useRef)();a==="office"&&(U=Object(R.V)(b).filesize,U>z&&(a="other")),l&&(s.filename=l),Object(I.useEffect)(function(){var te,ae,ce=(te=document.cookie)===null||te===void 0||((ae=te.replace(/\s/g,""))===null||ae===void 0)?void 0:ae.split(";");ce==null||ce.map(function(Te){var ge=Te.split("=");ge[0]==="_educoder_session"&&_(ge[1])})},[]);var F=function(){if(b.startsWith("http")||b.startsWith("blob:")){X();return}Object(R.z)(l||"educoder",b,l)},X=function(){Object(R.x)(l||"educoder",decodeURIComponent(b))};return console.log("data:",b,"fileanme:",l," name:",x),k.a.createElement("div",{style:Object(M.a)({},g||{}),className:"".concat(T&&D.a.bgBlack," ").concat(a?D.a.wrp:"hide")},h&&k.a.createElement("div",{className:D.a.close,ref:j},k.a.createElement(W.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return j.current}},k.a.createElement("span",{onClick:X},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(W.a,{title:"\u5173\u95ED",getPopupContainer:function(){return j.current}},k.a.createElement("span",{className:"",onClick:L},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(D.a[C]," ").concat(C," ").concat(D.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&k.a.createElement(y.b,s)),a==="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}),a==="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})),a==="html"&&k.a.createElement("iframe",{src:b+"&disposition=inline"}),a==="html"&&k.a.createElement("iframe",{src:b+"&disposition=inline"}),a==="pdf"&&k.a.createElement("embed",{className:D.a.embed,src:b}),a==="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)})),a==="other"&&k.a.createElement("div",null,k.a.createElement(K.a,{type:"primary",size:"large",onClick:F},k.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&k.a.createElement(K.a,{type:"primary",size:"large",onClick:F},k.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(rt,Qe,J){},"rAM+":function(rt,Qe,J){"use strict";J.d(Qe,"a",function(){return K});var $=J("Qw5x");function K(A,W){var M;if(typeof Symbol=="undefined"||A[Symbol.iterator]==null){if(Array.isArray(A)||(M=Object($.a)(A))||W&&A&&typeof A.length=="number"){M&&(A=M);var P=0,I=function(){};return{s:I,n:function(){return P>=A.length?{done:!0}:{done:!1,value:A[P++]}},e:function(y){throw y},f:I}}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,O=!1,D;return{s:function(){M=A[Symbol.iterator]()},n:function(){var y=M.next();return k=y.done,y},e:function(y){O=!0,D=y},f:function(){try{!k&&M.return!=null&&M.return()}finally{if(O)throw D}}}}},rUJ1:function(rt,Qe){const J=/[&<>"']/,$=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,W={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},M=T=>W[T];function P(T,m){if(m){if(J.test(T))return T.replace($,M)}else if(K.test(T))return T.replace(A,M);return T}const I=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(T){return T.replace(I,(m,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const O=/(^|[^\[])\^/g;function D(T,m){T=T.source||T,m=m||"";const f={replace:(u,o)=>(o=o.source||o,o=o.replace(O,"$1"),T=T.replace(u,o),f),getRegex:()=>new RegExp(T,m)};return f}const p=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(T,m,f){if(T){let u;try{u=decodeURIComponent(k(f)).replace(p,"").toLowerCase()}catch(o){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}m&&!y.test(f)&&(f=a(m,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(u){return null}return f}const S={},x=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(T,m){S[" "+T]||(x.test(T)?S[" "+T]=T+"/":S[" "+T]=g(T,"/",!0)),T=S[" "+T];const f=T.indexOf(":")===-1;return m.substring(0,2)==="//"?f?m:T.replace(b,"$1")+m:m.charAt(0)==="/"?f?m:T.replace(d,"$1")+m:T+m}const l={exec:function(){}};function s(T){let m=1,f,u;for(;m<arguments.length;m++){f=arguments[m];for(u in f)Object.prototype.hasOwnProperty.call(f,u)&&(T[u]=f[u])}return T}function C(T,m){const f=T.replace(/\|/g,(E,v,c)=>{let _=!1,U=v;for(;--U>=0&&c[U]==="\\";)_=!_;return _?"|":" |"}),u=f.split(/ \|/);let o=0;if(u.length>m)u.splice(m);else for(;u.length<m;)u.push("");for(;o<u.length;o++)u[o]=u[o].trim().replace(/\\\|/g,"|");return u}function g(T,m,f){const u=T.length;if(u===0)return"";let o=0;for(;o<u;){const E=T.charAt(u-o-1);if(E===m&&!f)o++;else if(E!==m&&f)o++;else break}return T.substr(0,u-o)}function h(T,m){if(T.indexOf(m[1])===-1)return-1;const f=T.length;let u=0,o=0;for(;o<f;o++)if(T[o]==="\\")o++;else if(T[o]===m[0])u++;else if(T[o]===m[1]&&(u--,u<0))return o;return-1}function L(T){T&&T.sanitize&&!T.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}rt.exports={escape:P,unescape:k,edit:D,cleanUrl:R,resolveUrl:a,noopTest:l,merge:s,splitCells:C,rtrim:g,findClosingBracket:h,checkSanitizeDeprecation:L}},rcnY:function(rt,Qe,J){var $=J("aRTE");function K(A,W){this.totalCount=A,this.dataCount=W}K.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],K.getRSBlocks=function(A,W){var M=K.getRsBlockTable(A,W);if(M==null)throw new Error("bad rs block @ typeNumber:"+A+"/errorCorrectLevel:"+W);for(var P=M.length/3,I=new Array,k=0;k<P;k++)for(var O=M[k*3+0],D=M[k*3+1],p=M[k*3+2],y=0;y<O;y++)I.push(new K(D,p));return I},K.getRsBlockTable=function(A,W){switch(W){case $.L:return K.RS_BLOCK_TABLE[(A-1)*4+0];case $.M:return K.RS_BLOCK_TABLE[(A-1)*4+1];case $.Q:return K.RS_BLOCK_TABLE[(A-1)*4+2];case $.H:return K.RS_BLOCK_TABLE[(A-1)*4+3];default:return}},rt.exports=K},uK0f:function(rt,Qe,J){(function($,K){rt.exports=K()})(this,function(){"use strict";function $(K,A,W){W=W||{},W.childrenKeyName=W.childrenKeyName||"children";var M=K||[],P=[],I=0;do{var k=M.filter(function(O){return A(O,I)})[0];if(!k)break;P.push(k),M=k[W.childrenKeyName]||[],I+=1}while(M.length>0);return P}return $})},ulZh:function(rt,Qe,J){typeof window!="undefined"&&function(K,A){rt.exports=A()}(this,function(){return function($){var K={};function A(W){if(K[W])return K[W].exports;var M=K[W]={i:W,l:!1,exports:{}};return $[W].call(M.exports,M,M.exports,A),M.l=!0,M.exports}return A.m=$,A.c=K,A.d=function(W,M,P){A.o(W,M)||Object.defineProperty(W,M,{enumerable:!0,get:P})},A.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},A.t=function(W,M){if(M&1&&(W=A(W)),M&8)return W;if(M&4&&typeof W=="object"&&W&&W.__esModule)return W;var P=Object.create(null);if(A.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:W}),M&2&&typeof W!="string")for(var I in W)A.d(P,I,function(k){return W[k]}.bind(null,I));return P},A.n=function(W){var M=W&&W.__esModule?function(){return W.default}:function(){return W};return A.d(M,"a",M),M},A.o=function(W,M){return Object.prototype.hasOwnProperty.call(W,M)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function($,K,A){"use strict";var W=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function I(p,y,R){this.fn=p,this.context=y,this.once=R||!1}function k(p,y,R,S,x){if(typeof R!="function")throw new TypeError("The listener must be a function");var b=new I(R,S||p,x),d=M?M+y:y;return p._events[d]?p._events[d].fn?p._events[d]=[p._events[d],b]:p._events[d].push(b):(p._events[d]=b,p._eventsCount++),p}function O(p,y){--p._eventsCount===0?p._events=new P:delete p._events[y]}function D(){this._events=new P,this._eventsCount=0}D.prototype.eventNames=function(){var y=[],R,S;if(this._eventsCount===0)return y;for(S in R=this._events)W.call(R,S)&&y.push(M?S.slice(1):S);return Object.getOwnPropertySymbols?y.concat(Object.getOwnPropertySymbols(R)):y},D.prototype.listeners=function(y){var R=M?M+y:y,S=this._events[R];if(!S)return[];if(S.fn)return[S.fn];for(var x=0,b=S.length,d=new Array(b);x<b;x++)d[x]=S[x].fn;return d},D.prototype.listenerCount=function(y){var R=M?M+y:y,S=this._events[R];return S?S.fn?1:S.length:0},D.prototype.emit=function(y,R,S,x,b,d){var a=M?M+y:y;if(!this._events[a])return!1;var l=this._events[a],s=arguments.length,C,g;if(l.fn){l.once&&this.removeListener(y,l.fn,void 0,!0);switch(s){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,R),!0;case 3:return l.fn.call(l.context,R,S),!0;case 4:return l.fn.call(l.context,R,S,x),!0;case 5:return l.fn.call(l.context,R,S,x,b),!0;case 6:return l.fn.call(l.context,R,S,x,b,d),!0}for(g=1,C=new Array(s-1);g<s;g++)C[g-1]=arguments[g];l.fn.apply(l.context,C)}else{var h=l.length,L;for(g=0;g<h;g++){l[g].once&&this.removeListener(y,l[g].fn,void 0,!0);switch(s){case 1:l[g].fn.call(l[g].context);break;case 2:l[g].fn.call(l[g].context,R);break;case 3:l[g].fn.call(l[g].context,R,S);break;case 4:l[g].fn.call(l[g].context,R,S,x);break;default:if(!C)for(L=1,C=new Array(s-1);L<s;L++)C[L-1]=arguments[L];l[g].fn.apply(l[g].context,C)}}}return!0},D.prototype.on=function(y,R,S){return k(this,y,R,S,!1)},D.prototype.once=function(y,R,S){return k(this,y,R,S,!0)},D.prototype.removeListener=function(y,R,S,x){var b=M?M+y:y;if(!this._events[b])return this;if(!R)return O(this,b),this;var d=this._events[b];if(d.fn)d.fn===R&&(!x||d.once)&&(!S||d.context===S)&&O(this,b);else{for(var a=0,l=[],s=d.length;a<s;a++)(d[a].fn!==R||x&&!d[a].once||S&&d[a].context!==S)&&l.push(d[a]);l.length?this._events[b]=l.length===1?l[0]:l:O(this,b)}return this},D.prototype.removeAllListeners=function(y){var R;return y?(R=M?M+y:y,this._events[R]&&O(this,R)):(this._events=new P,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=M,D.EventEmitter=D,$.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function($,K,A){(function(W){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,I=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(D,p,y){if(y=y||{},D=D.trim(),p=p.trim(),!p){if(!y.alwaysNormalize)return D;var R=O.parseURL(D);if(!R)throw new Error("Error trying to parse base URL.");return R.path=O.normalizePath(R.path),O.buildURLFromParts(R)}var S=O.parseURL(p);if(!S)throw new Error("Error trying to parse relative URL.");if(S.scheme)return y.alwaysNormalize?(S.path=O.normalizePath(S.path),O.buildURLFromParts(S)):p;var x=O.parseURL(D);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var b=P.exec(x.path);x.netLoc=b[1],x.path=b[2]}x.netLoc&&!x.path&&(x.path="/");var d={scheme:x.scheme,netLoc:S.netLoc,path:null,params:S.params,query:S.query,fragment:S.fragment};if(!S.netLoc&&(d.netLoc=x.netLoc,S.path[0]!=="/"))if(!S.path)d.path=x.path,S.params||(d.params=x.params,S.query||(d.query=x.query));else{var a=x.path,l=a.substring(0,a.lastIndexOf("/")+1)+S.path;d.path=O.normalizePath(l)}return d.path===null&&(d.path=y.alwaysNormalize?O.normalizePath(S.path):S.path),O.buildURLFromParts(d)},parseURL:function(D){var p=M.exec(D);return p?{scheme:p[1]||"",netLoc:p[2]||"",path:p[3]||"",params:p[4]||"",query:p[5]||"",fragment:p[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(I,"");D.length!==(D=D.replace(k,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};$.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function($,K,A){function W(y){var R={};function S(b){if(R[b])return R[b].exports;var d=R[b]={i:b,l:!1,exports:{}};return y[b].call(d.exports,d,d.exports,S),d.l=!0,d.exports}S.m=y,S.c=R,S.i=function(b){return b},S.d=function(b,d,a){S.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:a})},S.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},S.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return S.d(d,"a",d),d},S.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},S.p="/",S.oe=function(b){throw console.error(b),b};var x=S(S.s=ENTRY_MODULE);return x.default||x}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function I(y){return(y+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(y){return!isNaN(1*y)}function O(y,R,S){var x={};x[S]=[];var b=R.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return x;for(var a=d[1],l=new RegExp("(\\\\n|\\W)"+I(a)+P,"g"),s;s=l.exec(b);){if(s[3]==="dll-reference")continue;x[S].push(s[3])}for(l=new RegExp("\\("+I(a)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");s=l.exec(b);)y[s[2]]||(x[S].push(s[1]),y[s[2]]=A(s[1]).m),x[s[2]]=x[s[2]]||[],x[s[2]].push(s[4]);for(var C=Object.keys(x),g=0;g<C.length;g++)for(var h=0;h<x[C[g]].length;h++)k(x[C[g]][h])&&(x[C[g]][h]=1*x[C[g]][h]);return x}function D(y){var R=Object.keys(y);return R.reduce(function(S,x){return S||y[x].length>0},!1)}function p(y,R){for(var S={main:[R]},x={main:[]},b={main:{}};D(S);)for(var d=Object.keys(S),a=0;a<d.length;a++){var l=d[a],s=S[l],C=s.pop();if(b[l]=b[l]||{},b[l][C]||!y[l][C])continue;b[l][C]=!0,x[l]=x[l]||[],x[l].push(C);for(var g=O(y,y[l][C],l),h=Object.keys(g),L=0;L<h.length;L++)S[h[L]]=S[h[L]]||[],S[h[L]]=S[h[L]].concat(g[h[L]])}return x}$.exports=function(y,R){R=R||{};var S={main:A.m},x=R.all?{main:Object.keys(S.main)}:p(S,y),b="";Object.keys(x).filter(function(C){return C!=="main"}).forEach(function(C){for(var g=0;x[C][g];)g++;x[C].push(g),S[C][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+C+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+x[C].map(function(h){return""+JSON.stringify(h)+": "+S[C][h].toString()}).join(",")+`});
`}),b=b+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(y))+")({"+x.main.map(function(C){return""+JSON.stringify(C)+": "+S.main[C].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(R.bare)return d;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(d),s=new window.Worker(l);return s.objectURL=l,s}},"./src/config.ts":function($,K,A){"use strict";A.r(K),A.d(K,"hlsDefaultConfig",function(){return L}),A.d(K,"mergeConfig",function(){return m}),A.d(K,"enableStreamingMode",function(){return f});var W=A("./src/controller/abr-controller.ts"),M=A("./src/controller/audio-stream-controller.ts"),P=A("./src/controller/audio-track-controller.ts"),I=A("./src/controller/subtitle-stream-controller.ts"),k=A("./src/controller/subtitle-track-controller.ts"),O=A("./src/controller/buffer-controller.ts"),D=A("./src/controller/timeline-controller.ts"),p=A("./src/controller/cap-level-controller.ts"),y=A("./src/controller/fps-controller.ts"),R=A("./src/controller/eme-controller.ts"),S=A("./src/controller/cmcd-controller.ts"),x=A("./src/utils/xhr-loader.ts"),b=A("./src/utils/fetch-loader.ts"),d=A("./src/utils/cues.ts"),a=A("./src/utils/mediakeys-helper.ts"),l=A("./src/utils/logger.ts");function s(){return s=Object.assign||function(u){for(var o=1;o<arguments.length;o++){var E=arguments[o];for(var v in E)Object.prototype.hasOwnProperty.call(E,v)&&(u[v]=E[v])}return u},s.apply(this,arguments)}function C(u,o){var E=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);o&&(v=v.filter(function(c){return Object.getOwnPropertyDescriptor(u,c).enumerable})),E.push.apply(E,v)}return E}function g(u){for(var o=1;o<arguments.length;o++){var E=arguments[o]!=null?arguments[o]:{};o%2?C(Object(E),!0).forEach(function(v){h(u,v,E[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(E)):C(Object(E)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(E,v))})}return u}function h(u,o,E){return o in u?Object.defineProperty(u,o,{value:E,enumerable:!0,configurable:!0,writable:!0}):u[o]=E,u}var L=g(g({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:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:O.default,capLevelController:p.default,fpsController:y.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:I.SubtitleStreamController,subtitleTrackController:k.default,timelineController:D.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:R.default,cmcdController:S.default});function T(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function m(u,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},u,o)}function f(u){var o=u.loader;if(o!==b.default&&o!==x.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var E=Object(b.fetchSupported)();E&&(u.loader=b.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/ewma-bandwidth-estimator.ts"),P=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),k=A("./src/errors.ts"),O=A("./src/types/loader.ts"),D=A("./src/utils/logger.ts");function p(S,x){for(var b=0;b<x.length;b++){var d=x[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(S,d.key,d)}}function y(S,x,b){return x&&p(S.prototype,x),b&&p(S,b),S}var R=function(){function S(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 x=S.prototype;return x.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)},x.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)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(d,a){var l=a.frag;if(l.type===O.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=l,this.partCurrent=(s=a.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(d,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var d=this.fragCurrent,a=this.partCurrent,l=this.hls,s=l.autoLevelEnabled,C=l.config,g=l.media;if(!d||!g)return;var h=a?a.stats:d.stats,L=a?a.duration:d.duration;if(h.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||g.paused||!g.playbackRate||!g.readyState)return;var T=performance.now()-h.loading.start,m=Math.abs(g.playbackRate);if(T<=500*L/m)return;var f=l.levels,u=l.minAutoLevel,o=f[d.level],E=h.total||Math.max(h.loaded,Math.round(L*o.maxBitrate/8)),v=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/T),c=(E-h.loaded)/v,_=g.currentTime,U=(I.BufferHelper.bufferInfo(g,_,C.maxBufferHole).end-_)/m;if(U>=2*L/m||c<=U)return;var B=Number.POSITIVE_INFINITY,z;for(z=d.level-1;z>u;z--){var j=f[z].maxBitrate;if(B=L*j/(8*.8*v),B<U)break}if(B>=c)return;var F=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+d.sn+(a?" part "+a.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
Current BW estimate: `+(Object(W.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+c.toFixed(3)+` s
Estimated load time for the next fragment: `+B.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=z,this.bwEstimator.sample(T,h.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:a,stats:h})},x.onFragLoaded=function(d,a){var l=a.frag,s=a.part;if(l.type===O.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(l.sn)){var C=s?s.stats:l.stats,g=s?s.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[l.level],L=(h.loaded?h.loaded.bytes:0)+C.loaded,T=(h.loaded?h.loaded.duration:0)+g;h.loaded={bytes:L,duration:T},h.realBitrate=Math.round(8*L/T)}if(l.bitrateTest){var m={stats:C,frag:l,part:s,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},x.onFragBuffered=function(d,a){var l=a.frag,s=a.part,C=s?s.stats:l.stats;if(C.aborted)return;if(l.type!==O.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},x.onError=function(d,a){switch(a.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var d=this.fragCurrent,a=this.partCurrent,l=this.hls,s=l.maxAutoLevel,C=l.config,g=l.minAutoLevel,h=l.media,L=a?a.duration:d?d.duration:0,T=h?h.currentTime:0,m=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,u=(I.BufferHelper.bufferInfo(h,T,C.maxBufferHole).end-T)/m,o=this.findBestLevel(f,g,s,u,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(o>=0)return o;D.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=L?Math.min(L,C.maxStarvationDelay):C.maxStarvationDelay,v=C.abrBandWidthFactor,c=C.abrBandWidthUpFactor;if(!u){var _=this.bitrateTestDelay;if(_){var U=L?Math.min(L,C.maxLoadingDelay):C.maxLoadingDelay;E=U-_,D.logger.trace("bitrate test took "+Math.round(1e3*_)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),v=c=1}}return o=this.findBestLevel(f,g,s,u+E,v,c),Math.max(o,0)},x.findBestLevel=function(d,a,l,s,C,g){for(var h,L=this.fragCurrent,T=this.partCurrent,m=this.lastLoadedFragLevel,f=this.hls.levels,u=f[m],o=!!(u!=null&&(h=u.details)!==null&&h!==void 0&&h.live),E=u==null?void 0:u.codecSet,v=T?T.duration:L?L.duration:0,c=l;c>=a;c--){var _=f[c];if(!_||E&&_.codecSet!==E)continue;var U=_.details,B=(T?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||v,z=void 0;c<=m?z=C*d:z=g*d;var j=f[c].maxBitrate,F=j*B/z;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+c+"/"+Math.round(z)+"/"+j+"/"+B+"/"+s+"/"+F),z>j&&(!F||o&&!this.bitrateTestDelay||F<s))return c}return-1},y(S,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,a=this.bwEstimator;if(d!==-1&&(!a||!a.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),S}();K.default=R},"./src/controller/audio-stream-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/events.ts"),I=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),O=A("./src/types/level.ts"),D=A("./src/types/loader.ts"),p=A("./src/loader/fragment.ts"),y=A("./src/demux/chunk-cache.ts"),R=A("./src/demux/transmuxer-interface.ts"),S=A("./src/types/transmuxer.ts"),x=A("./src/controller/fragment-finders.ts"),b=A("./src/utils/discontinuities.ts"),d=A("./src/errors.ts"),a=A("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(L[f]=m[f])}return L},l.apply(this,arguments)}function s(L,T){L.prototype=Object.create(T.prototype),L.prototype.constructor=L,C(L,T)}function C(L,T){return C=Object.setPrototypeOf||function(f,u){return f.__proto__=u,f},C(L,T)}var g=100,h=function(L){s(T,L);function T(f,u){var o;return o=L.call(this,f,u,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var m=T.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var u=this.hls;u.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(P.Events.ERROR,this.onError,this),u.on(P.Events.BUFFER_RESET,this.onBufferReset,this),u.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var u=this.hls;u.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(P.Events.ERROR,this.onError,this),u.off(P.Events.BUFFER_RESET,this.onBufferReset,this),u.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(u,o){var E=o.frag,v=o.id,c=o.initPTS;if(v==="main"){var _=E.cc;this.initPTS[E.cc]=c,this.log("InitPTS for cc: "+_+" found from main: "+c),this.videoTrackCC=_,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=M.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,o>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},m.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var u,o=this.levels,E=this.trackId,v=o==null||((u=o[E])===null||u===void 0)?void 0:u.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var c,_=performance.now(),U=this.retryDate;(!U||_>=U||(c=this.media)!==null&&c!==void 0&&c.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var z=B.frag,j=B.part,F=B.cache,X=B.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var te=F.flush(),ae={frag:z,part:j,payload:te,networkDetails:null};this._handleFragmentLoadProgress(ae),X&&L.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ce=this.getLoadPosition(),Te=I.BufferHelper.bufferInfo(this.mediaBuffer,ce,this.config.maxBufferHole),ge=Object(x.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,z);ge<0&&(a.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},m.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:u,E=o.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},m.doTickIdle=function(){var u,o,E=this.hls,v=this.levels,c=this.media,_=this.trackId,U=E.config;if(!v||!v[_])return;if(!c&&(this.startFragRequested||!U.startFragPrefetch))return;var B=v[_],z=B.details;if(!z||z.live&&this.levelLastLoaded!==_||this.waitForCdnTuneIn(z)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,p.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(),te=this.audioSwitch;if(F>=X&&!te)return;if(!te&&this._streamEnded(j,z)){E.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ae=z.fragments,ce=ae[0].start,Te=j.end;if(te){var ge=this.getLoadPosition();Te=ge,z.PTSKnown&&ge<ce&&((j.end>ce||j.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),c.currentTime=ce+.05))}var he=this.getNextFragment(Te,z);if(!he){this.bufferFlushed=!0;return}((u=he.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((o=he.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(he,z):this.loadFragment(he,z,Te)},m.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return o===null?u:Math.max(u,o.len)},m.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(u,o){var E=o.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(v){return new O.Level(v)})},m.onAudioTrackSwitching=function(u,o){var E=!!o.url;this.trackId=o.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(g):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(u,o){this.mainDetails=o.details},m.onAudioTrackLoaded=function(u,o){var E,v=this.levels,c=o.details,_=o.id;if(!v){this.warn("Audio tracks were reset while loading level "+_);return}this.log("Track "+_+" loaded ["+c.startSN+","+c.endSN+"],duration:"+c.totalduration);var U=v[_],B=0;if(c.live||(E=U.details)!==null&&E!==void 0&&E.live){var z=this.mainDetails;if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed||!z)return;!U.details&&c.hasProgramDateTime&&z.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(c,z),B=c.fragments[0].start):B=this.alignPlaylists(c,U.details)}U.details=c,this.levelLastLoaded=_,!this.startFragRequested&&(this.mainDetails||!c.live)&&this.setStartPosition(U.details,B),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(c)&&(this.state=M.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(u){var o,E=u.frag,v=u.part,c=u.payload,_=this.config,U=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var z=B[U];console.assert(z,"Audio track is defined on fragment load progress");var j=z.details;console.assert(j,"Audio track details are defined on fragment load progress");var F=_.defaultAudioCodec||z.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new R.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var te=this.initPTS[E.cc],ae=(o=E.initSegment)===null||o===void 0?void 0:o.data;if(te!==void 0){var ce=!1,Te=v?v.index:-1,ge=Te!==-1,he=new S.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,c.byteLength,Te,ge);X.push(c,ae,F,"",E,v,j.totalduration,ce,he,te)}else{a.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+U);var ee=this.waitingData=this.waitingData||{frag:E,part:v,cache:new y.default,complete:!1},re=ee.cache;re.push(new Uint8Array(c)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(u,o){var E=o.tracks.audio;E&&(this.mediaBuffer=E.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},m.onFragBuffered=function(u,o){var E=o.frag,v=o.part;if(E.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(v?" p: "+v.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,v)},m.onError=function(u,o){switch(o.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,o);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=o.fatal?M.State.ERROR:M.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var E=!0,v=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);v&&v.len>.5&&(E=!this.reduceMaxBufferLength(v.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(u,o){var E=o.type;E===p.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(u){var o,E="audio",v=this.hls,c=u.remuxResult,_=u.chunkMeta,U=this.getCurrentContext(_);if(!U){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var B=U.frag,z=U.part,j=c.audio,F=c.text,X=c.id3,te=c.initSegment;if(this.fragContextChanged(B))return;if(this.state=M.State.PARSING,this.audioSwitch&&j&&this.completeAudioSwitch(),te!=null&&te.tracks&&(this._bufferInitSegment(te.tracks,B,_),v.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:E,tracks:te.tracks})),j){var ae=j.startPTS,ce=j.endPTS,Te=j.startDTS,ge=j.endDTS;z&&(z.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:ce,startDTS:Te,endDTS:ge}),B.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,ae,ce,Te,ge),this.bufferFragmentData(j,B,z,_)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var he=l({frag:B,id:E},X);v.trigger(P.Events.FRAG_PARSING_METADATA,he)}if(F){var ee=l({frag:B,id:E},F);v.trigger(P.Events.FRAG_PARSING_USERDATA,ee)}},m._bufferInitSegment=function(u,o,E){if(this.state!==M.State.PARSING)return;u.video&&delete u.video;var v=u.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,u);var c=v.initSegment;if(c!=null&&c.byteLength){var _={type:"audio",frag:o,part:null,chunkMeta:E,parent:o.type,data:c};this.hls.trigger(P.Events.BUFFER_APPENDING,_)}this.tick()},m.loadFragment=function(u,o,E){var v=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||v===k.FragmentState.NOT_LOADED||v===k.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):o.live&&!Object(W.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,o,E)))},m.completeAudioSwitch=function(){var u=this.hls,o=this.media,E=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:E})},T}(M.default);K.default=h},"./src/controller/audio-track-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/controller/base-playlist-controller.ts"),I=A("./src/types/loader.ts");function k(R,S){for(var x=0;x<S.length;x++){var b=S[x];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function O(R,S,x){return S&&k(R.prototype,S),x&&k(R,x),R}function D(R,S){R.prototype=Object.create(S.prototype),R.prototype.constructor=R,p(R,S)}function p(R,S){return p=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},p(R,S)}var y=function(R){D(S,R);function S(b){var d;return d=R.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 x=S.prototype;return x.registerListeners=function(){var d=this.hls;d.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(W.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(W.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(d,a){this.tracks=a.audioTracks||[]},x.onAudioTrackLoaded=function(d,a){var l=a.id,s=a.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var g=C.details;C.details=a.details,this.log("audioTrack "+l+" loaded ["+s.startSN+"-"+s.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,g))},x.onLevelLoading=function(d,a){this.switchLevel(a.level)},x.onLevelSwitching=function(d,a){this.switchLevel(a.level)},x.switchLevel=function(d){var a=this.hls.levels[d];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var s=this.tracks.filter(function(g){return!l||g.groupId===l});this.selectDefaultTrack&&!s.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var C={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},x.onError=function(d,a){if(R.prototype.onError.call(this,d,a),a.fatal||!a.context)return;a.context.type===I.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},x.setAudioTrack=function(d){var a=this.tracksInGroup;if(d<0||d>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+d);var s=a[d],C=s.id,g=s.groupId,h=g===void 0?"":g,L=s.name,T=s.type,m=s.url;if(this.trackId=d,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:h,name:L,type:T,url:m}),s.details&&!s.details.live)return;var f=this.switchParams(s.url,l==null?void 0:l.details);this.loadPlaylist(f)},x.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(d){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var s=a[l];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},x.loadPlaylist=function(d){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,s=a.groupId,C=a.url;if(d)try{C=d.addDirectives(C)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:s,deliveryDirectives:d||null})}},O(S,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),S}(P.default);K.default=y},"./src/controller/base-playlist-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var W=A("./src/polyfills/number.ts"),M=A("./src/types/level.ts"),P=A("./src/controller/level-helper.ts"),I=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),O=function(){function D(y,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=I.logger.log.bind(I.logger,R+":"),this.warn=I.logger.warn.bind(I.logger,R+":"),this.hls=y}var p=D.prototype;return p.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},p.onError=function(R,S){S.fatal&&S.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},p.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},p.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},p.stopLoad=function(){this.canLoad=!1,this.clearTimer()},p.switchParams=function(R,S){var x=S==null?void 0:S.renditionReports;if(x)for(var b=0;b<x.length;b++){var d=x[b],a=""+d.URI;if(a===R.substr(-a.length)){var l=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(S&&this.hls.config.lowLatencyMode){var C=Math.min(S.age-S.partTarget,S.targetduration);s!==void 0&&C>S.partTarget&&(s+=1)}if(Object(W.isFiniteNumber)(l))return new M.HlsUrlParameters(l,Object(W.isFiniteNumber)(s)?s:void 0,M.HlsSkip.No)}}},p.loadPlaylist=function(R){},p.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},p.playlistLoaded=function(R,S,x){var b=this,d=S.details,a=S.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||x!=null&&x.live){if(d.reloaded(x),x&&this.log("live playlist "+R+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),x&&d.fragments.length>0&&Object(P.mergeDetails)(x,d),!this.canLoad||!d.live)return;var s,C=void 0,g=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var h=this.hls.config.lowLatencyMode,L=d.lastPartSn,T=d.endSN,m=d.lastPartIndex,f=m!==-1,u=L===T,o=h?0:m;f?(C=u?T+1:L,g=u?o:m+1):C=T+1;var E=d.age,v=E+d.ageHeader,c=Math.min(v-d.partTarget,d.targetduration*1.5);if(c>0){if(x&&c>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+c+" with playlist age: "+d.age),c=0;else{var _=Math.floor(c/d.targetduration);if(C+=_,g!==void 0){var U=Math.round(c%d.targetduration/d.partTarget);g+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+c+" skip sn "+_+" to part "+g)}d.tuneInGoal=c}if(s=this.getDeliveryDirectives(d,S.deliveryDirectives,C,g),h||!u){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,S.deliveryDirectives,C,g);var B=Object(P.computeReloadInterval)(d,a);C!==void 0&&d.canBlockReload&&(B-=d.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(s)},B)}else this.clearTimer()},p.getDeliveryDirectives=function(R,S,x,b){var d=Object(M.getSkipValue)(R,x);return S!=null&&S.skip&&R.deltaUpdateFailed&&(x=S.msn,b=S.part,d=M.HlsSkip.No),new M.HlsUrlParameters(x,b,d)},p.retryLoadingOrFail=function(R){var S=this,x=this.hls.config,b=this.retryCount<x.levelLoadingMaxRetry;if(b){var d;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(d=R.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return S.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return b},D}()},"./src/controller/base-stream-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"State",function(){return T}),A.d(K,"default",function(){return m});var W=A("./src/polyfills/number.ts"),M=A("./src/task-loop.ts"),P=A("./src/controller/fragment-tracker.ts"),I=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/logger.ts"),O=A("./src/events.ts"),D=A("./src/errors.ts"),p=A("./src/types/transmuxer.ts"),y=A("./src/utils/mp4-tools.ts"),R=A("./src/utils/discontinuities.ts"),S=A("./src/controller/fragment-finders.ts"),x=A("./src/controller/level-helper.ts"),b=A("./src/loader/fragment-loader.ts"),d=A("./src/crypt/decrypter.ts"),a=A("./src/utils/time-ranges.ts"),l=A("./src/types/loader.ts");function s(f,u){for(var o=0;o<u.length;o++){var E=u[o];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(f,E.key,E)}}function C(f,u,o){return u&&s(f.prototype,u),o&&s(f,o),f}function g(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,u){f.prototype=Object.create(u.prototype),f.prototype.constructor=f,L(f,u)}function L(f,u){return L=Object.setPrototypeOf||function(E,v){return E.__proto__=v,E},L(f,u)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},m=function(f){h(u,f);function u(E,v,c){var _;return _=f.call(this)||this,_.hls=void 0,_.fragPrevious=null,_.fragCurrent=null,_.fragmentTracker=void 0,_.transmuxer=null,_._state=T.STOPPED,_.media=void 0,_.mediaBuffer=void 0,_.config=void 0,_.bitrateTest=!1,_.lastCurrentTime=0,_.nextLoadPosition=0,_.startPosition=0,_.loadedmetadata=!1,_.fragLoadError=0,_.retryDate=0,_.levels=null,_.fragmentLoader=void 0,_.levelLastLoaded=null,_.startFragRequested=!1,_.decrypter=void 0,_.initPTS=[],_.onvseeking=null,_.onvended=null,_.logPrefix="",_.log=void 0,_.warn=void 0,_.logPrefix=c,_.log=k.logger.log.bind(k.logger,c+":"),_.warn=k.logger.warn.bind(k.logger,c+":"),_.hls=E,_.fragmentLoader=new b.default(E.config),_.fragmentTracker=v,_.config=E.config,_.decrypter=new d.default(E,E.config),E.on(O.Events.KEY_LOADED,_.onKeyLoaded,g(_)),_}var o=u.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(v){},o.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},o._streamEnded=function(v,c){var _=this.fragCurrent,U=this.fragmentTracker;if(!c.live&&_&&_.sn===c.endSN&&!v.nextStart){var B=U.getState(_);return B===P.FragmentState.PARTIAL||B===P.FragmentState.OK}return!1},o.onMediaAttached=function(v,c){var _=this.media=this.mediaBuffer=c.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),_.addEventListener("seeking",this.onvseeking),_.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(U.startPosition)},o.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var v=this.config,c=this.fragCurrent,_=this.media,U=this.mediaBuffer,B=this.state,z=_?_.currentTime:0,j=I.BufferHelper.bufferInfo(U||_,z,v.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+B),B===T.ENDED)this.resetLoadingState();else if(c&&!j.len){var F=v.maxFragLookUpTolerance,X=c.start-F,te=c.start+c.duration+F,ae=z>te;(z<X||ae)&&(ae&&c.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),c.loader.abort()),this.resetLoadingState())}_&&(this.lastCurrentTime=z),!this.loadedmetadata&&!j.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(v,c){if(this.state!==T.KEY_LOADING||c.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var _=this.levels[c.frag.level].details;_&&this.loadFragment(c.frag,_,c.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(O.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,f.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(v,c){this.log("Loading key for "+v.sn+" of ["+c.startSN+"-"+c.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=T.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(O.Events.KEY_LOADING,{frag:v})},o.loadFragment=function(v,c,_){this._loadFragForPlayback(v,c,_)},o._loadFragForPlayback=function(v,c,_){var U=this,B=function(j){if(U.fragContextChanged(v)){U.warn("Fragment "+v.sn+(j.part?" p: "+j.part.index:"")+" of level "+v.level+" was dropped during download."),U.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,U._handleFragmentLoadProgress(j)};this._doFragLoad(v,c,_,B).then(function(z){if(!z)return;U.fragLoadError=0;var j=U.state;if(U.fragContextChanged(v)){(j===T.FRAG_LOADING||j===T.BACKTRACKING||!U.fragCurrent&&j===T.PARSING)&&(U.fragmentTracker.removeFragment(v),U.state=T.IDLE);return}if("payload"in z&&(U.log("Loaded fragment "+v.sn+" of level "+v.level),U.hls.trigger(O.Events.FRAG_LOADED,z),U.state===T.BACKTRACKING)){U.fragmentTracker.backtrack(v,z),U.resetFragmentLoading(v);return}U._handleFragmentLoadComplete(z)}).catch(function(z){U.warn(z),U.resetFragmentLoading(v)})},o.flushMainBuffer=function(v,c,_){if(_===void 0&&(_=null),!(v-c))return;var U={startOffset:v,endOffset:c,type:_};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,U)},o._loadInitSegment=function(v){var c=this;this._doFragLoad(v).then(function(_){if(!_||c.fragContextChanged(v)||!c.levels)throw new Error("init load aborted");return _}).then(function(_){var U=c.hls,B=_.payload,z=v.decryptdata;if(B&&B.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var j=self.performance.now();return c.decrypter.webCryptoDecrypt(new Uint8Array(B),z.key.buffer,z.iv.buffer).then(function(F){var X=self.performance.now();return U.trigger(O.Events.FRAG_DECRYPTED,{frag:v,payload:F,stats:{tstart:j,tdecrypt:X}}),_.payload=F,_})}return _}).then(function(_){var U=c.fragCurrent,B=c.hls,z=c.levels;if(!z)throw new Error("init load aborted, missing levels");var j=z[v.level].details;console.assert(j,"Level details are defined when init segment is loaded");var F=v.stats;c.state=T.IDLE,c.fragLoadError=0,v.data=new Uint8Array(_.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),_.frag===U&&B.trigger(O.Events.FRAG_BUFFERED,{stats:F,frag:U,part:null,id:v.type}),c.tick()}).catch(function(_){c.warn(_),c.resetFragmentLoading(v)})},o.fragContextChanged=function(v){var c=this.fragCurrent;return!v||!c||v.level!==c.level||v.sn!==c.sn||v.urlId!==c.urlId},o.fragBufferedComplete=function(v,c){var _=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(c?" part: "+c.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+a.default.toString(I.BufferHelper.getBuffered(_))),this.state=T.IDLE,this.tick()},o._handleFragmentLoadComplete=function(v){var c=this.transmuxer;if(!c)return;var _=v.frag,U=v.part,B=v.partsLoaded,z=!B||B.length===0||B.some(function(F){return!F}),j=new p.ChunkMetadata(_.level,_.sn,_.stats.chunkCount+1,0,U?U.index:-1,!z);c.flush(j)},o._handleFragmentLoadProgress=function(v){},o._doFragLoad=function(v,c,_,U){var B=this;if(_===void 0&&(_=null),!this.levels)throw new Error("frag load aborted, missing levels");if(_=Math.max(v.start,_||0),this.config.lowLatencyMode&&c){var z=c.partList;if(z&&U){_>v.end&&c.fragmentHint&&(v=c.fragmentHint);var j=this.getNextPart(z,v,_);if(j>-1){var F=z[j];return this.log("Loading part sn: "+v.sn+" p: "+F.index+" cc: "+v.cc+" of playlist ["+c.startSN+"-"+c.endSN+"] parts [0-"+j+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(_.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=T.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:v,part:z[j],targetBufferTime:_}),this.doFragPartsLoad(v,z,j,U).catch(function(X){return B.handleFragLoadError(X)})}else if(!v.url||this.loadedEndOfParts(z,_))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(c?"of ["+c.startSN+"-"+c.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(_.toFixed(3))),Object(W.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=T.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:v,targetBufferTime:_}),this.fragmentLoader.load(v,U).catch(function(X){return B.handleFragLoadError(X)})},o.doFragPartsLoad=function(v,c,_,U){var B=this;return new Promise(function(z,j){var F=[],X=function te(ae){var ce=c[ae];B.fragmentLoader.loadPart(v,ce,U).then(function(Te){F[ce.index]=Te;var ge=Te.part;B.hls.trigger(O.Events.FRAG_LOADED,Te);var he=c[ae+1];if(he&&he.fragment===v)te(ae+1);else return z({frag:v,part:ge,partsLoaded:F})}).catch(j)};X(_)})},o.handleFragLoadError=function(v){var c=v.data;return c&&c.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(c.frag,c.part):this.hls.trigger(O.Events.ERROR,c),null},o._handleTransmuxerFlush=function(v){var c=this.getCurrentContext(v);if(!c||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var _=c.frag,U=c.part,B=c.level,z=self.performance.now();_.stats.parsing.end=z,U&&(U.stats.parsing.end=z),this.updateLevelTiming(_,U,B,v.partial)},o.getCurrentContext=function(v){var c=this.levels,_=v.level,U=v.sn,B=v.part;if(!c||!c[_])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+_+". The current chunk will not be buffered."),null;var z=c[_],j=B>-1?Object(x.getPartWith)(z,U,B):null,F=j?j.fragment:Object(x.getFragmentWithSN)(z,U,this.fragCurrent);return F?{frag:F,part:j,level:z}:null},o.bufferFragmentData=function(v,c,_,U){if(!v||this.state!==T.PARSING)return;var B=v.data1,z=v.data2,j=B;if(B&&z&&(j=Object(y.appendUint8Array)(B,z)),!j||!j.length)return;var F={type:v.type,frag:c,part:_,chunkMeta:U,parent:c.type,data:j};this.hls.trigger(O.Events.BUFFER_APPENDING,F),v.dropped&&v.independent&&!_&&this.flushBufferGap(c)},o.flushBufferGap=function(v){var c=this.media;if(!c)return;if(!I.BufferHelper.isBuffered(c,c.currentTime)){this.flushMainBuffer(0,v.start);return}var _=c.currentTime,U=I.BufferHelper.bufferInfo(c,_,0),B=v.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),j=Math.max(Math.min(v.start-z,U.end-z),_+z);v.start-j>z&&this.flushMainBuffer(j,v.start)},o.getFwdBufferInfo=function(v,c){var _=this.config,U=this.getLoadPosition();if(!Object(W.isFiniteNumber)(U))return null;var B=I.BufferHelper.bufferInfo(v,U,_.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(U,c);if(z&&B.nextStart<z.end)return I.BufferHelper.bufferInfo(v,U,Math.max(B.nextStart,_.maxBufferHole))}return B},o.getMaxBufferLength=function(v){var c=this.config,_;return v?_=Math.max(8*c.maxBufferSize/v,c.maxBufferLength):_=c.maxBufferLength,Math.min(_,c.maxMaxBufferLength)},o.reduceMaxBufferLength=function(v){var c=this.config,_=v||c.maxBufferLength;return c.maxMaxBufferLength>=_?(c.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+c.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(v,c){var _,U,B=c.fragments,z=B.length;if(!z)return null;var j=this.config,F=B[0].start,X;if(c.live){var te=j.initialLiveManifestSize;if(z<te)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+te+")"),null;!c.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(c,B),this.startPosition=X?this.hls.liveSyncPosition||X.start:v)}else v<=F&&(X=B[0]);if(!X){var ae=j.lowLatencyMode?c.partEnd:c.fragmentEnd;X=this.getFragmentAtPosition(v,ae,c)}return(_=X)!==null&&_!==void 0&&_.initSegment&&!((U=X)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(v,c,_){for(var U=-1,B=!1,z=!0,j=0,F=v.length;j<F;j++){var X=v[j];if(z=z&&!X.independent,U>-1&&_<X.start)break;var te=X.loaded;!te&&(B||X.independent||z)&&X.fragment===c&&(U=j),B=te}return U},o.loadedEndOfParts=function(v,c){var _=v[v.length-1];return _&&c>_.start&&_.loaded},o.getInitialLiveFragment=function(v,c){var _=this.fragPrevious,U=null;if(_){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+_.programDateTime),U=Object(S.findFragmentByPDT)(c,_.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var B=_.sn+1;if(B>=v.startSN&&B<=v.endSN){var z=c[B-v.startSN];_.cc===z.cc&&(U=z,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(S.findFragWithCC)(c,_.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var j=this.hls.liveSyncPosition;j!==null&&(U=this.getFragmentAtPosition(j,this.bitrateTest?v.fragmentEnd:v.edge,v))}return U},o.getFragmentAtPosition=function(v,c,_){var U=this.config,B=this.fragPrevious,z=_.fragments,j=_.endSN,F=_.fragmentHint,X=U.maxFragLookUpTolerance,te=!!(U.lowLatencyMode&&_.partList&&F);te&&F&&!this.bitrateTest&&(z=z.concat(F),j=F.sn);var ae;if(v<c){var ce=v>c-X?0:X;ae=Object(S.findFragmentByPTS)(B,z,v,ce)}else ae=z[z.length-1];if(ae){var Te=ae.sn-_.startSN,ge=B&&ae.level===B.level,he=z[Te+1],ee=this.fragmentTracker.getState(ae);if(ee===P.FragmentState.BACKTRACKED){ae=null;for(var re=Te;z[re]&&this.fragmentTracker.getState(z[re])===P.FragmentState.BACKTRACKED;)B?ae=z[re--]:ae=z[--re];ae||(ae=he)}else B&&ae.sn===B.sn&&!te&&(ge&&(ae.sn<j&&this.fragmentTracker.getState(he)!==P.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+he.sn),ae=he):ae=null))}return ae},o.synchronizeToLiveEdge=function(v){var c=this.config,_=this.media;if(!_)return;var U=this.hls.liveSyncPosition,B=_.currentTime,z=v.fragments[0].start,j=v.edge,F=B>=z-c.maxFragLookUpTolerance&&B<=j;if(U!==null&&_.duration>U&&(B<U||!F)){var X=c.liveMaxLatencyDuration!==void 0?c.liveMaxLatencyDuration:c.liveMaxLatencyDurationCount*v.targetduration;(!F&&_.readyState<4||B<j-X)&&(this.loadedmetadata||(this.nextLoadPosition=U),_.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+j+", reset currentTime to : "+U.toFixed(3)),_.currentTime=U))}},o.alignPlaylists=function(v,c){var _=this.levels,U=this.levelLastLoaded,B=this.fragPrevious,z=U!==null?_[U]:null,j=v.fragments.length;if(!j)return this.warn("No fragments in live playlist"),0;var F=v.fragments[0].start,X=!c,te=v.alignedSliding&&Object(W.isFiniteNumber)(F);if(X||!te&&!F){Object(R.alignStream)(B,z,v);var ae=v.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(c?c.startSN:"na")+"->"+v.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+j),ae}return F},o.waitForCdnTuneIn=function(v){var c=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*c)},o.setStartPosition=function(v,c){var _=this.startPosition;if(_<c&&(_=-1),_===-1||this.lastCurrentTime===-1){var U=v.startTimeOffset;Object(W.isFiniteNumber)(U)?(_=c+U,U<0&&(_+=v.totalduration),_=Math.min(Math.max(c,_),c+v.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+_),this.startPosition=_):v.live?_=this.hls.liveSyncPosition||c:this.startPosition=_=0,this.lastCurrentTime=_}this.nextLoadPosition=_},o.getLoadPosition=function(){var v=this.media,c=0;return this.loadedmetadata&&v?c=v.currentTime:this.nextLoadPosition&&(c=this.nextLoadPosition),c},o.handleFragLoadAborted=function(v,c){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(c?" part"+c.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},o.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=T.IDLE)},o.onFragmentOrKeyLoadError=function(v,c){if(c.fatal)return;var _=c.frag;if(!_||_.type!==v)return;var U=this.fragCurrent;console.assert(U&&_.sn===U.sn&&_.level===U.level&&_.urlId===U.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(_.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+_.sn+" of "+v+" "+_.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else c.levelRetry?(v===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(k.logger.error(c.details+" reaches max retry, redispatch as fatal ..."),c.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},o.afterBufferFlushed=function(v,c,_){if(!v)return;var U=I.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(c,U,_),this.state===T.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},o.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var c=this.levels?this.levels[v].details:null;if(c!=null&&c.live)return this.startPosition=-1,this.setStartPosition(c,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(v,c,_,U){var B=this,z=_.details;console.assert(!!z,"level.details must be defined");var j=Object.keys(v.elementaryStreams).reduce(function(F,X){var te=v.elementaryStreams[X];if(te){var ae=te.endPTS-te.startPTS;if(ae<=0)return B.warn("Could not parse fragment "+v.sn+" "+X+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),F||!1;var ce=U?0:Object(x.updateFragPTSDTS)(z,v,te.startPTS,te.endPTS,te.startDTS,te.endDTS);return B.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:z,level:_,drift:ce,type:X,frag:v,start:te.startPTS,end:te.endPTS}),!0}return F},!1);j?(this.state=T.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:v,part:c})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(u,[{key:"state",get:function(){return this._state},set:function(v){var c=this._state;c!==v&&(this._state=v,this.log(c+"->"+v))}}]),u}(M.default)},"./src/controller/buffer-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return S});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),I=A("./src/errors.ts"),k=A("./src/utils/buffer-helper.ts"),O=A("./src/utils/mediasource-helper.ts"),D=A("./src/loader/fragment.ts"),p=A("./src/controller/buffer-operation-queue.ts"),y=Object(O.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,S=function(){function x(d){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=a.hls,s=a.media,C=a.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),s&&(a.updateMediaElementDuration(),l.trigger(M.Events.MEDIA_ATTACHED,{media:s})),C&&C.removeEventListener("sourceopen",a._onMediaSourceOpen),a.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=x.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 a=this.hls;a.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(M.Events.BUFFER_RESET,this.onBufferReset,this),a.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(M.Events.BUFFER_EOS,this.onBufferEos,this),a.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(M.Events.FRAG_PARSED,this.onFragParsed,this),a.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var a=this.hls;a.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(M.Events.BUFFER_RESET,this.onBufferReset,this),a.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(M.Events.BUFFER_EOS,this.onBufferEos,this),a.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(M.Events.FRAG_PARSED,this.onFragParsed,this),a.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new p.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(a,l){var s=2;(l.audio&&!l.video||!l.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(a,l){var s=this.media=l.media;if(s&&y){var C=this.mediaSource=new y;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(C),this._objectUrl=s.src}},b.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,s=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){P.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(s&&self.URL.revokeObjectURL(s),a.src===s?(a.removeAttribute("src"),a.load()):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 a=this;this.getSourceBufferTypes().forEach(function(l){var s=a.sourceBuffer[l];try{s&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(s),a.sourceBuffer[l]=void 0)}catch(C){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},b.onBufferCodecs=function(a,l){var s=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(g){if(C){var h=s.tracks[g];if(h&&typeof h.buffer.changeType=="function"){var L=l[g],T=L.codec,m=L.levelCodec,f=L.container,u=(h.levelCodec||h.codec).replace(R,"$1"),o=(m||T).replace(R,"$1");if(u!==o){var E=f+";codecs="+(m||T);s.appendChangeType(g,E)}}}else s.pendingTracks[g]=l[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(a,l){var s=this,C=this.operationQueue,g={execute:function(){var L=s.sourceBuffer[a];L&&(P.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),L.changeType(l)),C.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",L)}};C.append(g,a)},b.onBufferAppending=function(a,l){var s=this,C=this.hls,g=this.operationQueue,h=this.tracks,L=l.data,T=l.type,m=l.frag,f=l.part,u=l.chunkMeta,o=u.buffering[T],E=self.performance.now();o.start=E;var v=m.stats.buffering,c=f?f.stats.buffering:null;v.start===0&&(v.start=E),c&&c.start===0&&(c.start=E);var _=h.audio,U=T==="audio"&&u.id===1&&(_==null?void 0:_.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),U){var j=s.sourceBuffer[T];if(j){var F=m.start-j.timestampOffset;Math.abs(F)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+F+") sn: "+m.sn+")"),j.timestampOffset=m.start)}}s.appendExecutor(L,T)},onStart:function(){},onComplete:function(){var j=self.performance.now();o.executeEnd=o.end=j,v.first===0&&(v.first=j),c&&c.first===0&&(c.first=j);var F=s.sourceBuffer,X={};for(var te in F)X[te]=k.BufferHelper.getBuffered(F[te]);s.appendError=0,s.hls.trigger(M.Events.BUFFER_APPENDED,{type:T,frag:m,part:f,chunkMeta:u,parent:m.type,timeRanges:X})},onError:function(j){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",j);var F={type:I.ErrorTypes.MEDIA_ERROR,parent:m.type,details:I.ErrorDetails.BUFFER_APPEND_ERROR,err:j,fatal:!1};j.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=I.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,F.details=I.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>C.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),C.trigger(M.Events.ERROR,F)}};g.append(B,T)},b.onBufferFlushing=function(a,l){var s=this,C=this.operationQueue,g=function(L){return{execute:s.removeExecutor.bind(s,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(M.Events.BUFFER_FLUSHED,{type:L})},onError:function(m){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",m)}}};l.type?C.append(g(l.type),l.type):this.getSourceBufferTypes().forEach(function(h){C.append(g(h),h)})},b.onFragParsed=function(a,l){var s=this,C=l.frag,g=l.part,h=[],L=g?g.elementaryStreams:C.elementaryStreams;L[D.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(L[D.ElementaryStreamTypes.AUDIO]&&h.push("audio"),L[D.ElementaryStreamTypes.VIDEO]&&h.push("video"));var T=function(){var f=self.performance.now();C.stats.buffering.end=f,g&&(g.stats.buffering.end=f);var u=g?g.stats:C.stats;s.hls.trigger(M.Events.FRAG_BUFFERED,{frag:C,part:g,stats:u,id:C.type})};h.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(T,h)},b.onFragChanged=function(a,l){this.flushBackBuffer()},b.onBufferEos=function(a,l){var s=this,C=this.getSourceBufferTypes().reduce(function(g,h){var L=s.sourceBuffer[h];return(!l.type||l.type===h)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),g&&!!(!L||L.ended)},!0);C&&this.blockBuffers(function(){var g=s.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},b.onLevelUpdated=function(a,l){var s=l.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var a=this.hls,l=this.details,s=this.media,C=this.sourceBuffer;if(!s||l===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var h=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(W.isFiniteNumber)(h)||h<0)return;var L=s.currentTime,T=l.levelTargetDuration,m=Math.max(h,T),f=Math.floor(L/T)*T-m;g.forEach(function(u){var o=C[u];if(o){var E=k.BufferHelper.getBuffered(o);E.length>0&&f>E.start(0)&&(a.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),l.live&&a.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),a.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:u}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,s=this.media,C=this.mediaSource,g=a.fragments[0].start+a.totalduration,h=s.duration,L=Object(W.isFiniteNumber)(C.duration)?C.duration:0;a.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(a)):(g>L&&g>h||!Object(W.isFiniteNumber)(h))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},b.updateSeekableRange=function(a){var l=this.mediaSource,s=a.fragments,C=s.length;if(C&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var g=Math.max(0,s[0].start),h=Math.max(g,g+a.totalduration);l.setLiveSeekableRange(g,h)}},b.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,s=this.pendingTracks,C=Object.keys(s).length;if(C&&!a||C===2){this.createSourceBuffers(s),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(h){l.executeNext(h)})}},b.createSourceBuffers=function(a){var l=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in a)if(!l[g]){var h=a[g];if(!h)throw Error("source buffer exists for track "+g+", however track does not");var L=h.levelCodec||h.codec,T=h.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var m=l[g]=s.addSourceBuffer(T),f=g;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[g]={buffer:m,codec:L,container:h.container,levelCodec:h.levelCodec,id:h.id},C++}catch(u){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:T})}}C&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(a){var l=this.operationQueue,s=l.current(a);s.onStart()},b._onSBUpdateEnd=function(a){var l=this.operationQueue,s=l.current(a);s.onComplete(),l.shiftAndExecuteNext(a)},b._onSBUpdateError=function(a,l){P.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(M.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(a);s&&s.onError(l)},b.removeExecutor=function(a,l,s){var C=this.media,g=this.mediaSource,h=this.operationQueue,L=this.sourceBuffer,T=L[a];if(!C||!g||!T){P.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(a);return}var m=Object(W.isFiniteNumber)(C.duration)?C.duration:Infinity,f=Object(W.isFiniteNumber)(g.duration)?g.duration:Infinity,u=Math.max(0,l),o=Math.min(s,m,f);o>u?(P.logger.log("[buffer-controller]: Removing ["+u+","+o+"] from the "+a+" SourceBuffer"),console.assert(!T.updating,a+" sourceBuffer must not be updating"),T.remove(u,o)):h.shiftAndExecuteNext(a)},b.appendExecutor=function(a,l){var s=this.operationQueue,C=this.sourceBuffer,g=C[l];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(l);return}g.ended=!1,console.assert(!g.updating,l+" sourceBuffer must not be updating"),g.appendBuffer(a)},b.blockBuffers=function(a,l){var s=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var C=this.operationQueue,g=l.map(function(h){return C.appendBlocker(h)});Promise.all(g).then(function(){a(),l.forEach(function(h){var L=s.sourceBuffer[h];(!L||!L.updating)&&C.shiftAndExecuteNext(h)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(a,l,s){var C=this.sourceBuffer[a];if(!C)return;var g=s.bind(this,a);this.listeners[a].push({event:l,listener:g}),C.addEventListener(l,g)},b.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(s){l.removeEventListener(s.event,s.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return M});var W=A("./src/utils/logger.ts"),M=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var I=P.prototype;return I.append=function(O,D){var p=this.queues[D];p.push(O),p.length===1&&this.buffers[D]&&this.executeNext(D)},I.insertAbort=function(O,D){var p=this.queues[D];p.unshift(O),this.executeNext(D)},I.appendBlocker=function(O){var D,p=new Promise(function(R){D=R}),y={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(y,O),p},I.executeNext=function(O){var D=this.buffers,p=this.queues,y=D[O],R=p[O];if(R.length){var S=R[0];try{S.execute()}catch(x){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),S.onError(x),(!y||!y.updating)&&(R.shift(),this.executeNext(O))}}},I.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},I.current=function(O){return this.queues[O][0]},P}()},"./src/controller/cap-level-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/events.ts");function M(k,O){for(var D=0;D<O.length;D++){var p=O[D];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(k,p.key,p)}}function P(k,O,D){return O&&M(k.prototype,O),D&&M(k,D),k}var I=function(){function k(D){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=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=k.prototype;return O.setStreamController=function(p){this.streamController=p},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var p=this.hls;p.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),p.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),p.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var p=this.hls;p.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),p.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),p.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),p.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(p,y){k.isLevelAllowed(y.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(y.droppedLevel)},O.onMediaAttaching=function(p,y){this.media=y.media instanceof HTMLVideoElement?y.media:null},O.onManifestParsed=function(p,y){var R=this.hls;this.restrictedLevels=[],this.firstLevel=y.firstLevel,R.config.capLevelToPlayerSize&&y.video&&this.startCapping()},O.onBufferCodecs=function(p,y){var R=this.hls;R.config.capLevelToPlayerSize&&y.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var p=this.hls.levels;if(p.length){var y=this.hls;y.autoLevelCapping=this.getMaxLevel(p.length-1),y.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=y.autoLevelCapping}}},O.getMaxLevel=function(p){var y=this,R=this.hls.levels;if(!R.length)return-1;var S=R.filter(function(x,b){return k.isLevelAllowed(b,y.restrictedLevels)&&b<=p});return this.clientRect=null,k.getMaxLevelByMediaSize(S,this.mediaWidth,this.mediaHeight)},O.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()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var p=this.media,y={width:0,height:0};if(p){var R=p.getBoundingClientRect();y.width=R.width,y.height=R.height,!y.width&&!y.height&&(y.width=R.right-R.left||p.width||0,y.height=R.bottom-R.top||p.height||0)}return this.clientRect=y,y},k.isLevelAllowed=function(p,y){return y===void 0&&(y=[]),y.indexOf(p)===-1},k.getMaxLevelByMediaSize=function(p,y,R){if(!p||!p.length)return-1;for(var S=function(l,s){return s?l.width!==s.width||l.height!==s.height:!0},x=p.length-1,b=0;b<p.length;b+=1){var d=p[b];if((d.width>=y||d.height>=R)&&S(d,p[b+1])){x=b;break}}return x},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 p=1;try{p=self.devicePixelRatio}catch(y){}return p}}]),k}();K.default=I},"./src/controller/cmcd-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return S});var W=A("./src/events.ts"),M=A("./src/types/cmcd.ts"),P=A("./src/utils/buffer-helper.ts"),I=A("./src/utils/logger.ts");function k(x,b){for(var d=0;d<b.length;d++){var a=b[d];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(x,a.key,a)}}function O(x,b,d){return b&&k(x.prototype,b),d&&k(x,d),x}function D(x,b){var d=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(d)return(d=d.call(x)).next.bind(d);if(Array.isArray(x)||(d=p(x))||b&&x&&typeof x.length=="number"){d&&(x=d);var a=0;return function(){return a>=x.length?{done:!0}:{done:!1,value:x[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function p(x,b){if(!x)return;if(typeof x=="string")return y(x,b);var d=Object.prototype.toString.call(x).slice(8,-1);if(d==="Object"&&x.constructor&&(d=x.constructor.name),d==="Map"||d==="Set")return Array.from(x);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return y(x,b)}function y(x,b){(b==null||b>x.length)&&(b=x.length);for(var d=0,a=new Array(b);d<b;d++)a[d]=x[d];return a}function R(){return R=Object.assign||function(x){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(x[a]=d[a])}return x},R.apply(this,arguments)}var S=function(){function x(d){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(C){try{a.apply(C,{ot:M.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(g){I.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(C){try{var g=C.frag,h=a.hls.levels[g.level],L=a.getObjectType(g),T={d:g.duration*1e3,ot:L};(L===M.CMCDObjectType.VIDEO||L===M.CMCDObjectType.AUDIO||L==M.CMCDObjectType.MUXED)&&(T.br=h.bitrate/1e3,T.tb=a.getTopBandwidth(L),T.bl=a.getBufferLength(L)),a.apply(C,T)}catch(m){I.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=d;var l=this.config=d.config,s=l.cmcd;s!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||x.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var b=x.prototype;return b.registerListeners=function(){var a=this.hls;a.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var a=this.hls;a.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(W.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(a,l){this.media=l.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(a,l){var s,C;this.audioBuffer=(s=l.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},b.createData=function(){var a;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(a,l){l===void 0&&(l={}),R(l,this.createData());var s=l.ot===M.CMCDObjectType.INIT||l.ot===M.CMCDObjectType.VIDEO||l.ot===M.CMCDObjectType.MUXED;if(this.starved&&s&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=x.toHeaders(l);if(!Object.keys(C).length)return;a.headers||(a.headers={}),R(a.headers,C)}else{var g=x.toQuery(l);if(!g)return;a.url=x.appendQueryToUri(a.url,g)}},b.getObjectType=function(a){var l=a.type;return l==="subtitle"?M.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?M.CMCDObjectType.INIT:l==="audio"?M.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(a){for(var l=0,s=a===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=D(s),g;!(g=C()).done;){var h=g.value;h.bitrate>l&&(l=h.bitrate)}return l>0?l:NaN},b.getBufferLength=function(a){var l=this.hls.media,s=a===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!l)return NaN;var C=P.BufferHelper.bufferInfo(s,l.currentTime,this.config.maxBufferHole);return C.len*1e3},b.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,s=a||this.config.loader;return function(){function C(h){this.loader=void 0,this.loader=new s(h)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,T,m){l(L),this.loader.load(L,T,m)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,s=a||this.config.loader;return function(){function C(h){this.loader=void 0,this.loader=new s(h)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(L,T,m){l(L),this.loader.load(L,T,m)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},x.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},x.serialize=function(a){for(var l=[],s=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},C=function(U){return Math.round(U)},g=function(U){return C(U/100)*100},h=function(U){return encodeURIComponent(U)},L={br:C,d:C,bl:g,dl:g,mtp:g,nor:h,rtp:g,tb:C},T=Object.keys(a||{}).sort(),m=D(T),f;!(f=m()).done;){var u=f.value,o=a[u];if(!s(o))continue;if(u==="v"&&o===1)continue;if(u=="pr"&&o===1)continue;var E=L[u];E&&(o=E(o));var v=typeof o,c=void 0;u==="ot"||u==="sf"||u==="st"?c=u+"="+o:v==="boolean"?c=u:v==="number"?c=u+"="+o:c=u+"="+JSON.stringify(o),l.push(c)}return l.join(",")},x.toHeaders=function(a){for(var l=Object.keys(a),s={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],h={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},L=0,T=l;L<T.length;L++){var m=T[L],f=h[m]!=null?h[m]:1;g[f][m]=a[m]}for(var u=0;u<g.length;u++){var o=x.serialize(g[u]);o&&(s["CMCD-"+C[u]]=o)}return s},x.toQuery=function(a){return"CMCD="+encodeURIComponent(x.serialize(a))},x.appendQueryToUri=function(a,l){if(!l)return a;var s=a.includes("?")?"&":"?";return""+a+s+l},x}()},"./src/controller/eme-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),I=A("./src/utils/mediakeys-helper.ts");function k(S,x){for(var b=0;b<x.length;b++){var d=x[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(S,d.key,d)}}function O(S,x,b){return x&&k(S.prototype,x),b&&k(S,b),S}var D=3,p=function(x,b,d){var a={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),b.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[a]},y=function(x,b,d,a){switch(x){case I.KeySystems.WIDEVINE:return p(b,d,a);default:throw new Error("Unknown key-system: "+x)}},R=function(){function S(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 x=S.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(d){switch(d){case I.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},x._attemptKeySystemAccess=function(d,a,l){var s=this,C=y(d,a,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(d,C);this.mediaKeysPromise=g.then(function(h){return s._onMediaKeySystemAccessObtained(d,h)}),g.catch(function(h){P.logger.error('Failed to obtain key-system "'+d+'" access:',h)})},x._onMediaKeySystemAccessObtained=function(d,a){var l=this;P.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var C=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(g){return s.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),g});return C.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),C},x._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),d._onNewMediaKeySession(a.mediaKeysSession))})},x._onNewMediaKeySession=function(d){var a=this;P.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){a._onKeySessionMessage(d,l.message)},!1)},x._onKeySessionMessage=function(d,a){P.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},x.onMediaEncrypted=function(d){var a=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(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!a._media)return;a._attemptSetMediaKeys(C),a._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},x._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.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(a.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(d,a){var l=this,s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var C=s.mediaKeysSession;if(!C){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(W.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'),s.mediaKeysSessionInitialized=!0,C.generateRequest(d,a).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),l.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(d,a,l){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,a,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,s,d),C=void 0}catch(g){P.logger.error(g)}try{s.readyState||s.open("POST",d,!0),C&&C.call(this.hls,s,d)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return s},x._onLicenseRequestReadyStageChange=function(d,a,l,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var C=d.response,g=this._licenseResponseCallback;if(g)try{C=g.call(this.hls,d,a)}catch(L){P.logger.error(L)}s(C)}else{if(P.logger.error("License Request XHR failed ("+a+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=D-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(l,s)}break}},x._generateLicenseRequestChallenge=function(d,a){switch(d.mediaKeySystemDomain){case I.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},x._requestLicense=function(d,a){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(s,d,a);P.logger.log("Sending license request to URL: "+s);var g=this._generateLicenseRequestChallenge(l,d);C.send(g)}catch(h){P.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(d,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var d=this._media,a=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(d,a){if(!this._emeEnabled)return;var l=a.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),s=a.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(I.KeySystems.WIDEVINE,l,s)},O(S,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),S}();K.default=R},"./src/controller/fps-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=function(){function I(O){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=O,this.registerListeners()}var k=I.prototype;return k.setStreamController=function(D){this.streamController=D},k.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(D,p){var y=this.hls.config;if(y.capLevelOnFPSDrop){var R=p.media instanceof self.HTMLVideoElement?p.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),y.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(D,p,y){var R=performance.now();if(p){if(this.lastTime){var S=R-this.lastTime,x=y-this.lastDroppedFrames,b=p-this.lastDecodedFrames,d=1e3*x/S,a=this.hls;if(a.trigger(W.Events.FPS_DROP,{currentDropped:x,currentDecoded:b,totalDroppedFrames:y}),d>0&&x>a.config.fpsDroppedMonitoringThreshold*b){var l=a.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(W.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=y,this.lastDecodedFrames=p}},k.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var p=D.getVideoPlaybackQuality();this.checkFPS(D,p.totalVideoFrames,p.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},I}();K.default=P},"./src/controller/fragment-finders.ts":function($,K,A){"use strict";A.r(K),A.d(K,"findFragmentByPDT",function(){return P}),A.d(K,"findFragmentByPTS",function(){return I}),A.d(K,"fragmentWithinToleranceTest",function(){return k}),A.d(K,"pdtWithinToleranceTest",function(){return O}),A.d(K,"findFragWithCC",function(){return D});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/binary-search.ts");function P(p,y,R){if(y===null||!Array.isArray(p)||!p.length||!Object(W.isFiniteNumber)(y))return null;var S=p[0].programDateTime;if(y<(S||0))return null;var x=p[p.length-1].endProgramDateTime;if(y>=(x||0))return null;R=R||0;for(var b=0;b<p.length;++b){var d=p[b];if(O(y,R,d))return d}return null}function I(p,y,R,S){R===void 0&&(R=0),S===void 0&&(S=0);var x=null;if(p?x=y[p.sn-y[0].sn+1]||null:R===0&&y[0].start===0&&(x=y[0]),x&&k(R,S,x)===0)return x;var b=M.default.search(y,k.bind(null,R,S));return b||x}function k(p,y,R){p===void 0&&(p=0),y===void 0&&(y=0);var S=Math.min(y,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-S<=p?1:R.start-S>p&&R.start?-1:0}function O(p,y,R){var S=Math.min(y,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,x=R.endProgramDateTime||0;return x-S>p}function D(p,y){return M.default.search(p,function(R){return R.cc<y?1:R.cc>y?-1:0})}},"./src/controller/fragment-tracker.ts":function($,K,A){"use strict";A.r(K),A.d(K,"FragmentState",function(){return P}),A.d(K,"FragmentTracker",function(){return I});var W=A("./src/events.ts"),M=A("./src/types/loader.ts"),P;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(P||(P={}));var I=function(){function D(y){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=y,this._registerListeners()}var p=D.prototype;return p._registerListeners=function(){var R=this.hls;R.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},p._unregisterListeners=function(){var R=this.hls;R.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},p.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},p.getAppendedFrag=function(R,S){if(S===M.PlaylistLevelType.MAIN){var x=this.activeFragment,b=this.activeParts;if(!x)return null;if(b)for(var d=b.length;d--;){var a=b[d],l=a?a.end:x.appendedPTS;if(a.start<=R&&l!==void 0&&R<=l)return d>9&&(this.activeParts=b.slice(d-9)),a}else if(x.start<=R&&x.appendedPTS!==void 0&&R<=x.appendedPTS)return x}return this.getBufferedFrag(R,S)},p.getBufferedFrag=function(R,S){for(var x=this.fragments,b=Object.keys(x),d=b.length;d--;){var a=x[b[d]];if((a==null?void 0:a.body.type)===S&&a.buffered){var l=a.body;if(l.start<=R&&R<=l.end)return l}}return null},p.detectEvictedFragments=function(R,S,x){var b=this;Object.keys(this.fragments).forEach(function(d){var a=b.fragments[d];if(!a)return;if(!a.buffered){a.body.type===x&&b.removeFragment(a.body);return}var l=a.range[R];if(!l)return;l.time.some(function(s){var C=!b.isTimeBuffered(s.startPTS,s.endPTS,S);return C&&b.removeFragment(a.body),C})})},p.detectPartialFragments=function(R){var S=this,x=this.timeRanges,b=R.frag,d=R.part;if(!x||b.sn==="initSegment")return;var a=O(b),l=this.fragments[a];if(!l)return;Object.keys(x).forEach(function(s){var C=b.elementaryStreams[s];if(!C)return;var g=x[s],h=d!==null||C.partial===!0;l.range[s]=S.getBufferedTimes(b,d,h,g)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},p.fragBuffered=function(R){var S=O(R),x=this.fragments[S];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},p.getBufferedTimes=function(R,S,x,b){for(var d={time:[],partial:x},a=S?S.start:R.start,l=S?S.end:R.end,s=R.minEndPTS||l,C=R.maxStartPTS||a,g=0;g<b.length;g++){var h=b.start(g)-this.bufferPadding,L=b.end(g)+this.bufferPadding;if(C>=h&&s<=L){d.time.push({startPTS:Math.max(a,b.start(g)),endPTS:Math.min(l,b.end(g))});break}else if(a<L&&l>h)d.partial=!0,d.time.push({startPTS:Math.max(a,b.start(g)),endPTS:Math.min(l,b.end(g))});else if(l<=h)break}return d},p.getPartialFragment=function(R){var S=null,x,b,d,a=0,l=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(C){var g=s[C];if(!g)return;k(g)&&(b=g.body.start-l,d=g.body.end+l,R>=b&&R<=d&&(x=Math.min(R-b,d-R),a<=x&&(S=g.body,a=x)))}),S},p.getState=function(R){var S=O(R),x=this.fragments[S];return x?x.buffered?k(x)?P.PARTIAL:P.OK:x.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},p.backtrack=function(R,S){var x=O(R),b=this.fragments[x];if(!b||b.backtrack)return null;var d=b.backtrack=S||b.loaded;return b.loaded=null,d},p.getBacktrackData=function(R){var S=O(R),x=this.fragments[S];if(x){var b,d=x.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(R)}return null},p.isTimeBuffered=function(R,S,x){for(var b,d,a=0;a<x.length;a++){if(b=x.start(a)-this.bufferPadding,d=x.end(a)+this.bufferPadding,R>=b&&S<=d)return!0;if(S<=b)return!1}return!1},p.onFragLoaded=function(R,S){var x=S.frag,b=S.part;if(x.sn==="initSegment"||x.bitrateTest||b)return;var d=O(x);this.fragments[d]={body:x,loaded:S,backtrack:null,buffered:!1,range:Object.create(null)}},p.onBufferAppended=function(R,S){var x=this,b=S.frag,d=S.part,a=S.timeRanges;if(b.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(s){var C=a[s];if(x.detectEvictedFragments(s,C),!d)for(var g=0;g<C.length;g++)b.appendedPTS=Math.max(C.end(g),b.appendedPTS||0)})},p.onFragBuffered=function(R,S){this.detectPartialFragments(S)},p.hasFragment=function(R){var S=O(R);return!!this.fragments[S]},p.removeFragmentsInRange=function(R,S,x){var b=this;Object.keys(this.fragments).forEach(function(d){var a=b.fragments[d];if(!a)return;if(a.buffered){var l=a.body;l.type===x&&l.start<S&&l.end>R&&b.removeFragment(l)}})},p.removeFragment=function(R){var S=O(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[S]},p.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function k(D){var p,y;return D.buffered&&(((p=D.range.video)===null||p===void 0?void 0:p.partial)||((y=D.range.audio)===null||y===void 0?void 0:y.partial))}function O(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"STALL_MINIMUM_DURATION_MS",function(){return k}),A.d(K,"MAX_START_GAP_JUMP",function(){return O}),A.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),A.d(K,"SKIP_BUFFER_RANGE_START",function(){return p}),A.d(K,"default",function(){return y});var W=A("./src/utils/buffer-helper.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts"),I=A("./src/utils/logger.ts"),k=250,O=2,D=.1,p=.05,y=function(){function R(x,b,d,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=x,this.media=b,this.fragmentTracker=d,this.hls=a}var S=R.prototype;return S.destroy=function(){this.hls=this.fragmentTracker=this.media=null},S.poll=function(b){var d=this.config,a=this.media,l=this.stalled,s=a.currentTime,C=a.seeking,g=this.seeking&&!C,h=!this.seeking&&C;if(this.seeking=C,s!==b){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;I.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||g)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!W.BufferHelper.getBuffered(a).length)return;var T=W.BufferHelper.bufferInfo(a,s,0),m=T.len>0,f=T.nextStart||0;if(!m&&!f)return;if(C){var u=T.len>O,o=!f||f-s>O&&!this.fragmentTracker.getPartialFragment(s);if(u||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,v=Math.max(f,T.start||0)-s,c=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=c==null||((E=c.details)===null||E===void 0)?void 0:E.live,U=_?c.details.targetduration*2:O;if(v>0&&v<=U){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(l===null){this.stalled=B;return}var z=B-l;!C&&z>=k&&this._reportStall(T.len);var j=W.BufferHelper.bufferInfo(a,s,d.maxBufferHole);this._tryFixBufferStall(j,z)},S._tryFixBufferStall=function(b,d){var a=this.config,l=this.fragmentTracker,s=this.media,C=s.currentTime,g=l.getPartialFragment(C);if(g){var h=this._trySkipBufferHole(g);if(h)return}b.len>a.maxBufferHole&&d>a.highBufferWatchdogPeriod*1e3&&(I.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},S._reportStall=function(b){var d=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,I.logger.warn("Playback stalling at @"+a.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}))},S._trySkipBufferHole=function(b){for(var d=this.config,a=this.hls,l=this.media,s=l.currentTime,C=0,g=W.BufferHelper.getBuffered(l),h=0;h<g.length;h++){var L=g.start(h);if(s+d.maxBufferHole>=C&&s<L){var T=Math.max(L+p,l.currentTime+D);return I.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+T),this.moved=!0,this.stalled=null,l.currentTime=T,b&&a.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 "+s+" to "+T,frag:b}),T}C=g.end(h)}return 0},S._tryNudgeBuffer=function(){var b=this.config,d=this.hls,a=this.media,l=a.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<b.nudgeMaxRetry){var C=l+s*b.nudgeOffset;I.logger.warn("Nudging 'currentTime' from "+l+" to "+C),a.currentTime=C,d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else I.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/demux/id3.ts"),I=.25,k=function(){function O(p){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=p,this._registerListeners()}var D=O.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var y=this.hls;y.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),y.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var y=this.hls;y.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),y.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(y,R){this.media=R.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(y){if(!this.media)return;for(var R=0;R<y.length;R++){var S=y[R];if(S.kind==="metadata"&&S.label==="id3")return Object(M.sendAddTrackEvent)(S,this.media),S}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(y,R){if(!this.media)return;var S=R.frag,x=R.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<x.length;d++){var a=P.getID3Frames(x[d].data);if(a){var l=x[d].pts,s=d<x.length-1?x[d+1].pts:S.end,C=s-l;C<=0&&(s=l+I);for(var g=0;g<a.length;g++){var h=a[g];if(!P.isTimeStampFrame(h)){var L=new b(l,s,"");L.value=h,this.id3Track.addCue(L)}}}}},D.onBufferFlushing=function(y,R){var S=R.startOffset,x=R.endOffset,b=R.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(M.removeCuesInRange)(d,S,x)}},O}();K.default=k},"./src/controller/latency-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var W=A("./src/errors.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts");function I(D,p){for(var y=0;y<p.length;y++){var R=p[y];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function k(D,p,y){return p&&I(D.prototype,p),y&&I(D,y),D}var O=function(){function D(y){var R=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 R.timeupdate()},this.hls=y,this.config=y.config,this.registerListeners()}var p=D.prototype;return p.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},p.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)},p.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)},p.onMediaAttached=function(R,S){this.media=S.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},p.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},p.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},p.onLevelUpdated=function(R,S){var x=S.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},p.onError=function(R,S){if(S.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},p.timeupdate=function(){var R=this.media,S=this.levelDetails;if(!R||!S)return;this.currentTime=R.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var b=this.config,d=b.lowLatencyMode,a=b.maxLiveSyncPlaybackRate;if(!d||a===1)return;var l=this.targetLatency;if(l===null)return;var s=x-l,C=Math.min(this.maxLatency,l+S.targetduration),g=s<C;if(S.live&&g&&s>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,a)),L=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;R.playbackRate=Math.min(h,Math.max(1,L))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},p.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},p.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},k(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,S=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:S?R.liveMaxLatencyDurationCount*S.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var S=R.holdBack,x=R.partHoldBack,b=R.targetduration,d=this.config,a=d.liveSyncDuration,l=d.liveSyncDurationCount,s=d.lowLatencyMode,C=this.hls.userConfig,g=s&&x||S;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=a!==void 0?a:l*b);var h=b,L=1;return g+Math.min(this.stallCount*L,h)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),S=this.targetLatency,x=this.levelDetails;if(R===null||S===null||x===null)return null;var b=x.edge,d=R-S-this.edgeStalled,a=b-x.totalduration,l=b-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(a,d),l)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var S=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-S,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,S=this.levelDetails;if(!R||!S)return 0;var x=R.buffered.length;return x?R.buffered.end(x-1):S.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return d});var W=A("./src/types/level.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),I=A("./src/utils/codecs.ts"),k=A("./src/controller/level-helper.ts"),O=A("./src/controller/base-playlist-controller.ts"),D=A("./src/types/loader.ts");function p(){return p=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var C in s)Object.prototype.hasOwnProperty.call(s,C)&&(a[C]=s[C])}return a},p.apply(this,arguments)}function y(a,l){for(var s=0;s<l.length;s++){var C=l[s];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function R(a,l,s){return l&&y(a.prototype,l),s&&y(a,s),a}function S(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,x(a,l)}function x(a,l){return x=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},x(a,l)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(a){S(l,a);function l(C){var g;return g=a.call(this,C,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var s=l.prototype;return s._registerListeners=function(){var g=this.hls;g.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(M.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var g=this.hls;g.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(M.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},s.startLoad=function(){var g=this._levels;g.forEach(function(h){h.loadError=0}),a.prototype.startLoad.call(this)},s.onManifestLoaded=function(g,h){var L=[],T=[],m=[],f,u={},o,E=!1,v=!1,c=!1;if(h.levels.forEach(function(z){var j=z.attrs;E=E||!!(z.width&&z.height),v=v||!!z.videoCodec,c=c||!!z.audioCodec,b&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var F=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;o=u[F],o?o.url.push(z.url):(o=new W.Level(z),u[F]=o,L.push(o)),j&&(j.AUDIO&&Object(k.addGroupId)(o,"audio",j.AUDIO),j.SUBTITLES&&Object(k.addGroupId)(o,"text",j.SUBTITLES))}),(E||v)&&c&&(L=L.filter(function(z){var j=z.videoCodec,F=z.width,X=z.height;return!!j||!!(F&&X)})),L=L.filter(function(z){var j=z.audioCodec,F=z.videoCodec;return(!j||Object(I.isCodecSupportedInMp4)(j,"audio"))&&(!F||Object(I.isCodecSupportedInMp4)(F,"video"))}),h.audioTracks&&(T=h.audioTracks.filter(function(z){return!z.audioCodec||Object(I.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(T)),h.subtitles&&(m=h.subtitles,Object(k.assignTrackIdsByGroup)(m)),L.length>0){f=L[0].bitrate,L.sort(function(z,j){return z.bitrate-j.bitrate}),this._levels=L;for(var _=0;_<L.length;_++)if(L[_].bitrate===f){this._firstLevel=_,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+f);break}var U=c&&!v,B={levels:L,audioTracks:T,subtitleTracks:m,firstLevel:this._firstLevel,stats:h.stats,audio:c,video:v,altAudio:!U&&T.some(function(z){return!!z.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,B),(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:h.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(g,h){if(a.prototype.onError.call(this,g,h),h.fatal)return;var L=h.context,T=this._levels[this.currentLevelIndex];if(L&&(L.type===D.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&L.groupId===T.audioGroupIds[T.urlId]||L.type===D.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&L.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,f=!0,u;switch(h.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(h.frag){var o=this._levels[h.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=h.frag.level)):u=h.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(f=!1),u=L.level),m=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:u=h.level,m=!0;break}u!==void 0&&this.recoverLevel(h,u,m,f)},s.recoverLevel=function(g,h,L,T){var m=g.details,f=this._levels[h];if(f.loadError++,L){var u=this.retryLoadingOrFail(g);if(u)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var o=f.url.length;if(o>1&&f.loadError<o)g.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var E=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(m+": switch to "+E),g.levelRetry=!0,this.hls.nextAutoLevel=E)}}},s.redundantFailover=function(g){var h=this._levels[g],L=h.url.length;if(L>1){var T=(h.urlId+1)%L;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(m){m.urlId=T}),this.level=g}},s.onFragLoaded=function(g,h){var L=h.frag;if(L!==void 0&&L.type===D.PlaylistLevelType.MAIN){var T=this._levels[L.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},s.onLevelLoaded=function(g,h){var L,T=h.level,m=h.details,f=this._levels[T];if(!f){var u;this.warn("Invalid level index "+T),(u=h.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(m.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(T,h,f.details)):(L=h.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(m.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(g,h){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var T=-1,m=this.hls.audioTracks[h.id].groupId,f=0;f<L.audioGroupIds.length;f++)if(L.audioGroupIds[f]===m){T=f;break}T!==L.urlId&&(L.urlId=T,this.startLoad())}},s.loadPlaylist=function(g){var h=this.currentLevelIndex,L=this._levels[h];if(this.canLoad&&L&&L.url.length>0){var T=L.urlId,m=L.url[T];if(g)try{m=g.addDirectives(m)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+T+" "+m),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:m,level:h,id:T,deliveryDirectives:g||null})}},s.removeLevel=function(g,h){var L=function(f,u){return u!==h},T=this._levels.filter(function(m,f){return f!==g?!0:m.url.length>1&&h!==void 0?(m.url=m.url.filter(L),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(L)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(L)),m.urlId=0,!0):!1}).map(function(m,f){var u=m.details;return u!=null&&u.fragments&&u.fragments.forEach(function(o){o.level=f}),m});this._levels=T,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:T})},R(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var h,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===g&&(h=L[g])!==null&&h!==void 0&&h.details)return;if(g<0||g>=L.length){var T=g<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:T,reason:"invalid level idx"}),T)return;g=Math.min(g,L.length-1)}this.clearTimer();var m=this.currentLevelIndex,f=L[m],u=L[g];this.log("switching to level "+g+" from "+m),this.currentLevelIndex=g;var o=p({},u,{level:g,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete o._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,o);var E=u.details;if(!E||E.live){var v=this.switchParams(u.uri,f==null?void 0:f.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),l}(O.default)},"./src/controller/level-helper.ts":function($,K,A){"use strict";A.r(K),A.d(K,"addGroupId",function(){return P}),A.d(K,"assignTrackIdsByGroup",function(){return I}),A.d(K,"updatePTS",function(){return k}),A.d(K,"updateFragPTSDTS",function(){return D}),A.d(K,"mergeDetails",function(){return p}),A.d(K,"mapPartIntersection",function(){return y}),A.d(K,"mapFragmentIntersection",function(){return R}),A.d(K,"adjustSliding",function(){return S}),A.d(K,"addSliding",function(){return x}),A.d(K,"computeReloadInterval",function(){return b}),A.d(K,"getFragmentWithSN",function(){return d}),A.d(K,"getPartWith",function(){return a});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts");function P(l,s,C){switch(s){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function I(l){var s={};l.forEach(function(C){var g=C.groupId||"";C.id=s[g]=s[g]||0,s[g]++})}function k(l,s,C){var g=l[s],h=l[C];O(g,h)}function O(l,s){var C=s.startPTS;if(Object(W.isFiniteNumber)(C)){var g=0,h;s.sn>l.sn?(g=C-l.start,h=l):(g=l.start-C,h=s),h.duration!==g&&(h.duration=g)}else if(s.sn>l.sn){var L=l.cc===s.cc;L&&l.minEndPTS?s.start=l.start+(l.minEndPTS-l.start):s.start=l.start+l.duration}else s.start=Math.max(l.start-s.duration,0)}function D(l,s,C,g,h,L){var T=g-C;T<=0&&(M.logger.warn("Fragment should have a positive duration",s),g=C+s.duration,L=h+s.duration);var m=C,f=g,u=s.startPTS,o=s.endPTS;if(Object(W.isFiniteNumber)(u)){var E=Math.abs(u-C);Object(W.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(E,s.deltaPTS):s.deltaPTS=E,m=Math.max(C,u),C=Math.min(C,u),h=Math.min(h,s.startDTS),f=Math.min(g,o),g=Math.max(g,o),L=Math.max(L,s.endDTS)}s.duration=g-C;var v=C-s.start;s.appendedPTS=g,s.start=s.startPTS=C,s.maxStartPTS=m,s.startDTS=h,s.endPTS=g,s.minEndPTS=f,s.endDTS=L;var c=s.sn;if(!l||c<l.startSN||c>l.endSN)return 0;var _,U=c-l.startSN,B=l.fragments;for(B[U]=s,_=U;_>0;_--)O(B[_],B[_-1]);for(_=U;_<B.length-1;_++)O(B[_],B[_+1]);return l.fragmentHint&&O(B[B.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,v}function p(l,s){for(var C=null,g=l.fragments,h=g.length-1;h>=0;h--){var L=g[h].initSegment;if(L){C=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var T=0,m;if(R(l,s,function(_,U){_.relurl&&(T=_.cc-U.cc),Object(W.isFiniteNumber)(_.startPTS)&&Object(W.isFiniteNumber)(_.endPTS)&&(U.start=U.startPTS=_.startPTS,U.startDTS=_.startDTS,U.appendedPTS=_.appendedPTS,U.maxStartPTS=_.maxStartPTS,U.endPTS=_.endPTS,U.endDTS=_.endDTS,U.minEndPTS=_.minEndPTS,U.duration=_.endPTS-_.startPTS,U.duration&&(m=U),s.PTSKnown=s.alignedSliding=!0),U.elementaryStreams=_.elementaryStreams,U.loader=_.loader,U.stats=_.stats,U.urlId=_.urlId,_.initSegment&&(U.initSegment=_.initSegment,C=_.initSegment)}),C){var f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;f.forEach(function(_){var U;(!_.initSegment||_.initSegment.relurl===((U=C)===null||U===void 0?void 0:U.relurl))&&(_.initSegment=C)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(_){return!_}),s.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=s.skippedSegments;u--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var o=s.fragments;if(T){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<o.length;E++)o[E].cc+=T}s.skippedSegments&&(s.startCC=s.fragments[0].cc),y(l.partList,s.partList,function(_,U){U.elementaryStreams=_.elementaryStreams,U.stats=_.stats}),m?D(s,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):S(l,s),o.length&&(s.totalduration=s.edge-o[0].start),s.driftStartTime=l.driftStartTime,s.driftStart=l.driftStart;var v=s.advancedDateTime;if(s.advanced&&v){var c=s.edge;s.driftStart||(s.driftStartTime=v,s.driftStart=c),s.driftEndTime=v,s.driftEnd=c}else s.driftEndTime=l.driftEndTime,s.driftEnd=l.driftEnd,s.advancedDateTime=l.advancedDateTime}function y(l,s,C){if(l&&s)for(var g=0,h=0,L=l.length;h<=L;h++){var T=l[h],m=s[h+g];T&&m&&T.index===m.index&&T.fragment.sn===m.fragment.sn?C(T,m):g--}}function R(l,s,C){for(var g=s.skippedSegments,h=Math.max(l.startSN,s.startSN)-s.startSN,L=(l.fragmentHint?1:0)+(g?s.endSN:Math.min(l.endSN,s.endSN))-s.startSN,T=s.startSN-l.startSN,m=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=h;u<=L;u++){var o=f[T+u],E=m[u];g&&!E&&u<g&&(E=s.fragments[u]=o),o&&E&&C(o,E)}}function S(l,s){var C=s.startSN+s.skippedSegments-l.startSN,g=l.fragments;if(C<0||C>=g.length)return;x(s,g[C].start)}function x(l,s){if(s){for(var C=l.fragments,g=l.skippedSegments;g<C.length;g++)C[g].start+=s;l.fragmentHint&&(l.fragmentHint.start+=s)}}function b(l,s){var C=1e3*l.levelTargetDuration,g=C/2,h=l.age,L=h>0&&h<C*3,T=s.loading.end-s.loading.start,m,f=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;m=Math.max(Math.min(g,T*2),u),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=g;else L?(f=Math.min(f||C/2,h),l.availabilityDelay=f,m=f+C-h):m=C-T;return Math.round(m)}function d(l,s,C){if(!l||!l.details)return null;var g=l.details,h=g.fragments[s-g.startSN];return h||(h=g.fragmentHint,h&&h.sn===s?h:s<g.startSN&&C&&C.sn===s?C:null)}function a(l,s,C){if(!l||!l.details)return null;var g=l.details.partList;if(g)for(var h=g.length;h--;){var L=g[h];if(L.index===C&&L.fragment.sn===s)return L}return null}},"./src/controller/stream-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return g});var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/is-supported.ts"),I=A("./src/events.ts"),k=A("./src/utils/buffer-helper.ts"),O=A("./src/controller/fragment-tracker.ts"),D=A("./src/types/loader.ts"),p=A("./src/loader/fragment.ts"),y=A("./src/demux/transmuxer-interface.ts"),R=A("./src/types/transmuxer.ts"),S=A("./src/controller/gap-controller.ts"),x=A("./src/errors.ts"),b=A("./src/utils/logger.ts");function d(h,L){for(var T=0;T<L.length;T++){var m=L[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(h,m.key,m)}}function a(h,L,T){return L&&d(h.prototype,L),T&&d(h,T),h}function l(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,s(h,L)}function s(h,L){return s=Object.setPrototypeOf||function(m,f){return m.__proto__=f,m},s(h,L)}var C=100,g=function(h){l(L,h);function L(m,f){var u;return u=h.call(this,m,f,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var T=L.prototype;return T._registerListeners=function(){var f=this.hls;f.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(I.Events.ERROR,this.onError,this),f.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var f=this.hls;f.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(I.Events.ERROR,this.onError,this),f.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(f){if(this.levels){var u=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=o.startLevel;E===-1&&(o.config.testBandwidth?(E=0,this.bitrateTest=!0):E=o.nextAutoLevel),this.level=o.nextLoadLevel=E,this.loadedmetadata=!1}u>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),f=u),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var f,u=this.levels,o=this.level,E=u==null||((f=u[o])===null||f===void 0)?void 0:f.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var v,c=self.performance.now(),_=this.retryDate;(!_||c>=_||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var f,u,o=this.hls,E=this.levelLastLoaded,v=this.levels,c=this.media,_=o.config,U=o.nextLoadLevel;if(E===null||!c&&(this.startFragRequested||!_.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[U])return;var B=v[U];this.level=o.nextLoadLevel=U;var z=B.details;if(!z||this.state===M.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==U){this.state=M.State.WAITING_LEVEL;return}var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:c,D.PlaylistLevelType.MAIN);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(B.maxBitrate);if(F>=X)return;if(this._streamEnded(j,z)){var te={};this.altAudio&&(te.type="video"),this.hls.trigger(I.Events.BUFFER_EOS,te),this.state=M.State.ENDED;return}var ae=j.end,ce=this.getNextFragment(ae,z);if(this.couldBacktrack&&!this.fragPrevious&&ce&&ce.sn!=="initSegment"){var Te=ce.sn-z.startSN;Te>1&&(ce=z.fragments[Te-1],this.fragmentTracker.removeFragment(ce))}if(ce&&this.fragmentTracker.getState(ce)===O.FragmentState.OK&&this.nextLoadPosition>ae){var ge=this.audioOnly&&!this.altAudio?p.ElementaryStreamTypes.AUDIO:p.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(c,ge,D.PlaylistLevelType.MAIN),ce=this.getNextFragment(this.nextLoadPosition,z)}if(!ce)return;ce.initSegment&&!ce.initSegment.data&&!this.bitrateTest&&(ce=ce.initSegment),((f=ce.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((u=ce.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ce,z):this.loadFragment(ce,z,ae)},T.loadFragment=function(f,u,o){var E,v=this.fragmentTracker.getState(f);if(this.fragCurrent=f,v===O.FragmentState.BACKTRACKED){var c=this.fragmentTracker.getBacktrackData(f);if(c){this._handleFragmentLoadProgress(c),this._handleFragmentLoadComplete(c);return}else v=O.FragmentState.NOT_LOADED}v===O.FragmentState.NOT_LOADED||v===O.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,u,o)):v===O.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(f){var u=this.fragmentTracker.getAppendedFrag(f,D.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},T.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,D.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var f=this.levels,u=this.media;if(u!=null&&u.readyState){var o,E=this.getAppendedFrag(u.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!u.paused&&f){var v=this.hls.nextLoadLevel,c=f[v],_=this.fragLastKbps;_&&this.fragCurrent?o=this.fragCurrent.duration*c.maxBitrate/(1e3*_)+1:o=0}else o=0;var U=this.getBufferedFrag(u.currentTime+o);if(U){var B=this.followingBufferedFrag(U);if(B){this.abortCurrentFrag();var z=B.maxStartPTS?B.maxStartPTS:B.start,j=B.duration,F=Math.max(U.end,z+Math.min(Math.max(j-this.config.maxFragLookUpTolerance,j*.5),j*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(f,u){h.prototype.flushMainBuffer.call(this,f,u,this.altAudio?"video":null)},T.onMediaAttached=function(f,u){h.prototype.onMediaAttached.call(this,f,u);var o=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new S.default(this.config,o,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var f=this.media,u=f?f.currentTime:null;Object(W.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(f,u){var o=!1,E=!1,v;u.levels.forEach(function(c){v=c.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(o=!0),v.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=o&&E&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},T.onLevelLoading=function(f,u){var o=this.levels;if(!o||this.state!==M.State.IDLE)return;var E=o[u.level];(!E.details||E.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(E.details))&&(this.state=M.State.WAITING_LEVEL)},T.onLevelLoaded=function(f,u){var o,E=this.levels,v=u.level,c=u.details,_=c.totalduration;if(!E){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+c.startSN+","+c.endSN+"], cc ["+c.startCC+", "+c.endCC+"] duration:"+_);var U=this.fragCurrent;U&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==u.level&&U.loader&&(this.state=M.State.IDLE,U.loader.abort()));var B=E[v],z=0;if(c.live||(o=B.details)!==null&&o!==void 0&&o.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;z=this.alignPlaylists(c,B.details)}if(B.details=c,this.levelLastLoaded=v,this.hls.trigger(I.Events.LEVEL_UPDATED,{details:c,level:v}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(c))return;this.state=M.State.IDLE}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,z),this.tick()},T._handleFragmentLoadProgress=function(f){var u,o=f.frag,E=f.part,v=f.payload,c=this.levels;if(!c){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var _=c[o.level],U=_.details;if(!U){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=_.videoCodec,z=U.PTSKnown||!U.live,j=(u=o.initSegment)===null||u===void 0?void 0:u.data,F=this._getAudioCodec(_),X=this.transmuxer=this.transmuxer||new y.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),te=E?E.index:-1,ae=te!==-1,ce=new R.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,v.byteLength,te,ae),Te=this.initPTS[o.cc];X.push(v,j,F,B,o,E,U.totalduration,z,ce,Te)},T.onAudioTrackSwitching=function(f,u){var o=this.altAudio,E=!!u.url,v=u.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var c=this.fragCurrent;c!=null&&c.loader&&(this.log("Switching to main audio track, cancel main fragment load"),c.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var _=this.hls;o&&_.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),_.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:v})}},T.onAudioTrackSwitched=function(f,u){var o=u.id,E=!!this.hls.audioTracks[o].url;if(E){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=E,this.tick()},T.onBufferCreated=function(f,u){var o=u.tracks,E,v,c=!1;for(var _ in o){var U=o[_];if(U.id==="main"){if(v=_,E=U,_==="video"){var B=o[_];B&&(this.videoBuffer=B.buffer)}}else c=!0}c&&E?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(f,u){var o=u.frag,E=u.part;if(o&&o.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(E?" p: "+E.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var v=E?E.stats:o.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,E)},T.onError=function(f,u){switch(u.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,u);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=M.State.ERROR):!u.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var o=!0,E=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);E&&E.len>.5&&(o=!this.reduceMaxBufferLength(E.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var f=this.media,u=this.gapController;if(!f||!u||!f.readyState)return;var o=k.BufferHelper.getBuffered(f);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(f,u){var o=u.type;if(o!==p.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(o===p.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,o,D.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(f,u){this.levels=u.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var f=this.media,u=f.currentTime,o=this.startPosition;if(o>=0&&u<o){if(f.seeking){b.logger.log("could not seek to "+o+", already seeking at "+u);return}var E=k.BufferHelper.getBuffered(f),v=E.length?E.start(0):0,c=v-o;c>0&&(c<this.config.maxBufferHole||c<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+c+" to match buffer start"),o+=c,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+u),f.currentTime=o}},T._getAudioCodec=function(f){var u=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},T._loadBitrateTestFrag=function(f){var u=this;this._doFragLoad(f).then(function(o){var E=u.hls;if(!o||E.nextLoadLevel||u.fragContextChanged(f))return;u.fragLoadError=0,u.state=M.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var v=f.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),E.trigger(I.Events.FRAG_LOADED,o)})},T._handleTransmuxComplete=function(f){var u,o="main",E=this.hls,v=f.remuxResult,c=f.chunkMeta,_=this.getCurrentContext(c);if(!_){this.warn("The loading context changed while buffering fragment "+c.sn+" of level "+c.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(c.level);return}var U=_.frag,B=_.part,z=_.level,j=v.video,F=v.text,X=v.id3,te=v.initSegment,ae=this.altAudio?void 0:v.audio;if(this.fragContextChanged(U))return;if(this.state=M.State.PARSING,te){te.tracks&&(this._bufferInitSegment(z,te.tracks,U,c),E.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:o,tracks:te.tracks}));var ce=te.initPTS,Te=te.timescale;Object(W.isFiniteNumber)(ce)&&(this.initPTS[U.cc]=ce,E.trigger(I.Events.INIT_PTS_FOUND,{frag:U,id:o,initPTS:ce,timescale:Te}))}if(j&&v.independent!==!1){if(z.details){var ge=j.startPTS,he=j.endPTS,ee=j.startDTS,re=j.endDTS;if(B)B.elementaryStreams[j.type]={startPTS:ge,endPTS:he,startDTS:ee,endDTS:re};else if(j.firstKeyFrame&&j.independent&&(this.couldBacktrack=!0),j.dropped&&j.independent){var Z=this.getLoadPosition()+this.config.maxBufferHole;if(Z<ge){this.backtrack(U);return}U.setElementaryStreamInfo(j.type,U.start,he,U.start,re,!0)}U.setElementaryStreamInfo(j.type,ge,he,ee,re),this.bufferFragmentData(j,U,B,c)}}else if(v.independent===!1){this.backtrack(U);return}if(ae){var ne=ae.startPTS,me=ae.endPTS,de=ae.startDTS,Se=ae.endDTS;B&&(B.elementaryStreams[p.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:me,startDTS:de,endDTS:Se}),U.setElementaryStreamInfo(p.ElementaryStreamTypes.AUDIO,ne,me,de,Se),this.bufferFragmentData(ae,U,B,c)}if(X!=null&&(u=X.samples)!==null&&u!==void 0&&u.length){var ye={frag:U,id:o,samples:X.samples};E.trigger(I.Events.FRAG_PARSING_METADATA,ye)}if(F){var Ie={frag:U,id:o,samples:F.samples};E.trigger(I.Events.FRAG_PARSING_USERDATA,Ie)}},T._bufferInitSegment=function(f,u,o,E){var v=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var c=u.audio,_=u.video,U=u.audiovideo;if(c){var B=f.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),c.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(B="mp4a.40.5")),z.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),f.audioCodec&&f.audioCodec!==B&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+B+'"'),c.levelCodec=B,c.id="main",this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(f.audioCodec||"")+"/"+c.codec+"]")}_&&(_.levelCodec=f.videoCodec,_.id="main",this.log("Init video buffer, container:"+_.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+_.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(j){var F=u[j],X=F.initSegment;X!=null&&X.byteLength&&v.hls.trigger(I.Events.BUFFER_APPENDING,{type:j,data:X,frag:o,part:null,chunkMeta:E,parent:o.type})}),this.tick()},T.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var u=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,u?this.resetFragmentLoading(f):this.state=M.State.BACKTRACKING},T.checkFragmentChanged=function(){var f=this.media,u=null;if(f&&f.readyState>1&&f.seeking===!1){var o=f.currentTime;if(k.BufferHelper.isBuffered(f,o)?u=this.getAppendedFrag(o):k.BufferHelper.isBuffered(f,o+.1)&&(u=this.getAppendedFrag(o+.1)),u){var E=this.fragPlaying,v=u.level;(!E||u.sn!==E.sn||E.level!==v||u.urlId!==E.urlId)&&(this.hls.trigger(I.Events.FRAG_CHANGED,{frag:u}),(!E||E.level!==v)&&this.hls.trigger(I.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=u)}}},a(L,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var u=this.getAppendedFrag(f.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var u=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(M.default)},"./src/controller/subtitle-stream-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"SubtitleStreamController",function(){return l});var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=A("./src/utils/buffer-helper.ts"),I=A("./src/controller/fragment-finders.ts"),k=A("./src/utils/discontinuities.ts"),O=A("./src/controller/level-helper.ts"),D=A("./src/controller/fragment-tracker.ts"),p=A("./src/controller/base-stream-controller.ts"),y=A("./src/types/loader.ts"),R=A("./src/types/level.ts");function S(s,C){for(var g=0;g<C.length;g++){var h=C[g];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(s,h.key,h)}}function x(s,C,g){return C&&S(s.prototype,C),g&&S(s,g),s}function b(s,C){s.prototype=Object.create(C.prototype),s.prototype.constructor=s,d(s,C)}function d(s,C){return d=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},d(s,C)}var a=500,l=function(s){b(C,s);function C(h,L){var T;return T=s.call(this,h,L,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var g=C.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var L=this.hls;L.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(W.Events.ERROR,this.onError,this),L.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var L=this.hls;L.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(W.Events.ERROR,this.onError,this),L.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=p.State.IDLE,this.setInterval(a),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(L,T){this.mainDetails=T.details},g.onSubtitleFragProcessed=function(L,T){var m=T.frag,f=T.success;if(this.fragPrevious=m,this.state=p.State.IDLE,!f)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var o,E=m.start,v=0;v<u.length;v++)if(E>=u[v].start&&E<=u[v].end){o=u[v];break}var c=m.start+m.duration;o?o.end=c:(o={start:E,end:c},u.push(o)),this.fragmentTracker.fragBuffered(m)},g.onBufferFlushing=function(L,T){var m=T.startOffset,f=T.endOffset;if(m===0&&f!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,o=this.levels;if(!o.length||!o[u]||!o[u].details)return;var E=o[u].details,v=E.targetduration,c=f-v;if(c<=0)return;T.endOffsetSubtitles=Math.max(0,c),this.tracksBuffered.forEach(function(_){for(var U=0;U<_.length;){if(_[U].end<=c){_.shift();continue}else if(_[U].start<c)_[U].start=c;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,c,y.PlaylistLevelType.SUBTITLE)}},g.onError=function(L,T){var m,f=T.frag;if(!f||f.type!==y.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=p.State.IDLE},g.onSubtitleTracksUpdated=function(L,T){var m=this,f=T.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(u){return new R.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){m.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(L,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(a)},g.onSubtitleTrackLoaded=function(L,T){var m,f=T.details,u=T.id,o=this.currentTrackId,E=this.levels;if(!E.length)return;var v=E[o];if(u>=E.length||u!==o||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(m=v.details)!==null&&m!==void 0&&m.live){var c=this.mainDetails;if(f.deltaUpdateFailed||!c)return;var _=c.fragments[0];if(!v.details)f.hasProgramDateTime&&c.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(f,c):_&&Object(O.addSliding)(f,_.start);else{var U=this.alignPlaylists(f,v.details);U===0&&_&&Object(O.addSliding)(f,_.start)}}if(v.details=f,this.levelLastLoaded=u,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===p.State.IDLE){var B=Object(I.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},g._handleFragmentLoadComplete=function(L){var T=L.frag,m=L.payload,f=T.decryptdata,u=this.hls;if(this.fragContextChanged(T))return;if(m&&m.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),f.key.buffer,f.iv.buffer).then(function(E){var v=performance.now();u.trigger(W.Events.FRAG_DECRYPTED,{frag:T,payload:E,stats:{tstart:o,tdecrypt:v}})})}},g.doTick=function(){if(!this.media){this.state=p.State.IDLE;return}if(this.state===p.State.IDLE){var L,T=this.currentTrackId,m=this.levels;if(!m.length||!m[T]||!m[T].details)return;var f=m[T].details,u=f.targetduration,o=this.config,E=this.media,v=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-u,o.maxBufferHole),c=v.end,_=v.len,U=this.getMaxBufferLength()+u;if(_>U)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var B=f.fragments,z=B.length,j=f.edge,F,X=this.fragPrevious;if(c<j){var te=o.maxFragLookUpTolerance;X&&f.hasProgramDateTime&&(F=Object(I.findFragmentByPDT)(B,X.endProgramDateTime,te)),F||(F=Object(I.findFragmentByPTS)(X,B,c,te),!F&&X&&X.start<B[0].start&&(F=B[0]))}else F=B[z-1];(L=F)!==null&&L!==void 0&&L.encrypted?(M.logger.log("Loading key for "+F.sn),this.state=p.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===D.FragmentState.NOT_LOADED&&this.loadFragment(F,f,c)}},g.loadFragment=function(L,T,m){this.fragCurrent=L,s.prototype.loadFragment.call(this,L,T,m)},x(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(p.default)},"./src/controller/subtitle-track-controller.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/controller/base-playlist-controller.ts"),I=A("./src/types/loader.ts");function k(S,x){for(var b=0;b<x.length;b++){var d=x[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(S,d.key,d)}}function O(S,x,b){return x&&k(S.prototype,x),b&&k(S,b),S}function D(S,x){S.prototype=Object.create(x.prototype),S.prototype.constructor=S,p(S,x)}function p(S,x){return p=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},p(S,x)}var y=function(S){D(x,S);function x(d){var a;return a=S.call(this,d,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var b=x.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,S.prototype.destroy.call(this)},b.registerListeners=function(){var a=this.hls;a.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(W.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var a=this.hls;a.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(W.Events.ERROR,this.onError,this)},b.onMediaAttached=function(a,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},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 a=R(this.media.textTracks);a.forEach(function(l){Object(M.clearCurrentCues)(l)}),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(a,l){this.tracks=l.subtitleTracks},b.onSubtitleTrackLoaded=function(a,l){var s=l.id,C=l.details,g=this.trackId,h=this.tracksInGroup[g];if(!h){this.warn("Invalid subtitle track id "+s);return}var L=h.details;h.details=l.details,this.log("subtitle track "+s+" loaded ["+C.startSN+"-"+C.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,l,L))},b.onLevelLoading=function(a,l){this.switchLevel(l.level)},b.onLevelSwitching=function(a,l){this.switchLevel(l.level)},b.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var s=l.textGroupIds[l.urlId];if(this.groupId!==s){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(T){return!s||T.groupId===s});this.tracksInGroup=g;var h=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=s;var L={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,L),h!==-1&&this.setSubtitleTrack(h,C)}},b.findTrackId=function(a){for(var l=this.tracksInGroup,s=0;s<l.length;s++){var C=l[s];if((!this.selectDefaultTrack||C.default)&&(!a||a===C.name))return C.id}return-1},b.onError=function(a,l){if(S.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===I.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},b.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var s=l.id,C=l.groupId,g=l.url;if(a)try{g=a.addDirectives(g)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:g,id:s,groupId:C,deliveryDirectives:a||null})}},b.toggleTrackModes=function(a){var l=this,s=this.media,C=this.subtitleDisplay,g=this.trackId;if(!s)return;var h=R(s.textTracks),L=h.filter(function(f){return f.groupId===l.groupId});if(a===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var T=L[g];T&&(T.mode="disabled")}var m=L[a];m&&(m.mode=C?"showing":"hidden")},b.setSubtitleTrack=function(a,l){var s,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(s=C[a])!==null&&s!==void 0&&s.details)||a<-1||a>=C.length)return;this.clearTimer();var g=C[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,g){var h=g.id,L=g.groupId,T=L===void 0?"":L,m=g.name,f=g.type,u=g.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:T,name:m,type:f,url:u});var o=this.switchParams(g.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:a})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=R(this.media.textTracks),s=0;s<l.length;s++)if(l[s].mode==="hidden")a=s;else if(l[s].mode==="showing"){a=s;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},O(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),x}(P.default);function R(S){for(var x=[],b=0;b<S.length;b++){var d=S[b];d.kind==="subtitles"&&d.label&&x.push(S[b])}return x}K.default=y},"./src/controller/timeline-controller.ts":function($,K,A){"use strict";A.r(K),A.d(K,"TimelineController",function(){return R});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/cea-608-parser.ts"),I=A("./src/utils/output-filter.ts"),k=A("./src/utils/webvtt-parser.ts"),O=A("./src/utils/texttrack-utils.ts"),D=A("./src/utils/imsc1-ttml-parser.ts"),p=A("./src/types/loader.ts"),y=A("./src/utils/logger.ts"),R=function(){function d(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var s=new I.default(this,"textTrack1"),C=new I.default(this,"textTrack2"),g=new I.default(this,"textTrack3"),h=new I.default(this,"textTrack4");this.cea608Parser1=new P.default(1,s,C),this.cea608Parser2=new P.default(3,g,h)}l.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(M.Events.FRAG_LOADING,this.onFragLoading,this),l.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=d.prototype;return a.destroy=function(){var s=this.hls;s.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(M.Events.FRAG_LOADING,this.onFragLoading,this),s.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(s,C,g,h,L){for(var T=!1,m=L.length;m--;){var f=L[m],u=x(f[0],f[1],C,g);if(u>=0&&(f[0]=Math.min(f[0],C),f[1]=Math.max(f[1],g),T=!0,u/(g-C)>.5))return}if(T||L.push([C,g]),this.config.renderTextTracksNatively){var o=this.captionsTracks[s];this.Cues.newCue(o,C,g,h)}else{var E=this.Cues.newCue(null,C,g,h);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:E,track:s})}},a.onInitPtsFound=function(s,C){var g=this,h=C.frag,L=C.id,T=C.initPTS,m=C.timescale,f=this.unparsedVttFrags;L==="main"&&(this.initPTS[h.cc]=T,this.timescale[h.cc]=m),f.length&&(this.unparsedVttFrags=[],f.forEach(function(u){g.onFragLoaded(M.Events.FRAG_LOADED,u)}))},a.getExistingTrack=function(s){var C=this.media;if(C)for(var g=0;g<C.textTracks.length;g++){var h=C.textTracks[g];if(h[s])return h}return null},a.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},a.createNativeTrack=function(s){if(this.captionsTracks[s])return;var C=this.captionsProperties,g=this.captionsTracks,h=this.media,L=C[s],T=L.label,m=L.languageCode,f=this.getExistingTrack(s);if(f)g[s]=f,Object(O.clearCurrentCues)(g[s]),Object(O.sendAddTrackEvent)(g[s],h);else{var u=this.createTextTrack("captions",T,m);u&&(u[s]=!0,g[s]=u)}},a.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var C=this.captionsProperties[s];if(!C)return;var g=C.label,h={_id:s,label:g,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[s]=h,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},a.createTextTrack=function(s,C,g){var h=this.media;return h?h.addTextTrack(s,C,g):void 0},a.onMediaAttaching=function(s,C){this.media=C.media,this._cleanTracks()},a.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(C){Object(O.clearCurrentCues)(s[C]),delete s[C]}),this.nonNativeCaptionsTracks={}},a.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())},a._cleanTracks=function(){var s=this.media;if(!s)return;var C=s.textTracks;if(C)for(var g=0;g<C.length;g++)Object(O.clearCurrentCues)(C[g])},a.onSubtitleTracksUpdated=function(s,C){var g=this;this.textTracks=[];var h=C.subtitleTracks||[],L=h.some(function(u){return u.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var T=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,o){var E;if(o<m.length){for(var v=null,c=0;c<m.length;c++)if(S(m[c],u)){v=m[c];break}v&&(E=v)}E?Object(O.clearCurrentCues)(E):(E=g.createTextTrack("subtitles",u.name,u.lang),E&&(E.mode="disabled")),E&&(E.groupId=u.groupId,g.textTracks.push(E))})}else if(!T&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},a.onManifestLoaded=function(s,C){var g=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(h){var L=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!L)return;var T="textTrack"+L[1],m=g.captionsProperties[T];if(!m)return;m.label=h.name,h.lang&&(m.languageCode=h.lang),m.media=h})},a.onFragLoading=function(s,C){var g=this.cea608Parser1,h=this.cea608Parser2,L=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(g&&h))return;if(C.frag.type===p.PlaylistLevelType.MAIN){var m,f,u=C.frag.sn,o=(m=C==null||((f=C.part)===null||f===void 0)?void 0:f.index)!=null?m:-1;u===L+1||u===L&&o===T+1||(g.reset(),h.reset()),this.lastSn=u,this.lastPartIndex=o}},a.onFragLoaded=function(s,C){var g=C.frag,h=C.payload,L=this.initPTS,T=this.unparsedVttFrags;if(g.type===p.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(W.isFiniteNumber)(L[g.cc])){T.push(C),L.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var m=g.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var f=this.tracks[g.level],u=this.vttCCs;u[g.cc]||(u[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),f&&f.textCodec===D.IMSC1_CODEC?this._parseIMSC1(g,h):this._parseVTTs(g,h,u)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(s,C){var g=this,h=this.hls;Object(D.parseIMSC1)(C,this.initPTS[s.cc],this.timescale[s.cc],function(L){g._appendCues(L,s.level),h.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(L){y.logger.log("Failed to parse IMSC1: "+L),h.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:L})})},a._parseVTTs=function(s,C,g){var h=this,L=this.hls;Object(k.parseWebVTT)(C,this.initPTS[s.cc],this.timescale[s.cc],g,s.cc,s.start,function(T){h._appendCues(T,s.level),L.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(T){h._fallbackToIMSC1(s,C),y.logger.log("Failed to parse VTT cue: "+T),L.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:T})})},a._fallbackToIMSC1=function(s,C){var g=this,h=this.tracks[s.level];h.textCodec||Object(D.parseIMSC1)(C,this.initPTS[s.cc],this.timescale[s.cc],function(){h.textCodec=D.IMSC1_CODEC,g._parseIMSC1(s,C)},function(){h.textCodec="wvtt"})},a._appendCues=function(s,C){var g=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[C];if(h.mode==="disabled")return;s.forEach(function(m){return Object(O.addCueToTrack)(h,m)})}else{var L=this.tracks[C],T=L.default?"default":"subtitles"+C;g.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:s,track:T})}},a.onFragDecrypted=function(s,C){var g=C.frag;if(g.type===p.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(M.Events.FRAG_LOADED,C)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(s,C){var g=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(g&&h))return;for(var L=0;L<C.samples.length;L++){var T=C.samples[L].bytes;if(T){var m=this.extractCea608Data(T);g.addData(C.samples[L].pts,m[0]),h.addData(C.samples[L].pts,m[1])}}},a.onBufferFlushing=function(s,C){var g=C.startOffset,h=C.endOffset,L=C.endOffsetSubtitles,T=C.type,m=this.media;if(!m||m.currentTime<h)return;if(!T||T==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(o){return Object(O.removeCuesInRange)(f[o],g,h)})}if(this.config.renderTextTracksNatively&&(g===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(o){return Object(O.removeCuesInRange)(u[o],g,L)})}},a.extractCea608Data=function(s){for(var C=s[0]&31,g=2,h=[[],[]],L=0;L<C;L++){var T=s[g++],m=127&s[g++],f=127&s[g++],u=(4&T)!==0,o=3&T;if(m===0&&f===0)continue;u&&((o===0||o===1)&&(h[o].push(m),h[o].push(f)))}return h},d}();function S(d,a){return d&&d.label===a.name&&!(d.textTrack1||d.textTrack2)}function x(d,a,l,s){return Math.min(a,s)-Math.max(d,l)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(I,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=I,this.aesIV=k}var P=M.prototype;return P.decrypt=function(k,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,k)},M}()},"./src/crypt/aes-decryptor.ts":function($,K,A){"use strict";A.r(K),A.d(K,"removePadding",function(){return M}),A.d(K,"default",function(){return P});var W=A("./src/utils/typed-array.ts");function M(I){var k=I.byteLength,O=k&&new DataView(I.buffer).getUint8(k-1);return O?Object(W.sliceUint8)(I,0,k-O):I}var P=function(){function I(){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=I.prototype;return k.uint8ArrayToUint32Array_=function(D){for(var p=new DataView(D),y=new Uint32Array(4),R=0;R<4;R++)y[R]=p.getUint32(R*4);return y},k.initTable=function(){var D=this.sBox,p=this.invSBox,y=this.subMix,R=y[0],S=y[1],x=y[2],b=y[3],d=this.invSubMix,a=d[0],l=d[1],s=d[2],C=d[3],g=new Uint32Array(256),h=0,L=0,T=0;for(T=0;T<256;T++)T<128?g[T]=T<<1:g[T]=T<<1^283;for(T=0;T<256;T++){var m=L^L<<1^L<<2^L<<3^L<<4;m=m>>>8^m&255^99,D[h]=m,p[m]=h;var f=g[h],u=g[f],o=g[u],E=g[m]*257^m*16843008;R[h]=E<<24|E>>>8,S[h]=E<<16|E>>>16,x[h]=E<<8|E>>>24,b[h]=E,E=o*16843009^u*65537^f*257^h*16843008,a[m]=E<<24|E>>>8,l[m]=E<<16|E>>>16,s[m]=E<<8|E>>>24,C[m]=E,h?(h=f^g[g[g[o^f]]],L^=g[g[L]]):h=L=1}},k.expandKey=function(D){for(var p=this.uint8ArrayToUint32Array_(D),y=!0,R=0;R<p.length&&y;)y=p[R]===this.key[R],R++;if(y)return;this.key=p;var S=this.keySize=p.length;if(S!==4&&S!==6&&S!==8)throw new Error("Invalid aes key size="+S);var x=this.ksRows=(S+6+1)*4,b,d,a=this.keySchedule=new Uint32Array(x),l=this.invKeySchedule=new Uint32Array(x),s=this.sBox,C=this.rcon,g=this.invSubMix,h=g[0],L=g[1],T=g[2],m=g[3],f,u;for(b=0;b<x;b++){if(b<S){f=a[b]=p[b];continue}u=f,b%S===0?(u=u<<8|u>>>24,u=s[u>>>24]<<24|s[u>>>16&255]<<16|s[u>>>8&255]<<8|s[u&255],u^=C[b/S|0]<<24):S>6&&b%S===4&&(u=s[u>>>24]<<24|s[u>>>16&255]<<16|s[u>>>8&255]<<8|s[u&255]),a[b]=f=(a[b-S]^u)>>>0}for(d=0;d<x;d++)b=x-d,d&3?u=a[b]:u=a[b-4],d<4||b<=4?l[d]=u:l[d]=h[s[u>>>24]]^L[s[u>>>16&255]]^T[s[u>>>8&255]]^m[s[u&255]],l[d]=l[d]>>>0},k.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},k.decrypt=function(D,p,y){for(var R=this.keySize+6,S=this.invKeySchedule,x=this.invSBox,b=this.invSubMix,d=b[0],a=b[1],l=b[2],s=b[3],C=this.uint8ArrayToUint32Array_(y),g=C[0],h=C[1],L=C[2],T=C[3],m=new Int32Array(D),f=new Int32Array(m.length),u,o,E,v,c,_,U,B,z,j,F,X,te,ae,ce=this.networkToHostOrderSwap;p<m.length;){for(z=ce(m[p]),j=ce(m[p+1]),F=ce(m[p+2]),X=ce(m[p+3]),c=z^S[0],_=X^S[1],U=F^S[2],B=j^S[3],te=4,ae=1;ae<R;ae++)u=d[c>>>24]^a[_>>16&255]^l[U>>8&255]^s[B&255]^S[te],o=d[_>>>24]^a[U>>16&255]^l[B>>8&255]^s[c&255]^S[te+1],E=d[U>>>24]^a[B>>16&255]^l[c>>8&255]^s[_&255]^S[te+2],v=d[B>>>24]^a[c>>16&255]^l[_>>8&255]^s[U&255]^S[te+3],c=u,_=o,U=E,B=v,te=te+4;u=x[c>>>24]<<24^x[_>>16&255]<<16^x[U>>8&255]<<8^x[B&255]^S[te],o=x[_>>>24]<<24^x[U>>16&255]<<16^x[B>>8&255]<<8^x[c&255]^S[te+1],E=x[U>>>24]<<24^x[B>>16&255]<<16^x[c>>8&255]<<8^x[_&255]^S[te+2],v=x[B>>>24]<<24^x[c>>16&255]<<16^x[_>>8&255]<<8^x[U&255]^S[te+3],f[p]=ce(u^g),f[p+1]=ce(v^h),f[p+2]=ce(E^L),f[p+3]=ce(o^T),g=z,h=j,L=F,T=X,p=p+4}return f.buffer},I}()},"./src/crypt/decrypter.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return p});var W=A("./src/crypt/aes-crypto.ts"),M=A("./src/crypt/fast-aes-key.ts"),P=A("./src/crypt/aes-decryptor.ts"),I=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),O=A("./src/utils/typed-array.ts"),D=16,p=function(){function y(S,x,b){var d=b===void 0?{}:b,a=d.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=S,this.config=x,this.removePKCS7Padding=l,l)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=y.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var b=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(b):b},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(x,b,d,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),b,d);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),b,d).then(a)},R.softwareDecrypt=function(x,b,d){var a=this.currentIV,l=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(x=Object(k.appendUint8Array)(s,x),this.remainderData=null);var C=this.getValidChunk(x);if(!C.length)return null;a&&(d=a);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(b);var h=l;return this.currentResult=g.decrypt(C.buffer,0,d),this.currentIV=Object(O.sliceUint8)(C,-16).buffer,h||null},R.webCryptoDecrypt=function(x,b,d){var a=this,l=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new M.default(l,b)),this.fastAesKey.expandKey().then(function(s){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new W.default(l,d);return C.decrypt(x.buffer,s)}).catch(function(s){return a.onWebCryptoError(s,x,b,d)})},R.onWebCryptoError=function(x,b,d,a){return I.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,a)},R.getValidChunk=function(x){var b=x,d=x.length-x.length%D;return d!==x.length&&(b=Object(O.sliceUint8)(x,0,d),this.remainderData=Object(O.sliceUint8)(x,d)),b},R.logOnce=function(x){if(!this.logEnabled)return;I.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},y}()},"./src/crypt/fast-aes-key.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(I,k){this.subtle=void 0,this.key=void 0,this.subtle=I,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($,K,A){"use strict";A.r(K);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/adts.ts"),P=A("./src/utils/logger.ts"),I=A("./src/demux/id3.ts");function k(p,y){p.prototype=Object.create(y.prototype),p.prototype.constructor=p,O(p,y)}function O(p,y){return O=Object.setPrototypeOf||function(S,x){return S.__proto__=x,S},O(p,y)}var D=function(p){k(y,p);function y(S,x){var b;return b=p.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=S,b.config=x,b}var R=y.prototype;return R.resetInitSegment=function(x,b,d){p.prototype.resetInitSegment.call(this,x,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},y.probe=function(x){if(!x)return!1;for(var b=I.getID3Data(x,0)||[],d=b.length,a=x.length;d<a;d++)if(M.probe(x,d))return P.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(x,b){return M.canParse(x,b)},R.appendFrame=function(x,b,d){M.initTrackConfig(x,this.observer,b,d,x.manifestCodec);var a=M.appendFrame(x,b,d,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},y}(W.default);D.minProbeByteLength=9,K.default=D},"./src/demux/adts.ts":function($,K,A){"use strict";A.r(K),A.d(K,"getAudioConfig",function(){return I}),A.d(K,"isHeaderPattern",function(){return k}),A.d(K,"getHeaderLength",function(){return O}),A.d(K,"getFullFrameLength",function(){return D}),A.d(K,"canGetFrameLength",function(){return p}),A.d(K,"isHeader",function(){return y}),A.d(K,"canParse",function(){return R}),A.d(K,"probe",function(){return S}),A.d(K,"initTrackConfig",function(){return x}),A.d(K,"getFrameDuration",function(){return b}),A.d(K,"parseFrameHeader",function(){return d}),A.d(K,"appendFrame",function(){return a});var W=A("./src/utils/logger.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts");function I(l,s,C,g){var h,L,T,m,f=navigator.userAgent.toLowerCase(),u=g,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((s[C+2]&192)>>>6)+1;var E=(s[C+2]&60)>>>2;if(E>o.length-1){l.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return T=(s[C+2]&1)<<2,T|=(s[C+3]&192)>>>6,W.logger.log("manifest codec:"+g+", ADTS type:"+h+", samplingIndex:"+E),/firefox/i.test(f)?E>=6?(h=5,m=new Array(4),L=E-3):(h=2,m=new Array(2),L=E):f.indexOf("android")!==-1?(h=2,m=new Array(2),L=E):(h=5,m=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&E>=6?L=E-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(E>=6&&T===1||/vivaldi/i.test(f))||!g&&T===1)&&(h=2,m=new Array(2)),L=E)),m[0]=h<<3,m[0]|=(E&14)>>1,m[1]|=(E&1)<<7,m[1]|=T<<3,h===5&&(m[1]|=(L&14)>>1,m[2]=(L&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:o[E],channelCount:T,codec:"mp4a.40."+h,manifestCodec:u}}function k(l,s){return l[s]===255&&(l[s+1]&246)===240}function O(l,s){return l[s+1]&1?7:9}function D(l,s){return(l[s+3]&3)<<11|l[s+4]<<3|(l[s+5]&224)>>>5}function p(l,s){return s+5<l.length}function y(l,s){return s+1<l.length&&k(l,s)}function R(l,s){return p(l,s)&&k(l,s)&&D(l,s)<=l.length-s}function S(l,s){if(y(l,s)){var C=O(l,s);if(s+C>=l.length)return!1;var g=D(l,s);if(g<=C)return!1;var h=s+g;return h===l.length||y(l,h)}return!1}function x(l,s,C,g,h){if(!l.samplerate){var L=I(s,C,g,h);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,W.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function b(l){return 1024*9e4/l}function d(l,s,C,g,h){var L=O(l,s),T=D(l,s);if(T-=L,T>0){var m=C+g*h;return{headerLength:L,frameLength:T,stamp:m}}}function a(l,s,C,g,h){var L=b(l.samplerate),T=d(s,C,g,h,L);if(T){var m=T.frameLength,f=T.headerLength,u=T.stamp,o=f+m,E=Math.max(0,C+o-s.length),v;E?(v=new Uint8Array(o-f),v.set(s.subarray(C+f,s.length),0)):v=s.subarray(C+f,C+o);var c={unit:v,pts:u};return E||l.samples.push(c),{sample:c,length:o,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function($,K,A){"use strict";A.r(K),A.d(K,"initPTSFn",function(){return D});var W=A("./src/polyfills/number.ts"),M=A("./src/demux/id3.ts"),P=A("./src/demux/dummy-demuxed-track.ts"),I=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),O=function(){function p(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var y=p.prototype;return y.resetInitSegment=function(S,x,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},y.resetTimeStamp=function(){},y.resetContiguity=function(){},y.canParse=function(S,x){return!1},y.appendFrame=function(S,x,b){},y.demux=function(S,x){this.cachedData&&(S=Object(I.appendUint8Array)(this.cachedData,S),this.cachedData=null);var b=M.getID3Data(S,0),d=b?b.length:0,a,l,s=this._audioTrack,C=this._id3Track,g=b?M.getTimeStamp(b):void 0,h=S.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(g,x)),b&&b.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),l=this.initPTS;d<h;){if(this.canParse(S,d)){var L=this.appendFrame(s,S,d);L?(this.frameIndex++,l=L.sample.pts,d+=L.length,a=d):d=h}else M.canParse(S,d)?(b=M.getID3Data(S,d),C.samples.push({pts:l,dts:l,data:b}),d+=b.length,a=d):d++;if(d===h&&a!==h){var T=Object(k.sliceUint8)(S,a);this.cachedData?this.cachedData=Object(I.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:s,avcTrack:Object(P.dummyTrack)(),id3Track:C,textTrack:Object(P.dummyTrack)()}},y.demuxSampleAes=function(S,x,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},y.flush=function(S){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},y.destroy=function(){},p}(),D=function(y,R){return Object(W.isFiniteNumber)(y)?y*90:R*9e4};K.default=O},"./src/demux/chunk-cache.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function P(){this.chunks=[],this.dataLength=0}var I=P.prototype;return I.push=function(O){this.chunks.push(O),this.dataLength+=O.length},I.flush=function(){var O=this.chunks,D=this.dataLength,p;if(O.length)O.length===1?p=O[0]:p=M(O,D);else return new Uint8Array(0);return this.reset(),p},I.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,I){for(var k=new Uint8Array(I),O=0,D=0;D<P.length;D++){var p=P[D];k.set(p,O),O+=p.length}return k}},"./src/demux/dummy-demuxed-track.ts":function($,K,A){"use strict";A.r(K),A.d(K,"dummyTrack",function(){return W});function W(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function($,K,A){"use strict";A.r(K);var W=A("./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 I=P.prototype;return I.loadWord=function(){var O=this.data,D=this.bytesAvailable,p=O.byteLength-D,y=new Uint8Array(4),R=Math.min(4,D);if(R===0)throw new Error("no bytes available");y.set(O.subarray(p,p+R)),this.word=new DataView(y.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},I.skipBits=function(O){var D;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,D=O>>3,O-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},I.readBits=function(O){var D=Math.min(this.bitsAvailable,O),p=this.word>>>32-D;return O>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=O-D,D>0&&this.bitsAvailable?p<<D|this.readBits(D):p},I.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},I.skipUEG=function(){this.skipBits(1+this.skipLZ())},I.skipEG=function(){this.skipBits(1+this.skipLZ())},I.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},I.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},I.readBoolean=function(){return this.readBits(1)===1},I.readUByte=function(){return this.readBits(8)},I.readUShort=function(){return this.readBits(16)},I.readUInt=function(){return this.readBits(32)},I.skipScalingList=function(O){for(var D=8,p=8,y,R=0;R<O;R++)p!==0&&(y=this.readEG(),p=(D+y+256)%256),D=p===0?D:p},I.readSPS=function(){var O=0,D=0,p=0,y=0,R,S,x,b=this.readUByte.bind(this),d=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),s=this.skipBits.bind(this),C=this.skipEG.bind(this),g=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);b();var L=b();if(d(5),s(3),b(),g(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var T=a();if(T===3&&s(1),g(),g(),s(1),l())for(S=T!==3?8:12,x=0;x<S;x++)l()&&(x<6?h(16):h(64))}g();var m=a();if(m===0)a();else if(m===1)for(s(1),C(),C(),R=a(),x=0;x<R;x++)C();g(),s(1);var f=a(),u=a(),o=d(1);o===0&&s(1),s(1),l()&&(O=a(),D=a(),p=a(),y=a());var E=[1,1];if(l()&&l()){var v=b();switch(v){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((f+1)*16-O*2-D*2),height:(2-o)*(u+1)*16-(o?2:4)*(p+y),pixelRatio:E}},I.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();K.default=M},"./src/demux/id3.ts":function($,K,A){"use strict";A.r(K),A.d(K,"isHeader",function(){return W}),A.d(K,"isFooter",function(){return M}),A.d(K,"getID3Data",function(){return P}),A.d(K,"canParse",function(){return k}),A.d(K,"getTimeStamp",function(){return O}),A.d(K,"isTimeStampFrame",function(){return D}),A.d(K,"getID3Frames",function(){return y}),A.d(K,"decodeFrame",function(){return R}),A.d(K,"utf8ArrayToStr",function(){return a}),A.d(K,"testables",function(){return l});var W=function(h,L){return L+10<=h.length&&(h[L]===73&&h[L+1]===68&&h[L+2]===51&&(h[L+3]<255&&h[L+4]<255&&(h[L+6]<128&&h[L+7]<128&&h[L+8]<128&&h[L+9]<128)))},M=function(h,L){return L+10<=h.length&&(h[L]===51&&h[L+1]===68&&h[L+2]===73&&(h[L+3]<255&&h[L+4]<255&&(h[L+6]<128&&h[L+7]<128&&h[L+8]<128&&h[L+9]<128)))},P=function(h,L){for(var T=L,m=0;W(h,L);){m+=10;var f=I(h,L+6);m+=f,M(h,L+10)&&(m+=10),L+=m}return m>0?h.subarray(T,T+m):void 0},I=function(h,L){var T=0;return T=(h[L]&127)<<21,T|=(h[L+1]&127)<<14,T|=(h[L+2]&127)<<7,T|=h[L+3]&127,T},k=function(h,L){return W(h,L)&&I(h,L+6)+10<=h.length-L},O=function(h){for(var L=y(h),T=0;T<L.length;T++){var m=L[T];if(D(m))return d(m)}return},D=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},p=function(h){var L=String.fromCharCode(h[0],h[1],h[2],h[3]),T=I(h,4),m=10;return{type:L,size:T,data:h.subarray(m,m+T)}},y=function(h){for(var L=0,T=[];W(h,L);){var m=I(h,L+6);L+=10;for(var f=L+m;L+8<f;){var u=p(h.subarray(L)),o=R(u);o&&T.push(o),L+=u.size+10}M(h,L)&&(L+=10)}return T},R=function(h){return h.type==="PRIV"?S(h):h.type[0]==="W"?b(h):x(h)},S=function(h){if(h.size<2)return;var L=a(h.data,!0),T=new Uint8Array(h.data.subarray(L.length+1));return{key:h.type,info:L,data:T.buffer}},x=function(h){if(h.size<2)return;if(h.type==="TXXX"){var L=1,T=a(h.data.subarray(L),!0);L+=T.length+1;var m=a(h.data.subarray(L));return{key:h.type,info:T,data:m}}var f=a(h.data.subarray(1));return{key:h.type,data:f}},b=function(h){if(h.type==="WXXX"){if(h.size<2)return;var L=1,T=a(h.data.subarray(L),!0);L+=T.length+1;var m=a(h.data.subarray(L));return{key:h.type,info:T,data:m}}var f=a(h.data);return{key:h.type,data:f}},d=function(h){if(h.data.byteLength===8){var L=new Uint8Array(h.data),T=L[3]&1,m=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return m/=45,T&&(m+=4772185884e-2),Math.round(m)}return},a=function(h,L){L===void 0&&(L=!1);var T=C();if(T){var m=T.decode(h);if(L){var f=m.indexOf("\0");return f!==-1?m.substring(0,f):m}return m.replace(/\0/g,"")}for(var u=h.length,o,E,v,c="",_=0;_<u;){if(o=h[_++],o===0&&L)return c;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(o);break;case 12:case 13:E=h[_++],c+=String.fromCharCode((o&31)<<6|E&63);break;case 14:E=h[_++],v=h[_++],c+=String.fromCharCode((o&15)<<12|(E&63)<<6|(v&63)<<0);break;default:}}return c},l={decodeTextFrame:x},s;function C(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/id3.ts"),P=A("./src/utils/logger.ts"),I=A("./src/demux/mpegaudio.ts");function k(p,y){p.prototype=Object.create(y.prototype),p.prototype.constructor=p,O(p,y)}function O(p,y){return O=Object.setPrototypeOf||function(S,x){return S.__proto__=x,S},O(p,y)}var D=function(p){k(y,p);function y(){return p.apply(this,arguments)||this}var R=y.prototype;return R.resetInitSegment=function(x,b,d){p.prototype.resetInitSegment.call(this,x,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},y.probe=function(x){if(!x)return!1;for(var b=M.getID3Data(x,0)||[],d=b.length,a=x.length;d<a;d++)if(I.probe(x,d))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(x,b){return I.canParse(x,b)},R.appendFrame=function(x,b,d){return this.initPTS===null?void 0:I.appendFrame(x,b,d,this.initPTS,this.frameIndex)},y}(W.default);D.minProbeByteLength=4,K.default=D},"./src/demux/mp4demuxer.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/utils/mp4-tools.ts"),M=A("./src/demux/dummy-demuxed-track.ts"),P=function(){function I(O,D){this.remainderData=null,this.config=void 0,this.config=D}var k=I.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},I.probe=function(D){return Object(W.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},k.demux=function(D){var p=D,y=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(p=Object(W.appendUint8Array)(this.remainderData,D));var R=Object(W.segmentValidRange)(p);this.remainderData=R.remainder,y.samples=R.valid||new Uint8Array}else y.samples=p;return{audioTrack:Object(M.dummyTrack)(),avcTrack:y,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var D=Object(M.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:D,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(D,p,y){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},I}();P.minProbeByteLength=1024,K.default=P},"./src/demux/mpegaudio.ts":function($,K,A){"use strict";A.r(K),A.d(K,"appendFrame",function(){return O}),A.d(K,"parseHeader",function(){return D}),A.d(K,"isHeaderPattern",function(){return p}),A.d(K,"isHeader",function(){return y}),A.d(K,"canParse",function(){return R}),A.d(K,"probe",function(){return S});var W=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],I=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function O(x,b,d,a,l){if(d+24>b.length)return;var s=D(b,d);if(s&&d+s.frameLength<=b.length){var C=s.samplesPerFrame*9e4/s.sampleRate,g=a+l*C,h={unit:b.subarray(d,d+s.frameLength),pts:g,dts:g};return x.config=[],x.channelCount=s.channelCount,x.samplerate=s.sampleRate,x.samples.push(h),{sample:h,length:s.frameLength,missing:0}}}function D(x,b){var d=x[b+1]>>3&3,a=x[b+1]>>1&3,l=x[b+2]>>4&15,s=x[b+2]>>2&3;if(d!==1&&l!==0&&l!==15&&s!==3){var C=x[b+2]>>1&1,g=x[b+3]>>6,h=d===3?3-a:a===3?3:4,L=M[h*14+l-1]*1e3,T=d===3?0:d===2?1:2,m=P[T*3+s],f=g===3?1:2,u=I[d][a],o=k[a],E=u*8*o,v=Math.floor(u*L/m+C)*o;if(W===null){var c=navigator.userAgent||"",_=c.match(/Chrome\/(\d+)/i);W=_?parseInt(_[1]):0}var U=!!W&&W<=87;return U&&a===2&&L>=224e3&&g===0&&(x[b+3]=x[b+3]|128),{sampleRate:m,channelCount:f,frameLength:v,samplesPerFrame:E}}}function p(x,b){return x[b]===255&&(x[b+1]&224)===224&&(x[b+1]&6)!==0}function y(x,b){return b+1<x.length&&p(x,b)}function R(x,b){var d=4;return p(x,b)&&d<=x.length-b}function S(x,b){if(b+1<x.length&&p(x,b)){var d=4,a=D(x,b),l=d;a!=null&&a.frameLength&&(l=a.frameLength);var s=b+l;return s===x.length||y(x,s)}return!1}},"./src/demux/sample-aes.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/crypt/decrypter.ts"),M=A("./src/demux/tsdemuxer.ts"),P=function(){function I(O,D,p){this.keyData=void 0,this.decrypter=void 0,this.keyData=p,this.decrypter=new W.default(O,D,{removePKCS7Padding:!1})}var k=I.prototype;return k.decryptBuffer=function(D,p){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,p)},k.decryptAacSample=function(D,p,y,R){var S=D[p].unit,x=S.subarray(16,S.length-S.length%16),b=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),d=this;this.decryptBuffer(b,function(a){var l=new Uint8Array(a);S.set(l,16),R||d.decryptAacSamples(D,p+1,y)})},k.decryptAacSamples=function(D,p,y){for(;;p++){if(p>=D.length){y();return}if(D[p].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(D,p,y,R),!R)return}},k.getAvcEncryptedData=function(D){for(var p=Math.floor((D.length-48)/160)*16+16,y=new Int8Array(p),R=0,S=32;S<=D.length-16;S+=160,R+=16)y.set(D.subarray(S,S+16),R);return y},k.getAvcDecryptedUnit=function(D,p){for(var y=new Uint8Array(p),R=0,S=32;S<=D.length-16;S+=160,R+=16)D.set(y.subarray(R,R+16),S);return D},k.decryptAvcSample=function(D,p,y,R,S,x){var b=Object(M.discardEPB)(S.data),d=this.getAvcEncryptedData(b),a=this;this.decryptBuffer(d.buffer,function(l){S.data=a.getAvcDecryptedUnit(b,l),x||a.decryptAvcSamples(D,p,y+1,R)})},k.decryptAvcSamples=function(D,p,y,R){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;p++,y=0){if(p>=D.length){R();return}for(var S=D[p].units;!(y>=S.length);y++){var x=S[y];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(D,p,y,R,x,b),!b)return}}},I}();K.default=P},"./src/demux/transmuxer-interface.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return S});var W=A("./node_modules/webworkify-webpack/index.js"),M=A.n(W),P=A("./src/events.ts"),I=A("./src/demux/transmuxer.ts"),k=A("./src/utils/logger.ts"),O=A("./src/errors.ts"),D=A("./src/utils/mediasource-helper.ts"),p=A("./node_modules/eventemitter3/index.js"),y=A.n(p),R=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},S=function(){function x(d,a,l,s){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=a,this.onTransmuxComplete=l,this.onFlush=s;var g=d.config,h=function(u,o){o=o||{},o.frag=C.frag,o.id=C.id,d.trigger(u,o)};this.observer=new p.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,h),this.observer.on(P.Events.ERROR,h);var L={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var m;try{m=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(f){d.trigger(P.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},m.postMessage({cmd:"init",typeSupported:L,vendor:T,id:a,config:JSON.stringify(g)})}catch(f){k.logger.warn("Error in worker:",f),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new I.default(this.observer,L,g,T,a),this.worker=null}}else this.transmuxer=new I.default(this.observer,L,g,T,a)}var b=x.prototype;return b.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},b.push=function(a,l,s,C,g,h,L,T,m,f){var u=this;m.transmuxing.start=self.performance.now();var o=this.transmuxer,E=this.worker,v=h?h.start:g.start,c=g.decryptdata,_=this.frag,U=!(_&&g.cc===_.cc),B=!(_&&m.level===_.level),z=_?m.sn-_.sn:-1,j=this.part?m.part-this.part.index:1,F=!B&&(z===1||z===0&&j===1),X=self.performance.now();(B||z||g.stats.parsing.start===0)&&(g.stats.parsing.start=X),h&&(j||!F)&&(h.stats.parsing.start=X);var te=new I.TransmuxState(U,F,T,B,v);if(!F||U){k.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
discontinuity: `+U+`
trackSwitch: `+B+`
contiguous: `+F+`
accurateTimeOffset: `+T+`
timeOffset: `+v);var ae=new I.TransmuxConfig(s,C,l,L,f);this.configureTransmuxer(ae)}if(this.frag=g,this.part=h,E)E.postMessage({cmd:"demux",data:a,decryptdata:c,chunkMeta:m,state:te},a instanceof ArrayBuffer?[a]:[]);else if(o){var ce=o.push(a,c,m,te);Object(I.isPromise)(ce)?ce.then(function(Te){u.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ce)}},b.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var s=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:a});else if(s){var g=s.flush(a);Object(I.isPromise)(g)?g.then(function(h){l.handleFlushResult(h,a)}):this.handleFlushResult(g,a)}},b.handleFlushResult=function(a,l){var s=this;a.forEach(function(C){s.handleTransmuxComplete(C)}),this.onFlush(l)},b.onWorkerMessage=function(a){var l=a.data,s=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,s.trigger(l.event,l.data);break}}},b.configureTransmuxer=function(a){var l=this.worker,s=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):s&&s.configure(a)},b.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},x}()},"./src/demux/transmuxer-worker.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return O});var W=A("./src/demux/transmuxer.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),I=A("./node_modules/eventemitter3/index.js"),k=A.n(I);function O(S){var x=new I.EventEmitter,b=function(a,l){S.postMessage({event:a,data:l})};x.on(M.Events.FRAG_DECRYPTED,b),x.on(M.Events.ERROR,b),S.addEventListener("message",function(d){var a=d.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);S.transmuxer=new W.default(x,a.typeSupported,l,a.vendor,a.id),Object(P.enableLogs)(l.debug),b("init",null);break}case"configure":{S.transmuxer.configure(a.config);break}case"demux":{var s=S.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(W.isPromise)(s)?s.then(function(h){D(S,h)}):D(S,s);break}case"flush":{var C=a.chunkMeta,g=S.transmuxer.flush(C);Object(W.isPromise)(g)?g.then(function(h){y(S,h,C)}):y(S,g,C);break}default:break}})}function D(S,x){if(R(x.remuxResult))return;var b=[],d=x.remuxResult,a=d.audio,l=d.video;a&&p(b,a),l&&p(b,l),S.postMessage({event:"transmuxComplete",data:x},b)}function p(S,x){x.data1&&S.push(x.data1.buffer),x.data2&&S.push(x.data2.buffer)}function y(S,x,b){x.forEach(function(d){D(S,d)}),S.postMessage({event:"flush",data:b})}function R(S){return!S.audio&&!S.video&&!S.text&&!S.id3&&!S.initSegment}},"./src/demux/transmuxer.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return l}),A.d(K,"isPromise",function(){return g}),A.d(K,"TransmuxConfig",function(){return h}),A.d(K,"TransmuxState",function(){return L});var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/crypt/decrypter.ts"),I=A("./src/demux/aacdemuxer.ts"),k=A("./src/demux/mp4demuxer.ts"),O=A("./src/demux/tsdemuxer.ts"),D=A("./src/demux/mp3demuxer.ts"),p=A("./src/remux/mp4-remuxer.ts"),y=A("./src/remux/passthrough-remuxer.ts"),R=A("./src/demux/chunk-cache.ts"),S=A("./src/utils/mp4-tools.ts"),x=A("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(T){x.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:O.default,remux:p.default},{demux:k.default,remux:y.default},{demux:I.default,remux:p.default},{demux:D.default,remux:p.default}],a=1024;d.forEach(function(T){var m=T.demux;a=Math.max(a,m.minProbeByteLength)});var l=function(){function T(f,u,o,E,v){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 R.default,this.observer=f,this.typeSupported=u,this.config=o,this.vendor=E,this.id=v}var m=T.prototype;return m.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},m.push=function(u,o,E,v){var c=this,_=E.transmuxing;_.executeStart=b();var U=new Uint8Array(u),B=this.cache,z=this.config,j=this.currentTransmuxState,F=this.transmuxConfig;v&&(this.currentTransmuxState=v);var X=s(U,o);if(X&&X.method==="AES-128"){var te=this.getDecrypter();if(z.enableSoftwareAES){var ae=te.softwareDecrypt(U,X.key.buffer,X.iv.buffer);if(!ae)return _.executeEnd=b(),C(E);U=new Uint8Array(ae)}else return this.decryptionPromise=te.webCryptoDecrypt(U,X.key.buffer,X.iv.buffer).then(function(De){var Re=c.push(De,null,E);return c.decryptionPromise=null,Re}),this.decryptionPromise}var ce=v||j,Te=ce.contiguous,ge=ce.discontinuity,he=ce.trackSwitch,ee=ce.accurateTimeOffset,re=ce.timeOffset,Z=F.audioCodec,ne=F.videoCodec,me=F.defaultInitPts,de=F.duration,Se=F.initSegmentData;if((ge||he)&&this.resetInitSegment(Se,Z,ne,de),ge&&this.resetInitialTimestamp(me),Te||this.resetContiguity(),this.needsProbing(U,ge,he)){if(B.dataLength){var ye=B.flush();U=Object(S.appendUint8Array)(ye,U)}this.configureTransmuxer(U,F)}var Ie=this.transmux(U,X,re,ee,E),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,_.executeEnd=b(),Ie},m.flush=function(u){var o=this,E=u.transmuxing;E.executeStart=b();var v=this.decrypter,c=this.cache,_=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return o.flush(u)});var B=[],z=_.timeOffset;if(v){var j=v.flush();j&&B.push(this.push(j,null,u))}var F=c.dataLength;c.reset();var X=this.demuxer,te=this.remuxer;if(!X||!te)return F>=a&&this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=b(),[C(u)];var ae=X.flush(z);return g(ae)?ae.then(function(ce){return o.flushRemux(B,ce,u),B}):(this.flushRemux(B,ae,u),B)},m.flushRemux=function(u,o,E){var v=o.audioTrack,c=o.avcTrack,_=o.id3Track,U=o.textTrack,B=this.currentTransmuxState,z=B.accurateTimeOffset,j=B.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var F=this.remuxer.remux(v,c,_,U,j,z,!0,this.id);u.push({remuxResult:F,chunkMeta:E}),E.transmuxing.executeEnd=b()},m.resetInitialTimestamp=function(u){var o=this.demuxer,E=this.remuxer;if(!o||!E)return;o.resetTimeStamp(u),E.resetTimeStamp(u)},m.resetContiguity=function(){var u=this.demuxer,o=this.remuxer;if(!u||!o)return;u.resetContiguity(),o.resetNextTimestamp()},m.resetInitSegment=function(u,o,E,v){var c=this.demuxer,_=this.remuxer;if(!c||!_)return;c.resetInitSegment(o,E,v),_.resetInitSegment(u,o,E)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(u,o,E,v,c){var _;return o&&o.method==="SAMPLE-AES"?_=this.transmuxSampleAes(u,o,E,v,c):_=this.transmuxUnencrypted(u,E,v,c),_},m.transmuxUnencrypted=function(u,o,E,v){var c=this.demuxer.demux(u,o,!1,!this.config.progressive),_=c.audioTrack,U=c.avcTrack,B=c.id3Track,z=c.textTrack,j=this.remuxer.remux(_,U,B,z,o,E,!1,this.id);return{remuxResult:j,chunkMeta:v}},m.transmuxSampleAes=function(u,o,E,v,c){var _=this;return this.demuxer.demuxSampleAes(u,o,E).then(function(U){var B=_.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,E,v,!1,_.id);return{remuxResult:B,chunkMeta:c}})},m.configureTransmuxer=function(u,o){for(var E=this.config,v=this.observer,c=this.typeSupported,_=this.vendor,U=o.audioCodec,B=o.defaultInitPts,z=o.duration,j=o.initSegmentData,F=o.videoCodec,X,te=0,ae=d.length;te<ae;te++)if(d[te].demux.probe(u)){X=d[te];break}X||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:k.default,remux:y.default});var ce=this.demuxer,Te=this.remuxer,ge=X.remux,he=X.demux;(!Te||!(Te instanceof ge))&&(this.remuxer=new ge(v,E,c,_)),(!ce||!(ce instanceof he))&&(this.demuxer=new he(v,E,c),this.probe=he.probe),this.resetInitSegment(j,U,F,z),this.resetInitialTimestamp(B)},m.needsProbing=function(u,o,E){return!this.demuxer||!this.remuxer||o||E},m.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new P.default(this.observer,this.config)),u},T}();function s(T,m){var f=null;return T.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(f=m),f}var C=function(m){return{remuxResult:{},chunkMeta:m}};function g(T){return"then"in T&&T.then instanceof Function}var h=function(m,f,u,o,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=f,this.initSegmentData=u,this.duration=o,this.defaultInitPts=E},L=function(m,f,u,o,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=f,this.accurateTimeOffset=u,this.trackSwitch=o,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function($,K,A){"use strict";A.r(K),A.d(K,"discardEPB",function(){return C});var W=A("./src/demux/adts.ts"),M=A("./src/demux/mpegaudio.ts"),P=A("./src/demux/exp-golomb.ts"),I=A("./src/demux/id3.ts"),k=A("./src/demux/sample-aes.ts"),O=A("./src/events.ts"),D=A("./src/utils/mp4-tools.ts"),p=A("./src/utils/logger.ts"),y=A("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},S=function(){function g(L,T,m){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=T,this.typeSupported=m}g.probe=function(T){var m=g.syncOffset(T);return m<0?!1:(m&&p.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},g.syncOffset=function(T){for(var m=Math.min(1e3,T.length-3*188),f=0;f<m;){if(T[f]===71&&T[f+188]===71&&T[f+2*188]===71)return f;f++}return-1},g.createTrack=function(T,m){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:R[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?m:void 0}};var h=g.prototype;return h.resetInitSegment=function(T,m,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",f),this._audioTrack=g.createTrack("audio",f),this._id3Track=g.createTrack("id3",f),this._txtTrack=g.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=m,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var T=this._audioTrack,m=this._avcTrack,f=this._id3Track;T&&(T.pesData=null),m&&(m.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(T,m,f,u){f===void 0&&(f=!1),u===void 0&&(u=!1),f||(this.sampleAes=null);var o,E=this._avcTrack,v=this._audioTrack,c=this._id3Track,_=E.pid,U=E.pesData,B=v.pid,z=c.pid,j=v.pesData,F=c.pesData,X=!1,te=this.pmtParsed,ae=this._pmtId,ce=T.length;if(this.remainderData&&(T=Object(D.appendUint8Array)(this.remainderData,T),ce=T.length,this.remainderData=null),ce<188&&!u)return this.remainderData=T,{audioTrack:v,avcTrack:E,id3Track:c,textTrack:this._txtTrack};var Te=Math.max(0,g.syncOffset(T));ce-=(ce+Te)%188,ce<T.byteLength&&!u&&(this.remainderData=new Uint8Array(T.buffer,ce,T.buffer.byteLength-ce));for(var ge=Te;ge<ce;ge+=188)if(T[ge]===71){var he=!!(T[ge+1]&64),ee=((T[ge+1]&31)<<8)+T[ge+2],re=(T[ge+3]&48)>>4,Z=void 0;if(re>1){if(Z=ge+5+T[ge+4],Z===ge+188)continue}else Z=ge+4;switch(ee){case _:he&&(U&&(o=a(U))&&this.parseAVCPES(o,!1),U={data:[],size:0}),U&&(U.data.push(T.subarray(Z,ge+188)),U.size+=ge+188-Z);break;case B:he&&(j&&(o=a(j))&&(v.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),j={data:[],size:0}),j&&(j.data.push(T.subarray(Z,ge+188)),j.size+=ge+188-Z);break;case z:he&&(F&&(o=a(F))&&this.parseID3PES(o),F={data:[],size:0}),F&&(F.data.push(T.subarray(Z,ge+188)),F.size+=ge+188-Z);break;case 0:he&&(Z+=T[Z]+1),ae=this._pmtId=b(T,Z);break;case ae:{he&&(Z+=T[Z]+1);var ne=d(T,Z,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);_=ne.avc,_>0&&(E.pid=_),B=ne.audio,B>0&&(v.pid=B,v.isAAC=ne.isAAC),z=ne.id3,z>0&&(c.pid=z),X&&!te&&(p.logger.log("reparse from beginning"),X=!1,ge=Te-188),te=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=U,v.pesData=j,c.pesData=F;var me={audioTrack:v,avcTrack:E,id3Track:c,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(me),me},h.flush=function(){var T=this.remainderData;this.remainderData=null;var m;return T?m=this.demux(T,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},h.extractRemainingSamples=function(T){var m=T.audioTrack,f=T.avcTrack,u=T.id3Track,o=f.pesData,E=m.pesData,v=u.pesData,c;o&&(c=a(o))?(this.parseAVCPES(c,!0),f.pesData=null):f.pesData=o,E&&(c=a(E))?(m.isAAC?this.parseAACPES(c):this.parseMPEGPES(c),m.pesData=null):(E!=null&&E.size&&p.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=E),v&&(c=a(v))?(this.parseID3PES(c),u.pesData=null):u.pesData=v},h.demuxSampleAes=function(T,m,f){var u=this.demux(T,f,!0,!this.config.progressive),o=this.sampleAes=new k.default(this.observer,this.config,m);return this.decrypt(u,o)},h.decrypt=function(T,m){return new Promise(function(f){var u=T.audioTrack,o=T.avcTrack;u.samples&&u.isAAC?m.decryptAacSamples(u.samples,0,function(){o.samples?m.decryptAvcSamples(o.samples,0,0,function(){f(T)}):f(T)}):o.samples&&m.decryptAvcSamples(o.samples,0,0,function(){f(T)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(T,m){var f=this,u=this._avcTrack,o=this.parseAVCNALu(T.data),E=!1,v=this.avcSample,c,_=!1;T.data=null,v&&o.length&&!u.audFound&&(l(v,u),v=this.avcSample=x(!1,T.pts,T.dts,"")),o.forEach(function(U){switch(U.type){case 1:{c=!0,v||(v=f.avcSample=x(!0,T.pts,T.dts,"")),E&&(v.debug+="NDR "),v.frame=!0;var B=U.data;if(_&&B.length>4){var z=new P.default(B).readSliceType();(z===2||z===4||z===7||z===9)&&(v.key=!0)}break}case 5:c=!0,v||(v=f.avcSample=x(!0,T.pts,T.dts,"")),E&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{c=!0,E&&v&&(v.debug+="SEI ");var j=new P.default(C(U.data));j.readUByte();for(var F=0,X=0,te=!1,ae=0;!te&&j.bytesAvailable>1;){F=0;do ae=j.readUByte(),F+=ae;while(ae===255);X=0;do ae=j.readUByte(),X+=ae;while(ae===255);if(F===4&&j.bytesAvailable!==0){te=!0;var ce=j.readUByte();if(ce===181){var Te=j.readUShort();if(Te===49){var ge=j.readUInt();if(ge===1195456820){var he=j.readUByte();if(he===3){for(var ee=j.readUByte(),re=j.readUByte(),Z=31&ee,ne=[ee,re],me=0;me<Z;me++)ne.push(j.readUByte()),ne.push(j.readUByte()),ne.push(j.readUByte());s(f._txtTrack.samples,{type:3,pts:T.pts,bytes:ne})}}}}}else if(F===5&&j.bytesAvailable!==0){if(te=!0,X>16){for(var de=[],Se=0;Se<16;Se++)de.push(j.readUByte().toString(16)),(Se===3||Se===5||Se===7||Se===9)&&de.push("-");for(var ye=X-16,Ie=new Uint8Array(ye),Ee=0;Ee<ye;Ee++)Ie[Ee]=j.readUByte();s(f._txtTrack.samples,{pts:T.pts,payloadType:F,uuid:de.join(""),userData:Object(I.utf8ArrayToStr)(Ie),userDataBytes:Ie})}}else if(X<j.bytesAvailable)for(var De=0;De<X;De++)j.readUByte()}break}case 7:if(c=!0,_=!0,E&&v&&(v.debug+="SPS "),!u.sps){var Re=new P.default(U.data),ke=Re.readSPS();u.width=ke.width,u.height=ke.height,u.pixelRatio=ke.pixelRatio,u.sps=[U.data],u.duration=f._duration;for(var Ne=U.data.subarray(1,4),Pe="avc1.",Ce=0;Ce<3;Ce++){var Je=Ne[Ce].toString(16);Je.length<2&&(Je="0"+Je),Pe+=Je}u.codec=Pe}break;case 8:c=!0,E&&v&&(v.debug+="PPS "),u.pps||(u.pps=[U.data]);break;case 9:c=!1,u.audFound=!0,v&&l(v,u),v=f.avcSample=x(!1,T.pts,T.dts,E?"AUD ":"");break;case 12:c=!1;break;default:c=!1,v&&(v.debug+="unknown NAL "+U.type+" ");break}if(v&&c){var Xe=v.units;Xe.push(U)}}),m&&v&&(l(v,u),this.avcSample=null)},h.getLastNalUnit=function(){var T,m=this.avcSample,f;if(!m||m.units.length===0){var u=this._avcTrack.samples;m=u[u.length-1]}if((T=m)!==null&&T!==void 0&&T.units){var o=m.units;f=o[o.length-1]}return f},h.parseAVCNALu=function(T){var m=T.byteLength,f=this._avcTrack,u=f.naluState||0,o=u,E=[],v=0,c,_,U,B=-1,z=0;for(u===-1&&(B=0,z=T[0]&31,u=0,v=1);v<m;){if(c=T[v++],!u){u=c?0:1;continue}if(u===1){u=c?0:2;continue}if(!c)u=3;else if(c===1){if(B>=0){var j={data:T.subarray(B,v-u-1),type:z};E.push(j)}else{var F=this.getLastNalUnit();if(F&&(o&&v<=4-o&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-o))),_=v-u-1,_>0)){var X=new Uint8Array(F.data.byteLength+_);X.set(F.data,0),X.set(T.subarray(0,_),F.data.byteLength),F.data=X,F.state=0}}v<m?(U=T[v]&31,B=v,z=U,u=0):u=-1}else u=0}if(B>=0&&u>=0){var te={data:T.subarray(B,m),type:z,state:u};E.push(te)}if(E.length===0){var ae=this.getLastNalUnit();if(ae){var ce=new Uint8Array(ae.data.byteLength+T.byteLength);ce.set(ae.data,0),ce.set(T,ae.data.byteLength),ae.data=ce}}return f.naluState=u,E},h.parseAACPES=function(T){var m=0,f=this._audioTrack,u=this.aacOverFlow,o=T.data;if(u){this.aacOverFlow=null;var E=u.sample.unit.byteLength,v=Math.min(u.missing,E),c=E-v;u.sample.unit.set(o.subarray(0,v),c),f.samples.push(u.sample),m=u.missing}var _,U;for(_=m,U=o.length;_<U-1&&!W.isHeader(o,_);_++);if(_!==m){var B,z;if(_<U-1?(B="AAC PES did not start with ADTS header,offset:"+_,z=!1):(B="no ADTS header found in AAC PES",z=!0),p.logger.warn("parsing error:"+B),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:B}),z)return}W.initTrackConfig(f,this.observer,o,_,this.audioCodec);var j;if(T.pts!==void 0)j=T.pts;else if(u){var F=W.getFrameDuration(f.samplerate);j=u.sample.pts+F}else{p.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;_<U;)if(W.isHeader(o,_)){if(_+5<U){var te=W.appendFrame(f,o,_,j,X);if(te)if(te.missing)this.aacOverFlow=te;else{_+=te.length,X++;continue}}break}else _++},h.parseMPEGPES=function(T){var m=T.data,f=m.length,u=0,o=0,E=T.pts;if(E===void 0){p.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<f;)if(M.isHeader(m,o)){var v=M.appendFrame(this._audioTrack,m,o,E,u);if(v)o+=v.length,u++;else break}else o++},h.parseID3PES=function(T){if(T.pts===void 0){p.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},g}();S.minProbeByteLength=188;function x(g,h,L,T){return{key:g,frame:!1,pts:h,dts:L,units:[],debug:T,length:0}}function b(g,h){return(g[h+10]&31)<<8|g[h+11]}function d(g,h,L,T){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(g[h+1]&15)<<8|g[h+2],u=h+3+f-4,o=(g[h+10]&15)<<8|g[h+11];for(h+=12+o;h<u;){var E=(g[h+1]&31)<<8|g[h+2];switch(g[h]){case 207:if(!T){p.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=E);break;case 21:m.id3===-1&&(m.id3=E);break;case 219:if(!T){p.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=E);break;case 3:case 4:L?m.audio===-1&&(m.audio=E,m.isAAC=!1):p.logger.log("MPEG audio found, not supported in this browser");break;case 36:p.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((g[h+3]&15)<<8|g[h+4])+5}return m}function a(g){var h=0,L,T,m,f,u,o=g.data;if(!g||g.size===0)return null;for(;o[0].length<19&&o.length>1;){var E=new Uint8Array(o[0].length+o[1].length);E.set(o[0]),E.set(o[1],o[0].length),o[0]=E,o.splice(1,1)}L=o[0];var v=(L[0]<<16)+(L[1]<<8)+L[2];if(v===1){if(T=(L[4]<<8)+L[5],T&&T>g.size-6)return null;var c=L[7];c&192&&(f=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,c&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,f-u>60*9e4&&(p.logger.warn(Math.round((f-u)/9e4)+"s delta between PTS and DTS, align them"),f=u)):u=f),m=L[8];var _=m+9;if(g.size<=_)return null;g.size-=_;for(var U=new Uint8Array(g.size),B=0,z=o.length;B<z;B++){L=o[B];var j=L.byteLength;if(_)if(_>j){_-=j;continue}else L=L.subarray(_),j-=_,_=0;U.set(L,h),h+=j}return T&&(T-=m+3),{data:U,pts:f,dts:u,len:T}}return null}function l(g,h){if(g.units.length&&g.frame){if(g.pts===void 0){var L=h.samples,T=L.length;if(T){var m=L[T-1];g.pts=m.pts,g.dts=m.dts}else{h.dropped++;return}}h.samples.push(g)}g.debug.length&&p.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function s(g,h){var L=g.length;if(L>0){if(h.pts>=g[L-1].pts)g.push(h);else for(var T=L-1;T>=0;T--)if(h.pts<g[T].pts){g.splice(T,0,h);break}}else g.push(h)}function C(g){for(var h=g.byteLength,L=[],T=1;T<h-2;)g[T]===0&&g[T+1]===0&&g[T+2]===3?(L.push(T+2),T+=2):T++;if(L.length===0)return g;var m=h-L.length,f=new Uint8Array(m),u=0;for(T=0;T<m;u++,T++)u===L[0]&&(u++,L.shift()),f[T]=g[u];return f}K.default=S},"./src/errors.ts":function($,K,A){"use strict";A.r(K),A.d(K,"ErrorTypes",function(){return W}),A.d(K,"ErrorDetails",function(){return M});var W;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(W||(W={}));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($,K,A){"use strict";A.r(K),A.d(K,"Events",function(){return W});var W;(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"})(W||(W={}))},"./src/hls.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return g});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W),P=A("./src/loader/playlist-loader.ts"),I=A("./src/loader/key-loader.ts"),k=A("./src/controller/id3-track-controller.ts"),O=A("./src/controller/latency-controller.ts"),D=A("./src/controller/level-controller.ts"),p=A("./src/controller/fragment-tracker.ts"),y=A("./src/controller/stream-controller.ts"),R=A("./src/is-supported.ts"),S=A("./src/utils/logger.ts"),x=A("./src/config.ts"),b=A("./node_modules/eventemitter3/index.js"),d=A.n(b),a=A("./src/events.ts"),l=A("./src/errors.ts");function s(h,L){for(var T=0;T<L.length;T++){var m=L[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(h,m.key,m)}}function C(h,L,T){return L&&s(h.prototype,L),T&&s(h,T),h}var g=function(){h.isSupported=function(){return Object(R.isSupported)()};function h(T){T===void 0&&(T={}),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 m=this.config=Object(x.mergeConfig)(h.DefaultConfig,T);this.userConfig=T,Object(S.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(x.enableStreamingMode)(m);var f=m.abrController,u=m.bufferController,o=m.capLevelController,E=m.fpsController,v=this.abrController=new f(this),c=this.bufferController=new u(this),_=this.capLevelController=new o(this),U=new E(this),B=new P.default(this),z=new I.default(this),j=new k.default(this),F=this.levelController=new D.default(this),X=new p.FragmentTracker(this),te=this.streamController=new y.default(this,X);_.setStreamController(te),U.setStreamController(te);var ae=[F,te];this.networkControllers=ae;var ce=[B,z,v,c,_,U,j,X];this.audioTrackController=this.createController(m.audioTrackController,null,ae),this.createController(m.audioStreamController,X,ae),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,ae),this.createController(m.subtitleStreamController,X,ae),this.createController(m.timelineController,null,ce),this.emeController=this.createController(m.emeController,null,ce),this.cmcdController=this.createController(m.cmcdController,null,ce),this.latencyController=this.createController(O.default,null,ce),this.coreComponents=ce}var L=h.prototype;return L.createController=function(m,f,u){if(m){var o=f?new m(this,f):new m(this);return u&&u.push(o),o}return null},L.on=function(m,f,u){u===void 0&&(u=this),this._emitter.on(m,f,u)},L.once=function(m,f,u){u===void 0&&(u=this),this._emitter.once(m,f,u)},L.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},L.off=function(m,f,u,o){u===void 0&&(u=this),this._emitter.off(m,f,u,o)},L.listeners=function(m){return this._emitter.listeners(m)},L.emit=function(m,f,u){return this._emitter.emit(m,f,u)},L.trigger=function(m,f){if(this.config.debug)return this.emit(m,m,f);try{return this.emit(m,m,f)}catch(u){S.logger.error("An internal error happened while handling event "+m+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:u})}return!1},L.listenerCount=function(m){return this._emitter.listenerCount(m)},L.destroy=function(){S.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},L.attachMedia=function(m){S.logger.log("attachMedia"),this._media=m,this.trigger(a.Events.MEDIA_ATTACHING,{media:m})},L.detachMedia=function(){S.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(m){this.stopLoad();var f=this.media,u=this.url,o=this.url=W.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});S.logger.log("loadSource:"+o),f&&u&&u!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(a.Events.MANIFEST_LOADING,{url:m})},L.startLoad=function(m){m===void 0&&(m=-1),S.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(f){f.startLoad(m)})},L.stopLoad=function(){S.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},L.swapAudioCodec=function(){S.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){S.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},L.removeLevel=function(m,f){f===void 0&&(f=0),this.levelController.removeLevel(m,f)},C(h,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){S.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){S.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){S.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){S.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){S.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var f=!!m;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(m){this._autoLevelCapping!==m&&(S.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,f=this.config.minAutoBitrate;if(!m)return 0;for(var u=m.length,o=0;o<u;o++)if(m[o].maxBitrate>f)return o;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,f=this.autoLevelCapping,u;return f===-1&&m&&m.length?u=m.length-1:u=f,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var f=this.audioTrackController;f&&(f.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var f=this.subtitleTrackController;f&&(f.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:x.hlsDefaultConfig},set:function(m){h.defaultConfig=m}}]),h}();g.defaultConfig=void 0},"./src/is-supported.ts":function($,K,A){"use strict";A.r(K),A.d(K,"isSupported",function(){return P}),A.d(K,"changeTypeSupported",function(){return I});var W=A("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(W.getMediaSource)();if(!k)return!1;var O=M(),D=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),p=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!D&&!!p}function I(){var k,O=M();return typeof(O==null||((k=O.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return S}),A.d(K,"LoadError",function(){return b});var W=A("./src/polyfills/number.ts"),M=A("./src/errors.ts");function P(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,p(d,a)}function I(d){var a=typeof Map=="function"?new Map:void 0;return I=function(s){if(s===null||!D(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(s))return a.get(s);a.set(s,C)}function C(){return k(s,arguments,y(this).constructor)}return C.prototype=Object.create(s.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),p(C,s)},I(d)}function k(d,a,l){return O()?k=Reflect.construct:k=function(C,g,h){var L=[null];L.push.apply(L,g);var T=Function.bind.apply(C,L),m=new T;return h&&p(m,h.prototype),m},k.apply(null,arguments)}function O(){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(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function p(d,a){return p=Object.setPrototypeOf||function(s,C){return s.__proto__=C,s},p(d,a)}function y(d){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},y(d)}var R=Math.pow(2,17),S=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=d.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(s,C){var g=this,h=s.url;if(!h)return Promise.reject(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var L=this.config,T=L.fLoader,m=L.loader;return new Promise(function(f,u){g.loader&&g.loader.destroy();var o=g.loader=s.loader=T?new T(L):new m(L),E=x(s),v={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:R};s.stats=o.stats,o.load(E,v,{onSuccess:function(_,U,B,z){g.resetLoader(s,o),f({frag:s,part:null,payload:_.data,networkDetails:z})},onError:function(_,U,B){g.resetLoader(s,o),u(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:_,networkDetails:B}))},onAbort:function(_,U,B){g.resetLoader(s,o),u(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:B}))},onTimeout:function(_,U,B){g.resetLoader(s,o),u(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:B}))},onProgress:function(_,U,B,z){C&&C({frag:s,part:null,payload:B,networkDetails:z})}})})},a.loadPart=function(s,C,g){var h=this;this.abort();var L=this.config,T=L.fLoader,m=L.loader;return new Promise(function(f,u){h.loader&&h.loader.destroy();var o=h.loader=s.loader=T?new T(L):new m(L),E=x(s,C),v={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:R};C.stats=o.stats,o.load(E,v,{onSuccess:function(_,U,B,z){h.resetLoader(s,o),h.updateStatsFromPart(s,C);var j={frag:s,part:C,payload:_.data,networkDetails:z};g(j),f(j)},onError:function(_,U,B){h.resetLoader(s,o),u(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:C,response:_,networkDetails:B}))},onAbort:function(_,U,B){s.stats.aborted=C.stats.aborted,h.resetLoader(s,o),u(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:C,networkDetails:B}))},onTimeout:function(_,U,B){h.resetLoader(s,o),u(new b({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:C,networkDetails:B}))}})})},a.updateStatsFromPart=function(s,C){var g=s.stats,h=C.stats,L=h.total;if(g.loaded+=h.loaded,L){var T=Math.round(s.duration/C.duration),m=Math.min(Math.round(g.loaded/L),T),f=T-m,u=f*Math.round(g.loaded/m);g.total=g.loaded+u}else g.total=Math.max(g.loaded,g.total);var o=g.loading,E=h.loading;o.start?o.first+=E.first-E.start:(o.start=E.start,o.first=E.first),o.end=E.end},a.resetLoader=function(s,C){s.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},d}();function x(d,a){a===void 0&&(a=null);var l=a||d,s={frag:d,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,g=l.byteRangeEndOffset;return Object(W.isFiniteNumber)(C)&&Object(W.isFiniteNumber)(g)&&(s.rangeStart=C,s.rangeEnd=g),s}var b=function(d){P(a,d);function a(l){for(var s,C=arguments.length,g=new Array(C>1?C-1:0),h=1;h<C;h++)g[h-1]=arguments[h];return s=d.call.apply(d,[this].concat(g))||this,s.data=void 0,s.data=l,s}return a}(I(Error))},"./src/loader/fragment.ts":function($,K,A){"use strict";A.r(K),A.d(K,"ElementaryStreamTypes",function(){return S}),A.d(K,"BaseSegment",function(){return x}),A.d(K,"Fragment",function(){return b}),A.d(K,"Part",function(){return d});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),I=A("./src/utils/logger.ts"),k=A("./src/loader/level-key.ts"),O=A("./src/loader/load-stats.ts");function D(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,p(a,l)}function p(a,l){return p=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},p(a,l)}function y(a,l){for(var s=0;s<l.length;s++){var C=l[s];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function R(a,l,s){return l&&y(a.prototype,l),s&&y(a,s),a}var S;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(S||(S={}));var x=function(){function a(s){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[S.AUDIO]=null,C[S.VIDEO]=null,C[S.AUDIOVIDEO]=null,C),this.baseurl=s}var l=a.prototype;return l.setByteRange=function(C,g){var h=C.split("@",2),L=[];h.length===1?L[0]=g?g.byteRangeEndOffset:0:L[0]=parseInt(h[1]),L[1]=parseInt(h[0])+L[0],this._byteRange=L},R(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),a}(),b=function(a){D(l,a);function l(C,g){var h;return h=a.call(this,g)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new O.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=C,h}var s=l.prototype;return s.createInitializationVector=function(g){for(var h=new Uint8Array(16),L=12;L<16;L++)h[L]=g>>8*(15-L)&255;return h},s.setDecryptDataFromLevelKey=function(g,h){var L=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(L=k.LevelKey.fromURI(g.uri),L.method=g.method,L.iv=this.createInitializationVector(h),L.keyFormat="identity"),L},s.setElementaryStreamInfo=function(g,h,L,T,m,f){f===void 0&&(f=!1);var u=this.elementaryStreams,o=u[g];if(!o){u[g]={startPTS:h,endPTS:L,startDTS:T,endDTS:m,partial:f};return}o.startPTS=Math.min(o.startPTS,h),o.endPTS=Math.max(o.endPTS,L),o.startDTS=Math.min(o.startDTS,T),o.endDTS=Math.max(o.endDTS,m)},s.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[S.AUDIO]=null,g[S.VIDEO]=null,g[S.AUDIOVIDEO]=null},R(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&I.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(W.isFiniteNumber)(this.programDateTime))return null;var g=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),l}(x),d=function(a){D(l,a);function l(s,C,g,h,L){var T;T=a.call(this,g)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new O.LoadStats,T.duration=s.decimalFloatingPoint("DURATION"),T.gap=s.bool("GAP"),T.independent=s.bool("INDEPENDENT"),T.relurl=s.enumeratedString("URI"),T.fragment=C,T.index=h;var m=s.enumeratedString("BYTERANGE");return m&&T.setByteRange(m,L),L&&(T.fragOffset=L.fragOffset+L.duration),T}return R(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(x)},"./src/loader/key-loader.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return I});var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),I=function(){function k(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var O=k.prototype;return O._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var p in this.loaders){var y=this.loaders[p];y&&y.destroy()}this.loaders={}},O.onKeyLoading=function(p,y){var R=y.frag,S=R.type,x=this.loaders[S];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=R.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(x&&(P.logger.warn("abort previous key loader for type:"+S),x.abort()),!b){P.logger.warn("key uri is falsy");return}var a=d.loader,l=R.loader=this.loaders[S]=new a(d);this.decrypturl=b,this.decryptkey=null;var s={url:b,frag:R,responseType:"arraybuffer"},C={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(s,C,g)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:R}))},O.loadsuccess=function(p,y,R){var S=R.frag;if(!S.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=S.decryptdata.key=new Uint8Array(p.data),S.loader=null,delete this.loaders[S.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:S})},O.loaderror=function(p,y){var R=y.frag,S=R.loader;S&&S.abort(),delete this.loaders[R.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:p})},O.loadtimeout=function(p,y){var R=y.frag,S=R.loader;S&&S.abort(),delete this.loaders[R.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},k}()},"./src/loader/level-details.ts":function($,K,A){"use strict";A.r(K),A.d(K,"LevelDetails",function(){return k});var W=A("./src/polyfills/number.ts");function M(O,D){for(var p=0;p<D.length;p++){var y=D[p];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function P(O,D,p){return D&&M(O.prototype,D),p&&M(O,p),O}var I=10,k=function(){function O(p){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=p}var D=O.prototype;return D.reloaded=function(y){if(!y){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-y.lastPartSn,S=this.lastPartIndex-y.lastPartIndex;this.updated=this.endSN!==y.endSN||!!S||!!R,this.advanced=this.endSN>y.endSN||R>0||R===0&&S>0,this.updated||this.advanced?this.misses=Math.floor(y.misses*.6):this.misses=y.misses+1,this.availabilityDelay=y.availabilityDelay},P(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(W.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||I}},{key:"drift",get:function(){var y=this.driftEndTime-this.driftStartTime;if(y>0){var R=this.driftEnd-this.driftStart;return R*1e3/y}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var y;return(y=this.partList)!==null&&y!==void 0&&y.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var y;return(y=this.fragments)!==null&&y!==void 0&&y.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 y;return(y=this.partList)!==null&&y!==void 0&&y.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var y;return(y=this.partList)!==null&&y!==void 0&&y.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function($,K,A){"use strict";A.r(K),A.d(K,"LevelKey",function(){return k});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W);function P(O,D){for(var p=0;p<D.length;p++){var y=D[p];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function I(O,D,p){return D&&P(O.prototype,D),p&&P(O,p),O}var k=function(){O.fromURL=function(p,y){return new O(p,y)},O.fromURI=function(p){return new O(p)};function O(D,p){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,p?this._uri=Object(W.buildAbsoluteURL)(D,p,{alwaysNormalize:!0}):this._uri=D}return I(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function($,K,A){"use strict";A.r(K),A.d(K,"LoadStats",function(){return W});var W=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($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return l});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),I=A("./src/loader/fragment.ts"),k=A("./src/loader/level-details.ts"),O=A("./src/loader/level-key.ts"),D=A("./src/utils/attr-list.ts"),p=A("./src/utils/logger.ts"),y=A("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,S=/#EXT-X-MEDIA:(.*)/g,x=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 a(L){var T,m;return d.test((T=(m=M.parseURL(L))===null||m===void 0?void 0:m.path)!=null?T:"")}var l=function(){function L(){}return L.findGroup=function(m,f){for(var u=0;u<m.length;u++){var o=m[u];if(o.id===f)return o}},L.convertAVC1ToAVCOTI=function(m){var f=m.split(".");if(f.length>2){var u=f.shift()+".";return u+=parseInt(f.shift()).toString(16),u+=("000"+parseInt(f.shift()).toString(16)).substr(-4),u}return m},L.resolve=function(m,f){return M.buildAbsoluteURL(f,m,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(m,f){var u=[],o={},E=!1;R.lastIndex=0;for(var v;(v=R.exec(m))!=null;)if(v[1]){var c=new D.AttrList(v[1]),_={attrs:c,bitrate:c.decimalInteger("AVERAGE-BANDWIDTH")||c.decimalInteger("BANDWIDTH"),name:c.NAME,url:L.resolve(v[2],f)},U=c.decimalResolution("RESOLUTION");U&&(_.width=U.width,_.height=U.height),s((c.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),_),_.videoCodec&&_.videoCodec.indexOf("avc1")!==-1&&(_.videoCodec=L.convertAVC1ToAVCOTI(_.videoCodec)),u.push(_)}else if(v[3]){var B=new D.AttrList(v[3]);B["DATA-ID"]&&(E=!0,o[B["DATA-ID"]]=B)}return{levels:u,sessionData:E?o:null}},L.parseMasterPlaylistMedia=function(m,f,u,o){o===void 0&&(o=[]);var E,v=[],c=0;for(S.lastIndex=0;(E=S.exec(m))!==null;){var _=new D.AttrList(E[1]);if(_.TYPE===u){var U={attrs:_,bitrate:0,id:c++,groupId:_["GROUP-ID"],instreamId:_["INSTREAM-ID"],name:_.NAME||_.LANGUAGE||"",type:u,default:_.bool("DEFAULT"),autoselect:_.bool("AUTOSELECT"),forced:_.bool("FORCED"),lang:_.LANGUAGE,url:_.URI?L.resolve(_.URI,f):""};if(o.length){var B=L.findGroup(o,U.groupId)||o[0];C(U,B,"audioCodec"),C(U,B,"textCodec")}v.push(U)}}return v},L.parseLevelPlaylist=function(m,f,u,o,E){var v=new k.LevelDetails(f),c=v.fragments,_=null,U=0,B=0,z=0,j=0,F=null,X=new I.Fragment(o,f),te,ae,ce,Te=-1,ge=!1;for(x.lastIndex=0,v.m3u8=m;(te=x.exec(m))!==null;){ge&&(ge=!1,X=new I.Fragment(o,f),X.start=z,X.sn=U,X.cc=j,X.level=u,_&&(X.initSegment=_,X.rawProgramDateTime=_.rawProgramDateTime));var he=te[1];if(he){X.duration=parseFloat(he);var ee=(" "+te[2]).slice(1);X.title=ee||null,X.tagList.push(ee?["INF",he,ee]:["INF",he])}else if(te[3])Object(W.isFiniteNumber)(X.duration)&&(X.start=z,ce&&(X.levelkey=ce),X.sn=U,X.level=u,X.cc=j,X.urlId=E,c.push(X),X.relurl=(" "+te[3]).slice(1),h(X,F),F=X,z+=X.duration,U++,B=0,ge=!0);else if(te[4]){var re=(" "+te[4]).slice(1);F?X.setByteRange(re,F):X.setByteRange(re)}else if(te[5])X.rawProgramDateTime=(" "+te[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Te===-1&&(Te=c.length);else{if(te=te[0].match(b),!te){p.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<te.length&&!(typeof te[ae]!="undefined");ae++);var Z=(" "+te[ae]).slice(1),ne=(" "+te[ae+1]).slice(1),me=te[ae+2]?(" "+te[ae+2]).slice(1):"";switch(Z){case"PLAYLIST-TYPE":v.type=ne.toUpperCase();break;case"MEDIA-SEQUENCE":U=v.startSN=parseInt(ne);break;case"SKIP":{var de=new D.AttrList(ne),Se=de.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(Se)){v.skippedSegments=Se;for(var ye=Se;ye--;)c.unshift(null);U+=Se}var Ie=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ie&&(v.recentlyRemovedDateranges=Ie.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(ne);break;case"VERSION":v.version=parseInt(ne);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(ne||me)&&X.tagList.push(me?[ne,me]:[ne]);break;case"DIS":j++;case"GAP":X.tagList.push([Z]);break;case"BITRATE":X.tagList.push([Z,ne]);break;case"DISCONTINUITY-SEQ":j=parseInt(ne);break;case"KEY":{var Ee,De=new D.AttrList(ne),Re=De.enumeratedString("METHOD"),ke=De.URI,Ne=De.hexadecimalInteger("IV"),Pe=De.enumeratedString("KEYFORMATVERSIONS"),Ce=De.enumeratedString("KEYID"),Je=(Ee=De.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",Xe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Xe.indexOf(Je)>-1){p.logger.warn("Keyformat "+Je+" is not supported from the manifest");continue}else if(Je!=="identity")continue;Re&&(ce=O.LevelKey.fromURL(f,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ce.method=Re,ce.keyFormat=Je,Ce&&(ce.keyID=Ce),Pe&&(ce.keyFormatVersions=Pe),ce.iv=Ne));break}case"START":{var We=new D.AttrList(ne),He=We.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(He)&&(v.startTimeOffset=He);break}case"MAP":{var et=new D.AttrList(ne);X.relurl=et.URI,et.BYTERANGE&&X.setByteRange(et.BYTERANGE),X.level=u,X.sn="initSegment",ce&&(X.levelkey=ce),X.initSegment=null,_=X,ge=!0;break}case"SERVER-CONTROL":{var Be=new D.AttrList(ne);v.canBlockReload=Be.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=Be.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&Be.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=Be.optionalFloat("PART-HOLD-BACK",0),v.holdBack=Be.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ge=new D.AttrList(ne);v.partTarget=Ge.decimalFloatingPoint("PART-TARGET");break}case"PART":{var xe=v.partList;xe||(xe=v.partList=[]);var Ze=B>0?xe[xe.length-1]:void 0,Ve=B++,we=new I.Part(new D.AttrList(ne),X,f,Ve,Ze);xe.push(we),X.duration+=we.duration;break}case"PRELOAD-HINT":{var Me=new D.AttrList(ne);v.preloadHint=Me;break}case"RENDITION-REPORT":{var fe=new D.AttrList(ne);v.renditionReports=v.renditionReports||[],v.renditionReports.push(fe);break}default:p.logger.warn("line parsed but not handled: "+te);break}}}F&&!F.relurl?(c.pop(),z-=F.duration,v.partList&&(v.fragmentHint=F)):v.partList&&(h(X,F),X.cc=j,v.fragmentHint=X);var le=c.length,ue=c[0],Y=c[le-1];if(z+=v.skippedSegments*v.targetduration,z>0&&le&&Y){v.averagetargetduration=z/le;var Q=Y.sn;v.endSN=Q!=="initSegment"?Q:0,ue&&(v.startCC=ue.cc,ue.initSegment||v.fragments.every(function(q){return q.relurl&&a(q.relurl)})&&(p.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new I.Fragment(o,f),X.relurl=Y.relurl,X.level=u,X.sn="initSegment",ue.initSegment=X,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(z+=v.fragmentHint.duration),v.totalduration=z,v.endCC=j,Te>0&&g(c,Te),v},L}();function s(L,T){["video","audio","text"].forEach(function(m){var f=L.filter(function(o){return Object(y.isCodecType)(o,m)});if(f.length){var u=f.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});T[m+"Codec"]=u.length>0?u[0]:f[0],L=L.filter(function(o){return f.indexOf(o)===-1})}}),T.unknownCodecs=L}function C(L,T,m){var f=T[m];f&&(L[m]=f)}function g(L,T){for(var m=L[T],f=T;f--;){var u=L[f];if(!u)return;u.programDateTime=m.programDateTime-u.duration*1e3,m=u}}function h(L,T){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):T!=null&&T.programDateTime&&(L.programDateTime=T.endProgramDateTime),Object(W.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),I=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),O=A("./src/loader/m3u8-parser.ts"),D=A("./src/types/loader.ts"),p=A("./src/utils/attr-list.ts");function y(x){var b=x.type;switch(b){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function R(x,b){var d=x.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var S=function(){function x(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=x.prototype;return b.registerListeners=function(){var a=this.hls;a.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var a=this.hls;a.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(a){var l=this.hls.config,s=l.pLoader,C=l.loader,g=s||C,h=new g(l);return a.loader=h,this.loaders[a.type]=h,h},b.getInternalLoader=function(a){return this.loaders[a.type]},b.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},b.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(a,l){var s=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},b.onLevelLoading=function(a,l){var s=l.id,C=l.level,g=l.url,h=l.deliveryDirectives;this.load({id:s,groupId:null,level:C,responseType:"text",type:D.PlaylistContextType.LEVEL,url:g,deliveryDirectives:h})},b.onAudioTrackLoading=function(a,l){var s=l.id,C=l.groupId,g=l.url,h=l.deliveryDirectives;this.load({id:s,groupId:C,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:h})},b.onSubtitleTrackLoading=function(a,l){var s=l.id,C=l.groupId,g=l.url,h=l.deliveryDirectives;this.load({id:s,groupId:C,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:h})},b.load=function(a){var l,s=this.hls.config,C=this.getInternalLoader(a);if(C){var g=C.context;if(g&&g.url===a.url){I.logger.trace("[playlist-loader]: playlist request ongoing");return}I.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),C.abort()}var h,L,T,m;switch(a.type){case D.PlaylistContextType.MANIFEST:h=s.manifestLoadingMaxRetry,L=s.manifestLoadingTimeOut,T=s.manifestLoadingRetryDelay,m=s.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:h=0,L=s.levelLoadingTimeOut;break;default:h=s.levelLoadingMaxRetry,L=s.levelLoadingTimeOut,T=s.levelLoadingRetryDelay,m=s.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var f;if(a.type===D.PlaylistContextType.LEVEL&&a.level!==null?f=this.hls.levels[a.level].details:a.type===D.PlaylistContextType.AUDIO_TRACK&&a.id!==null?f=this.hls.audioTracks[a.id].details:a.type===D.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(f=this.hls.subtitleTracks[a.id].details),f){var u=f.partTarget,o=f.targetduration;u&&o&&(L=Math.min(Math.max(u*3,o*.8)*1e3,L))}}var E={timeout:L,maxRetry:h,retryDelay:T,maxRetryDelay:m,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(a,E,v)},b.loadsuccess=function(a,l,s,C){if(C===void 0&&(C=null),s.isSidxRequest){this.handleSidxRequest(a,s),this.handlePlaylistLoaded(a,l,s,C);return}this.resetInternalLoader(s.type);var g=a.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,s,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,s,C):this.handleMasterPlaylist(a,l,s,C)},b.loaderror=function(a,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!1,a)},b.loadtimeout=function(a,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!0)},b.handleMasterPlaylist=function(a,l,s,C){var g=this.hls,h=a.data,L=R(a,s),T=O.default.parseMasterPlaylist(h,L),m=T.levels,f=T.sessionData;if(!m.length){this.handleManifestParsingError(a,s,"no level found in manifest",C);return}var u=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),o=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),E=O.default.parseMasterPlaylistMedia(h,L,"AUDIO",u),v=O.default.parseMasterPlaylistMedia(h,L,"SUBTITLES",o),c=O.default.parseMasterPlaylistMedia(h,L,"CLOSED-CAPTIONS");if(E.length){var _=E.some(function(U){return!U.url});!_&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(I.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new p.AttrList({}),bitrate:0,url:""}))}g.trigger(M.Events.MANIFEST_LOADED,{levels:m,audioTracks:E,subtitles:v,captions:c,url:L,stats:l,networkDetails:C,sessionData:f})},b.handleTrackOrLevelPlaylist=function(a,l,s,C){var g=this.hls,h=s.id,L=s.level,T=s.type,m=R(a,s),f=Object(W.isFiniteNumber)(h)?h:0,u=Object(W.isFiniteNumber)(L)?L:f,o=y(s),E=O.default.parseLevelPlaylist(a.data,m,u,o,f);if(!E.fragments.length){g.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(T===D.PlaylistContextType.MANIFEST){var v={attrs:new p.AttrList({}),bitrate:0,details:E,name:"",url:m};g.trigger(M.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:m,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),E.needSidxRanges){var c,_=(c=E.fragments[0].initSegment)===null||c===void 0?void 0:c.url;this.load({url:_,isSidxRequest:!0,type:T,level:L,levelDetails:E,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=E,this.handlePlaylistLoaded(a,l,s,C)},b.handleSidxRequest=function(a,l){var s=Object(k.parseSegmentIndex)(new Uint8Array(a.data));if(!s)return;var C=s.references,g=l.levelDetails;C.forEach(function(h,L){var T=h.info,m=g.fragments[L];m.byteRange.length===0&&m.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),m.initSegment&&m.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(a,l,s,C){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===D.PlaylistContextType.MANIFEST,url:a.url,reason:s,response:a,context:l,networkDetails:C})},b.handleNetworkError=function(a,l,s,C){s===void 0&&(s=!1),I.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var g=P.ErrorDetails.UNKNOWN,h=!1,L=this.getInternalLoader(a);switch(a.type){case D.PlaylistContextType.MANIFEST:g=s?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case D.PlaylistContextType.LEVEL:g=s?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.AUDIO_TRACK:g=s?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:g=s?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}L&&this.resetInternalLoader(a.type);var T={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:h,url:a.url,loader:L,context:a,networkDetails:l};C&&(T.response=C),this.hls.trigger(M.Events.ERROR,T)},b.handlePlaylistLoaded=function(a,l,s,C){var g=s.type,h=s.level,L=s.id,T=s.groupId,m=s.loader,f=s.levelDetails,u=s.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(a,s,"invalid target duration",C);return}if(!m)return;f.live&&(m.getCacheAge&&(f.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(g){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:f,level:h||0,id:L||0,stats:l,networkDetails:C,deliveryDirectives:u});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:f,id:L||0,groupId:T||"",stats:l,networkDetails:C,deliveryDirectives:u});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:f,id:L||0,groupId:T||"",stats:l,networkDetails:C,deliveryDirectives:u});break}},x}();K.default=S},"./src/polyfills/number.ts":function($,K,A){"use strict";A.r(K),A.d(K,"isFiniteNumber",function(){return W}),A.d(K,"MAX_SAFE_INTEGER",function(){return M});var W=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function($,K,A){"use strict";A.r(K);var W=function(){function M(){}return M.getSilentFrame=function(I,k){switch(I){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}();K.default=W},"./src/remux/mp4-generator.ts":function($,K,A){"use strict";A.r(K);var W=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 O=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]),D=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:O,audio:D};var p=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),y=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=y,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 R=new Uint8Array([105,115,111,109]),S=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,x,R,S),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,p))},P.box=function(k){for(var O=8,D=arguments.length,p=new Array(D>1?D-1:0),y=1;y<D;y++)p[y-1]=arguments[y];for(var R=p.length,S=R;R--;)O+=p[R].byteLength;var x=new Uint8Array(O);for(x[0]=O>>24&255,x[1]=O>>16&255,x[2]=O>>8&255,x[3]=O&255,x.set(k,4),R=0,O=8;R<S;R++)x.set(p[R],O),O+=p[R].byteLength;return x},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,O){O*=k;var D=Math.floor(O/(W+1)),p=Math.floor(O%(W+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,D>>24,D>>16&255,D>>8&255,D&255,p>>24,p>>16&255,p>>8&255,p&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,O,D){return P.box(P.types.moof,P.mfhd(k),P.traf(D,O))},P.moov=function(k){for(var O=k.length,D=[];O--;)D[O]=P.trak(k[O]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(D).concat(P.mvex(k)))},P.mvex=function(k){for(var O=k.length,D=[];O--;)D[O]=P.trex(k[O]);return P.box.apply(null,[P.types.mvex].concat(D))},P.mvhd=function(k,O){O*=k;var D=Math.floor(O/(W+1)),p=Math.floor(O%(W+1)),y=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,D>>24,D>>16&255,D>>8&255,D&255,p>>24,p>>16&255,p>>8&255,p&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,y)},P.sdtp=function(k){var O=k.samples||[],D=new Uint8Array(4+O.length),p,y;for(p=0;p<O.length;p++)y=O[p].flags,D[p+4]=y.dependsOn<<4|y.isDependedOn<<2|y.hasRedundancy;return P.box(P.types.sdtp,D)},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 O=[],D=[],p,y,R;for(p=0;p<k.sps.length;p++)y=k.sps[p],R=y.byteLength,O.push(R>>>8&255),O.push(R&255),O=O.concat(Array.prototype.slice.call(y));for(p=0;p<k.pps.length;p++)y=k.pps[p],R=y.byteLength,D.push(R>>>8&255),D.push(R&255),D=D.concat(Array.prototype.slice.call(y));var S=P.box(P.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|k.sps.length].concat(O).concat([k.pps.length]).concat(D))),x=k.width,b=k.height,d=k.pixelRatio[0],a=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,x>>8&255,x&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]),S,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,a>>24,a>>16&255,a>>8&255,a&255])))},P.esds=function(k){var O=k.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var O=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,O>>8&255,O&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var O=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,O>>8&255,O&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 O=k.id,D=k.duration*k.timescale,p=k.width,y=k.height,R=Math.floor(D/(W+1)),S=Math.floor(D%(W+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,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,S>>24,S>>16&255,S>>8&255,S&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,p>>8&255,p&255,0,0,y>>8&255,y&255,0,0]))},P.traf=function(k,O){var D=P.sdtp(k),p=k.id,y=Math.floor(O/(W+1)),R=Math.floor(O%(W+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,y>>24,y>>16&255,y>>8&255,y&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(k,D.length+16+20+8+16+8+8),D)},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 O=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,O){var D=k.samples||[],p=D.length,y=12+16*p,R=new Uint8Array(y),S,x,b,d,a,l;for(O+=8+y,R.set([0,0,15,1,p>>>24&255,p>>>16&255,p>>>8&255,p&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),S=0;S<p;S++)x=D[S],b=x.duration,d=x.size,a=x.flags,l=x.cts,R.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*S);return P.box(P.types.trun,R)},P.initSegment=function(k){P.types||P.init();var O=P.moov(k),D=new Uint8Array(P.FTYP.byteLength+O.byteLength);return D.set(P.FTYP),D.set(O,P.FTYP.byteLength),D},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,K.default=M},"./src/remux/mp4-remuxer.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return l}),A.d(K,"normalizePts",function(){return s});var W=A("./src/polyfills/number.ts"),M=A("./src/remux/aac-helper.ts"),P=A("./src/remux/mp4-generator.ts"),I=A("./src/events.ts"),k=A("./src/errors.ts"),O=A("./src/utils/logger.ts"),D=A("./src/types/loader.ts"),p=A("./src/utils/timescale-conversion.ts");function y(){return y=Object.assign||function(L){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(L[f]=m[f])}return L},y.apply(this,arguments)}var R=10*1e3,S=1024,x=1152,b=null,d=null,a=!1,l=function(){function L(m,f,u,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=m,this.config=f,this.typeSupported=u,this.ISGenerated=!1,b===null){var E=navigator.userAgent||"",v=E.match(/Chrome\/(\d+)/i);b=v?parseInt(v[1]):0}if(d===null){var c=navigator.userAgent.match(/Safari\/(\d+)/i);d=c?parseInt(c[1]):0}a=!!b&&b<75||!!d&&d<600}var T=L.prototype;return T.destroy=function(){},T.resetTimeStamp=function(f){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},T.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(f){var u=!1,o=f.reduce(function(E,v){var c=v.pts-E;return c<-4294967296?(u=!0,s(E,v.pts)):c>0?E:v.pts},f[0].pts);return u&&O.logger.debug("PTS rollover detected"),o},T.remux=function(f,u,o,E,v,c,_,U){var B,z,j,F,X,te,ae=v,ce=v,Te=f.pid>-1,ge=u.pid>-1,he=u.samples.length,ee=f.samples.length>0,re=he>1,Z=(!Te||ee)&&(!ge||re)||this.ISGenerated||_;if(Z){this.ISGenerated||(j=this.generateIS(f,u,v));var ne=this.isVideoContiguous,me=-1;if(re&&(me=C(u.samples),!ne&&this.config.forceKeyFrameOnDiscontinuity))if(te=!0,me>0){O.logger.warn("[mp4-remuxer]: Dropped "+me+" out of "+he+" video samples due to a missing keyframe");var de=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(me),u.dropped+=me,ce+=(u.samples[0].pts-de)/(u.timescale||9e4)}else me===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),te=!1);if(this.ISGenerated){if(ee&&re){var Se=this.getVideoStartPts(u.samples),ye=s(f.samples[0].pts,Se)-Se,Ie=ye/u.inputTimeScale;ae+=Math.max(0,Ie),ce+=Math.max(0,-Ie)}if(ee){if(f.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),j=this.generateIS(f,u,v)),z=this.remuxAudio(f,ae,this.isAudioContiguous,c,ge||re||U===D.PlaylistLevelType.AUDIO?ce:void 0),re){var Ee=z?z.endPTS-z.startPTS:0;u.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),j=this.generateIS(f,u,v)),B=this.remuxVideo(u,ce,ne,Ee)}}else re&&(B=this.remuxVideo(u,ce,ne,0));B&&(B.firstKeyFrame=me,B.independent=me!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,v)),E.samples.length&&(F=this.remuxText(E,v))),{audio:z,video:B,initSegment:j,independent:te,text:F,id3:X}},T.generateIS=function(f,u,o){var E=f.samples,v=u.samples,c=this.typeSupported,_={},U=!Object(W.isFiniteNumber)(this._initPTS),B="audio/mp4",z,j,F;if(U&&(z=j=Infinity),f.config&&E.length&&(f.timescale=f.samplerate,f.isAAC||(c.mpeg?(B="audio/mpeg",f.codec=""):c.mp3&&(f.codec="mp3")),_.audio={id:"audio",container:B,codec:f.codec,initSegment:!f.isAAC&&c.mpeg?new Uint8Array(0):P.default.initSegment([f]),metadata:{channelCount:f.channelCount}},U&&(F=f.inputTimeScale,z=j=E[0].pts-Math.round(F*o))),u.sps&&u.pps&&v.length&&(u.timescale=u.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:P.default.initSegment([u]),metadata:{width:u.width,height:u.height}},U)){F=u.inputTimeScale;var X=this.getVideoStartPts(v),te=Math.round(F*o);j=Math.min(j,s(v[0].dts,X)-te),z=Math.min(z,X-te)}if(Object.keys(_).length)return this.ISGenerated=!0,U&&(this._initPTS=z,this._initDTS=j),{tracks:_,initPTS:z,timescale:F}},T.remuxVideo=function(f,u,o,E){var v=f.inputTimeScale,c=f.samples,_=[],U=c.length,B=this._initPTS,z=this.nextAvcDts,j=8,F,X,te,ae=Number.POSITIVE_INFINITY,ce=Number.NEGATIVE_INFINITY,Te=0,ge=!1;if(!o||z===null){var he=u*v,ee=c[0].pts-s(c[0].dts,c[0].pts);z=he-ee}for(var re=0;re<U;re++){var Z=c[re];if(Z.pts=s(Z.pts-B,z),Z.dts=s(Z.dts-B,z),Z.dts>Z.pts){var ne=9e4*.2;Te=Math.max(Math.min(Te,Z.pts-Z.dts),-1*ne)}Z.dts<c[re>0?re-1:re].dts&&(ge=!0)}ge&&c.sort(function(ct,at){var tt=ct.dts-at.dts,xt=ct.pts-at.pts;return tt||xt}),X=c[0].dts,te=c[c.length-1].dts;var me=Math.round((te-X)/(U-1));if(Te<0){if(Te<me*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(p.toMsFromMpegTsClock)(-me,!0)+" ms");for(var de=Te,Se=0;Se<U;Se++)c[Se].dts=de=Math.max(de,c[Se].pts-me),c[Se].pts=Math.max(de,c[Se].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(p.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var ye=0;ye<U;ye++)c[ye].dts=c[ye].dts+Te}X=c[0].dts}if(o){var Ie=X-z,Ee=Ie>me,De=Ie<-1;if(Ee||De){Ee?O.logger.warn("AVC: "+Object(p.toMsFromMpegTsClock)(Ie,!0)+" ms ("+Ie+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(p.toMsFromMpegTsClock)(-Ie,!0)+" ms ("+Ie+"dts) overlapping between fragments detected"),X=z;var Re=c[0].pts-Ie;c[0].dts=X,c[0].pts=Re,O.logger.log("Video: First PTS/DTS adjusted: "+Object(p.toMsFromMpegTsClock)(Re,!0)+"/"+Object(p.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(p.toMsFromMpegTsClock)(Ie,!0)+" ms")}}a&&(X=Math.max(0,X));for(var ke=0,Ne=0,Pe=0;Pe<U;Pe++){for(var Ce=c[Pe],Je=Ce.units,Xe=Je.length,We=0,He=0;He<Xe;He++)We+=Je[He].data.length;Ne+=We,ke+=Xe,Ce.length=We,Ce.dts=Math.max(Ce.dts,X),Ce.pts=Math.max(Ce.pts,Ce.dts,0),ae=Math.min(Ce.pts,ae),ce=Math.max(Ce.pts,ce)}te=c[U-1].dts;var et=Ne+4*ke+8,Be;try{Be=new Uint8Array(et)}catch(ct){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var Ge=new DataView(Be.buffer);Ge.setUint32(0,et),Be.set(P.default.types.mdat,4);for(var xe=0;xe<U;xe++){for(var Ze=c[xe],Ve=Ze.units,we=0,Me=0,fe=Ve.length;Me<fe;Me++){var le=Ve[Me],ue=le.data,Y=le.data.byteLength;Ge.setUint32(j,Y),j+=4,Be.set(ue,j),j+=Y,we+=4+Y}if(xe<U-1)F=c[xe+1].dts-Ze.dts;else{var Q=this.config,q=Ze.dts-c[xe>0?xe-1:xe].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var oe=Math.floor(Q.maxBufferHole*v),be=(E?ae+E*v:this.nextAudioPts)-Ze.pts;be>oe?(F=be-q,F<0&&(F=q),O.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=q}else F=q}var Le=Math.round(Ze.pts-Ze.dts);_.push(new g(Ze.key,F,we,Le))}if(_.length&&b&&b<70){var _e=_[0].flags;_e.dependsOn=2,_e.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=te+F,this.isVideoContiguous=!0;var ze=P.default.moof(f.sequenceNumber++,X,y({},f,{samples:_})),it="video",Ae={data1:ze,data2:Be,startPTS:ae/v,endPTS:(ce+F)/v,startDTS:X/v,endDTS:z/v,type:it,hasAudio:!1,hasVideo:!0,nb:_.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Be.length,"MDAT length must not be zero"),Ae},T.remuxAudio=function(f,u,o,E,v){var c=f.inputTimeScale,_=f.samplerate?f.samplerate:c,U=c/_,B=f.isAAC?S:x,z=B*U,j=this._initPTS,F=!f.isAAC&&this.typeSupported.mpeg,X=[],te=f.samples,ae=F?0:8,ce=this.nextAudioPts||-1,Te=u*c;if(this.isAudioContiguous=o=o||te.length&&ce>0&&(E&&Math.abs(Te-ce)<9e3||Math.abs(s(te[0].pts-j,Te)-ce)<20*z),te.forEach(function(ue){ue.pts=s(ue.pts-j,Te)}),!o||ce<0){if(te=te.filter(function(ue){return ue.pts>=0}),!te.length)return;v===0?ce=0:E?ce=Math.max(0,Te):ce=te[0].pts}if(f.isAAC)for(var ge=v!==void 0,he=this.config.maxAudioFramesDrift,ee=0,re=ce;ee<te.length;ee++){var Z=te[ee],ne=Z.pts,me=ne-re,de=Math.abs(1e3*me/c);if(me<=-he*z&&ge)ee===0&&(O.logger.warn("Audio frame @ "+(ne/c).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*me/c)+" ms."),this.nextAudioPts=ce=re=ne);else if(me>=he*z&&de<R&&ge){var Se=Math.round(me/z);re=ne-Se*z,re<0&&(Se--,re+=z),ee===0&&(this.nextAudioPts=ce=re),O.logger.warn("[mp4-remuxer]: Injecting "+Se+" audio frame @ "+(re/c).toFixed(3)+"s due to "+Math.round(1e3*me/c)+" ms gap.");for(var ye=0;ye<Se;ye++){var Ie=Math.max(re,0),Ee=M.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);Ee||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=Z.unit.subarray()),te.splice(ee,0,{unit:Ee,pts:Ie}),re+=z,ee++}}Z.pts=re,re+=z}for(var De=null,Re=null,ke,Ne=0,Pe=te.length;Pe--;)Ne+=te[Pe].unit.byteLength;for(var Ce=0,Je=te.length;Ce<Je;Ce++){var Xe=te[Ce],We=Xe.unit,He=Xe.pts;if(Re!==null){var et=X[Ce-1];et.duration=Math.round((He-Re)/U)}else if(o&&f.isAAC&&(He=ce),De=He,Ne>0){Ne+=ae;try{ke=new Uint8Array(Ne)}catch(ue){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ne,reason:"fail allocating audio mdat "+Ne});return}if(!F){var Be=new DataView(ke.buffer);Be.setUint32(0,Ne),ke.set(P.default.types.mdat,4)}}else return;ke.set(We,ae);var Ge=We.byteLength;ae+=Ge,X.push(new g(!0,B,Ge,0)),Re=He}var xe=X.length;if(!xe)return;var Ze=X[X.length-1];this.nextAudioPts=ce=Re+U*Ze.duration;var Ve=F?new Uint8Array(0):P.default.moof(f.sequenceNumber++,De/U,y({},f,{samples:X}));f.samples=[];var we=De/c,Me=ce/c,fe="audio",le={data1:Ve,data2:ke,startPTS:we,endPTS:Me,startDTS:we,endDTS:Me,type:fe,hasAudio:!0,hasVideo:!1,nb:xe};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),le},T.remuxEmptyAudio=function(f,u,o,E){var v=f.inputTimeScale,c=f.samplerate?f.samplerate:v,_=v/c,U=this.nextAudioPts,B=(U!==null?U:E.startDTS*v)+this._initDTS,z=E.endDTS*v+this._initDTS,j=_*S,F=Math.ceil((z-B)/j),X=M.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var te=[],ae=0;ae<F;ae++){var ce=B+ae*j;te.push({unit:X,pts:ce,dts:ce})}return f.samples=te,this.remuxAudio(f,u,o,!1)},T.remuxID3=function(f,u){var o=f.samples.length;if(!o)return;for(var E=f.inputTimeScale,v=this._initPTS,c=this._initDTS,_=0;_<o;_++){var U=f.samples[_];U.pts=s(U.pts-v,u*E)/E,U.dts=s(U.dts-c,u*E)/E}var B=f.samples;return f.samples=[],{samples:B}},T.remuxText=function(f,u){var o=f.samples.length;if(!o)return;for(var E=f.inputTimeScale,v=this._initPTS,c=0;c<o;c++){var _=f.samples[c];_.pts=s(_.pts-v,u*E)/E}f.samples.sort(function(B,z){return B.pts-z.pts});var U=f.samples;return f.samples=[],{samples:U}},L}();function s(L,T){var m;if(T===null)return L;for(T<L?m=-8589934592:m=8589934592;Math.abs(L-T)>4294967296;)L+=m;return L}function C(L){for(var T=0;T<L.length;T++)if(L[T].key)return T;return-1}var g=function(T,m,f,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=f,this.cts=u,this.flags=new h(T)},h=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/mp4-tools.ts"),P=A("./src/loader/fragment.ts"),I=A("./src/utils/logger.ts"),k=function(){function p(){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 y=p.prototype;return y.destroy=function(){},y.resetTimeStamp=function(S){this.initPTS=S,this.lastEndDTS=null},y.resetNextTimestamp=function(){this.lastEndDTS=null},y.resetInitSegment=function(S,x,b){this.audioCodec=x,this.videoCodec=b,this.generateInitSegment(S),this.emitInitSegment=!0},y.generateInitSegment=function(S){var x=this.audioCodec,b=this.videoCodec;if(!S||!S.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(M.parseInitSegment)(S);x||(x=D(d.audio,P.ElementaryStreamTypes.AUDIO)),b||(b=D(d.video,P.ElementaryStreamTypes.VIDEO));var a={};d.audio&&d.video?a.audiovideo={container:"video/mp4",codec:x+","+b,initSegment:S,id:"main"}:d.audio?a.audio={container:"audio/mp4",codec:x,initSegment:S,id:"audio"}:d.video?a.video={container:"video/mp4",codec:b,initSegment:S,id:"main"}:I.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},y.remux=function(S,x,b,d,a){var l=this.initPTS,s=this.lastEndDTS,C={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(W.isFiniteNumber)(s)||(s=this.lastEndDTS=a||0);var g=x.samples;if(!g||!g.length)return C;var h={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(g),L=this.initData),!L||!L.length)return I.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(l)||(this.initPTS=h.initPTS=l=O(L,g,s));var T=Object(M.getDuration)(g,L),m=s,f=T+m;Object(M.offsetStartDTS)(L,g,l),T>0?this.lastEndDTS=f:(I.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,o=!!L.video,E="";u&&(E+="audio"),o&&(E+="video");var v={data1:g,startPTS:m,startDTS:m,endPTS:f,endDTS:f,type:E,hasAudio:u,hasVideo:o,nb:1,dropped:0};return C.audio=v.type==="audio"?v:void 0,C.video=v.type!=="audio"?v:void 0,C.text=d,C.id3=b,C.initSegment=h,C},p}(),O=function(y,R,S){return Object(M.getStartDTS)(y,R)-S};function D(p,y){var R=p==null?void 0:p.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||y===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=k},"./src/task-loop.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=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($,K,A){"use strict";A.r(K),A.d(K,"CMCDVersion",function(){return W}),A.d(K,"CMCDObjectType",function(){return M}),A.d(K,"CMCDStreamingFormat",function(){return P}),A.d(K,"CMCDStreamType",function(){return I});var W=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 I;(function(k){k.VOD="v",k.LIVE="l"})(I||(I={}))},"./src/types/level.ts":function($,K,A){"use strict";A.r(K),A.d(K,"HlsSkip",function(){return P}),A.d(K,"getSkipValue",function(){return I}),A.d(K,"HlsUrlParameters",function(){return k}),A.d(K,"Level",function(){return O});function W(D,p){for(var y=0;y<p.length;y++){var R=p[y];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function M(D,p,y){return p&&W(D.prototype,p),y&&W(D,y),D}var P;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(P||(P={}));function I(D,p){var y=D.canSkipUntil,R=D.canSkipDateRanges,S=D.endSN,x=p!==void 0?p-S:0;return y&&x<y?R?P.v2:P.Yes:P.No}var k=function(){function D(y,R,S){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=y,this.part=R,this.skip=S}var p=D.prototype;return p.addDirectives=function(R){var S=new self.URL(R);return this.msn!==void 0&&S.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&S.searchParams.set("_HLS_part",this.part.toString()),this.skip&&S.searchParams.set("_HLS_skip",this.skip),S.toString()},D}(),O=function(){function D(p){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=[p.url],this.attrs=p.attrs,this.bitrate=p.bitrate,p.details&&(this.details=p.details),this.id=p.id||0,this.name=p.name,this.width=p.width||0,this.height=p.height||0,this.audioCodec=p.audioCodec,this.videoCodec=p.videoCodec,this.unknownCodecs=p.unknownCodecs,this.codecSet=[p.videoCodec,p.audioCodec].filter(function(y){return y}).join(",").replace(/\.[^.,]+/g,"")}return M(D,[{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(y){var R=y%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),D}()},"./src/types/loader.ts":function($,K,A){"use strict";A.r(K),A.d(K,"PlaylistContextType",function(){return W}),A.d(K,"PlaylistLevelType",function(){return M});var W;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function($,K,A){"use strict";A.r(K),A.d(K,"ChunkMetadata",function(){return W});var W=function(I,k,O,D,p,y){D===void 0&&(D=0),p===void 0&&(p=-1),y===void 0&&(y=!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=I,this.sn=k,this.id=O,this.size=D,this.part=p,this.partial=y};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function($,K,A){"use strict";A.r(K),A.d(K,"AttrList",function(){return P});var W=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function I(O){typeof O=="string"&&(O=I.parseAttrList(O));for(var D in O)O.hasOwnProperty(D)&&(this[D]=O[D])}var k=I.prototype;return k.decimalInteger=function(D){var p=parseInt(this[D],10);return p>Number.MAX_SAFE_INTEGER?Infinity:p},k.hexadecimalInteger=function(D){if(this[D]){var p=(this[D]||"0x").slice(2);p=(p.length&1?"0":"")+p;for(var y=new Uint8Array(p.length/2),R=0;R<p.length/2;R++)y[R]=parseInt(p.slice(R*2,R*2+2),16);return y}else return null},k.hexadecimalIntegerAsNumber=function(D){var p=parseInt(this[D],16);return p>Number.MAX_SAFE_INTEGER?Infinity:p},k.decimalFloatingPoint=function(D){return parseFloat(this[D])},k.optionalFloat=function(D,p){var y=this[D];return y?parseFloat(y):p},k.enumeratedString=function(D){return this[D]},k.bool=function(D){return this[D]==="YES"},k.decimalResolution=function(D){var p=W.exec(this[D]);return p===null?void 0:{width:parseInt(p[1],10),height:parseInt(p[2],10)}},I.parseAttrList=function(D){var p,y={},R='"';for(M.lastIndex=0;(p=M.exec(D))!==null;){var S=p[2];S.indexOf(R)===0&&S.lastIndexOf(R)===S.length-1&&(S=S.slice(1,-1)),y[p[1]]=S}return y},I}()},"./src/utils/binary-search.ts":function($,K,A){"use strict";A.r(K);var W={search:function(P,I){for(var k=0,O=P.length-1,D=null,p=null;k<=O;){D=(k+O)/2|0,p=P[D];var y=I(p);if(y>0)k=D+1;else if(y<0)O=D-1;else return p}return null}};K.default=W},"./src/utils/buffer-helper.ts":function($,K,A){"use strict";A.r(K),A.d(K,"BufferHelper",function(){return P});var W=A("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function I(){}return I.isBuffered=function(O,D){try{if(O){for(var p=I.getBuffered(O),y=0;y<p.length;y++)if(D>=p.start(y)&&D<=p.end(y))return!0}}catch(R){}return!1},I.bufferInfo=function(O,D,p){try{if(O){var y=I.getBuffered(O),R=[],S;for(S=0;S<y.length;S++)R.push({start:y.start(S),end:y.end(S)});return this.bufferedInfo(R,D,p)}}catch(x){}return{len:0,start:D,end:D,nextStart:void 0}},I.bufferedInfo=function(O,D,p){D=Math.max(0,D),O.sort(function(h,L){var T=h.start-L.start;return T||L.end-h.end});var y=[];if(p)for(var R=0;R<O.length;R++){var S=y.length;if(S){var x=y[S-1].end;O[R].start-x<p?O[R].end>x&&(y[S-1].end=O[R].end):y.push(O[R])}else y.push(O[R])}else y=O;for(var b=0,d,a=D,l=D,s=0;s<y.length;s++){var C=y[s].start,g=y[s].end;if(D+p>=C&&D<g)a=C,l=g,b=l-D;else if(D+p<C){d=C;break}}return{len:b,start:a||0,end:l||0,nextStart:d}},I.getBuffered=function(O){try{return O.buffered}catch(D){return W.logger.log("failed to get media.buffered",D),M}},I}()},"./src/utils/cea-608-parser.ts":function($,K,A){"use strict";A.r(K),A.d(K,"Row",function(){return l}),A.d(K,"CaptionScreen",function(){return s});var W=A("./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(f){var u=f;return M.hasOwnProperty(f)&&(u=M[f]),String.fromCharCode(u)},I=15,k=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},p={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},y={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],S;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(S||(S={}));var x=function(){function m(){this.time=null,this.verboseLevel=S.ERROR}var f=m.prototype;return f.log=function(o,E){this.verboseLevel>=o&&W.logger.log(this.time+" ["+o+"] "+E)},m}(),b=function(f){for(var u=[],o=0;o<f.length;o++)u.push(f[o].toString(16));return u},d=function(){function m(u,o,E,v,c){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=o||!1,this.italics=E||!1,this.background=v||"black",this.flash=c||!1}var f=m.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(o){for(var E=["foreground","underline","italics","background","flash"],v=0;v<E.length;v++){var c=E[v];o.hasOwnProperty(c)&&(this[c]=o[c])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},f.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),a=function(){function m(u,o,E,v,c,_){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(o,E,v,c,_)}var f=m.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(o,E){this.uchar=o,this.penState.copy(E)},f.setPenState=function(o){this.penState.copy(o)},f.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},f.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),l=function(){function m(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<k;o++)this.chars.push(new a);this.logger=u,this.pos=0,this.currPenState=new d}var f=m.prototype;return f.equals=function(o){for(var E=!0,v=0;v<k;v++)if(!this.chars[v].equals(o.chars[v])){E=!1;break}return E},f.copy=function(o){for(var E=0;E<k;E++)this.chars[E].copy(o.chars[E])},f.isEmpty=function(){for(var o=!0,E=0;E<k;E++)if(!this.chars[E].isEmpty()){o=!1;break}return o},f.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(S.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(S.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},f.moveCursor=function(o){var E=this.pos+o;if(o>1)for(var v=this.pos+1;v<E+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(E)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(o){o>=144&&this.backSpace();var E=P(o);if(this.pos>=k){this.logger.log(S.ERROR,"Cannot insert "+o.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(o){var E;for(E=o;E<k;E++)this.chars[E].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var o=[],E=!0,v=0;v<k;v++){var c=this.chars[v].uchar;c!==" "&&(E=!1),o.push(c)}return E?"":o.join("")},f.setPenStyles=function(o){this.currPenState.setStyles(o);var E=this.chars[this.pos];E.setPenState(this.currPenState)},m}(),s=function(){function m(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<I;o++)this.rows.push(new l(u));this.logger=u,this.currRow=I-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=m.prototype;return f.reset=function(){for(var o=0;o<I;o++)this.rows[o].clear();this.currRow=I-1},f.equals=function(o){for(var E=!0,v=0;v<I;v++)if(!this.rows[v].equals(o.rows[v])){E=!1;break}return E},f.copy=function(o){for(var E=0;E<I;E++)this.rows[E].copy(o.rows[E])},f.isEmpty=function(){for(var o=!0,E=0;E<I;E++)if(!this.rows[E].isEmpty()){o=!1;break}return o},f.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},f.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},f.insertChar=function(o){var E=this.rows[this.currRow];E.insertChar(o)},f.setPen=function(o){var E=this.rows[this.currRow];E.setPenStyles(o)},f.moveCursor=function(o){var E=this.rows[this.currRow];E.moveCursor(o)},f.setCursor=function(o){this.logger.log(S.INFO,"setCursor: "+o);var E=this.rows[this.currRow];E.setCursor(o)},f.setPAC=function(o){this.logger.log(S.INFO,"pacData = "+JSON.stringify(o));var E=o.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var v=0;v<I;v++)this.rows[v].clear();var c=this.currRow+1-this.nrRollUpRows,_=this.lastOutputScreen;if(_){var U=_.rows[c].cueStartTime,B=this.logger.time;if(U&&B!==null&&U<B)for(var z=0;z<this.nrRollUpRows;z++)this.rows[E-this.nrRollUpRows+z+1].copy(_.rows[c+z])}}this.currRow=E;var j=this.rows[this.currRow];if(o.indent!==null){var F=o.indent,X=Math.max(F-1,0);j.setCursor(o.indent),o.color=j.chars[X].penState.foreground}var te={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(te)},f.setBkgData=function(o){this.logger.log(S.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},f.setRollUpRows=function(o){this.nrRollUpRows=o},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(S.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(S.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(o,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(S.INFO,"Rolling up")},f.getDisplayText=function(o){o=o||!1;for(var E=[],v="",c=-1,_=0;_<I;_++){var U=this.rows[_].getTextString();U&&(c=_+1,o?E.push("Row "+c+": '"+U+"'"):E.push(U.trim()))}return E.length>0&&(o?v="["+E.join(" | ")+"]":v=E.join(`
`)),v},f.getTextAndFormat=function(){return this.rows},m}(),C=function(){function m(u,o,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new s(E),this.nonDisplayedMemory=new s(E),this.lastOutputScreen=new s(E),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var f=m.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(o){this.outputFilter=o},f.setPAC=function(o){this.writeScreen.setPAC(o)},f.setBkgData=function(o){this.writeScreen.setBkgData(o)},f.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(S.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},f.insertChars=function(o){for(var E=0;E<o.length;E++)this.writeScreen.insertChar(o[E]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(S.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(S.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(S.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(S.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(S.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(o){this.logger.log(S.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},f.ccFON=function(){this.logger.log(S.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(S.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(S.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(S.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(S.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(S.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(S.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(S.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(S.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(o){this.logger.log(S.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},f.ccMIDROW=function(o){var E={flash:!1};if(E.underline=o%2===1,E.italics=o>=46,E.italics)E.foreground="white";else{var v=Math.floor(o/2)-16,c=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=c[v]}this.logger.log(S.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},f.outputDataUpdate=function(o){o===void 0&&(o=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},m}(),g=function(){function m(u,o,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new x;this.channels=[null,new C(u,o,v),new C(u+1,E,v)],this.cmdHistory=T(),this.logger=v}var f=m.prototype;return f.getHandler=function(o){return this.channels[o].getHandler()},f.setHandler=function(o,E){this.channels[o].setHandler(E)},f.addData=function(o,E){var v,c,_,U=!1;this.logger.time=o;for(var B=0;B<E.length;B+=2){if(c=E[B]&127,_=E[B+1]&127,c===0&&_===0)continue;if(this.logger.log(S.DATA,"["+b([E[B],E[B+1]])+"] -> ("+b([c,_])+")"),v=this.parseCmd(c,_),v||(v=this.parseMidrow(c,_)),v||(v=this.parsePAC(c,_)),v||(v=this.parseBackgroundAttributes(c,_)),!v&&(U=this.parseChars(c,_),U)){var z=this.currentChannel;if(z&&z>0){var j=this.channels[z];j.insertChars(U)}else this.logger.log(S.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!U&&this.logger.log(S.WARNING,"Couldn't parse cleaned data "+b([c,_])+" orig: "+b([E[B],E[B+1]]))}},f.parseCmd=function(o,E){var v=this.cmdHistory,c=(o===20||o===28||o===21||o===29)&&E>=32&&E<=47,_=(o===23||o===31)&&E>=33&&E<=35;if(!(c||_))return!1;if(L(o,E,v))return h(null,null,v),this.logger.log(S.DEBUG,"Repeated command ("+b([o,E])+") is dropped"),!0;var U=o===20||o===21||o===23?1:2,B=this.channels[U];return o===20||o===21||o===28||o===29?E===32?B.ccRCL():E===33?B.ccBS():E===34?B.ccAOF():E===35?B.ccAON():E===36?B.ccDER():E===37?B.ccRU(2):E===38?B.ccRU(3):E===39?B.ccRU(4):E===40?B.ccFON():E===41?B.ccRDC():E===42?B.ccTR():E===43?B.ccRTD():E===44?B.ccEDM():E===45?B.ccCR():E===46?B.ccENM():E===47&&B.ccEOC():B.ccTO(E-32),h(o,E,v),this.currentChannel=U,!0},f.parseMidrow=function(o,E){var v=0;if((o===17||o===25)&&E>=32&&E<=47){if(o===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(S.ERROR,"Mismatch channel in midrow parsing"),!1;var c=this.channels[v];return c?(c.ccMIDROW(E),this.logger.log(S.DEBUG,"MIDROW ("+b([o,E])+")"),!0):!1}return!1},f.parsePAC=function(o,E){var v,c=this.cmdHistory,_=(o>=17&&o<=23||o>=25&&o<=31)&&E>=64&&E<=127,U=(o===16||o===24)&&E>=64&&E<=95;if(!(_||U))return!1;if(L(o,E,c))return h(null,null,c),!0;var B=o<=23?1:2;E>=64&&E<=95?v=B===1?O[o]:p[o]:v=B===1?D[o]:y[o];var z=this.channels[B];return z?(z.setPAC(this.interpretPAC(v,E)),h(o,E,c),this.currentChannel=B,!0):!1},f.interpretPAC=function(o,E){var v,c={color:null,italics:!1,indent:null,underline:!1,row:o};return E>95?v=E-96:v=E-64,c.underline=(v&1)===1,v<=13?c.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(c.italics=!0,c.color="white"):c.indent=Math.floor((v-16)/2)*4,c},f.parseChars=function(o,E){var v,c=null,_=null;if(o>=25?(v=2,_=o-8):(v=1,_=o),_>=17&&_<=19){var U;_===17?U=E+80:_===18?U=E+112:U=E+144,this.logger.log(S.INFO,"Special char '"+P(U)+"' in channel "+v),c=[U]}else o>=32&&o<=127&&(c=E===0?[o]:[o,E]);if(c){var B=b(c);this.logger.log(S.DEBUG,"Char codes = "+B.join(",")),h(o,E,this.cmdHistory)}return c},f.parseBackgroundAttributes=function(o,E){var v=(o===16||o===24)&&E>=32&&E<=47,c=(o===23||o===31)&&E>=45&&E<=47;if(!(v||c))return!1;var _,U={};o===16||o===24?(_=Math.floor((E-32)/2),U.background=R[_],E%2===1&&(U.background=U.background+"_semi")):E===45?U.background="transparent":(U.foreground="black",E===47&&(U.underline=!0));var B=o<=23?1:2,z=this.channels[B];return z.setBkgData(U),h(o,E,this.cmdHistory),!0},f.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var E=this.channels[o];E&&E.reset()}this.cmdHistory=T()},f.cueSplitAtTime=function(o){for(var E=0;E<this.channels.length;E++){var v=this.channels[E];v&&v.cueSplitAtTime(o)}},m}();function h(m,f,u){u.a=m,u.b=f}function L(m,f,u){return u.a===m&&u.b===f}function T(){return{a:null,b:null}}K.default=g},"./src/utils/codecs.ts":function($,K,A){"use strict";A.r(K),A.d(K,"isCodecType",function(){return M}),A.d(K,"isCodecSupportedInMp4",function(){return P});var W={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(I,k){var O=W[k];return!!O&&O[I.slice(0,4)]===!0}function P(I,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+I+'"')}},"./src/utils/cues.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/utils/vttparser.ts"),M=A("./src/utils/webvtt-parser.ts"),P=A("./src/utils/texttrack-utils.ts"),I=/\s/,k={newCue:function(D,p,y,R){for(var S=[],x,b,d,a,l,s=self.VTTCue||self.TextTrackCue,C=0;C<R.rows.length;C++)if(x=R.rows[C],d=!0,a=0,l="",!x.isEmpty()){for(var g=0;g<x.chars.length;g++)I.test(x.chars[g].uchar)&&d?a++:(l+=x.chars[g].uchar,d=!1);x.cueStartTime=p,p===y&&(y+=1e-4),a>=16?a--:a++;var h=Object(W.fixLineBreaks)(l.trim()),L=Object(M.generateCueId)(p,y,h);(!D||!D.cues||!D.cues.getCueById(L))&&(b=new s(p,y,h),b.id=L,b.line=C+1,b.align="left",b.position=10+Math.min(80,Math.floor(a*8/32)*10),S.push(b))}return D&&S.length&&(S.sort(function(T,m){return T.line==="auto"||m.line==="auto"?0:T.line>8&&m.line>8?m.line-T.line:T.line-m.line}),S.forEach(function(T){return Object(P.addCueToTrack)(D,T)})),S}};K.default=k},"./src/utils/discontinuities.ts":function($,K,A){"use strict";A.r(K),A.d(K,"findFirstFragWithCC",function(){return I}),A.d(K,"shouldAlignOnDiscontinuities",function(){return k}),A.d(K,"findDiscontinuousReferenceFrag",function(){return O}),A.d(K,"adjustSlidingStart",function(){return p}),A.d(K,"alignStream",function(){return y}),A.d(K,"alignPDT",function(){return S}),A.d(K,"alignFragmentByPDTDelta",function(){return x}),A.d(K,"alignMediaPlaylistByPDT",function(){return b});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts"),P=A("./src/controller/level-helper.ts");function I(d,a){for(var l=null,s=0,C=d.length;s<C;s++){var g=d[s];if(g&&g.cc===a){l=g;break}}return l}function k(d,a,l){return!!(a.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function O(d,a){var l=d.fragments,s=a.fragments;if(!s.length||!l.length){M.logger.log("No fragments to align");return}var C=I(l,s[0].cc);if(!C||C&&!C.startPTS){M.logger.log("No frag in previous level to align on");return}return C}function D(d,a){if(d){var l=d.start+a;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function p(d,a){for(var l=a.fragments,s=0,C=l.length;s<C;s++)D(l[s],d);a.fragmentHint&&D(a.fragmentHint,d),a.alignedSliding=!0}function y(d,a,l){if(!a)return;R(d,l,a),!l.alignedSliding&&a.details&&S(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(P.adjustSliding)(a.details,l)}function R(d,a,l){if(k(d,l,a)){var s=O(l.details,a);s&&Object(W.isFiniteNumber)(s.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),p(s.start,a))}}function S(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,s=d.fragments[0].programDateTime,C=(s-l)/1e3+a.fragments[0].start;C&&Object(W.isFiniteNumber)(C)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(s-l)+"ms, sliding:"+C.toFixed(3)+" "+d.url+" "),p(C,d))}function x(d,a){var l=d.programDateTime;if(!l)return;var s=(l-a)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function b(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,s=a.fragments[0].start,C=l-s*1e3;d.fragments.forEach(function(g){x(g,C)}),d.fragmentHint&&x(d.fragmentHint,C),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/utils/ewma.ts"),M=function(){function P(k,O,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(k),this.fast_=new W.default(O)}var I=P.prototype;return I.update=function(O,D){var p=this.slow_,y=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new W.default(O,p.getEstimate(),p.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new W.default(D,y.getEstimate(),y.getTotalWeight()))},I.sample=function(O,D){O=Math.max(O,this.minDelayMs_);var p=8*D,y=O/1e3,R=p/y;this.fast_.sample(y,R),this.slow_.sample(y,R)},I.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},I.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},I.destroy=function(){},P}();K.default=M},"./src/utils/ewma.ts":function($,K,A){"use strict";A.r(K);var W=function(){function M(I,k,O){k===void 0&&(k=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=I,this.alpha_=I?Math.exp(Math.log(.5)/I):0,this.estimate_=k,this.totalWeight_=O}var P=M.prototype;return P.sample=function(k,O){var D=Math.pow(this.alpha_,k);this.estimate_=O*(1-D)+D*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}();K.default=W},"./src/utils/fetch-loader.ts":function($,K,A){"use strict";A.r(K),A.d(K,"fetchSupported",function(){return x});var W=A("./src/polyfills/number.ts"),M=A("./src/loader/load-stats.ts"),P=A("./src/demux/chunk-cache.ts");function I(s,C){s.prototype=Object.create(C.prototype),s.prototype.constructor=s,y(s,C)}function k(s){var C=typeof Map=="function"?new Map:void 0;return k=function(h){if(h===null||!p(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(h))return C.get(h);C.set(h,L)}function L(){return O(h,arguments,R(this).constructor)}return L.prototype=Object.create(h.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),y(L,h)},k(s)}function O(s,C,g){return D()?O=Reflect.construct:O=function(L,T,m){var f=[null];f.push.apply(f,T);var u=Function.bind.apply(L,f),o=new u;return m&&y(o,m.prototype),o},O.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function p(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function y(s,C){return y=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},y(s,C)}function R(s){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},R(s)}function S(){return S=Object.assign||function(s){for(var C=1;C<arguments.length;C++){var g=arguments[C];for(var h in g)Object.prototype.hasOwnProperty.call(g,h)&&(s[h]=g[h])}return s},S.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var b=function(){function s(g){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=g.fetchSetup||a,this.controller=new self.AbortController,this.stats=new M.LoadStats}var C=s.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(h,L,T){var m=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var u=d(h,this.controller.signal),o=T.onProgress,E=h.responseType==="arraybuffer",v=E?"byteLength":"length";this.context=h,this.config=L,this.callbacks=T,this.request=this.fetchSetup(h,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),T.onTimeout(f,h,m.response)},L.timeout),self.fetch(this.request).then(function(c){if(m.response=m.loader=c,!c.ok){var _=c.status,U=c.statusText;throw new l(U||"fetch, bad network response",_,c)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(c.headers.get("Content-Length")||"0"),o&&Object(W.isFiniteNumber)(L.highWaterMark)?m.loadProgressively(c,f,h,L.highWaterMark,o):E?c.arrayBuffer():c.text()}).then(function(c){var _=m.response;self.clearTimeout(m.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=c[v];var U={url:_.url,data:c};o&&!Object(W.isFiniteNumber)(L.highWaterMark)&&o(f,h,c,_),T.onSuccess(U,f,h,_)}).catch(function(c){if(self.clearTimeout(m.requestTimeout),f.aborted)return;var _=c.code||0;T.onError({code:_,text:c.message},h,c.details)})},C.getCacheAge=function(){var h=null;if(this.response){var L=this.response.headers.get("age");h=L?parseFloat(L):null}return h},C.loadProgressively=function(h,L,T,m,f){m===void 0&&(m=0);var u=new P.default,o=h.body.getReader(),E=function v(){return o.read().then(function(c){if(c.done)return u.dataLength&&f(L,T,u.flush(),h),Promise.resolve(new ArrayBuffer(0));var _=c.value,U=_.length;return L.loaded+=U,U<m||u.dataLength?(u.push(_),u.dataLength>=m&&f(L,T,u.flush(),h)):f(L,T,_,h),v()}).catch(function(){return Promise.reject()})};return E()},s}();function d(s,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(S({},s.headers))};return s.rangeEnd&&g.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),g}function a(s,C){return new self.Request(s.url,C)}var l=function(s){I(C,s);function C(g,h,L){var T;return T=s.call(this,g)||this,T.code=void 0,T.details=void 0,T.code=h,T.details=L,T}return C}(k(Error));K.default=b},"./src/utils/imsc1-ttml-parser.ts":function($,K,A){"use strict";A.r(K),A.d(K,"IMSC1_CODEC",function(){return p}),A.d(K,"parseIMSC1",function(){return x});var W=A("./src/utils/mp4-tools.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/utils/vttcue.ts"),I=A("./src/demux/id3.ts"),k=A("./src/utils/timescale-conversion.ts"),O=A("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(m){for(var f=1;f<arguments.length;f++){var u=arguments[f];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(m[o]=u[o])}return m},D.apply(this,arguments)}var p="stpp.ttml.im1t",y=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,S={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(m,f,u,o,E){var v=Object(W.findBox)(new Uint8Array(m),["mdat"]);if(v.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var c=v[0],_=Object(I.utf8ArrayToStr)(new Uint8Array(m,c.start,c.end-c.start)),U=Object(k.toTimescaleFromScale)(f,1,u);try{o(b(_,U))}catch(B){E(B)}}function b(m,f){var u=new DOMParser,o=u.parseFromString(m,"text/xml"),E=o.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},c=Object.keys(v).reduce(function(j,F){return j[F]=E.getAttribute("ttp:"+F)||v[F],j},{}),_=E.getAttribute("xml:space")!=="preserve",U=a(d(E,"styling","style")),B=a(d(E,"layout","region")),z=d(E,"body","[begin]");return[].map.call(z,function(j){var F=l(j,_);if(!F||!j.hasAttribute("begin"))return null;var X=h(j.getAttribute("begin"),c),te=h(j.getAttribute("dur"),c),ae=h(j.getAttribute("end"),c);if(X===null)throw g(j);if(ae===null){if(te===null)throw g(j);ae=X+te}var ce=new P.default(X-f,ae-f,F);ce.id=Object(O.generateCueId)(ce.startTime,ce.endTime,ce.text);var Te=B[j.getAttribute("region")],ge=U[j.getAttribute("style")];ce.position=10,ce.size=80;var he=s(Te,ge),ee=he.textAlign;if(ee){var re=S[ee];re&&(ce.lineAlign=re),ce.align=ee}return D(ce,he),ce}).filter(function(j){return j!==null})}function d(m,f,u){var o=m.getElementsByTagName(f)[0];return o?[].slice.call(o.querySelectorAll(u)):[]}function a(m){return m.reduce(function(f,u){var o=u.getAttribute("xml:id");return o&&(f[o]=u),f},{})}function l(m,f){return[].slice.call(m.childNodes).reduce(function(u,o,E){var v;return o.nodeName==="br"&&E?u+`
`:(v=o.childNodes)!==null&&v!==void 0&&v.length?l(o,f):f?u+o.textContent.trim().replace(/\s+/g," "):u+o.textContent},"")}function s(m,f){var u="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(E,v){var c=C(f,u,v)||C(m,u,v);return c&&(E[v]=c),E},{})}function C(m,f,u){return m.hasAttributeNS(f,u)?m.getAttributeNS(f,u):null}function g(m){return new Error("Could not parse ttml timestamp "+m)}function h(m,f){if(!m)return null;var u=Object(M.parseTimeStamp)(m);return u===null&&(y.test(m)?u=L(m,f):R.test(m)&&(u=T(m,f))),u}function L(m,f){var u=y.exec(m),o=(u[4]|0)+(u[5]|0)/f.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+o/f.frameRate}function T(m,f){var u=R.exec(m),o=Number(u[1]),E=u[2];switch(E){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/f.frameRate;case"t":return o/f.tickRate}return o}},"./src/utils/logger.ts":function($,K,A){"use strict";A.r(K),A.d(K,"enableLogs",function(){return O}),A.d(K,"logger",function(){return D});var W=function(){},M={trace:W,debug:W,log:W,warn:W,info:W,error:W},P=M;function I(p){var y=self.console[p];return y?y.bind(self.console,"["+p+"] >"):W}function k(p){for(var y=arguments.length,R=new Array(y>1?y-1:0),S=1;S<y;S++)R[S-1]=arguments[S];R.forEach(function(x){P[x]=p[x]?p[x].bind(p):I(x)})}function O(p){if(self.console&&p===!0||typeof p=="object"){k(p,"debug","log","info","warn","error");try{P.log()}catch(y){P=M}}else P=M}var D=P},"./src/utils/mediakeys-helper.ts":function($,K,A){"use strict";A.r(K),A.d(K,"KeySystems",function(){return W}),A.d(K,"requestMediaKeySystemAccess",function(){return M});var W;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(W||(W={}));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($,K,A){"use strict";A.r(K),A.d(K,"getMediaSource",function(){return W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function($,K,A){"use strict";A.r(K),A.d(K,"bin2str",function(){return k}),A.d(K,"readUint16",function(){return O}),A.d(K,"readUint32",function(){return D}),A.d(K,"writeUint32",function(){return p}),A.d(K,"findBox",function(){return y}),A.d(K,"parseSegmentIndex",function(){return R}),A.d(K,"parseInitSegment",function(){return S}),A.d(K,"getStartDTS",function(){return x}),A.d(K,"getDuration",function(){return b}),A.d(K,"computeRawDurationFromSamples",function(){return d}),A.d(K,"offsetStartDTS",function(){return a}),A.d(K,"segmentValidRange",function(){return l}),A.d(K,"appendUint8Array",function(){return s});var W=A("./src/utils/typed-array.ts"),M=A("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,I=[].push;function k(C){return String.fromCharCode.apply(null,C)}function O(C,g){"data"in C&&(g+=C.start,C=C.data);var h=C[g]<<8|C[g+1];return h<0?65536+h:h}function D(C,g){"data"in C&&(g+=C.start,C=C.data);var h=C[g]<<24|C[g+1]<<16|C[g+2]<<8|C[g+3];return h<0?4294967296+h:h}function p(C,g,h){"data"in C&&(g+=C.start,C=C.data),C[g]=h>>24,C[g+1]=h>>16&255,C[g+2]=h>>8&255,C[g+3]=h&255}function y(C,g){var h=[];if(!g.length)return h;var L,T,m;"data"in C?(L=C.data,T=C.start,m=C.end):(L=C,T=0,m=L.byteLength);for(var f=T;f<m;){var u=D(L,f),o=k(L.subarray(f+4,f+8)),E=u>1?f+u:m;if(o===g[0])if(g.length===1)h.push({data:L,start:f+8,end:E});else{var v=y({data:L,start:f+8,end:E},g.slice(1));v.length&&I.apply(h,v)}f=E}return h}function R(C){var g=y(C,["moov"]),h=g[0],L=h?h.end:null,T=y(C,["sidx"]);if(!T||!T[0])return null;var m=[],f=T[0],u=f.data[0],o=u===0?8:16,E=D(f,o);o+=4;var v=0,c=0;u===0?o+=8:o+=16,o+=2;var _=f.end+c,U=O(f,o);o+=2;for(var B=0;B<U;B++){var z=o,j=D(f,z);z+=4;var F=j&2147483647,X=(j&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var te=D(f,z);z+=4,m.push({referenceSize:F,subsegmentDuration:te,info:{duration:te/E,start:_,end:_+F-1}}),_+=F,z+=4,o=z}return{earliestPresentationTime:v,timescale:E,version:u,referencesCount:U,references:m,moovEndOffset:L}}function S(C){for(var g=[],h=y(C,["moov","trak"]),L=0;L<h.length;L++){var T=h[L],m=y(T,["tkhd"])[0];if(m){var f=m.data[m.start],u=f===0?12:20,o=D(m,u),E=y(T,["mdia","mdhd"])[0];if(E){f=E.data[E.start],u=f===0?12:20;var v=D(E,u),c=y(T,["mdia","hdlr"])[0];if(c){var _=k(c.data.subarray(c.start+8,c.start+12)),U={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[_];if(U){var B=y(T,["mdia","minf","stbl","stsd"])[0],z=void 0;B&&(z=k(B.data.subarray(B.start+12,B.start+16))),g[o]={timescale:v,type:U},g[U]={timescale:v,id:o,codec:z}}}}}}var j=y(C,["moov","mvex","trex"]);return j.forEach(function(F){var X=D(F,4),te=g[X];te&&(te.default={duration:D(F,12),flags:D(F,20)})}),g}function x(C,g){return y(g,["moof","traf"]).reduce(function(h,L){var T=y(L,["tfdt"])[0],m=T.data[T.start],f=y(L,["tfhd"]).reduce(function(u,o){var E=D(o,4),v=C[E];if(v){var c=D(T,4);m===1&&(c*=Math.pow(2,32),c+=D(T,8));var _=v.timescale||9e4,U=c/_;if(isFinite(U)&&(u===null||U<u))return U}return u},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function b(C,g){for(var h=0,L=0,T=0,m=y(C,["moof","traf"]),f=0;f<m.length;f++){var u=m[f],o=y(u,["tfhd"])[0],E=D(o,4),v=g[E];if(!v)continue;var c=v.default,_=D(o,0)|(c==null?void 0:c.flags),U=c==null?void 0:c.duration;_&8&&(_&2?U=D(o,12):U=D(o,8));for(var B=v.timescale||9e4,z=y(u,["trun"]),j=0;j<z.length;j++){if(U){var F=D(z[j],4);h=U*F}else h=d(z[j]);v.type===M.ElementaryStreamTypes.VIDEO?L+=h/B:v.type===M.ElementaryStreamTypes.AUDIO&&(T+=h/B)}}if(L===0&&T===0){var X=R(C);if(X!=null&&X.references)return X.references.reduce(function(te,ae){return te+ae.info.duration||0},0)}return L||T}function d(C){var g=D(C,0),h=8;g&1&&(h+=4),g&4&&(h+=4);for(var L=0,T=D(C,4),m=0;m<T;m++){if(g&256){var f=D(C,h);L+=f,h+=4}g&512&&(h+=4),g&1024&&(h+=4),g&2048&&(h+=4)}return L}function a(C,g,h){y(g,["moof","traf"]).forEach(function(L){y(L,["tfhd"]).forEach(function(T){var m=D(T,4),f=C[m];if(!f)return;var u=f.timescale||9e4;y(L,["tfdt"]).forEach(function(o){var E=o.data[o.start],v=D(o,4);if(E===0)p(o,4,v-h*u);else{v*=Math.pow(2,32),v+=D(o,8),v-=h*u,v=Math.max(v,0);var c=Math.floor(v/(P+1)),_=Math.floor(v%(P+1));p(o,4,c),p(o,8,_)}})})})}function l(C){var g={valid:null,remainder:null},h=y(C,["moof"]);if(h){if(h.length<2)return g.remainder=C,g}else return g;var L=h[h.length-1];return g.valid=Object(W.sliceUint8)(C,0,L.start-8),g.remainder=Object(W.sliceUint8)(C,L.start-8),g}function s(C,g){var h=new Uint8Array(C.length+g.length);return h.set(C),h.set(g,C.length),h}},"./src/utils/output-filter.ts":function($,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(I,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=I,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,O,D){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=O,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function($,K,A){"use strict";A.r(K),A.d(K,"sendAddTrackEvent",function(){return M}),A.d(K,"addCueToTrack",function(){return P}),A.d(K,"clearCurrentCues",function(){return I}),A.d(K,"removeCuesInRange",function(){return k}),A.d(K,"getCuesInRange",function(){return D});var W=A("./src/utils/logger.ts");function M(p,y){var R;try{R=new Event("addtrack")}catch(S){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=p,y.dispatchEvent(R)}function P(p,y){var R=p.mode;if(R==="disabled"&&(p.mode="hidden"),p.cues&&!p.cues.getCueById(y.id))try{if(p.addCue(y),!p.cues.getCueById(y.id))throw new Error("addCue is failed for: "+y)}catch(x){W.logger.debug("[texttrack-utils]: "+x);var S=new self.TextTrackCue(y.startTime,y.endTime,y.text);S.id=y.id,p.addCue(S)}R==="disabled"&&(p.mode=R)}function I(p){var y=p.mode;if(y==="disabled"&&(p.mode="hidden"),p.cues)for(var R=p.cues.length;R--;)p.removeCue(p.cues[R]);y==="disabled"&&(p.mode=y)}function k(p,y,R){var S=p.mode;if(S==="disabled"&&(p.mode="hidden"),p.cues&&p.cues.length>0)for(var x=D(p.cues,y,R),b=0;b<x.length;b++)p.removeCue(x[b]);S==="disabled"&&(p.mode=S)}function O(p,y){if(y<p[0].startTime)return 0;var R=p.length-1;if(y>p[R].endTime)return-1;for(var S=0,x=R;S<=x;){var b=Math.floor((x+S)/2);if(y<p[b].startTime)x=b-1;else if(y>p[b].startTime&&S<R)S=b+1;else return b}return p[S].startTime-y<y-p[x].startTime?S:x}function D(p,y,R){var S=[],x=O(p,y);if(x>-1)for(var b=x,d=p.length;b<d;b++){var a=p[b];if(a.startTime>=y&&a.endTime<=R)S.push(a);else if(a.startTime>R)return S}return S}},"./src/utils/time-ranges.ts":function($,K,A){"use strict";A.r(K);var W={toString:function(P){for(var I="",k=P.length,O=0;O<k;O++)I+="["+P.start(O).toFixed(3)+","+P.end(O).toFixed(3)+"]";return I}};K.default=W},"./src/utils/timescale-conversion.ts":function($,K,A){"use strict";A.r(K),A.d(K,"toTimescaleFromBase",function(){return M}),A.d(K,"toTimescaleFromScale",function(){return P}),A.d(K,"toMsFromMpegTsClock",function(){return I}),A.d(K,"toMpegTsClockFromTimescale",function(){return k});var W=9e4;function M(O,D,p,y){p===void 0&&(p=1),y===void 0&&(y=!1);var R=O*D*p;return y?Math.round(R):R}function P(O,D,p,y){return p===void 0&&(p=1),y===void 0&&(y=!1),M(O,D,1/p,y)}function I(O,D){return D===void 0&&(D=!1),M(O,1e3,1/W,D)}function k(O,D){return D===void 0&&(D=1),M(O,W,1/D)}},"./src/utils/typed-array.ts":function($,K,A){"use strict";A.r(K),A.d(K,"sliceUint8",function(){return W});function W(M,P,I){return Uint8Array.prototype.slice?M.slice(P,I):new Uint8Array(Array.prototype.slice.call(M,P,I))}},"./src/utils/vttcue.ts":function($,K,A){"use strict";A.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],M=["start","middle","end","left","right"];function P(p,y){if(typeof y!="string")return!1;if(!Array.isArray(p))return!1;var R=y.toLowerCase();return~p.indexOf(R)?R:!1}function I(p){return P(W,p)}function k(p){return P(M,p)}function O(p){for(var y=arguments.length,R=new Array(y>1?y-1:0),S=1;S<y;S++)R[S-1]=arguments[S];for(var x=1;x<arguments.length;x++){var b=arguments[x];for(var d in b)p[d]=b[d]}return p}function D(p,y,R){var S=this,x={enumerable:!0};S.hasBeenReset=!1;var b="",d=!1,a=p,l=y,s=R,C=null,g="",h=!0,L="auto",T="start",m=50,f="middle",u=50,o="middle";Object.defineProperty(S,"id",O({},x,{get:function(){return b},set:function(v){b=""+v}})),Object.defineProperty(S,"pauseOnExit",O({},x,{get:function(){return d},set:function(v){d=!!v}})),Object.defineProperty(S,"startTime",O({},x,{get:function(){return a},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");a=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"endTime",O({},x,{get:function(){return l},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");l=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"text",O({},x,{get:function(){return s},set:function(v){s=""+v,this.hasBeenReset=!0}})),Object.defineProperty(S,"region",O({},x,{get:function(){return C},set:function(v){C=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"vertical",O({},x,{get:function(){return g},set:function(v){var c=I(v);if(c===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=c,this.hasBeenReset=!0}})),Object.defineProperty(S,"snapToLines",O({},x,{get:function(){return h},set:function(v){h=!!v,this.hasBeenReset=!0}})),Object.defineProperty(S,"line",O({},x,{get:function(){return L},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"lineAlign",O({},x,{get:function(){return T},set:function(v){var c=k(v);if(!c)throw new SyntaxError("An invalid or illegal string was specified.");T=c,this.hasBeenReset=!0}})),Object.defineProperty(S,"position",O({},x,{get:function(){return m},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");m=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"positionAlign",O({},x,{get:function(){return f},set:function(v){var c=k(v);if(!c)throw new SyntaxError("An invalid or illegal string was specified.");f=c,this.hasBeenReset=!0}})),Object.defineProperty(S,"size",O({},x,{get:function(){return u},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");u=v,this.hasBeenReset=!0}})),Object.defineProperty(S,"align",O({},x,{get:function(){return o},set:function(v){var c=k(v);if(!c)throw new SyntaxError("An invalid or illegal string was specified.");o=c,this.hasBeenReset=!0}})),S.displayState=void 0}return D.prototype.getCueAsHTML=function(){var p=self.WebVTT;return p.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function($,K,A){"use strict";A.r(K),A.d(K,"parseTimeStamp",function(){return P}),A.d(K,"fixLineBreaks",function(){return y}),A.d(K,"VTTParser",function(){return R});var W=A("./src/utils/vttcue.ts"),M=function(){function S(){}var x=S.prototype;return x.decode=function(d,a){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},S}();function P(S){function x(d,a,l,s){return(d|0)*3600+(a|0)*60+(l|0)+parseFloat(s||0)}var b=S.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?x(b[2],b[3],0,b[4]):x(b[1],b[2],b[3],b[4]):null}var I=function(){function S(){this.values=Object.create(null)}var x=S.prototype;return x.set=function(d,a){!this.get(d)&&a!==""&&(this.values[d]=a)},x.get=function(d,a,l){return l?this.has(d)?this.values[d]:a[l]:this.has(d)?this.values[d]:a},x.has=function(d){return d in this.values},x.alt=function(d,a,l){for(var s=0;s<l.length;++s)if(a===l[s]){this.set(d,a);break}},x.integer=function(d,a){/^-?\d+$/.test(a)&&this.set(d,parseInt(a,10))},x.percent=function(d,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},S}();function k(S,x,b,d){var a=d?S.split(d):[S];for(var l in a){if(typeof a[l]!="string")continue;var s=a[l].split(b);if(s.length!==2)continue;var C=s[0],g=s[1];x(C,g)}}var O=new W.default(0,0,""),D=O.align==="middle"?"middle":"center";function p(S,x,b){var d=S;function a(){var C=P(S);if(C===null)throw new Error("Malformed timestamp: "+d);return S=S.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,g){var h=new I;k(C,function(m,f){var u;switch(m){case"region":for(var o=b.length-1;o>=0;o--)if(b[o].id===f){h.set(m,b[o].region);break}break;case"vertical":h.alt(m,f,["rl","lr"]);break;case"line":u=f.split(","),h.integer(m,u[0]),h.percent(m,u[0])&&h.set("snapToLines",!1),h.alt(m,u[0],["auto"]),u.length===2&&h.alt("lineAlign",u[1],["start",D,"end"]);break;case"position":u=f.split(","),h.percent(m,u[0]),u.length===2&&h.alt("positionAlign",u[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":h.percent(m,f);break;case"align":h.alt(m,f,["start",D,"end","left","right"]);break}},/:/,/\s/),g.region=h.get("region",null),g.vertical=h.get("vertical","");var L=h.get("line","auto");L==="auto"&&O.line===-1&&(L=-1),g.line=L,g.lineAlign=h.get("lineAlign","start"),g.snapToLines=h.get("snapToLines",!0),g.size=h.get("size",100),g.align=h.get("align",D);var T=h.get("position","auto");T==="auto"&&O.position===50&&(T=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=T}function s(){S=S.replace(/^\s+/,"")}if(s(),x.startTime=a(),s(),S.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);S=S.substr(3),s(),x.endTime=a(),s(),l(S,x)}function y(S){return S.replace(/<br(?: \/)?>/gi,`
`)}var R=function(){function S(){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 x=S.prototype;return x.parse=function(d){var a=this;d&&(a.buffer+=a.decoder.decode(d,{stream:!0}));function l(){var T=a.buffer,m=0;for(T=y(T);m<T.length&&T[m]!=="\r"&&T[m]!==`
`;)++m;var f=T.substr(0,m);return T[m]==="\r"&&++m,T[m]===`
`&&++m,a.buffer=T.substr(m),f}function s(T){k(T,function(m,f){},/:/)}try{var C="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;C=l();var g=C.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var h=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;h?h=!1:C=l();switch(a.state){case"HEADER":/:/.test(C)?s(C):C||(a.state="ID");continue;case"NOTE":C||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){a.state="NOTE";break}if(!C)continue;if(a.cue=new W.default(0,0,""),a.state="CUE",C.indexOf("-->")===-1){a.cue.id=C;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{p(C,a.cue,a.regionList)}catch(T){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var L=C.indexOf("-->")!==-1;if(!C||L&&(h=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=C}continue;case"BADCUE":C||(a.state="ID")}}}catch(T){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){d.onparsingerror&&d.onparsingerror(a)}return d.onflush&&d.onflush(),this},S}()},"./src/utils/webvtt-parser.ts":function($,K,A){"use strict";A.r(K),A.d(K,"generateCueId",function(){return R}),A.d(K,"parseWebVTT",function(){return x});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/demux/id3.ts"),I=A("./src/utils/timescale-conversion.ts"),k=A("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,D=function(d,a,l){return l===void 0&&(l=0),d.substr(l,a.length)===a},p=function(d){var a=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),C=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(a)||!Object(W.isFiniteNumber)(l)||!Object(W.isFiniteNumber)(s)||!Object(W.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return a+=1e3*l,a+=60*1e3*s,a+=60*60*1e3*C,a},y=function(d){for(var a=5381,l=d.length;l;)a=a*33^d.charCodeAt(--l);return(a>>>0).toString()};function R(b,d,a){return y(b.toString())+y(d.toString())+y(a)}var S=function(d,a,l){var s=d[a],C=d[s.prevCC];if(!C||!C.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;d.ccOffset+=s.start-C.start,s.new=!1,s=C,C=d[s.prevCC]}d.presentationOffset=l};function x(b,d,a,l,s,C,g,h){var L=new M.VTTParser,T=Object(P.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(O,`
`).split(`
`),m=[],f=Object(I.toMpegTsClockFromTimescale)(d,a),u="00:00.000",o=0,E=0,v,c=!0,_=!1;L.oncue=function(U){var B=l[s],z=l.ccOffset,j=(o-f)/9e4;if(B!=null&&B.new&&(E!==void 0?z=l.ccOffset=B.start:S(l,s,j)),j&&(z=j-l.presentationOffset),_){var F=U.endTime-U.startTime,X=Object(k.normalizePts)((U.startTime+z-E)*9e4,C*9e4)/9e4;U.startTime=X,U.endTime=X+F}var te=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(te)),U.id||(U.id=R(U.startTime,U.endTime,te)),U.endTime>0&&m.push(U)},L.onparsingerror=function(U){v=U},L.onflush=function(){if(v){h(v);return}g(m)},T.forEach(function(U){if(c)if(D(U,"X-TIMESTAMP-MAP=")){c=!1,_=!0,U.substr(16).split(",").forEach(function(B){D(B,"LOCAL:")?u=B.substr(6):D(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{E=p(u)/1e3}catch(B){_=!1,v=B}return}else U===""&&(c=!1);L.parse(U+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function($,K,A){"use strict";A.r(K);var W=A("./src/utils/logger.ts"),M=A("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,I=function(){function k(D){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=D?D.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var O=k.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var p=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),p&&(p.onreadystatechange=null,p.onprogress=null,p.readyState!==4&&(this.stats.aborted=!0,p.abort()))},O.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(p,y,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=p,this.config=y,this.callbacks=R,this.retryDelay=y.retryDelay,this.loadInternal()},O.loadInternal=function(){var p=this.config,y=this.context;if(!p)return;var R=this.loader=new self.XMLHttpRequest,S=this.stats;S.loading.first=0,S.loaded=0;var x=this.xhrSetup;try{if(x)try{x(R,y.url)}catch(a){R.open("GET",y.url,!0),x(R,y.url)}R.readyState||R.open("GET",y.url,!0);var b=this.context.headers;if(b)for(var d in b)R.setRequestHeader(d,b[d])}catch(a){this.callbacks.onError({code:R.status,text:a.message},y,R);return}y.rangeEnd&&R.setRequestHeader("Range","bytes="+y.rangeStart+"-"+(y.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=y.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout),R.send()},O.readystatechange=function(){var p=this.context,y=this.loader,R=this.stats;if(!p||!y)return;var S=y.readyState,x=this.config;if(R.aborted)return;if(S>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),S===4){y.onreadystatechange=null,y.onprogress=null;var b=y.status;if(b>=200&&b<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var d,a;if(p.responseType==="arraybuffer"?(d=y.response,a=d.byteLength):(d=y.responseText,a=d.length),R.loaded=R.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(R,p,d,y),!this.callbacks)return;var s={url:y.responseURL,data:d};this.callbacks.onSuccess(s,R,p,y)}else R.retry>=x.maxRetry||b>=400&&b<499?(W.logger.error(b+" while loading "+p.url),this.callbacks.onError({code:b,text:y.statusText},p,y)):(W.logger.warn(b+" while loading "+p.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,x.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},O.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var p=this.callbacks;p&&(this.abortInternal(),p.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(p){var y=this.stats;y.loaded=p.loaded,p.lengthComputable&&(y.total=p.total)},O.getCacheAge=function(){var p=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var y=this.loader.getResponseHeader("age");p=y?parseFloat(y):null}return p},k}();K.default=I}}).default})},vHTk:function(rt,Qe,J){rt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(rt,Qe){function J(){this.buffer=new Array,this.length=0}J.prototype={get:function($){var K=Math.floor($/8);return(this.buffer[K]>>>7-$%8&1)==1},put:function($,K){for(var A=0;A<K;A++)this.putBit(($>>>K-A-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function($){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),$&&(this.buffer[K]|=128>>>this.length%8),this.length++}},rt.exports=J}}]);