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__Messages__Detail.0873dbb...

139 lines
739 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[159,5,7],{"+NIl":function(mt,et,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";te.defineMode("stex",function(G,A){"use strict";function W(C,y){C.cmdState.push(y)}function M(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var y=C.cmdState.pop();y&&y.closeBracket()}function N(C){for(var y=C.cmdState,g=y.length-1;g>=0;g--){var u=y[g];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function k(C,y,g){return function(){this.name=C,this.bracketNo=0,this.style=y,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var D={};D.importmodule=k("importmodule","tag",["string","builtin"]),D.documentclass=k("documentclass","tag",["","atom"]),D.usepackage=k("usepackage","tag",["atom"]),D.begin=k("begin","tag",["atom"]),D.end=k("end","tag",["atom"]),D.label=k("label","tag",["atom"]),D.ref=k("ref","tag",["atom"]),D.eqref=k("eqref","tag",["atom"]),D.cite=k("cite","tag",["atom"]),D.bibitem=k("bibitem","tag",["atom"]),D.Bibitem=k("Bibitem","tag",["atom"]),D.RBibitem=k("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(C,y){C.f=y}function E(C,y){var g;if(C.match(/^\\[a-zA-Z@]+/)){var u=C.current().slice(1);return g=D.hasOwnProperty(u)?D[u]:D.DEFAULT,g=new g,W(y,g),O(y,_),g.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return O(y,function(l,d){return T(l,d,"\\]")}),"keyword";if(C.match("\\("))return O(y,function(l,d){return T(l,d,"\\)")}),"keyword";if(C.match("$$"))return O(y,function(l,d){return T(l,d,"$$")}),"keyword";if(C.match("$"))return O(y,function(l,d){return T(l,d,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(g=M(y),g)g.closeBracket(o),O(y,_);else return"error";return"bracket"}else return o=="{"||o=="["?(g=D.DEFAULT,g=new g,W(y,g),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),g=N(y),g.name=="begin"&&(g.argument=C.current()),g.styleIdentifier())}function T(C,y,g){if(C.eatSpace())return null;if(g&&C.match(g))return O(y,E),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=C.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(C.skipToEnd(),"comment"):"error"}function _(C,y){var g=C.peek(),u;return g=="{"||g=="["?(u=M(y),u.openBracket(g),C.eat(g),O(y,E),"bracket"):/[ \t\r]/.test(g)?(C.eat(g),null):(O(y,E),R(y),E(C,y))}return{startState:function(){var C=A.inMathMode?function(y,g){return T(y,g)}:E;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,y){return y.f(C,y)},blankLine:function(C){C.f=E,C.cmdState.length=0},lineComment:"%"}}),te.defineMIME("text/x-stex","stex"),te.defineMIME("text/x-latex","stex")})},"19Vz":function(mt,et,Q){(function(te){te(Q("VrN/"))})(function(te){te.defineOption("placeholder","",function(k,D,O){var E=O&&O!=te.Init;if(D&&!E)k.on("blur",M),k.on("change",R),k.on("swapDoc",R),te.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){W(k)}),R(k);else if(!D&&E){k.off("blur",M),k.off("change",R),k.off("swapDoc",R),te.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),G(k);var T=k.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}D&&!k.hasFocus()&&M(k)});function G(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function A(k){G(k);var D=k.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=k.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var O=k.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),D.appendChild(O),k.display.lineSpace.insertBefore(D,k.display.lineSpace.firstChild)}function W(k){setTimeout(function(){var D=!1,O=k.getInputField();O.nodeName=="TEXTAREA"?D=!O.value:k.lineCount()==1&&(D=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),D?A(k):G(k)},20)}function M(k){N(k)&&A(k)}function R(k){var D=k.getWrapperElement(),O=N(k);D.className=D.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?A(k):G(k)}function N(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(mt,et,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};te.defineMode("xml",function(W,M){var R=W.indentUnit,N={},k=M.htmlMode?G:A;for(var D in k)N[D]=k[D];for(var D in M)N[D]=M[D];var O,E;function T(a,v){function p(F){return v.tokenize=F,F(a,v)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(y("atom","]]>")):null:a.match("--")?p(y("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(g(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=y("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",v.tokenize=_,"tag bracket");if(b=="&"){var P;return a.eat("#")?a.eat("x")?P=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):P=a.eatWhile(/[\d]/)&&a.eat(";"):P=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),P?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function _(a,v){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return v.tokenize=T,O=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return O="equals",null;if(p=="<"){v.tokenize=T,v.state=d,v.tagName=v.tagStart=null;var b=v.tokenize(a,v);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(p)?(v.tokenize=C(p),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(p,b){for(;!p.eol();)if(p.next()==a){b.tokenize=_;break}return"string"};return v.isInAttribute=!0,v}function y(a,v){return function(p,b){for(;!p.eol();){if(p.match(v)){b.tokenize=T;break}p.next()}return a}}function g(a){return function(v,p){for(var b;(b=v.next())!=null;){if(b=="<")return p.tokenize=g(a+1),p.tokenize(v,p);if(b==">")if(a==1){p.tokenize=T;break}else return p.tokenize=g(a-1),p.tokenize(v,p)}return"meta"}}function u(a,v,p){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=p,(N.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,v){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!N.contextGrabbers.hasOwnProperty(p)||!N.contextGrabbers[p].hasOwnProperty(v))return;o(a)}}function d(a,v,p){return a=="openTag"?(p.tagStart=v.column(),w):a=="closeTag"?f:d}function w(a,v,p){return a=="word"?(p.tagName=v.current(),E="tag",x):N.allowMissingTagName&&a=="endTag"?(E="tag bracket",x(a,v,p)):(E="error",w)}function f(a,v,p){if(a=="word"){var b=v.current();return p.context&&p.context.tagName!=b&&N.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==b||N.matchClosing===!1?(E="tag",m):(E="tag error",L)}else return N.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,v,p)):(E="error",L)}function m(a,v,p){return a!="endTag"?(E="error",m):(o(p),d)}function L(a,v,p){return E="error",m(a,v,p)}function x(a,v,p){if(a=="word")return E="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var b=p.tagName,P=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||N.autoSelfClosers.hasOwnProperty(b)?l(p,b):(l(p,b),p.context=new u(p,b,P==p.indented)),d}return E="error",x}function h(a,v,p){return a=="equals"?c:(N.allowMissing||(E="error"),x(a,v,p))}function c(a,v,p){return a=="string"?s:a=="word"&&N.allowUnquoted?(E="string",x):(E="error",x(a,v,p))}function s(a,v,p){return a=="string"?s:x(a,v,p)}return{startState:function(a){var v={tokenize:T,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;O=null;var p=v.tokenize(a,v);return(p||O)&&p!="comment"&&(E=null,v.state=v.state(O||p,a,v),E&&(p=E=="error"?p+" error":E)),p},indent:function(a,v,p){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(b&&b.noIndent)return te.Pass;if(a.tokenize!=_&&a.tokenize!=T)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return N.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(N.multilineTagIndentFactor||1);if(N.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var P=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(P&&P[1])for(;b;)if(b.tagName==P[2]){b=b.prev;break}else if(N.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(P)for(;b;){var F=N.contextGrabbers[b.tagName];if(F&&F.hasOwnProperty(P[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:N.htmlMode?"html":"xml",helperType:N.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],p=a.context;p;p=p.prev)p.tagName&&v.push(p.tagName);return v.reverse()}}}),te.defineMIME("text/xml","xml"),te.defineMIME("application/xml","xml"),te.mimeModes.hasOwnProperty("text/html")||te.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"30zm":function(mt,et,Q){"use strict";var te=Q("jCWc"),G=Q("kPKH"),A=Q("k1fw"),W=Q("tJVT"),M=Q("PpiC"),R=Q("B9cy"),N=Q("Ol7k"),k=Q("lUTK"),D=Q("BvKs"),O=Q("q1tI"),E=Q.n(O),T=Q("Ty5D"),_=Q("55Ip"),C=Q("9kvl"),y=Q("m3rI"),g=Q("kzJb"),u=Q.n(g),o=D.a.SubMenu,l=N.a.Sider,d=N.a.Content,w=function(m){var L=m.messages,x=m.globalSetting,h=m.loading,c=m.user,s=m.dispatch,a=Object(M.a)(m,["messages","globalSetting","loading","user","dispatch"]),v=Object(T.i)(),p=c.userInfo,b=Object(T.h)(),P=L.tidingsList,F=L.privateMessage,H=L.unreadInfo,X=Object(O.useState)({per_page:10,page:1}),B=Object(W.a)(X,2),U=B[0],z=B[1];Object(O.useEffect)(function(){Z()},[v.userId]);var Z=function(){s({type:"messages/unreadMessageInfo",payload:Object(A.a)(Object(A.a)({},U),v)})};return E.a.createElement(G.a,{flex:"264px"},E.a.createElement("aside",{className:u.a.userInfo},E.a.createElement("img",{className:"mt40",src:y.a.IMG_SERVER+"/images/"+(p==null?void 0:p.image_url)}),E.a.createElement("p",{className:"font24 mt10"},p==null?void 0:p.username),E.a.createElement("p",{className:"mt20"},p==null?void 0:p.user_identity)),E.a.createElement("ul",{className:u.a.navInfo},E.a.createElement(_.a,{to:"/messages/".concat(p==null?void 0:p.login,"/user_tidings")},E.a.createElement("li",{className:b.pathname.indexOf("user_tidings")>-1&&u.a.actived},"\u6D88\u606F",!!(H!=null&&H.unread_tiding_count)&&E.a.createElement("span",{className:u.a.newTip},H==null?void 0:H.unread_tiding_count))),E.a.createElement(_.a,{to:"/messages/".concat(p==null?void 0:p.login,"/private_messages")},E.a.createElement("li",{className:(b.pathname.indexOf("private_messages")>-1||b.pathname.indexOf("message_detail")>-1)&&u.a.actived},"\u79C1\u4FE1",!!(H!=null&&H.unread_message_count)&&E.a.createElement("span",{className:u.a.newTip},H==null?void 0:H.unread_message_count)))))};et.a=Object(C.a)(function(f){var m=f.messages,L=f.loading,x=f.user,h=f.globalSetting;return{messages:m,globalSetting:h,user:x,loading:L.effects}})(w)},"55Ip":function(mt,et,Q){"use strict";Q.d(et,"a",function(){return l});var te=Q("Ty5D"),G=Q("dI71"),A=Q("q1tI"),W=Q.n(A),M=Q("YS25"),R=Q("17x9"),N=Q.n(R),k=Q("wx14"),D=Q("zLVn"),O=Q("9R94"),E=function(c){Object(G.a)(s,c);function s(){for(var v,p=arguments.length,b=new Array(p),P=0;P<p;P++)b[P]=arguments[P];return v=c.call.apply(c,[this].concat(b))||this,v.history=Object(M.a)(v.props),v}var a=s.prototype;return a.render=function(){return W.a.createElement(te.c,{history:this.history,children:this.props.children})},s}(W.a.Component),T=function(c){Object(G.a)(s,c);function s(){for(var v,p=arguments.length,b=new Array(p),P=0;P<p;P++)b[P]=arguments[P];return v=c.call.apply(c,[this].concat(b))||this,v.history=Object(M.b)(v.props),v}var a=s.prototype;return a.render=function(){return W.a.createElement(te.c,{history:this.history,children:this.props.children})},s}(W.a.Component),_=function(s,a){return typeof s=="function"?s(a):s},C=function(s,a){return typeof s=="string"?Object(M.c)(s,null,null,a):s},y=function(s){return s},g=W.a.forwardRef;typeof g=="undefined"&&(g=y);function u(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=g(function(c,s){var a=c.innerRef,v=c.navigate,p=c.onClick,b=Object(D.a)(c,["innerRef","navigate","onClick"]),P=b.target,F=Object(k.a)({},b,{onClick:function(X){try{p&&p(X)}catch(B){throw X.preventDefault(),B}!X.defaultPrevented&&X.button===0&&(!P||P==="_self")&&!u(X)&&(X.preventDefault(),v())}});return y!==g?F.ref=s||a:F.ref=a,W.a.createElement("a",F)}),l=g(function(c,s){var a=c.component,v=a===void 0?o:a,p=c.replace,b=c.to,P=c.innerRef,F=Object(D.a)(c,["component","replace","to","innerRef"]);return W.a.createElement(te.e.Consumer,null,function(H){H||Object(O.a)(!1);var X=H.history,B=C(_(b,H.location),H.location),U=B?X.createHref(B):"",z=Object(k.a)({},F,{href:U,navigate:function(){var ne=_(b,H.location),oe=p?X.replace:X.push;oe(ne)}});return y!==g?z.ref=s||P:z.innerRef=P,W.a.createElement(v,z)})});if(!1)var d,w;var f=function(s){return s},m=W.a.forwardRef;typeof m=="undefined"&&(m=f);function L(){for(var c=arguments.length,s=new Array(c),a=0;a<c;a++)s[a]=arguments[a];return s.filter(function(v){return v}).join(" ")}var x=m(function(c,s){var a=c["aria-current"],v=a===void 0?"page":a,p=c.activeClassName,b=p===void 0?"active":p,P=c.activeStyle,F=c.className,H=c.exact,X=c.isActive,B=c.location,U=c.sensitive,z=c.strict,Z=c.style,ne=c.to,oe=c.innerRef,Ce=Object(D.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return W.a.createElement(te.e.Consumer,null,function(he){he||Object(O.a)(!1);var we=B||he.location,ve=C(_(ne,we),we),pe=ve.pathname,se=pe&&pe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),de=se?Object(te.f)(we.pathname,{path:se,exact:H,sensitive:U,strict:z}):null,Le=!!(X?X(de,we):de),We=Le?L(F,b):F,Te=Le?Object(k.a)({},Z,{},P):Z,xe=Object(k.a)({"aria-current":Le&&v||null,className:We,style:Te,to:ve},Ce);return f!==m?xe.ref=s||oe:xe.innerRef=oe,W.a.createElement(l,xe)})});if(!1)var h},"7ahc":function(mt,et,Q){"use strict";Q.d(et,"a",function(){return w});var te=Q("k1fw"),G=Q("0Owb"),A=Q("+L6B"),W=Q("2/Rp"),M=Q("y8nQ"),R=Q("Vl3Y"),N=Q("tJVT"),k=Q("OaEy"),D=Q("2fM7"),O=Q("q1tI"),E=Q.n(O),T=Q("VrN/"),_=Q.n(T),C=Q("p77/"),y=Q.n(C),g=Q("c5Ni"),u=Q.n(g),o=D.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};et.b=function(f){var m=f.callback,L=f.onCancel,x=Object(O.useState)("python"),h=Object(N.a)(x,2),c=h[0],s=h[1];function a(p){s(d[p][1])}function v(p){m(p)}return E.a.createElement(R.a,Object(G.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),E.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(D.a,{onChange:a},Object.keys(d).map(function(p){return E.a.createElement(o,{key:p,value:p},d[p][0])}))),E.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(w,{mode:c})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(W.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function w(f){var m=f.value,L=f.onChange,x=f.mode,h=f.options,c=h===void 0?{}:h,s=Object(O.useRef)(),a=Object(O.useState)(),v=Object(N.a)(a,2),p=v[0],b=v[1];return Object(O.useEffect)(function(){if(p){function P(F){var H=F.getValue();L&&L(H)}return p.on("change",P),function(){p.off("change",P)}}},[p,L]),Object(O.useEffect)(function(){p&&p.setOption("mode",x)},[p,x]),Object(O.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(O.useEffect)(function(){if(s.current&&!p){var P=_.a.fromTextArea(s.current,Object(te.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));b(P)}},[s.current,p]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:s}))}},"8EBN":function(mt,et,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";te.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G<te.modeInfo.length;G++){var A=te.modeInfo[G];A.mimes&&(A.mime=A.mimes[0])}te.findModeByMIME=function(W){W=W.toLowerCase();for(var M=0;M<te.modeInfo.length;M++){var R=te.modeInfo[M];if(R.mime==W)return R;if(R.mimes){for(var N=0;N<R.mimes.length;N++)if(R.mimes[N]==W)return R}}if(/\+xml$/.test(W))return te.findModeByMIME("application/xml");if(/\+json$/.test(W))return te.findModeByMIME("application/json")},te.findModeByExtension=function(W){W=W.toLowerCase();for(var M=0;M<te.modeInfo.length;M++){var R=te.modeInfo[M];if(R.ext){for(var N=0;N<R.ext.length;N++)if(R.ext[N]==W)return R}}},te.findModeByFileName=function(W){for(var M=0;M<te.modeInfo.length;M++){var R=te.modeInfo[M];if(R.file&&R.file.test(W))return R}var N=W.lastIndexOf("."),k=N>-1&&W.substring(N+1,W.length);if(k)return te.findModeByExtension(k)},te.findModeByName=function(W){W=W.toLowerCase();for(var M=0;M<te.modeInfo.length;M++){var R=te.modeInfo[M];if(R.name.toLowerCase()==W)return R;if(R.alias){for(var N=0;N<R.alias.length;N++)if(R.alias[N].toLowerCase()==W)return R}}}})},"9Bee":function(mt,et,Q){"use strict";var te=Q("k1fw"),G=Q("tJVT"),A=Q("q1tI"),W=Q.n(A),M=Q("vg9a"),R=Q("DlQD"),N=Q.n(R),k=Q("rUJ1");function D(z,Z){var ne=z.match(/^(\s+)(?:```)/);if(ne===null)return Z;var oe=ne[1];return Z.split(`
`).map(function(Ce){var he=Ce.match(/^\s+/);if(he===null)return Ce;var we=Object(G.a)(he,1),ve=we[0];return ve.length>=oe.length?Ce.slice(oe.length):Ce}).join(`
`)}var O=[],E=["<ul>"],T=new N.a.Renderer,_=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){O.length=0,E=["<ul>"]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(z,Z,ne,oe){if(Z>=z.length||z[Z].level<=ne)return Z;var Ce=z[Z];oe.push("<li><a href='#"+Ce.anchor+"'>"+Ce.text+"</a>"),Z++;var he=[];return Z=g(z,Z,Ce.level,he),he.length>0&&(oe.push("<ul>"),he.forEach(function(we){oe.push(we)}),oe.push("</ul>")),oe.push("</li>"),Z=g(z,Z,ne,oe),Z}function u(){return g(O,0,0,E),E.push("</ul>"),E.join("")}var o={heading:function(Z){var ne=_.exec(Z);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},fences:function(Z){var ne=this.rules.block.fences.exec(Z);if(ne){var oe=ne[0],Ce=D(oe,ne[3]||""),he=ne[2]?ne[2].trim():ne[2];if(["latex","katex","math"].indexOf(he)>=0){var we=w(),ve=Ce;Ce=we,f[we]={type:"block",expression:ve}}return{type:"code",raw:oe,lang:he,text:Ce}}}},l=/(?:\${2})([^\n`]+?)(?:\${2})/gi,d=0,w=function(){return"__special_katext_id_".concat(d++,"__")},f={};function m(){return f}function L(){d=0,f={}}function x(z){return z=z.replace(l,function(Z,ne){var oe=w();return f[oe]={type:"inline",expression:ne},oe}),z}var h=T.listitem;T.listitem=function(z){return h(x(z))};var c=T.paragraph;T.paragraph=function(z){return c(x(z))};var s=T.tablecell;T.tablecell=function(z,Z){return s(x(z),Z)},T.code=function(z,Z,ne){var oe=(Z||"").match(/\S*/)[0];return oe?["latex","katex","math"].indexOf(oe)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Z,'">').concat(ne?z:Object(k.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ne?z:Object(k.escape)(z,!0))+"</code></pre>"},T.heading=function(z,Z,ne){var oe=this.options.headerPrefix+ne.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:oe,level:Z,text:z}),"<h"+Z+' id="'+oe+'">'+z+"</h"+Z+">"},N.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),N.a.use({tokenizer:o,renderer:T});var a=N.a,v=Q("SJMd"),p=Q("ulZh"),b=Q.n(p),P=Q("m3rI"),F=Q("Oy/b"),H=Q("p5ED"),X=/<pre[^>]*>/g;function B(z){var Z=document.createElement("div");return Z.innerHTML=z,Z.childNodes.length===0?"":Z.childNodes[0].nodeValue}var U=et.a=function(z){var Z,ne=z.value,oe=ne===void 0?"":ne,Ce=z.className,he=z.showTextOnly,we=z.showLines,ve=z.style,pe=ve===void 0?{}:ve,se=z.stylesPrev,de=se===void 0?{}:se,Le=(Z=String(oe))===null||Z===void 0?void 0:Z.replace(/<script.*?>|<\/script>/gi,"").replace(/on\w+="[^"]*"/gi,""),We=Object(A.useState)(""),Te=Object(G.a)(We,2),xe=Te[0],Oe=Te[1],ye=Object(A.useMemo)(function(){try{var Ie=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ae=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Re=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Le=Le.replace(Ie,"("+P.a.API_SERVER+"/api/attachments/").replace(Ae,'"'+P.a.API_SERVER+"/api/attachments/").replace(Re,'"'+P.a.API_SERVER+"/files/uploads/").replace(/\r\n/g,`
`),Le=Le.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(He){}var Ke=a(Le),ze=m();if(Le.match(/\[TOC\]/)&&(Ke=Ke.replace("<p>[TOC]</p>",u()),C()),Ke=Ke.replace(/(__special_katext_id_\d+__)/g,function(He,ot){var Xe=ze[ot],Be=Xe.type,be=Xe.expression;return Object(F.renderToString)(B(be)||"",{displayMode:Be==="block",throwOnError:!1,output:"html"})}),Ke=Ke.replace(/▁/g,"\u2581\u2581\u2581"),L(),he){var Ge=document.createElement("div");return Ge.innerHTML=Ke,Ge.innerText}return setTimeout(function(){return Ne()},500),Ke},[Le]),me=Object(A.useRef)();y.WebkitLineClamp=we,we&&(pe=Object(te.a)(Object(te.a)({},pe),y));function Me(Ie){var Ae=Ie.target;if(Ae.tagName.toUpperCase()==="A"){var Re=Ae.getAttribute("href");if(Re.indexOf("office")>-1)Ie.preventDefault(),Oe(Re);else if(Re.startsWith("#")){Ie.preventDefault();var Ke=document.getElementById(Re.replace("#",""));Ke&&Ke.scrollIntoView(!0)}}}var Ne=function(){var Ae,Re=(Ae=me.current)===null||Ae===void 0?void 0:Ae.querySelectorAll("video");Re==null||Re.forEach(function(Ke){if(Ke.oncontextmenu=function(){return!1},Ke.src.indexOf(".m3u8")>-1&&!Ke.canPlayType("application/vnd.apple.mpegurl")){if(b.a.isSupported()){var ze=new b.a;ze.loadSource(Ke.src),ze.attachMedia(Ke)}}})};return Object(A.useEffect)(function(){if(me.current&&ye&&(ye.match(X)&&window.PR.prettyPrint()),me.current)return me.current.addEventListener("click",Me),function(){me.current.removeEventListener("click",Me),L(),C()}},[ye,me.current,Me]),W.a.createElement(W.a.Fragment,null,W.a.createElement("div",{ref:me,style:Object(te.a)({},pe),className:"".concat(Ce||""," markdown-body "),dangerouslySetInnerHTML:{__html:ye}}),W.a.createElement(H.a,{close:!0,data:xe,type:xe!=null&&xe.length?"office":"",style:Object(te.a)({},de),onClose:function(){return Oe("")}}))}},"9VGf":function(mt,et,Q){"use strict";Q.d(et,"a",function(){return A});var te=Q("q1tI"),G=Q.n(te);function A(W,M){var R=Object(te.useRef)();Object(te.useEffect)(function(){R.current=W}),Object(te.useEffect)(function(){function N(){R.current()}if(M!==null){var k=setInterval(N,M);return function(){return clearInterval(k)}}},[M])}},BU3w:function(mt,et,Q){"use strict";Q.d(et,"a",function(){return R});var te=Q("MNnm"),G="rc-util-key";function A(N){if(N.attachTo)return N.attachTo;var k=document.querySelector("head");return k||document.body}function W(N){var k,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(te.a)())return null;var O=document.createElement("style");if((k=D.csp)===null||k===void 0?void 0:k.nonce){var E;O.nonce=(E=D.csp)===null||E===void 0?void 0:E.nonce}O.innerHTML=N;var T=A(D),_=T.firstChild;return D.prepend&&T.prepend?T.prepend(O):D.prepend&&_?T.insertBefore(O,_):T.appendChild(O),O}var M=new Map;function R(N,k){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=A(D);if(!M.has(O)){var E=W("",D),T=E.parentNode;M.set(O,T),T.removeChild(E)}var _=Array.from(M.get(O).children).find(function(o){return o.tagName==="STYLE"&&o[G]===k});if(_){var C,y;if(((C=D.csp)===null||C===void 0?void 0:C.nonce)&&_.nonce!==((y=D.csp)===null||y===void 0?void 0:y.nonce)){var g;_.nonce=(g=D.csp)===null||g===void 0?void 0:g.nonce}return _.innerHTML!==N&&(_.innerHTML=N),_}var u=W(N,D);return u[G]=k,u}},Bd2K:function(mt,et,Q){(function(te){te(Q("VrN/"),Q("osHv"))})(function(te){te.defineOption("autoCloseTags",!1,function(D,O,E){if(E!=te.Init&&E&&D.removeKeyMap("autoCloseTags"),!O)return;var T={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(T["'/'"]=function(_){return R(_)}),(typeof O!="object"||O.whenOpening!==!1)&&(T["'>'"]=function(_){return W(_)}),D.addKeyMap(T)});var G=["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(D){if(D.getOption("disableInput"))return te.Pass;for(var O=D.listSelections(),E=[],T=D.getOption("autoCloseTags"),_=0;_<O.length;_++){if(!O[_].empty())return te.Pass;var C=O[_].head,y=D.getTokenAt(C),g=te.innerMode(D.getMode(),y.state),u=g.state,o=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(u),l=o&&o.name;if(!l)return te.Pass;var d=g.mode.configuration=="html",w=typeof T=="object"&&T.dontCloseTags||d&&G,f=typeof T=="object"&&T.indentTags||d&&A;y.end>C.ch&&(l=l.slice(0,l.length-y.end+C.ch));var m=l.toLowerCase();if(!l||y.type=="string"&&(y.end!=C.ch||!/[\"\']/.test(y.string.charAt(y.string.length-1))||y.string.length==1)||y.type=="tag"&&o.close||y.string.indexOf("/")==C.ch-y.start-1||w&&N(w,m)>-1||k(D,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(u)||[],l,C,!0))return te.Pass;var L=typeof T=="object"&&T.emptyTags;if(L&&N(L,l)>-1){E[_]={text:"/>",newPos:te.Pos(C.line,C.ch+2)};continue}var x=f&&N(f,m)>-1;E[_]={indent:x,text:">"+(x?`
`:"")+"</"+l+">",newPos:x?te.Pos(C.line+1,0):te.Pos(C.line,C.ch+1)}}for(var h=typeof T=="object"&&T.dontIndentOnAutoClose,_=O.length-1;_>=0;_--){var c=E[_];D.replaceRange(c.text,O[_].head,O[_].anchor,"+insert");var s=D.listSelections().slice(0);s[_]={head:c.newPos,anchor:c.newPos},D.setSelections(s),!h&&c.indent&&(D.indentLine(c.newPos.line,null,!0),D.indentLine(c.newPos.line+1,null,!0))}}function M(D,O){for(var E=D.listSelections(),T=[],_=O?"/":"</",C=D.getOption("autoCloseTags"),y=typeof C=="object"&&C.dontIndentOnSlash,g=0;g<E.length;g++){if(!E[g].empty())return te.Pass;var u=E[g].head,o=D.getTokenAt(u),l=te.innerMode(D.getMode(),o.state),d=l.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return te.Pass;var w,f=l.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(f&&l.mode.name=="javascript")w=_+"script";else if(f&&l.mode.name=="css")w=_+"style";else{var m=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!m||m.length&&k(D,m,m[m.length-1],u))return te.Pass;w=_+m[m.length-1]}D.getLine(u.line).charAt(o.end)!=">"&&(w+=">"),T[g]=w}if(D.replaceSelections(T),E=D.listSelections(),!y)for(var g=0;g<E.length;g++)(g==E.length-1||E[g].head.line<E[g+1].head.line)&&D.indentLine(E[g].head.line)}function R(D){return D.getOption("disableInput")?te.Pass:M(D,!0)}te.commands.closeTag=function(D){return M(D)};function N(D,O){if(D.indexOf)return D.indexOf(O);for(var E=0,T=D.length;E<T;++E)if(D[E]==O)return E;return-1}function k(D,O,E,T,_){if(!te.scanForClosingTag)return!1;var C=Math.min(D.lastLine()+1,T.line+500),y=te.scanForClosingTag(D,T,null,C);if(!y||y.tag!=E)return!1;for(var g=_?1:0,u=O.length-1;u>=0&&O[u]==E;u--)++g;T=y.to;for(var u=1;u<g;u++){var o=te.scanForClosingTag(D,T,null,C);if(!o||o.tag!=E)return!1;T=o.to}return!0}})},BjJ7:function(mt,et,Q){"use strict";Q.d(et,"d",function(){return G}),Q.d(et,"c",function(){return A}),Q.d(et,"e",function(){return W}),Q.d(et,"b",function(){return M}),Q.d(et,"a",function(){return N});var te=Q("m3rI");function G(k){var D=!0;if(k.length>0){for(var O=0;O<k.length;O++)if(k[O].compile_success==0||!k[O].compile_success){D=!1;break}}else D=!1;return D}function A(k){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],E=0;E<k.length;E++){var T=k[E],_=D?"".concat(D,"/").concat(T.name):"".concat(T.name);O.push({title:T.name,isLeaf:!(T.type==="tree"),key:_})}return O}function W(k,D,O){for(var E=0;E<k.length;E++){var T=k[E];if(T.key===D){T.children=O;break}T.children&&W(T.children,D,O)}return k}function M(k,D,O){var E;return function(){var T=this,_=arguments,C=function(){E=null,O||k.apply(T,_)},y=O&&!E;clearTimeout(E),E=setTimeout(C,D),y&&k.apply(T,_)}}var R=!0,N=te.a.API_SERVER},"C+DQ":function(mt,et,Q){},DlQD:function(mt,et,Q){(function(te,G){mt.exports=G()})(this,function(){"use strict";function te(le,ie){for(var ee=0;ee<ie.length;ee++){var Y=ie[ee];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(le,Y.key,Y)}}function G(le,ie,ee){return ie&&te(le.prototype,ie),ee&&te(le,ee),le}function A(le,ie){if(!le)return;if(typeof le=="string")return W(le,ie);var ee=Object.prototype.toString.call(le).slice(8,-1);if(ee==="Object"&&le.constructor&&(ee=le.constructor.name),ee==="Map"||ee==="Set")return Array.from(le);if(ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ee))return W(le,ie)}function W(le,ie){(ie==null||ie>le.length)&&(ie=le.length);for(var ee=0,Y=new Array(ie);ee<ie;ee++)Y[ee]=le[ee];return Y}function M(le,ie){var ee;if(typeof Symbol=="undefined"||le[Symbol.iterator]==null){if(Array.isArray(le)||(ee=A(le))||ie&&le&&typeof le.length=="number"){ee&&(le=ee);var Y=0;return function(){return Y>=le.length?{done:!0}:{done:!1,value:le[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 ee=le[Symbol.iterator](),ee.next.bind(ee)}function R(le,ie){return ie={exports:{}},le(ie,ie.exports),ie.exports}var N=R(function(le){function ie(){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 ee(Y){le.exports.defaults=Y}le.exports={defaults:ie(),getDefaults:ie,changeDefaults:ee}}),k=N.defaults,D=N.getDefaults,O=N.changeDefaults,E=/[&<>"']/,T=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=function(ie){return y[ie]};function u(le,ie){if(ie){if(E.test(le))return le.replace(T,g)}else if(_.test(le))return le.replace(C,g);return le}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(le){return le.replace(o,function(ie,ee){return ee=ee.toLowerCase(),ee==="colon"?":":ee.charAt(0)==="#"?ee.charAt(1)==="x"?String.fromCharCode(parseInt(ee.substring(2),16)):String.fromCharCode(+ee.substring(1)):""})}var d=/(^|[^\[])\^/g;function w(le,ie){le=le.source||le,ie=ie||"";var ee={replace:function($,J){return J=J.source||J,J=J.replace(d,"$1"),le=le.replace($,J),ee},getRegex:function(){return new RegExp(le,ie)}};return ee}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(le,ie,ee){if(le){var Y;try{Y=decodeURIComponent(l(ee)).replace(f,"").toLowerCase()}catch($){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ie&&!m.test(ee)&&(ee=a(ie,ee));try{ee=encodeURI(ee).replace(/%25/g,"%")}catch($){return null}return ee}var x={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(le,ie){x[" "+le]||(h.test(le)?x[" "+le]=le+"/":x[" "+le]=P(le,"/",!0)),le=x[" "+le];var ee=le.indexOf(":")===-1;return ie.substring(0,2)==="//"?ee?ie:le.replace(c,"$1")+ie:ie.charAt(0)==="/"?ee?ie:le.replace(s,"$1")+ie:le+ie}var v={exec:function(){}};function p(le){for(var ie=1,ee,Y;ie<arguments.length;ie++){ee=arguments[ie];for(Y in ee)Object.prototype.hasOwnProperty.call(ee,Y)&&(le[Y]=ee[Y])}return le}function b(le,ie){var ee=le.replace(/\|/g,function(J,q,ue){for(var ge=!1,_e=q;--_e>=0&&ue[_e]==="\\";)ge=!ge;return ge?"|":" |"}),Y=ee.split(/ \|/),$=0;if(Y.length>ie)Y.splice(ie);else for(;Y.length<ie;)Y.push("");for(;$<Y.length;$++)Y[$]=Y[$].trim().replace(/\\\|/g,"|");return Y}function P(le,ie,ee){var Y=le.length;if(Y===0)return"";for(var $=0;$<Y;){var J=le.charAt(Y-$-1);if(J===ie&&!ee)$++;else if(J!==ie&&ee)$++;else break}return le.substr(0,Y-$)}function F(le,ie){if(le.indexOf(ie[1])===-1)return-1;for(var ee=le.length,Y=0,$=0;$<ee;$++)if(le[$]==="\\")$++;else if(le[$]===ie[0])Y++;else if(le[$]===ie[1]&&(Y--,Y<0))return $;return-1}function H(le){le&&le.sanitize&&!le.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var X={escape:u,unescape:l,edit:w,cleanUrl:L,resolveUrl:a,noopTest:v,merge:p,splitCells:b,rtrim:P,findClosingBracket:F,checkSanitizeDeprecation:H},B=N.defaults,U=X.rtrim,z=X.splitCells,Z=X.escape,ne=X.findClosingBracket;function oe(le,ie,ee){var Y=ie.href,$=ie.title?Z(ie.title):null,J=le[1].replace(/\\([\[\]])/g,"$1");return le[0].charAt(0)!=="!"?{type:"link",raw:ee,href:Y,title:$,text:J}:{type:"image",raw:ee,href:Y,title:$,text:Z(J)}}function Ce(le,ie){var ee=le.match(/^(\s+)(?:```)/);if(ee===null)return ie;var Y=ee[1];return ie.split(`
`).map(function($){var J=$.match(/^\s+/);if(J===null)return $;var q=J[0];return q.length>=Y.length?$.slice(Y.length):$}).join(`
`)}var he=function(){function le(ee){this.options=ee||B}var ie=le.prototype;return ie.space=function(Y){var $=this.rules.block.newline.exec(Y);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
`}},ie.code=function(Y,$){var J=this.rules.block.code.exec(Y);if(J){var q=$[$.length-1];if(q&&q.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var ue=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?ue:U(ue,`
`)}}},ie.fences=function(Y){var $=this.rules.block.fences.exec(Y);if($){var J=$[0],q=Ce(J,$[3]||"");return{type:"code",raw:J,lang:$[2]?$[2].trim():$[2],text:q}}},ie.heading=function(Y){var $=this.rules.block.heading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ie.nptable=function(Y){var $=this.rules.block.nptable.exec(Y);if($){var J={type:"table",header:z($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[],raw:$[0]};if(J.header.length===J.align.length){var q=J.align.length,ue;for(ue=0;ue<q;ue++)/^ *-+: *$/.test(J.align[ue])?J.align[ue]="right":/^ *:-+: *$/.test(J.align[ue])?J.align[ue]="center":/^ *:-+ *$/.test(J.align[ue])?J.align[ue]="left":J.align[ue]=null;for(q=J.cells.length,ue=0;ue<q;ue++)J.cells[ue]=z(J.cells[ue],J.header.length);return J}}},ie.hr=function(Y){var $=this.rules.block.hr.exec(Y);if($)return{type:"hr",raw:$[0]}},ie.blockquote=function(Y){var $=this.rules.block.blockquote.exec(Y);if($){var J=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:J}}},ie.list=function(Y){var $=this.rules.block.list.exec(Y);if($){for(var J=$[0],q=$[2],ue=q.length>1,ge=q[q.length-1]===")",_e={type:"list",raw:J,ordered:ue,start:ue?+q.slice(0,-1):"",loose:!1,items:[]},Ve=$[0].match(this.rules.block.item),Qe=!1,Ze,st,pt,tt,Rt,vt,It,Ut=Ve.length,xt=0;xt<Ut;xt++)Ze=Ve[xt],J=Ze,st=Ze.length,Ze=Ze.replace(/^ *([*+-]|\d+[.)]) */,""),~Ze.indexOf(`
`)&&(st-=Ze.length,Ze=this.options.pedantic?Ze.replace(/^ {1,4}/gm,""):Ze.replace(new RegExp("^ {1,"+st+"}","gm"),"")),xt!==Ut-1&&(pt=this.rules.block.bullet.exec(Ve[xt+1])[0],(ue?pt.length===1||!ge&&pt[pt.length-1]===")":pt.length>1||this.options.smartLists&&pt!==q)&&(tt=Ve.slice(xt+1).join(`
`),_e.raw=_e.raw.substring(0,_e.raw.length-tt.length),xt=Ut-1)),Rt=Qe||/\n\n(?!\s*$)/.test(Ze),xt!==Ut-1&&(Qe=Ze.charAt(Ze.length-1)===`
`,Rt||(Rt=Qe)),Rt&&(_e.loose=!0),vt=/^\[[ xX]\] /.test(Ze),It=void 0,vt&&(It=Ze[1]!==" ",Ze=Ze.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:J,task:vt,checked:It,loose:Rt,text:Ze});return _e}},ie.html=function(Y){var $=this.rules.block.html.exec(Y);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):Z($[0]):$[0]}},ie.def=function(Y){var $=this.rules.block.def.exec(Y);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var J=$[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:$[0],href:$[2],title:$[3]}}},ie.table=function(Y){var $=this.rules.block.table.exec(Y);if($){var J={type:"table",header:z($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[]};if(J.header.length===J.align.length){J.raw=$[0];var q=J.align.length,ue;for(ue=0;ue<q;ue++)/^ *-+: *$/.test(J.align[ue])?J.align[ue]="right":/^ *:-+: *$/.test(J.align[ue])?J.align[ue]="center":/^ *:-+ *$/.test(J.align[ue])?J.align[ue]="left":J.align[ue]=null;for(q=J.cells.length,ue=0;ue<q;ue++)J.cells[ue]=z(J.cells[ue].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},ie.lheading=function(Y){var $=this.rules.block.lheading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ie.paragraph=function(Y){var $=this.rules.block.paragraph.exec(Y);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
`?$[1].slice(0,-1):$[1]}},ie.text=function(Y,$){var J=this.rules.block.text.exec(Y);if(J){var q=$[$.length-1];return q&&q.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},ie.escape=function(Y){var $=this.rules.inline.escape.exec(Y);if($)return{type:"escape",raw:$[0],text:Z($[1])}},ie.tag=function(Y,$,J){var q=this.rules.inline.tag.exec(Y);if(q)return!$&&/^<a /i.test(q[0])?$=!0:$&&/^<\/a>/i.test(q[0])&&($=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(q[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(q[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:q[0],inLink:$,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Z(q[0]):q[0]}},ie.link=function(Y){var $=this.rules.inline.link.exec(Y);if($){var J=ne($[2],"()");if(J>-1){var q=$[0].indexOf("!")===0?5:4,ue=q+$[1].length+J;$[2]=$[2].substring(0,J),$[0]=$[0].substring(0,ue).trim(),$[3]=""}var ge=$[2],_e="";if(this.options.pedantic){var Ve=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ge);Ve?(ge=Ve[1],_e=Ve[3]):_e=""}else _e=$[3]?$[3].slice(1,-1):"";ge=ge.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=oe($,{href:ge&&ge.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},$[0]);return Qe}},ie.reflink=function(Y,$){var J;if((J=this.rules.inline.reflink.exec(Y))||(J=this.rules.inline.nolink.exec(Y))){var q=(J[2]||J[1]).replace(/\s+/g," ");if(q=$[q.toLowerCase()],!q||!q.href){var ue=J[0].charAt(0);return{type:"text",raw:ue,text:ue}}var ge=oe(J,q,J[0]);return ge}},ie.strong=function(Y,$,J){J===void 0&&(J="");var q=this.rules.inline.strong.start.exec(Y);if(q&&(!q[1]||q[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var ue=q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ue.lastIndex=0;for(var ge;(q=ue.exec($))!=null;)if(ge=this.rules.inline.strong.middle.exec($.slice(0,q.index+3)),ge)return{type:"strong",raw:Y.slice(0,ge[0].length),text:Y.slice(2,ge[0].length-2)}}},ie.em=function(Y,$,J){J===void 0&&(J="");var q=this.rules.inline.em.start.exec(Y);if(q&&(!q[1]||q[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var ue=q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ue.lastIndex=0;for(var ge;(q=ue.exec($))!=null;)if(ge=this.rules.inline.em.middle.exec($.slice(0,q.index+2)),ge)return{type:"em",raw:Y.slice(0,ge[0].length),text:Y.slice(1,ge[0].length-1)}}},ie.codespan=function(Y){var $=this.rules.inline.code.exec(Y);if($){var J=$[2].replace(/\n/g," "),q=/[^ ]/.test(J),ue=J.startsWith(" ")&&J.endsWith(" ");return q&&ue&&(J=J.substring(1,J.length-1)),J=Z(J,!0),{type:"codespan",raw:$[0],text:J}}},ie.br=function(Y){var $=this.rules.inline.br.exec(Y);if($)return{type:"br",raw:$[0]}},ie.del=function(Y){var $=this.rules.inline.del.exec(Y);if($)return{type:"del",raw:$[0],text:$[1]}},ie.autolink=function(Y,$){var J=this.rules.inline.autolink.exec(Y);if(J){var q,ue;return J[2]==="@"?(q=Z(this.options.mangle?$(J[1]):J[1]),ue="mailto:"+q):(q=Z(J[1]),ue=q),{type:"link",raw:J[0],text:q,href:ue,tokens:[{type:"text",raw:q,text:q}]}}},ie.url=function(Y,$){var J;if(J=this.rules.inline.url.exec(Y)){var q,ue;if(J[2]==="@")q=Z(this.options.mangle?$(J[0]):J[0]),ue="mailto:"+q;else{var ge;do ge=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(ge!==J[0]);q=Z(J[0]),J[1]==="www."?ue="http://"+q:ue=q}return{type:"link",raw:J[0],text:q,href:ue,tokens:[{type:"text",raw:q,text:q}]}}},ie.inlineText=function(Y,$,J){var q=this.rules.inline.text.exec(Y);if(q){var ue;return $?ue=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Z(q[0]):q[0]:ue=Z(this.options.smartypants?J(q[0]):q[0]),{type:"text",raw:q[0],text:ue}}},le}(),we=X.noopTest,ve=X.edit,pe=X.merge,se={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:we,table:we,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};se._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,se._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,se.def=ve(se.def).replace("label",se._label).replace("title",se._title).getRegex(),se.bullet=/(?:[*+-]|\d{1,9}[.)])/,se.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,se.item=ve(se.item,"gm").replace(/bull/g,se.bullet).getRegex(),se.list=ve(se.list).replace(/bull/g,se.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+se.def.source+")").getRegex(),se._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",se._comment=/<!--(?!-?>)[\s\S]*?-->/,se.html=ve(se.html,"i").replace("comment",se._comment).replace("tag",se._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),se.paragraph=ve(se._paragraph).replace("hr",se.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",se._tag).getRegex(),se.blockquote=ve(se.blockquote).replace("paragraph",se.paragraph).getRegex(),se.normal=pe({},se),se.gfm=pe({},se.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*|$)"}),se.gfm.nptable=ve(se.gfm.nptable).replace("hr",se.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",se._tag).getRegex(),se.gfm.table=ve(se.gfm.table).replace("hr",se.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",se._tag).getRegex(),se.pedantic=pe({},se.normal,{html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",se._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:we,paragraph:ve(se.normal._paragraph).replace("hr",se.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",se.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:we,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:we,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};de._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",de.punctuation=ve(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=ve(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=ve(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=ve(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=ve(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=ve(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=ve(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=ve(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=ve(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=ve(de._blockSkip,"g").getRegex(),de.overlapSkip=ve(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._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])?)+(?![-_])/,de.autolink=ve(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=ve(de.tag).replace("comment",se._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=ve(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=ve(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=ve(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=pe({},de),de.pedantic=pe({},de.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:ve(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=pe({},de.normal,{escape:ve(de.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),de.gfm.url=ve(de.gfm.url,"i").replace("email",de.gfm._extended_email).getRegex(),de.breaks=pe({},de.gfm,{br:ve(de.br).replace("{2,}","*").getRegex(),text:ve(de.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Le={block:se,inline:de},We=N.defaults,Te=Le.block,xe=Le.inline;function Oe(le){return le.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ye(le){var ie="",ee,Y,$=le.length;for(ee=0;ee<$;ee++)Y=le.charCodeAt(ee),Math.random()>.5&&(Y="x"+Y.toString(16)),ie+="&#"+Y+";";return ie}var me=function(){function le(ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=ee||We,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Te.normal,inline:xe.normal};this.options.pedantic?(Y.block=Te.pedantic,Y.inline=xe.pedantic):this.options.gfm&&(Y.block=Te.gfm,this.options.breaks?Y.inline=xe.breaks:Y.inline=xe.gfm),this.tokenizer.rules=Y}le.lex=function(Y,$){var J=new le($);return J.lex(Y)};var ie=le.prototype;return ie.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},ie.blockTokens=function(Y,$,J){$===void 0&&($=[]),J===void 0&&(J=!0),Y=Y.replace(/^ +$/gm,"");for(var q,ue,ge,_e;Y;){if(q=this.tokenizer.space(Y)){Y=Y.substring(q.raw.length),q.type&&$.push(q);continue}if(q=this.tokenizer.code(Y,$)){Y=Y.substring(q.raw.length),q.type?$.push(q):(_e=$[$.length-1],_e.raw+=`
`+q.raw,_e.text+=`
`+q.text);continue}if(q=this.tokenizer.fences(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.heading(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.nptable(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.hr(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.blockquote(Y)){Y=Y.substring(q.raw.length),q.tokens=this.blockTokens(q.text,[],J),$.push(q);continue}if(q=this.tokenizer.list(Y)){for(Y=Y.substring(q.raw.length),ge=q.items.length,ue=0;ue<ge;ue++)q.items[ue].tokens=this.blockTokens(q.items[ue].text,[],!1);$.push(q);continue}if(q=this.tokenizer.html(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(J&&(q=this.tokenizer.def(Y))){Y=Y.substring(q.raw.length),this.tokens.links[q.tag]||(this.tokens.links[q.tag]={href:q.href,title:q.title});continue}if(q=this.tokenizer.table(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.lheading(Y)){Y=Y.substring(q.raw.length),$.push(q);continue}if(J&&(q=this.tokenizer.paragraph(Y))){Y=Y.substring(q.raw.length),$.push(q);continue}if(q=this.tokenizer.text(Y,$)){Y=Y.substring(q.raw.length),q.type?$.push(q):(_e=$[$.length-1],_e.raw+=`
`+q.raw,_e.text+=`
`+q.text);continue}if(Y){var Ve="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return $},ie.inline=function(Y){var $,J,q,ue,ge,_e,Ve=Y.length;for($=0;$<Ve;$++){_e=Y[$];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:[]},ue=_e.header.length,J=0;J<ue;J++)_e.tokens.header[J]=[],this.inlineTokens(_e.header[J],_e.tokens.header[J]);for(ue=_e.cells.length,J=0;J<ue;J++)for(ge=_e.cells[J],_e.tokens.cells[J]=[],q=0;q<ge.length;q++)_e.tokens.cells[J][q]=[],this.inlineTokens(ge[q],_e.tokens.cells[J][q]);break}case"blockquote":{this.inline(_e.tokens);break}case"list":{for(ue=_e.items.length,J=0;J<ue;J++)this.inline(_e.items[J].tokens);break}}}return Y},ie.inlineTokens=function(Y,$,J,q,ue){$===void 0&&($=[]),J===void 0&&(J=!1),q===void 0&&(q=!1),ue===void 0&&(ue="");var ge,_e=Y,Ve;if(this.tokens.links){var Qe=Object.keys(this.tokens.links);if(Qe.length>0)for(;(Ve=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)Qe.includes(Ve[0].slice(Ve[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ve=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(ge=this.tokenizer.escape(Y)){Y=Y.substring(ge.raw.length),$.push(ge);continue}if(ge=this.tokenizer.tag(Y,J,q)){Y=Y.substring(ge.raw.length),J=ge.inLink,q=ge.inRawBlock,$.push(ge);continue}if(ge=this.tokenizer.link(Y)){Y=Y.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,q)),$.push(ge);continue}if(ge=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,q)),$.push(ge);continue}if(ge=this.tokenizer.strong(Y,_e,ue)){Y=Y.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],J,q),$.push(ge);continue}if(ge=this.tokenizer.em(Y,_e,ue)){Y=Y.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],J,q),$.push(ge);continue}if(ge=this.tokenizer.codespan(Y)){Y=Y.substring(ge.raw.length),$.push(ge);continue}if(ge=this.tokenizer.br(Y)){Y=Y.substring(ge.raw.length),$.push(ge);continue}if(ge=this.tokenizer.del(Y)){Y=Y.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],J,q),$.push(ge);continue}if(ge=this.tokenizer.autolink(Y,ye)){Y=Y.substring(ge.raw.length),$.push(ge);continue}if(!J&&(ge=this.tokenizer.url(Y,ye))){Y=Y.substring(ge.raw.length),$.push(ge);continue}if(ge=this.tokenizer.inlineText(Y,q,Oe)){Y=Y.substring(ge.raw.length),ue=ge.raw.slice(-1),$.push(ge);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 $},G(le,null,[{key:"rules",get:function(){return{block:Te,inline:xe}}}]),le}(),Me=N.defaults,Ne=X.cleanUrl,Ie=X.escape,Ae=function(){function le(ee){this.options=ee||Me}var ie=le.prototype;return ie.code=function(Y,$,J){var q=($||"").match(/\S*/)[0];if(this.options.highlight){var ue=this.options.highlight(Y,q);ue!=null&&ue!==Y&&(J=!0,Y=ue)}return q?'<pre><code class="'+this.options.langPrefix+Ie(q,!0)+'">'+(J?Y:Ie(Y,!0))+`</code></pre>
`:"<pre><code>"+(J?Y:Ie(Y,!0))+`</code></pre>
`},ie.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},ie.html=function(Y){return Y},ie.heading=function(Y,$,J,q){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+q.slug(J)+'">'+Y+"</h"+$+`>
`:"<h"+$+">"+Y+"</h"+$+`>
`},ie.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ie.list=function(Y,$,J){var q=$?"ol":"ul",ue=$&&J!==1?' start="'+J+'"':"";return"<"+q+ue+`>
`+Y+"</"+q+`>
`},ie.listitem=function(Y){return"<li>"+Y+`</li>
`},ie.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ie.paragraph=function(Y){return"<p>"+Y+`</p>
`},ie.table=function(Y,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+$+`</table>
`},ie.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},ie.tablecell=function(Y,$){var J=$.header?"th":"td",q=$.align?"<"+J+' align="'+$.align+'">':"<"+J+">";return q+Y+"</"+J+`>
`},ie.strong=function(Y){return"<strong>"+Y+"</strong>"},ie.em=function(Y){return"<em>"+Y+"</em>"},ie.codespan=function(Y){return"<code>"+Y+"</code>"},ie.br=function(){return this.options.xhtml?"<br/>":"<br>"},ie.del=function(Y){return"<del>"+Y+"</del>"},ie.link=function(Y,$,J){if(Y=Ne(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var q='<a href="'+Ie(Y)+'"';return $&&(q+=' title="'+$+'"'),q+=">"+J+"</a>",q},ie.image=function(Y,$,J){if(Y=Ne(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var q='<img src="'+Y+'" alt="'+J+'"';return $&&(q+=' title="'+$+'"'),q+=this.options.xhtml?"/>":">",q},ie.text=function(Y){return Y},le}(),Re=function(){function le(){}var ie=le.prototype;return ie.strong=function(Y){return Y},ie.em=function(Y){return Y},ie.codespan=function(Y){return Y},ie.del=function(Y){return Y},ie.html=function(Y){return Y},ie.text=function(Y){return Y},ie.link=function(Y,$,J){return""+J},ie.image=function(Y,$,J){return""+J},ie.br=function(){return""},le}(),Ke=function(){function le(){this.seen={}}var ie=le.prototype;return ie.slug=function(Y){var $=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var J=$;do this.seen[J]++,$=J+"-"+this.seen[J];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},le}(),ze=N.defaults,Ge=X.unescape,He=function(){function le(ee){this.options=ee||ze,this.options.renderer=this.options.renderer||new Ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Re,this.slugger=new Ke}le.parse=function(Y,$){var J=new le($);return J.parse(Y)};var ie=le.prototype;return ie.parse=function(Y,$){$===void 0&&($=!0);var J="",q,ue,ge,_e,Ve,Qe,Ze,st,pt,tt,Rt,vt,It,Ut,xt,$t,gr,ir,sr=Y.length;for(q=0;q<sr;q++){tt=Y[q];switch(tt.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(tt.tokens),tt.depth,Ge(this.parseInline(tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(tt.text,tt.lang,tt.escaped);continue}case"table":{for(st="",Ze="",_e=tt.header.length,ue=0;ue<_e;ue++)Ze+=this.renderer.tablecell(this.parseInline(tt.tokens.header[ue]),{header:!0,align:tt.align[ue]});for(st+=this.renderer.tablerow(Ze),pt="",_e=tt.cells.length,ue=0;ue<_e;ue++){for(Qe=tt.tokens.cells[ue],Ze="",Ve=Qe.length,ge=0;ge<Ve;ge++)Ze+=this.renderer.tablecell(this.parseInline(Qe[ge]),{header:!1,align:tt.align[ge]});pt+=this.renderer.tablerow(Ze)}J+=this.renderer.table(st,pt);continue}case"blockquote":{pt=this.parse(tt.tokens),J+=this.renderer.blockquote(pt);continue}case"list":{for(Rt=tt.ordered,vt=tt.start,It=tt.loose,_e=tt.items.length,pt="",ue=0;ue<_e;ue++)xt=tt.items[ue],$t=xt.checked,gr=xt.task,Ut="",xt.task&&(ir=this.renderer.checkbox($t),It?xt.tokens.length>0&&xt.tokens[0].type==="text"?(xt.tokens[0].text=ir+" "+xt.tokens[0].text,xt.tokens[0].tokens&&xt.tokens[0].tokens.length>0&&xt.tokens[0].tokens[0].type==="text"&&(xt.tokens[0].tokens[0].text=ir+" "+xt.tokens[0].tokens[0].text)):xt.tokens.unshift({type:"text",text:ir}):Ut+=ir),Ut+=this.parse(xt.tokens,It),pt+=this.renderer.listitem(Ut,gr,$t);J+=this.renderer.list(pt,Rt,vt);continue}case"html":{J+=this.renderer.html(tt.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(tt.tokens));continue}case"text":{for(pt=tt.tokens?this.parseInline(tt.tokens):tt.text;q+1<sr&&Y[q+1].type==="text";)tt=Y[++q],pt+=`
`+(tt.tokens?this.parseInline(tt.tokens):tt.text);J+=$?this.renderer.paragraph(pt):pt;continue}default:{var Jt='Token with "'+tt.type+'" type was not found.';if(this.options.silent){console.error(Jt);return}else throw new Error(Jt)}}}return J},ie.parseInline=function(Y,$){$=$||this.renderer;var J="",q,ue,ge=Y.length;for(q=0;q<ge;q++){ue=Y[q];switch(ue.type){case"escape":{J+=$.text(ue.text);break}case"html":{J+=$.html(ue.text);break}case"link":{J+=$.link(ue.href,ue.title,this.parseInline(ue.tokens,$));break}case"image":{J+=$.image(ue.href,ue.title,ue.text);break}case"strong":{J+=$.strong(this.parseInline(ue.tokens,$));break}case"em":{J+=$.em(this.parseInline(ue.tokens,$));break}case"codespan":{J+=$.codespan(ue.text);break}case"br":{J+=$.br();break}case"del":{J+=$.del(this.parseInline(ue.tokens,$));break}case"text":{J+=$.text(ue.text);break}default:{var _e='Token with "'+ue.type+'" type was not found.';if(this.options.silent){console.error(_e);return}else throw new Error(_e)}}}return J},le}(),ot=X.merge,Xe=X.checkSanitizeDeprecation,Be=X.escape,be=N.getDefaults,qe=N.changeDefaults,Ye=N.defaults;function Se(le,ie,ee){if(typeof le=="undefined"||le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(le)+", string expected");if(typeof ie=="function"&&(ee=ie,ie=null),ie=ot({},Se.defaults,ie||{}),Xe(ie),ee){var Y=ie.highlight,$;try{$=me.lex(le,ie)}catch(ge){return ee(ge)}var J=function(_e){var Ve;if(!_e)try{Ve=He.parse($,ie)}catch(Qe){_e=Qe}return ie.highlight=Y,_e?ee(_e):ee(null,Ve)};if(!Y||Y.length<3)return J();if(delete ie.highlight,!$.length)return J();var q=0;Se.walkTokens($,function(ge){ge.type==="code"&&(q++,setTimeout(function(){Y(ge.text,ge.lang,function(_e,Ve){if(_e)return J(_e);Ve!=null&&Ve!==ge.text&&(ge.text=Ve,ge.escaped=!0),q--,q===0&&J()})},0))}),q===0&&J();return}try{var ue=me.lex(le,ie);return ie.walkTokens&&Se.walkTokens(ue,ie.walkTokens),He.parse(ue,ie)}catch(ge){if(ge.message+=`
Please report this to https://github.com/markedjs/marked.`,ie.silent)return"<p>An error occurred:</p><pre>"+Be(ge.message+"",!0)+"</pre>";throw ge}}Se.options=Se.setOptions=function(le){return ot(Se.defaults,le),qe(Se.defaults),Se},Se.getDefaults=be,Se.defaults=Ye,Se.use=function(le){var ie=ot({},le);if(le.renderer&&function(){var Y=Se.defaults.renderer||new Ae,$=function(ue){var ge=Y[ue];Y[ue]=function(){for(var _e=arguments.length,Ve=new Array(_e),Qe=0;Qe<_e;Qe++)Ve[Qe]=arguments[Qe];var Ze=le.renderer[ue].apply(Y,Ve);return Ze===!1&&(Ze=ge.apply(Y,Ve)),Ze}};for(var J in le.renderer)$(J);ie.renderer=Y}(),le.tokenizer&&function(){var Y=Se.defaults.tokenizer||new he,$=function(ue){var ge=Y[ue];Y[ue]=function(){for(var _e=arguments.length,Ve=new Array(_e),Qe=0;Qe<_e;Qe++)Ve[Qe]=arguments[Qe];var Ze=le.tokenizer[ue].apply(Y,Ve);return Ze===!1&&(Ze=ge.apply(Y,Ve)),Ze}};for(var J in le.tokenizer)$(J);ie.tokenizer=Y}(),le.walkTokens){var ee=Se.defaults.walkTokens;ie.walkTokens=function(Y){le.walkTokens(Y),ee&&ee(Y)}}Se.setOptions(ie)},Se.walkTokens=function(le,ie){for(var ee=M(le),Y;!(Y=ee()).done;){var $=Y.value;ie($);switch($.type){case"table":{for(var J=M($.tokens.header),q;!(q=J()).done;){var ue=q.value;Se.walkTokens(ue,ie)}for(var ge=M($.tokens.cells),_e;!(_e=ge()).done;)for(var Ve=_e.value,Qe=M(Ve),Ze;!(Ze=Qe()).done;){var st=Ze.value;Se.walkTokens(st,ie)}break}case"list":{Se.walkTokens($.items,ie);break}default:$.tokens&&Se.walkTokens($.tokens,ie)}}},Se.Parser=He,Se.parser=He.parse,Se.Renderer=Ae,Se.TextRenderer=Re,Se.Lexer=me,Se.lexer=me.lex,Se.Tokenizer=he,Se.Slugger=Ke,Se.parse=Se;var ke=Se;return ke})},ELLl:function(mt,et,Q){(function(te){te(Q("VrN/"))})(function(te){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=te.Pos;te.defineOption("autoCloseBrackets",!1,function(y,g,u){u&&u!=te.Init&&(y.removeKeyMap(M),y.state.closeBrackets=null),g&&(R(W(g,"pairs")),y.state.closeBrackets=g,y.addKeyMap(M))});function W(y,g){return g=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[g]!=null?y[g]:G[g]}var M={Backspace:D,Enter:O};function R(y){for(var g=0;g<y.length;g++){var u=y.charAt(g),o="'"+u+"'";M[o]||(M[o]=N(u))}}R(G.pairs+"`");function N(y){return function(g){return T(g,y)}}function k(y){var g=y.state.closeBrackets;if(!g||g.override)return g;var u=y.getModeAt(y.getCursor());return u.closeBrackets||g}function D(y){var g=k(y);if(!g||y.getOption("disableInput"))return te.Pass;for(var u=W(g,"pairs"),o=y.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return te.Pass;var d=_(y,o[l].head);if(!d||u.indexOf(d)%2!=0)return te.Pass}for(var l=o.length-1;l>=0;l--){var w=o[l].head;y.replaceRange("",A(w.line,w.ch-1),A(w.line,w.ch+1),"+delete")}}function O(y){var g=k(y),u=g&&W(g,"explode");if(!u||y.getOption("disableInput"))return te.Pass;for(var o=y.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return te.Pass;var d=_(y,o[l].head);if(!d||u.indexOf(d)%2!=0)return te.Pass}y.operation(function(){var w=y.lineSeparator()||`
`;y.replaceSelection(w+w,null),y.execCommand("goCharLeft"),o=y.listSelections();for(var f=0;f<o.length;f++){var m=o[f].head.line;y.indentLine(m,null,!0),y.indentLine(m+1,null,!0)}})}function E(y){var g=te.cmpPos(y.anchor,y.head)>0;return{anchor:new A(y.anchor.line,y.anchor.ch+(g?-1:1)),head:new A(y.head.line,y.head.ch+(g?1:-1))}}function T(y,g){var u=k(y);if(!u||y.getOption("disableInput"))return te.Pass;var o=W(u,"pairs"),l=o.indexOf(g);if(l==-1)return te.Pass;for(var d=W(u,"closeBefore"),w=W(u,"triples"),f=o.charAt(l+1)==g,m=y.listSelections(),L=l%2==0,x,h=0;h<m.length;h++){var c=m[h],s=c.head,a,v=y.getRange(s,A(s.line,s.ch+1));if(L&&!c.empty())a="surround";else if((f||!L)&&v==g)f&&C(y,s)?a="both":w.indexOf(g)>=0&&y.getRange(s,A(s.line,s.ch+3))==g+g+g?a="skipThree":a="skip";else if(f&&s.ch>1&&w.indexOf(g)>=0&&y.getRange(A(s.line,s.ch-2),s)==g+g){if(s.ch>2&&/\bstring/.test(y.getTokenTypeAt(A(s.line,s.ch-2))))return te.Pass;a="addFour"}else if(f){var p=s.ch==0?" ":y.getRange(A(s.line,s.ch-1),s);if(!te.isWordChar(v)&&p!=g&&!te.isWordChar(p))a="both";else return te.Pass}else if(L&&(v.length===0||/\s/.test(v)||d.indexOf(v)>-1))a="both";else return te.Pass;if(!x)x=a;else if(x!=a)return te.Pass}var b=l%2?o.charAt(l-1):g,P=l%2?g:o.charAt(l+1);y.operation(function(){if(x=="skip")y.execCommand("goCharRight");else if(x=="skipThree")for(var F=0;F<3;F++)y.execCommand("goCharRight");else if(x=="surround"){for(var H=y.getSelections(),F=0;F<H.length;F++)H[F]=b+H[F]+P;y.replaceSelections(H,"around"),H=y.listSelections().slice();for(var F=0;F<H.length;F++)H[F]=E(H[F]);y.setSelections(H)}else x=="both"?(y.replaceSelection(b+P,null),y.triggerElectric(b+P),y.execCommand("goCharLeft")):x=="addFour"&&(y.replaceSelection(b+b+b+b,"before"),y.execCommand("goCharRight"))})}function _(y,g){var u=y.getRange(A(g.line,g.ch-1),A(g.line,g.ch+1));return u.length==2?u:null}function C(y,g){var u=y.getTokenAt(A(g.line,g.ch+1));return/\bstring/.test(u.type)&&u.start==g.ch&&(g.ch==0||!/\bstring/.test(y.getTokenTypeAt(g)))}})},HmJG:function(mt,et,Q){},LSTS:function(mt,et,Q){"use strict";Object.defineProperty(et,"__esModule",{value:!0});var te=function(){function T(_,C){for(var y=0;y<C.length;y++){var g=C[y];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(_,g.key,g)}}return function(_,C,y){return C&&T(_.prototype,C),y&&T(_,y),_}}(),G=Q("q1tI"),A=R(G),W=Q("17x9"),M=R(W);function R(T){return T&&T.__esModule?T:{default:T}}function N(T,_){var C={};for(var y in T){if(_.indexOf(y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(T,y))continue;C[y]=T[y]}return C}function k(T,_){if(!(T instanceof _))throw new TypeError("Cannot call a class as a function")}function D(T,_){if(!T)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:T}function O(T,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);T.prototype=Object.create(_&&_.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(T,_):T.__proto__=_)}var E=function(T){O(_,T);function _(C){k(this,_);var y=D(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,C));return y.scrollListener=y.scrollListener.bind(y),y.eventListenerOptions=y.eventListenerOptions.bind(y),y.mousewheelListener=y.mousewheelListener.bind(y),y}return te(_,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var y=this.getParentElement(this.scrollComponent);y.scrollTop=y.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var y=!1,g={get passive(){y=!0}};try{document.addEventListener("test",null,g),document.removeEventListener("test",null,g)}catch(u){}return y}},{key:"eventListenerOptions",value:function(){var y=this.props.useCapture;return this.isPassiveSupported()&&(y={useCapture:this.props.useCapture,passive:!0}),y}},{key:"setDefaultLoader",value:function(y){this.defaultLoader=y}},{key:"detachMousewheelListener",value:function(){var y=window;this.props.useWindow===!1&&(y=this.scrollComponent.parentNode),y.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var y=window;this.props.useWindow===!1&&(y=this.getParentElement(this.scrollComponent)),y.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),y.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(y){var g=this.props.getScrollParent&&this.props.getScrollParent();return g!=null?g:y&&y.parentNode}},{key:"filterProps",value:function(y){return y}},{key:"attachScrollListener",value:function(){var y=this.getParentElement(this.scrollComponent);if(!this.props.hasMore||!y)return;var g=window;this.props.useWindow===!1&&(g=y),g.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),g.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),g.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}},{key:"mousewheelListener",value:function(y){y.deltaY===1&&!this.isPassiveSupported()&&y.preventDefault()}},{key:"scrollListener",value:function(){var y=this.scrollComponent,g=window,u=this.getParentElement(y),o=void 0;if(this.props.useWindow){var l=document.documentElement||document.body.parentNode||document.body,d=g.pageYOffset!==void 0?g.pageYOffset:l.scrollTop;this.props.isReverse?o=d:o=this.calculateOffset(y,d)}else this.props.isReverse?o=u.scrollTop:o=y.scrollHeight-u.scrollTop-u.clientHeight;o<Number(this.props.threshold)&&y&&y.offsetParent!==null&&(this.detachScrollListener(),this.beforeScrollHeight=u.scrollHeight,this.beforeScrollTop=u.scrollTop,typeof this.props.loadMore=="function"&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function(y,g){return y?this.calculateTopPosition(y)+(y.offsetHeight-g-window.innerHeight):0}},{key:"calculateTopPosition",value:function(y){return y?y.offsetTop+this.calculateTopPosition(y.offsetParent):0}},{key:"render",value:function(){var y=this,g=this.filterProps(this.props),u=g.children,o=g.element,l=g.hasMore,d=g.initialLoad,w=g.isReverse,f=g.loader,m=g.loadMore,L=g.pageStart,x=g.ref,h=g.threshold,c=g.useCapture,s=g.useWindow,a=g.getScrollParent,v=N(g,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);v.ref=function(b){y.scrollComponent=b,x&&x(b)};var p=[u];return l&&(f?w?p.unshift(f):p.push(f):this.defaultLoader&&(w?p.unshift(this.defaultLoader):p.push(this.defaultLoader))),A.default.createElement(o,v,p)}}]),_}(G.Component);E.propTypes={children:M.default.node.isRequired,element:M.default.node,hasMore:M.default.bool,initialLoad:M.default.bool,isReverse:M.default.bool,loader:M.default.node,loadMore:M.default.func.isRequired,pageStart:M.default.number,ref:M.default.func,getScrollParent:M.default.func,threshold:M.default.number,useCapture:M.default.bool,useWindow:M.default.bool},E.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},et.default=E,mt.exports=et.default},LdHM:function(mt,et,Q){"use strict";Q.d(et,"b",function(){return d}),Q.d(et,"a",function(){return f});var te=Q("1OyB"),G=Q("vuIU"),A=Q("Ji7U"),W=Q("LK+K"),M=Q("q1tI"),R=Q("rePB"),N=Q("Ff2n"),k=Q("ODXe"),D=Q("4IlW"),O=Q("bX4T"),E=Q("YrtM"),T=Q("TSYQ"),_=Q.n(T),C=Q("+nKL"),y=Q("8OUc"),g=function(z,Z){var ne=z.prefixCls,oe=z.id,Ce=z.flattenOptions,he=z.childrenAsData,we=z.values,ve=z.searchValue,pe=z.multiple,se=z.defaultActiveFirstOption,de=z.height,Le=z.itemHeight,We=z.notFoundContent,Te=z.open,xe=z.menuItemSelectedIcon,Oe=z.virtual,ye=z.onSelect,me=z.onToggleOpen,Me=z.onActiveValue,Ne=z.onScroll,Ie=z.onMouseEnter,Ae="".concat(ne,"-item"),Re=Object(E.a)(function(){return Ce},[Te,Ce],function(ke,le){return le[0]&&ke[1]!==le[1]}),Ke=M.useRef(null),ze=function(le){le.preventDefault()},Ge=function(le){Ke.current&&Ke.current.scrollTo({index:le})},He=function(le){for(var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ee=Re.length,Y=0;Y<ee;Y+=1){var $=(le+Y*ie+ee)%ee,J=Re[$],q=J.group,ue=J.data;if(!q&&!ue.disabled)return $}return-1},ot=M.useState(function(){return He(0)}),Xe=Object(k.a)(ot,2),Be=Xe[0],be=Xe[1],qe=function(le){be(le);var ie=Re[le];if(!ie){Me(null,-1);return}Me(ie.data.value,le)};M.useEffect(function(){qe(se!==!1?He(0):-1)},[Re.length,ve]),M.useEffect(function(){var ke=setTimeout(function(){if(!pe&&Te&&we.size===1){var le=Array.from(we)[0],ie=Re.findIndex(function(ee){var Y=ee.data;return Y.value===le});qe(ie),Ge(ie)}});return function(){return clearTimeout(ke)}},[Te]);var Ye=function(le){le!==void 0&&ye(le,{selected:!we.has(le)}),pe||me(!1)};if(M.useImperativeHandle(Z,function(){return{onKeyDown:function(le){var ie=le.which;switch(ie){case D.a.UP:case D.a.DOWN:{var ee=0;if(ie===D.a.UP?ee=-1:ie===D.a.DOWN&&(ee=1),ee!==0){var Y=He(Be+ee,ee);Ge(Y),qe(Y)}break}case D.a.ENTER:{var $=Re[Be];$&&!$.data.disabled?Ye($.data.value):Ye(void 0),Te&&le.preventDefault();break}case D.a.ESC:me(!1)}},onKeyUp:function(){},scrollTo:function(le){Ge(le)}}}),Re.length===0)return M.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Ae,"-empty"),onMouseDown:ze},We);function Se(ke){var le=Re[ke];if(!le)return null;var ie=le.data||{},ee=ie.value,Y=ie.label,$=ie.children,J=Object(O.a)(ie,!0),q=he?$:Y;return le?M.createElement("div",Object.assign({"aria-label":typeof q=="string"?q:null},J,{key:ke,role:"option",id:"".concat(oe,"_list_").concat(ke),"aria-selected":we.has(ee)}),ee):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Se(Be-1),Se(Be),Se(Be+1)),M.createElement(C.a,{itemKey:"key",ref:Ke,data:Re,height:de,itemHeight:Le,fullHeight:!1,onMouseDown:ze,onScroll:Ne,virtual:Oe,onMouseEnter:Ie},function(ke,le){var ie,ee=ke.group,Y=ke.groupOption,$=ke.data,J=$.label,q=$.key;if(ee)return M.createElement("div",{className:_()(Ae,"".concat(Ae,"-group"))},J!==void 0?J:q);var ue=$.disabled,ge=$.value,_e=$.title,Ve=$.children,Qe=$.style,Ze=$.className,st=Object(N.a)($,["disabled","value","title","children","style","className"]),pt=we.has(ge),tt="".concat(Ae,"-option"),Rt=_()(Ae,tt,Ze,(ie={},Object(R.a)(ie,"".concat(tt,"-grouped"),Y),Object(R.a)(ie,"".concat(tt,"-active"),Be===le&&!ue),Object(R.a)(ie,"".concat(tt,"-disabled"),ue),Object(R.a)(ie,"".concat(tt,"-selected"),pt),ie)),vt=he?Ve:J,It=!xe||typeof xe=="function"||pt;return M.createElement("div",Object.assign({},st,{"aria-selected":pt,className:Rt,title:_e,onMouseMove:function(){if(Be===le||ue)return;qe(le)},onClick:function(){ue||Ye(ge)},style:Qe}),M.createElement("div",{className:"".concat(tt,"-content")},vt||ge),M.isValidElement(xe)||pt,It&&M.createElement(y.a,{className:"".concat(Ae,"-option-state"),customizeIcon:xe,customizeIconProps:{isSelected:pt}},pt?"\u2713":null))}))},u=M.forwardRef(g);u.displayName="OptionList";var o=u,l=function(){return null};l.isSelectOption=!0;var d=l,w=function(){return null};w.isSelectOptGroup=!0;var f=w,m=Q("VTBJ"),L=Q("Zm9Q");function x(U){var z=U.key,Z=U.props,ne=Z.children,oe=Z.value,Ce=Object(N.a)(Z,["children","value"]);return Object(m.a)({key:z,value:oe!==void 0?oe:z,children:ne},Ce)}function h(U){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(U).map(function(Z,ne){if(!M.isValidElement(Z)||!Z.type)return null;var oe=Z.type.isSelectOptGroup,Ce=Z.key,he=Z.props,we=he.children,ve=Object(N.a)(he,["children"]);return z||!oe?x(Z):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?ne:Ce,"__"),label:Ce},ve),{},{options:h(we)})}).filter(function(Z){return Z})}var c=Q("2Qr1"),s=Q("qNPg"),a=Q("U8pU"),v=Q("Kwbf"),p=Q("WKfj");function b(U){var z=U.mode,Z=U.options,ne=U.children,oe=U.backfill,Ce=U.allowClear,he=U.placeholder,we=U.getInputElement,ve=U.showSearch,pe=U.onSearch,se=U.defaultOpen,de=U.autoFocus,Le=U.labelInValue,We=U.value,Te=U.inputValue,xe=U.optionLabelProp,Oe=z==="multiple"||z==="tags",ye=ve!==void 0?ve:Oe||z==="combobox",me=Z||h(ne);if(Object(v.a)(z!=="tags"||me.every(function(Ae){return!Ae.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),z==="tags"||z==="combobox"){var Me=me.some(function(Ae){return Ae.options?Ae.options.some(function(Re){return typeof("value"in Re?Re.value:Re.key)=="number"}):typeof("value"in Ae?Ae.value:Ae.key)=="number"});Object(v.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(z!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(z==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(v.a)(z==="combobox"||!we,"`getInputElement` only work with `combobox` mode."),Object(v.b)(z!=="combobox"||!we||!Ce||!he,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!ye&&z!=="combobox"&&z!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!se||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),We!=null){var Ne=Object(p.d)(We);Object(v.a)(!Le||Ne.every(function(Ae){return Object(a.a)(Ae)==="object"&&("key"in Ae||"value"in Ae)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Oe||Array.isArray(We),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var Ie=null;Object(L.a)(ne).some(function(Ae){if(!M.isValidElement(Ae)||!Ae.type)return!1;var Re=Ae.type;if(Re.isSelectOption)return!1;if(Re.isSelectOptGroup){var Ke=Object(L.a)(Ae.props.children).every(function(ze){return!M.isValidElement(ze)||!Ae.type||ze.type.isSelectOption?!0:(Ie=ze.type,!1)});return!Ke}return Ie=Re,!0}),Ie&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(v.a)(Te===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=b,F=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:P,fillOptionsWithMissingValue:c.a}),H=function(U){Object(A.a)(Z,U);var z=Object(W.a)(Z);function Z(){var ne;return Object(te.a)(this,Z),ne=z.apply(this,arguments),ne.selectRef=M.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(G.a)(Z,[{key:"render",value:function(){return M.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Z}(M.Component);H.Option=d,H.OptGroup=f;var X=H,B=et.c=X},M8RZ:function(mt,et,Q){"use strict";Q.d(et,"a",function(){return D});var te=Q("fWQN"),G=Q("mtLc"),A=Q("yKVA"),W=Q("879j"),M=Q("q1tI"),R=Q.n(M),N=Q("i8i4"),k=Q.n(N),D=function(O){Object(A.a)(T,O);var E=Object(W.a)(T);function T(_){var C;Object(te.a)(this,T),C=E.call(this,_);var y=window.document;return C.node=y.createElement("div"),y.body.appendChild(C.node),C}return Object(G.a)(T,[{key:"render",value:function(){var C=this.props.children;return Object(N.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(R.a.Component)},Ot1p:function(mt,et,Q){"use strict";var te=Q("2qtc"),G=Q("kLXV"),A=Q("rAM+"),W=Q("miYZ"),M=Q("tsqr"),R=Q("tJVT"),N=Q("jrin"),k=Q("q1tI"),D=Q.n(k),O=Q("VrN/"),E=Q.n(O),T=Q("bdgK"),_=Q("p77/"),C=Q("Bd2K"),y=Q("ELLl"),g=Q("19Vz"),u=Q("lZu9"),o=Q("+NIl"),l=Q("kSUc"),d=Q("9Bee"),w=function(ee){var Y=ee.value,$=Y===void 0?"":Y,J=ee.className,q=ee.showTextOnly,ue=ee.showLines,ge=ee.style,_e=ge===void 0?{}:ge,Ve=Object(k.useMemo)(function(){return""},[$]);return D.a.createElement(D.a.Fragment,null,D.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ve}}))},f=Q("0Owb"),m=Q("dejd"),L=Q("C+DQ"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function h(ee){var Y=ee.onActionCallback,$=ee.title,J=ee.icon,q=ee.actionName,ue=ee.className,ge=ue===void 0?"":ue,_e=ee.children;function Ve(){Y(q)}return D.a.createElement("a",{title:$,className:ge,onClick:Ve},D.a.createElement("i",{className:"md-iconfont ".concat(J)}),_e)}var c=function(ee){var Y=ee.watch,$=ee.showNullButton,J=ee.onActionCallback,q=ee.fullScreen,ue=ee.insertTemp,ge=ee.hidetoolBar,_e=[].concat(x,[{title:"".concat(Y?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Y?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return D.a.createElement("ul",{className:"markdown-toolbar-container"},!ge&&_e.map(function(Ve,Qe){return D.a.createElement("li",{key:Qe},Ve.actionName?D.a.createElement(h,Object(f.a)({},Ve,{onActionCallback:J})):D.a.createElement("span",{className:"v-line"}))}),$?D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:J},D.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ue&&D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ue),onActionCallback:J},D.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),D.a.createElement("li",{className:"btn-full-screen"},D.a.createElement(h,{icon:"".concat(q?"icon-shrink":"icon-enlarge"),title:q?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:J})))},s=Q("M8RZ"),a=Q("+L6B"),v=Q("2/Rp"),p=Q("y8nQ"),b=Q("Vl3Y"),P=Q("5NDa"),F=Q("5rEg"),H={labelCol:{span:4},wrapperCol:{span:20}},X=function(ee){var Y=ee.callback,$=ee.onCancel;function J(q){Y(q)}return D.a.createElement(b.a,Object(f.a)({},H,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:J}),D.a.createElement(b.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},D.a.createElement(F.a,null)),D.a.createElement(b.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},D.a.createElement(F.a,null)),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(v.a,{type:"ghost",onClick:$},"\u53D6\u6D88")))},B=Q("7ahc"),U=Q("HmJG"),z=Q("BjJ7"),Z=b.a.useForm,ne={width:280,marginRight:10},oe={labelCol:{span:5},wrapperCol:{span:19}},Ce=function(ee){var Y=ee.callback,$=ee.onCancel,J=Z(),q=Object(R.a)(J,1),ue=q[0];function ge(Qe){Y(Qe)}function _e(Qe,Ze){ue.setFieldsValue({src:"/api/attachments/".concat(Qe.id),type:Ze.type})}function Ve(Qe){var Ze=Qe.target.files[0];we(Ze,_e)}return D.a.createElement(b.a,Object(f.a)({form:ue},oe,{className:"upload-image-panel",onFinish:ge}),D.a.createElement(b.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},D.a.createElement("div",{className:"flex-container"},D.a.createElement(b.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},D.a.createElement(F.a,{style:ne})),D.a.createElement(he,{onFileChange:Ve}))),D.a.createElement(b.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},D.a.createElement(F.a,{style:{width:264}})),D.a.createElement(b.a.Item,{style:{textAlign:"right"}},D.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(v.a,{type:"ghost",onClick:$},"\u53D6\u6D88")))};function he(ee){var Y=ee.onFileChange;return D.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",D.a.createElement("input",{type:"file",onChange:Y}))}function we(ee,Y){if(!ee)throw new String("\u6CA1\u6709\u6587\u4EF6");var $=new FormData;$.append("editormd-image-file",ee),$.append("file_param_name","editormd-image-file"),$.append("byxhr","true");var J=new window.XMLHttpRequest;J.withCredentials=!0,J.addEventListener("load",function(q){Y(JSON.parse(q.target.responseText),ee)},!1),J.addEventListener("error",function(q){console.error(q)},!1),J.open("POST","".concat(z.a,"/api/attachments.json")),J.send($)}var ve=Q("giR+"),pe=Q("fyUT"),se=Q("7Kak"),de=Q("9yH6"),Le=de.a.Group,We={margin:"0 8px"},Te=function(ee){var Y=ee.callback,$=ee.onCancel;function J(q){Y(q)}return D.a.createElement(b.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:J},D.a.createElement("div",{className:"flex-container"},D.a.createElement("span",{style:We},"\u5355\u5143\u683C\u6570\uFF1A"),D.a.createElement("span",{style:We},"\u884C\u6570"),D.a.createElement(b.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},D.a.createElement(pe.a,null)),D.a.createElement("span",{style:We},"\u5217\u6570"),D.a.createElement(b.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},D.a.createElement(pe.a,null))),D.a.createElement("div",{className:"flex-container",style:{marginTop:12}},D.a.createElement("span",{style:We},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),D.a.createElement(b.a.Item,{name:"align"},D.a.createElement(Le,null,D.a.createElement(de.a,{value:"default"},D.a.createElement("i",{className:"fa fa-align-justify"})),D.a.createElement(de.a,{value:"left"},D.a.createElement("i",{className:"fa fa-align-left"})),D.a.createElement(de.a,{value:"center"},D.a.createElement("i",{className:"fa fa-align-center"})),D.a.createElement(de.a,{value:"right"},D.a.createElement("i",{className:"fa fa-align-right"}))))),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(v.a,{type:"ghost",onClick:$},"\u53D6\u6D88")))},xe=Q("m3rI"),Oe=Q("wMS7"),ye=Q.n(Oe),me="link",Me="upload-image",Ne="code-block",Ie="add-table",Ae="------------",Re={default:Ae,left:":".concat(Ae),center:":".concat(Ae,":"),right:"".concat(Ae,":")},Ke=Q("9VGf"),ze,Ge;function He(){}var ot=0,Xe=1e4,Be="\u2581",be=`
**\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 qe(ee){return/^\d+$/.test(ee)?"".concat(ee,"px"):ee}var Ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,Se=Ye?"Cmd":"Ctrl",ke=(ze={},Object(N.a)(ze,Se+"-B","bold"),Object(N.a)(ze,Se+"-I","italic"),ze),le=(Ge={},Object(N.a)(Ge,me,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Ge,Ne,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Ge,Me,"\u6DFB\u52A0\u56FE\u7247"),Object(N.a)(Ge,Ie,"\u6DFB\u52A0\u8868\u683C"),Ge),ie=et.a=function(ee){var Y=ee.defaultValue,$=Y===void 0?"":Y,J=ee.onChange,q=ee.width,ue=q===void 0?"100%":q,ge=ee.height,_e=ge===void 0?400:ge,Ve=ee.miniToolbar,Qe=Ve===void 0?!1:Ve,Ze=ee.isFocus,st=Ze===void 0?!1:Ze,pt=ee.watch,tt=ee.insertTemp,Rt=ee.mode,vt=Rt===void 0?"markdown":Rt,It=ee.id,Ut=It===void 0?"markdown-editor-id":It,xt=ee.showResizeBar,$t=xt===void 0?!1:xt,gr=ee.noStorage,ir=gr===void 0?!1:gr,sr=ee.showNullButton,Jt=sr===void 0?!1:sr,Wr=ee.hidetoolBar,wt=Wr===void 0?!1:Wr,Nt=ee.fullScreen,At=Nt===void 0?!1:Nt,Et=ee.onBlur,nt=ee.onCMBeforeChange,Ft=ee.onFullScreen,vr=ee.className,yr=vr===void 0?"":vr,St=ee.disablePaste,Dr=St===void 0?!1:St,Ir=ee.placeholder,Mr=Ir===void 0?"":Ir,Ue=ee.values,ft=Ue===void 0?"":Ue,_r=Object(k.useState)(null),Pr=Object(R.a)(_r,2),je=Pr[0],Vr=Pr[1],An=Object(k.useState)($),ct=Object(R.a)(An,2),cr=ct[0],Hr=ct[1],Xr=Object(k.useState)(pt),fr=Object(R.a)(Xr,2),kr=fr[0],dt=fr[1],Ee=Object(k.useState)(At),it=Object(R.a)(Ee,2),lt=it[0],Lt=it[1],hr=Object(k.useState)(""),Qt=Object(R.a)(hr,2),jt=Qt[0],Pt=Qt[1],Dn=Object(k.useState)(0),Cr=Object(R.a)(Dn,2),Ur=Cr[0],br=Cr[1],Ci=Object(k.useState)(_e),Li=Object(R.a)(Ci,2),mn=Li[0],rn=Li[1],Zi=Object(k.useState)(!1),Ai=Object(R.a)(Zi,2),Ba=Ai[0],Jn=Ai[1],Yr=Object(k.useRef)(),_n=Object(k.useRef)(),On=Object(k.useRef)(),pn=Object(k.useRef)();Object(k.useEffect)(function(){Hr(ft),je==null||je.setValue(ft)},[ft]),Object(k.useEffect)(function(){Ft==null||Ft(lt)},[lt]),Object(k.useEffect)(function(){if(Yr.current){var gt=E.a.fromTextArea(Yr.current,{mode:vt,lineNumbers:!Qe,lineWrapping:!0,value:$,autoCloseTags:!0,autoCloseBrackets:!0});st&&gt.focus();function yt(bt,Ct){if(Dr){Ct.preventDefault();return}var _t=Ct.clipboardData;if(_t){var kt=_t.types.toString(),Ht=_t.items,Zt=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(kt==="Files"||_t.types.indexOf("Files")>-1){if(Ct.preventDefault(),vt=="stex")return;try{var qt,Jr=Ht[1];((qt=Ht[0])===null||qt===void 0?void 0:qt.kind)==="file"&&(Jr=Ht[0]);var zt=Jr.getAsFile(),an=zt.name.split(".").pop();we(zt,function(lr){if(lr.id){var Qr,Zr,qn;(zt==null||((Qr=zt.type)===null||Qr===void 0)?void 0:Qr.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(lr.id,"?type=").concat(lr.content_type,")")):(zt==null||((Zr=zt.type)===null||Zr===void 0)?void 0:Zr.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(xe.a.API_SERVER,"/api/attachments/").concat(lr.id,'"></video>')):(zt==null||((qn=zt.type)===null||qn===void 0)?void 0:qn.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(xe.a.API_SERVER,"/api/attachments/").concat(lr.id,"?type=").concat(zt.type,'&disposition=inline" target="_blank">').concat(zt.name,"</a>")):Zt.includes(an)?gt.replaceSelection('<a href="'.concat(xe.a.API_SERVER,"/api/attachments/").concat(lr.id,'?type=office&disposition=inline" target="_blank">').concat(zt.name,"</a>")):gt.replaceSelection("[".concat(zt.name,"](").concat(xe.a.API_SERVER,"/api/attachments/").concat(lr.id,"?type=").concat(lr.content_type,")"))}else(lr==null?void 0:lr.status)===401&&(document.location.href="/user/login")})}catch(lr){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return gt.on("paste",yt),Vr(gt),function(){gt.off("paste",yt)}}},[]);var Qn=Object(k.useCallback)(function(){if(_n.current)try{}catch(gt){console.log(gt,"---- to set md editor body height")}},[mn,_n,lt]);Object(k.useEffect)(function(){function gt(){var bt=new T.default(function(Ct){var _t=Object(A.a)(Ct),kt;try{for(_t.s();!(kt=_t.n()).done;){var Ht=kt.value;(Ht.target.offsetHeight>0||Ht.target.offsetWidth>0)&&(Qn(),je.setSize("100%","100%"),je.refresh())}}catch(Zt){_t.e(Zt)}finally{_t.f()}});return bt.observe(Yr.current.parentElement),bt}if(je){var yt=gt();return function(){yt.unobserve(Yr.current.parentElement)}}},[je,Qn]),Object(k.useEffect)(function(){if(je){for(var gt=[],yt=function(){var Ht=Ct[bt];_t=Object(R.a)(Ht,2);var Zt=_t[0],qt=_t[1],Jr=Object(N.a)({},Zt,function(){gn(qt)});gt.push(Jr),je.addKeyMap(Jr)},bt=0,Ct=Object.entries(ke);bt<Ct.length;bt++){var _t;yt()}return function(){var kt=Object(A.a)(gt),Ht;try{for(kt.s();!(Ht=kt.n()).done;){var Zt=Ht.value;je.removeKeyMap(Zt)}}catch(qt){kt.e(qt)}finally{kt.f()}}}},[je]),Object(k.useEffect)(function(){At!==lt&&Lt(At)},[At]),Object(Ke.a)(function(){if(!ir&&Ur>0){var gt=new Date().getTime(),yt=window.sessionStorage.getItem(Ut);gt>=Ur+Xe&&(!yt||yt!==cr)&&(window.sessionStorage.setItem(Ut,cr),Jn(!0))}},Xe),Object(k.useEffect)(function(){dt(pt)},[je,pt]),Object(k.useEffect)(function(){je&&(st&&je.focus())},[je,st]),Object(k.useEffect)(function(){if(kr&&je){var gt=je.getScrollerElement();function yt(bt){var Ct=bt.target;if(pn.current){var _t=Ct.scrollTop/Ct.scrollHeight;pn.current.scrollTop=pn.current.scrollHeight*_t}}return gt.addEventListener("scroll",yt),function(){gt.removeEventListener("scroll",yt)}}},[je,kr]),Object(k.useEffect)(function(){if(je&&nt){function gt(yt,bt){nt(yt,bt)}return je.on("beforeChange",gt),function(){je.off("beforeChange",gt)}}},[je,nt]),Object(k.useEffect)(function(){if(je&&Et){function gt(){Et(je.getValue())}return je.on("blur",gt),function(){je.off("blur",gt)}}},[je,Et]),Object(k.useEffect)(function(){if(je){function gt(yt){var bt=ye.a.sanitize(yt.getValue());Hr(bt),br(new Date().getTime()),yt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),J&&J(bt)}return je.on("change",gt),function(){je.off("change",gt)}}},[je,J]),Object(k.useEffect)(function(){je&&($==null?(je.setValue(""),Hr("")):$!==je.getValue()&&(je.setValue($),Hr($),je.setCursor(je.lineCount(),0)))},[je,$]);var gn=Object(k.useCallback)(function(gt){var yt=je.getCursor(),bt=je.getSelection(),Ct=bt.split(`
`);switch(gt){case"bold":return je.replaceSelection("**"+bt+"**"),bt===""&&je.setCursor(yt.line,yt.ch+2),je.focus();case"italic":return je.replaceSelection("*"+bt+"*"),bt===""&&je.setCursor(yt.line,yt.ch+1),je.focus();case"code":return je.replaceSelection("`"+bt+"`"),bt===""&&je.setCursor(yt.line,yt.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+bt+"$$`"),bt===""&&je.setCursor(yt.line,yt.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+bt+"\n```"),je.setCursor(yt.line+1,bt.length+1),je.focus();case"line-break":return je.replaceSelection(`<br/>
`),je.focus();case"list-ul":return bt===""?je.replaceSelection("- "+bt):je.replaceSelection(Ct.map(function(_t){return _t===""?"":"- ".concat(_t)}).join(`
`)),je.focus();case"list-ol":return bt===""?je.replaceSelection("1. "+bt):je.replaceSelection(Ct.map(function(_t,kt){return _t===""?"":"".concat(kt+1,". ").concat(_t)}).join(`
`)),je.focus();case"add-null-ch":return bt===""&&je.setCursor(yt.line,yt.ch+1),je.replaceSelection(Be),je.focus();case"inster-template-1":return bt===""&&je.setCursor(yt.line,yt.ch),je.replaceSelection(be),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return dt(!kr),je.focus();case"trigger-full-screen":return Lt(!lt),je.focus();case me:Pt(me);return;case Ne:Pt(Ne);return;case Me:Pt(Me);return;case Ie:Pt(Ie);return;default:throw new Error}},[je,kr,lt]),$r=Object(k.useCallback)(function(gt){Pt("");switch(jt){case me:var yt=gt.title,bt=gt.link;return je.replaceSelection("[".concat(yt,"](").concat(bt,")")),je.focus();case Ne:var Ct=gt.language,_t=gt.content;return je.replaceSelection(["```"+Ct,_t,"```"].join(`
`)),je.focus();case Me:var kt=gt.src,Ht=gt.alt;return je.replaceSelection("![ ".concat(Ht," ]( ").concat(kt,' "').concat(Ht,'" )')),je.focus();case Ie:for(var Zt=gt.row,qt=gt.col,Jr=gt.align,zt=`
`,an=0;an<Zt;an++){for(var lr=[],Qr=[],Zr=0;Zr<qt;Zr++)an===1&&Qr.push(Re[Jr]),lr.push(" ");an===1&&(zt+="| ".concat(Qr.join(" | "),` |
`)),zt+="| ".concat(lr.join(qt===1?"":" | "),` |
`)}return je.replaceSelection(zt+`
`),je.focus();default:throw new Error}},[je,jt]),Zn=Object(k.useMemo)(function(){switch(jt){case me:return D.a.createElement(X,{callback:$r,onCancel:nn});case Ne:return D.a.createElement(B.b,{callback:$r,onCancel:nn});case Me:return D.a.createElement(Ce,{callback:$r,onCancel:nn});case Ie:return D.a.createElement(Te,{callback:$r,onCancel:nn});default:return null}},[jt]);function nn(){Pt("")}Object(k.useEffect)(function(){if(On.current){var gt=On.current,yt=!1,bt=0;function Ct(Ht){yt=!0,bt=Ht.pageY}function _t(){yt=!1}function kt(Ht){if(yt){var Zt=Ht.pageY-bt;Zt<0&&(Zt=0),Zt>300&&(Zt=300);var qt=_e+Zt+"px";rn(qt)}}return gt.addEventListener("mousedown",Ct),document.addEventListener("mousemove",kt),document.addEventListener("mouseup",_t),function(){gt.removeEventListener("mousedown",Ct),document.removeEventListener("mousemove",kt),document.removeEventListener("mouseup",_t)}}},[je,On]),Object(k.useEffect)(function(){rn(_e)},[_e]);var Di=qe(ue),Rn=qe(mn),qi={width:Di,height:Rn},ea=Object(k.useMemo)(function(){if(Ur){var gt=new Date(Ur),yt=gt.getHours(),bt=gt.getMinutes(),Ct=gt.getSeconds();return yt=yt<10?"0"+yt:yt,bt=bt<10?"0"+bt:bt,Ct=Ct<10?"0"+Ct:Ct,"".concat(yt,":").concat(bt,":").concat(Ct)}return 0},[Ur]);function Nr(){window.sessionStorage.removeItem(Ut),Jn(!1),br(0)}function ja(){Jn(!1),br(0),je.setValue(window.sessionStorage.getItem(Ut))}return D.a.createElement(k.Fragment,null,D.a.createElement("div",{className:"markdown-editor-wrapper",ref:_n},D.a.createElement("div",{className:"markdown-editor-container ".concat(yr," ").concat(kr?"on-preview":""," ").concat(Qe?"mini":""," ").concat(lt?"full-screen":""),style:qi},D.a.createElement(c,{insertTemp:tt,watch:kr,fullScreen:lt,showNullButton:Jt,onActionCallback:gn,hidetoolBar:wt}),D.a.createElement("div",{className:"markdown-editor-body"},D.a.createElement("div",{className:"codemirror-container"},D.a.createElement("textarea",{ref:Yr,placeholder:Mr})),kr?D.a.createElement("div",{ref:pn,className:"preview-container"},vt==="stex"&&D.a.createElement(w,{value:cr}),vt!=="stex"&&D.a.createElement(d.a,{value:cr})):null))),$t?D.a.createElement("a",{ref:On,className:"editor-resize"}):null,D.a.createElement(s.a,null,le[jt]?D.a.createElement(G.a,{centered:!0,title:le[jt],visible:!0,onCancel:nn,footer:null},Zn):null))}},RotF:function(mt,et,Q){mt.exports=Q("LSTS")},SJMd:function(mt,et){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var Q,te,G,A=!1,W,M;window.PR_SHOULD_USE_CONTINUATION=!0;var R,N;(function(){var k=window,D=["break,continue,do,else,for,if,return,while"],O=[D,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],E=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],_=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[E,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],y="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",g=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[D,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[D,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[T,C,_,g,u,o,l,d],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",L="kwd",x="com",h="typ",c="lit",s="pun",a="pln",v="tag",p="dec",b="src",P="atn",F="atv",H="nocode",X="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(ye){for(var me=0,Me=!1,Ne=!1,Ie=0,Ae=ye.length;Ie<Ae;++Ie){var Re=ye[Ie];if(Re.ignoreCase)Ne=!0;else if(/[a-z]/i.test(Re.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,Ne=!1;break}}var Ke={b:8,t:9,n:10,v:11,f:12,r:13};function ze(Be){var be=Be.charCodeAt(0);if(be!==92)return be;var qe=Be.charAt(1);return be=Ke[qe],be||("0"<=qe&&qe<="7"?parseInt(Be.substring(1),8):qe==="u"||qe==="x"?parseInt(Be.substring(2),16):Be.charCodeAt(1))}function Ge(Be){if(Be<32)return(Be<16?"\\x0":"\\x")+Be.toString(16);var be=String.fromCharCode(Be);return be==="\\"||be==="-"||be==="]"||be==="^"?"\\"+be:be}function He(Be){var be=Be.substring(1,Be.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")),qe=[],Ye=be[0]==="^",Se=["["];Ye&&Se.push("^");for(var ke=Ye?1:0,le=be.length;ke<le;++ke){var ie=be[ke];if(/\\[bdsw]/i.test(ie))Se.push(ie);else{var ee=ze(ie),Y;ke+2<le&&be[ke+1]==="-"?(Y=ze(be[ke+2]),ke+=2):Y=ee,qe.push([ee,Y]),Y<65||ee>122||(Y<65||ee>90||qe.push([Math.max(65,ee)|32,Math.min(Y,90)|32]),Y<97||ee>122||qe.push([Math.max(97,ee)&~32,Math.min(Y,122)&~32]))}}qe.sort(function(ue,ge){return ue[0]-ge[0]||ge[1]-ue[1]});for(var $=[],J=[],ke=0;ke<qe.length;++ke){var q=qe[ke];q[0]<=J[1]+1?J[1]=Math.max(J[1],q[1]):$.push(J=q)}for(var ke=0;ke<$.length;++ke){var q=$[ke];Se.push(Ge(q[0])),q[1]>q[0]&&(q[1]+1>q[0]&&Se.push("-"),Se.push(Ge(q[1])))}return Se.push("]"),Se.join("")}function ot(Be){for(var be=Be.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")),qe=be.length,Ye=[],Se=0,ke=0;Se<qe;++Se){var le=be[Se];if(le==="(")++ke;else if(le.charAt(0)==="\\"){var ie=+le.substring(1);ie&&(ie<=ke?Ye[ie]=-1:be[Se]=Ge(ie))}}for(var Se=1;Se<Ye.length;++Se)Ye[Se]===-1&&(Ye[Se]=++me);for(var Se=0,ke=0;Se<qe;++Se){var le=be[Se];if(le==="(")++ke,Ye[ke]||(be[Se]="(?:");else if(le.charAt(0)==="\\"){var ie=+le.substring(1);ie&&ie<=ke&&(be[Se]="\\"+Ye[ie])}}for(var Se=0;Se<qe;++Se)be[Se]==="^"&&be[Se+1]!=="^"&&(be[Se]="");if(Be.ignoreCase&&Me)for(var Se=0;Se<qe;++Se){var le=be[Se],ee=le.charAt(0);le.length>=2&&ee==="["?be[Se]=He(le):ee!=="\\"&&(be[Se]=le.replace(/[a-zA-Z]/g,function(J){var q=J.charCodeAt(0);return"["+String.fromCharCode(q&~32,q|32)+"]"}))}return be.join("")}for(var Xe=[],Ie=0,Ae=ye.length;Ie<Ae;++Ie){var Re=ye[Ie];if(Re.global||Re.multiline)throw new Error(""+Re);Xe.push("(?:"+ot(Re)+")")}return new RegExp(Xe.join("|"),Ne?"gi":"g")}function U(ye,me){var Me=/(?:^|\s)nocode(?:\s|$)/,Ne=[],Ie=0,Ae=[],Re=0;function Ke(ze){var Ge=ze.nodeType;if(Ge==1){if(Me.test(ze.className))return;for(var He=ze.firstChild;He;He=He.nextSibling)Ke(He);var ot=ze.nodeName.toLowerCase();(ot==="br"||ot==="li")&&(Ne[Re]=`
`,Ae[Re<<1]=Ie++,Ae[Re++<<1|1]=ze)}else if(Ge==3||Ge==4){var Xe=ze.nodeValue;Xe.length&&(me?Xe=Xe.replace(/\r\n?/g,`
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Ne[Re]=Xe,Ae[Re<<1]=Ie,Ie+=Xe.length,Ae[Re++<<1|1]=ze)}}return Ke(ye),{sourceCode:Ne.join("").replace(/\n$/,""),spans:Ae}}function z(ye,me,Me,Ne,Ie){if(!Me)return;var Ae={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:me,decorations:null};Ne(Ae),Ie.push.apply(Ie,Ae.decorations)}var Z=/\S/;function ne(ye){for(var me=void 0,Me=ye.firstChild;Me;Me=Me.nextSibling){var Ne=Me.nodeType;me=Ne===1?me?ye:Me:Ne===3&&Z.test(Me.nodeValue)?ye:me}return me===ye?void 0:me}function oe(ye,me){var Me={},Ne;(function(){for(var Re=ye.concat(me),Ke=[],ze={},Ge=0,He=Re.length;Ge<He;++Ge){var ot=Re[Ge],Xe=ot[3];if(Xe)for(var Be=Xe.length;--Be>=0;)Me[Xe.charAt(Be)]=ot;var be=ot[1],qe=""+be;ze.hasOwnProperty(qe)||(Ke.push(be),ze[qe]=null)}Ke.push(/[\0-\uffff]/),Ne=B(Ke)})();var Ie=me.length,Ae=function(Re){for(var Ke=Re.sourceCode,ze=Re.basePos,Ge=Re.sourceNode,He=[ze,a],ot=0,Xe=Ke.match(Ne)||[],Be={},be=0,qe=Xe.length;be<qe;++be){var Ye=Xe[be],Se=Be[Ye],ke=void 0,le;if(typeof Se=="string")le=!1;else{var ie=Me[Ye.charAt(0)];if(ie)ke=Ye.match(ie[1]),Se=ie[0];else{for(var ee=0;ee<Ie;++ee)if(ie=me[ee],ke=Ye.match(ie[1]),ke){Se=ie[0];break}ke||(Se=a)}le=Se.length>=5&&Se.substring(0,5)==="lang-",le&&!(ke&&typeof ke[1]=="string")&&(le=!1,Se=b),le||(Be[Ye]=Se)}var Y=ot;if(ot+=Ye.length,!le)He.push(ze+Y,Se);else{var $=ke[1],J=Ye.indexOf($),q=J+$.length;ke[2]&&(q=Ye.length-ke[2].length,J=q-$.length);var ue=Se.substring(5);z(Ge,ze+Y,Ye.substring(0,J),Ae,He),z(Ge,ze+Y+J,$,de(ue,$),He),z(Ge,ze+Y+q,Ye.substring(q),Ae,He)}}Re.decorations=He};return Ae}function Ce(ye){var me=[],Me=[];ye.tripleQuotedStrings?me.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?me.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):me.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Me.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ne=ye.hashComments;Ne&&(ye.cStyleComments?(Ne>1?me.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):me.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):me.push([x,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Me.push([x,/^\/\/[^\r\n]*/,null]),Me.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=ye.regexLiterals;if(Ie){var Ae=Ie>1?"":`
\r`,Re=Ae?".":"[\\S\\s]",Ke="/(?=[^/*"+Ae+"])(?:[^/\\x5B\\x5C"+Ae+"]|\\x5C"+Re+"|\\x5B(?:[^\\x5C\\x5D"+Ae+"]|\\x5C"+Re+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+X+"("+Ke+")")])}var ze=ye.types;ze&&Me.push([h,ze]);var Ge=(""+ye.keywords).replace(/^ | $/g,"");Ge.length&&Me.push([L,new RegExp("^(?:"+Ge.replace(/[\s,]+/g,"|")+")\\b"),null]),me.push([a,/^\s+/,null,` \r
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(He+="(?!s*/)"),Me.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(He),null]),oe(me,Me)}var he=Ce({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function we(ye,me,Me){for(var Ne=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Ae=ye.ownerDocument,Re=Ae.createElement("li");ye.firstChild;)Re.appendChild(ye.firstChild);var Ke=[Re];function ze(be){var qe=be.nodeType;if(qe==1&&!Ne.test(be.className))if(be.nodeName==="br")Ge(be),be.parentNode&&be.parentNode.removeChild(be);else for(var Ye=be.firstChild;Ye;Ye=Ye.nextSibling)ze(Ye);else if((qe==3||qe==4)&&Me){var Se=be.nodeValue,ke=Se.match(Ie);if(ke){var le=Se.substring(0,ke.index);be.nodeValue=le;var ie=Se.substring(ke.index+ke[0].length);if(ie){var ee=be.parentNode;ee.insertBefore(Ae.createTextNode(ie),be.nextSibling)}Ge(be),le||be.parentNode.removeChild(be)}}}function Ge(be){for(;!be.nextSibling;)if(be=be.parentNode,!be)return;function qe(ke,le){var ie=le?ke.cloneNode(!1):ke,ee=ke.parentNode;if(ee){var Y=qe(ee,1),$=ke.nextSibling;Y.appendChild(ie);for(var J=$;J;J=$)$=J.nextSibling,Y.appendChild(J)}return ie}for(var Ye=qe(be.nextSibling,0),Se;(Se=Ye.parentNode)&&Se.nodeType===1;)Ye=Se;Ke.push(Ye)}for(var He=0;He<Ke.length;++He)ze(Ke[He]);me===(me|0)&&Ke[0].setAttribute("value",me);var ot=Ae.createElement("ol");ot.className="linenums";for(var Xe=Math.max(0,me-1|0)||0,He=0,Be=Ke.length;He<Be;++He)Re=Ke[He],Re.className="L"+(He+Xe)%10,Re.firstChild||Re.appendChild(Ae.createTextNode("\xA0")),ot.appendChild(Re);ye.appendChild(ot)}function ve(ye){var me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);me=me&&+me[1]<=8;var Me=/\n/g,Ne=ye.sourceCode,Ie=Ne.length,Ae=0,Re=ye.spans,Ke=Re.length,ze=0,Ge=ye.decorations,He=Ge.length,ot=0;Ge[He]=Ie;var Xe,Be;for(Be=Xe=0;Be<He;)Ge[Be]!==Ge[Be+2]?(Ge[Xe++]=Ge[Be++],Ge[Xe++]=Ge[Be++]):Be+=2;for(He=Xe,Be=Xe=0;Be<He;){for(var be=Ge[Be],qe=Ge[Be+1],Ye=Be+2;Ye+2<=He&&Ge[Ye+1]===qe;)Ye+=2;Ge[Xe++]=be,Ge[Xe++]=qe,Be=Ye}He=Ge.length=Xe;var Se=ye.sourceNode,ke="";Se&&(ke=Se.style.display,Se.style.display="none");try{for(var le=null;ze<Ke;){var ie=Re[ze],ee=Re[ze+2]||Ie,Y=Ge[ot+2]||Ie,Ye=Math.min(ee,Y),$=Re[ze+1],J;if($.nodeType!==1&&(J=Ne.substring(Ae,Ye))){me&&(J=J.replace(Me,"\r")),$.nodeValue=J;var q=$.ownerDocument,ue=q.createElement("span");ue.className=Ge[ot+1];var ge=$.parentNode;ge.replaceChild(ue,$),ue.appendChild($),Ae<ee&&(Re[ze+1]=$=q.createTextNode(Ne.substring(Ye,ee)),ge.insertBefore($,ue.nextSibling))}Ae=Ye,Ae>=ee&&(ze+=2),Ae>=Y&&(ot+=2)}}finally{Se&&(Se.style.display=ke)}}var pe={};function se(ye,me){for(var Me=me.length;--Me>=0;){var Ne=me[Me];pe.hasOwnProperty(Ne)?k.console&&console.warn("cannot override language handler %s",Ne):pe[Ne]=ye}}function de(ye,me){return ye&&pe.hasOwnProperty(ye)||(ye=/^\s*</.test(me)?"default-markup":"default-code"),pe[ye]}se(he,["default-code"]),se(oe([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["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"]),se(oe([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["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"]),se(oe([],[[F,/^[\s\S]+/]]),["uq.val"]),se(Ce({keywords:T,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),se(Ce({keywords:"null,true,false"}),["json"]),se(Ce({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),se(Ce({keywords:_,cStyleComments:!0}),["java"]),se(Ce({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),se(Ce({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),se(Ce({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),se(Ce({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),se(Ce({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),se(Ce({keywords:y,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),se(oe([],[[m,/^[\s\S]+/]]),["regex"]);function Le(ye){var me=ye.langExtension;try{var Me=U(ye.sourceNode,ye.pre),Ne=Me.sourceCode;ye.sourceCode=Ne,ye.spans=Me.spans,ye.basePos=0,de(me,Ne)(ye),ve(ye)}catch(Ie){k.console&&console.log(Ie&&Ie.stack||Ie)}}function We(ye,me,Me){var Ne=Me||!1,Ie=me||null,Ae=document.createElement("div");Ae.innerHTML="<pre>"+ye+"</pre>",Ae=Ae.firstChild,Ne&&we(Ae,Ne,!0);var Re={langExtension:Ie,numberLines:Ne,sourceNode:Ae,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Le(Re),Ae.innerHTML}function Te(ye,me){var Me=me||document.body,Ne=Me.ownerDocument||document;function Ie(ie){return Me.getElementsByTagName(ie)}for(var Ae=[Ie("pre"),Ie("code"),Ie("xmp")],Re=[],Ke=0;Ke<Ae.length;++Ke)for(var ze=0,Ge=Ae[Ke].length;ze<Ge;++ze)Re.push(Ae[Ke][ze]);Ae=null;var He=Date;He.now||(He={now:function(){return+new Date}});var ot=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Be=/\bprettyprint\b/,be=/\bprettyprinted\b/,qe=/pre|xmp/i,Ye=/^code$/i,Se=/^(?:pre|code|xmp)$/i,ke={};function le(){for(var ie=k.PR_SHOULD_USE_CONTINUATION?He.now()+250:Infinity;ot<Re.length&&He.now()<ie;ot++){for(var ee=Re[ot],Y=ke,$=ee;$=$.previousSibling;){var J=$.nodeType,q=(J===7||J===8)&&$.nodeValue;if(q?!/^\??prettify\b/.test(q):J!==3||/\S/.test($.nodeValue))break;if(q){Y={},q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ut,xt,$t){Y[xt]=$t});break}}var ue=ee.className;if((Y!==ke||Be.test(ue))&&!be.test(ue)){for(var ge=!1,_e=ee.parentNode;_e;_e=_e.parentNode){var Ve=_e.tagName;if(Se.test(Ve)&&_e.className&&Be.test(_e.className)){ge=!0;break}}if(!ge){ee.className+=" prettyprinted";var Qe=Y.lang;if(!Qe){Qe=ue.match(Xe);var Ze;!Qe&&(Ze=ne(ee))&&Ye.test(Ze.tagName)&&(Qe=Ze.className.match(Xe)),Qe&&(Qe=Qe[1])}var st;if(qe.test(ee.tagName))st=1;else{var pt=ee.currentStyle,tt=Ne.defaultView,Rt=pt?pt.whiteSpace:tt&&tt.getComputedStyle?tt.getComputedStyle(ee,null).getPropertyValue("white-space"):0;st=Rt&&Rt.substring(0,3)==="pre"}var vt=Y.linenums;(vt=vt==="true"||+vt)||(vt=ue.match(/\blinenums\b(?::(\d+))?/),vt=vt?vt[1]&&vt[1].length?+vt[1]:!0:!1),vt&&we(ee,vt,st);var It={langExtension:Qe,sourceNode:ee,numberLines:vt,pre:st,sourceCode:null,basePos:null,spans:null,decorations:null};Le(It)}}}ot<Re.length?k.setTimeout(le,250):typeof ye=="function"&&ye()}le()}var xe=k.PR={createSimpleLexer:oe,registerLangHandler:se,sourceDecorator:Ce,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:F,PR_COMMENT:x,PR_DECLARATION:p,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:H,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:b,PR_STRING:m,PR_TAG:v,PR_TYPE:h,prettyPrintOne:A?k.prettyPrintOne=We:R=We,prettyPrint:N=A?k.prettyPrint=Te:N=Te},Oe=k.define;typeof Oe=="function"&&Oe.amd&&Oe("google-code-prettify",[],function(){return xe})})()},SbmS:function(mt,et,Q){mt.exports={flex_box_center:"flex_box_center___HG_ui",flex_space_between:"flex_space_between___i7dgQ",flex_box_vertical_center:"flex_box_vertical_center___25J9O",flex_box_center_end:"flex_box_center_end___Q7-xc",flex_box_column:"flex_box_column___2Q6GJ",userInfo:"userInfo___2ECUY",navInfo:"navInfo___3H3dt",actived:"actived___ilDpa",topBar:"topBar___2O4NK",tabs:"tabs___yp4Rb",active:"active___3Xgtk",list:"list___U4GMG",tags:"tags___2IWIk",searchWrp:"searchWrp___1-W5t",listMessage:"listMessage___1M4jE",deleteMsg:"deleteMsg___1HDtB",listRightMessage:"listRightMessage___1rCRK",content:"content___KsZrb",msg:"msg___35IM3",msgDate:"msgDate___ovoCe"}},UZu5:function(mt,et,Q){},"VrN/":function(mt,et,Q){(function(te,G){mt.exports=G()})(this,function(){"use strict";var te=navigator.userAgent,G=navigator.platform,A=/gecko\/\d/i.test(te),W=/MSIE \d/.test(te),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(te),R=/Edge\/(\d+)/.exec(te),N=W||M||R,k=N&&(W?document.documentMode||6:+(R||M)[1]),D=!R&&/WebKit\//.test(te),O=D&&/Qt\/\d+\.\d+/.test(te),E=!R&&/Chrome\//.test(te),T=/Opera\//.test(te),_=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(te),y=/PhantomJS/.test(te),g=!R&&/AppleWebKit/.test(te)&&/Mobile\/\w+/.test(te),u=/Android/.test(te),o=g||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(te),l=g||/Mac/.test(G),d=/\bCrOS\b/.test(te),w=/win/i.test(G),f=T&&te.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(T=!1,D=!0);var m=l&&(O||T&&(f==null||f<12.11)),L=A||N&&k>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=x(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)i.appendChild(t[S]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function b(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 P(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function H(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var X=function(e){e.select()};g?X=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:N&&(X=function(e){try{e.select()}catch(t){}});function B(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function U(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function z(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,I=i||0;;){var j=e.indexOf(" ",S);if(j<0||j>=t)return I+(t-S);I+=j-S,I+=n-I%n,S=j+1}}var Z=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};Z.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Z.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 ne(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,Ce={toString:function(){return"CodeMirror.Pass"}},he={scroll:!1},we={origin:"*mouse"},ve={origin:"+move"};function pe(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var I=S-r;if(S==e.length||i+I>=t)return r+Math.min(I,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var se=[""];function de(e){for(;se.length<=e;)se.push(Le(se)+" ");return se[e]}function Le(e){return e[e.length-1]}function We(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Te(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function xe(){}function Oe(e,t){var n;return Object.create?n=Object.create(e):(xe.prototype=e,n=new xe),t&&U(t,n),n}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function me(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&me(e)?!0:t.test(e):me(e)}function Ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ae(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Re(e,t,n){for(;(n<0?t>0:t<e.length)&&Ae(e.charAt(t));)t+=n;return t}function Ke(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function ze(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var I=e[S];(I.from<n&&I.to>t||t==n&&I.to==t)&&(r(Math.max(I.from,t),Math.min(I.to,n),I.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ge=null;function He(e,t,n){var r;Ge=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ge=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ge=i)}return r!=null?r:Ge}var ot=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]/,S=/[LRr]/,I=/[Lb1n]/,j=/[1n]/;function K(V,re,ae){this.level=V,this.from=re,this.to=ae}return function(V,re){var ae=re=="ltr"?"L":"R";if(V.length==0||re=="ltr"&&!r.test(V))return!1;for(var fe=V.length,ce=[],De=0;De<fe;++De)ce.push(n(V.charCodeAt(De)));for(var Pe=0,Fe=ae;Pe<fe;++Pe){var $e=ce[Pe];$e=="m"?ce[Pe]=Fe:Fe=$e}for(var rt=0,Je=ae;rt<fe;++rt){var at=ce[rt];at=="1"&&Je=="r"?ce[rt]="n":S.test(at)&&(Je=at,at=="r"&&(ce[rt]="R"))}for(var ht=1,ut=ce[0];ht<fe-1;++ht){var Tt=ce[ht];Tt=="+"&&ut=="1"&&ce[ht+1]=="1"?ce[ht]="1":Tt==","&&ut==ce[ht+1]&&(ut=="1"||ut=="n")&&(ce[ht]=ut),ut=Tt}for(var Mt=0;Mt<fe;++Mt){var rr=ce[Mt];if(rr==",")ce[Mt]="N";else if(rr=="%"){var Wt=void 0;for(Wt=Mt+1;Wt<fe&&ce[Wt]=="%";++Wt);for(var Ar=Mt&&ce[Mt-1]=="!"||Wt<fe&&ce[Wt]=="1"?"1":"N",Tr=Mt;Tr<Wt;++Tr)ce[Tr]=Ar;Mt=Wt-1}}for(var Vt=0,Sr=ae;Vt<fe;++Vt){var or=ce[Vt];Sr=="L"&&or=="1"?ce[Vt]="L":S.test(or)&&(Sr=or)}for(var Yt=0;Yt<fe;++Yt)if(i.test(ce[Yt])){var Xt=void 0;for(Xt=Yt+1;Xt<fe&&i.test(ce[Xt]);++Xt);for(var Kt=(Yt?ce[Yt-1]:ae)=="L",wr=(Xt<fe?ce[Xt]:ae)=="L",Yn=Kt==wr?Kt?"L":"R":ae,hn=Yt;hn<Xt;++hn)ce[hn]=Yn;Yt=Xt-1}for(var dr=[],zr,nr=0;nr<fe;)if(I.test(ce[nr])){var Na=nr;for(++nr;nr<fe&&I.test(ce[nr]);++nr);dr.push(new K(0,Na,nr))}else{var tn=nr,Cn=dr.length,Ln=re=="rtl"?1:0;for(++nr;nr<fe&&ce[nr]!="L";++nr);for(var pr=tn;pr<nr;)if(j.test(ce[pr])){tn<pr&&(dr.splice(Cn,0,new K(1,tn,pr)),Cn+=Ln);var $n=pr;for(++pr;pr<nr&&j.test(ce[pr]);++pr);dr.splice(Cn,0,new K(2,$n,pr)),Cn+=Ln,tn=pr}else++pr;tn<nr&&dr.splice(Cn,0,new K(1,tn,nr))}return re=="ltr"&&(dr[0].level==1&&(zr=V.match(/^\s+/))&&(dr[0].from=zr[0].length,dr.unshift(new K(0,0,zr[0].length))),Le(dr).level==1&&(zr=V.match(/\s+$/))&&(Le(dr).to-=zr[0].length,dr.push(new K(0,fe-zr[0].length,fe)))),re=="rtl"?dr.reverse():dr}}();function Xe(e,t){var n=e.order;return n==null&&(n=e.order=ot(e.text,t)),n}var Be=[],be=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]||Be).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||Be}function Ye(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var S=ne(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function Se(e,t){var n=qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function ke(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Se(e,n||t.type,e,t),J(t)||t.codemirrorIgnore}function le(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ne(n,t[r])==-1&&n.push(t[r])}function ie(e,t){return qe(e,t).length>0}function ee(e){e.prototype.on=function(t,n){be(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function J(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function q(e){Y(e),$(e)}function ue(e){return e.target||e.srcElement}function ge(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(N&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ve;function Qe(e){if(Ve==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ve=t.offsetWidth<=1&&t.offsetHeight>2&&!(N&&k<8))}var n=Ve?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ze;function st(e){if(Ze!=null)return Ze;var t=s(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Ze=r.right-n.right<3}var pt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),I=S.indexOf("\r");I!=-1?(n.push(S.slice(0,I)),t+=I+1):(n.push(S),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},Rt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),vt=null;function It(e){if(vt!=null)return vt;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return vt=Math.abs(n.left-r.left)>1}var Ut={},xt={};function $t(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function gr(e,t){xt[e]=t}function ir(e){if(typeof e=="string"&&xt.hasOwnProperty(e))e=xt[e];else if(e&&typeof e.name=="string"&&xt.hasOwnProperty(e.name)){var t=xt[e.name];typeof t=="string"&&(t={name:t}),e=Oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ir("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ir("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function sr(e,t){t=ir(t);var n=Ut[t.name];if(!n)return sr(e,"text/plain");var r=n(e,t);if(Jt.hasOwnProperty(t.name)){var i=Jt[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var I in t.modeProps)r[I]=t.modeProps[I];return r}var Jt={};function Wr(e,t){var n=Jt.hasOwnProperty(e)?Jt[e]:Jt[e]={};U(t,n)}function wt(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 Nt(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 At(e,t,n){return e.startState?e.startState(t,n):!0}var Et=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};Et.prototype.eol=function(){return this.pos>=this.string.length},Et.prototype.sol=function(){return this.pos==this.lineStart},Et.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Et.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Et.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},Et.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Et.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Et.prototype.skipToEnd=function(){this.pos=this.string.length},Et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Et.prototype.backUp=function(e){this.pos-=e},Et.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Et.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Et.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(I){return n?I.toLowerCase():I},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Et.prototype.current=function(){return this.string.slice(this.start,this.pos)},Et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function Ft(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var I=S.text;i==n.line&&(I=I.slice(0,n.ch)),i==t.line&&(I=I.slice(t.ch)),r.push(I),++i}),r}function vr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function yr(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=ne(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Dr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var I=0;I<e.lines.length;++I){var j=e.lines[I],K=j.height;if(t<K)break;t-=K}return n+I}function Ir(e,t){return t>=e.first&&t<e.first+e.size}function Mr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ue(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ue))return new Ue(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 _r(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function Pr(e){return Ue(e.line,e.ch)}function je(e,t){return ft(e,t)<0?t:e}function Vr(e,t){return ft(e,t)<0?e:t}function An(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ct(e,t){if(t.line<e.first)return Ue(e.first,0);var n=e.first+e.size-1;return t.line>n?Ue(n,nt(e,n).text.length):cr(t,nt(e,t.line).text.length)}function cr(e,t){var n=e.ch;return n==null||n>t?Ue(e.line,t):n<0?Ue(e.line,0):e}function Hr(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ct(e,t[r]);return n}var Xr=function(e,t){this.state=e,this.lookAhead=t},fr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};fr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},fr.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}},fr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},fr.fromSaved=function(e,t,n){return t instanceof Xr?new fr(e,wt(e.mode,t.state),n,t.lookAhead):new fr(e,wt(e.mode,t),n)},fr.prototype.save=function(e){var t=e!==!1?wt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Xr(t,this.maxLookAhead):t};function kr(e,t,n,r){var i=[e.state.modeGen],S={};Pt(e,t.text,e.doc.mode,n,function(V,re){return i.push(V,re)},S,r);for(var I=n.state,j=function(V){n.baseTokens=i;var re=e.state.overlays[V],ae=1,fe=0;n.state=!0,Pt(e,t.text,re.mode,n,function(ce,De){for(var Pe=ae;fe<ce;){var Fe=i[ae];Fe>ce&&i.splice(ae,1,ce,i[ae+1],Fe),ae+=2,fe=Math.min(ce,Fe)}if(!De)return;if(re.opaque)i.splice(Pe,ae-Pe,ce,"overlay "+De),ae=Pe+2;else for(;Pe<ae;Pe+=2){var $e=i[Pe+1];i[Pe+1]=($e?$e+" ":"")+"overlay "+De}},S),n.state=I,n.baseTokens=null,n.baseTokenPos=1},K=0;K<e.state.overlays.length;++K)j(K);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function dt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ee(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&wt(e.doc.mode,r.state),S=kr(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ee(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new fr(r,!0,t);var S=Dn(e,t,n),I=S>r.first&&nt(r,S-1).stateAfter,j=I?fr.fromSaved(r,I,S):new fr(r,At(r.mode),S);return r.iter(S,t,function(K){it(e,K.text,j);var V=j.line;K.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?j.save():null,j.nextLine()}),n&&(r.modeFrontier=j.line),j}function it(e,t,n,r){var i=e.doc.mode,S=new Et(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&lt(i,n.state);!S.eol();)Lt(i,S,n.state),S.start=S.pos}function lt(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Nt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Lt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Nt(e,n).mode);var S=e.token(t,n);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var hr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Qt(e,t,n,r){var i=e.doc,S=i.mode,I;t=ct(i,t);var j=nt(i,t.line),K=Ee(e,t.line,n),V=new Et(j.text,e.options.tabSize,K),re;for(r&&(re=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,I=Lt(S,V,K.state),r&&re.push(new hr(V,I,wt(i.mode,K.state)));return r?re:new hr(V,I,K.state)}function jt(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 Pt(e,t,n,r,i,S,I){var j=n.flattenSpans;j==null&&(j=e.options.flattenSpans);var K=0,V=null,re=new Et(t,e.options.tabSize,r),ae,fe=e.options.addModeClass&&[null];for(t==""&&jt(lt(n,r.state),S);!re.eol();){if(re.pos>e.options.maxHighlightLength?(j=!1,I&&it(e,t,r,re.pos),re.pos=t.length,ae=null):ae=jt(Lt(n,re,r.state,fe),S),fe){var ce=fe[0].name;ce&&(ae="m-"+(ae?ce+" "+ae:ce))}if(!j||V!=ae){for(;K<re.start;)K=Math.min(re.start,K+5e3),i(K,V);V=ae}re.start=re.pos}for(;K<re.pos;){var De=Math.min(re.pos,K+5e3);i(De,V),K=De}}function Dn(e,t,n){for(var r,i,S=e.doc,I=n?-1:t-(e.doc.mode.innerMode?1e3:100),j=t;j>I;--j){if(j<=S.first)return S.first;var K=nt(S,j-1),V=K.stateAfter;if(V&&(!n||j+(V instanceof Xr?V.lookAhead:0)<=S.modeFrontier))return j;var re=z(K.text,null,e.options.tabSize);(i==null||r>re)&&(i=j-1,r=re)}return i}function Cr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=nt(e,r).stateAfter;if(i&&(!(i instanceof Xr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ur=!1,br=!1;function Ci(){Ur=!0}function Li(){br=!0}function mn(e,t,n){this.marker=e,this.from=t,this.to=n}function rn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Zi(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ai(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ba(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],I=S.marker,j=S.from==null||(I.inclusiveLeft?S.from<=t:S.from<t);if(j||S.from==t&&I.type=="bookmark"&&(!n||!S.marker.insertLeft)){var K=S.to==null||(I.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new mn(I,S.from,K?null:S.to))}}return r}function Jn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],I=S.marker,j=S.to==null||(I.inclusiveRight?S.to>=t:S.to>t);if(j||S.from==t&&I.type=="bookmark"&&(!n||S.marker.insertLeft)){var K=S.from==null||(I.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new mn(I,K?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Yr(e,t){if(t.full)return null;var n=Ir(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Ir(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,I=ft(t.from,t.to)==0,j=Ba(n,i,I),K=Jn(r,S,I),V=t.text.length==1,re=Le(t.text).length+(V?i:0);if(j)for(var ae=0;ae<j.length;++ae){var fe=j[ae];if(fe.to==null){var ce=rn(K,fe.marker);ce?V&&(fe.to=ce.to==null?null:ce.to+re):fe.to=i}}if(K)for(var De=0;De<K.length;++De){var Pe=K[De];if(Pe.to!=null&&(Pe.to+=re),Pe.from==null){var Fe=rn(j,Pe.marker);Fe||(Pe.from=re,V&&(j||(j=[])).push(Pe))}else Pe.from+=re,V&&(j||(j=[])).push(Pe)}j&&(j=_n(j)),K&&K!=j&&(K=_n(K));var $e=[j];if(!V){var rt=t.text.length-2,Je;if(rt>0&&j)for(var at=0;at<j.length;++at)j[at].to==null&&(Je||(Je=[])).push(new mn(j[at].marker,null,null));for(var ht=0;ht<rt;++ht)$e.push(Je);$e.push(K)}return $e}function _n(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 On(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ce){if(ce.markedSpans)for(var De=0;De<ce.markedSpans.length;++De){var Pe=ce.markedSpans[De].marker;Pe.readOnly&&(!r||ne(r,Pe)==-1)&&(r||(r=[])).push(Pe)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var I=r[S],j=I.find(0),K=0;K<i.length;++K){var V=i[K];if(ft(V.to,j.from)<0||ft(V.from,j.to)>0)continue;var re=[K,1],ae=ft(V.from,j.from),fe=ft(V.to,j.to);(ae<0||!I.inclusiveLeft&&!ae)&&re.push({from:V.from,to:j.from}),(fe>0||!I.inclusiveRight&&!fe)&&re.push({from:j.to,to:V.to}),i.splice.apply(i,re),K+=re.length-3}return i}function pn(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 Qn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function gn(e){return e.inclusiveLeft?-1:0}function $r(e){return e.inclusiveRight?1:0}function Zn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),S=ft(r.from,i.from)||gn(e)-gn(t);if(S)return-S;var I=ft(r.to,i.to)||$r(e)-$r(t);return I||t.id-e.id}function nn(e,t){var n=br&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Zn(r,i.marker)<0)&&(r=i.marker);return r}function Di(e){return nn(e,!0)}function Rn(e){return nn(e,!1)}function qi(e,t){var n=br&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||Zn(r,S.marker)<0)&&(r=S.marker)}return r}function ea(e,t,n,r,i){var S=nt(e,t),I=br&&S.markedSpans;if(I)for(var j=0;j<I.length;++j){var K=I[j];if(!K.marker.collapsed)continue;var V=K.marker.find(0),re=ft(V.from,n)||gn(K.marker)-gn(i),ae=ft(V.to,r)||$r(K.marker)-$r(i);if(re>=0&&ae<=0||re<=0&&ae>=0)continue;if(re<=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?ft(V.to,n)>=0:ft(V.to,n)>0)||re>=0&&(K.marker.inclusiveRight&&i.inclusiveLeft?ft(V.from,r)<=0:ft(V.from,r)<0))return!0}}function Nr(e){for(var t;t=Di(e);)e=t.find(-1,!0).line;return e}function ja(e){for(var t;t=Rn(e);)e=t.find(1,!0).line;return e}function gt(e){for(var t,n;t=Rn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function yt(e,t){var n=nt(e,t),r=Nr(n);return n==r?t:St(r)}function bt(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Ct(e,n))return t;for(;r=Rn(n);)n=r.find(1,!0).line;return St(n)+1}function Ct(e,t){var n=br&&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&&_t(e,t,r))return!0}}function _t(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return _t(e,r.line,rn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&_t(e,t,i))return!0}function kt(e){e=Nr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var S=n.parent;S;n=S,S=n.parent)for(var I=0;I<S.children.length;++I){var j=S.children[I];if(j==n)break;t+=j.height}return t}function Ht(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Di(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Rn(r);){var S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Zt(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=Ht(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Ht(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var qt=function(e,t,n){this.text=e,Qn(this,t),this.height=n?n(this):1};qt.prototype.lineNo=function(){return St(this)},ee(qt);function Jr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),pn(e),Qn(e,n);var i=r?r(e):1;i!=e.height&&yr(e,i)}function zt(e){e.parent=null,pn(e)}var an={},lr={};function Qr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lr:an;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Zr(e,t){var n=v("span",null,null,D?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var S=i?t.rest[i-1]:t.line,I=void 0;r.pos=0,r.addToken=Cs,st(e.display.measure)&&(I=Xe(S,e.doc.direction))&&(r.addToken=As(r.addToken,I)),r.map=[];var j=t!=e.display.externalMeasured&&St(S);Ds(S,r,dt(e,S,j)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=H(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=H(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Qe(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var K=r.content.lastChild;(/\bcm-tab\b/.test(K.className)||K.querySelector&&K.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Se(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=H(r.pre.className,r.textClass||"")),r}function qn(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,S,I){if(!t)return;var j=e.splitSpaces?Ls(t,e.trailingSpace):t,K=e.cm.state.specialChars,V=!1,re;if(!K.test(t))e.col+=t.length,re=document.createTextNode(j),e.map.push(e.pos,e.pos+t.length,re),N&&k<9&&(V=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var ae=0;;){K.lastIndex=ae;var fe=K.exec(t),ce=fe?fe.index-ae:t.length-ae;if(ce){var De=document.createTextNode(j.slice(ae,ae+ce));N&&k<9?re.appendChild(a("span",[De])):re.appendChild(De),e.map.push(e.pos,e.pos+ce,De),e.col+=ce,e.pos+=ce}if(!fe)break;ae+=ce+1;var Pe=void 0;if(fe[0]==" "){var Fe=e.cm.options.tabSize,$e=Fe-e.col%Fe;Pe=re.appendChild(a("span",de($e),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=$e}else fe[0]=="\r"||fe[0]==`
`?(Pe=re.appendChild(a("span",fe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",fe[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(fe[0]),Pe.setAttribute("cm-text",fe[0]),N&&k<9?re.appendChild(a("span",[Pe])):re.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=j.charCodeAt(t.length-1)==32,n||r||i||V||S||I){var rt=n||"";r&&(rt+=r),i&&(rt+=i);var Je=a("span",[re],rt,S);if(I)for(var at in I)I.hasOwnProperty(at)&&at!="style"&&at!="class"&&Je.setAttribute(at,I[at]);return e.content.appendChild(Je)}e.content.appendChild(re)}function Ls(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function As(e,t){return function(n,r,i,S,I,j,K){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,re=V+r.length;;){for(var ae=void 0,fe=0;fe<t.length&&!(ae=t[fe],ae.to>V&&ae.from<=V);fe++);if(ae.to>=re)return e(n,r,i,S,I,j,K);e(n,r.slice(0,ae.to-V),i,S,null,j,K),S=null,r=r.slice(ae.to-V),V=ae.to}}}function Wa(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 Ds(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var I=1;I<n.length;I+=2)t.addToken(t,i.slice(S,S=n[I]),Qr(n[I+1],t.cm.options));return}for(var j=i.length,K=0,V=1,re="",ae,fe,ce=0,De,Pe,Fe,$e,rt;;){if(ce==K){De=Pe=Fe=fe="",rt=null,$e=null,ce=Infinity;for(var Je=[],at=void 0,ht=0;ht<r.length;++ht){var ut=r[ht],Tt=ut.marker;if(Tt.type=="bookmark"&&ut.from==K&&Tt.widgetNode)Je.push(Tt);else if(ut.from<=K&&(ut.to==null||ut.to>K||Tt.collapsed&&ut.to==K&&ut.from==K)){if(ut.to!=null&&ut.to!=K&&ce>ut.to&&(ce=ut.to,Pe=""),Tt.className&&(De+=" "+Tt.className),Tt.css&&(fe=(fe?fe+";":"")+Tt.css),Tt.startStyle&&ut.from==K&&(Fe+=" "+Tt.startStyle),Tt.endStyle&&ut.to==ce&&(at||(at=[])).push(Tt.endStyle,ut.to),Tt.title&&((rt||(rt={})).title=Tt.title),Tt.attributes)for(var Mt in Tt.attributes)(rt||(rt={}))[Mt]=Tt.attributes[Mt];Tt.collapsed&&(!$e||Zn($e.marker,Tt)<0)&&($e=ut)}else ut.from>K&&ce>ut.from&&(ce=ut.from)}if(at)for(var rr=0;rr<at.length;rr+=2)at[rr+1]==ce&&(Pe+=" "+at[rr]);if(!$e||$e.from==K)for(var Wt=0;Wt<Je.length;++Wt)Wa(t,0,Je[Wt]);if($e&&($e.from||0)==K){if(Wa(t,($e.to==null?j+1:$e.to)-K,$e.marker,$e.from==null),$e.to==null)return;$e.to==K&&($e=!1)}}if(K>=j)break;for(var Ar=Math.min(j,ce);;){if(re){var Tr=K+re.length;if(!$e){var Vt=Tr>Ar?re.slice(0,Ar-K):re;t.addToken(t,Vt,ae?ae+De:De,Fe,K+Vt.length==ce?Pe:"",fe,rt)}if(Tr>=Ar){re=re.slice(Ar-K),K=Ar;break}K=Tr,Fe=""}re=i.slice(S,S=n[V++]),ae=Qr(n[V++],t.cm.options)}}}function Ha(e,t,n){this.line=t,this.rest=gt(t),this.size=this.rest?St(Le(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Ct(e,t)}function _i(e,t,n){for(var r=[],i,S=t;S<n;S=i){var I=new Ha(e.doc,nt(e.doc,S),S);i=S+I.size,r.push(I)}return r}var Mn=null;function _s(e){Mn?Mn.ops.push(e):e.ownsGroup=Mn={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Mn=null,t(n)}}var ei=null;function ar(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Mn?i=Mn.delayedCallbacks:ei?i=ei:(i=ei=[],setTimeout(Ms,0));for(var S=function(j){i.push(function(){return n[j].apply(null,r)})},I=0;I<n.length;++I)S(I)}function Ms(){var e=ei;ei=null;for(var t=0;t<e.length;++t)e[t]()}function Ka(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?ks(e,t):S=="gutter"?za(e,t,n,r):S=="class"?ta(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function ti(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),N&&k<8&&(e.node.style.zIndex=2)),e.node}function Ps(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=ti(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ga(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Zr(e,t)}function ks(e,t){var n=t.text.className,r=Ga(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,ta(e,t)):n&&(t.text.className=n)}function ta(e,t){Ps(e,t),t.line.wrapClass?ti(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function za(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ti(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var I=ti(t),j=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(j),I.insertBefore(j,t.text),t.line.gutterClass&&(j.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=j.appendChild(a("div",Mr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var K=0;K<e.display.gutterSpecs.length;++K){var V=e.display.gutterSpecs[K].className,re=S.hasOwnProperty(V)&&S[V];re&&j.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Va(e,t,n)}function Us(e,t,n,r){var i=Ga(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ta(e,t),za(e,t,n,r),Va(e,t,r),t.node}function Va(e,t,n){if(Xa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Xa(e,t.rest[r],t,n,!1)}function Xa(e,t,n,r,i){if(!t.widgets)return;for(var S=ti(n),I=0,j=t.widgets;I<j.length;++I){var K=j[I],V=a("div",[K.node],"CodeMirror-linewidget"+(K.className?" "+K.className:""));K.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(K,V,n,r),e.display.input.setUneditable(V),i&&K.above?S.insertBefore(V,n.gutter||n.text):S.appendChild(V),ar(K,"redraw")}}function Ns(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ri(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(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;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function qr(e,t){for(var n=ue(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 Oi(e){return e.lineSpace.offsetTop}function ra(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ya(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Kr(e){return oe-e.display.nativeBarWidth}function vn(e){return e.display.scroller.clientWidth-Kr(e)-e.display.barWidth}function na(e){return e.display.scroller.clientHeight-Kr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&vn(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var I=t.text.firstChild.getClientRects(),j=0;j<I.length-1;j++){var K=I[j],V=I[j+1];Math.abs(K.bottom-V.bottom)>2&&S.push((K.bottom+V.top)/2-n.top)}}S.push(n.bottom-n.top)}}function $a(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=Nr(t);var n=St(t),r=e.display.externalMeasured=new Ha(e.doc,t,n);r.lineN=n;var i=r.built=Zr(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function Ja(e,t,n,r){return Gr(e,Pn(e,t),n,r)}function ia(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[En(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Pn(e,t){var n=St(t),r=ia(e,n);r&&!r.text?r=null:r&&r.changes&&(Ka(e,r,n,da(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=$a(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Gr(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),I;return t.cache.hasOwnProperty(S)?I=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),I=Ws(e,t,n,r),I.bogus||(t.cache[S]=I)),{left:I.left,right:I.right,top:i?I.rtop:I.top,bottom:i?I.rbottom:I.bottom}}var Qa={left:0,right:0,top:0,bottom:0};function Za(e,t,n){for(var r,i,S,I,j,K,V=0;V<e.length;V+=3)if(j=e[V],K=e[V+1],t<j?(i=0,S=1,I="left"):t<K?(i=t-j,S=i+1):(V==e.length-3||t==K&&e[V+3]>t)&&(S=K-j,i=S-1,t>=K&&(I="right")),i!=null){if(r=e[V+2],j==K&&n==(r.insertLeft?"left":"right")&&(I=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],I="left";if(n=="right"&&i==K-j)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],I="right";break}return{node:r,start:i,end:S,collapse:I,coverStart:j,coverEnd:K}}function js(e,t){var n=Qa;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=Za(t.map,n,r),S=i.node,I=i.start,j=i.end,K=i.collapse,V;if(S.nodeType==3){for(var re=0;re<4;re++){for(;I&&Ae(t.line.text.charAt(i.coverStart+I));)--I;for(;i.coverStart+j<i.coverEnd&&Ae(t.line.text.charAt(i.coverStart+j));)++j;if(N&&k<9&&I==0&&j==i.coverEnd-i.coverStart?V=S.parentNode.getBoundingClientRect():V=js(p(S,I,j).getClientRects(),r),V.left||V.right||I==0)break;j=I,I=I-1,K="right"}N&&k<11&&(V=Hs(e.display.measure,V))}else{I>0&&(K=r="right");var ae;e.options.lineWrapping&&(ae=S.getClientRects()).length>1?V=ae[r=="right"?ae.length-1:0]:V=S.getBoundingClientRect()}if(N&&k<9&&!I&&(!V||!V.left&&!V.right)){var fe=S.parentNode.getClientRects()[0];fe?V={left:fe.left,right:fe.left+In(e.display),top:fe.top,bottom:fe.bottom}:V=Qa}for(var ce=V.top-t.rect.top,De=V.bottom-t.rect.top,Pe=(ce+De)/2,Fe=t.view.measure.heights,$e=0;$e<Fe.length-1&&!(Pe<Fe[$e]);$e++);var rt=$e?Fe[$e-1]:0,Je=Fe[$e],at={left:(K=="right"?V.right:V.left)-t.rect.left,right:(K=="left"?V.left:V.right)-t.rect.left,top:rt,bottom:Je};return!V.left&&!V.right&&(at.bogus=!0),e.options.singleCursorHeightPerLine||(at.rtop=ce,at.rbottom=De),at}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!It(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 qa(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 eo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)qa(e.display.view[t])}function ni(e){eo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function to(){return E&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ro(){return E&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function aa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ri(e.widgets[n]));return t}function Ri(e,t,n,r,i){if(!i){var S=aa(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var I=kt(t);if(r=="local"?I+=Oi(e.display):I-=e.display.viewOffset,r=="page"||r=="window"){var j=e.display.lineSpace.getBoundingClientRect();I+=j.top+(r=="window"?0:ro());var K=j.left+(r=="window"?0:to());n.left+=K,n.right+=K}return n.top+=I,n.bottom+=I,n}function no(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=to(),i-=ro();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var I=e.display.lineSpace.getBoundingClientRect();return{left:r-I.left,top:i-I.top}}function oa(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Ri(e,r,Ja(e,r,t.ch,i),n)}function Fr(e,t,n,r,i,S){r=r||nt(e.doc,t.line),i||(i=Pn(e,r));function I(De,Pe){var Fe=Gr(e,i,De,Pe?"right":"left",S);return Pe?Fe.left=Fe.right:Fe.right=Fe.left,Ri(e,r,Fe,n)}var j=Xe(r,e.doc.direction),K=t.ch,V=t.sticky;if(K>=r.text.length?(K=r.text.length,V="before"):K<=0&&(K=0,V="after"),!j)return I(V=="before"?K-1:K,V=="before");function re(De,Pe,Fe){var $e=j[Pe],rt=$e.level==1;return I(Fe?De-1:De,rt!=Fe)}var ae=He(j,K,V),fe=Ge,ce=re(K,ae,V=="before");return fe!=null&&(ce.other=re(K,fe,V!="before")),ce}function io(e,t){var n=0;t=ct(e.doc,t),e.options.lineWrapping||(n=In(e.display)*t.ch);var r=nt(e.doc,t.line),i=kt(r)+Oi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function sa(e,t,n,r,i){var S=Ue(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function la(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return sa(r.first,0,null,-1,-1);var i=Dr(r,n),S=r.first+r.size-1;if(i>S)return sa(r.first+r.size-1,nt(r,S).text.length,null,1,1);t<0&&(t=0);for(var I=nt(r,i);;){var j=Ks(e,I,i,t,n),K=qi(I,j.ch+(j.xRel>0||j.outside>0?1:0));if(!K)return j;var V=K.find(1);if(V.line==i)return V;I=nt(r,i=V.line)}}function ao(e,t,n,r){r-=aa(t);var i=t.text.length,S=Ke(function(I){return Gr(e,n,I-1).bottom<=r},i,0);return i=Ke(function(I){return Gr(e,n,I).top>r},S,i),{begin:S,end:i}}function oo(e,t,n,r){n||(n=Pn(e,t));var i=Ri(e,t,Gr(e,n,r),"line").top;return ao(e,t,n,i)}function ua(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-=kt(t);var S=Pn(e,t),I=aa(t),j=0,K=t.text.length,V=!0,re=Xe(t,e.doc.direction);if(re){var ae=(e.options.lineWrapping?zs:Gs)(e,t,n,S,re,r,i);V=ae.level!=1,j=V?ae.from:ae.to-1,K=V?ae.to:ae.from-1}var fe=null,ce=null,De=Ke(function(ht){var ut=Gr(e,S,ht);return ut.top+=I,ut.bottom+=I,ua(ut,r,i,!1)?(ut.top<=i&&ut.left<=r&&(fe=ht,ce=ut),!0):!1},j,K),Pe,Fe,$e=!1;if(ce){var rt=r-ce.left<ce.right-r,Je=rt==V;De=fe+(Je?0:1),Fe=Je?"after":"before",Pe=rt?ce.left:ce.right}else{!V&&(De==K||De==j)&&De++,Fe=De==0?"after":De==t.text.length?"before":Gr(e,S,De-(V?1:0)).bottom+I<=i==V?"after":"before";var at=Fr(e,Ue(n,De,Fe),"line",t,S);Pe=at.left,$e=i<at.top?-1:i>=at.bottom?1:0}return De=Re(t.text,De,1),sa(n,De,Fe,$e,r-Pe)}function Gs(e,t,n,r,i,S,I){var j=Ke(function(ae){var fe=i[ae],ce=fe.level!=1;return ua(Fr(e,Ue(n,ce?fe.to:fe.from,ce?"before":"after"),"line",t,r),S,I,!0)},0,i.length-1),K=i[j];if(j>0){var V=K.level!=1,re=Fr(e,Ue(n,V?K.from:K.to,V?"after":"before"),"line",t,r);ua(re,S,I,!0)&&re.top>I&&(K=i[j-1])}return K}function zs(e,t,n,r,i,S,I){var j=ao(e,t,r,I),K=j.begin,V=j.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var re=null,ae=null,fe=0;fe<i.length;fe++){var ce=i[fe];if(ce.from>=V||ce.to<=K)continue;var De=ce.level!=1,Pe=Gr(e,r,De?Math.min(V,ce.to)-1:Math.max(K,ce.from)).right,Fe=Pe<S?S-Pe+1e9:Pe-S;(!re||ae>Fe)&&(re=ce,ae=Fe)}return re||(re=i[i.length-1]),re.from<K&&(re={from:K,to:re.to,level:re.level}),re.to>V&&(re={from:re.from,to:V,level:re.level}),re}var yn;function kn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(yn==null){yn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)yn.appendChild(document.createTextNode("x")),yn.appendChild(a("br"));yn.appendChild(document.createTextNode("x"))}s(e.measure,yn);var n=yn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function In(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function da(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,I=0;S;S=S.nextSibling,++I){var j=e.display.gutterSpecs[I].className;n[j]=S.offsetLeft+S.clientLeft+i,r[j]=S.clientWidth}return{fixedPos:ca(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ca(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function so(e){var t=kn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/In(e.display)-3);return function(i){if(Ct(e.doc,i))return 0;var S=0;if(i.widgets)for(var I=0;I<i.widgets.length;I++)i.widgets[I].height&&(S+=i.widgets[I].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function fa(e){var t=e.doc,n=so(e);t.iter(function(r){var i=n(r);i!=r.height&&yr(r,i)})}function bn(e,t,n,r){var i=e.display;if(!n&&ue(t).getAttribute("cm-not-content")=="true")return null;var S,I,j=i.lineSpace.getBoundingClientRect();try{S=t.clientX-j.left,I=t.clientY-j.top}catch(ae){return null}var K=la(e,S,I),V;if(r&&K.xRel>0&&(V=nt(e.doc,K.line).text).length==K.ch){var re=z(V,V.length,e.options.tabSize)-V.length;K=Ue(K.line,Math.max(0,Math.round((S-Ya(e.display).left)/In(e.display))-re))}return K}function En(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 Er(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)br&&yt(e.doc,t)<i.viewTo&&sn(e);else if(n<=i.viewFrom)br&&bt(e.doc,n+r)>i.viewFrom?sn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)sn(e);else if(t<=i.viewFrom){var S=Mi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):sn(e)}else if(n>=i.viewTo){var I=Mi(e,t,t,-1);I?(i.view=i.view.slice(0,I.index),i.viewTo=I.lineN):sn(e)}else{var j=Mi(e,t,t,-1),K=Mi(e,n,n+r,1);j&&K?(i.view=i.view.slice(0,j.index).concat(_i(e,j.lineN,K.lineN)).concat(i.view.slice(K.index)),i.viewTo+=r):sn(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function on(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var S=r.view[En(e,t)];if(S.node==null)return;var I=S.changes||(S.changes=[]);ne(I,n)==-1&&I.push(n)}function sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Mi(e,t,n,r){var i=En(e,t),S,I=e.display.view;if(!br||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var j=e.display.viewFrom,K=0;K<i;K++)j+=I[K].size;if(j!=t){if(r>0){if(i==I.length-1)return null;S=j+I[i].size-t,i++}else S=j-t;t+=S,n+=S}for(;yt(e.doc,n)!=n;){if(i==(r<0?0:I.length-1))return null;n+=r*I[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=_i(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=_i(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(En(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(_i(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,En(e,n)))),r.viewTo=n}function lo(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 ii(e){e.display.input.showSelection(e.display.input.prepareSelection())}function uo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),I=0;I<n.sel.ranges.length;I++){if(!t&&I==n.sel.primIndex)continue;var j=n.sel.ranges[I];if(j.from().line>=e.display.viewTo||j.to().line<e.display.viewFrom)continue;var K=j.empty();(K||e.options.showCursorWhenSelecting)&&co(e,j.head,i),K||Xs(e,j,S)}return r}function co(e,t,n){var r=Fr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,S=document.createDocumentFragment(),I=Ya(e.display),j=I.left,K=Math.max(r.sizerWidth,vn(e)-r.sizer.offsetLeft)-I.right,V=i.direction=="ltr";function re(Je,at,ht,ut){at<0&&(at=0),at=Math.round(at),ut=Math.round(ut),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
top: `+at+"px; width: "+(ht==null?K-Je:ht)+`px;
height: `+(ut-at)+"px"))}function ae(Je,at,ht){var ut=nt(i,Je),Tt=ut.text.length,Mt,rr;function Wt(Vt,Sr){return oa(e,Ue(Je,Vt),"div",ut,Sr)}function Ar(Vt,Sr,or){var Yt=oo(e,ut,null,Vt),Xt=Sr=="ltr"==(or=="after")?"left":"right",Kt=or=="after"?Yt.begin:Yt.end-(/\s/.test(ut.text.charAt(Yt.end-1))?2:1);return Wt(Kt,Xt)[Xt]}var Tr=Xe(ut,i.direction);return ze(Tr,at||0,ht==null?Tt:ht,function(Vt,Sr,or,Yt){var Xt=or=="ltr",Kt=Wt(Vt,Xt?"left":"right"),wr=Wt(Sr-1,Xt?"right":"left"),Yn=at==null&&Vt==0,hn=ht==null&&Sr==Tt,dr=Yt==0,zr=!Tr||Yt==Tr.length-1;if(wr.top-Kt.top<=3){var nr=(V?Yn:hn)&&dr,Na=(V?hn:Yn)&&zr,tn=nr?j:(Xt?Kt:wr).left,Cn=Na?K:(Xt?wr:Kt).right;re(tn,Kt.top,Cn-tn,Kt.bottom)}else{var Ln,pr,$n,Fa;Xt?(Ln=V&&Yn&&dr?j:Kt.left,pr=V?K:Ar(Vt,or,"before"),$n=V?j:Ar(Sr,or,"after"),Fa=V&&hn&&zr?K:wr.right):(Ln=V?Ar(Vt,or,"before"):j,pr=!V&&Yn&&dr?K:Kt.right,$n=!V&&hn&&zr?j:wr.left,Fa=V?Ar(Sr,or,"after"):K),re(Ln,Kt.top,pr-Ln,Kt.bottom),Kt.bottom<wr.top&&re(j,Kt.bottom,null,wr.top),re($n,wr.top,Fa-$n,wr.bottom)}(!Mt||Pi(Kt,Mt)<0)&&(Mt=Kt),Pi(wr,Mt)<0&&(Mt=wr),(!rr||Pi(Kt,rr)<0)&&(rr=Kt),Pi(wr,rr)<0&&(rr=wr)}),{start:Mt,end:rr}}var fe=t.from(),ce=t.to();if(fe.line==ce.line)ae(fe.line,fe.ch,ce.ch);else{var De=nt(i,fe.line),Pe=nt(i,ce.line),Fe=Nr(De)==Nr(Pe),$e=ae(fe.line,fe.ch,Fe?De.text.length+1:null).end,rt=ae(ce.line,Fe?0:null,ce.ch).start;Fe&&($e.top<rt.top-2?(re($e.right,$e.top,null,$e.bottom),re(j,rt.top,rt.left,rt.bottom)):re($e.right,$e.top,rt.left-$e.right,$e.bottom)),$e.bottom<rt.top&&re(j,$e.bottom,null,rt.top)}n.appendChild(S)}function ha(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()||Un(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function fo(e){e.state.focused||(e.display.input.focus(),ma(e))}function ho(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Un(e))},100)}function ma(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Se(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ha(e)}function Un(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Se(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ki(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],S=e.options.lineWrapping,I=void 0,j=0;if(i.hidden)continue;if(N&&k<8){var K=i.node.offsetTop+i.node.offsetHeight;I=K-n,n=K}else{var V=i.node.getBoundingClientRect();I=V.bottom-V.top,!S&&i.text.firstChild&&(j=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var re=i.line.height-I;if((re>.005||re<-.005)&&(yr(i.line,I),mo(i.line),i.rest))for(var ae=0;ae<i.rest.length;ae++)mo(i.rest[ae]);if(j>e.display.sizerWidth){var fe=Math.ceil(j/In(e.display));fe>e.display.maxLineLength&&(e.display.maxLineLength=fe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function mo(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 Ii(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Oi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=Dr(t,r),I=Dr(t,i);if(n&&n.ensure){var j=n.ensure.from.line,K=n.ensure.to.line;j<S?(S=j,I=Dr(t,kt(nt(t,j))+e.wrapper.clientHeight)):Math.min(K,t.lastLine())>=I&&(S=Dr(t,kt(nt(t,K))-e.wrapper.clientHeight),I=K)}return{from:S,to:Math.max(I,S+1)}}function Ys(e,t){if(ke(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!y){var S=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Oi(e.display))+`px;
height: `+(t.bottom-t.top+Kr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ue(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ue(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var I=!1,j=Fr(e,t),K=!n||n==t?j:Fr(e,n);i={left:Math.min(j.left,K.left),top:Math.min(j.top,K.top)-r,right:Math.max(j.left,K.left),bottom:Math.max(j.bottom,K.bottom)+r};var V=pa(e,i),re=e.doc.scrollTop,ae=e.doc.scrollLeft;if(V.scrollTop!=null&&(oi(e,V.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(I=!0)),V.scrollLeft!=null&&(xn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ae)>1&&(I=!0)),!I)break}return i}function Js(e,t){var n=pa(e,t);n.scrollTop!=null&&oi(e,n.scrollTop),n.scrollLeft!=null&&xn(e,n.scrollLeft)}function pa(e,t){var n=e.display,r=kn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=na(e),I={};t.bottom-t.top>S&&(t.bottom=t.top+S);var j=e.doc.height+ra(n),K=t.top<r,V=t.bottom>j-r;if(t.top<i)I.scrollTop=K?0:t.top;else if(t.bottom>i+S){var re=Math.min(t.top,(V?j:t.bottom)-S);re!=i&&(I.scrollTop=re)}var ae=e.options.fixedGutter?0:n.gutters.offsetWidth,fe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ae,ce=vn(e)-n.gutters.offsetWidth,De=t.right-t.left>ce;return De&&(t.right=t.left+ce),t.left<10?I.scrollLeft=0:t.left<fe?I.scrollLeft=Math.max(0,t.left+ae-(De?0:10)):t.right>ce+fe-3&&(I.scrollLeft=t.right+(De?0:10)-ce),I}function ga(e,t){if(t==null)return;Ui(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Nn(e){Ui(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ai(e,t,n){(t!=null||n!=null)&&Ui(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ui(e),e.curOp.scrollToPos=t}function Ui(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=io(e,t.from),r=io(e,t.to);po(e,n,r,t.margin)}}function po(e,t,n,r){var i=pa(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});ai(e,i.scrollLeft,i.scrollTop)}function oi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||ya(e,{top:t}),go(e,t,!0),A&&ya(e),ui(e,100)}function go(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 xn(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,xo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function si(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ra(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+Kr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Tn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),be(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),be(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,N&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Tn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Tn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Tn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Tn.prototype.zeroWidthHack=function(){var e=l&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Z,this.disableVert=new Z},Tn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Tn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var li=function(){};li.prototype.update=function(){return{bottom:0,right:0}},li.prototype.setScrollLeft=function(){},li.prototype.setScrollTop=function(){},li.prototype.clear=function(){};function Fn(e,t){t||(t=si(e));var n=e.display.barWidth,r=e.display.barHeight;vo(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ki(e),vo(e,si(e)),n=e.display.barWidth,r=e.display.barHeight}function vo(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 yo={native:Tn,null:li};function bo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new yo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),be(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"?xn(e,t):oi(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Sn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},_s(e.curOp)}function wn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var S=0;S<t.length;S++)nl(t[S]);for(var I=0;I<t.length;I++)il(t[I])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Zt(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 Ni(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&va(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ki(t),e.barMeasure=si(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ja(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+Kr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-vn(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&&xn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Fn(t,e.barMeasure),e.updatedDisplay&&Ea(t,e.barMeasure),e.selectionChanged&&ha(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&fo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Eo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&go(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&xn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ct(r,e.scrollToPos.from),ct(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var S=e.maybeHiddenMarkers,I=e.maybeUnhiddenMarkers;if(S)for(var j=0;j<S.length;++j)S[j].lines.length||Se(S[j],"hide");if(I)for(var K=0;K<I.length;++K)I[K].lines.length&&Se(I[K],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Lr(e,t){if(e.curOp)return t();Sn(e);try{return t()}finally{wn(e)}}function er(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Sn(e);try{return t.apply(e,arguments)}finally{wn(e)}}}function mr(e){return function(){if(this.curOp)return e.apply(this,arguments);Sn(this);try{return e.apply(this,arguments)}finally{wn(this)}}}function tr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Sn(t);try{return e.apply(this,arguments)}finally{wn(t)}}}function ui(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,B(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Ee(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var I=S.styles,j=S.text.length>e.options.maxHighlightLength?wt(t.mode,r.state):null,K=kr(e,S,r,!0);j&&(r.state=j),S.styles=K.styles;var V=S.styleClasses,re=K.classes;re?S.styleClasses=re:V&&(S.styleClasses=null);for(var ae=!I||I.length!=S.styles.length||V!=re&&(!V||!re||V.bgClass!=re.bgClass||V.textClass!=re.textClass),fe=0;!ae&&fe<I.length;++fe)ae=I[fe]!=S.styles[fe];ae&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&it(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ui(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Lr(e,function(){for(var S=0;S<i.length;S++)on(e,i[S],"text")})}var Ni=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Ii(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=vn(e),this.force=n,this.dims=da(e),this.events=[]};Ni.prototype.signal=function(e,t){ie(e,t)&&this.events.push(arguments)},Ni.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Se.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=Kr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Kr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&b(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==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(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 va(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return sn(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&&lo(e)==0)return!1;To(e)&&(sn(e),t.dims=da(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),I=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>I&&n.viewTo-I<20&&(I=Math.min(i,n.viewTo)),br&&(S=yt(e.doc,S),I=bt(e.doc,I));var j=S!=n.viewFrom||I!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,I),n.viewOffset=kt(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var K=lo(e);if(!j&&K==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return K>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),K>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,j&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ui(e,400)),n.updateLineNumbers=null,!0}function Eo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==vn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ra(e.display)-na(e),n.top)}),t.visible=Ii(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Ii(e.display,e.doc,n));if(!va(e,t))break;ki(e);var i=si(e);ii(e),Fn(e,i),Ea(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 ya(e,t){var n=new Ni(e,t);if(va(e,n)){ki(e),Eo(e,n);var r=si(e);ii(e),Fn(e,r),Ea(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,I=S.firstChild;function j(De){var Pe=De.nextSibling;return D&&l&&e.display.currentWheelTarget==De?De.style.display="none":De.parentNode.removeChild(De),Pe}for(var K=r.view,V=r.viewFrom,re=0;re<K.length;re++){var ae=K[re];if(!ae.hidden)if(!ae.node||ae.node.parentNode!=S){var fe=Us(e,ae,V,n);S.insertBefore(fe,I)}else{for(;I!=ae.node;)I=j(I);var ce=i&&t!=null&&t<=V&&ae.lineNumber;ae.changes&&(ne(ae.changes,"gutter")>-1&&(ce=!1),Ka(e,ae,V,n)),ce&&(c(ae.lineNumber),ae.lineNumber.appendChild(document.createTextNode(Mr(e.options,V)))),I=ae.node.nextSibling}V+=ae.size}for(;I;)I=j(I)}function ba(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ea(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+Kr(e)+"px"}function xo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ca(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",I=0;I<n.length;I++)if(!n[I].hidden){e.options.fixedGutter&&(n[I].gutter&&(n[I].gutter.style.left=S),n[I].gutterBackground&&(n[I].gutterBackground.style.left=S));var j=n[I].alignable;if(j)for(var K=0;K<j.length;K++)j[K].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function To(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Mr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=i.firstChild.offsetWidth,I=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-I)+1,r.lineNumWidth=r.lineNumInnerWidth+I,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ba(e.display),!0}return!1}function xa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],I=null;if(typeof S!="string"&&(I=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:I})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function So(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],S=i.className,I=i.style,j=t.appendChild(a("div",null,"CodeMirror-gutter "+S));I&&(j.style.cssText=I),S=="CodeMirror-linenumbers"&&(e.lineGutter=j,j.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ba(e)}function di(e){So(e.display),Er(e),xo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[S],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),N&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(A&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=xa(r.gutters,r.lineNumbers),So(i),n.init(i)}var Fi=0,Or=null;N?Or=-.53:A?Or=15:E?Or=-.7:_&&(Or=-1/3);function wo(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=wo(e);return t.x*=Or,t.y*=Or,t}function Co(e,t){var n=wo(t),r=n.x,i=n.y,S=e.display,I=S.scroller,j=I.scrollWidth>I.clientWidth,K=I.scrollHeight>I.clientHeight;if(!(r&&j||i&&K))return;if(i&&l&&D){e:for(var V=t.target,re=S.view;V!=I;V=V.parentNode)for(var ae=0;ae<re.length;ae++)if(re[ae].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!A&&!T&&Or!=null){i&&K&&oi(e,Math.max(0,I.scrollTop+i*Or)),xn(e,Math.max(0,I.scrollLeft+r*Or)),(!i||i&&K)&&Y(t),S.wheelStartX=null;return}if(i&&Or!=null){var fe=i*Or,ce=e.doc.scrollTop,De=ce+S.wrapper.clientHeight;fe<0?ce=Math.max(0,ce+fe-50):De=Math.min(e.doc.height,De+fe+50),ya(e,{top:ce,bottom:De})}Fi<20&&(S.wheelStartX==null?(S.wheelStartX=I.scrollLeft,S.wheelStartY=I.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Pe=I.scrollLeft-S.wheelStartX,Fe=I.scrollTop-S.wheelStartY,$e=Fe&&S.wheelDY&&Fe/S.wheelDY||Pe&&S.wheelDX&&Pe/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!$e)return;Or=(Or*Fi+$e)/(Fi+1),++Fi},200)):(S.wheelDX+=r,S.wheelDY+=i))}var Rr=function(e,t){this.ranges=e,this.primIndex=t};Rr.prototype.primary=function(){return this.ranges[this.primIndex]},Rr.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(!_r(n.anchor,r.anchor)||!_r(n.head,r.head))return!1}return!0},Rr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Dt(Pr(this.ranges[t].anchor),Pr(this.ranges[t].head));return new Rr(e,this.primIndex)},Rr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Rr.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 Dt=function(e,t){this.anchor=e,this.head=t};Dt.prototype.from=function(){return Vr(this.anchor,this.head)},Dt.prototype.to=function(){return je(this.anchor,this.head)},Dt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Br(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(fe,ce){return ft(fe.from(),ce.from())}),n=ne(t,i);for(var S=1;S<t.length;S++){var I=t[S],j=t[S-1],K=ft(j.to(),I.from());if(r&&!I.empty()?K>0:K>=0){var V=Vr(j.from(),I.from()),re=je(j.to(),I.to()),ae=j.empty()?I.from()==I.head:j.from()==j.head;S<=n&&--n,t.splice(--S,2,new Dt(ae?re:V,ae?V:re))}}return new Rr(t,n)}function ln(e,t){return new Rr([new Dt(e,t||e)],0)}function un(e){return e.text?Ue(e.from.line+e.text.length-1,Le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Lo(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return un(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+=un(t).ch-t.to.ch),Ue(n,r)}function Ta(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Dt(Lo(i.anchor,t),Lo(i.head,t)))}return Br(e.cm,n,e.sel.primIndex)}function Ao(e,t,n){return e.line==t.line?Ue(n.line,e.ch-t.ch+n.ch):Ue(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ue(e.first,0),S=i,I=0;I<t.length;I++){var j=t[I],K=Ao(j.from,i,S),V=Ao(un(j),i,S);if(i=j.to,S=V,n=="around"){var re=e.sel.ranges[I],ae=ft(re.head,re.anchor)<0;r[I]=new Dt(ae?V:K,ae?K:V)}else r[I]=new Dt(K,K)}return new Rr(r,e.sel.primIndex)}function Sa(e){e.doc.mode=sr(e.options,e.doc.modeOption),ci(e)}function ci(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,ui(e,100),e.state.modeGen++,e.curOp&&Er(e)}function Do(e,t){return t.from.ch==0&&t.to.ch==0&&Le(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function wa(e,t,n,r){function i(rt){return n?n[rt]:null}function S(rt,Je,at){Jr(rt,Je,at,r),ar(rt,"change",rt,t)}function I(rt,Je){for(var at=[],ht=rt;ht<Je;++ht)at.push(new qt(V[ht],i(ht),r));return at}var j=t.from,K=t.to,V=t.text,re=nt(e,j.line),ae=nt(e,K.line),fe=Le(V),ce=i(V.length-1),De=K.line-j.line;if(t.full)e.insert(0,I(0,V.length)),e.remove(V.length,e.size-V.length);else if(Do(e,t)){var Pe=I(0,V.length-1);S(ae,ae.text,ce),De&&e.remove(j.line,De),Pe.length&&e.insert(j.line,Pe)}else if(re==ae)if(V.length==1)S(re,re.text.slice(0,j.ch)+fe+re.text.slice(K.ch),ce);else{var Fe=I(1,V.length-1);Fe.push(new qt(fe+re.text.slice(K.ch),ce,r)),S(re,re.text.slice(0,j.ch)+V[0],i(0)),e.insert(j.line+1,Fe)}else if(V.length==1)S(re,re.text.slice(0,j.ch)+V[0]+ae.text.slice(K.ch),i(0)),e.remove(j.line+1,De);else{S(re,re.text.slice(0,j.ch)+V[0],i(0)),S(ae,fe+ae.text.slice(K.ch),ce);var $e=I(1,V.length-1);De>1&&e.remove(j.line+1,De-1),e.insert(j.line+1,$e)}ar(e,"change",e,t)}function dn(e,t,n){function r(i,S,I){if(i.linked)for(var j=0;j<i.linked.length;++j){var K=i.linked[j];if(K.doc==S)continue;var V=I&&K.sharedHist;if(n&&!V)continue;t(K.doc,V),r(K.doc,i,V)}}r(e,null,!0)}function _o(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,fa(e),Sa(e),Oo(e),e.options.lineWrapping||Zt(e),e.options.mode=t.modeOption,Er(e)}function Oo(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){Lr(e,function(){Oo(e),Er(e)})}function Bi(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 Ca(e,t){var n={from:Pr(t.from),to:un(t),text:Ft(e,t.from,t.to)};return Po(e,n,t.from.line,t.to.line+1),dn(e,function(r){return Po(r,n,t.from.line,t.to.line+1)},!0),n}function Ro(e){for(;e.length;){var t=Le(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Ro(e.done),Le(e.done);if(e.done.length&&!Le(e.done).ranges)return Le(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Le(e.done)}function Mo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,I,j;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(I=ml(i,i.lastOp==r)))j=Le(I.changes),ft(t.from,t.to)==0&&ft(t.from,j.to)==0?j.to=un(t):I.changes.push(Ca(e,t));else{var K=Le(i.done);for((!K||!K.ranges)&&ji(e.sel,i.done),I={changes:[Ca(e,t)],generation:i.generation},i.done.push(I);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,j||Se(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||pl(e,S,Le(i.done),t))?i.done[i.done.length-1]=t:ji(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ro(i.undone)}function ji(e,t){var n=Le(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Po(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(I){I.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=I.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function ko(e,t){var n=yl(e,t),r=Yr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],I=r[i];if(S&&I){e:for(var j=0;j<I.length;++j){for(var K=I[j],V=0;V<S.length;++V)if(S[V].marker==K.marker)continue e;S.push(K)}}else I&&(n[i]=I)}return n}function Bn(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?Rr.prototype.deepCopy.call(S):S);continue}var I=S.changes,j=[];r.push({changes:j});for(var K=0;K<I.length;++K){var V=I[K],re=void 0;if(j.push({from:V.from,to:V.to,text:V.text}),t)for(var ae in V)(re=ae.match(/^spans_(\d+)$/))&&(ne(t,Number(re[1]))>-1&&(Le(j)[ae]=V[ae],delete V[ae]))}}return r}function La(e,t,n,r){if(r){var i=e.anchor;if(n){var S=ft(t,i)<0;S!=ft(n,i)<0?(i=t,t=n):S!=ft(t,n)<0&&(t=n)}return new Dt(i,t)}else return new Dt(n||t,t)}function Wi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ur(e,new Rr([La(e.sel.primary(),t,n,i)],0),r)}function Io(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=La(e.sel.ranges[S],t[S],null,i);var I=Br(e.cm,r,e.sel.primIndex);ur(e,I,n)}function Aa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,ur(e,Br(e.cm,i,e.sel.primIndex),r)}function Uo(e,t,n,r){ur(e,ln(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var S=0;S<i.length;S++)this.ranges[S]=new Dt(ct(e,i[S].anchor),ct(e,i[S].head))},origin:n&&n.origin};return Se(e,"beforeSelectionChange",e,r),e.cm&&Se(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Br(e.cm,r.ranges,r.ranges.length-1):t}function No(e,t,n){var r=e.history.done,i=Le(r);i&&i.ranges?(r[r.length-1]=t,Hi(e,t,n)):ur(e,t,n)}function ur(e,t,n){Hi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Hi(e,t,n){(ie(e,"beforeSelectionChange")||e.cm&&ie(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Fo(e,jo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Nn(e.cm)}function Fo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,le(e.cm)),ar(e,"cursorActivity",e)}function Bo(e){Fo(e,jo(e,e.sel,null,!1))}function jo(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var I=t.ranges[S],j=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],K=Ki(e,I.anchor,j&&j.anchor,n,r),V=Ki(e,I.head,j&&j.head,n,r);(i||K!=I.anchor||V!=I.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new Dt(K,V))}return i?Br(e.cm,i,t.primIndex):t}function jn(e,t,n,r,i){var S=nt(e,t.line);if(S.markedSpans)for(var I=0;I<S.markedSpans.length;++I){var j=S.markedSpans[I],K=j.marker,V="selectLeft"in K?!K.selectLeft:K.inclusiveLeft,re="selectRight"in K?!K.selectRight:K.inclusiveRight;if((j.from==null||(V?j.from<=t.ch:j.from<t.ch))&&(j.to==null||(re?j.to>=t.ch:j.to>t.ch))){if(i&&(Se(K,"beforeCursorEnter"),K.explicitlyCleared))if(S.markedSpans){--I;continue}else break;if(!K.atomic)continue;if(n){var ae=K.find(r<0?1:-1),fe=void 0;if((r<0?re:V)&&(ae=Wo(e,ae,-r,ae&&ae.line==t.line?S:null)),ae&&ae.line==t.line&&(fe=ft(ae,n))&&(r<0?fe<0:fe>0))return jn(e,ae,t,r,i)}var ce=K.find(r<0?-1:1);return(r<0?V:re)&&(ce=Wo(e,ce,r,ce.line==t.line?S:null)),ce?jn(e,ce,t,r,i):null}}return t}function Ki(e,t,n,r,i){var S=r||1,I=jn(e,t,n,S,i)||!i&&jn(e,t,n,S,!0)||jn(e,t,n,-S,i)||!i&&jn(e,t,n,-S,!0);return I||(e.cantEdit=!0,Ue(e.first,0))}function Wo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ct(e,Ue(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Ue(t.line+1,0):null:new Ue(t.line,t.ch+n)}function Ho(e){e.setSelection(Ue(e.firstLine(),0),Ue(e.lastLine()),he)}function Ko(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,S,I,j){i&&(r.from=ct(e,i)),S&&(r.to=ct(e,S)),I&&(r.text=I),j!==void 0&&(r.origin=j)}),Se(e,"beforeChange",e,r),e.cm&&Se(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 Wn(e,t,n){if(e.cm){if(!e.cm.curOp)return er(e.cm,Wn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ie(e,"beforeChange")||e.cm&&ie(e.cm,"beforeChange"))&&(t=Ko(e,t,!0),!t))return;var r=Ur&&!n&&On(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Go(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Go(e,t)}function Go(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Ta(e,t);Mo(e,t,n,e.cm?e.cm.curOp.id:NaN),fi(e,t,n,Yr(e,t));var r=[];dn(e,function(i,S){!S&&ne(r,i.history)==-1&&(Yo(i.history,t),r.push(i.history)),fi(i,t,null,Yr(i,t))})}function Gi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,I=e.sel,j=t=="undo"?i.done:i.undone,K=t=="undo"?i.undone:i.done,V=0;V<j.length&&!(S=j[V],n?S.ranges&&!S.equals(e.sel):!S.ranges);V++);if(V==j.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=j.pop(),S.ranges){if(ji(S,K),n&&!S.equals(e.sel)){ur(e,S,{clearRedo:!1});return}I=S}else if(r){j.push(S);return}else break;var re=[];ji(I,K),K.push({changes:re,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var ae=ie(e,"beforeChange")||e.cm&&ie(e.cm,"beforeChange"),fe=function(Pe){var Fe=S.changes[Pe];if(Fe.origin=t,ae&&!Ko(e,Fe,!1))return j.length=0,{};re.push(Ca(e,Fe));var $e=Pe?Ta(e,Fe):Le(j);fi(e,Fe,$e,ko(e,Fe)),!Pe&&e.cm&&e.cm.scrollIntoView({from:Fe.from,to:un(Fe)});var rt=[];dn(e,function(Je,at){!at&&ne(rt,Je.history)==-1&&(Yo(Je.history,Fe),rt.push(Je.history)),fi(Je,Fe,null,ko(Je,Fe))})},ce=S.changes.length-1;ce>=0;--ce){var De=fe(ce);if(De)return De.v}}function zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Rr(We(e.sel.ranges,function(i){return new Dt(Ue(i.anchor.line+t,i.anchor.ch),Ue(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Er(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)on(e.cm,r,"gutter")}}function fi(e,t,n,r){if(e.cm&&!e.cm.curOp)return er(e.cm,fi)(e,t,n,r);if(t.to.line<e.first){zo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);zo(e,i),t={from:Ue(e.first,0),to:Ue(t.to.line+i,t.to.ch),text:[Le(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Ue(S,nt(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ft(e,t.from,t.to),n||(n=Ta(e,t)),e.cm?El(e.cm,t,r):wa(e,t,r),Hi(e,n,he),e.cantEdit&&Ki(e,Ue(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,I=t.to,j=!1,K=S.line;e.options.lineWrapping||(K=St(Nr(nt(r,S.line))),r.iter(K,I.line+1,function(ce){if(ce==i.maxLine)return j=!0,!0})),r.sel.contains(t.from,t.to)>-1&&le(e),wa(r,t,n,so(e)),e.options.lineWrapping||(r.iter(K,S.line+t.text.length,function(ce){var De=Ht(ce);De>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=De,i.maxLineChanged=!0,j=!1)}),j&&(e.curOp.updateMaxLine=!0)),Cr(r,S.line),ui(e,400);var V=t.text.length-(I.line-S.line)-1;t.full?Er(e):S.line==I.line&&t.text.length==1&&!Do(e.doc,t)?on(e,S.line,"text"):Er(e,S.line,I.line+1,V);var re=ie(e,"changes"),ae=ie(e,"change");if(ae||re){var fe={from:S,to:I,text:t.text,removed:t.removed,origin:t.origin};ae&&ar(e,"change",e,fe),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(fe)}e.display.selForContextMenu=null}function Hn(e,t,n,r,i){var S;r||(r=n),ft(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Wn(e,{from:n,to:r,text:t,origin:i})}function Vo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Xo(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],I=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var j=0;j<S.ranges.length;j++)Vo(S.ranges[j].anchor,t,n,r),Vo(S.ranges[j].head,t,n,r);continue}for(var K=0;K<S.changes.length;++K){var V=S.changes[K];if(n<V.from.line)V.from=Ue(V.from.line+r,V.from.ch),V.to=Ue(V.to.line+r,V.to.ch);else if(t<=V.to.line){I=!1;break}}I||(e.splice(0,i+1),i=0)}}function Yo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Xo(e.done,n,r,i),Xo(e.undone,n,r,i)}function hi(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=nt(e,An(e,t)):i=St(t),i==null?null:(r(S,i)&&e.cm&&on(e.cm,i,n),S)}function mi(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}mi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,zt(i),ar(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 pi(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}pi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var S=Math.min(t,i-e),I=r.height;if(r.removeInner(e,S),this.height-=I-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mi))){var j=[];this.collapse(j),this.children=[new mi(j)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var I=i.lines.length%25+25,j=I;j<i.lines.length;){var K=new mi(i.lines.slice(j,j+=25));i.height-=K.height,this.children.splice(++r,0,K),K.parent=this}i.lines=i.lines.slice(0,I),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new pi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ne(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new pi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<S){var I=Math.min(t,S-e);if(i.iterN(e,I,n))return!0;if((t-=I)==0)break;e=0}else e-=S}}};var gi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};gi.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 S=ri(this);yr(n,Math.max(0,n.height-S)),e&&(Lr(e,function(){$o(e,n,-S),on(e,r,"widget")}),ar(e,"lineWidgetCleared",e,this,r))},gi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ri(this)-t;if(!i)return;Ct(this.doc,r)||yr(r,r.height+i),n&&Lr(n,function(){n.curOp.forceUpdate=!0,$o(n,r,i),ar(n,"lineWidgetChanged",n,e,St(r))})},ee(gi);function $o(e,t,n){kt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ga(e,n)}function xl(e,t,n,r){var i=new gi(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),hi(e,t,"widget",function(I){var j=I.widgets||(I.widgets=[]);if(i.insertAt==null?j.push(i):j.splice(Math.min(j.length-1,Math.max(0,i.insertAt)),0,i),i.line=I,S&&!Ct(e,I)){var K=kt(I)<e.scrollTop;yr(I,I.height+ri(i)),K&&ga(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&ar(S,"lineWidgetAdded",S,i,typeof t=="number"?t:St(t)),i}var Jo=0,cn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Jo};cn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Sn(e),ie(this,"clear")){var n=this.find();n&&ar(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var I=this.lines[S],j=rn(I.markedSpans,this);e&&!this.collapsed?on(e,St(I),"text"):e&&(j.to!=null&&(i=St(I)),j.from!=null&&(r=St(I))),I.markedSpans=Zi(I.markedSpans,j),j.from==null&&this.collapsed&&!Ct(this.doc,I)&&e&&yr(I,kn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var K=0;K<this.lines.length;++K){var V=Nr(this.lines[K]),re=Ht(V);re>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Er(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Bo(e.doc)),e&&ar(e,"markerCleared",e,this,r,i),t&&wn(e),this.parent&&this.parent.clear()},cn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var S=this.lines[i],I=rn(S.markedSpans,this);if(I.from!=null&&(n=Ue(t?S:St(S),I.from),e==-1))return n;if(I.to!=null&&(r=Ue(t?S:St(S),I.to),e==1))return r}return n&&{from:n,to:r}},cn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Lr(r,function(){var i=t.line,S=St(t.line),I=ia(r,S);if(I&&(qa(I),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ct(n.doc,i)&&n.height!=null){var j=n.height;n.height=null;var K=ri(n)-j;K&&yr(i,i.height+K)}ar(r,"markerChanged",r,e)})},cn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ne(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},cn.prototype.detachLine=function(e){if(this.lines.splice(ne(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ee(cn);function Kn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return er(e.cm,Kn)(e,t,n,r,i);var S=new cn(e,i),I=ft(t,n);if(r&&U(r,S,!1),I>0||I==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=v("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(ea(e,t.line,t,n,S)||t.line!=n.line&&ea(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");Li()}S.addToHistory&&Mo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var j=t.line,K=e.cm,V;if(e.iter(j,n.line+1,function(ae){K&&S.collapsed&&!K.options.lineWrapping&&Nr(ae)==K.display.maxLine&&(V=!0),S.collapsed&&j!=t.line&&yr(ae,0),Ai(ae,new mn(S,j==t.line?t.ch:null,j==n.line?n.ch:null)),++j}),S.collapsed&&e.iter(t.line,n.line+1,function(ae){Ct(e,ae)&&yr(ae,0)}),S.clearOnEnter&&be(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Ci(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++Jo,S.atomic=!0),K){if(V&&(K.curOp.updateMaxLine=!0),S.collapsed)Er(K,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var re=t.line;re<=n.line;re++)on(K,re,"text");S.atomic&&Bo(K.doc),ar(K,"markerAdded",K,S)}return S}var vi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};vi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ar(this,"clear")},vi.prototype.find=function(e,t){return this.primary.find(e,t)},ee(vi);function Tl(e,t,n,r,i){r=U(r),r.shared=!1;var S=[Kn(e,t,n,r,i)],I=S[0],j=r.widgetNode;return dn(e,function(K){j&&(r.widgetNode=j.cloneNode(!0)),S.push(Kn(K,ct(K,t),ct(K,n),r,i));for(var V=0;V<K.linked.length;++V)if(K.linked[V].isParent)return;I=Le(S)}),new vi(S,I)}function Qo(e){return e.findMarks(Ue(e.first,0),e.clipPos(Ue(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),S=e.clipPos(i.from),I=e.clipPos(i.to);if(ft(S,I)){var j=Kn(e,S,I,r.primary,r.primary.type);r.markers.push(j),j.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];dn(i.primary.doc,function(K){return S.push(K)});for(var I=0;I<i.markers.length;I++){var j=i.markers[I];ne(S,j.doc)==-1&&(j.parent=null,i.markers.splice(I--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,xr=function(e,t,n,r,i){if(!(this instanceof xr))return new xr(e,t,n,r,i);n==null&&(n=0),pi.call(this,[new mi([new qt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Ue(n,0);this.sel=ln(S),this.history=new Bi(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)),wa(this,{from:S,to:S,text:e}),ur(this,ln(S),he)};xr.prototype=Oe(pi.prototype,{constructor:xr,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=vr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:tr(function(e){var t=Ue(this.first,0),n=this.first+this.size-1;Wn(this,{from:t,to:Ue(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ai(this.cm,0,0),ur(this,ln(t),he)}),replaceRange:function(e,t,n,r){t=ct(this,t),n=n?ct(this,n):t,Hn(this,e,t,n,r)},getRange:function(e,t,n){var r=Ft(this,ct(this,e),ct(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(Ir(this,e))return nt(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),Nr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ct(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:tr(function(e,t,n){Uo(this,ct(this,typeof e=="number"?Ue(e,t||0):e),null,n)}),setSelection:tr(function(e,t,n){Uo(this,ct(this,e),ct(this,t||e),n)}),extendSelection:tr(function(e,t,n){Wi(this,ct(this,e),t&&ct(this,t),n)}),extendSelections:tr(function(e,t){Io(this,Hr(this,e),t)}),extendSelectionsBy:tr(function(e,t){var n=We(this.sel.ranges,e);Io(this,Hr(this,n),t)}),setSelections:tr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Dt(ct(this,e[i].anchor),ct(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),ur(this,Br(this.cm,r,t),n)}),addSelection:tr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Dt(ct(this,e),ct(this,t||e))),ur(this,Br(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Ft(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=Ft(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:tr(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var I=i.ranges[S];r[S]={from:I.from(),to:I.to(),text:this.splitLines(e[S]),origin:n}}for(var j=t&&t!="end"&&fl(this,r,t),K=r.length-1;K>=0;K--)Wn(this,r[K]);j?No(this,j):this.cm&&Nn(this.cm)}),undo:tr(function(){Gi(this,"undo")}),redo:tr(function(){Gi(this,"redo")}),undoSelection:tr(function(){Gi(this,"undo",!0)}),redoSelection:tr(function(){Gi(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 Bi(this.history.maxGeneration),dn(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:Bn(this.history.done),undone:Bn(this.history.undone)}},setHistory:function(e){var t=this.history=new Bi(this.history.maxGeneration);t.done=Bn(e.done.slice(0),null,!0),t.undone=Bn(e.undone.slice(0),null,!0)},setGutterMarker:tr(function(e,t,n){return hi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Ne(i)&&(r.gutterMarkers=null),!0})}),clearGutter:tr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&hi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ne(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Ir(this,e))return null;if(t=e,e=nt(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:tr(function(e,t,n){return hi(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(x(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:tr(function(e,t,n){return hi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[i];if(S)if(n==null)r[i]=null;else{var I=S.match(x(n));if(!I)return!1;var j=I.index+I[0].length;r[i]=S.slice(0,I.index)+(!I.index||j==S.length?"":" ")+S.slice(j)||null}else return!1;return!0})}),addLineWidget:tr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Kn(this,ct(this,e),ct(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=ct(this,e),Kn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ct(this,e);var t=[],n=nt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ct(this,e),t=ct(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var I=S.markedSpans;if(I)for(var j=0;j<I.length;j++){var K=I[j];!(K.to!=null&&i==e.line&&e.ch>=K.to||K.from==null&&i!=e.line||K.from!=null&&i==t.line&&K.from>=t.ch)&&(!n||n(K.marker))&&r.push(K.marker.parent||K.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++n}),ct(this,Ue(n,t))},indexFromPos:function(e){e=ct(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 xr(vr(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 xr(vr(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,Qo(this)),r},unlinkDoc:function(e){if(e instanceof Bt&&(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(Qo(this));break}if(e.history==this.history){var r=[e.id];dn(e,function(i){return r.push(i.id)},!0),e.history=new Bi(null),e.history.done=Bn(this.history.done,r),e.history.undone=Bn(this.history.undone,r)}},iterLinkedDocs:function(e){dn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):pt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:tr(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)})}),xr.prototype.eachLine=xr.prototype.iter;var Zo=0;function Ll(e){var t=this;if(qo(t),ke(t,e)||qr(t.display,e))return;Y(e),N&&(Zo=+new Date);var n=bn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,S=Array(i),I=0,j=function(){++I==i&&er(t,function(){n=ct(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(S.filter(function(De){return De!=null}).join(t.doc.lineSeparator())),origin:"paste"};Wn(t.doc,ce),No(t.doc,ln(ct(t.doc,n),ct(t.doc,un(ce))))})()},K=function(ce,De){if(t.options.allowDropFileTypes&&ne(t.options.allowDropFileTypes,ce.type)==-1){j();return}var Pe=new FileReader;Pe.onerror=function(){return j()},Pe.onload=function(){var Fe=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Fe)){j();return}S[De]=Fe,j()},Pe.readAsText(ce)},V=0;V<r.length;V++)K(r[V],V);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var re=e.dataTransfer.getData("Text");if(re){var ae;if(t.state.draggingText&&!t.state.draggingText.copy&&(ae=t.listSelections()),Hi(t.doc,ln(n,n)),ae)for(var fe=0;fe<ae.length;++fe)Hn(t.doc,"",ae[fe].anchor,ae[fe].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(ce){}}}function Al(e,t){if(N&&(!e.state.draggingText||+new Date-Zo<100)){q(t);return}if(ke(e,t)||qr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),T&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=bn(e,t);if(!n)return;var r=document.createDocumentFragment();co(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function qo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function es(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var S=0;S<n.length;S++)e(n[S])})}var ts=!1;function _l(){if(ts)return;Ol(),ts=!0}function Ol(){var e;be(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,es(Rl)},100))}),be(window,"blur",function(){return es(Un)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var fn={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"},yi=0;yi<10;yi++)fn[yi+48]=fn[yi+96]=String(yi);for(var zi=65;zi<=90;zi++)fn[zi]=String.fromCharCode(zi);for(var bi=1;bi<=12;bi++)fn[bi+111]=fn[bi+63235]="F"+bi;var en={};en.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"},en.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"},en.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"},en.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"]},en.default=l?en.macDefault:en.pcDefault;function Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,I=0;I<t.length-1;I++){var j=t[I];if(/^(cmd|meta|m)$/i.test(j))S=!0;else if(/^a(lt)?$/i.test(j))n=!0;else if(/^(c|ctrl|control)$/i.test(j))r=!0;else if(/^s(hift)?$/i.test(j))i=!0;else throw new Error("Unrecognized modifier name: "+j)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(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=We(n.split(" "),Ml),S=0;S<i.length;S++){var I=void 0,j=void 0;S==i.length-1?(j=i.join(" "),I=r):(j=i.slice(0,S+1).join(" "),I="...");var K=t[j];if(!K)t[j]=I;else if(K!=I)throw new Error("Inconsistent bindings for "+j)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Gn(e,t,n,r){t=Vi(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 Gn(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var I=Gn(e,t.fallthrough[S],n,r);if(I)return I}}}function rs(e){var t=typeof e=="string"?e:fn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ns(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function is(e,t){if(T&&e.keyCode==34&&e.char)return!1;var n=fn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ns(n,e,t))}function Vi(e){return typeof e=="string"?en[e]:e}function zn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&ft(S.from,Le(r).to)<=0;){var I=r.pop();if(ft(I.from,S.from)<0){S.from=I.from;break}}r.push(S)}Lr(e,function(){for(var j=r.length-1;j>=0;j--)Hn(e.doc,"",r[j].from,r[j].to,"+delete");Nn(e)})}function Da(e,t,n){var r=Re(e.text,t+n,n);return r<0||r>e.text.length?null:r}function _a(e,t,n){var r=Da(e,t.ch,n);return r==null?null:new Ue(t.line,r,n<0?"after":"before")}function Oa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Xe(n,t.doc.direction);if(S){var I=i<0?Le(S):S[0],j=i<0==(I.level==1),K=j?"after":"before",V;if(I.level>0||t.doc.direction=="rtl"){var re=Pn(t,n);V=i<0?n.text.length-1:0;var ae=Gr(t,re,V).top;V=Ke(function(fe){return Gr(t,re,fe).top==ae},i<0==(I.level==1)?I.from:I.to-1,V),K=="before"&&(V=Da(n,V,1))}else V=i<0?I.to:I.from;return new Ue(r,V,K)}}return new Ue(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Xe(t,e.doc.direction);if(!i)return _a(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var S=He(i,n.ch,n.sticky),I=i[S];if(e.doc.direction=="ltr"&&I.level%2==0&&(r>0?I.to>n.ch:I.from<n.ch))return _a(t,n,r);var j=function($e,rt){return Da(t,$e instanceof Ue?$e.ch:$e,rt)},K,V=function($e){return e.options.lineWrapping?(K=K||Pn(e,t),oo(e,t,K,$e)):{begin:0,end:t.text.length}},re=V(n.sticky=="before"?j(n,-1):n.ch);if(e.doc.direction=="rtl"||I.level==1){var ae=I.level==1==r<0,fe=j(n,ae?1:-1);if(fe!=null&&(ae?fe<=I.to&&fe<=re.end:fe>=I.from&&fe>=re.begin)){var ce=ae?"before":"after";return new Ue(n.line,fe,ce)}}var De=function($e,rt,Je){for(var at=function(Mt,rr){return rr?new Ue(n.line,j(Mt,1),"before"):new Ue(n.line,Mt,"after")};$e>=0&&$e<i.length;$e+=rt){var ht=i[$e],ut=rt>0==(ht.level!=1),Tt=ut?Je.begin:j(Je.end,-1);if(ht.from<=Tt&&Tt<ht.to)return at(Tt,ut);if(Tt=ut?ht.from:j(ht.to,-1),Je.begin<=Tt&&Tt<Je.end)return at(Tt,ut)}},Pe=De(S+r,r,re);if(Pe)return Pe;var Fe=r>0?re.end:j(re.begin,-1);return Fe!=null&&!(r>0&&Fe==t.text.length)&&(Pe=De(r>0?0:i.length-1,r,V(Fe)),Pe)?Pe:null}var Ei={selectAll:Ho,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),he)},killLine:function(e){return zn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ue(t.head.line+1,0)}:{from:t.head,to:Ue(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return zn(e,function(t){return{from:Ue(t.from().line,0),to:ct(e.doc,Ue(t.to().line+1,0))}})},delLineLeft:function(e){return zn(e,function(t){return{from:Ue(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return zn(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 zn(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(Ue(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ue(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return os(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")},ve)},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")},ve)},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/)?os(e,t.head):r},ve)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var S=n[i].from(),I=z(e.getLine(S.line),S.ch,r);t.push(de(r-I%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Lr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,S=nt(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Ue(i.line,i.ch-1)),i.ch>0)i=new Ue(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Ue(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var I=nt(e.doc,i.line-1).text;I&&(i=new Ue(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+I.charAt(I.length-1),Ue(i.line-1,I.length-1),i,"+transpose"))}}n.push(new Dt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Lr(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);Nn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function as(e,t){var n=nt(e.doc,t),r=Nr(n);return r!=n&&(t=St(r)),Oa(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=ja(n);return r!=n&&(t=St(r)),Oa(!0,e,n,t,-1)}function os(e,t){var n=as(e,t.line),r=nt(e.doc,n.line),i=Xe(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),I=t.line==n.line&&t.ch<=S&&t.ch;return Ue(n.line,I?0:S,n.sticky)}return n}function Xi(e,t,n){if(typeof t=="string"&&(t=Ei[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ce}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Gn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Gn(t,e.options.extraKeys,n,e)||Gn(t,e.options.keyMap,n,e)}var Nl=new Z;function xi(e,t,n,r){var i=e.state.keySeq;if(i){if(rs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ss(e,i+" "+t,n,r))return!0}return ss(e,t,n,r)}function ss(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&ar(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),ha(e)),!!i}function ls(e,t){var n=is(t,!0);return n?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+n,t,function(r){return Xi(e,r,!0)})||xi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Xi(e,r)}):xi(e,n,t,function(r){return Xi(e,r)}):!1}function Fl(e,t,n){return xi(e,"'"+n+"'",t,function(r){return Xi(e,r,!0)})}var Ra=null;function us(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=P(),ke(t,e))return;N&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ls(t,e);T&&(Ra=r?n:null,!r&&n==88&&!Rt&&(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;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}be(document,"keyup",n),be(document,"mouseover",n)}function ds(e){e.keyCode==16&&(this.doc.sel.shift=!1),ke(this,e)}function cs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(qr(t.display,e)||ke(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(T&&n==Ra){Ra=null,Y(e);return}if(T&&(!e.which||e.which<10)&&ls(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,Ma=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ma.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var Ti,Si;function Wl(e,t){var n=+new Date;return Si&&Si.compare(n,e,t)?(Ti=Si=null,"triple"):Ti&&Ti.compare(n,e,t)?(Si=new Ma(n,e,t),Ti=null,"double"):(Ti=new Ma(n,e,t),Si=null,"single")}function fs(e){var t=this,n=t.display;if(ke(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,qr(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Pa(t,e))return;var r=bn(t,e),i=ge(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):ue(e)==n.scroller&&Y(e):i==2?(r&&Wi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):ho(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,xi(e,ns(S,i),i,function(I){if(typeof I=="string"&&(I=Ei[I]),!I)return!1;var j=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),j=I(e,n)!=Ce}finally{e.state.suppressEdits=!1}return j})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){N?setTimeout(B(fo,e),0):e.curOp.focus=P();var i=Kl(e,n,r),S=e.doc.sel,I;e.options.dragDrop&&_e&&!e.isReadOnly()&&n=="single"&&(I=S.contains(t))>-1&&(ft((I=S.ranges[I]).from(),t)<0||t.xRel>0)&&(ft(I.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,S=!1,I=er(e,function(V){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",I),Ye(i.wrapper.ownerDocument,"mousemove",j),Ye(i.scroller,"dragstart",K),Ye(i.scroller,"drop",I),S||(Y(V),r.addNew||Wi(e.doc,n,null,null,r.extend),D&&!_||N&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),j=function(V){S=S||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},K=function(){return S=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=I,I.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),be(i.wrapper.ownerDocument,"mouseup",I),be(i.wrapper.ownerDocument,"mousemove",j),be(i.scroller,"dragstart",K),be(i.scroller,"drop",I),ho(e),setTimeout(function(){return i.input.focus()},20)}function hs(e,t,n){if(n=="char")return new Dt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Dt(Ue(t.line,0),ct(e.doc,Ue(t.line+1,0)));var r=n(e,t);return new Dt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;Y(t);var I,j,K=S.sel,V=K.ranges;if(r.addNew&&!r.extend?(j=S.sel.contains(n),j>-1?I=V[j]:I=new Dt(n,n)):(I=S.sel.primary(),j=S.sel.primIndex),r.unit=="rectangle")r.addNew||(I=new Dt(n,n)),n=bn(e,t,!0,!0),j=-1;else{var re=hs(e,n,r.unit);r.extend?I=La(I,re.anchor,re.head,r.extend):I=re}r.addNew?j==-1?(j=V.length,ur(S,Br(e,V.concat([I]),j),{scroll:!1,origin:"*mouse"})):V.length>1&&V[j].empty()&&r.unit=="char"&&!r.extend?(ur(S,Br(e,V.slice(0,j).concat(V.slice(j+1)),0),{scroll:!1,origin:"*mouse"}),K=S.sel):Aa(S,j,I,we):(j=0,ur(S,new Rr([I],0),we),K=S.sel);var ae=n;function fe(Je){if(ft(ae,Je)==0)return;if(ae=Je,r.unit=="rectangle"){for(var at=[],ht=e.options.tabSize,ut=z(nt(S,n.line).text,n.ch,ht),Tt=z(nt(S,Je.line).text,Je.ch,ht),Mt=Math.min(ut,Tt),rr=Math.max(ut,Tt),Wt=Math.min(n.line,Je.line),Ar=Math.min(e.lastLine(),Math.max(n.line,Je.line));Wt<=Ar;Wt++){var Tr=nt(S,Wt).text,Vt=pe(Tr,Mt,ht);Mt==rr?at.push(new Dt(Ue(Wt,Vt),Ue(Wt,Vt))):Tr.length>Vt&&at.push(new Dt(Ue(Wt,Vt),Ue(Wt,pe(Tr,rr,ht))))}at.length||at.push(new Dt(n,n)),ur(S,Br(e,K.ranges.slice(0,j).concat(at),j),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var Sr=I,or=hs(e,Je,r.unit),Yt=Sr.anchor,Xt;ft(or.anchor,Yt)>0?(Xt=or.head,Yt=Vr(Sr.from(),or.anchor)):(Xt=or.anchor,Yt=je(Sr.to(),or.head));var Kt=K.ranges.slice(0);Kt[j]=Xl(e,new Dt(ct(S,Yt),Xt)),ur(S,Br(e,Kt,j),we)}}var ce=i.wrapper.getBoundingClientRect(),De=0;function Pe(Je){var at=++De,ht=bn(e,Je,!0,r.unit=="rectangle");if(!ht)return;if(ft(ht,ae)!=0){e.curOp.focus=P(),fe(ht);var ut=Ii(i,S);(ht.line>=ut.to||ht.line<ut.from)&&setTimeout(er(e,function(){De==at&&Pe(Je)}),150)}else{var Tt=Je.clientY<ce.top?-20:Je.clientY>ce.bottom?20:0;Tt&&setTimeout(er(e,function(){if(De!=at)return;i.scroller.scrollTop+=Tt,Pe(Je)}),50)}}function Fe(Je){e.state.selectingText=!1,De=Infinity,Je&&(Y(Je),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",$e),Ye(i.wrapper.ownerDocument,"mouseup",rt),S.history.lastSelOrigin=null}var $e=er(e,function(Je){Je.buttons===0||!ge(Je)?Fe(Je):Pe(Je)}),rt=er(e,Fe);e.state.selectingText=rt,be(i.wrapper.ownerDocument,"mousemove",$e),be(i.wrapper.ownerDocument,"mouseup",rt)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var S=Xe(i);if(!S)return t;var I=He(S,n.ch,n.sticky),j=S[I];if(j.from!=n.ch&&j.to!=n.ch)return t;var K=I+(j.from==n.ch==(j.level!=1)?0:1);if(K==0||K==S.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=He(S,r.ch,r.sticky),ae=re-I||(r.ch-n.ch)*(j.level==1?-1:1);re==K-1||re==K?V=ae<0:V=ae>0}var fe=S[K+(V?-1:0)],ce=V==(fe.level==1),De=ce?fe.from:fe.to,Pe=ce?"after":"before";return n.ch==De&&n.sticky==Pe?t:new Dt(new Ue(n.line,De,Pe),r)}function ms(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(fe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var I=e.display,j=I.lineDiv.getBoundingClientRect();if(S>j.bottom||!ie(e,n))return J(t);S-=j.top-I.viewOffset;for(var K=0;K<e.display.gutterSpecs.length;++K){var V=I.gutters.childNodes[K];if(V&&V.getBoundingClientRect().right>=i){var re=Dr(e.doc,S),ae=e.display.gutterSpecs[K];return Se(e,n,e,re,ae.className,t),J(t)}}}function Pa(e,t){return ms(e,t,"gutterClick",!0)}function ps(e,t){if(qr(e.display,t)||Yl(e,t))return;if(ke(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ie(e,"gutterContextMenu")?ms(e,t,"gutterContextMenu",!1):!1}function gs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ni(e)}var Vn={toString:function(){return"CodeMirror.Init"}},vs={},Yi={};function $l(e){var t=e.optionHandlers;function n(r,i,S,I){e.defaults[r]=i,S&&(t[r]=I?function(j,K,V){V!=Vn&&S(j,K,V)}:S)}e.defineOption=n,e.Init=Vn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Sa(r)},!0),n("indentUnit",2,Sa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ci(r),ni(r),Er(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],I=r.doc.first;r.doc.iter(function(K){for(var V=0;;){var re=K.text.indexOf(i,V);if(re==-1)break;V=re+i.length,S.push(Ue(I,re))}I++});for(var j=S.length-1;j>=0;j--)Hn(r.doc,i,S[j],Ue(S[j].line,S[j].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Vn&&r.refresh()}),n("specialCharPlaceholder",qn,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){gs(r),di(r)},!0),n("keyMap","default",function(r,i,S){var I=Vi(i),j=S!=Vn&&Vi(S);j&&j.detach&&j.detach(r,I),I.attach&&I.attach(r,j||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=xa(i,r.options.lineNumbers),di(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ca(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Fn(r)},!0),n("scrollbarStyle","native",function(r){bo(r),Fn(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=xa(r.options.gutters,i),di(r)},!0),n("firstLineNumber",1,di,!0),n("lineNumberFormatter",function(r){return r},di,!0),n("showCursorWhenSelecting",!1,ii,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Un(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ii,!0),n("singleCursorHeightPerLine",!0,ii,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ci,!0),n("addModeClass",!1,ci,!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,ci,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Vn;if(!t!=!r){var i=e.display.dragFunctions,S=t?be:Ye;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Zt(e)),fa(e),Er(e),ni(e),setTimeout(function(){return Fn(e)},100)}function Bt(e,t){var n=this;if(!(this instanceof Bt))return new Bt(e,t);this.options=t=t?U(t):{},U(vs,t,!1);var r=t.value;typeof r=="string"?r=new xr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Bt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,gs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),bo(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 Z,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),N&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),Sn(this),this.curOp.forceUpdate=!0,_o(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ma(n)},20):Un(this);for(var I in Yi)Yi.hasOwnProperty(I)&&Yi[I](this,t[I],Vn);To(this),t.finishInit&&t.finishInit(this);for(var j=0;j<ka.length;++j)ka[j](this);wn(this),D&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Bt.defaults=vs,Bt.optionHandlers=Yi;function Zl(e){var t=e.display;be(t.scroller,"mousedown",er(e,fs)),N&&k<11?be(t.scroller,"dblclick",er(e,function(K){if(ke(e,K))return;var V=bn(e,K);if(!V||Pa(e,K)||qr(e.display,K))return;Y(K);var re=e.findWordAt(V);Wi(e.doc,re.anchor,re.head)})):be(t.scroller,"dblclick",function(K){return ke(e,K)||Y(K)}),be(t.scroller,"contextmenu",function(K){return ps(e,K)}),be(t.input.getField(),"contextmenu",function(K){t.scroller.contains(K.target)||ps(e,K)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S(K){if(K.touches.length!=1)return!1;var V=K.touches[0];return V.radiusX<=1&&V.radiusY<=1}function I(K,V){if(V.left==null)return!0;var re=V.left-K.left,ae=V.top-K.top;return re*re+ae*ae>20*20}be(t.scroller,"touchstart",function(K){if(!ke(e,K)&&!S(K)&&!Pa(e,K)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},K.touches.length==1&&(t.activeTouch.left=K.touches[0].pageX,t.activeTouch.top=K.touches[0].pageY)}}),be(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),be(t.scroller,"touchend",function(K){var V=t.activeTouch;if(V&&!qr(t,K)&&V.left!=null&&!V.moved&&new Date-V.start<300){var re=e.coordsChar(t.activeTouch,"page"),ae;!V.prev||I(V,V.prev)?ae=new Dt(re,re):!V.prev.prev||I(V,V.prev.prev)?ae=e.findWordAt(re):ae=new Dt(Ue(re.line,0),ct(e.doc,Ue(re.line+1,0))),e.setSelection(ae.anchor,ae.head),e.focus(),Y(K)}i()}),be(t.scroller,"touchcancel",i),be(t.scroller,"scroll",function(){t.scroller.clientHeight&&(oi(e,t.scroller.scrollTop),xn(e,t.scroller.scrollLeft,!0),Se(e,"scroll",e))}),be(t.scroller,"mousewheel",function(K){return Co(e,K)}),be(t.scroller,"DOMMouseScroll",function(K){return Co(e,K)}),be(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(K){ke(e,K)||q(K)},over:function(K){ke(e,K)||(Dl(e,K),q(K))},start:function(K){return Al(e,K)},drop:er(e,Ll),leave:function(K){ke(e,K)||qo(e)}};var j=t.input.getField();be(j,"keyup",function(K){return ds.call(e,K)}),be(j,"keydown",er(e,us)),be(j,"keypress",er(e,cs)),be(j,"focus",function(K){return ma(e,K)}),be(j,"blur",function(K){return Un(e,K)})}var ka=[];Bt.defineInitHook=function(e){return ka.push(e)};function wi(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=Ee(e,t).state:n="prev");var I=e.options.tabSize,j=nt(i,t),K=z(j.text,null,I);j.stateAfter&&(j.stateAfter=null);var V=j.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(j.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(S,j.text.slice(V.length),j.text),re==Ce||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=z(nt(i,t-1).text,null,I):re=0:n=="add"?re=K+e.options.indentUnit:n=="subtract"?re=K-e.options.indentUnit:typeof n=="number"&&(re=K+n),re=Math.max(0,re);var ae="",fe=0;if(e.options.indentWithTabs)for(var ce=Math.floor(re/I);ce;--ce)fe+=I,ae+=" ";if(fe<re&&(ae+=de(re-fe)),ae!=V)return Hn(i,ae,Ue(t,0),Ue(t,V.length),"+input"),j.stateAfter=null,!0;for(var De=0;De<i.sel.ranges.length;De++){var Pe=i.sel.ranges[De];if(Pe.head.line==t&&Pe.head.ch<V.length){var Fe=Ue(t,V.length);Aa(i,De,new Dt(Fe,Fe));break}}}var jr=null;function $i(e){jr=e}function Ia(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var I=+new Date-200,j=i=="paste"||e.state.pasteIncoming>I,K=pt(t),V=null;if(j&&r.ranges.length>1)if(jr&&jr.text.join(`
`)==t){if(r.ranges.length%jr.text.length==0){V=[];for(var re=0;re<jr.text.length;re++)V.push(S.splitLines(jr.text[re]))}}else K.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=We(K,function($e){return[$e]}));for(var ae=e.curOp.updateInput,fe=r.ranges.length-1;fe>=0;fe--){var ce=r.ranges[fe],De=ce.from(),Pe=ce.to();ce.empty()&&(n&&n>0?De=Ue(De.line,De.ch-n):e.state.overwrite&&!j?Pe=Ue(Pe.line,Math.min(nt(S,Pe.line).text.length,Pe.ch+Le(K).length)):j&&jr&&jr.lineWise&&jr.text.join(`
`)==K.join(`
`)&&(De=Pe=Ue(De.line,0)));var Fe={from:De,to:Pe,text:V?V[fe%V.length]:K,origin:i||(j?"paste":e.state.cutIncoming>I?"cut":"+input")};Wn(e.doc,Fe),ar(e,"inputRead",e,Fe)}t&&!j&&bs(e,t),Nn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ae),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ys(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Lr(t,function(){return Ia(t,n,0,null,"paste")}),!0}function bs(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var S=e.getModeAt(i.head),I=!1;if(S.electricChars){for(var j=0;j<S.electricChars.length;j++)if(t.indexOf(S.electricChars.charAt(j))>-1){I=wi(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(I=wi(e,i.head.line,"smart")));I&&ar(e,"electricInput",e,i.head.line)}}function Es(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,S={anchor:Ue(i,0),head:Ue(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function xs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ts(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),xs(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var S=this.options,I=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&er(this,t[r])(this,i,I),Se(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"](Vi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:mr(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");Te(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(I){return I.priority}),this.state.modeGen++,Er(this)}),removeOverlay:mr(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var I=i[S].modeSpec;if(I==r||typeof r=="string"&&I.name==r){i.splice(S,1),this.state.modeGen++,Er(this);return}}}),indentLine:mr(function(r,i,S){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Ir(this.doc,r)&&wi(this,r,i,S)}),indentSelection:mr(function(r){for(var i=this.doc.sel.ranges,S=-1,I=0;I<i.length;I++){var j=i[I];if(j.empty())j.head.line>S&&(wi(this,j.head.line,r,!0),S=j.head.line,I==this.doc.sel.primIndex&&Nn(this));else{var K=j.from(),V=j.to(),re=Math.max(S,K.line);S=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ae=re;ae<S;++ae)wi(this,ae,r);var fe=this.doc.sel.ranges;K.ch==0&&i.length==fe.length&&fe[I].from().ch>0&&Aa(this.doc,I,new Dt(K,fe[I].to()),he)}}}),getTokenAt:function(r,i){return Qt(this,r,i)},getLineTokens:function(r,i){return Qt(this,Ue(r),i,!0)},getTokenTypeAt:function(r){r=ct(this.doc,r);var i=dt(this,nt(this.doc,r.line)),S=0,I=(i.length-1)/2,j=r.ch,K;if(j==0)K=i[2];else for(;;){var V=S+I>>1;if((V?i[V*2-1]:0)>=j)I=V;else if(i[V*2+1]<j)S=V+1;else{K=i[V*2+2];break}}var re=K?K.indexOf("overlay "):-1;return re<0?K:re==0?null:K.slice(0,re-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var S=[];if(!n.hasOwnProperty(i))return S;var I=n[i],j=this.getModeAt(r);if(typeof j[i]=="string")I[j[i]]&&S.push(I[j[i]]);else if(j[i])for(var K=0;K<j[i].length;K++){var V=I[j[i][K]];V&&S.push(V)}else j.helperType&&I[j.helperType]?S.push(I[j.helperType]):I[j.name]&&S.push(I[j.name]);for(var re=0;re<I._global.length;re++){var ae=I._global[re];ae.pred(j,this)&&ne(S,ae.val)==-1&&S.push(ae.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=An(S,r==null?S.first+S.size-1:r),Ee(this,r+1,i).state},cursorCoords:function(r,i){var S,I=this.doc.sel.primary();return r==null?S=I.head:typeof r=="object"?S=ct(this.doc,r):S=r?I.from():I.to(),Fr(this,S,i||"page")},charCoords:function(r,i){return oa(this,ct(this.doc,r),i||"page")},coordsChar:function(r,i){return r=no(this,r,i||"page"),la(this,r.left,r.top)},lineAtHeight:function(r,i){return r=no(this,{top:r,left:0},i||"page").top,Dr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var I=!1,j;if(typeof r=="number"){var K=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>K&&(r=K,I=!0),j=nt(this.doc,r)}else j=r;return Ri(this,j,{top:0,left:0},i||"page",S||I).top+(I?this.doc.height-kt(j):0)},defaultTextHeight:function(){return kn(this.display)},defaultCharWidth:function(){return In(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,I,j){var K=this.display;r=Fr(this,ct(this.doc,r));var V=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),K.sizer.appendChild(i),I=="over")V=r.top;else if(I=="above"||I=="near"){var ae=Math.max(K.wrapper.clientHeight,this.doc.height),fe=Math.max(K.sizer.clientWidth,K.lineSpace.clientWidth);(I=="above"||r.bottom+i.offsetHeight>ae)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ae&&(V=r.bottom),re+i.offsetWidth>fe&&(re=fe-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",j=="right"?(re=K.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(j=="left"?re=0:j=="middle"&&(re=(K.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),S&&Js(this,{left:re,top:V,right:re+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:mr(us),triggerOnKeyPress:mr(cs),triggerOnKeyUp:ds,triggerOnMouseDown:mr(fs),execCommand:function(r){if(Ei.hasOwnProperty(r))return Ei[r].call(null,this)},triggerElectric:mr(function(r){bs(this,r)}),findPosH:function(r,i,S,I){var j=1;i<0&&(j=-1,i=-i);for(var K=ct(this.doc,r),V=0;V<i&&!(K=Ua(this.doc,K,j,S,I),K.hitSide);++V);return K},moveH:mr(function(r,i){var S=this;this.extendSelectionsBy(function(I){return S.display.shift||S.doc.extend||I.empty()?Ua(S.doc,I.head,r,i,S.options.rtlMoveVisually):r<0?I.from():I.to()},ve)}),deleteH:mr(function(r,i){var S=this.doc.sel,I=this.doc;S.somethingSelected()?I.replaceSelection("",null,"+delete"):zn(this,function(j){var K=Ua(I,j.head,r,i,!1);return r<0?{from:K,to:j.head}:{from:j.head,to:K}})}),findPosV:function(r,i,S,I){var j=1,K=I;i<0&&(j=-1,i=-i);for(var V=ct(this.doc,r),re=0;re<i;++re){var ae=Fr(this,V,"div");if(K==null?K=ae.left:ae.left=K,V=Ss(this,ae,j,S),V.hitSide)break}return V},moveV:mr(function(r,i){var S=this,I=this.doc,j=[],K=!this.display.shift&&!I.extend&&I.sel.somethingSelected();if(I.extendSelectionsBy(function(re){if(K)return r<0?re.from():re.to();var ae=Fr(S,re.head,"div");re.goalColumn!=null&&(ae.left=re.goalColumn),j.push(ae.left);var fe=Ss(S,ae,r,i);return i=="page"&&re==I.sel.primary()&&ga(S,oa(S,fe,"div").top-ae.top),fe},ve),j.length)for(var V=0;V<I.sel.ranges.length;V++)I.sel.ranges[V].goalColumn=j[V]}),findWordAt:function(r){var i=this.doc,S=nt(i,r.line).text,I=r.ch,j=r.ch;if(S){var K=this.getHelper(r,"wordChars");(r.sticky=="before"||j==S.length)&&I?--I:++j;for(var V=S.charAt(I),re=Me(V,K)?function(ae){return Me(ae,K)}:/\s/.test(V)?function(ae){return/\s/.test(ae)}:function(ae){return!/\s/.test(ae)&&!Me(ae)};I>0&&re(S.charAt(I-1));)--I;for(;j<S.length&&re(S.charAt(j));)++j}return new Dt(Ue(r.line,I),Ue(r.line,j))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:mr(function(r,i){ai(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Kr(this)-this.display.barHeight,width:r.scrollWidth-Kr(this)-this.display.barWidth,clientHeight:na(this),clientWidth:vn(this)}},scrollIntoView:mr(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:Ue(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):po(this,r.from,r.to,r.margin)}),setSize:mr(function(r,i){var S=this,I=function(K){return typeof K=="number"||/^\d+$/.test(String(K))?K+"px":K};r!=null&&(this.display.wrapper.style.width=I(r)),i!=null&&(this.display.wrapper.style.height=I(i)),this.options.lineWrapping&&eo(this);var j=this.display.viewFrom;this.doc.iter(j,this.display.viewTo,function(K){if(K.widgets){for(var V=0;V<K.widgets.length;V++)if(K.widgets[V].noHScroll){on(S,j,"widget");break}}++j}),this.curOp.forceUpdate=!0,Se(this,"refresh",this)}),operation:function(r){return Lr(this,r)},startOperation:function(){return Sn(this)},endOperation:function(){return wn(this)},refresh:mr(function(){var r=this.display.cachedTextHeight;Er(this),this.curOp.forceUpdate=!0,ni(this),ai(this,this.doc.scrollLeft,this.doc.scrollTop),ba(this.display),(r==null||Math.abs(r-kn(this.display))>.5||this.options.lineWrapping)&&fa(this),Se(this,"refresh",this)}),swapDoc:mr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),_o(this,r),ni(this),this.display.input.reset(),ai(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,ar(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}},ee(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,I){e.registerHelper(r,i,I),n[r]._global.push({pred:S,val:I})}}function Ua(e,t,n,r,i){var S=t,I=n,j=nt(e,t.line),K=i&&e.direction=="rtl"?-n:n;function V(){var rt=t.line+K;return rt<e.first||rt>=e.first+e.size?!1:(t=new Ue(rt,t.ch,t.sticky),j=nt(e,rt))}function re(rt){var Je;if(r=="codepoint"){var at=j.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(at)?Je=null:Je=new Ue(t.line,Math.max(0,Math.min(j.text.length,t.ch+n*(at>=55296&&at<56320?2:1))),-n)}else i?Je=kl(e.cm,j,t,n):Je=_a(j,t,n);if(Je==null)if(!rt&&V())t=Oa(i,e.cm,j,t.line,K);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var ae=null,fe=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),De=!0;!(n<0&&!re(!De));De=!1){var Pe=j.text.charAt(t.ch)||`
`,Fe=Me(Pe,ce)?"w":fe&&Pe==`
`?"n":!fe||/\s/.test(Pe)?null:"p";if(fe&&!De&&!Fe&&(Fe="s"),ae&&ae!=Fe){n<0&&(n=1,re(),t.sticky="after");break}if(Fe&&(ae=Fe),n>0&&!re(!De))break}var $e=Ki(e,t,S,I,!0);return _r(S,$e)&&($e.hitSide=!0),$e}function Ss(e,t,n,r){var i=e.doc,S=t.left,I;if(r=="page"){var j=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),K=Math.max(j-.5*kn(e.display),3);I=(n>0?t.bottom:t.top)+n*K}else r=="line"&&(I=n>0?t.bottom+3:t.top-3);for(var V;!(V=la(e,S,I),!V.outside);){if(n<0?I<=0:I>=i.height){V.hitSide=!0;break}I+=n*5}return V}var Ot=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ot.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;xs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(j){for(var K=j.target;K;K=K.parentNode){if(K==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(K.className))break}return!1}be(i,"paste",function(j){if(!S(j)||ke(r,j)||ys(j,r))return;k<=11&&setTimeout(er(r,function(){return t.updateFromDOM()}),20)}),be(i,"compositionstart",function(j){t.composing={data:j.data,done:!1}}),be(i,"compositionupdate",function(j){t.composing||(t.composing={data:j.data,done:!1})}),be(i,"compositionend",function(j){t.composing&&(j.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),be(i,"touchstart",function(){return n.forceCompositionEnd()}),be(i,"input",function(){t.composing||t.readFromDOMSoon()});function I(j){if(!S(j)||ke(r,j))return;if(r.somethingSelected())$i({lineWise:!1,text:r.getSelections()}),j.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var K=Es(r);$i({lineWise:!0,text:K.text}),j.type=="cut"&&r.operation(function(){r.setSelections(K.ranges,0,he),r.replaceSelection("",null,"cut")})}else return;if(j.clipboardData){j.clipboardData.clearData();var V=jr.text.join(`
`);if(j.clipboardData.setData("Text",V),j.clipboardData.getData("Text")==V){j.preventDefault();return}}var re=Ts(),ae=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),ae.value=jr.text.join(`
`);var fe=document.activeElement;X(ae),setTimeout(function(){r.display.lineSpace.removeChild(re),fe.focus(),fe==i&&n.showPrimarySelection()},50)}be(i,"copy",I),be(i,"cut",I)},Ot.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ot.prototype.prepareSelection=function(){var e=uo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ot.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ot.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ot.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var S=Ji(t,e.anchorNode,e.anchorOffset),I=Ji(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&I&&!I.bad&&ft(Vr(S,I),r)==0&&ft(je(S,I),i)==0)return;var j=t.display.view,K=r.line>=t.display.viewFrom&&ws(t,r)||{node:j[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&ws(t,i);if(!V){var re=j[j.length-1].measure,ae=re.maps?re.maps[re.maps.length-1]:re.map;V={node:ae[ae.length-1],offset:ae[ae.length-2]-ae[ae.length-3]}}if(!K||!V){e.removeAllRanges();return}var fe=e.rangeCount&&e.getRangeAt(0),ce;try{ce=p(K.node,K.offset,V.offset,V.node)}catch(De){}ce&&(!A&&t.state.focused?(e.collapse(K.node,K.offset),ce.collapsed||(e.removeAllRanges(),e.addRange(ce))):(e.removeAllRanges(),e.addRange(ce)),fe&&e.anchorNode==null?e.addRange(fe):A&&this.startGracePeriod()),this.rememberSelection()},Ot.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)},Ot.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},Ot.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ot.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},Ot.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ot.prototype.blur=function(){this.div.blur()},Ot.prototype.getField=function(){return this.div},Ot.prototype.supportsTouch=function(){return!0},Ot.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Lr(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)},Ot.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ot.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&E&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=Ji(t,e.anchorNode,e.anchorOffset),r=Ji(t,e.focusNode,e.focusOffset);n&&r&&Lr(t,function(){ur(t.doc,ln(n,r),he),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ot.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=Ue(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ue(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,I,j;r.line==t.viewFrom||(S=En(e,r.line))==0?(I=St(t.view[0].line),j=t.view[0].node):(I=St(t.view[S].line),j=t.view[S-1].node.nextSibling);var K=En(e,i.line),V,re;if(K==t.view.length-1?(V=t.viewTo-1,re=t.lineDiv.lastChild):(V=St(t.view[K+1].line)-1,re=t.view[K+1].node.previousSibling),!j)return!1;for(var ae=e.doc.splitLines(tu(e,j,re,I,V)),fe=Ft(e.doc,Ue(I,0),Ue(V,nt(e.doc,V).text.length));ae.length>1&&fe.length>1;)if(Le(ae)==Le(fe))ae.pop(),fe.pop(),V--;else if(ae[0]==fe[0])ae.shift(),fe.shift(),I++;else break;for(var ce=0,De=0,Pe=ae[0],Fe=fe[0],$e=Math.min(Pe.length,Fe.length);ce<$e&&Pe.charCodeAt(ce)==Fe.charCodeAt(ce);)++ce;for(var rt=Le(ae),Je=Le(fe),at=Math.min(rt.length-(ae.length==1?ce:0),Je.length-(fe.length==1?ce:0));De<at&&rt.charCodeAt(rt.length-De-1)==Je.charCodeAt(Je.length-De-1);)++De;if(ae.length==1&&fe.length==1&&I==r.line)for(;ce&&ce>r.ch&&rt.charCodeAt(rt.length-De-1)==Je.charCodeAt(Je.length-De-1);)ce--,De++;ae[ae.length-1]=rt.slice(0,rt.length-De).replace(/^\u200b+/,""),ae[0]=ae[0].slice(ce).replace(/\u200b+$/,"");var ht=Ue(I,ce),ut=Ue(V,fe.length?Le(fe).length-De:0);if(ae.length>1||ae[0]||ft(ht,ut))return Hn(e.doc,ae,ht,ut,"+input"),!0},Ot.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ot.prototype.reset=function(){this.forceCompositionEnd()},Ot.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ot.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)},Ot.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Lr(this.cm,function(){return Er(e.cm)})},Ot.prototype.setUneditable=function(e){e.contentEditable="false"},Ot.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||er(this.cm,Ia)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ot.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ot.prototype.onContextMenu=function(){},Ot.prototype.resetPosition=function(){},Ot.prototype.needsContentAttribute=!0;function ws(e,t){var n=ia(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=$a(n,r,t.line),S=Xe(r,e.doc.direction),I="left";if(S){var j=He(S,t.ch);I=j%2?"right":"left"}var K=Za(i.map,t.ch,I);return K.offset=K.collapse=="right"?K.end:K.start,K}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Xn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",I=!1,j=e.doc.lineSeparator(),K=!1;function V(ce){return function(De){return De.id==ce}}function re(){I&&(S+=j,K&&(S+=j),I=K=!1)}function ae(ce){ce&&(re(),S+=ce)}function fe(ce){if(ce.nodeType==1){var De=ce.getAttribute("cm-text");if(De){ae(De);return}var Pe=ce.getAttribute("cm-marker"),Fe;if(Pe){var $e=e.findMarks(Ue(r,0),Ue(i+1,0),V(+Pe));$e.length&&(Fe=$e[0].find(0))&&ae(Ft(e.doc,Fe.from,Fe.to).join(j));return}if(ce.getAttribute("contenteditable")=="false")return;var rt=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;rt&&re();for(var Je=0;Je<ce.childNodes.length;Je++)fe(ce.childNodes[Je]);/^(pre|p)$/i.test(ce.nodeName)&&(K=!0),rt&&(I=!0)}else ce.nodeType==3&&ae(ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(fe(t),t==n);)t=t.nextSibling,K=!1;return S}function Ji(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Xn(e.clipPos(Ue(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!b(r,t))return Xn(Ue(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?Le(e.rest):e.line;return Xn(Ue(St(S),S.text.length),i)}var I=t.nodeType==3?t:null,j=t;for(!I&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(I=t.firstChild,n&&(n=I.nodeValue.length));j.parentNode!=r;)j=j.parentNode;var K=e.measure,V=K.maps;function re(Fe,$e,rt){for(var Je=-1;Je<(V?V.length:0);Je++)for(var at=Je<0?K.map:V[Je],ht=0;ht<at.length;ht+=3){var ut=at[ht+2];if(ut==Fe||ut==$e){var Tt=St(Je<0?e.line:e.rest[Je]),Mt=at[ht]+rt;return(rt<0||ut!=Fe)&&(Mt=at[ht+(rt?1:0)]),Ue(Tt,Mt)}}}var ae=re(I,j,n);if(ae)return Xn(ae,i);for(var fe=j.nextSibling,ce=I?I.nodeValue.length-n:0;fe;fe=fe.nextSibling){if(ae=re(fe,fe.firstChild,0),ae)return Xn(Ue(ae.line,ae.ch-ce),i);ce+=fe.textContent.length}for(var De=j.previousSibling,Pe=n;De;De=De.previousSibling){if(ae=re(De,De.firstChild,-1),ae)return Xn(Ue(ae.line,ae.ch+Pe),i);Pe+=De.textContent.length}}var Gt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Z,this.hasSelection=!1,this.composing=null};Gt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),be(i,"input",function(){N&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),be(i,"paste",function(I){if(ke(r,I)||ys(I,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(I){if(ke(r,I))return;if(r.somethingSelected())$i({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var j=Es(r);$i({lineWise:!0,text:j.text}),I.type=="cut"?r.setSelections(j.ranges,null,he):(n.prevInput="",i.value=j.text.join(`
`),X(i))}else return;I.type=="cut"&&(r.state.cutIncoming=+new Date)}be(i,"cut",S),be(i,"copy",S),be(e.scroller,"paste",function(I){if(qr(e,I)||ke(r,I))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var j=new Event("paste");j.clipboardData=I.clipboardData,i.dispatchEvent(j)}),be(e.lineSpace,"selectstart",function(I){qr(e,I)||Y(I)}),be(i,"compositionstart",function(){var I=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:I,range:r.markText(I,r.getCursor("to"),{className:"CodeMirror-composing"})}}),be(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Gt.prototype.createField=function(e){this.wrapper=Ts(),this.textarea=this.wrapper.firstChild},Gt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=uo(e);if(e.options.moveInputWithCursor){var i=Fr(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),I=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+I.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+I.left-S.left))}return r},Gt.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Gt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&X(this.textarea),N&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",N&&k>=9&&(this.hasSelection=null))},Gt.prototype.getField=function(){return this.textarea},Gt.prototype.supportsTouch=function(){return!1},Gt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Gt.prototype.blur=function(){this.textarea.blur()},Gt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Gt.prototype.receivedFocus=function(){this.slowPoll()},Gt.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()})},Gt.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)},Gt.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(N&&k>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var I=0,j=Math.min(r.length,i.length);I<j&&r.charCodeAt(I)==i.charCodeAt(I);)++I;return Lr(t,function(){Ia(t,i.slice(I),r.length-I,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Gt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Gt.prototype.onKeyPress=function(){N&&k>=9&&(this.hasSelection=null),this.fastPoll()},Gt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=bn(n,e),I=r.scroller.scrollTop;if(!S||T)return;var j=n.options.resetSelectionOnContextMenu;j&&n.doc.sel.contains(S)==-1&&er(n,ur)(n.doc,ln(S),he);var K=i.style.cssText,V=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
z-index: 1000; background: `+(N?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ae;D&&(ae=window.scrollY),r.input.focus(),D&&window.scrollTo(null,ae),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function fe(){if(i.selectionStart!=null){var Pe=n.somethingSelected(),Fe="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=Fe,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=Fe.length,r.selForContextMenu=n.doc.sel}}function ce(){if(t.contextMenuPending!=ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=K,N&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=I),i.selectionStart!=null){(!N||N&&k<9)&&fe();var Pe=0,Fe=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?er(n,Ho)(n):Pe++<10?r.detectingSelectAll=setTimeout(Fe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Fe,200)}}if(N&&k>=9&&fe(),L){q(e);var De=function(){Ye(window,"mouseup",De),setTimeout(ce,20)};be(window,"mouseup",De)}else setTimeout(ce,50)},Gt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Gt.prototype.setUneditable=function(){},Gt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?U(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=P();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=j.getValue()}var i;if(e.form&&(be(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var I=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=I}}catch(K){}}t.finishInit=function(K){K.save=r,K.getTextArea=function(){return e},K.toTextArea=function(){K.toTextArea=isNaN,r(),e.parentNode.removeChild(K.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var j=Bt(function(K){return e.parentNode.insertBefore(K,e.nextSibling)},t);return j}function iu(e){e.off=Ye,e.on=be,e.wheelEventPixels=cl,e.Doc=xr,e.splitLines=pt,e.countColumn=z,e.findColumn=pe,e.isWordChar=me,e.Pass=Ce,e.signal=Se,e.Line=qt,e.changeEnd=un,e.scrollbarModel=yo,e.Pos=Ue,e.cmpPos=ft,e.modes=Ut,e.mimeModes=xt,e.resolveMode=ir,e.getMode=sr,e.modeExtensions=Jt,e.extendMode=Wr,e.copyState=wt,e.startState=At,e.innerMode=Nt,e.commands=Ei,e.keyMap=en,e.keyName=is,e.isModifierKey=rs,e.lookupKey=Gn,e.normalizeKeyMap=Pl,e.StringStream=Et,e.SharedTextMarker=vi,e.TextMarker=cn,e.LineWidget=gi,e.e_preventDefault=Y,e.e_stopPropagation=$,e.e_stop=q,e.addClass=F,e.contains=b,e.rmClass=h,e.keyNames=fn}$l(Bt),ql(Bt);var au="iter insert remove copy getEditor constructor".split(" ");for(var Qi in xr.prototype)xr.prototype.hasOwnProperty(Qi)&&ne(au,Qi)<0&&(Bt.prototype[Qi]=function(e){return function(){return e.apply(this.doc,arguments)}}(xr.prototype[Qi]));return ee(xr),Bt.inputStyles={textarea:Gt,contenteditable:Ot},Bt.defineMode=function(e){!Bt.defaults.mode&&e!="null"&&(Bt.defaults.mode=e),$t.apply(this,arguments)},Bt.defineMIME=gr,Bt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Bt.defineMIME("text/plain","null"),Bt.defineExtension=function(e,t){Bt.prototype[e]=t},Bt.defineDocExtension=function(e,t){xr.prototype[e]=t},Bt.fromTextArea=nu,iu(Bt),Bt.version="5.58.2",Bt})},Y1PL:function(mt,et,Q){"use strict";Q.r(et),Q.d(et,"ResizableTextArea",function(){return ne});var te=Q("wx14"),G=Q("1OyB"),A=Q("vuIU"),W=Q("Ji7U"),M=Q("LK+K"),R=Q("q1tI"),N=Q("VTBJ"),k=Q("rePB"),D=Q("Zm9Q"),O=Q("Kwbf"),E=Q("c+Xe"),T=Q("m+aA"),_=Q("bdgK"),C=new Map;function y(he){he.forEach(function(we){var ve,pe=we.target;(ve=C.get(pe))===null||ve===void 0||ve.forEach(function(se){return se(pe)})})}var g=new _.default(y),u=null,o=null;function l(he,we){C.has(he)||(C.set(he,new Set),g.observe(he)),C.get(he).add(we)}function d(he,we){C.has(he)&&(C.get(he).delete(we),C.get(he).size||(g.unobserve(he),C.delete(he)))}var w=function(he){Object(W.a)(ve,he);var we=Object(M.a)(ve);function ve(){return Object(G.a)(this,ve),we.apply(this,arguments)}return Object(A.a)(ve,[{key:"render",value:function(){return this.props.children}}]),ve}(R.Component),f=R.createContext(null);function m(he){var we=he.children,ve=he.onBatchResize,pe=R.useRef(0),se=R.useRef([]),de=R.useContext(f),Le=R.useCallback(function(We,Te,xe){pe.current+=1;var Oe=pe.current;se.current.push({size:We,element:Te,data:xe}),Promise.resolve().then(function(){Oe===pe.current&&(ve==null||ve(se.current),se.current=[])}),de==null||de(We,Te,xe)},[ve,de]);return R.createElement(f.Provider,{value:Le},we)}function L(he){var we=he.children,ve=he.disabled,pe=R.useRef(null),se=R.useRef(null),de=R.useContext(f),Le=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),We=R.isValidElement(we)&&Object(E.c)(we),Te=We?we.ref:null,xe=R.useMemo(function(){return Object(E.a)(Te,pe)},[Te,pe]),Oe=R.useRef(he);Oe.current=he;var ye=R.useCallback(function(me){var Me=Oe.current,Ne=Me.onResize,Ie=Me.data,Ae=me.getBoundingClientRect(),Re=Ae.width,Ke=Ae.height,ze=me.offsetWidth,Ge=me.offsetHeight,He=Math.floor(Re),ot=Math.floor(Ke);if(Le.current.width!==He||Le.current.height!==ot||Le.current.offsetWidth!==ze||Le.current.offsetHeight!==Ge){var Xe={width:He,height:ot,offsetWidth:ze,offsetHeight:Ge};Le.current=Xe;var Be=ze===Math.round(Re)?Re:ze,be=Ge===Math.round(Ke)?Ke:Ge,qe=Object(N.a)(Object(N.a)({},Xe),{},{offsetWidth:Be,offsetHeight:be});de==null||de(qe,me,Ie),Ne&&Promise.resolve().then(function(){Ne(qe,me)})}},[]);return R.useEffect(function(){var me=Object(T.a)(pe.current)||Object(T.a)(se.current);return me&&!ve&&l(me,ye),function(){return d(me,ye)}},[pe.current,ve]),R.createElement(w,{ref:se},We?R.cloneElement(we,{ref:xe}):we)}var x="rc-observer-key";function h(he){var we=he.children,ve=Object(D.a)(we);return ve.map(function(pe,se){var de=(pe==null?void 0:pe.key)||"".concat(x,"-").concat(se);return R.createElement(L,Object(te.a)({},he,{key:de}),pe)})}h.Collection=m;var c=h,s=Q("bT9E"),a=Q("TSYQ"),v=Q.n(a),p=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,b=["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"],P={},F;function H(he){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ve=he.getAttribute("id")||he.getAttribute("data-reactid")||he.getAttribute("name");if(we&&P[ve])return P[ve];var pe=window.getComputedStyle(he),se=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),de=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),Le=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),We=b.map(function(xe){return"".concat(xe,":").concat(pe.getPropertyValue(xe))}).join(";"),Te={sizingStyle:We,paddingSize:de,borderSize:Le,boxSizing:se};return we&&ve&&(P[ve]=Te),Te}function X(he){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),he.getAttribute("wrap")?F.setAttribute("wrap",he.getAttribute("wrap")):F.removeAttribute("wrap");var se=H(he,we),de=se.paddingSize,Le=se.borderSize,We=se.boxSizing,Te=se.sizingStyle;F.setAttribute("style","".concat(Te,";").concat(p)),F.value=he.value||he.placeholder||"";var xe=Number.MIN_SAFE_INTEGER,Oe=Number.MAX_SAFE_INTEGER,ye=F.scrollHeight,me;if(We==="border-box"?ye+=Le:We==="content-box"&&(ye-=de),ve!==null||pe!==null){F.value=" ";var Me=F.scrollHeight-de;ve!==null&&(xe=Me*ve,We==="border-box"&&(xe=xe+de+Le),ye=Math.max(xe,ye)),pe!==null&&(Oe=Me*pe,We==="border-box"&&(Oe=Oe+de+Le),me=ye>Oe?"":"hidden",ye=Math.min(Oe,ye))}return{height:ye,minHeight:xe,maxHeight:Oe,overflowY:me,resize:"none"}}var B=Q("Gytx"),U=Q.n(B),z;(function(he){he[he.NONE=0]="NONE",he[he.RESIZING=1]="RESIZING",he[he.RESIZED=2]="RESIZED"})(z||(z={}));var Z=function(he){Object(W.a)(ve,he);var we=Object(M.a)(ve);function ve(pe){var se;return Object(G.a)(this,ve),se=we.call(this,pe),se.nextFrameActionId=void 0,se.resizeFrameId=void 0,se.textArea=void 0,se.saveTextArea=function(de){se.textArea=de},se.handleResize=function(de){var Le=se.state.resizeStatus,We=se.props,Te=We.autoSize,xe=We.onResize;if(Le!==z.NONE)return;typeof xe=="function"&&xe(de),Te&&se.resizeOnNextFrame()},se.resizeOnNextFrame=function(){cancelAnimationFrame(se.nextFrameActionId),se.nextFrameActionId=requestAnimationFrame(se.resizeTextarea)},se.resizeTextarea=function(){var de=se.props.autoSize;if(!de||!se.textArea)return;var Le=de.minRows,We=de.maxRows,Te=X(se.textArea,!1,Le,We);se.setState({textareaStyles:Te,resizeStatus:z.RESIZING},function(){cancelAnimationFrame(se.resizeFrameId),se.resizeFrameId=requestAnimationFrame(function(){se.setState({resizeStatus:z.RESIZED},function(){se.resizeFrameId=requestAnimationFrame(function(){se.setState({resizeStatus:z.NONE}),se.fixFirefoxAutoScroll()})})})})},se.renderTextArea=function(){var de=se.props,Le=de.prefixCls,We=Le===void 0?"rc-textarea":Le,Te=de.autoSize,xe=de.onResize,Oe=de.className,ye=de.disabled,me=se.state,Me=me.textareaStyles,Ne=me.resizeStatus,Ie=Object(s.a)(se.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ae=v()(We,Oe,Object(k.a)({},"".concat(We,"-disabled"),ye));"value"in Ie&&(Ie.value=Ie.value||"");var Re=Object(N.a)(Object(N.a)(Object(N.a)({},se.props.style),Me),Ne===z.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:se.handleResize,disabled:!(Te||xe)},R.createElement("textarea",Object(te.a)({},Ie,{className:Ae,style:Re,ref:se.saveTextArea})))},se.state={textareaStyles:{},resizeStatus:z.NONE},se}return Object(A.a)(ve,[{key:"componentDidUpdate",value:function(se){(se.value!==this.props.value||!U()(se.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 se=this.textArea.selectionStart,de=this.textArea.selectionEnd;this.textArea.setSelectionRange(se,de)}}catch(Le){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ve}(R.Component),ne=Z,oe=function(he){Object(W.a)(ve,he);var we=Object(M.a)(ve);function ve(pe){var se;Object(G.a)(this,ve),se=we.call(this,pe),se.resizableTextArea=void 0,se.focus=function(){se.resizableTextArea.textArea.focus()},se.saveTextArea=function(Le){se.resizableTextArea=Le},se.handleChange=function(Le){var We=se.props.onChange;se.setValue(Le.target.value,function(){se.resizableTextArea.resizeTextarea()}),We&&We(Le)},se.handleKeyDown=function(Le){var We=se.props,Te=We.onPressEnter,xe=We.onKeyDown;Le.keyCode===13&&Te&&Te(Le),xe&&xe(Le)};var de=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return se.state={value:de},se}return Object(A.a)(ve,[{key:"setValue",value:function(se,de){"value"in this.props||this.setState({value:se},de)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ne,Object(te.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(se){return"value"in se?{value:se.value}:null}}]),ve}(R.Component),Ce=et.default=oe},ZW9T:function(mt,et,Q){"use strict";Q.d(et,"a",function(){return w});var te=Q("k1fw"),G=Q("miYZ"),A=Q("tsqr"),W=Q("rAM+"),M=Q("tJVT"),R=Q("PpiC"),N=Q("q1tI"),k=Q.n(N),D=Q("bdgK");function O(f,m,L,x,h){var c=m.getWordUntilPosition(L),s={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=x.map(function(v){return{label:v,kind:f.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:s}});return h.map(function(v){a.push(Object(te.a)(Object(te.a)({},v),{},{range:s}))}),a}var E=function(f){var m={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(s,a){var v=O(f,s,a,L,[m]);return{suggestions:v}}});var x=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(s,a){var v=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=O(f,s,a,x,v);return{suggestions:p}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(s,a){var v=[m,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=O(f,s,a,h,v);return{suggestions:p}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",_=Q("LvDl");function C(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function y(){}var g=!1,u={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=f;if(Array.isArray(f)){for(var L=0;L<f.length;L++){var x=u[f[L]];if(x)return x}return m[0]}return u[m]||m}var l=null,d=et.b=function(f){var m=f.width,L=m===void 0?"100%":m,x=f.height,h=x===void 0?"100%":x,c=f.value,s=f.language,a=s===void 0?"javascript":s,v=f.style,p=v===void 0?{}:v,b=f.options,P=b===void 0?{}:b,F=f.overrideServices,H=F===void 0?{}:F,X=f.theme,B=X===void 0?"vs-dark":X,U=f.onEditBlur,z=f.onSave,Z=f.autoHeight,ne=Z===void 0?!1:Z,oe=f.forbidCopy,Ce=oe===void 0?!1:oe,he=f.onChange,we=he===void 0?y:he,ve=f.editorDidMount,pe=ve===void 0?y:ve,se=f.onFocus,de=se===void 0?y:se,Le=f.filename,We=Le===void 0?"educoder.txt":Le,Te=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),xe=Object(N.useRef)(),Oe=Object(N.useRef)({}),ye=Object(N.useRef)(),me=Object(N.useRef)(!1),Me=Object(N.useRef)(),Ne=Object(N.useState)(!1),Ie=Object(M.a)(Ne,2),Ae=Ie[0],Re=Ie[1];function Ke(){var J;return xe.current&&(J=new D.default(function(q){var ue=Object(W.a)(q),ge;try{for(ue.s();!(ge=ue.n()).done;){var _e=ge.value;(_e.target.offsetHeight>0||_e.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(Ve){ue.e(Ve)}finally{ue.f()}}),J.observe(xe.current)),J}function ze(){A.b.warn(decodeURIComponent(T))}var Ge=function(){var q=Oe.current.instance;if(c!=null&&q&&Ae){var ue=q.getModel();ue&&c!==ue.getValue()&&(g=!0,ue.setValue(c),q.layout(),g=!1)}};Object(N.useEffect)(function(){ye.current&&clearTimeout(ye.current),ye.current=setTimeout(function(){Ge()},500)},[c,Ae,Oe.current]);function He(){var J=Oe.current.instance;if(J){var q=J.getSelection(),ue=Oe.current.pastePos||{},ge=new l.Range(ue.startLineNumber||q.endLineNumber,ue.startColumn||q.endColumn,ue.endLineNumber||q.endLineNumber,ue.endColumn||q.endColumn);setTimeout(function(){J.executeEdits("",[{range:ge,text:""}])},300)}}function ot(J){(window.navigator.platform.match("Mac")?J.metaKey:J.ctrlKey)&&J.keyCode==83&&(J.preventDefault(),z())}var Xe=function(){if(ne&&Oe.current.instance){var q=Oe.current.instance.getContentHeight();Y(q<h?h:q)}else Y(h)};function Be(J){var q=document.createEvent("MouseEvents");q.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),J.dispatchEvent(q)}function be(J,q){var ue=window.URL||window.webkitURL||window,ge=new Blob([q]),_e=document.createElementNS("http://www.w3.org/1999/xhtml","a");_e.href=ue.createObjectURL(ge),_e.download=J,Be(_e)}Object(N.useEffect)(function(){Xe()},[Xe]),Object(N.useEffect)(function(){xe.current&&!Ae&&Q.e(26).then(Q.t.bind(null,"M/lh",7)).then(function(J){try{l=J,Oe.current.instance=l.editor.create(xe.current,{value:c,language:o(a),theme:B,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},H);var q=Oe.current.instance;if(pe(q,l),setTimeout(function(){Xe(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){be(We||"educoder.txt",q.getValue())}})},500),Oe.current.subscription=q.onDidChangeModelContent(function(ge){me.current?clearTimeout(Me.current):(Xe(),we(q.getValue(),ge)),Me.current=setTimeout(function(){me.current=!1},500)}),window.Monaco||E(l),Ce&&(q.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return ze(),null}),q.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return ze(),null})),window.Monaco=l,U&&q.onDidBlurEditorWidget(function(){U(q.getValue())}),de&&q.onDidFocusEditorText(function(){de(q.getValue())}),Ce){q.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return ze(),null}),q.onDidPaste(function(ge){Oe.current.pastePos=ge});try{window.addEventListener("paste",He)}catch(ge){}}var ue=Ke();return Re(!0),function(){var ge=Oe.current.instance;ge.dispose();var _e=ge.getModel();_e&&_e.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),Ce&&window.removeEventListener("paste",He),ue.unobserve(xe.current)}}catch(ge){}})},[]),Object(N.useEffect)(function(){var J=Oe.current.instance;if(J&&Ae)return document.addEventListener("keydown",ot,!1),function(){document.removeEventListener("keydown",ot)}},[z,Ae]),Object(N.useEffect)(function(){var J=Oe.current.instance;if(J&&Ae){var q=o(a);l.editor.setModelLanguage(J.getModel(),q),console.log("language:",a,J.getModel(),q)}},[a,Ae]),Object(N.useEffect)(function(){var J=Oe.current.instance;J&&Ae&&l.editor.setTheme(B)},[B,Ae]),Object(N.useEffect)(function(){var J=Oe.current.instance;J&&Ae&&(J.updateOptions(Object(te.a)({},P)),setTimeout(function(){J.getModel().updateOptions(Object(te.a)({},P))},200))},[JSON.stringify(P),Ae]),Object(N.useEffect)(function(){var J=Oe.current.instance;J&&Ae&&J.layout()},[L,h,Ae]);var qe=Object(N.useState)(C(L)),Ye=Object(M.a)(qe,2),Se=Ye[0],ke=Ye[1],le=Object(N.useState)(C(h)),ie=Object(M.a)(le,2),ee=ie[0],Y=ie[1],$=Object(te.a)(Object(te.a)({},p),{},{width:Se,height:ee});return k.a.createElement("div",{className:"my-monaco-editor",ref:xe,style:$})};function w(f){var m=f.width,L=m===void 0?"100%":m,x=f.height,h=x===void 0?"100%":x,c=f.original,s=f.modified,a=f.language,v=f.options,p=v===void 0?{}:v,b=Object(N.useRef)(),P=Object(N.useState)(null),F=Object(M.a)(P,2),H=F[0],X=F[1];function B(ne){var oe;return b.current&&(oe=new D.default(function(Ce){var he=Object(W.a)(Ce),we;try{for(he.s();!(we=he.n()).done;){var ve=we.value;(ve.target.offsetHeight>0||ve.target.offsetWidth>0)&&ne.layout()}}catch(pe){he.e(pe)}finally{he.f()}}),oe.observe(b.current)),oe}Object(N.useEffect)(function(){b.current&&Q.e(26).then(Q.t.bind(null,"M/lh",7)).then(function(ne){l=ne;var oe=l.editor.createDiffEditor(b.current,Object(te.a)(Object(te.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},p),{},{wordWrap:!0}));X(oe);var Ce=B(oe);return function(){oe.dispose();var he=oe.getModel();he&&he.dispose(),Ce.unobserve(b.current)}})},[]),Object(N.useEffect)(function(){H&&H.setModel({original:l.editor.createModel(c,a),modified:l.editor.createModel(s,a)})},[c,s,a,H]);var U=C(L),z=C(h),Z={width:U,height:z};return k.a.createElement("div",{className:"my-diff-editor",ref:b,style:Z})}},ZpRC:function(mt,et,Q){"use strict";function te(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function G(E,T){return(!T||E!=="hidden")&&E!=="visible"&&E!=="clip"}function A(E,T){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var _=getComputedStyle(E,null);return G(_.overflowY,T)||G(_.overflowX,T)||function(C){var y=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(u){return null}}(C);return!!y&&(y.clientHeight<C.scrollHeight||y.clientWidth<C.scrollWidth)}(E)}return!1}function W(E,T,_,C,y,g,u,o){return g<E&&u>T||g>E&&u<T?0:g<=E&&o<=_||u>=T&&o>=_?g-E-C:u>T&&o<_||g<E&&o>_?u-T+y:0}var M=function(E,T){var _=window,C=T.scrollMode,y=T.block,g=T.inline,u=T.boundary,o=T.skipOverflowHiddenElements,l=typeof u=="function"?u:function(Me){return Me!==u};if(!te(E))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,w=[],f=E;te(f)&&l(f);){if((f=f.parentElement)===d){w.push(f);break}f!=null&&f===document.body&&A(f)&&!A(document.documentElement)||f!=null&&A(f,o)&&w.push(f)}for(var m=_.visualViewport?_.visualViewport.width:innerWidth,L=_.visualViewport?_.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=E.getBoundingClientRect(),s=c.height,a=c.width,v=c.top,p=c.right,b=c.bottom,P=c.left,F=y==="start"||y==="nearest"?v:y==="end"?b:v+s/2,H=g==="center"?P+a/2:g==="end"?p:P,X=[],B=0;B<w.length;B++){var U=w[B],z=U.getBoundingClientRect(),Z=z.height,ne=z.width,oe=z.top,Ce=z.right,he=z.bottom,we=z.left;if(C==="if-needed"&&v>=0&&P>=0&&b<=L&&p<=m&&v>=oe&&b<=he&&P>=we&&p<=Ce)return X;var ve=getComputedStyle(U),pe=parseInt(ve.borderLeftWidth,10),se=parseInt(ve.borderTopWidth,10),de=parseInt(ve.borderRightWidth,10),Le=parseInt(ve.borderBottomWidth,10),We=0,Te=0,xe="offsetWidth"in U?U.offsetWidth-U.clientWidth-pe-de:0,Oe="offsetHeight"in U?U.offsetHeight-U.clientHeight-se-Le:0;if(d===U)We=y==="start"?F:y==="end"?F-L:y==="nearest"?W(h,h+L,L,se,Le,h+F,h+F+s,s):F-L/2,Te=g==="start"?H:g==="center"?H-m/2:g==="end"?H-m:W(x,x+m,m,pe,de,x+H,x+H+a,a),We=Math.max(0,We+h),Te=Math.max(0,Te+x);else{We=y==="start"?F-oe-se:y==="end"?F-he+Le+Oe:y==="nearest"?W(oe,he,Z,se,Le+Oe,F,F+s,s):F-(oe+Z/2)+Oe/2,Te=g==="start"?H-we-pe:g==="center"?H-(we+ne/2)+xe/2:g==="end"?H-Ce+de+xe:W(we,Ce,ne,pe,de+xe,H,H+a,a);var ye=U.scrollLeft,me=U.scrollTop;F+=me-(We=Math.max(0,Math.min(me+We,U.scrollHeight-Z+Oe))),H+=ye-(Te=Math.max(0,Math.min(ye+Te,U.scrollWidth-ne+xe)))}X.push({el:U,top:We,left:Te})}return X};function R(E){return E===Object(E)&&Object.keys(E).length!==0}function N(E,T){T===void 0&&(T="auto");var _="scrollBehavior"in document.body.style;E.forEach(function(C){var y=C.el,g=C.top,u=C.left;y.scroll&&_?y.scroll({top:g,left:u,behavior:T}):(y.scrollTop=g,y.scrollLeft=u)})}function k(E){return E===!1?{block:"end",inline:"nearest"}:R(E)?E:{block:"start",inline:"nearest"}}function D(E,T){var _=!E.ownerDocument.documentElement.contains(E);if(R(T)&&typeof T.behavior=="function")return T.behavior(_?[]:M(E,T));if(_)return;var C=k(T);return N(M(E,C),C.behavior)}var O=et.a=D},bT9E:function(mt,et,Q){"use strict";Q.d(et,"a",function(){return G});var te=Q("VTBJ");function G(A,W){var M=Object(te.a)({},A);return Array.isArray(W)&&W.forEach(function(R){delete M[R]}),M}},c5Ni:function(mt,et,Q){},dejd:function(mt,et,Q){},dmUQ:function(mt,et,Q){"use strict";var te=Q("Ff2n"),G=Q("rePB"),A=Q("1OyB"),W=Q("vuIU"),M=Q("Ji7U"),R=Q("md7G"),N=Q("foSv"),k=Q("q1tI"),D=Q.n(k),O=Q("TSYQ"),E=Q.n(O),T=Q("4IlW");function _(s,a){var v=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);a&&(p=p.filter(function(b){return Object.getOwnPropertyDescriptor(s,b).enumerable})),v.push.apply(v,p)}return v}function C(s){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?_(Object(v),!0).forEach(function(p){Object(G.a)(s,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(v)):_(Object(v)).forEach(function(p){Object.defineProperty(s,p,Object.getOwnPropertyDescriptor(v,p))})}return s}function y(s){var a=g();return function(){var p=Object(N.a)(s),b;if(a){var P=Object(N.a)(this).constructor;b=Reflect.construct(p,arguments,P)}else b=p.apply(this,arguments);return Object(R.a)(this,b)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function u(){}function o(s){s.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,w=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},L=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},x=function(s){Object(M.a)(v,s);var a=y(v);function v(p){var b;Object(A.a)(this,v),b=a.call(this,p),b.onKeyDown=function(H){var X=b.props,B=X.onKeyDown,U=X.onPressEnter;if(H.keyCode===T.a.UP){var z=b.getRatio(H);b.up(H,z,null),b.stop()}else if(H.keyCode===T.a.DOWN){var Z=b.getRatio(H);b.down(H,Z,null),b.stop()}else H.keyCode===T.a.ENTER&&U&&U(H);if(b.recordCursorPosition(),b.lastKeyCode=H.keyCode,B){for(var ne=arguments.length,oe=new Array(ne>1?ne-1:0),Ce=1;Ce<ne;Ce++)oe[Ce-1]=arguments[Ce];B.apply(void 0,[H].concat(oe))}},b.onKeyUp=function(H){var X=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),X){for(var B=arguments.length,U=new Array(B>1?B-1:0),z=1;z<B;z++)U[z-1]=arguments[z];X.apply(void 0,[H].concat(U))}},b.onChange=function(H){var X=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(H)),b.setState({inputValue:b.rawInput}),X(b.toNumber(b.rawInput))},b.onMouseUp=function(){var H=b.props.onMouseUp;b.recordCursorPosition(),H&&H.apply(void 0,arguments)},b.onFocus=function(){var H;b.setState({focused:!0}),(H=b.props).onFocus.apply(H,arguments)},b.onBlur=function(){var H=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var X=b.getCurrentValidValue(b.state.inputValue),B=b.setValue(X,u);if(H){var U=b.input.value,z=b.getInputDisplayValue({focus:!1,value:B});b.input.value=z&&Number(z),H.apply(void 0,arguments),b.input.value=U}},b.getRatio=function(H){var X=1;return H.metaKey||H.ctrlKey?X=.1:H.shiftKey&&(X=10),X},b.getFullNum=function(H){return isNaN(H)?H:/e/i.test(String(H))?Number(H).toFixed(18).replace(/\.?0+$/,""):H},b.getPrecision=function(H){if(m(b.props.precision))return b.props.precision;var X=String(H);if(X.indexOf("e-")>=0)return parseInt(X.slice(X.indexOf("e-")+2),10);var B=0;return X.indexOf(".")>=0&&(B=X.length-X.indexOf(".")-1),B},b.getInputDisplayValue=function(H){var X=H||b.state,B=X.focused,U=X.inputValue,z=X.value,Z;B?Z=U:Z=b.toPrecisionAsStep(z),Z==null&&(Z="");var ne=b.formatWrapper(Z);return m(b.props.decimalSeparator)&&(ne=ne.toString().replace(".",b.props.decimalSeparator)),ne},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(H){}},b.restoreByAfter=function(H){if(H===void 0)return!1;var X=b.input.value,B=X.lastIndexOf(H);if(B===-1)return!1;var U=b.cursorBefore.length;return b.lastKeyCode===T.a.DELETE&&b.cursorBefore.charAt(U-1)===H[0]?(b.fixCaret(U,U),!0):B+H.length===X.length?(b.fixCaret(B,B),!0):!1},b.partRestoreByAfter=function(H){return H===void 0?!1:Array.prototype.some.call(H,function(X,B){var U=H.substring(B);return b.restoreByAfter(U)})},b.isNotCompleteNumber=function(H){return isNaN(H)||H===""||H===null||H&&H.toString().indexOf(".")===H.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(H,X,B){b.pressingUpOrDown=!0,b.step("down",H,X,B)},b.up=function(H,X,B){b.pressingUpOrDown=!0,b.step("up",H,X,B)},b.saveInput=function(H){b.input=H};var P=p.value;P===void 0&&(P=p.defaultValue),b.state={focused:p.autoFocus};var F=b.getValidValue(b.toNumber(P));return b.state=C(C({},b.state),{},{inputValue:b.toPrecisionAsStep(F),value:F}),b}return Object(W.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var P=this.props,F=P.value,H=P.onChange,X=P.max,B=P.min,U=this.state.focused;if(b){if(!L(b.value,F)||!L(b.max,X)||!L(b.min,B)){var z=U?F:this.getValidValue(F),Z;this.pressingUpOrDown?Z=z:this.inputting?Z=this.rawInput:Z=this.toPrecisionAsStep(z),this.setState({value:z,inputValue:Z})}var ne="value"in this.props?F:this.state.value;"max"in this.props&&b.max!==X&&typeof ne=="number"&&ne>X&&H&&H(X),"min"in this.props&&b.min!==B&&typeof ne=="number"&&ne<B&&H&&H(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ce){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(b){var P=b;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(b){var P=b.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,H=parseFloat(b);return isNaN(H)?b:(H<P&&(H=P),H>F&&(H=F),H)}},{key:"setValue",value:function(b,P){var F=this.props.precision,H=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),X=this.state.value,B=X===void 0?null:X,U=this.state.inputValue,z=U===void 0?null:U,Z=typeof H=="number"?H.toFixed(F):"".concat(H),ne=H!==B||Z!=="".concat(z);return"value"in this.props?(z=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:z},P)):this.setState({value:H,inputValue:this.toPrecisionAsStep(b)},P),ne&&this.props.onChange(H),H}},{key:"getMaxPrecision",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,H=F.precision,X=F.step;if(m(H))return H;var B=this.getPrecision(P),U=this.getPrecision(X),z=this.getPrecision(b);return b?Math.max(z,B+U):B+U}},{key:"getPrecisionFactor",value:function(b){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(b,P);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var P=Math.abs(this.getMaxPrecision(b));return isNaN(P)?b.toString():Number(b).toFixed(P)}},{key:"toNumber",value:function(b){var P=this.props.precision,F=this.state.focused,H=b&&b.length>16&&F;return this.isNotCompleteNumber(b)||H?b:m(P)?Math.round(b*Math.pow(10,P))/Math.pow(10,P):Number(b)}},{key:"upStep",value:function(b,P){var F=this.props.step,H=this.getPrecisionFactor(b,P),X=Math.abs(this.getMaxPrecision(b,P)),B=((H*b+H*F*P)/H).toFixed(X);return this.toNumber(B)}},{key:"downStep",value:function(b,P){var F=this.props.step,H=this.getPrecisionFactor(b,P),X=Math.abs(this.getMaxPrecision(b,P)),B=((H*b-H*F*P)/H).toFixed(X);return this.toNumber(B)}},{key:"step",value:function(b,P){var F=this,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,X=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var B=this.props;if(B.disabled)return;var U=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(U))return;var z=this["".concat(b,"Step")](U,H),Z=z>B.max||z<B.min;if(z>B.max?z=B.max:z<B.min&&(z=B.min),this.setValue(z,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Z)return;this.autoStepTimer=setTimeout(function(){F[b](P,H,!0)},X?d:w)}},{key:"fixCaret",value:function(b,P){if(b===void 0||P===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,H=this.input.selectionEnd;(b!==F||P!==H)&&this.input.setSelectionRange(b,P)}catch(X){}}},{key:"render",value:function(){var b,P=this.props,F=P.prefixCls,H=P.disabled,X=P.readOnly,B=P.useTouch,U=P.autoComplete,z=P.upHandler,Z=P.downHandler,ne=P.className,oe=P.max,Ce=P.min,he=P.style,we=P.title,ve=P.onMouseEnter,pe=P.onMouseLeave,se=P.onMouseOver,de=P.onMouseOut,Le=P.required,We=P.onClick,Te=P.tabIndex,xe=P.type,Oe=P.placeholder,ye=P.id,me=P.inputMode,Me=P.pattern,Ne=P.step,Ie=P.maxLength,Ae=P.autoFocus,Re=P.name,Ke=P.onPaste,ze=P.onInput,Ge=Object(te.a)(P,["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,ot=He.value,Xe=He.focused,Be=E()(F,(b={},Object(G.a)(b,ne,!!ne),Object(G.a)(b,"".concat(F,"-disabled"),H),Object(G.a)(b,"".concat(F,"-focused"),Xe),b)),be={};Object.keys(Ge).forEach(function(q){(q.substr(0,5)==="data-"||q.substr(0,5)==="aria-"||q==="role")&&(be[q]=Ge[q])});var qe=!X&&!H,Ye=this.getInputDisplayValue(null),Se=(ot||ot===0)&&(isNaN(ot)||Number(ot)>=oe),ke=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=Ce),le=Se||H||X,ie=ke||H||X,ee=E()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(G.a)({},"".concat(F,"-handler-up-disabled"),le)),Y=E()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(G.a)({},"".concat(F,"-handler-down-disabled"),ie)),$=B?{onTouchStart:le?u:this.up,onTouchEnd:this.stop}:{onMouseDown:le?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=B?{onTouchStart:ie?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ie?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:Be,style:he,title:we,onMouseEnter:ve,onMouseLeave:pe,onMouseOver:se,onMouseOut:de,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(F,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":le,className:ee}),z||D.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),D.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":ie,className:Y}),Z||D.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),D.a.createElement("div",{className:"".concat(F,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":oe,"aria-valuenow":ot,required:Le,type:xe,placeholder:Oe,onPaste:Ke,onClick:We,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Te,autoComplete:U,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:u,onKeyUp:qe?this.onKeyUp:u,autoFocus:Ae,maxLength:Ie,readOnly:X,disabled:H,max:oe,min:Ce,step:Ne,name:Re,title:we,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:Me,inputMode:me,onInput:ze},be))))}}]),v}(D.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:l,required:!1,autoComplete:"off"};var h=x,c=et.a=h},fB9n:function(mt,et,Q){"use strict";Q.r(et);var te=Q("14J3"),G=Q("BMrR"),A=Q("jCWc"),W=Q("kPKH"),M=Q("k1fw"),R=Q("9og8"),N=Q("tJVT"),k=Q("PpiC"),D=Q("WmNS"),O=Q.n(D),E=Q("q1tI"),T=Q.n(E),_=Q("55Ip"),C=Q("9kvl"),y=Q("T2oS"),g=Q("W9HT"),u=Q("oBTY"),o=Q("B9cy"),l=Q("Ol7k"),d=Q("lUTK"),w=Q("BvKs"),f=Q("Ty5D"),m=Q("wd/R"),L=Q.n(m),x=Q("RotF"),h=Q.n(x),c=Q("m3rI"),s=Q("9Bee"),a=Q("SbmS"),v=Q.n(a),p=w.a.SubMenu,b=l.a.Sider,P=l.a.Content,F=function(me){var Me=me.messages,Ne=me.globalSetting,Ie=me.loading,Ae=me.user,Re=me.dispatch,Ke=Object(k.a)(me,["messages","globalSetting","loading","user","dispatch"]),ze=Object(f.i)(),Ge=Object(f.h)(),He=Ae.userInfo,ot=Object(E.useState)(!1),Xe=Object(N.a)(ot,2),Be=Xe[0],be=Xe[1],qe=Object(E.useState)({per_page:20,page:1}),Ye=Object(N.a)(qe,2),Se=Ye[0],ke=Ye[1],le=Object(E.useState)({per_page:20,page:1}),ie=Object(N.a)(le,2),ee=ie[0],Y=ie[1],$=Object(E.useState)([]),J=Object(N.a)($,2),q=J[0],ue=J[1];Object(E.useEffect)(function(){Se.page=1,_e()},[ze.userId]);var ge=function(Qe){var Ze,st;C.d.push("/messages/".concat(Ae==null||((Ze=Ae.userInfo)===null||Ze===void 0)?void 0:Ze.login,"/message_detail?target_ids=").concat(Qe==null||((st=Qe.target)===null||st===void 0)?void 0:st.id))},_e=function(){var Ve=Object(R.a)(O.a.mark(function Qe(){var Ze,st;return O.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return be(!1),tt.next=3,Re({type:"messages/getPrivateMessages",payload:Object(M.a)(Object(M.a)({},ze),ee)});case 3:Ze=tt.sent,Ze!=null&&Ze.private_messages&&(ue([].concat(Object(u.a)(q),Object(u.a)(Ze.private_messages))),((st=Ze.private_messages)===null||st===void 0?void 0:st.length)===20&&be(!0));case 5:case"end":return tt.stop()}},Qe)}));return function(){return Ve.apply(this,arguments)}}();return T.a.createElement("aside",{className:v.a.listRightMessage},T.a.createElement(h.a,{loadMore:function(){ee.page++,_e()},hasMore:Be,useWindow:!1},T.a.createElement(g.a,{spinning:Ie["messages/getPrivateMessages"]},T.a.createElement("div",{className:"minH500"},q==null?void 0:q.map(function(Ve,Qe){var Ze,st;return T.a.createElement("aside",{key:Qe},T.a.createElement(G.a,{onClick:function(){return ge(Ve)}},T.a.createElement(W.a,{flex:"58px"},T.a.createElement("img",{src:c.a.IMG_SERVER+"/images/"+(Ve==null||((Ze=Ve.target)===null||Ze===void 0)?void 0:Ze.image_url),alt:""})),T.a.createElement(W.a,{flex:"1"},T.a.createElement(G.a,null,T.a.createElement(W.a,{span:24},T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"1"},T.a.createElement("span",{className:v.a.userName},Ve==null||((st=Ve.target)===null||st===void 0)?void 0:st.name)),T.a.createElement(W.a,null,T.a.createElement("span",{className:"ml15 c-grey-c"},L()(Ve.send_time).fromNow())))),T.a.createElement(W.a,{span:24},T.a.createElement("div",{className:["mt15",v.a.content].join(" ")},T.a.createElement(s.a,{value:Ve.content||""})))))))})))))},H=Object(C.a)(function(ye){var me=ye.messages,Me=ye.loading,Ne=ye.user,Ie=ye.globalSetting;return{messages:me,globalSetting:Ie,user:Ne,loading:Me.effects}})(F),X=Q("+L6B"),B=Q("2/Rp"),U=Q("miYZ"),z=Q("tsqr"),Z=Q("y8nQ"),ne=Q("Vl3Y"),oe=Q("kaH+"),Ce=Q("1vsH"),he=Q("5WQS"),we=Q("Ot1p"),ve=Q("dhSg"),pe=w.a.SubMenu,se=l.a.Sider,de=l.a.Content,Le=function(me){var Me=me.messages,Ne=me.globalSetting,Ie=me.loading,Ae=me.user,Re=me.dispatch,Ke=Object(k.a)(me,["messages","globalSetting","loading","user","dispatch"]),ze=Object(f.i)(),Ge=Object(f.h)(),He=Ge.query,ot=Object(E.useState)({per_page:20,page:1}),Xe=Object(N.a)(ot,2),Be=Xe[0],be=Xe[1],qe=Object(E.useState)([]),Ye=Object(N.a)(qe,2),Se=Ye[0],ke=Ye[1],le=Object(E.useState)(!1),ie=Object(N.a)(le,2),ee=ie[0],Y=ie[1],$=Object(E.useState)(!1),J=Object(N.a)($,2),q=J[0],ue=J[1],ge=Object(E.useState)(""),_e=Object(N.a)(ge,2),Ve=_e[0],Qe=_e[1],Ze=Object(E.useRef)(),st=ne.a.useForm(),pt=Object(N.a)(st,1),tt=pt[0],Rt=Object(E.useState)([]),vt=Object(N.a)(Rt,2),It=vt[0],Ut=vt[1],xt=Object(E.useState)(!0),$t=Object(N.a)(xt,2),gr=$t[0],ir=$t[1];Object(E.useEffect)(function(){Be.page=1,sr()},[He.target_ids]);var sr=function(){var wt=Object(R.a)(O.a.mark(function Nt(){var At,Et;return O.a.wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:return Y(!1),Ft.next=3,Re({type:"messages/getPrivateMessageDetails",payload:Object(M.a)(Object(M.a)({},ze),{},{target_id:He==null?void 0:He.target_ids},Be)});case 3:At=Ft.sent,At!=null&&At.messages&&(It=At==null?void 0:At.messages,((Et=It)===null||Et===void 0?void 0:Et.length)===20&&setTimeout(function(){Y(!0),ir(!1)},500),Be.page===1?ke(Object(u.a)(At==null?void 0:At.messages.reverse())):ke([].concat(Object(u.a)(Se),Object(u.a)(At==null?void 0:At.messages.reverse()))));case 5:case"end":return Ft.stop()}},Nt)}));return function(){return wt.apply(this,arguments)}}();Object(E.useEffect)(function(){console.log("newData.length:",Be,It.length,It),Be.page===1&&gr&&(Ze.current.scrollTop=Ze.current.scrollHeight)},[Se]),Object(E.useEffect)(function(){Ze.current.onclick=function(wt){wt.target.nodeName==="IMG"&&wt.target.alt!==""&&ve.a.publish("preview-image",wt.target.src)}},[]);var Jt=function(){var wt=Object(R.a)(O.a.mark(function Nt(At,Et){var nt;return O.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return vr.next=2,Object(he.a)(Object(M.a)(Object(M.a)({},ze),{},{id:At.id}));case 2:nt=vr.sent,nt.status===0&&(Se.splice(Et,1),ke(Object(u.a)(Se)));case 5:case"end":return vr.stop()}},Nt)}));return function(At,Et){return wt.apply(this,arguments)}}(),Wr=function(){var wt=Object(R.a)(O.a.mark(function Nt(){return O.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:if(!(Ve==="")){Et.next=3;break}return z.b.error("\u8BF7\u8F93\u5165\u60A8\u7684\u56DE\u590D"),Et.abrupt("return",!1);case 3:return Qe(""),ue(!0),Et.next=8,Object(he.g)(Object(M.a)(Object(M.a)({},ze),{},{content:Ve,target_id:He==null?void 0:He.target_ids}));case 8:ue(!1),Be.page=1,tt.resetFields(),sr();case 12:case"end":return Et.stop()}},Nt)}));return function(){return wt.apply(this,arguments)}}();return T.a.createElement("section",null,T.a.createElement("aside",{className:v.a.listMessage,ref:Ze},T.a.createElement(h.a,{isReverse:!0,loadMore:function(){Be.page++,sr()},hasMore:ee,useWindow:!1},!ee&&T.a.createElement("div",{className:"tc mt20 animated fadeIn"},T.a.createElement("span",{className:v.a.msgDate},"\u6CA1\u6709\u4FE1\u606F\u4E86\uFF5E\uFF5E")),T.a.createElement(g.a,{spinning:Ie["messages/getPrivateMessageDetails"]},T.a.createElement("aside",{className:"minH500"},Se==null?void 0:Se.map(function(wt,Nt){var At;return T.a.createElement("aside",{key:Nt},T.a.createElement(G.a,{justify:"center"},T.a.createElement(W.a,{flex:"1",className:"tc"},T.a.createElement("span",{className:v.a.msgDate},L()(wt.send_time).format("YYYY-MM-DD")))),T.a.createElement(G.a,{onClick:function(){return Object(Ce.I)(wt)}},T.a.createElement(W.a,{flex:"58px"},T.a.createElement("img",{src:c.a.IMG_SERVER+"/images/"+(wt==null||((At=wt.sender)===null||At===void 0)?void 0:At.image_url),alt:""})),T.a.createElement(W.a,null,T.a.createElement("div",{className:v.a.msg},T.a.createElement(s.a,{value:wt.content||""}),T.a.createElement("span",{onClick:function(){return Jt(wt,Nt)},className:["current",v.a.deleteMsg].join(" ")},"\u5220\u9664"))),T.a.createElement(W.a,null,T.a.createElement("span",{className:"c-grey-c ml10"},L()(wt.send_time).format("HH:mm")))))}))))),T.a.createElement("aside",{className:"pl30 pr30 mb30 mt30"},T.a.createElement(ne.a,{form:tt},T.a.createElement(ne.a.Item,{name:"content"},T.a.createElement(we.a,{placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D",height:150,onChange:function(Nt){return Qe(Nt)}})),T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"1"},T.a.createElement("span",{className:"c-red font14"},"\u5728\u95EE\u9898\u53CD\u9988\u65F6\uFF0C\u8BF7\u540C\u65F6\u53D1\u9001\u95EE\u9898\u53D1\u751F\u9875\u7684\u7F51\u5740\u94FE\u63A5\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u9AD8\u6548\u7684\u4E3A\u60A8\u670D\u52A1")),T.a.createElement(W.a,null,T.a.createElement(B.a,{loading:q,type:"primary",onClick:function(){return Wr()}},"\u56DE\u590D"))))),T.a.createElement(oe.a,null))},We=Object(C.a)(function(ye){var me=ye.messages,Me=ye.loading,Ne=ye.user,Ie=ye.globalSetting;return{messages:me,globalSetting:Ie,user:Ne,loading:Me.effects}})(Le),Te=Q("30zm"),xe=function(me){var Me,Ne=me.messages,Ie=me.globalSetting,Ae=me.loading,Re=me.user,Ke=me.dispatch,ze=Object(k.a)(me,["messages","globalSetting","loading","user","dispatch"]),Ge=ze.match.params,He=ze.location.query,ot=Re.userInfo,Xe=Ne.tidingsList,Be=Ne.privateMessageDetails,be=Object(E.useState)({per_page:20,page:1}),qe=Object(N.a)(be,2),Ye=qe[0],Se=qe[1],ke=Object(E.useState)({per_page:20,page:1}),le=Object(N.a)(ke,2),ie=le[0],ee=le[1],Y=Object(E.useState)([]),$=Object(N.a)(Y,2),J=$[0],q=$[1],ue=Object(E.useState)([]),ge=Object(N.a)(ue,2),_e=ge[0],Ve=ge[1];Object(E.useEffect)(function(){Ye.page=1},[Ge.userId]);var Qe=function(){var st=Object(R.a)(O.a.mark(function pt(){var tt;return O.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return vt.next=2,Ke({type:"messages/getPrivateMessageDetails",payload:Object(M.a)(Object(M.a)({},Ge),{},{target_id:He==null?void 0:He.target_ids})});case 2:tt=vt.sent,tt!=null&&tt.messages&&q(tt.messages);case 4:case"end":return vt.stop()}},pt)}));return function(){return st.apply(this,arguments)}}(),Ze=function(){var st=Object(R.a)(O.a.mark(function pt(){var tt;return O.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return vt.next=2,Ke({type:"messages/getPrivateMessages",payload:Object(M.a)(Object(M.a)({},Ge),ie)});case 2:tt=vt.sent,tt!=null&&tt.private_messages&&Ve(tt.private_messages);case 4:case"end":return vt.stop()}},pt)}));return function(){return st.apply(this,arguments)}}();return T.a.createElement("section",{className:v.a.bg},T.a.createElement("section",{className:"edu-container mt20"},T.a.createElement(G.a,{gutter:[20,20]},T.a.createElement(Te.a,null),T.a.createElement(W.a,{flex:"1"},T.a.createElement("aside",{className:"bg-white"},T.a.createElement("aside",{className:["font16",v.a.topBar].join(" ")},T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"30px",className:"tc"},T.a.createElement(_.a,{to:"/messages/".concat(Ge.userId,"/private_messages"),className:"iconfont icon-zuojiantou c-black pl10"})),T.a.createElement(W.a,{flex:"1",className:"tc"},Be==null||((Me=Be.target)===null||Me===void 0)?void 0:Me.name,"\u4E0E\u4F60\u7684\u79C1\u4FE1"),T.a.createElement(W.a,{flex:"290px",className:"tl"},T.a.createElement("span",{className:"pl30"},"\u79C1\u4FE1\u5217\u8868")))),T.a.createElement(G.a,null,T.a.createElement(W.a,{flex:"1"},T.a.createElement(We,null)),T.a.createElement(W.a,{flex:"290px"},T.a.createElement(H,null))))))))},Oe=et.default=Object(C.a)(function(ye){var me=ye.messages,Me=ye.loading,Ne=ye.user,Ie=ye.globalSetting;return{messages:me,globalSetting:Ie,user:Ne,loading:Me.effects}})(xe)},kSUc:function(mt,et,Q){},"kaH+":function(mt,et,Q){"use strict";var te=Q("+L6B"),G=Q("2/Rp"),A=Q("tJVT"),W=Q("q1tI"),M=Q.n(W),R=Q("UZu5"),N=Q.n(R),k=Q("dhSg"),D=Q("rLCj"),O=Q("dF/Y"),E=Q("4i/N");et.a=function(){var T=Object(W.useState)(""),_=Object(A.a)(T,2),C=_[0],y=_[1],g=Object(W.useState)(0),u=Object(A.a)(g,2),o=u[0],l=u[1],d=Object(W.useRef)("");Object(W.useEffect)(function(){var L=k.a.subscribe("preview-image",function(x){y(x),document.body.style.overflow="hidden"});return L},[]),Object(W.useEffect)(function(){return document.addEventListener("keydown",w),function(){document.removeEventListener("keydown",w)}},[]),Object(W.useEffect)(function(){d.current=C},[C]);function w(L){L.keyCode==27&&d.current&&f()}function f(){document.body.style.overflow="auto",y("")}function m(){l(o+90)}return M.a.createElement(W.Fragment,null,C?M.a.createElement("div",{className:"image-preview-container"},M.a.createElement("div",{className:"button-group"},M.a.createElement(G.a,{onClick:m},"\u65CB\u8F6C",M.a.createElement(D.a,null)),M.a.createElement(G.a,{href:C},"\u4E0B\u8F7D",M.a.createElement(O.a,null)),M.a.createElement(G.a,{onClick:f},"\u5173\u95ED",M.a.createElement(E.a,null))),M.a.createElement("div",{className:"preview-wrp-group"},M.a.createElement("img",{className:"image-preview",src:C,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(o,"deg)")}}))):null)}},kzJb:function(mt,et,Q){mt.exports={flex_box_center:"flex_box_center___2qtoc",flex_space_between:"flex_space_between___NF1Yf",flex_box_vertical_center:"flex_box_vertical_center___2qH_j",flex_box_center_end:"flex_box_center_end___22P0N",flex_box_column:"flex_box_column___1IKP8",userInfo:"userInfo___2Dupy",navInfo:"navInfo___3fEvD",actived:"actived___3F322",newTip:"newTip___1Ta-b"}},lZu9:function(mt,et,Q){(function(te){te(Q("VrN/"),Q("1eCo"),Q("8EBN"))})(function(te){"use strict";te.defineMode("markdown",function(G,A){var W=te.getMode(G,"text/html"),M=W.name=="null";function R(B){if(te.findModeByName){var U=te.findModeByName(B);U&&(B=U.mime||U.mimes[0])}var z=te.getMode(G,B);return z.name=="null"?null:z}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 N={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in N)N.hasOwnProperty(k)&&A.tokenTypeOverrides[k]&&(N[k]=A.tokenTypeOverrides[k]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,T=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,y=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(B,U,z){return U.f=U.inline=z,z(B,U)}function d(B,U,z){return U.f=U.block=z,z(B,U)}function w(B){return!B||!/\S/.test(B.string)}function f(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==L){var U=M;if(!U){var z=te.innerMode(W,B.htmlState);U=z.mode.name=="xml"&&z.state.tagStart===null&&!z.state.context&&z.state.tokenize.isInText}U&&(B.f=s,B.block=m,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function m(B,U){var z=B.column()===U.indentation,Z=w(U.prevLine.stream),ne=U.indentedCode,oe=U.prevLine.hr,Ce=U.list!==!1,he=(U.listStack[U.listStack.length-1]||0)+3;U.indentedCode=!1;var we=U.indentation;if(U.indentationDiff===null&&(U.indentationDiff=U.indentation,Ce)){for(U.list=null;we<U.listStack[U.listStack.length-1];)U.listStack.pop(),U.listStack.length?U.indentation=U.listStack[U.listStack.length-1]:U.list=!1;U.list!==!1&&(U.indentationDiff=we-U.listStack[U.listStack.length-1])}var ve=!Z&&!oe&&!U.prevLine.header&&(!Ce||!ne)&&!U.prevLine.fencedCodeEnd,pe=(U.list===!1||oe||Z)&&U.indentation<=he&&B.match(D),se=null;if(U.indentationDiff>=4&&(ne||U.prevLine.fencedCodeEnd||U.prevLine.header||Z))return B.skipToEnd(),U.indentedCode=!0,N.code;if(B.eatSpace())return null;if(z&&U.indentation<=he&&(se=B.match(T))&&se[1].length<=6)return U.quote=0,U.header=se[1].length,U.thisLine.header=!0,A.highlightFormatting&&(U.formatting="header"),U.f=U.inline,h(U);if(U.indentation<=he&&B.eat(">"))return U.quote=z?1:U.quote+1,A.highlightFormatting&&(U.formatting="quote"),B.eatSpace(),h(U);if(!pe&&!U.setext&&z&&U.indentation<=he&&(se=B.match(O))){var de=se[1]?"ol":"ul";return U.indentation=we+B.current().length,U.list=!0,U.quote=0,U.listStack.push(U.indentation),U.em=!1,U.strong=!1,U.code=!1,U.strikethrough=!1,A.taskLists&&B.match(E,!1)&&(U.taskList=!0),U.f=U.inline,A.highlightFormatting&&(U.formatting=["list","list-"+de]),h(U)}else{if(z&&U.indentation<=he&&(se=B.match(y,!0)))return U.quote=0,U.fencedEndRE=new RegExp(se[1]+"+ *$"),U.localMode=A.fencedCodeBlockHighlighting&&R(se[2]||A.fencedCodeBlockDefaultMode),U.localMode&&(U.localState=te.startState(U.localMode)),U.f=U.block=x,A.highlightFormatting&&(U.formatting="code-block"),U.code=-1,h(U);if(U.setext||(!ve||!Ce)&&!U.quote&&U.list===!1&&!U.code&&!pe&&!g.test(B.string)&&(se=B.lookAhead(1))&&(se=se.match(_)))return U.setext?(U.header=U.setext,U.setext=0,B.skipToEnd(),A.highlightFormatting&&(U.formatting="header")):(U.header=se[0].charAt(0)=="="?1:2,U.setext=U.header),U.thisLine.header=!0,U.f=U.inline,h(U);if(pe)return B.skipToEnd(),U.hr=!0,U.thisLine.hr=!0,N.hr;if(B.peek()==="[")return l(B,U,P)}return l(B,U,U.inline)}function L(B,U){var z=W.token(B,U.htmlState);if(!M){var Z=te.innerMode(W,U.htmlState);(Z.mode.name=="xml"&&Z.state.tagStart===null&&!Z.state.context&&Z.state.tokenize.isInText||U.md_inside&&B.current().indexOf(">")>-1)&&(U.f=s,U.block=m,U.htmlState=null)}return z}function x(B,U){var z=U.listStack[U.listStack.length-1]||0,Z=U.indentation<z,ne=z+3;if(U.fencedEndRE&&U.indentation<=ne&&(Z||B.match(U.fencedEndRE))){A.highlightFormatting&&(U.formatting="code-block");var oe;return Z||(oe=h(U)),U.localMode=U.localState=null,U.block=m,U.f=s,U.fencedEndRE=null,U.code=0,U.thisLine.fencedCodeEnd=!0,Z?d(B,U,U.block):oe}else return U.localMode?U.localMode.token(B,U.localState):(B.skipToEnd(),N.code)}function h(B){var U=[];if(B.formatting){U.push(N.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var z=0;z<B.formatting.length;z++)U.push(N.formatting+"-"+B.formatting[z]),B.formatting[z]==="header"&&U.push(N.formatting+"-"+B.formatting[z]+"-"+B.header),B.formatting[z]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=B.quote?U.push(N.formatting+"-"+B.formatting[z]+"-"+B.quote):U.push("error"))}if(B.taskOpen)return U.push("meta"),U.length?U.join(" "):null;if(B.taskClosed)return U.push("property"),U.length?U.join(" "):null;if(B.linkHref?U.push(N.linkHref,"url"):(B.strong&&U.push(N.strong),B.em&&U.push(N.em),B.strikethrough&&U.push(N.strikethrough),B.emoji&&U.push(N.emoji),B.linkText&&U.push(N.linkText),B.code&&U.push(N.code),B.image&&U.push(N.image),B.imageAltText&&U.push(N.imageAltText,"link"),B.imageMarker&&U.push(N.imageMarker)),B.header&&U.push(N.header,N.header+"-"+B.header),B.quote&&(U.push(N.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=B.quote?U.push(N.quote+"-"+B.quote):U.push(N.quote+"-"+A.maxBlockquoteDepth)),B.list!==!1){var Z=(B.listStack.length-1)%3;Z?Z===1?U.push(N.list2):U.push(N.list3):U.push(N.list1)}return B.trailingSpaceNewLine?U.push("trailing-space-new-line"):B.trailingSpace&&U.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),U.length?U.join(" "):null}function c(B,U){return B.match(C,!0)?h(U):void 0}function s(B,U){var z=U.text(B,U);if(typeof z!="undefined")return z;if(U.list)return U.list=null,h(U);if(U.taskList){var Z=B.match(E,!0)[1]===" ";return Z?U.taskOpen=!0:U.taskClosed=!0,A.highlightFormatting&&(U.formatting="task"),U.taskList=!1,h(U)}if(U.taskOpen=!1,U.taskClosed=!1,U.header&&B.match(/^#+$/,!0))return A.highlightFormatting&&(U.formatting="header"),h(U);var ne=B.next();if(U.linkTitle){U.linkTitle=!1;var oe=ne;ne==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ce="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(B.match(new RegExp(Ce),!0))return N.linkHref}if(ne==="`"){var he=U.formatting;A.highlightFormatting&&(U.formatting="code"),B.eatWhile("`");var we=B.current().length;if(U.code==0&&(!U.quote||we==1))return U.code=we,h(U);if(we==U.code){var ve=h(U);return U.code=0,ve}else return U.formatting=he,h(U)}else if(U.code)return h(U);if(ne==="\\"&&(B.next(),A.highlightFormatting)){var pe=h(U),se=N.formatting+"-escape";return pe?pe+" "+se:se}if(ne==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return U.imageMarker=!0,U.image=!0,A.highlightFormatting&&(U.formatting="image"),h(U);if(ne==="["&&U.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return U.imageMarker=!1,U.imageAltText=!0,A.highlightFormatting&&(U.formatting="image"),h(U);if(ne==="]"&&U.imageAltText){A.highlightFormatting&&(U.formatting="image");var pe=h(U);return U.imageAltText=!1,U.image=!1,U.inline=U.f=v,pe}if(ne==="["&&!U.image)return U.linkText&&B.match(/^.*?\]/)||(U.linkText=!0,A.highlightFormatting&&(U.formatting="link")),h(U);if(ne==="]"&&U.linkText){A.highlightFormatting&&(U.formatting="link");var pe=h(U);return U.linkText=!1,U.inline=U.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?v:s,pe}if(ne==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,A.highlightFormatting&&(U.formatting="link");var pe=h(U);return pe?pe+=" ":pe="",pe+N.linkInline}if(ne==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){U.f=U.inline=a,A.highlightFormatting&&(U.formatting="link");var pe=h(U);return pe?pe+=" ":pe="",pe+N.linkEmail}if(A.xml&&ne==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var de=B.string.indexOf(">",B.pos);if(de!=-1){var Le=B.string.substring(B.start,de);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Le)&&(U.md_inside=!0)}return B.backUp(1),U.htmlState=te.startState(W),d(B,U,L)}if(A.xml&&ne==="<"&&B.match(/^\/\w*?>/))return U.md_inside=!1,"tag";if(ne==="*"||ne==="_"){for(var We=1,Te=B.pos==1?" ":B.string.charAt(B.pos-2);We<3&&B.eat(ne);)We++;var xe=B.peek()||" ",Oe=!/\s/.test(xe)&&(!u.test(xe)||/\s/.test(Te)||u.test(Te)),ye=!/\s/.test(Te)&&(!u.test(Te)||/\s/.test(xe)||u.test(xe)),me=null,Me=null;if(We%2&&(!U.em&&Oe&&(ne==="*"||!ye||u.test(Te))?me=!0:U.em==ne&&ye&&(ne==="*"||!Oe||u.test(xe))&&(me=!1)),We>1&&(!U.strong&&Oe&&(ne==="*"||!ye||u.test(Te))?Me=!0:U.strong==ne&&ye&&(ne==="*"||!Oe||u.test(xe))&&(Me=!1)),Me!=null||me!=null){A.highlightFormatting&&(U.formatting=me==null?"strong":Me==null?"em":"strong em"),me===!0&&(U.em=ne),Me===!0&&(U.strong=ne);var ve=h(U);return me===!1&&(U.em=!1),Me===!1&&(U.strong=!1),ve}}else if(ne===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return h(U);B.backUp(1)}if(A.strikethrough){if(ne==="~"&&B.eatWhile(ne)){if(U.strikethrough){A.highlightFormatting&&(U.formatting="strikethrough");var ve=h(U);return U.strikethrough=!1,ve}else if(B.match(/^[^\s]/,!1))return U.strikethrough=!0,A.highlightFormatting&&(U.formatting="strikethrough"),h(U)}else if(ne===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return h(U);B.backUp(2)}}if(A.emoji&&ne===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){U.emoji=!0,A.highlightFormatting&&(U.formatting="emoji");var Ne=h(U);return U.emoji=!1,Ne}return ne===" "&&(B.match(/^ +$/,!1)?U.trailingSpace++:U.trailingSpace&&(U.trailingSpaceNewLine=!0)),h(U)}function a(B,U){var z=B.next();if(z===">"){U.f=U.inline=s,A.highlightFormatting&&(U.formatting="link");var Z=h(U);return Z?Z+=" ":Z="",Z+N.linkInline}return B.match(/^[^>]+/,!0),N.linkInline}function v(B,U){if(B.eatSpace())return null;var z=B.next();return z==="("||z==="["?(U.f=U.inline=b(z==="("?")":"]"),A.highlightFormatting&&(U.formatting="link-string"),U.linkHref=!0,h(U)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(B){return function(U,z){var Z=U.next();if(Z===B){z.f=z.inline=s,A.highlightFormatting&&(z.formatting="link-string");var ne=h(z);return z.linkHref=!1,ne}return U.match(p[B]),z.linkHref=!0,h(z)}}function P(B,U){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(U.f=F,B.next(),A.highlightFormatting&&(U.formatting="link"),U.linkText=!0,h(U)):l(B,U,s)}function F(B,U){if(B.match(/^\]:/,!0)){U.f=U.inline=H,A.highlightFormatting&&(U.formatting="link");var z=h(U);return U.linkText=!1,z}return B.match(/^([^\]\\]|\\.)+/,!0),N.linkText}function H(B,U){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?U.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),U.f=U.inline=s,N.linkHref+" url")}var X={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&te.copyState(W,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?te.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,U){if(U.formatting=!1,B!=U.thisLine.stream){if(U.header=0,U.hr=!1,B.match(/^\s*$/,!0))return f(U),null;if(U.prevLine=U.thisLine,U.thisLine={stream:B},U.taskList=!1,U.trailingSpace=0,U.trailingSpaceNewLine=!1,!U.localState&&(U.f=U.block,U.f!=L)){var z=B.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(U.indentation=z,U.indentationDiff=null,z>0)return null}}return U.f(B,U)},innerMode:function(B){return B.block==L?{state:B.htmlState,mode:W}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:X}},indent:function(B,U,z){return B.block==L&&W.indent?W.indent(B.htmlState,U,z):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,U,z):te.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return X},"xml"),te.defineMIME("text/markdown","markdown"),te.defineMIME("text/x-markdown","markdown")})},osHv:function(mt,et,Q){(function(te){te(Q("VrN/"))})(function(te){"use strict";var G=te.Pos;function A(u,o){return u.line-o.line||u.ch-o.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",R=new RegExp("<(/?)(["+W+"]["+M+"]*)","g");function N(u,o,l,d){this.line=o,this.ch=l,this.cm=u,this.text=u.getLine(o),this.min=d?Math.max(d.from,u.firstLine()):u.firstLine(),this.max=d?Math.min(d.to-1,u.lastLine()):u.lastLine()}function k(u,o){var l=u.cm.getTokenTypeAt(G(u.line,o));return l&&/\btag\b/.test(l)}function D(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function O(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function E(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(D(u))continue;return}if(!k(u,o+1)){u.ch=o+1;continue}var l=u.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function T(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(O(u))continue;return}if(!k(u,o+1)){u.ch=o;continue}R.lastIndex=o,u.ch=o;var l=R.exec(u.text);if(l&&l.index==o)return l}}function _(u){for(;;){R.lastIndex=u.ch;var o=R.exec(u.text);if(!o){if(D(u))continue;return}if(!k(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function C(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(O(u))continue;return}if(!k(u,o+1)){u.ch=o;continue}var l=u.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function y(u,o){for(var l=[];;){var d=_(u),w,f=u.line,m=u.ch-(d?d[0].length:0);if(!d||!(w=E(u)))return;if(w=="selfClose")continue;if(d[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==d[2]){l.length=L;break}if(L<0&&(!o||o==d[2]))return{tag:d[2],from:G(f,m),to:G(u.line,u.ch)}}else l.push(d[2])}}function g(u,o){for(var l=[];;){var d=C(u);if(!d)return;if(d=="selfClose"){T(u);continue}var w=u.line,f=u.ch,m=T(u);if(!m)return;if(m[1])l.push(m[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==m[2]){l.length=L;break}if(L<0&&(!o||o==m[2]))return{tag:m[2],from:G(u.line,u.ch),to:G(w,f)}}}}te.registerHelper("fold","xml",function(u,o){for(var l=new N(u,o.line,0);;){var d=_(l);if(!d||l.line!=o.line)return;var w=E(l);if(!w)return;if(!d[1]&&w!="selfClose"){var f=G(l.line,l.ch),m=y(l,d[2]);return m&&A(m.from,f)>0?{from:f,to:m.from}:null}}}),te.findMatchingTag=function(u,o,l){var d=new N(u,o.line,o.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var w=E(d),f=w&&G(d.line,d.ch),m=w&&T(d);if(!w||!m||A(d,o)>0)return;var L={from:G(d.line,d.ch),to:f,tag:m[2]};return w=="selfClose"?{open:L,close:null,at:"open"}:m[1]?{open:g(d,m[2]),close:L,at:"close"}:(d=new N(u,f.line,f.ch,l),{open:L,close:y(d,m[2]),at:"open"})},te.findEnclosingTag=function(u,o,l,d){for(var w=new N(u,o.line,o.ch,l);;){var f=g(w,d);if(!f)break;var m=new N(u,o.line,o.ch,l),L=y(m,f.tag);if(L)return{open:f,close:L}}},te.scanForClosingTag=function(u,o,l,d){var w=new N(u,o.line,o.ch,d?{from:0,to:d}:null);return y(w,l)}})},p5ED:function(mt,et,Q){"use strict";var te=Q("+L6B"),G=Q("2/Rp"),A=Q("5Dmo"),W=Q("3S7+"),M=Q("k1fw"),R=Q("tJVT"),N=Q("q1tI"),k=Q.n(N),D=Q("vHTk"),O=Q.n(D),E=Q("yEEn"),T=Q("ZW9T"),_=Q("1vsH");et.a=function(C){var y=C.name,g=C.data,u=C.theme,o=C.type,l=C.filename,d=C.monacoEditor,w=C.className,f=C.style,m=C.close,L=C.onClose,x=C.hasMask,h=Object(N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),s=c[0],a=c[1],v=Object(N.useState)(""),p=Object(R.a)(v,2),b=p[0],P=p[1],F=Object(N.useRef)();l&&(d.filename=l),Object(N.useEffect)(function(){var B,U,z=(B=document.cookie)===null||B===void 0||((U=B.replace(/\s/g,""))===null||U===void 0)?void 0:U.split(";");z==null||z.map(function(Z){var ne=Z.split("=");ne[0]==="_educoder_session"&&P(ne[1])})},[]);var H=function(){if(g.startsWith("http")||g.startsWith("/")){X();return}Object(_.y)(l||"educoder",g,l)},X=function(){Object(_.w)(l||y,g)};return console.log("data:",g,"fileanme:",l," name:",y),k.a.createElement("div",{style:Object(M.a)({},f||{}),className:"".concat(x&&O.a.bgBlack," ").concat(o?O.a.wrp:"hide")},m&&k.a.createElement("div",{className:O.a.close,ref:F},k.a.createElement(W.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.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 F.current}},k.a.createElement("span",{className:"",onClick:L},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(O.a[w]," ").concat(w," ").concat(O.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&k.a.createElement(T.b,d)),o==="audio"&&k.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),o==="video"&&k.a.createElement(k.a.Fragment,null,g!=null&&g.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),o==="pdf"&&k.a.createElement("embed",{className:O.a.embed,src:g}),o==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),o==="other"&&k.a.createElement("div",null,k.a.createElement(G.a,{type:"primary",size:"large",onClick:H},k.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&k.a.createElement(G.a,{type:"primary",size:"large",onClick:H},k.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(mt,et,Q){},"rAM+":function(mt,et,Q){"use strict";Q.d(et,"a",function(){return G});var te=Q("Qw5x");function G(A,W){var M;if(typeof Symbol=="undefined"||A[Symbol.iterator]==null){if(Array.isArray(A)||(M=Object(te.a)(A))||W&&A&&typeof A.length=="number"){M&&(A=M);var R=0,N=function(){};return{s:N,n:function(){return R>=A.length?{done:!0}:{done:!1,value:A[R++]}},e:function(T){throw T},f:N}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,D=!1,O;return{s:function(){M=A[Symbol.iterator]()},n:function(){var T=M.next();return k=T.done,T},e:function(T){D=!0,O=T},f:function(){try{!k&&M.return!=null&&M.return()}finally{if(D)throw O}}}}},rUJ1:function(mt,et){const Q=/[&<>"']/,te=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,W={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},M=x=>W[x];function R(x,h){if(h){if(Q.test(x))return x.replace(te,M)}else if(G.test(x))return x.replace(A,M);return x}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(x){return x.replace(N,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const D=/(^|[^\[])\^/g;function O(x,h){x=x.source||x,h=h||"";const c={replace:(s,a)=>(a=a.source||a,a=a.replace(D,"$1"),x=x.replace(s,a),c),getRegex:()=>new RegExp(x,h)};return c}const E=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(x,h,c){if(x){let s;try{s=decodeURIComponent(k(c)).replace(E,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}h&&!T.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(s){return null}return c}const C={},y=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,h){C[" "+x]||(y.test(x)?C[" "+x]=x+"/":C[" "+x]=f(x,"/",!0)),x=C[" "+x];const c=x.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:x.replace(g,"$1")+h:h.charAt(0)==="/"?c?h:x.replace(u,"$1")+h:x+h}const l={exec:function(){}};function d(x){let h=1,c,s;for(;h<arguments.length;h++){c=arguments[h];for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(x[s]=c[s])}return x}function w(x,h){const c=x.replace(/\|/g,(v,p,b)=>{let P=!1,F=p;for(;--F>=0&&b[F]==="\\";)P=!P;return P?"|":" |"}),s=c.split(/ \|/);let a=0;if(s.length>h)s.splice(h);else for(;s.length<h;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function f(x,h,c){const s=x.length;if(s===0)return"";let a=0;for(;a<s;){const v=x.charAt(s-a-1);if(v===h&&!c)a++;else if(v!==h&&c)a++;else break}return x.substr(0,s-a)}function m(x,h){if(x.indexOf(h[1])===-1)return-1;const c=x.length;let s=0,a=0;for(;a<c;a++)if(x[a]==="\\")a++;else if(x[a]===h[0])s++;else if(x[a]===h[1]&&(s--,s<0))return a;return-1}function L(x){x&&x.sanitize&&!x.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")}mt.exports={escape:R,unescape:k,edit:O,cleanUrl:_,resolveUrl:o,noopTest:l,merge:d,splitCells:w,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:L}},ulZh:function(mt,et,Q){typeof window!="undefined"&&function(G,A){mt.exports=A()}(this,function(){return function(te){var G={};function A(W){if(G[W])return G[W].exports;var M=G[W]={i:W,l:!1,exports:{}};return te[W].call(M.exports,M,M.exports,A),M.l=!0,M.exports}return A.m=te,A.c=G,A.d=function(W,M,R){A.o(W,M)||Object.defineProperty(W,M,{enumerable:!0,get:R})},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 R=Object.create(null);if(A.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:W}),M&2&&typeof W!="string")for(var N in W)A.d(R,N,function(k){return W[k]}.bind(null,N));return R},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(te,G,A){"use strict";var W=Object.prototype.hasOwnProperty,M="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(M=!1));function N(E,T,_){this.fn=E,this.context=T,this.once=_||!1}function k(E,T,_,C,y){if(typeof _!="function")throw new TypeError("The listener must be a function");var g=new N(_,C||E,y),u=M?M+T:T;return E._events[u]?E._events[u].fn?E._events[u]=[E._events[u],g]:E._events[u].push(g):(E._events[u]=g,E._eventsCount++),E}function D(E,T){--E._eventsCount===0?E._events=new R:delete E._events[T]}function O(){this._events=new R,this._eventsCount=0}O.prototype.eventNames=function(){var T=[],_,C;if(this._eventsCount===0)return T;for(C in _=this._events)W.call(_,C)&&T.push(M?C.slice(1):C);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(_)):T},O.prototype.listeners=function(T){var _=M?M+T:T,C=this._events[_];if(!C)return[];if(C.fn)return[C.fn];for(var y=0,g=C.length,u=new Array(g);y<g;y++)u[y]=C[y].fn;return u},O.prototype.listenerCount=function(T){var _=M?M+T:T,C=this._events[_];return C?C.fn?1:C.length:0},O.prototype.emit=function(T,_,C,y,g,u){var o=M?M+T:T;if(!this._events[o])return!1;var l=this._events[o],d=arguments.length,w,f;if(l.fn){l.once&&this.removeListener(T,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,_),!0;case 3:return l.fn.call(l.context,_,C),!0;case 4:return l.fn.call(l.context,_,C,y),!0;case 5:return l.fn.call(l.context,_,C,y,g),!0;case 6:return l.fn.call(l.context,_,C,y,g,u),!0}for(f=1,w=new Array(d-1);f<d;f++)w[f-1]=arguments[f];l.fn.apply(l.context,w)}else{var m=l.length,L;for(f=0;f<m;f++){l[f].once&&this.removeListener(T,l[f].fn,void 0,!0);switch(d){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,_);break;case 3:l[f].fn.call(l[f].context,_,C);break;case 4:l[f].fn.call(l[f].context,_,C,y);break;default:if(!w)for(L=1,w=new Array(d-1);L<d;L++)w[L-1]=arguments[L];l[f].fn.apply(l[f].context,w)}}}return!0},O.prototype.on=function(T,_,C){return k(this,T,_,C,!1)},O.prototype.once=function(T,_,C){return k(this,T,_,C,!0)},O.prototype.removeListener=function(T,_,C,y){var g=M?M+T:T;if(!this._events[g])return this;if(!_)return D(this,g),this;var u=this._events[g];if(u.fn)u.fn===_&&(!y||u.once)&&(!C||u.context===C)&&D(this,g);else{for(var o=0,l=[],d=u.length;o<d;o++)(u[o].fn!==_||y&&!u[o].once||C&&u[o].context!==C)&&l.push(u[o]);l.length?this._events[g]=l.length===1?l[0]:l:D(this,g)}return this},O.prototype.removeAllListeners=function(T){var _;return T?(_=M?M+T:T,this._events[_]&&D(this,_)):(this._events=new R,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=M,O.EventEmitter=O,te.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(te,G,A){(function(W){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(O,E,T){if(T=T||{},O=O.trim(),E=E.trim(),!E){if(!T.alwaysNormalize)return O;var _=D.parseURL(O);if(!_)throw new Error("Error trying to parse base URL.");return _.path=D.normalizePath(_.path),D.buildURLFromParts(_)}var C=D.parseURL(E);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return T.alwaysNormalize?(C.path=D.normalizePath(C.path),D.buildURLFromParts(C)):E;var y=D.parseURL(O);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var g=R.exec(y.path);y.netLoc=g[1],y.path=g[2]}y.netLoc&&!y.path&&(y.path="/");var u={scheme:y.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(u.netLoc=y.netLoc,C.path[0]!=="/"))if(!C.path)u.path=y.path,C.params||(u.params=y.params,C.query||(u.query=y.query));else{var o=y.path,l=o.substring(0,o.lastIndexOf("/")+1)+C.path;u.path=D.normalizePath(l)}return u.path===null&&(u.path=T.alwaysNormalize?D.normalizePath(C.path):C.path),D.buildURLFromParts(u)},parseURL:function(O){var E=M.exec(O);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(N,"");O.length!==(O=O.replace(k,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};te.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(te,G,A){function W(T){var _={};function C(g){if(_[g])return _[g].exports;var u=_[g]={i:g,l:!1,exports:{}};return T[g].call(u.exports,u,u.exports,C),u.l=!0,u.exports}C.m=T,C.c=_,C.i=function(g){return g},C.d=function(g,u,o){C.o(g,u)||Object.defineProperty(g,u,{configurable:!1,enumerable:!0,get:o})},C.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},C.n=function(g){var u=g&&g.__esModule?function(){return g.default}:function(){return g};return C.d(u,"a",u),u},C.o=function(g,u){return Object.prototype.hasOwnProperty.call(g,u)},C.p="/",C.oe=function(g){throw console.error(g),g};var y=C(C.s=ENTRY_MODULE);return y.default||y}var M="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function N(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(T){return!isNaN(1*T)}function D(T,_,C){var y={};y[C]=[];var g=_.toString(),u=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return y;for(var o=u[1],l=new RegExp("(\\\\n|\\W)"+N(o)+R,"g"),d;d=l.exec(g);){if(d[3]==="dll-reference")continue;y[C].push(d[3])}for(l=new RegExp("\\("+N(o)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+R,"g");d=l.exec(g);)T[d[2]]||(y[C].push(d[1]),T[d[2]]=A(d[1]).m),y[d[2]]=y[d[2]]||[],y[d[2]].push(d[4]);for(var w=Object.keys(y),f=0;f<w.length;f++)for(var m=0;m<y[w[f]].length;m++)k(y[w[f]][m])&&(y[w[f]][m]=1*y[w[f]][m]);return y}function O(T){var _=Object.keys(T);return _.reduce(function(C,y){return C||T[y].length>0},!1)}function E(T,_){for(var C={main:[_]},y={main:[]},g={main:{}};O(C);)for(var u=Object.keys(C),o=0;o<u.length;o++){var l=u[o],d=C[l],w=d.pop();if(g[l]=g[l]||{},g[l][w]||!T[l][w])continue;g[l][w]=!0,y[l]=y[l]||[],y[l].push(w);for(var f=D(T,T[l][w],l),m=Object.keys(f),L=0;L<m.length;L++)C[m[L]]=C[m[L]]||[],C[m[L]]=C[m[L]].concat(f[m[L]])}return y}te.exports=function(T,_){_=_||{};var C={main:A.m},y=_.all?{main:Object.keys(C.main)}:E(C,T),g="";Object.keys(y).filter(function(w){return w!=="main"}).forEach(function(w){for(var f=0;y[w][f];)f++;y[w].push(f),C[w][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+w+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+y[w].map(function(m){return""+JSON.stringify(m)+": "+C[w][m].toString()}).join(",")+`});
`}),g=g+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+y.main.map(function(w){return""+JSON.stringify(w)+": "+C.main[w].toString()}).join(",")+"}))(self);";var u=new window.Blob([g],{type:"text/javascript"});if(_.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(u),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"hlsDefaultConfig",function(){return L}),A.d(G,"mergeConfig",function(){return h}),A.d(G,"enableStreamingMode",function(){return c});var W=A("./src/controller/abr-controller.ts"),M=A("./src/controller/audio-stream-controller.ts"),R=A("./src/controller/audio-track-controller.ts"),N=A("./src/controller/subtitle-stream-controller.ts"),k=A("./src/controller/subtitle-track-controller.ts"),D=A("./src/controller/buffer-controller.ts"),O=A("./src/controller/timeline-controller.ts"),E=A("./src/controller/cap-level-controller.ts"),T=A("./src/controller/fps-controller.ts"),_=A("./src/controller/eme-controller.ts"),C=A("./src/controller/cmcd-controller.ts"),y=A("./src/utils/xhr-loader.ts"),g=A("./src/utils/fetch-loader.ts"),u=A("./src/utils/cues.ts"),o=A("./src/utils/mediakeys-helper.ts"),l=A("./src/utils/logger.ts");function d(){return d=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(s[p]=v[p])}return s},d.apply(this,arguments)}function w(s,a){var v=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);a&&(p=p.filter(function(b){return Object.getOwnPropertyDescriptor(s,b).enumerable})),v.push.apply(v,p)}return v}function f(s){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?w(Object(v),!0).forEach(function(p){m(s,p,v[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(v)):w(Object(v)).forEach(function(p){Object.defineProperty(s,p,Object.getOwnPropertyDescriptor(v,p))})}return s}function m(s,a,v){return a in s?Object.defineProperty(s,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):s[a]=v,s}var L=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:y.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:D.default,capLevelController:E.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:k.default,timelineController:O.TimelineController,audioStreamController:M.default,audioTrackController:R.default,emeController:_.default,cmcdController:C.default});function x(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},s,a)}function c(s){var a=s.loader;if(a!==g.default&&a!==y.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var v=Object(g.fetchSupported)();v&&(s.loader=g.default,s.progressive=!0,s.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/ewma-bandwidth-estimator.ts"),R=A("./src/events.ts"),N=A("./src/utils/buffer-helper.ts"),k=A("./src/errors.ts"),D=A("./src/types/loader.ts"),O=A("./src/utils/logger.ts");function E(C,y){for(var g=0;g<y.length;g++){var u=y[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function T(C,y,g){return y&&E(C.prototype,y),g&&E(C,g),C}var _=function(){function C(g){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=g;var u=g.config;this.bwEstimator=new M.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var y=C.prototype;return y.registerListeners=function(){var u=this.hls;u.on(R.Events.FRAG_LOADING,this.onFragLoading,this),u.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var u=this.hls;u.off(R.Events.FRAG_LOADING,this.onFragLoading,this),u.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},y.onFragLoading=function(u,o){var l=o.frag;if(l.type===D.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},y.onLevelLoaded=function(u,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},y._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,w=l.config,f=l.media;if(!u||!f)return;var m=o?o.stats:u.stats,L=o?o.duration:u.duration;if(m.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||f.paused||!f.playbackRate||!f.readyState)return;var x=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(x<=500*L/h)return;var c=l.levels,s=l.minAutoLevel,a=c[u.level],v=m.total||Math.max(m.loaded,Math.round(L*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/x),b=(v-m.loaded)/p,P=f.currentTime,F=(N.BufferHelper.bufferInfo(f,P,w.maxBufferHole).end-P)/h;if(F>=2*L/h||b<=F)return;var H=Number.POSITIVE_INFINITY,X;for(X=u.level-1;X>s;X--){var B=c[X].maxBitrate;if(H=L*B/(8*.8*p),H<F)break}if(H>=b)return;var U=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+X+`
Current BW estimate: `+(Object(W.isFiniteNumber)(U)?(U/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+b.toFixed(3)+` s
Estimated load time for the next fragment: `+H.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),l.nextLoadLevel=X,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),l.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:m})},y.onFragLoaded=function(u,o){var l=o.frag,d=o.part;if(l.type===D.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(l.sn)){var w=d?d.stats:l.stats,f=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[l.level],L=(m.loaded?m.loaded.bytes:0)+w.loaded,x=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:L,duration:x},m.realBitrate=Math.round(8*L/x)}if(l.bitrateTest){var h={stats:w,frag:l,part:d,id:l.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),l.bitrateTest=!1}}},y.onFragBuffered=function(u,o){var l=o.frag,d=o.part,w=d?d.stats:l.stats;if(w.aborted)return;if(l.type!==D.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var f=w.parsing.end-w.loading.start;this.bwEstimator.sample(f,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},y.onError=function(u,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},y.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},y.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.maxAutoLevel,w=l.config,f=l.minAutoLevel,m=l.media,L=o?o.duration:u?u.duration:0,x=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,s=(N.BufferHelper.bufferInfo(m,x,w.maxBufferHole).end-x)/h,a=this.findBestLevel(c,f,d,s,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=L?Math.min(L,w.maxStarvationDelay):w.maxStarvationDelay,p=w.abrBandWidthFactor,b=w.abrBandWidthUpFactor;if(!s){var P=this.bitrateTestDelay;if(P){var F=L?Math.min(L,w.maxLoadingDelay):w.maxLoadingDelay;v=F-P,O.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),p=b=1}}return a=this.findBestLevel(c,f,d,s+v,p,b),Math.max(a,0)},y.findBestLevel=function(u,o,l,d,w,f){for(var m,L=this.fragCurrent,x=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,s=c[h],a=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),v=s==null?void 0:s.codecSet,p=x?x.duration:L?L.duration:0,b=l;b>=o;b--){var P=c[b];if(!P||v&&P.codecSet!==v)continue;var F=P.details,H=(x?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||p,X=void 0;b<=h?X=w*u:X=f*u;var B=c[b].maxBitrate,U=B*H/X;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(X)+"/"+B+"/"+H+"/"+d+"/"+U),X>B&&(!U||a&&!this.bitrateTestDelay||U<d))return b}return-1},T(C,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var l=this.getNextABRAutoLevel();return u!==-1&&(l=Math.min(u,l)),l},set:function(u){this._nextAutoLevel=u}}]),C}();G.default=_},"./src/controller/audio-stream-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),R=A("./src/events.ts"),N=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),D=A("./src/types/level.ts"),O=A("./src/types/loader.ts"),E=A("./src/loader/fragment.ts"),T=A("./src/demux/chunk-cache.ts"),_=A("./src/demux/transmuxer-interface.ts"),C=A("./src/types/transmuxer.ts"),y=A("./src/controller/fragment-finders.ts"),g=A("./src/utils/discontinuities.ts"),u=A("./src/errors.ts"),o=A("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(L[c]=h[c])}return L},l.apply(this,arguments)}function d(L,x){L.prototype=Object.create(x.prototype),L.prototype.constructor=L,w(L,x)}function w(L,x){return w=Object.setPrototypeOf||function(c,s){return c.__proto__=s,c},w(L,x)}var f=100,m=function(L){d(x,L);function x(c,s){var a;return a=L.call(this,c,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=x.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var s=this.hls;s.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(R.Events.ERROR,this.onError,this),s.on(R.Events.BUFFER_RESET,this.onBufferReset,this),s.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var s=this.hls;s.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(R.Events.ERROR,this.onError,this),s.off(R.Events.BUFFER_RESET,this.onBufferReset,this),s.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(s,a){var v=a.frag,p=a.id,b=a.initPTS;if(p==="main"){var P=v.cc;this.initPTS[v.cc]=b,this.log("InitPTS for cc: "+P+" found from main: "+b),this.videoTrackCC=P,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},h.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var s,a=this.levels,v=this.trackId,p=a==null||((s=a[v])===null||s===void 0)?void 0:s.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var b,P=performance.now(),F=this.retryDate;(!F||P>=F||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var H=this.waitingData;if(H){var X=H.frag,B=H.part,U=H.cache,z=H.complete;if(this.initPTS[X.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var Z=U.flush(),ne={frag:X,part:B,payload:Z,networkDetails:null};this._handleFragmentLoadProgress(ne),z&&L.prototype._handleFragmentLoadComplete.call(this,ne)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+X.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Ce=N.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),he=Object(y.fragmentWithinToleranceTest)(Ce.end,this.config.maxFragLookUpTolerance,X);he<0&&(o.logger.log("Waiting fragment cc ("+X.cc+") @ "+X.start+" cancelled because another fragment at "+Ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},h.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},h.doTickIdle=function(){var s,a,v=this.hls,p=this.levels,b=this.media,P=this.trackId,F=v.config;if(!p||!p[P])return;if(!b&&(this.startFragRequested||!F.startFragPrefetch))return;var H=p[P],X=H.details;if(!X||X.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(X)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(B===null)return;var U=B.len,z=this.getMaxBufferLength(),Z=this.audioSwitch;if(U>=z&&!Z)return;if(!Z&&this._streamEnded(B,X)){v.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ne=X.fragments,oe=ne[0].start,Ce=B.end;if(Z){var he=this.getLoadPosition();Ce=he,X.PTSKnown&&he<oe&&((B.end>oe||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=oe+.05))}var we=this.getNextFragment(Ce,X);if(!we){this.bufferFlushed=!0;return}((s=we.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=we.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(we,X):this.loadFragment(we,X,Ce)},h.getMaxBufferLength=function(){var s=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(s,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(p){return new D.Level(p)})},h.onAudioTrackSwitching=function(s,a){var v=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(f):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(s,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(s,a){var v,p=this.levels,b=a.details,P=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var F=p[P],H=0;if(b.live||(v=F.details)!==null&&v!==void 0&&v.live){var X=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!X)return;!F.details&&b.hasProgramDateTime&&X.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(b,X),H=b.fragments[0].start):H=this.alignPlaylists(b,F.details)}F.details=b,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(F.details,H),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=M.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(s){var a,v=s.frag,p=s.part,b=s.payload,P=this.config,F=this.trackId,H=this.levels;if(!H){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var X=H[F];console.assert(X,"Audio track is defined on fragment load progress");var B=X.details;console.assert(B,"Audio track details are defined on fragment load progress");var U=P.defaultAudioCodec||X.audioCodec||"mp4a.40.2",z=this.transmuxer;z||(z=this.transmuxer=new _.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Z=this.initPTS[v.cc],ne=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Z!==void 0){var oe=!1,Ce=p?p.index:-1,he=Ce!==-1,we=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,b.byteLength,Ce,he);z.push(b,ne,U,"",v,p,B.totalduration,oe,we,Z)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+F);var ve=this.waitingData=this.waitingData||{frag:v,part:p,cache:new T.default,complete:!1},pe=ve.cache;pe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,s)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(s,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(s,a){var v=a.frag,p=a.part;if(v.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(p?" p: "+p.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,p)},h.onError=function(s,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=a.fatal?M.State.ERROR:M.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var v=!0,p=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);p&&p.len>.5&&(v=!this.reduceMaxBufferLength(p.len)),v&&(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}},h.onBufferFlushed=function(s,a){var v=a.type;v===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(s){var a,v="audio",p=this.hls,b=s.remuxResult,P=s.chunkMeta,F=this.getCurrentContext(P);if(!F){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var H=F.frag,X=F.part,B=b.audio,U=b.text,z=b.id3,Z=b.initSegment;if(this.fragContextChanged(H))return;if(this.state=M.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),Z!=null&&Z.tracks&&(this._bufferInitSegment(Z.tracks,H,P),p.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:v,tracks:Z.tracks})),B){var ne=B.startPTS,oe=B.endPTS,Ce=B.startDTS,he=B.endDTS;X&&(X.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:oe,startDTS:Ce,endDTS:he}),H.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ne,oe,Ce,he),this.bufferFragmentData(B,H,X,P)}if(z!=null&&(a=z.samples)!==null&&a!==void 0&&a.length){var we=l({frag:H,id:v},z);p.trigger(R.Events.FRAG_PARSING_METADATA,we)}if(U){var ve=l({frag:H,id:v},U);p.trigger(R.Events.FRAG_PARSING_USERDATA,ve)}},h._bufferInitSegment=function(s,a,v){if(this.state!==M.State.PARSING)return;s.video&&delete s.video;var p=s.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,s);var b=p.initSegment;if(b!=null&&b.byteLength){var P={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:b};this.hls.trigger(R.Events.BUFFER_APPENDING,P)}this.tick()},h.loadFragment=function(s,a,v){var p=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||p===k.FragmentState.NOT_LOADED||p===k.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(W.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,s,a,v)))},h.completeAudioSwitch=function(){var s=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:v})},x}(M.default);G.default=m},"./src/controller/audio-track-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/events.ts"),M=A("./src/errors.ts"),R=A("./src/controller/base-playlist-controller.ts"),N=A("./src/types/loader.ts");function k(_,C){for(var y=0;y<C.length;y++){var g=C[y];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(_,g.key,g)}}function D(_,C,y){return C&&k(_.prototype,C),y&&k(_,y),_}function O(_,C){_.prototype=Object.create(C.prototype),_.prototype.constructor=_,E(_,C)}function E(_,C){return E=Object.setPrototypeOf||function(g,u){return g.__proto__=u,g},E(_,C)}var T=function(_){O(C,_);function C(g){var u;return u=_.call(this,g,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var y=C.prototype;return y.registerListeners=function(){var u=this.hls;u.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(W.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var u=this.hls;u.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(W.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},y.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},y.onAudioTrackLoaded=function(u,o){var l=o.id,d=o.details,w=this.tracksInGroup[l];if(!w){this.warn("Invalid audio track id "+l);return}var f=w.details;w.details=o.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,f))},y.onLevelLoading=function(u,o){this.switchLevel(o.level)},y.onLevelSwitching=function(u,o){this.switchLevel(o.level)},y.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(f){return!l||f.groupId===l});this.selectDefaultTrack&&!d.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var w={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},y.onError=function(u,o){if(_.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===N.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},y.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+u);var d=o[u],w=d.id,f=d.groupId,m=f===void 0?"":f,L=d.name,x=d.type,h=d.url;if(this.trackId=u,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:m,name:L,type:x,url:h}),d.details&&!d.details.live)return;var c=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(c)},y.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||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}))},y.findTrackId=function(u){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var d=o[l];if((!this.selectDefaultTrack||d.default)&&(!u||u===d.name))return d.id}return-1},y.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,d=o.groupId,w=o.url;if(u)try{w=u.addDirectives(w)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:w,id:l,groupId:d,deliveryDirectives:u||null})}},D(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),C}(R.default);G.default=T},"./src/controller/base-playlist-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return D});var W=A("./src/polyfills/number.ts"),M=A("./src/types/level.ts"),R=A("./src/controller/level-helper.ts"),N=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),D=function(){function O(T,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=N.logger.log.bind(N.logger,_+":"),this.warn=N.logger.warn.bind(N.logger,_+":"),this.hls=T}var E=O.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(_,C){C.fatal&&C.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(_,C){var y=C==null?void 0:C.renditionReports;if(y)for(var g=0;g<y.length;g++){var u=y[g],o=""+u.URI;if(o===_.substr(-o.length)){var l=parseInt(u["LAST-MSN"]),d=parseInt(u["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var w=Math.min(C.age-C.partTarget,C.targetduration);d!==void 0&&w>C.partTarget&&(d+=1)}if(Object(W.isFiniteNumber)(l))return new M.HlsUrlParameters(l,Object(W.isFiniteNumber)(d)?d:void 0,M.HlsSkip.No)}}},E.loadPlaylist=function(_){},E.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},E.playlistLoaded=function(_,C,y){var g=this,u=C.details,o=C.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-l,u.live||y!=null&&y.live){if(u.reloaded(y),y&&this.log("live playlist "+_+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),y&&u.fragments.length>0&&Object(R.mergeDetails)(y,u),!this.canLoad||!u.live)return;var d,w=void 0,f=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var m=this.hls.config.lowLatencyMode,L=u.lastPartSn,x=u.endSN,h=u.lastPartIndex,c=h!==-1,s=L===x,a=m?0:h;c?(w=s?x+1:L,f=s?a:h+1):w=x+1;var v=u.age,p=v+u.ageHeader,b=Math.min(p-u.partTarget,u.targetduration*1.5);if(b>0){if(y&&b>y.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+y.tuneInGoal+" to: "+b+" with playlist age: "+u.age),b=0;else{var P=Math.floor(b/u.targetduration);if(w+=P,f!==void 0){var F=Math.round(b%u.targetduration/u.partTarget);f+=F}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+b+" skip sn "+P+" to part "+f)}u.tuneInGoal=b}if(d=this.getDeliveryDirectives(u,C.deliveryDirectives,w,f),m||!s){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(u,C.deliveryDirectives,w,f);var H=Object(R.computeReloadInterval)(u,o);w!==void 0&&u.canBlockReload&&(H-=u.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(H)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(d)},H)}else this.clearTimer()},E.getDeliveryDirectives=function(_,C,y,g){var u=Object(M.getSkipValue)(_,y);return C!=null&&C.skip&&_.deltaUpdateFailed&&(y=C.msn,g=C.part,u=M.HlsSkip.No),new M.HlsUrlParameters(y,g,u)},E.retryLoadingOrFail=function(_){var C=this,y=this.hls.config,g=this.retryCount<y.levelLoadingMaxRetry;if(g){var u;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(u=_.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*y.levelLoadingRetryDelay,y.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return g},O}()},"./src/controller/base-stream-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"State",function(){return x}),A.d(G,"default",function(){return h});var W=A("./src/polyfills/number.ts"),M=A("./src/task-loop.ts"),R=A("./src/controller/fragment-tracker.ts"),N=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/logger.ts"),D=A("./src/events.ts"),O=A("./src/errors.ts"),E=A("./src/types/transmuxer.ts"),T=A("./src/utils/mp4-tools.ts"),_=A("./src/utils/discontinuities.ts"),C=A("./src/controller/fragment-finders.ts"),y=A("./src/controller/level-helper.ts"),g=A("./src/loader/fragment-loader.ts"),u=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),l=A("./src/types/loader.ts");function d(c,s){for(var a=0;a<s.length;a++){var v=s[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function w(c,s,a){return s&&d(c.prototype,s),a&&d(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,s){c.prototype=Object.create(s.prototype),c.prototype.constructor=c,L(c,s)}function L(c,s){return L=Object.setPrototypeOf||function(v,p){return v.__proto__=p,v},L(c,s)}var x={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){m(s,c);function s(v,p,b){var P;return P=c.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=x.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=b,P.log=k.logger.log.bind(k.logger,b+":"),P.warn=k.logger.warn.bind(k.logger,b+":"),P.hls=v,P.fragmentLoader=new g.default(v.config),P.fragmentTracker=p,P.config=v.config,P.decrypter=new u.default(v,v.config),v.on(D.Events.KEY_LOADED,P.onKeyLoaded,f(P)),P}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},a._streamEnded=function(p,b){var P=this.fragCurrent,F=this.fragmentTracker;if(!b.live&&P&&P.sn===b.endSN&&!p.nextStart){var H=F.getState(P);return H===R.FragmentState.PARTIAL||H===R.FragmentState.OK}return!1},a.onMediaAttached=function(p,b){var P=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var p=this.config,b=this.fragCurrent,P=this.media,F=this.mediaBuffer,H=this.state,X=P?P.currentTime:0,B=N.BufferHelper.bufferInfo(F||P,X,p.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(X)?X.toFixed(3):X)+", state: "+H),H===x.ENDED)this.resetLoadingState();else if(b&&!B.len){var U=p.maxFragLookUpTolerance,z=b.start-U,Z=b.start+b.duration+U,ne=X>Z;(X<z||ne)&&(ne&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=X),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=X),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,b){if(this.state!==x.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var P=this.levels[b.frag.level].details;P&&this.loadFragment(b.frag,P,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(p,b){this.log("Loading key for "+p.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=x.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(D.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,b,P){this._loadFragForPlayback(p,b,P)},a._loadFragForPlayback=function(p,b,P){var F=this,H=function(B){if(F.fragContextChanged(p)){F.warn("Fragment "+p.sn+(B.part?" p: "+B.part.index:"")+" of level "+p.level+" was dropped during download."),F.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,F._handleFragmentLoadProgress(B)};this._doFragLoad(p,b,P,H).then(function(X){if(!X)return;F.fragLoadError=0;var B=F.state;if(F.fragContextChanged(p)){(B===x.FRAG_LOADING||B===x.BACKTRACKING||!F.fragCurrent&&B===x.PARSING)&&(F.fragmentTracker.removeFragment(p),F.state=x.IDLE);return}if("payload"in X&&(F.log("Loaded fragment "+p.sn+" of level "+p.level),F.hls.trigger(D.Events.FRAG_LOADED,X),F.state===x.BACKTRACKING)){F.fragmentTracker.backtrack(p,X),F.resetFragmentLoading(p);return}F._handleFragmentLoadComplete(X)}).catch(function(X){F.warn(X),F.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,b,P){if(P===void 0&&(P=null),!(p-b))return;var F={startOffset:p,endOffset:b,type:P};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(p){var b=this;this._doFragLoad(p).then(function(P){if(!P||b.fragContextChanged(p)||!b.levels)throw new Error("init load aborted");return P}).then(function(P){var F=b.hls,H=P.payload,X=p.decryptdata;if(H&&H.byteLength>0&&X&&X.key&&X.iv&&X.method==="AES-128"){var B=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(H),X.key.buffer,X.iv.buffer).then(function(U){var z=self.performance.now();return F.trigger(D.Events.FRAG_DECRYPTED,{frag:p,payload:U,stats:{tstart:B,tdecrypt:z}}),P.payload=U,P})}return P}).then(function(P){var F=b.fragCurrent,H=b.hls,X=b.levels;if(!X)throw new Error("init load aborted, missing levels");var B=X[p.level].details;console.assert(B,"Level details are defined when init segment is loaded");var U=p.stats;b.state=x.IDLE,b.fragLoadError=0,p.data=new Uint8Array(P.payload),U.parsing.start=U.buffering.start=self.performance.now(),U.parsing.end=U.buffering.end=self.performance.now(),P.frag===F&&H.trigger(D.Events.FRAG_BUFFERED,{stats:U,frag:F,part:null,id:p.type}),b.tick()}).catch(function(P){b.warn(P),b.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var b=this.fragCurrent;return!p||!b||p.level!==b.level||p.sn!==b.sn||p.urlId!==b.urlId},a.fragBufferedComplete=function(p,b){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(N.BufferHelper.getBuffered(P))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var b=this.transmuxer;if(!b)return;var P=p.frag,F=p.part,H=p.partsLoaded,X=!H||H.length===0||H.some(function(U){return!U}),B=new E.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,F?F.index:-1,!X);b.flush(B)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,b,P,F){var H=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(p.start,P||0),this.config.lowLatencyMode&&b){var X=b.partList;if(X&&F){P>p.end&&b.fragmentHint&&(p=b.fragmentHint);var B=this.getNextPart(X,p,P);if(B>-1){var U=X[B];return this.log("Loading part sn: "+p.sn+" p: "+U.index+" cc: "+p.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+B+"-"+(X.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=U.start+U.duration,this.state=x.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,part:X[B],targetBufferTime:P}),this.doFragPartsLoad(p,X,B,F).catch(function(z){return H.handleFragLoadError(z)})}else if(!p.url||this.loadedEndOfParts(X,P))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(P.toFixed(3))),Object(W.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=x.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,targetBufferTime:P}),this.fragmentLoader.load(p,F).catch(function(z){return H.handleFragLoadError(z)})},a.doFragPartsLoad=function(p,b,P,F){var H=this;return new Promise(function(X,B){var U=[],z=function Z(ne){var oe=b[ne];H.fragmentLoader.loadPart(p,oe,F).then(function(Ce){U[oe.index]=Ce;var he=Ce.part;H.hls.trigger(D.Events.FRAG_LOADED,Ce);var we=b[ne+1];if(we&&we.fragment===p)Z(ne+1);else return X({frag:p,part:he,partsLoaded:U})}).catch(B)};z(P)})},a.handleFragLoadError=function(p){var b=p.data;return b&&b.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(D.Events.ERROR,b),null},a._handleTransmuxerFlush=function(p){var b=this.getCurrentContext(p);if(!b||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var P=b.frag,F=b.part,H=b.level,X=self.performance.now();P.stats.parsing.end=X,F&&(F.stats.parsing.end=X),this.updateLevelTiming(P,F,H,p.partial)},a.getCurrentContext=function(p){var b=this.levels,P=p.level,F=p.sn,H=p.part;if(!b||!b[P])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+P+". The current chunk will not be buffered."),null;var X=b[P],B=H>-1?Object(y.getPartWith)(X,F,H):null,U=B?B.fragment:Object(y.getFragmentWithSN)(X,F,this.fragCurrent);return U?{frag:U,part:B,level:X}:null},a.bufferFragmentData=function(p,b,P,F){if(!p||this.state!==x.PARSING)return;var H=p.data1,X=p.data2,B=H;if(H&&X&&(B=Object(T.appendUint8Array)(H,X)),!B||!B.length)return;var U={type:p.type,frag:b,part:P,chunkMeta:F,parent:b.type,data:B};this.hls.trigger(D.Events.BUFFER_APPENDING,U),p.dropped&&p.independent&&!P&&this.flushBufferGap(b)},a.flushBufferGap=function(p){var b=this.media;if(!b)return;if(!N.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,p.start);return}var P=b.currentTime,F=N.BufferHelper.bufferInfo(b,P,0),H=p.duration,X=Math.min(this.config.maxFragLookUpTolerance*2,H*.25),B=Math.max(Math.min(p.start-X,F.end-X),P+X);p.start-B>X&&this.flushMainBuffer(B,p.start)},a.getFwdBufferInfo=function(p,b){var P=this.config,F=this.getLoadPosition();if(!Object(W.isFiniteNumber)(F))return null;var H=N.BufferHelper.bufferInfo(p,F,P.maxBufferHole);if(H.len===0&&H.nextStart!==void 0){var X=this.fragmentTracker.getBufferedFrag(F,b);if(X&&H.nextStart<X.end)return N.BufferHelper.bufferInfo(p,F,Math.max(H.nextStart,P.maxBufferHole))}return H},a.getMaxBufferLength=function(p){var b=this.config,P;return p?P=Math.max(8*b.maxBufferSize/p,b.maxBufferLength):P=b.maxBufferLength,Math.min(P,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var b=this.config,P=p||b.maxBufferLength;return b.maxMaxBufferLength>=P?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,b){var P,F,H=b.fragments,X=H.length;if(!X)return null;var B=this.config,U=H[0].start,z;if(b.live){var Z=B.initialLiveManifestSize;if(X<Z)return this.warn("Not enough fragments to start playback (have: "+X+", need: "+Z+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(z=this.getInitialLiveFragment(b,H),this.startPosition=z?this.hls.liveSyncPosition||z.start:p)}else p<=U&&(z=H[0]);if(!z){var ne=B.lowLatencyMode?b.partEnd:b.fragmentEnd;z=this.getFragmentAtPosition(p,ne,b)}return(P=z)!==null&&P!==void 0&&P.initSegment&&!((F=z)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(z=z.initSegment),z},a.getNextPart=function(p,b,P){for(var F=-1,H=!1,X=!0,B=0,U=p.length;B<U;B++){var z=p[B];if(X=X&&!z.independent,F>-1&&P<z.start)break;var Z=z.loaded;!Z&&(H||z.independent||X)&&z.fragment===b&&(F=B),H=Z}return F},a.loadedEndOfParts=function(p,b){var P=p[p.length-1];return P&&b>P.start&&P.loaded},a.getInitialLiveFragment=function(p,b){var P=this.fragPrevious,F=null;if(P){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),F=Object(C.findFragmentByPDT)(b,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var H=P.sn+1;if(H>=p.startSN&&H<=p.endSN){var X=b[H-p.startSN];P.cc===X.cc&&(F=X,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(b,P.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(F=this.getFragmentAtPosition(B,this.bitrateTest?p.fragmentEnd:p.edge,p))}return F},a.getFragmentAtPosition=function(p,b,P){var F=this.config,H=this.fragPrevious,X=P.fragments,B=P.endSN,U=P.fragmentHint,z=F.maxFragLookUpTolerance,Z=!!(F.lowLatencyMode&&P.partList&&U);Z&&U&&!this.bitrateTest&&(X=X.concat(U),B=U.sn);var ne;if(p<b){var oe=p>b-z?0:z;ne=Object(C.findFragmentByPTS)(H,X,p,oe)}else ne=X[X.length-1];if(ne){var Ce=ne.sn-P.startSN,he=H&&ne.level===H.level,we=X[Ce+1],ve=this.fragmentTracker.getState(ne);if(ve===R.FragmentState.BACKTRACKED){ne=null;for(var pe=Ce;X[pe]&&this.fragmentTracker.getState(X[pe])===R.FragmentState.BACKTRACKED;)H?ne=X[pe--]:ne=X[--pe];ne||(ne=we)}else H&&ne.sn===H.sn&&!Z&&(he&&(ne.sn<B&&this.fragmentTracker.getState(we)!==R.FragmentState.OK?(this.log("SN "+ne.sn+" just loaded, load next one: "+we.sn),ne=we):ne=null))}return ne},a.synchronizeToLiveEdge=function(p){var b=this.config,P=this.media;if(!P)return;var F=this.hls.liveSyncPosition,H=P.currentTime,X=p.fragments[0].start,B=p.edge,U=H>=X-b.maxFragLookUpTolerance&&H<=B;if(F!==null&&P.duration>F&&(H<F||!U)){var z=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*p.targetduration;(!U&&P.readyState<4||H<B-z)&&(this.loadedmetadata||(this.nextLoadPosition=F),P.readyState&&(this.warn("Playback: "+H.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+F.toFixed(3)),P.currentTime=F))}},a.alignPlaylists=function(p,b){var P=this.levels,F=this.levelLastLoaded,H=this.fragPrevious,X=F!==null?P[F]:null,B=p.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var U=p.fragments[0].start,z=!b,Z=p.alignedSliding&&Object(W.isFiniteNumber)(U);if(z||!Z&&!U){Object(_.alignStream)(H,X,p);var ne=p.fragments[0].start;return this.log("Live playlist sliding: "+ne.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+p.startSN+" prev-sn: "+(H?H.sn:"na")+" fragments: "+B),ne}return U},a.waitForCdnTuneIn=function(p){var b=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*b)},a.setStartPosition=function(p,b){var P=this.startPosition;if(P<b&&(P=-1),P===-1||this.lastCurrentTime===-1){var F=p.startTimeOffset;Object(W.isFiniteNumber)(F)?(P=b+F,F<0&&(P+=p.totalduration),P=Math.min(Math.max(b,P),b+p.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+P),this.startPosition=P):p.live?P=this.hls.liveSyncPosition||b:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},a.getLoadPosition=function(){var p=this.media,b=0;return this.loadedmetadata&&p?b=p.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(p,b){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(b?" part"+b.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=x.IDLE)},a.onFragmentOrKeyLoadError=function(p,b){if(b.fatal)return;var P=b.frag;if(!P||P.type!==p)return;var F=this.fragCurrent;console.assert(F&&P.sn===F.sn&&P.level===F.level&&P.urlId===F.urlId,"Frag load error must match current frag to retry");var H=this.config;if(this.fragLoadError+1<=H.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var X=Math.min(Math.pow(2,this.fragLoadError)*H.fragLoadingRetryDelay,H.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+p+" "+P.level+" failed to load, retrying in "+X+"ms"),this.retryDate=self.performance.now()+X,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(p===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(k.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},a.afterBufferFlushed=function(p,b,P){if(!p)return;var F=N.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(b,F,P),this.state===x.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[p].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,b,P,F){var H=this,X=P.details;console.assert(!!X,"level.details must be defined");var B=Object.keys(p.elementaryStreams).reduce(function(U,z){var Z=p.elementaryStreams[z];if(Z){var ne=Z.endPTS-Z.startPTS;if(ne<=0)return H.warn("Could not parse fragment "+p.sn+" "+z+" duration reliably ("+ne+") resetting transmuxer to fallback to playlist timing"),H.resetTransmuxer(),U||!1;var oe=F?0:Object(y.updateFragPTSDTS)(X,p,Z.startPTS,Z.endPTS,Z.startDTS,Z.endDTS);return H.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:X,level:P,drift:oe,type:z,frag:p,start:Z.startPTS,end:Z.endPTS}),!0}return U},!1);B?(this.state=x.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:p,part:b})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(s,[{key:"state",get:function(){return this._state},set:function(p){var b=this._state;b!==p&&(this._state=p,this.log(b+"->"+p))}}]),s}(M.default)},"./src/controller/buffer-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return C});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),R=A("./src/utils/logger.ts"),N=A("./src/errors.ts"),k=A("./src/utils/buffer-helper.ts"),D=A("./src/utils/mediasource-helper.ts"),O=A("./src/loader/fragment.ts"),E=A("./src/controller/buffer-operation-queue.ts"),T=Object(D.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function y(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,d=o.media,w=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),l.trigger(M.Events.MEDIA_ATTACHED,{media:d})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var g=y.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var o=this.hls;o.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(M.Events.BUFFER_RESET,this.onBufferReset,this),o.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(M.Events.BUFFER_EOS,this.onBufferEos,this),o.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(M.Events.FRAG_PARSED,this.onFragParsed,this),o.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(M.Events.BUFFER_RESET,this.onBufferReset,this),o.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(M.Events.BUFFER_EOS,this.onBufferEos,this),o.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(M.Events.FRAG_PARSED,this.onFragParsed,this),o.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(o,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(o,l){var d=this.media=l.media;if(d&&T){var w=this.mediaSource=new T;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(w),this._objectUrl=d.src}},g.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(R.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(M.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var d=o.sourceBuffer[l];try{d&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[l]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",w)}}),this._initSourceBuffer()},g.onBufferCodecs=function(o,l){var d=this,w=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(f){if(w){var m=d.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var L=l[f],x=L.codec,h=L.levelCodec,c=L.container,s=(m.levelCodec||m.codec).replace(_,"$1"),a=(h||x).replace(_,"$1");if(s!==a){var v=c+";codecs="+(h||x);d.appendChangeType(f,v)}}}else d.pendingTracks[f]=l[f]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(o,l){var d=this,w=this.operationQueue,f={execute:function(){var L=d.sourceBuffer[o];L&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};w.append(f,o)},g.onBufferAppending=function(o,l){var d=this,w=this.hls,f=this.operationQueue,m=this.tracks,L=l.data,x=l.type,h=l.frag,c=l.part,s=l.chunkMeta,a=s.buffering[x],v=self.performance.now();a.start=v;var p=h.stats.buffering,b=c?c.stats.buffering:null;p.start===0&&(p.start=v),b&&b.start===0&&(b.start=v);var P=m.audio,F=x==="audio"&&s.id===1&&(P==null?void 0:P.container)==="audio/mpeg",H={execute:function(){if(a.executeStart=self.performance.now(),F){var B=d.sourceBuffer[x];if(B){var U=h.start-B.timestampOffset;Math.abs(U)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+U+") sn: "+h.sn+")"),B.timestampOffset=h.start)}}d.appendExecutor(L,x)},onStart:function(){},onComplete:function(){var B=self.performance.now();a.executeEnd=a.end=B,p.first===0&&(p.first=B),b&&b.first===0&&(b.first=B);var U=d.sourceBuffer,z={};for(var Z in U)z[Z]=k.BufferHelper.getBuffered(U[Z]);d.appendError=0,d.hls.trigger(M.Events.BUFFER_APPENDED,{type:x,frag:h,part:c,chunkMeta:s,parent:h.type,timeRanges:z})},onError:function(B){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",B);var U={type:N.ErrorTypes.MEDIA_ERROR,parent:h.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?U.details=N.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,U.details=N.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),U.fatal=!0)),w.trigger(M.Events.ERROR,U)}};f.append(H,x)},g.onBufferFlushing=function(o,l){var d=this,w=this.operationQueue,f=function(L){return{execute:d.removeExecutor.bind(d,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(M.Events.BUFFER_FLUSHED,{type:L})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",h)}}};l.type?w.append(f(l.type),l.type):this.getSourceBufferTypes().forEach(function(m){w.append(f(m),m)})},g.onFragParsed=function(o,l){var d=this,w=l.frag,f=l.part,m=[],L=f?f.elementaryStreams:w.elementaryStreams;L[O.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(L[O.ElementaryStreamTypes.AUDIO]&&m.push("audio"),L[O.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var c=self.performance.now();w.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var s=f?f.stats:w.stats;d.hls.trigger(M.Events.FRAG_BUFFERED,{frag:w,part:f,stats:s,id:w.type})};m.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(x,m)},g.onFragChanged=function(o,l){this.flushBackBuffer()},g.onBufferEos=function(o,l){var d=this,w=this.getSourceBufferTypes().reduce(function(f,m){var L=d.sourceBuffer[m];return(!l.type||l.type===m)&&(L&&!L.ended&&(L.ended=!0,R.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),f&&!!(!L||L.ended)},!0);w&&this.blockBuffers(function(){var f=d.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},g.onLevelUpdated=function(o,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var o=this.hls,l=this.details,d=this.media,w=this.sourceBuffer;if(!d||l===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var m=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(W.isFiniteNumber)(m)||m<0)return;var L=d.currentTime,x=l.levelTargetDuration,h=Math.max(m,x),c=Math.floor(L/x)*x-h;f.forEach(function(s){var a=w[s];if(a){var v=k.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:s}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,d=this.media,w=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=d.duration,L=Object(W.isFiniteNumber)(w.duration)?w.duration:0;o.live&&l.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(f>L&&f>m||!Object(W.isFiniteNumber)(m))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),w.duration=f)},g.updateSeekableRange=function(o){var l=this.mediaSource,d=o.fragments,w=d.length;if(w&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var f=Math.max(0,d[0].start),m=Math.max(f,f+o.totalduration);l.setLiveSeekableRange(f,m)}},g.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,w=Object.keys(d).length;if(w&&!o||w===2){this.createSourceBuffers(d),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(m){l.executeNext(m)})}},g.createSourceBuffers=function(o){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var f in o)if(!l[f]){var m=o[f];if(!m)throw Error("source buffer exists for track "+f+", however track does not");var L=m.levelCodec||m.codec,x=m.container+";codecs="+L;R.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var h=l[f]=d.addSourceBuffer(x),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:L,container:m.container,levelCodec:m.levelCodec,id:m.id},w++}catch(s){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:x})}}w&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(o){var l=this.operationQueue,d=l.current(o);d.onStart()},g._onSBUpdateEnd=function(o){var l=this.operationQueue,d=l.current(o);d.onComplete(),l.shiftAndExecuteNext(o)},g._onSBUpdateError=function(o,l){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(M.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(l)},g.removeExecutor=function(o,l,d){var w=this.media,f=this.mediaSource,m=this.operationQueue,L=this.sourceBuffer,x=L[o];if(!w||!f||!x){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(W.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(W.isFiniteNumber)(f.duration)?f.duration:Infinity,s=Math.max(0,l),a=Math.min(d,h,c);a>s?(R.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(s,a)):m.shiftAndExecuteNext(o)},g.appendExecutor=function(o,l){var d=this.operationQueue,w=this.sourceBuffer,f=w[l];if(!f){R.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}f.ended=!1,console.assert(!f.updating,l+" sourceBuffer must not be updating"),f.appendBuffer(o)},g.blockBuffers=function(o,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,f=l.map(function(m){return w.appendBlocker(m)});Promise.all(f).then(function(){o(),l.forEach(function(m){var L=d.sourceBuffer[m];(!L||!L.updating)&&w.shiftAndExecuteNext(m)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(o,l,d){var w=this.sourceBuffer[o];if(!w)return;var f=d.bind(this,o);this.listeners[o].push({event:l,listener:f}),w.addEventListener(l,f)},g.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(d){l.removeEventListener(d.event,d.listener)})},y}()},"./src/controller/buffer-operation-queue.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return M});var W=A("./src/utils/logger.ts"),M=function(){function R(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var N=R.prototype;return N.append=function(D,O){var E=this.queues[O];E.push(D),E.length===1&&this.buffers[O]&&this.executeNext(O)},N.insertAbort=function(D,O){var E=this.queues[O];E.unshift(D),this.executeNext(O)},N.appendBlocker=function(D){var O,E=new Promise(function(_){O=_}),T={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,D),E},N.executeNext=function(D){var O=this.buffers,E=this.queues,T=O[D],_=E[D];if(_.length){var C=_[0];try{C.execute()}catch(y){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(y),(!T||!T.updating)&&(_.shift(),this.executeNext(D))}}},N.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},N.current=function(D){return this.queues[D][0]},R}()},"./src/controller/cap-level-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/events.ts");function M(k,D){for(var O=0;O<D.length;O++){var E=D[O];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(k,E.key,E)}}function R(k,D,O){return D&&M(k.prototype,D),O&&M(k,O),k}var N=function(){function k(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=k.prototype;return D.setStreamController=function(E){this.streamController=E},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var E=this.hls;E.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var E=this.hls;E.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(E,T){k.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},D.onMediaAttaching=function(E,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},D.onManifestParsed=function(E,T){var _=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,_.config.capLevelToPlayerSize&&T.video&&this.startCapping()},D.onBufferCodecs=function(E,T){var _=this.hls;_.config.capLevelToPlayerSize&&T.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(E.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},D.getMaxLevel=function(E){var T=this,_=this.hls.levels;if(!_.length)return-1;var C=_.filter(function(y,g){return k.isLevelAllowed(g,T.restrictedLevels)&&g<=E});return this.clientRect=null,k.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},D.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,T={width:0,height:0};if(E){var _=E.getBoundingClientRect();T.width=_.width,T.height=_.height,!T.width&&!T.height&&(T.width=_.right-_.left||E.width||0,T.height=_.bottom-_.top||E.height||0)}return this.clientRect=T,T},k.isLevelAllowed=function(E,T){return T===void 0&&(T=[]),T.indexOf(E)===-1},k.getMaxLevelByMediaSize=function(E,T,_){if(!E||!E.length)return-1;for(var C=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},y=E.length-1,g=0;g<E.length;g+=1){var u=E[g];if((u.width>=T||u.height>=_)&&C(u,E[g+1])){y=g;break}}return y},R(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 E=1;try{E=self.devicePixelRatio}catch(T){}return E}}]),k}();G.default=N},"./src/controller/cmcd-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return C});var W=A("./src/events.ts"),M=A("./src/types/cmcd.ts"),R=A("./src/utils/buffer-helper.ts"),N=A("./src/utils/logger.ts");function k(y,g){for(var u=0;u<g.length;u++){var o=g[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(y,o.key,o)}}function D(y,g,u){return g&&k(y.prototype,g),u&&k(y,u),y}function O(y,g){var u=typeof Symbol!="undefined"&&y[Symbol.iterator]||y["@@iterator"];if(u)return(u=u.call(y)).next.bind(u);if(Array.isArray(y)||(u=E(y))||g&&y&&typeof y.length=="number"){u&&(y=u);var o=0;return function(){return o>=y.length?{done:!0}:{done:!1,value:y[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(y,g){if(!y)return;if(typeof y=="string")return T(y,g);var u=Object.prototype.toString.call(y).slice(8,-1);if(u==="Object"&&y.constructor&&(u=y.constructor.name),u==="Map"||u==="Set")return Array.from(y);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return T(y,g)}function T(y,g){(g==null||g>y.length)&&(g=y.length);for(var u=0,o=new Array(g);u<g;u++)o[u]=y[u];return o}function _(){return _=Object.assign||function(y){for(var g=1;g<arguments.length;g++){var u=arguments[g];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(y[o]=u[o])}return y},_.apply(this,arguments)}var C=function(){function y(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:M.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){N.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(w){try{var f=w.frag,m=o.hls.levels[f.level],L=o.getObjectType(f),x={d:f.duration*1e3,ot:L};(L===M.CMCDObjectType.VIDEO||L===M.CMCDObjectType.AUDIO||L==M.CMCDObjectType.MUXED)&&(x.br=m.bitrate/1e3,x.tb=o.getTopBandwidth(L),x.bl=o.getBufferLength(L)),o.apply(w,x)}catch(h){N.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=u;var l=this.config=u.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||y.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var g=y.prototype;return g.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(o,l){var d,w;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(w=l.tracks.video)===null||w===void 0?void 0:w.buffer},g.createData=function(){var o;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(o,l){l===void 0&&(l={}),_(l,this.createData());var d=l.ot===M.CMCDObjectType.INIT||l.ot===M.CMCDObjectType.VIDEO||l.ot===M.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var w=y.toHeaders(l);if(!Object.keys(w).length)return;o.headers||(o.headers={}),_(o.headers,w)}else{var f=y.toQuery(l);if(!f)return;o.url=y.appendQueryToUri(o.url,f)}},g.getObjectType=function(o){var l=o.type;return l==="subtitle"?M.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?M.CMCDObjectType.INIT:l==="audio"?M.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(o){for(var l=0,d=o===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=O(d),f;!(f=w()).done;){var m=f.value;m.bitrate>l&&(l=m.bitrate)}return l>0?l:NaN},g.getBufferLength=function(o){var l=this.hls.media,d=o===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var w=R.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return w.len*1e3},g.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,d=o||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new d(m)}var f=w.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(L,x,h){l(L),this.loader.load(L,x,h)},D(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},g.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,d=o||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new d(m)}var f=w.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(L,x,h){l(L),this.loader.load(L,x,h)},D(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},y.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},y.serialize=function(o){for(var l=[],d=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},f=function(F){return w(F/100)*100},m=function(F){return encodeURIComponent(F)},L={br:w,d:w,bl:f,dl:f,mtp:f,nor:m,rtp:f,tb:w},x=Object.keys(o||{}).sort(),h=O(x),c;!(c=h()).done;){var s=c.value,a=o[s];if(!d(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var v=L[s];v&&(a=v(a));var p=typeof a,b=void 0;s==="ot"||s==="sf"||s==="st"?b=s+"="+a:p==="boolean"?b=s:p==="number"?b=s+"="+a:b=s+"="+JSON.stringify(a),l.push(b)}return l.join(",")},y.toHeaders=function(o){for(var l=Object.keys(o),d={},w=["Object","Request","Session","Status"],f=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,x=l;L<x.length;L++){var h=x[L],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var s=0;s<f.length;s++){var a=y.serialize(f[s]);a&&(d["CMCD-"+w[s]]=a)}return d},y.toQuery=function(o){return"CMCD="+encodeURIComponent(y.serialize(o))},y.appendQueryToUri=function(o,l){if(!l)return o;var d=o.includes("?")?"&":"?";return""+o+d+l},y}()},"./src/controller/eme-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/events.ts"),M=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),N=A("./src/utils/mediakeys-helper.ts");function k(C,y){for(var g=0;g<y.length;g++){var u=y[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function D(C,y,g){return y&&k(C.prototype,y),g&&k(C,g),C}var O=3,E=function(y,g,u){var o={audioCapabilities:[],videoCapabilities:[]};return y.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:u.audioRobustness||""})}),g.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:u.videoRobustness||""})}),[o]},T=function(y,g,u,o){switch(y){case N.KeySystems.WIDEVINE:return E(g,u,o);default:throw new Error("Unknown key-system: "+y)}},_=function(){function C(g){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=g,this._config=g.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var y=C.prototype;return y.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},y._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)},y._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)},y.getLicenseServerUrl=function(u){switch(u){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},y._attemptKeySystemAccess=function(u,o,l){var d=this,w=T(u,o,l,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(u,w);this.mediaKeysPromise=f.then(function(m){return d._onMediaKeySystemAccessObtained(u,m)}),f.catch(function(m){R.logger.error('Failed to obtain key-system "'+u+'" access:',m)})},y._onMediaKeySystemAccessObtained=function(u,o){var l=this;R.logger.log('Access for key-system "'+u+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(d);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return d.mediaKeys=f,R.logger.log('Media-keys created for key-system "'+u+'"'),l._onMediaKeysCreated(),f});return w.catch(function(f){R.logger.error("Failed to create media-keys:",f)}),w},y._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},y._onNewMediaKeySession=function(u){var o=this;R.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(l){o._onKeySessionMessage(u,l.message)},!1)},y._onKeySessionMessage=function(u,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){R.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),u.update(l)})},y.onMediaEncrypted=function(u){var o=this;if(R.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(l).catch(l)},y._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},y._generateRequestWithPreferredKeySession=function(u,o){var l=this,d=this._mediaKeysList[0];if(!d){R.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(d.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var w=d.mediaKeysSession;if(!w){R.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(!o){R.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}R.logger.log('Generating key-session request for "'+u+'" init data type'),d.mediaKeysSessionInitialized=!0,w.generateRequest(u,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(f){R.logger.error("Error generating key-session request:",f),l.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},y._createLicenseXhr=function(u,o,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,u,o,l);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,d,u),w=void 0}catch(f){R.logger.error(f)}try{d.readyState||d.open("POST",u,!0),w&&w.call(this.hls,d,u)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return d},y._onLicenseRequestReadyStageChange=function(u,o,l,d){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var w=u.response,f=this._licenseResponseCallback;if(f)try{w=f.call(this.hls,u,o)}catch(L){R.logger.error(L)}d(w)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=O-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(l,d)}break}},y._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},y._requestLicense=function(u,o){R.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){R.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 d=this.getLicenseServerUrl(l.mediaKeySystemDomain),w=this._createLicenseXhr(d,u,o);R.logger.log("Sending license request to URL: "+d);var f=this._generateLicenseRequestChallenge(l,u);w.send(f)}catch(m){R.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},y.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},y.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},y.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var l=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),d=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,l,d)},D(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();G.default=_},"./src/controller/fps-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),R=function(){function N(D){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=D,this.registerListeners()}var k=N.prototype;return k.setStreamController=function(O){this.streamController=O},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(O,E){var T=this.hls.config;if(T.capLevelOnFPSDrop){var _=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(O,E,T){var _=performance.now();if(E){if(this.lastTime){var C=_-this.lastTime,y=T-this.lastDroppedFrames,g=E-this.lastDecodedFrames,u=1e3*y/C,o=this.hls;if(o.trigger(W.Events.FPS_DROP,{currentDropped:y,currentDecoded:g,totalDroppedFrames:T}),u>0&&y>o.config.fpsDroppedMonitoringThreshold*g){var l=o.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(W.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=T,this.lastDecodedFrames=E}},k.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var E=O.getVideoPlaybackQuality();this.checkFPS(O,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},N}();G.default=R},"./src/controller/fragment-finders.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"findFragmentByPDT",function(){return R}),A.d(G,"findFragmentByPTS",function(){return N}),A.d(G,"fragmentWithinToleranceTest",function(){return k}),A.d(G,"pdtWithinToleranceTest",function(){return D}),A.d(G,"findFragWithCC",function(){return O});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/binary-search.ts");function R(E,T,_){if(T===null||!Array.isArray(E)||!E.length||!Object(W.isFiniteNumber)(T))return null;var C=E[0].programDateTime;if(T<(C||0))return null;var y=E[E.length-1].endProgramDateTime;if(T>=(y||0))return null;_=_||0;for(var g=0;g<E.length;++g){var u=E[g];if(D(T,_,u))return u}return null}function N(E,T,_,C){_===void 0&&(_=0),C===void 0&&(C=0);var y=null;if(E?y=T[E.sn-T[0].sn+1]||null:_===0&&T[0].start===0&&(y=T[0]),y&&k(_,C,y)===0)return y;var g=M.default.search(T,k.bind(null,_,C));return g||y}function k(E,T,_){E===void 0&&(E=0),T===void 0&&(T=0);var C=Math.min(T,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-C<=E?1:_.start-C>E&&_.start?-1:0}function D(E,T,_){var C=Math.min(T,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,y=_.endProgramDateTime||0;return y-C>E}function O(E,T){return M.default.search(E,function(_){return _.cc<T?1:_.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"FragmentState",function(){return R}),A.d(G,"FragmentTracker",function(){return N});var W=A("./src/events.ts"),M=A("./src/types/loader.ts"),R;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(R||(R={}));var N=function(){function O(T){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=T,this._registerListeners()}var E=O.prototype;return E._registerListeners=function(){var _=this.hls;_.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var _=this.hls;_.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(_,C){if(C===M.PlaylistLevelType.MAIN){var y=this.activeFragment,g=this.activeParts;if(!y)return null;if(g)for(var u=g.length;u--;){var o=g[u],l=o?o.end:y.appendedPTS;if(o.start<=_&&l!==void 0&&_<=l)return u>9&&(this.activeParts=g.slice(u-9)),o}else if(y.start<=_&&y.appendedPTS!==void 0&&_<=y.appendedPTS)return y}return this.getBufferedFrag(_,C)},E.getBufferedFrag=function(_,C){for(var y=this.fragments,g=Object.keys(y),u=g.length;u--;){var o=y[g[u]];if((o==null?void 0:o.body.type)===C&&o.buffered){var l=o.body;if(l.start<=_&&_<=l.end)return l}}return null},E.detectEvictedFragments=function(_,C,y){var g=this;Object.keys(this.fragments).forEach(function(u){var o=g.fragments[u];if(!o)return;if(!o.buffered){o.body.type===y&&g.removeFragment(o.body);return}var l=o.range[_];if(!l)return;l.time.some(function(d){var w=!g.isTimeBuffered(d.startPTS,d.endPTS,C);return w&&g.removeFragment(o.body),w})})},E.detectPartialFragments=function(_){var C=this,y=this.timeRanges,g=_.frag,u=_.part;if(!y||g.sn==="initSegment")return;var o=D(g),l=this.fragments[o];if(!l)return;Object.keys(y).forEach(function(d){var w=g.elementaryStreams[d];if(!w)return;var f=y[d],m=u!==null||w.partial===!0;l.range[d]=C.getBufferedTimes(g,u,m,f)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},E.fragBuffered=function(_){var C=D(_),y=this.fragments[C];y&&(y.backtrack=y.loaded=null,y.buffered=!0)},E.getBufferedTimes=function(_,C,y,g){for(var u={time:[],partial:y},o=C?C.start:_.start,l=C?C.end:_.end,d=_.minEndPTS||l,w=_.maxStartPTS||o,f=0;f<g.length;f++){var m=g.start(f)-this.bufferPadding,L=g.end(f)+this.bufferPadding;if(w>=m&&d<=L){u.time.push({startPTS:Math.max(o,g.start(f)),endPTS:Math.min(l,g.end(f))});break}else if(o<L&&l>m)u.partial=!0,u.time.push({startPTS:Math.max(o,g.start(f)),endPTS:Math.min(l,g.end(f))});else if(l<=m)break}return u},E.getPartialFragment=function(_){var C=null,y,g,u,o=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(w){var f=d[w];if(!f)return;k(f)&&(g=f.body.start-l,u=f.body.end+l,_>=g&&_<=u&&(y=Math.min(_-g,u-_),o<=y&&(C=f.body,o=y)))}),C},E.getState=function(_){var C=D(_),y=this.fragments[C];return y?y.buffered?k(y)?R.PARTIAL:R.OK:y.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},E.backtrack=function(_,C){var y=D(_),g=this.fragments[y];if(!g||g.backtrack)return null;var u=g.backtrack=C||g.loaded;return g.loaded=null,u},E.getBacktrackData=function(_){var C=D(_),y=this.fragments[C];if(y){var g,u=y.backtrack;if(u!=null&&(g=u.payload)!==null&&g!==void 0&&g.byteLength)return u;this.removeFragment(_)}return null},E.isTimeBuffered=function(_,C,y){for(var g,u,o=0;o<y.length;o++){if(g=y.start(o)-this.bufferPadding,u=y.end(o)+this.bufferPadding,_>=g&&C<=u)return!0;if(C<=g)return!1}return!1},E.onFragLoaded=function(_,C){var y=C.frag,g=C.part;if(y.sn==="initSegment"||y.bitrateTest||g)return;var u=D(y);this.fragments[u]={body:y,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(_,C){var y=this,g=C.frag,u=C.part,o=C.timeRanges;if(g.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=g,u){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var w=o[d];if(y.detectEvictedFragments(d,w),!u)for(var f=0;f<w.length;f++)g.appendedPTS=Math.max(w.end(f),g.appendedPTS||0)})},E.onFragBuffered=function(_,C){this.detectPartialFragments(C)},E.hasFragment=function(_){var C=D(_);return!!this.fragments[C]},E.removeFragmentsInRange=function(_,C,y){var g=this;Object.keys(this.fragments).forEach(function(u){var o=g.fragments[u];if(!o)return;if(o.buffered){var l=o.body;l.type===y&&l.start<C&&l.end>_&&g.removeFragment(l)}})},E.removeFragment=function(_){var C=D(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[C]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function k(O){var E,T;return O.buffered&&(((E=O.range.video)===null||E===void 0?void 0:E.partial)||((T=O.range.audio)===null||T===void 0?void 0:T.partial))}function D(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"STALL_MINIMUM_DURATION_MS",function(){return k}),A.d(G,"MAX_START_GAP_JUMP",function(){return D}),A.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),A.d(G,"SKIP_BUFFER_RANGE_START",function(){return E}),A.d(G,"default",function(){return T});var W=A("./src/utils/buffer-helper.ts"),M=A("./src/errors.ts"),R=A("./src/events.ts"),N=A("./src/utils/logger.ts"),k=250,D=2,O=.1,E=.05,T=function(){function _(y,g,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=y,this.media=g,this.fragmentTracker=u,this.hls=o}var C=_.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(g){var u=this.config,o=this.media,l=this.stalled,d=o.currentTime,w=o.seeking,f=this.seeking&&!w,m=!this.seeking&&w;if(this.seeking=w,d!==g){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;N.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!W.BufferHelper.getBuffered(o).length)return;var x=W.BufferHelper.bufferInfo(o,d,0),h=x.len>0,c=x.nextStart||0;if(!h&&!c)return;if(w){var s=x.len>D,a=!c||c-d>D&&!this.fragmentTracker.getPartialFragment(d);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,p=Math.max(c,x.start||0)-d,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=b==null||((v=b.details)===null||v===void 0)?void 0:v.live,F=P?b.details.targetduration*2:D;if(p>0&&p<=F){this._trySkipBufferHole(null);return}}var H=self.performance.now();if(l===null){this.stalled=H;return}var X=H-l;!w&&X>=k&&this._reportStall(x.len);var B=W.BufferHelper.bufferInfo(o,d,u.maxBufferHole);this._tryFixBufferStall(B,X)},C._tryFixBufferStall=function(g,u){var o=this.config,l=this.fragmentTracker,d=this.media,w=d.currentTime,f=l.getPartialFragment(w);if(f){var m=this._trySkipBufferHole(f);if(m)return}g.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(g){var u=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+g+")"),u.trigger(R.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},C._trySkipBufferHole=function(g){for(var u=this.config,o=this.hls,l=this.media,d=l.currentTime,w=0,f=W.BufferHelper.getBuffered(l),m=0;m<f.length;m++){var L=f.start(m);if(d+u.maxBufferHole>=w&&d<L){var x=Math.max(L+E,l.currentTime+O);return N.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,g&&o.trigger(R.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+x,frag:g}),x}w=f.end(m)}return 0},C._tryNudgeBuffer=function(){var g=this.config,u=this.hls,o=this.media,l=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<g.nudgeMaxRetry){var w=l+d*g.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+l+" to "+w),o.currentTime=w,u.trigger(R.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+g.nudgeMaxRetry+" nudges"),u.trigger(R.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),R=A("./src/demux/id3.ts"),N=.25,k=function(){function D(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var O=D.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var T=this.hls;T.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var T=this.hls;T.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(T,_){this.media=_.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(T){if(!this.media)return;for(var _=0;_<T.length;_++){var C=T[_];if(C.kind==="metadata"&&C.label==="id3")return Object(M.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(T,_){if(!this.media)return;var C=_.frag,y=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<y.length;u++){var o=R.getID3Frames(y[u].data);if(o){var l=y[u].pts,d=u<y.length-1?y[u+1].pts:C.end,w=d-l;w<=0&&(d=l+N);for(var f=0;f<o.length;f++){var m=o[f];if(!R.isTimeStampFrame(m)){var L=new g(l,d,"");L.value=m,this.id3Track.addCue(L)}}}}},O.onBufferFlushing=function(T,_){var C=_.startOffset,y=_.endOffset,g=_.type;if(!g||g==="audio"){var u=this.id3Track;u&&Object(M.removeCuesInRange)(u,C,y)}},D}();G.default=k},"./src/controller/latency-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return D});var W=A("./src/errors.ts"),M=A("./src/events.ts"),R=A("./src/utils/logger.ts");function N(O,E){for(var T=0;T<E.length;T++){var _=E[T];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(O,_.key,_)}}function k(O,E,T){return E&&N(O.prototype,E),T&&N(O,T),O}var D=function(){function O(T){var _=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 _.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var E=O.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.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)},E.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)},E.onMediaAttached=function(_,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(_,C){var y=C.details;this.levelDetails=y,y.advanced&&this.timeupdate(),!y.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(_,C){if(C.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var _=this.media,C=this.levelDetails;if(!_||!C)return;this.currentTime=_.currentTime;var y=this.computeLatency();if(y===null)return;this._latency=y;var g=this.config,u=g.lowLatencyMode,o=g.maxLiveSyncPlaybackRate;if(!u||o===1)return;var l=this.targetLatency;if(l===null)return;var d=y-l,w=Math.min(this.maxLatency,l+C.targetduration),f=d<w;if(C.live&&f&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;_.playbackRate=Math.min(m,Math.max(1,L))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},E.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},E.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},k(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,C=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:C?_.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var C=_.holdBack,y=_.partHoldBack,g=_.targetduration,u=this.config,o=u.liveSyncDuration,l=u.liveSyncDurationCount,d=u.lowLatencyMode,w=this.hls.userConfig,f=d&&y||C;(w.liveSyncDuration||w.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:l*g);var m=g,L=1;return f+Math.min(this.stallCount*L,m)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),C=this.targetLatency,y=this.levelDetails;if(_===null||C===null||y===null)return null;var g=y.edge,u=_-C-this.edgeStalled,o=g-y.totalduration,l=g-(this.config.lowLatencyMode&&y.partTarget||y.targetduration);return Math.min(Math.max(o,u),l)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var C=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-C,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,C=this.levelDetails;if(!_||!C)return 0;var y=_.buffered.length;return y?_.buffered.end(y-1):C.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return u});var W=A("./src/types/level.ts"),M=A("./src/events.ts"),R=A("./src/errors.ts"),N=A("./src/utils/codecs.ts"),k=A("./src/controller/level-helper.ts"),D=A("./src/controller/base-playlist-controller.ts"),O=A("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var w in d)Object.prototype.hasOwnProperty.call(d,w)&&(o[w]=d[w])}return o},E.apply(this,arguments)}function T(o,l){for(var d=0;d<l.length;d++){var w=l[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function _(o,l,d){return l&&T(o.prototype,l),d&&T(o,d),o}function C(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(w,f){return w.__proto__=f,w},y(o,l)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){C(l,o);function l(w){var f;return f=o.call(this,w,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var d=l.prototype;return d._registerListeners=function(){var f=this.hls;f.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(M.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var f=this.hls;f.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(M.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(f,m){var L=[],x=[],h=[],c,s={},a,v=!1,p=!1,b=!1;if(m.levels.forEach(function(X){var B=X.attrs;v=v||!!(X.width&&X.height),p=p||!!X.videoCodec,b=b||!!X.audioCodec,g&&X.audioCodec&&X.audioCodec.indexOf("mp4a.40.34")!==-1&&(X.audioCodec=void 0);var U=X.bitrate+"-"+X.attrs.RESOLUTION+"-"+X.attrs.CODECS;a=s[U],a?a.url.push(X.url):(a=new W.Level(X),s[U]=a,L.push(a)),B&&(B.AUDIO&&Object(k.addGroupId)(a,"audio",B.AUDIO),B.SUBTITLES&&Object(k.addGroupId)(a,"text",B.SUBTITLES))}),(v||p)&&b&&(L=L.filter(function(X){var B=X.videoCodec,U=X.width,z=X.height;return!!B||!!(U&&z)})),L=L.filter(function(X){var B=X.audioCodec,U=X.videoCodec;return(!B||Object(N.isCodecSupportedInMp4)(B,"audio"))&&(!U||Object(N.isCodecSupportedInMp4)(U,"video"))}),m.audioTracks&&(x=m.audioTracks.filter(function(X){return!X.audioCodec||Object(N.isCodecSupportedInMp4)(X.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(x)),m.subtitles&&(h=m.subtitles,Object(k.assignTrackIdsByGroup)(h)),L.length>0){c=L[0].bitrate,L.sort(function(X,B){return X.bitrate-B.bitrate}),this._levels=L;for(var P=0;P<L.length;P++)if(L[P].bitrate===c){this._firstLevel=P,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var F=b&&!p,H={levels:L,audioTracks:x,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:b,video:p,altAudio:!F&&x.some(function(X){return!!X.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,H),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var L=m.context,x=this._levels[this.currentLevelIndex];if(L&&(L.type===O.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&L.groupId===x.audioGroupIds[x.urlId]||L.type===O.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&L.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,s;switch(m.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),s=L.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,h=!0;break}s!==void 0&&this.recoverLevel(m,s,h,c)},d.recoverLevel=function(f,m,L,x){var h=f.details,c=this._levels[m];if(c.loadError++,L){var s=this.retryLoadingOrFail(f);if(s)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var v=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(h+": switch to "+v),f.levelRetry=!0,this.hls.nextAutoLevel=v)}}},d.redundantFailover=function(f){var m=this._levels[f],L=m.url.length;if(L>1){var x=(m.urlId+1)%L;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(h){h.urlId=x}),this.level=f}},d.onFragLoaded=function(f,m){var L=m.frag;if(L!==void 0&&L.type===O.PlaylistLevelType.MAIN){var x=this._levels[L.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},d.onLevelLoaded=function(f,m){var L,x=m.level,h=m.details,c=this._levels[x];if(!c){var s;this.warn("Invalid level index "+x),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(h.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,c.details)):(L=m.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(f,m){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var x=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===h){x=c;break}x!==L.urlId&&(L.urlId=x,this.startLoad())}},d.loadPlaylist=function(f){var m=this.currentLevelIndex,L=this._levels[m];if(this.canLoad&&L&&L.url.length>0){var x=L.urlId,h=L.url[x];if(f)try{h=f.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+x+" "+h),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:h,level:m,id:x,deliveryDirectives:f||null})}},d.removeLevel=function(f,m){var L=function(c,s){return s!==m},x=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(L),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(L)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(L)),h.urlId=0,!0):!1}).map(function(h,c){var s=h.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=c}),h});this._levels=x,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:x})},_(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var m,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===f&&(m=L[f])!==null&&m!==void 0&&m.details)return;if(f<0||f>=L.length){var x=f<0;if(this.hls.trigger(M.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:x,reason:"invalid level idx"}),x)return;f=Math.min(f,L.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=L[h],s=L[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=E({},s,{level:f,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var v=s.details;if(!v||v.live){var p=this.switchParams(s.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),l}(D.default)},"./src/controller/level-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"addGroupId",function(){return R}),A.d(G,"assignTrackIdsByGroup",function(){return N}),A.d(G,"updatePTS",function(){return k}),A.d(G,"updateFragPTSDTS",function(){return O}),A.d(G,"mergeDetails",function(){return E}),A.d(G,"mapPartIntersection",function(){return T}),A.d(G,"mapFragmentIntersection",function(){return _}),A.d(G,"adjustSliding",function(){return C}),A.d(G,"addSliding",function(){return y}),A.d(G,"computeReloadInterval",function(){return g}),A.d(G,"getFragmentWithSN",function(){return u}),A.d(G,"getPartWith",function(){return o});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts");function R(l,d,w){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(w);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(w);break}}function N(l){var d={};l.forEach(function(w){var f=w.groupId||"";w.id=d[f]=d[f]||0,d[f]++})}function k(l,d,w){var f=l[d],m=l[w];D(f,m)}function D(l,d){var w=d.startPTS;if(Object(W.isFiniteNumber)(w)){var f=0,m;d.sn>l.sn?(f=w-l.start,m=l):(f=l.start-w,m=d),m.duration!==f&&(m.duration=f)}else if(d.sn>l.sn){var L=l.cc===d.cc;L&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function O(l,d,w,f,m,L){var x=f-w;x<=0&&(M.logger.warn("Fragment should have a positive duration",d),f=w+d.duration,L=m+d.duration);var h=w,c=f,s=d.startPTS,a=d.endPTS;if(Object(W.isFiniteNumber)(s)){var v=Math.abs(s-w);Object(W.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(v,d.deltaPTS):d.deltaPTS=v,h=Math.max(w,s),w=Math.min(w,s),m=Math.min(m,d.startDTS),c=Math.min(f,a),f=Math.max(f,a),L=Math.max(L,d.endDTS)}d.duration=f-w;var p=w-d.start;d.appendedPTS=f,d.start=d.startPTS=w,d.maxStartPTS=h,d.startDTS=m,d.endPTS=f,d.minEndPTS=c,d.endDTS=L;var b=d.sn;if(!l||b<l.startSN||b>l.endSN)return 0;var P,F=b-l.startSN,H=l.fragments;for(H[F]=d,P=F;P>0;P--)D(H[P],H[P-1]);for(P=F;P<H.length-1;P++)D(H[P],H[P+1]);return l.fragmentHint&&D(H[H.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,p}function E(l,d){for(var w=null,f=l.fragments,m=f.length-1;m>=0;m--){var L=f[m].initSegment;if(L){w=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,h;if(_(l,d,function(P,F){P.relurl&&(x=P.cc-F.cc),Object(W.isFiniteNumber)(P.startPTS)&&Object(W.isFiniteNumber)(P.endPTS)&&(F.start=F.startPTS=P.startPTS,F.startDTS=P.startDTS,F.appendedPTS=P.appendedPTS,F.maxStartPTS=P.maxStartPTS,F.endPTS=P.endPTS,F.endDTS=P.endDTS,F.minEndPTS=P.minEndPTS,F.duration=P.endPTS-P.startPTS,F.duration&&(h=F),d.PTSKnown=d.alignedSliding=!0),F.elementaryStreams=P.elementaryStreams,F.loader=P.loader,F.stats=P.stats,F.urlId=P.urlId,P.initSegment&&(F.initSegment=P.initSegment,w=P.initSegment)}),w){var c=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;c.forEach(function(P){var F;(!P.initSegment||P.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(P.initSegment=w)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(P){return!P}),d.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=d.skippedSegments;s--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(x){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=x}d.skippedSegments&&(d.startCC=d.fragments[0].cc),T(l.partList,d.partList,function(P,F){F.elementaryStreams=P.elementaryStreams,F.stats=P.stats}),h?O(d,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(l,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var p=d.advancedDateTime;if(d.advanced&&p){var b=d.edge;d.driftStart||(d.driftStartTime=p,d.driftStart=b),d.driftEndTime=p,d.driftEnd=b}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function T(l,d,w){if(l&&d)for(var f=0,m=0,L=l.length;m<=L;m++){var x=l[m],h=d[m+f];x&&h&&x.index===h.index&&x.fragment.sn===h.fragment.sn?w(x,h):f--}}function _(l,d,w){for(var f=d.skippedSegments,m=Math.max(l.startSN,d.startSN)-d.startSN,L=(l.fragmentHint?1:0)+(f?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,x=d.startSN-l.startSN,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,s=m;s<=L;s++){var a=c[x+s],v=h[s];f&&!v&&s<f&&(v=d.fragments[s]=a),a&&v&&w(a,v)}}function C(l,d){var w=d.startSN+d.skippedSegments-l.startSN,f=l.fragments;if(w<0||w>=f.length)return;y(d,f[w].start)}function y(l,d){if(d){for(var w=l.fragments,f=l.skippedSegments;f<w.length;f++)w[f].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function g(l,d){var w=1e3*l.levelTargetDuration,f=w/2,m=l.age,L=m>0&&m<w*3,x=d.loading.end-d.loading.start,h,c=l.availabilityDelay;if(l.updated===!1)if(L){var s=333*l.misses;h=Math.max(Math.min(f,x*2),s),l.availabilityDelay=(l.availabilityDelay||0)+h}else h=f;else L?(c=Math.min(c||w/2,m),l.availabilityDelay=c,h=c+w-m):h=w-x;return Math.round(h)}function u(l,d,w){if(!l||!l.details)return null;var f=l.details,m=f.fragments[d-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===d?m:d<f.startSN&&w&&w.sn===d?w:null)}function o(l,d,w){if(!l||!l.details)return null;var f=l.details.partList;if(f)for(var m=f.length;m--;){var L=f[m];if(L.index===w&&L.fragment.sn===d)return L}return null}},"./src/controller/stream-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return f});var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),R=A("./src/is-supported.ts"),N=A("./src/events.ts"),k=A("./src/utils/buffer-helper.ts"),D=A("./src/controller/fragment-tracker.ts"),O=A("./src/types/loader.ts"),E=A("./src/loader/fragment.ts"),T=A("./src/demux/transmuxer-interface.ts"),_=A("./src/types/transmuxer.ts"),C=A("./src/controller/gap-controller.ts"),y=A("./src/errors.ts"),g=A("./src/utils/logger.ts");function u(m,L){for(var x=0;x<L.length;x++){var h=L[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,L,x){return L&&u(m.prototype,L),x&&u(m,x),m}function l(m,L){m.prototype=Object.create(L.prototype),m.prototype.constructor=m,d(m,L)}function d(m,L){return d=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},d(m,L)}var w=100,f=function(m){l(L,m);function L(h,c){var s;return s=m.call(this,h,c,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var x=L.prototype;return x._registerListeners=function(){var c=this.hls;c.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(N.Events.ERROR,this.onError,this),c.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var c=this.hls;c.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(N.Events.ERROR,this.onError,this),c.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(c){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}s>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),c=s),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var c,s=this.levels,a=this.level,v=s==null||((c=s[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var p,b=self.performance.now(),P=this.retryDate;(!P||b>=P||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var c,s,a=this.hls,v=this.levelLastLoaded,p=this.levels,b=this.media,P=a.config,F=a.nextLoadLevel;if(v===null||!b&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[F])return;var H=p[F];this.level=a.nextLoadLevel=F;var X=H.details;if(!X||this.state===M.State.WAITING_LEVEL||X.live&&this.levelLastLoaded!==F){this.state=M.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,O.PlaylistLevelType.MAIN);if(B===null)return;var U=B.len,z=this.getMaxBufferLength(H.maxBitrate);if(U>=z)return;if(this._streamEnded(B,X)){var Z={};this.altAudio&&(Z.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,Z),this.state=M.State.ENDED;return}var ne=B.end,oe=this.getNextFragment(ne,X);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Ce=oe.sn-X.startSN;Ce>1&&(oe=X.fragments[Ce-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===D.FragmentState.OK&&this.nextLoadPosition>ne){var he=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,he,O.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,X)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((c=oe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((s=oe.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(oe,X):this.loadFragment(oe,X,ne)},x.loadFragment=function(c,s,a){var v,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===D.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(c);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else p=D.FragmentState.NOT_LOADED}p===D.FragmentState.NOT_LOADED||p===D.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,s,a)):p===D.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(c){var s=this.fragmentTracker.getAppendedFrag(c,O.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},x.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,O.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var c=this.levels,s=this.media;if(s!=null&&s.readyState){var a,v=this.getAppendedFrag(s.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!s.paused&&c){var p=this.hls.nextLoadLevel,b=c[p],P=this.fragLastKbps;P&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*P)+1:a=0}else a=0;var F=this.getBufferedFrag(s.currentTime+a);if(F){var H=this.followingBufferedFrag(F);if(H){this.abortCurrentFrag();var X=H.maxStartPTS?H.maxStartPTS:H.start,B=H.duration,U=Math.max(F.end,X+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(U,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(c,s){m.prototype.flushMainBuffer.call(this,c,s,this.altAudio?"video":null)},x.onMediaAttached=function(c,s){m.prototype.onMediaAttached.call(this,c,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var c=this.media,s=c?c.currentTime:null;Object(W.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(c,s){var a=!1,v=!1,p;s.levels.forEach(function(b){p=b.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},x.onLevelLoading=function(c,s){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var v=a[s.level];(!v.details||v.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(v.details))&&(this.state=M.State.WAITING_LEVEL)},x.onLevelLoaded=function(c,s){var a,v=this.levels,p=s.level,b=s.details,P=b.totalduration;if(!v){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+P);var F=this.fragCurrent;F&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==s.level&&F.loader&&(this.state=M.State.IDLE,F.loader.abort()));var H=v[p],X=0;if(b.live||(a=H.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;X=this.alignPlaylists(b,H.details)}if(H.details=b,this.levelLastLoaded=p,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:b,level:p}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=M.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,X),this.tick()},x._handleFragmentLoadProgress=function(c){var s,a=c.frag,v=c.part,p=c.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var P=b[a.level],F=P.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var H=P.videoCodec,X=F.PTSKnown||!F.live,B=(s=a.initSegment)===null||s===void 0?void 0:s.data,U=this._getAudioCodec(P),z=this.transmuxer=this.transmuxer||new T.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Z=v?v.index:-1,ne=Z!==-1,oe=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,Z,ne),Ce=this.initPTS[a.cc];z.push(p,B,U,H,a,v,F.totalduration,X,oe,Ce)},x.onAudioTrackSwitching=function(c,s){var a=this.altAudio,v=!!s.url,p=s.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;a&&P.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:p})}},x.onAudioTrackSwitched=function(c,s){var a=s.id,v=!!this.hls.audioTracks[a].url;if(v){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=v,this.tick()},x.onBufferCreated=function(c,s){var a=s.tracks,v,p,b=!1;for(var P in a){var F=a[P];if(F.id==="main"){if(p=P,v=F,P==="video"){var H=a[P];H&&(this.videoBuffer=H.buffer)}}else b=!0}b&&v?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(c,s){var a=s.frag,v=s.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var p=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},x.onError=function(c,s){switch(s.details){case y.ErrorDetails.FRAG_LOAD_ERROR:case y.ErrorDetails.FRAG_LOAD_TIMEOUT:case y.ErrorDetails.KEY_LOAD_ERROR:case y.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,s);break;case y.ErrorDetails.LEVEL_LOAD_ERROR:case y.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=M.State.ERROR):!s.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case y.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var c=this.media,s=this.gapController;if(!c||!s||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(c,s){var a=s.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,O.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(c,s){this.levels=s.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var c=this.media,s=c.currentTime,a=this.startPosition;if(a>=0&&s<a){if(c.seeking){g.logger.log("could not seek to "+a+", already seeking at "+s);return}var v=k.BufferHelper.getBuffered(c),p=v.length?v.start(0):0,b=p-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+b+" to match buffer start"),a+=b,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),c.currentTime=a}},x._getAudioCodec=function(c){var s=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},x._loadBitrateTestFrag=function(c){var s=this;this._doFragLoad(c).then(function(a){var v=s.hls;if(!a||v.nextLoadLevel||s.fragContextChanged(c))return;s.fragLoadError=0,s.state=M.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),v.trigger(N.Events.FRAG_LOADED,a)})},x._handleTransmuxComplete=function(c){var s,a="main",v=this.hls,p=c.remuxResult,b=c.chunkMeta,P=this.getCurrentContext(b);if(!P){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var F=P.frag,H=P.part,X=P.level,B=p.video,U=p.text,z=p.id3,Z=p.initSegment,ne=this.altAudio?void 0:p.audio;if(this.fragContextChanged(F))return;if(this.state=M.State.PARSING,Z){Z.tracks&&(this._bufferInitSegment(X,Z.tracks,F,b),v.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Z.tracks}));var oe=Z.initPTS,Ce=Z.timescale;Object(W.isFiniteNumber)(oe)&&(this.initPTS[F.cc]=oe,v.trigger(N.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:oe,timescale:Ce}))}if(B&&p.independent!==!1){if(X.details){var he=B.startPTS,we=B.endPTS,ve=B.startDTS,pe=B.endDTS;if(H)H.elementaryStreams[B.type]={startPTS:he,endPTS:we,startDTS:ve,endDTS:pe};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var se=this.getLoadPosition()+this.config.maxBufferHole;if(se<he){this.backtrack(F);return}F.setElementaryStreamInfo(B.type,F.start,we,F.start,pe,!0)}F.setElementaryStreamInfo(B.type,he,we,ve,pe),this.bufferFragmentData(B,F,H,b)}}else if(p.independent===!1){this.backtrack(F);return}if(ne){var de=ne.startPTS,Le=ne.endPTS,We=ne.startDTS,Te=ne.endDTS;H&&(H.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:Le,startDTS:We,endDTS:Te}),F.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,de,Le,We,Te),this.bufferFragmentData(ne,F,H,b)}if(z!=null&&(s=z.samples)!==null&&s!==void 0&&s.length){var xe={frag:F,id:a,samples:z.samples};v.trigger(N.Events.FRAG_PARSING_METADATA,xe)}if(U){var Oe={frag:F,id:a,samples:U.samples};v.trigger(N.Events.FRAG_PARSING_USERDATA,Oe)}},x._bufferInitSegment=function(c,s,a,v){var p=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var b=s.audio,P=s.video,F=s.audiovideo;if(b){var H=c.audioCodec,X=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(H&&(H.indexOf("mp4a.40.5")!==-1?H="mp4a.40.2":H="mp4a.40.5"),b.metadata.channelCount!==1&&X.indexOf("firefox")===-1&&(H="mp4a.40.5")),X.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(H="mp4a.40.2",this.log("Android: force audio codec to "+H)),c.audioCodec&&c.audioCodec!==H&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+H+'"'),b.levelCodec=H,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(H||"")+"/"+(c.audioCodec||"")+"/"+b.codec+"]")}P&&(P.levelCodec=c.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+P.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(B){var U=s[B],z=U.initSegment;z!=null&&z.byteLength&&p.hls.trigger(N.Events.BUFFER_APPENDING,{type:B,data:z,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},x.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var s=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,s?this.resetFragmentLoading(c):this.state=M.State.BACKTRACKING},x.checkFragmentChanged=function(){var c=this.media,s=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?s=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var v=this.fragPlaying,p=s.level;(!v||s.sn!==v.sn||v.level!==p||s.urlId!==v.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:s}),(!v||v.level!==p)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=s)}}},o(L,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var s=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"SubtitleStreamController",function(){return l});var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),R=A("./src/utils/buffer-helper.ts"),N=A("./src/controller/fragment-finders.ts"),k=A("./src/utils/discontinuities.ts"),D=A("./src/controller/level-helper.ts"),O=A("./src/controller/fragment-tracker.ts"),E=A("./src/controller/base-stream-controller.ts"),T=A("./src/types/loader.ts"),_=A("./src/types/level.ts");function C(d,w){for(var f=0;f<w.length;f++){var m=w[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function y(d,w,f){return w&&C(d.prototype,w),f&&C(d,f),d}function g(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,u(d,w)}function u(d,w){return u=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},u(d,w)}var o=500,l=function(d){g(w,d);function w(m,L){var x;return x=d.call(this,m,L,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var f=w.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._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)},f._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)},f.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(L,x){this.mainDetails=x.details},f.onSubtitleFragProcessed=function(L,x){var h=x.frag,c=x.success;if(this.fragPrevious=h,this.state=E.State.IDLE,!c)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,v=h.start,p=0;p<s.length;p++)if(v>=s[p].start&&v<=s[p].end){a=s[p];break}var b=h.start+h.duration;a?a.end=b:(a={start:v,end:b},s.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(L,x){var h=x.startOffset,c=x.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var v=a[s].details,p=v.targetduration,b=c-p;if(b<=0)return;x.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(P){for(var F=0;F<P.length;){if(P[F].end<=b){P.shift();continue}else if(P[F].start<b)P[F].start=b;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,b,T.PlaylistLevelType.SUBTITLE)}},f.onError=function(L,x){var h,c=x.frag;if(!c||c.type!==T.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},f.onSubtitleTracksUpdated=function(L,x){var h=this,c=x.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(s){return new _.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){h.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(L,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(L,x){var h,c=x.details,s=x.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var p=v[a];if(s>=v.length||s!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var b=this.mainDetails;if(c.deltaUpdateFailed||!b)return;var P=b.fragments[0];if(!p.details)c.hasProgramDateTime&&b.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,b):P&&Object(D.addSliding)(c,P.start);else{var F=this.alignPlaylists(c,p.details);F===0&&P&&Object(D.addSliding)(c,P.start)}}if(p.details=c,this.levelLastLoaded=s,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var H=Object(N.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);H||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},f._handleFragmentLoadComplete=function(L){var x=L.frag,h=L.payload,c=x.decryptdata,s=this.hls;if(this.fragContextChanged(x))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(v){var p=performance.now();s.trigger(W.Events.FRAG_DECRYPTED,{frag:x,payload:v,stats:{tstart:a,tdecrypt:p}})})}},f.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var L,x=this.currentTrackId,h=this.levels;if(!h.length||!h[x]||!h[x].details)return;var c=h[x].details,s=c.targetduration,a=this.config,v=this.media,p=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-s,a.maxBufferHole),b=p.end,P=p.len,F=this.getMaxBufferLength()+s;if(P>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var H=c.fragments,X=H.length,B=c.edge,U,z=this.fragPrevious;if(b<B){var Z=a.maxFragLookUpTolerance;z&&c.hasProgramDateTime&&(U=Object(N.findFragmentByPDT)(H,z.endProgramDateTime,Z)),U||(U=Object(N.findFragmentByPTS)(z,H,b,Z),!U&&z&&z.start<H[0].start&&(U=H[0]))}else U=H[X-1];(L=U)!==null&&L!==void 0&&L.encrypted?(M.logger.log("Loading key for "+U.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:U})):U&&this.fragmentTracker.getState(U)===O.FragmentState.NOT_LOADED&&this.loadFragment(U,c,b)}},f.loadFragment=function(L,x,h){this.fragCurrent=L,d.prototype.loadFragment.call(this,L,x,h)},y(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(E.default)},"./src/controller/subtitle-track-controller.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),R=A("./src/controller/base-playlist-controller.ts"),N=A("./src/types/loader.ts");function k(C,y){for(var g=0;g<y.length;g++){var u=y[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function D(C,y,g){return y&&k(C.prototype,y),g&&k(C,g),C}function O(C,y){C.prototype=Object.create(y.prototype),C.prototype.constructor=C,E(C,y)}function E(C,y){return E=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},E(C,y)}var T=function(C){O(y,C);function y(u){var o;return o=C.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var g=y.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},g.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(W.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(W.Events.ERROR,this.onError,this)},g.onMediaAttached=function(o,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)},g.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},g.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=_(this.media.textTracks);o.forEach(function(l){Object(M.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},g.onSubtitleTrackLoaded=function(o,l){var d=l.id,w=l.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+d);return}var L=m.details;m.details=l.details,this.log("subtitle track "+d+" loaded ["+w.startSN+"-"+w.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,L))},g.onLevelLoading=function(o,l){this.switchLevel(l.level)},g.onLevelSwitching=function(o,l){this.switchLevel(l.level)},g.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(x){return!d||x.groupId===d});this.tracksInGroup=f;var m=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=d;var L={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,L),m!==-1&&this.setSubtitleTrack(m,w)}},g.findTrackId=function(o){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var w=l[d];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},g.onError=function(o,l){if(C.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===N.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},g.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,w=l.groupId,f=l.url;if(o)try{f=o.addDirectives(f)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:f,id:d,groupId:w,deliveryDirectives:o||null})}},g.toggleTrackModes=function(o){var l=this,d=this.media,w=this.subtitleDisplay,f=this.trackId;if(!d)return;var m=_(d.textTracks),L=m.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var x=L[f];x&&(x.mode="disabled")}var h=L[o];h&&(h.mode=w?"showing":"hidden")},g.setSubtitleTrack=function(o,l){var d,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=w[o])!==null&&d!==void 0&&d.details)||o<-1||o>=w.length)return;this.clearTimer();var f=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var m=f.id,L=f.groupId,x=L===void 0?"":L,h=f.name,c=f.type,s=f.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:h,type:c,url:s});var a=this.switchParams(f.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:o})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=_(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")o=d;else if(l[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},D(y,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),y}(R.default);function _(C){for(var y=[],g=0;g<C.length;g++){var u=C[g];u.kind==="subtitles"&&u.label&&y.push(C[g])}return y}G.default=T},"./src/controller/timeline-controller.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"TimelineController",function(){return _});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),R=A("./src/utils/cea-608-parser.ts"),N=A("./src/utils/output-filter.ts"),k=A("./src/utils/webvtt-parser.ts"),D=A("./src/utils/texttrack-utils.ts"),O=A("./src/utils/imsc1-ttml-parser.ts"),E=A("./src/types/loader.ts"),T=A("./src/utils/logger.ts"),_=function(){function u(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=g(),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 d=new N.default(this,"textTrack1"),w=new N.default(this,"textTrack2"),f=new N.default(this,"textTrack3"),m=new N.default(this,"textTrack4");this.cea608Parser1=new R.default(1,d,w),this.cea608Parser2=new R.default(3,f,m)}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 o=u.prototype;return o.destroy=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(M.Events.FRAG_LOADING,this.onFragLoading,this),d.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,w,f,m,L){for(var x=!1,h=L.length;h--;){var c=L[h],s=y(c[0],c[1],w,f);if(s>=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],f),x=!0,s/(f-w)>.5))return}if(x||L.push([w,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,w,f,m)}else{var v=this.Cues.newCue(null,w,f,m);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:v,track:d})}},o.onInitPtsFound=function(d,w){var f=this,m=w.frag,L=w.id,x=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(s){f.onFragLoaded(M.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(d){var w=this.media;if(w)for(var f=0;f<w.textTracks.length;f++){var m=w.textTracks[f];if(m[d])return m}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var w=this.captionsProperties,f=this.captionsTracks,m=this.media,L=w[d],x=L.label,h=L.languageCode,c=this.getExistingTrack(d);if(c)f[d]=c,Object(D.clearCurrentCues)(f[d]),Object(D.sendAddTrackEvent)(f[d],m);else{var s=this.createTextTrack("captions",x,h);s&&(s[d]=!0,f[d]=s)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var w=this.captionsProperties[d];if(!w)return;var f=w.label,m={_id:d,label:f,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(d,w,f){var m=this.media;return m?m.addTextTrack(d,w,f):void 0},o.onMediaAttaching=function(d,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(w){Object(D.clearCurrentCues)(d[w]),delete d[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var w=d.textTracks;if(w)for(var f=0;f<w.length;f++)Object(D.clearCurrentCues)(w[f])},o.onSubtitleTracksUpdated=function(d,w){var f=this;this.textTracks=[];var m=w.subtitleTracks||[],L=m.some(function(s){return s.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var x=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var v;if(a<h.length){for(var p=null,b=0;b<h.length;b++)if(C(h[b],s)){p=h[b];break}p&&(v=p)}v?Object(D.clearCurrentCues)(v):(v=f.createTextTrack("subtitles",s.name,s.lang),v&&(v.mode="disabled")),v&&(v.groupId=s.groupId,f.textTracks.push(v))})}else if(!x&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(d,w){var f=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(m){var L=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!L)return;var x="textTrack"+L[1],h=f.captionsProperties[x];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(d,w){var f=this.cea608Parser1,m=this.cea608Parser2,L=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(w.frag.type===E.PlaylistLevelType.MAIN){var h,c,s=w.frag.sn,a=(h=w==null||((c=w.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;s===L+1||s===L&&a===x+1||(f.reset(),m.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(d,w){var f=w.frag,m=w.payload,L=this.initPTS,x=this.unparsedVttFrags;if(f.type===E.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(W.isFiniteNumber)(L[f.cc])){x.push(w),L.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],s=this.vttCCs;s[f.cc]||(s[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===O.IMSC1_CODEC?this._parseIMSC1(f,m):this._parseVTTs(f,m,s)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,w){var f=this,m=this.hls;Object(O.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(L){f._appendCues(L,d.level),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(L){T.logger.log("Failed to parse IMSC1: "+L),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:L})})},o._parseVTTs=function(d,w,f){var m=this,L=this.hls;Object(k.parseWebVTT)(w,this.initPTS[d.cc],this.timescale[d.cc],f,d.cc,d.start,function(x){m._appendCues(x,d.level),L.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(x){m._fallbackToIMSC1(d,w),T.logger.log("Failed to parse VTT cue: "+x),L.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:x})})},o._fallbackToIMSC1=function(d,w){var f=this,m=this.tracks[d.level];m.textCodec||Object(O.parseIMSC1)(w,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=O.IMSC1_CODEC,f._parseIMSC1(d,w)},function(){m.textCodec="wvtt"})},o._appendCues=function(d,w){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[w];if(m.mode==="disabled")return;d.forEach(function(h){return Object(D.addCueToTrack)(m,h)})}else{var L=this.tracks[w],x=L.default?"default":"subtitles"+w;f.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:d,track:x})}},o.onFragDecrypted=function(d,w){var f=w.frag;if(f.type===E.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(M.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,w){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var L=0;L<w.samples.length;L++){var x=w.samples[L].bytes;if(x){var h=this.extractCea608Data(x);f.addData(w.samples[L].pts,h[0]),m.addData(w.samples[L].pts,h[1])}}},o.onBufferFlushing=function(d,w){var f=w.startOffset,m=w.endOffset,L=w.endOffsetSubtitles,x=w.type,h=this.media;if(!h||h.currentTime<m)return;if(!x||x==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(D.removeCuesInRange)(c[a],f,m)})}if(this.config.renderTextTracksNatively&&(f===0&&L!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(D.removeCuesInRange)(s[a],f,L)})}},o.extractCea608Data=function(d){for(var w=d[0]&31,f=2,m=[[],[]],L=0;L<w;L++){var x=d[f++],h=127&d[f++],c=127&d[f++],s=(4&x)!==0,a=3&x;if(h===0&&c===0)continue;s&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},u}();function C(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function y(u,o,l,d){return Math.min(o,d)-Math.max(u,l)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return W});var W=function(){function M(N,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=k}var R=M.prototype;return R.decrypt=function(k,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,k)},M}()},"./src/crypt/aes-decryptor.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"removePadding",function(){return M}),A.d(G,"default",function(){return R});var W=A("./src/utils/typed-array.ts");function M(N){var k=N.byteLength,D=k&&new DataView(N.buffer).getUint8(k-1);return D?Object(W.sliceUint8)(N,0,k-D):N}var R=function(){function N(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var k=N.prototype;return k.uint8ArrayToUint32Array_=function(O){for(var E=new DataView(O),T=new Uint32Array(4),_=0;_<4;_++)T[_]=E.getUint32(_*4);return T},k.initTable=function(){var O=this.sBox,E=this.invSBox,T=this.subMix,_=T[0],C=T[1],y=T[2],g=T[3],u=this.invSubMix,o=u[0],l=u[1],d=u[2],w=u[3],f=new Uint32Array(256),m=0,L=0,x=0;for(x=0;x<256;x++)x<128?f[x]=x<<1:f[x]=x<<1^283;for(x=0;x<256;x++){var h=L^L<<1^L<<2^L<<3^L<<4;h=h>>>8^h&255^99,O[m]=h,E[h]=m;var c=f[m],s=f[c],a=f[s],v=f[h]*257^h*16843008;_[m]=v<<24|v>>>8,C[m]=v<<16|v>>>16,y[m]=v<<8|v>>>24,g[m]=v,v=a*16843009^s*65537^c*257^m*16843008,o[h]=v<<24|v>>>8,l[h]=v<<16|v>>>16,d[h]=v<<8|v>>>24,w[h]=v,m?(m=c^f[f[f[a^c]]],L^=f[f[L]]):m=L=1}},k.expandKey=function(O){for(var E=this.uint8ArrayToUint32Array_(O),T=!0,_=0;_<E.length&&T;)T=E[_]===this.key[_],_++;if(T)return;this.key=E;var C=this.keySize=E.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var y=this.ksRows=(C+6+1)*4,g,u,o=this.keySchedule=new Uint32Array(y),l=this.invKeySchedule=new Uint32Array(y),d=this.sBox,w=this.rcon,f=this.invSubMix,m=f[0],L=f[1],x=f[2],h=f[3],c,s;for(g=0;g<y;g++){if(g<C){c=o[g]=E[g];continue}s=c,g%C===0?(s=s<<8|s>>>24,s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255],s^=w[g/C|0]<<24):C>6&&g%C===4&&(s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255]),o[g]=c=(o[g-C]^s)>>>0}for(u=0;u<y;u++)g=y-u,u&3?s=o[g]:s=o[g-4],u<4||g<=4?l[u]=s:l[u]=m[d[s>>>24]]^L[d[s>>>16&255]]^x[d[s>>>8&255]]^h[d[s&255]],l[u]=l[u]>>>0},k.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},k.decrypt=function(O,E,T){for(var _=this.keySize+6,C=this.invKeySchedule,y=this.invSBox,g=this.invSubMix,u=g[0],o=g[1],l=g[2],d=g[3],w=this.uint8ArrayToUint32Array_(T),f=w[0],m=w[1],L=w[2],x=w[3],h=new Int32Array(O),c=new Int32Array(h.length),s,a,v,p,b,P,F,H,X,B,U,z,Z,ne,oe=this.networkToHostOrderSwap;E<h.length;){for(X=oe(h[E]),B=oe(h[E+1]),U=oe(h[E+2]),z=oe(h[E+3]),b=X^C[0],P=z^C[1],F=U^C[2],H=B^C[3],Z=4,ne=1;ne<_;ne++)s=u[b>>>24]^o[P>>16&255]^l[F>>8&255]^d[H&255]^C[Z],a=u[P>>>24]^o[F>>16&255]^l[H>>8&255]^d[b&255]^C[Z+1],v=u[F>>>24]^o[H>>16&255]^l[b>>8&255]^d[P&255]^C[Z+2],p=u[H>>>24]^o[b>>16&255]^l[P>>8&255]^d[F&255]^C[Z+3],b=s,P=a,F=v,H=p,Z=Z+4;s=y[b>>>24]<<24^y[P>>16&255]<<16^y[F>>8&255]<<8^y[H&255]^C[Z],a=y[P>>>24]<<24^y[F>>16&255]<<16^y[H>>8&255]<<8^y[b&255]^C[Z+1],v=y[F>>>24]<<24^y[H>>16&255]<<16^y[b>>8&255]<<8^y[P&255]^C[Z+2],p=y[H>>>24]<<24^y[b>>16&255]<<16^y[P>>8&255]<<8^y[F&255]^C[Z+3],c[E]=oe(s^f),c[E+1]=oe(p^m),c[E+2]=oe(v^L),c[E+3]=oe(a^x),f=X,m=B,L=U,x=z,E=E+4}return c.buffer},N}()},"./src/crypt/decrypter.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return E});var W=A("./src/crypt/aes-crypto.ts"),M=A("./src/crypt/fast-aes-key.ts"),R=A("./src/crypt/aes-decryptor.ts"),N=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),D=A("./src/utils/typed-array.ts"),O=16,E=function(){function T(C,y,g){var u=g===void 0?{}:g,o=u.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=y,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=T.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var y=this.currentResult;if(!y){this.reset();return}var g=new Uint8Array(y);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(g):g},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(y,g,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(y),g,u);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(y),g,u).then(o)},_.softwareDecrypt=function(y,g,u){var o=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(y=Object(k.appendUint8Array)(d,y),this.remainderData=null);var w=this.getValidChunk(y);if(!w.length)return null;o&&(u=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new R.default),f.expandKey(g);var m=l;return this.currentResult=f.decrypt(w.buffer,0,u),this.currentIV=Object(D.sliceUint8)(w,-16).buffer,m||null},_.webCryptoDecrypt=function(y,g,u){var o=this,l=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new M.default(l,g)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var w=new W.default(l,u);return w.decrypt(y.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,y,g,u)})},_.onWebCryptoError=function(y,g,u,o){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",y),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,u,o)},_.getValidChunk=function(y){var g=y,u=y.length-y.length%O;return u!==y.length&&(g=Object(D.sliceUint8)(y,0,u),this.remainderData=Object(D.sliceUint8)(y,u)),g},_.logOnce=function(y){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+y),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return W});var W=function(){function M(N,k){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=k}var R=M.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/adts.ts"),R=A("./src/utils/logger.ts"),N=A("./src/demux/id3.ts");function k(E,T){E.prototype=Object.create(T.prototype),E.prototype.constructor=E,D(E,T)}function D(E,T){return D=Object.setPrototypeOf||function(C,y){return C.__proto__=y,C},D(E,T)}var O=function(E){k(T,E);function T(C,y){var g;return g=E.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=C,g.config=y,g}var _=T.prototype;return _.resetInitSegment=function(y,g,u){E.prototype.resetInitSegment.call(this,y,g,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:y,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(y){if(!y)return!1;for(var g=N.getID3Data(y,0)||[],u=g.length,o=y.length;u<o;u++)if(M.probe(y,u))return R.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(y,g){return M.canParse(y,g)},_.appendFrame=function(y,g,u){M.initTrackConfig(y,this.observer,g,u,y.manifestCodec);var o=M.appendFrame(y,g,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(W.default);O.minProbeByteLength=9,G.default=O},"./src/demux/adts.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"getAudioConfig",function(){return N}),A.d(G,"isHeaderPattern",function(){return k}),A.d(G,"getHeaderLength",function(){return D}),A.d(G,"getFullFrameLength",function(){return O}),A.d(G,"canGetFrameLength",function(){return E}),A.d(G,"isHeader",function(){return T}),A.d(G,"canParse",function(){return _}),A.d(G,"probe",function(){return C}),A.d(G,"initTrackConfig",function(){return y}),A.d(G,"getFrameDuration",function(){return g}),A.d(G,"parseFrameHeader",function(){return u}),A.d(G,"appendFrame",function(){return o});var W=A("./src/utils/logger.ts"),M=A("./src/errors.ts"),R=A("./src/events.ts");function N(l,d,w,f){var m,L,x,h,c=navigator.userAgent.toLowerCase(),s=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[w+2]&192)>>>6)+1;var v=(d[w+2]&60)>>>2;if(v>a.length-1){l.trigger(R.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return x=(d[w+2]&1)<<2,x|=(d[w+3]&192)>>>6,W.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(m=5,h=new Array(4),L=v-3):(m=2,h=new Array(2),L=v):c.indexOf("android")!==-1?(m=2,h=new Array(2),L=v):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&v>=6?L=v-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(v>=6&&x===1||/vivaldi/i.test(c))||!f&&x===1)&&(m=2,h=new Array(2)),L=v)),h[0]=m<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=x<<3,m===5&&(h[1]|=(L&14)>>1,h[2]=(L&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:x,codec:"mp4a.40."+m,manifestCodec:s}}function k(l,d){return l[d]===255&&(l[d+1]&246)===240}function D(l,d){return l[d+1]&1?7:9}function O(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function E(l,d){return d+5<l.length}function T(l,d){return d+1<l.length&&k(l,d)}function _(l,d){return E(l,d)&&k(l,d)&&O(l,d)<=l.length-d}function C(l,d){if(T(l,d)){var w=D(l,d);if(d+w>=l.length)return!1;var f=O(l,d);if(f<=w)return!1;var m=d+f;return m===l.length||T(l,m)}return!1}function y(l,d,w,f,m){if(!l.samplerate){var L=N(d,w,f,m);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 g(l){return 1024*9e4/l}function u(l,d,w,f,m){var L=D(l,d),x=O(l,d);if(x-=L,x>0){var h=w+f*m;return{headerLength:L,frameLength:x,stamp:h}}}function o(l,d,w,f,m){var L=g(l.samplerate),x=u(d,w,f,m,L);if(x){var h=x.frameLength,c=x.headerLength,s=x.stamp,a=c+h,v=Math.max(0,w+a-d.length),p;v?(p=new Uint8Array(a-c),p.set(d.subarray(w+c,d.length),0)):p=d.subarray(w+c,w+a);var b={unit:p,pts:s};return v||l.samples.push(b),{sample:b,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"initPTSFn",function(){return O});var W=A("./src/polyfills/number.ts"),M=A("./src/demux/id3.ts"),R=A("./src/demux/dummy-demuxed-track.ts"),N=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),D=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=E.prototype;return T.resetInitSegment=function(C,y,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(C,y){return!1},T.appendFrame=function(C,y,g){},T.demux=function(C,y){this.cachedData&&(C=Object(N.appendUint8Array)(this.cachedData,C),this.cachedData=null);var g=M.getID3Data(C,0),u=g?g.length:0,o,l,d=this._audioTrack,w=this._id3Track,f=g?M.getTimeStamp(g):void 0,m=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(f,y)),g&&g.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),l=this.initPTS;u<m;){if(this.canParse(C,u)){var L=this.appendFrame(d,C,u);L?(this.frameIndex++,l=L.sample.pts,u+=L.length,o=u):u=m}else M.canParse(C,u)?(g=M.getID3Data(C,u),w.samples.push({pts:l,dts:l,data:g}),u+=g.length,o=u):u++;if(u===m&&o!==m){var x=Object(k.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:d,avcTrack:Object(R.dummyTrack)(),id3Track:w,textTrack:Object(R.dummyTrack)()}},T.demuxSampleAes=function(C,y,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(C){var y=this.cachedData;return y&&(this.cachedData=null,this.demux(y,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},T.destroy=function(){},E}(),O=function(T,_){return Object(W.isFiniteNumber)(T)?T*90:_*9e4};G.default=D},"./src/demux/chunk-cache.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return W});var W=function(){function R(){this.chunks=[],this.dataLength=0}var N=R.prototype;return N.push=function(D){this.chunks.push(D),this.dataLength+=D.length},N.flush=function(){var D=this.chunks,O=this.dataLength,E;if(D.length)D.length===1?E=D[0]:E=M(D,O);else return new Uint8Array(0);return this.reset(),E},N.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function M(R,N){for(var k=new Uint8Array(N),D=0,O=0;O<R.length;O++){var E=R[O];k.set(E,D),D+=E.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"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(te,G,A){"use strict";A.r(G);var W=A("./src/utils/logger.ts"),M=function(){function R(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var N=R.prototype;return N.loadWord=function(){var D=this.data,O=this.bytesAvailable,E=D.byteLength-O,T=new Uint8Array(4),_=Math.min(4,O);if(_===0)throw new Error("no bytes available");T.set(D.subarray(E,E+_)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},N.skipBits=function(D){var O;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,O=D>>3,D-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},N.readBits=function(D){var O=Math.min(this.bitsAvailable,D),E=this.word>>>32-O;return D>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=D-O,O>0&&this.bitsAvailable?E<<O|this.readBits(O):E},N.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},N.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(D){for(var O=8,E=8,T,_=0;_<D;_++)E!==0&&(T=this.readEG(),E=(O+T+256)%256),O=E===0?O:E},N.readSPS=function(){var D=0,O=0,E=0,T=0,_,C,y,g=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),w=this.skipEG.bind(this),f=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);g();var L=g();if(u(5),d(3),g(),f(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var x=o();if(x===3&&d(1),f(),f(),d(1),l())for(C=x!==3?8:12,y=0;y<C;y++)l()&&(y<6?m(16):m(64))}f();var h=o();if(h===0)o();else if(h===1)for(d(1),w(),w(),_=o(),y=0;y<_;y++)w();f(),d(1);var c=o(),s=o(),a=u(1);a===0&&d(1),d(1),l()&&(D=o(),O=o(),E=o(),T=o());var v=[1,1];if(l()&&l()){var p=g();switch(p){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((c+1)*16-D*2-O*2),height:(2-a)*(s+1)*16-(a?2:4)*(E+T),pixelRatio:v}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();G.default=M},"./src/demux/id3.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isHeader",function(){return W}),A.d(G,"isFooter",function(){return M}),A.d(G,"getID3Data",function(){return R}),A.d(G,"canParse",function(){return k}),A.d(G,"getTimeStamp",function(){return D}),A.d(G,"isTimeStampFrame",function(){return O}),A.d(G,"getID3Frames",function(){return T}),A.d(G,"decodeFrame",function(){return _}),A.d(G,"utf8ArrayToStr",function(){return o}),A.d(G,"testables",function(){return l});var W=function(m,L){return L+10<=m.length&&(m[L]===73&&m[L+1]===68&&m[L+2]===51&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},M=function(m,L){return L+10<=m.length&&(m[L]===51&&m[L+1]===68&&m[L+2]===73&&(m[L+3]<255&&m[L+4]<255&&(m[L+6]<128&&m[L+7]<128&&m[L+8]<128&&m[L+9]<128)))},R=function(m,L){for(var x=L,h=0;W(m,L);){h+=10;var c=N(m,L+6);h+=c,M(m,L+10)&&(h+=10),L+=h}return h>0?m.subarray(x,x+h):void 0},N=function(m,L){var x=0;return x=(m[L]&127)<<21,x|=(m[L+1]&127)<<14,x|=(m[L+2]&127)<<7,x|=m[L+3]&127,x},k=function(m,L){return W(m,L)&&N(m,L+6)+10<=m.length-L},D=function(m){for(var L=T(m),x=0;x<L.length;x++){var h=L[x];if(O(h))return u(h)}return},O=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},E=function(m){var L=String.fromCharCode(m[0],m[1],m[2],m[3]),x=N(m,4),h=10;return{type:L,size:x,data:m.subarray(h,h+x)}},T=function(m){for(var L=0,x=[];W(m,L);){var h=N(m,L+6);L+=10;for(var c=L+h;L+8<c;){var s=E(m.subarray(L)),a=_(s);a&&x.push(a),L+=s.size+10}M(m,L)&&(L+=10)}return x},_=function(m){return m.type==="PRIV"?C(m):m.type[0]==="W"?g(m):y(m)},C=function(m){if(m.size<2)return;var L=o(m.data,!0),x=new Uint8Array(m.data.subarray(L.length+1));return{key:m.type,info:L,data:x.buffer}},y=function(m){if(m.size<2)return;if(m.type==="TXXX"){var L=1,x=o(m.data.subarray(L),!0);L+=x.length+1;var h=o(m.data.subarray(L));return{key:m.type,info:x,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},g=function(m){if(m.type==="WXXX"){if(m.size<2)return;var L=1,x=o(m.data.subarray(L),!0);L+=x.length+1;var h=o(m.data.subarray(L));return{key:m.type,info:x,data:h}}var c=o(m.data);return{key:m.type,data:c}},u=function(m){if(m.data.byteLength===8){var L=new Uint8Array(m.data),x=L[3]&1,h=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return h/=45,x&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,L){L===void 0&&(L=!1);var x=w();if(x){var h=x.decode(m);if(L){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var s=m.length,a,v,p,b="",P=0;P<s;){if(a=m[P++],a===0&&L)return b;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(a);break;case 12:case 13:v=m[P++],b+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=m[P++],p=m[P++],b+=String.fromCharCode((a&15)<<12|(v&63)<<6|(p&63)<<0);break;default:}}return b},l={decodeTextFrame:y},d;function w(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/id3.ts"),R=A("./src/utils/logger.ts"),N=A("./src/demux/mpegaudio.ts");function k(E,T){E.prototype=Object.create(T.prototype),E.prototype.constructor=E,D(E,T)}function D(E,T){return D=Object.setPrototypeOf||function(C,y){return C.__proto__=y,C},D(E,T)}var O=function(E){k(T,E);function T(){return E.apply(this,arguments)||this}var _=T.prototype;return _.resetInitSegment=function(y,g,u){E.prototype.resetInitSegment.call(this,y,g,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:y,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(y){if(!y)return!1;for(var g=M.getID3Data(y,0)||[],u=g.length,o=y.length;u<o;u++)if(N.probe(y,u))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(y,g){return N.canParse(y,g)},_.appendFrame=function(y,g,u){return this.initPTS===null?void 0:N.appendFrame(y,g,u,this.initPTS,this.frameIndex)},T}(W.default);O.minProbeByteLength=4,G.default=O},"./src/demux/mp4demuxer.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/utils/mp4-tools.ts"),M=A("./src/demux/dummy-demuxed-track.ts"),R=function(){function N(D,O){this.remainderData=null,this.config=void 0,this.config=O}var k=N.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},N.probe=function(O){return Object(W.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},k.demux=function(O){var E=O,T=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(W.appendUint8Array)(this.remainderData,O));var _=Object(W.segmentValidRange)(E);this.remainderData=_.remainder,T.samples=_.valid||new Uint8Array}else T.samples=E;return{audioTrack:Object(M.dummyTrack)(),avcTrack:T,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var O=Object(M.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:O,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(O,E,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},N}();R.minProbeByteLength=1024,G.default=R},"./src/demux/mpegaudio.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"appendFrame",function(){return D}),A.d(G,"parseHeader",function(){return O}),A.d(G,"isHeaderPattern",function(){return E}),A.d(G,"isHeader",function(){return T}),A.d(G,"canParse",function(){return _}),A.d(G,"probe",function(){return C});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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function D(y,g,u,o,l){if(u+24>g.length)return;var d=O(g,u);if(d&&u+d.frameLength<=g.length){var w=d.samplesPerFrame*9e4/d.sampleRate,f=o+l*w,m={unit:g.subarray(u,u+d.frameLength),pts:f,dts:f};return y.config=[],y.channelCount=d.channelCount,y.samplerate=d.sampleRate,y.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function O(y,g){var u=y[g+1]>>3&3,o=y[g+1]>>1&3,l=y[g+2]>>4&15,d=y[g+2]>>2&3;if(u!==1&&l!==0&&l!==15&&d!==3){var w=y[g+2]>>1&1,f=y[g+3]>>6,m=u===3?3-o:o===3?3:4,L=M[m*14+l-1]*1e3,x=u===3?0:u===2?1:2,h=R[x*3+d],c=f===3?1:2,s=N[u][o],a=k[o],v=s*8*a,p=Math.floor(s*L/h+w)*a;if(W===null){var b=navigator.userAgent||"",P=b.match(/Chrome\/(\d+)/i);W=P?parseInt(P[1]):0}var F=!!W&&W<=87;return F&&o===2&&L>=224e3&&f===0&&(y[g+3]=y[g+3]|128),{sampleRate:h,channelCount:c,frameLength:p,samplesPerFrame:v}}}function E(y,g){return y[g]===255&&(y[g+1]&224)===224&&(y[g+1]&6)!==0}function T(y,g){return g+1<y.length&&E(y,g)}function _(y,g){var u=4;return E(y,g)&&u<=y.length-g}function C(y,g){if(g+1<y.length&&E(y,g)){var u=4,o=O(y,g),l=u;o!=null&&o.frameLength&&(l=o.frameLength);var d=g+l;return d===y.length||T(y,d)}return!1}},"./src/demux/sample-aes.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/crypt/decrypter.ts"),M=A("./src/demux/tsdemuxer.ts"),R=function(){function N(D,O,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new W.default(D,O,{removePKCS7Padding:!1})}var k=N.prototype;return k.decryptBuffer=function(O,E){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,E)},k.decryptAacSample=function(O,E,T,_){var C=O[E].unit,y=C.subarray(16,C.length-C.length%16),g=y.buffer.slice(y.byteOffset,y.byteOffset+y.length),u=this;this.decryptBuffer(g,function(o){var l=new Uint8Array(o);C.set(l,16),_||u.decryptAacSamples(O,E+1,T)})},k.decryptAacSamples=function(O,E,T){for(;;E++){if(E>=O.length){T();return}if(O[E].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(O,E,T,_),!_)return}},k.getAvcEncryptedData=function(O){for(var E=Math.floor((O.length-48)/160)*16+16,T=new Int8Array(E),_=0,C=32;C<=O.length-16;C+=160,_+=16)T.set(O.subarray(C,C+16),_);return T},k.getAvcDecryptedUnit=function(O,E){for(var T=new Uint8Array(E),_=0,C=32;C<=O.length-16;C+=160,_+=16)O.set(T.subarray(_,_+16),C);return O},k.decryptAvcSample=function(O,E,T,_,C,y){var g=Object(M.discardEPB)(C.data),u=this.getAvcEncryptedData(g),o=this;this.decryptBuffer(u.buffer,function(l){C.data=o.getAvcDecryptedUnit(g,l),y||o.decryptAvcSamples(O,E,T+1,_)})},k.decryptAvcSamples=function(O,E,T,_){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,T=0){if(E>=O.length){_();return}for(var C=O[E].units;!(T>=C.length);T++){var y=C[T];if(y.data.length<=48||y.type!==1&&y.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(O,E,T,_,y,g),!g)return}}},N}();G.default=R},"./src/demux/transmuxer-interface.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return C});var W=A("./node_modules/webworkify-webpack/index.js"),M=A.n(W),R=A("./src/events.ts"),N=A("./src/demux/transmuxer.ts"),k=A("./src/utils/logger.ts"),D=A("./src/errors.ts"),O=A("./src/utils/mediasource-helper.ts"),E=A("./node_modules/eventemitter3/index.js"),T=A.n(E),_=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function y(u,o,l,d){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=o,this.onTransmuxComplete=l,this.onFlush=d;var f=u.config,m=function(s,a){a=a||{},a.frag=w.frag,a.id=w.id,u.trigger(s,a)};this.observer=new E.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,m),this.observer.on(R.Events.ERROR,m);var L={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var h;try{h=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){u.trigger(R.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:L,vendor:x,id:o,config:JSON.stringify(f)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new N.default(this.observer,L,f,x,o),this.worker=null}}else this.transmuxer=new N.default(this.observer,L,f,x,o)}var g=y.prototype;return g.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},g.push=function(o,l,d,w,f,m,L,x,h,c){var s=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,p=m?m.start:f.start,b=f.decryptdata,P=this.frag,F=!(P&&f.cc===P.cc),H=!(P&&h.level===P.level),X=P?h.sn-P.sn:-1,B=this.part?h.part-this.part.index:1,U=!H&&(X===1||X===0&&B===1),z=self.performance.now();(H||X||f.stats.parsing.start===0)&&(f.stats.parsing.start=z),m&&(B||!U)&&(m.stats.parsing.start=z);var Z=new N.TransmuxState(F,U,x,H,p);if(!U||F){k.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
discontinuity: `+F+`
trackSwitch: `+H+`
contiguous: `+U+`
accurateTimeOffset: `+x+`
timeOffset: `+p);var ne=new N.TransmuxConfig(d,w,l,L,c);this.configureTransmuxer(ne)}if(this.frag=f,this.part=m,v)v.postMessage({cmd:"demux",data:o,decryptdata:b,chunkMeta:h,state:Z},o instanceof ArrayBuffer?[o]:[]);else if(a){var oe=a.push(o,b,h,Z);Object(N.isPromise)(oe)?oe.then(function(Ce){s.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(oe)}},g.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(d){var f=d.flush(o);Object(N.isPromise)(f)?f.then(function(m){l.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},g.handleFlushResult=function(o,l){var d=this;o.forEach(function(w){d.handleTransmuxComplete(w)}),this.onFlush(l)},g.onWorkerMessage=function(o){var l=o.data,d=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,d.trigger(l.event,l.data);break}}},g.configureTransmuxer=function(o){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},g.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},y}()},"./src/demux/transmuxer-worker.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return D});var W=A("./src/demux/transmuxer.ts"),M=A("./src/events.ts"),R=A("./src/utils/logger.ts"),N=A("./node_modules/eventemitter3/index.js"),k=A.n(N);function D(C){var y=new N.EventEmitter,g=function(o,l){C.postMessage({event:o,data:l})};y.on(M.Events.FRAG_DECRYPTED,g),y.on(M.Events.ERROR,g),C.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);C.transmuxer=new W.default(y,o.typeSupported,l,o.vendor,o.id),Object(R.enableLogs)(l.debug),g("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var d=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(W.isPromise)(d)?d.then(function(m){O(C,m)}):O(C,d);break}case"flush":{var w=o.chunkMeta,f=C.transmuxer.flush(w);Object(W.isPromise)(f)?f.then(function(m){T(C,m,w)}):T(C,f,w);break}default:break}})}function O(C,y){if(_(y.remuxResult))return;var g=[],u=y.remuxResult,o=u.audio,l=u.video;o&&E(g,o),l&&E(g,l),C.postMessage({event:"transmuxComplete",data:y},g)}function E(C,y){y.data1&&C.push(y.data1.buffer),y.data2&&C.push(y.data2.buffer)}function T(C,y,g){y.forEach(function(u){O(C,u)}),C.postMessage({event:"flush",data:g})}function _(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return l}),A.d(G,"isPromise",function(){return f}),A.d(G,"TransmuxConfig",function(){return m}),A.d(G,"TransmuxState",function(){return L});var W=A("./src/events.ts"),M=A("./src/errors.ts"),R=A("./src/crypt/decrypter.ts"),N=A("./src/demux/aacdemuxer.ts"),k=A("./src/demux/mp4demuxer.ts"),D=A("./src/demux/tsdemuxer.ts"),O=A("./src/demux/mp3demuxer.ts"),E=A("./src/remux/mp4-remuxer.ts"),T=A("./src/remux/passthrough-remuxer.ts"),_=A("./src/demux/chunk-cache.ts"),C=A("./src/utils/mp4-tools.ts"),y=A("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(x){y.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var u=[{demux:D.default,remux:E.default},{demux:k.default,remux:T.default},{demux:N.default,remux:E.default},{demux:O.default,remux:E.default}],o=1024;u.forEach(function(x){var h=x.demux;o=Math.max(o,h.minProbeByteLength)});var l=function(){function x(c,s,a,v,p){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new _.default,this.observer=c,this.typeSupported=s,this.config=a,this.vendor=v,this.id=p}var h=x.prototype;return h.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},h.push=function(s,a,v,p){var b=this,P=v.transmuxing;P.executeStart=g();var F=new Uint8Array(s),H=this.cache,X=this.config,B=this.currentTransmuxState,U=this.transmuxConfig;p&&(this.currentTransmuxState=p);var z=d(F,a);if(z&&z.method==="AES-128"){var Z=this.getDecrypter();if(X.enableSoftwareAES){var ne=Z.softwareDecrypt(F,z.key.buffer,z.iv.buffer);if(!ne)return P.executeEnd=g(),w(v);F=new Uint8Array(ne)}else return this.decryptionPromise=Z.webCryptoDecrypt(F,z.key.buffer,z.iv.buffer).then(function(me){var Me=b.push(me,null,v);return b.decryptionPromise=null,Me}),this.decryptionPromise}var oe=p||B,Ce=oe.contiguous,he=oe.discontinuity,we=oe.trackSwitch,ve=oe.accurateTimeOffset,pe=oe.timeOffset,se=U.audioCodec,de=U.videoCodec,Le=U.defaultInitPts,We=U.duration,Te=U.initSegmentData;if((he||we)&&this.resetInitSegment(Te,se,de,We),he&&this.resetInitialTimestamp(Le),Ce||this.resetContiguity(),this.needsProbing(F,he,we)){if(H.dataLength){var xe=H.flush();F=Object(C.appendUint8Array)(xe,F)}this.configureTransmuxer(F,U)}var Oe=this.transmux(F,z,pe,ve,v),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,P.executeEnd=g(),Oe},h.flush=function(s){var a=this,v=s.transmuxing;v.executeStart=g();var p=this.decrypter,b=this.cache,P=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(s)});var H=[],X=P.timeOffset;if(p){var B=p.flush();B&&H.push(this.push(B,null,s))}var U=b.dataLength;b.reset();var z=this.demuxer,Z=this.remuxer;if(!z||!Z)return U>=o&&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"}),v.executeEnd=g(),[w(s)];var ne=z.flush(X);return f(ne)?ne.then(function(oe){return a.flushRemux(H,oe,s),H}):(this.flushRemux(H,ne,s),H)},h.flushRemux=function(s,a,v){var p=a.audioTrack,b=a.avcTrack,P=a.id3Track,F=a.textTrack,H=this.currentTransmuxState,X=H.accurateTimeOffset,B=H.timeOffset;y.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var U=this.remuxer.remux(p,b,P,F,B,X,!0,this.id);s.push({remuxResult:U,chunkMeta:v}),v.transmuxing.executeEnd=g()},h.resetInitialTimestamp=function(s){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(s),v.resetTimeStamp(s)},h.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(s,a,v,p){var b=this.demuxer,P=this.remuxer;if(!b||!P)return;b.resetInitSegment(a,v,p),P.resetInitSegment(s,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(s,a,v,p,b){var P;return a&&a.method==="SAMPLE-AES"?P=this.transmuxSampleAes(s,a,v,p,b):P=this.transmuxUnencrypted(s,v,p,b),P},h.transmuxUnencrypted=function(s,a,v,p){var b=this.demuxer.demux(s,a,!1,!this.config.progressive),P=b.audioTrack,F=b.avcTrack,H=b.id3Track,X=b.textTrack,B=this.remuxer.remux(P,F,H,X,a,v,!1,this.id);return{remuxResult:B,chunkMeta:p}},h.transmuxSampleAes=function(s,a,v,p,b){var P=this;return this.demuxer.demuxSampleAes(s,a,v).then(function(F){var H=P.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,p,!1,P.id);return{remuxResult:H,chunkMeta:b}})},h.configureTransmuxer=function(s,a){for(var v=this.config,p=this.observer,b=this.typeSupported,P=this.vendor,F=a.audioCodec,H=a.defaultInitPts,X=a.duration,B=a.initSegmentData,U=a.videoCodec,z,Z=0,ne=u.length;Z<ne;Z++)if(u[Z].demux.probe(s)){z=u[Z];break}z||(y.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),z={demux:k.default,remux:T.default});var oe=this.demuxer,Ce=this.remuxer,he=z.remux,we=z.demux;(!Ce||!(Ce instanceof he))&&(this.remuxer=new he(p,v,b,P)),(!oe||!(oe instanceof we))&&(this.demuxer=new we(p,v,b),this.probe=we.probe),this.resetInitSegment(B,F,U,X),this.resetInitialTimestamp(H)},h.needsProbing=function(s,a,v){return!this.demuxer||!this.remuxer||a||v},h.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new R.default(this.observer,this.config)),s},x}();function d(x,h){var c=null;return x.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var w=function(h){return{remuxResult:{},chunkMeta:h}};function f(x){return"then"in x&&x.then instanceof Function}var m=function(h,c,s,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=s,this.duration=a,this.defaultInitPts=v},L=function(h,c,s,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"discardEPB",function(){return w});var W=A("./src/demux/adts.ts"),M=A("./src/demux/mpegaudio.ts"),R=A("./src/demux/exp-golomb.ts"),N=A("./src/demux/id3.ts"),k=A("./src/demux/sample-aes.ts"),D=A("./src/events.ts"),O=A("./src/utils/mp4-tools.ts"),E=A("./src/utils/logger.ts"),T=A("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},C=function(){function f(L,x,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=x,this.typeSupported=h}f.probe=function(x){var h=f.syncOffset(x);return h<0?!1:(h&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(x){for(var h=Math.min(1e3,x.length-3*188),c=0;c<h;){if(x[c]===71&&x[c+188]===71&&x[c+2*188]===71)return c;c++}return-1},f.createTrack=function(x,h){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:_[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(x,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var x=this._audioTrack,h=this._avcTrack,c=this._id3Track;x&&(x.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(x,h,c,s){c===void 0&&(c=!1),s===void 0&&(s=!1),c||(this.sampleAes=null);var a,v=this._avcTrack,p=this._audioTrack,b=this._id3Track,P=v.pid,F=v.pesData,H=p.pid,X=b.pid,B=p.pesData,U=b.pesData,z=!1,Z=this.pmtParsed,ne=this._pmtId,oe=x.length;if(this.remainderData&&(x=Object(O.appendUint8Array)(this.remainderData,x),oe=x.length,this.remainderData=null),oe<188&&!s)return this.remainderData=x,{audioTrack:p,avcTrack:v,id3Track:b,textTrack:this._txtTrack};var Ce=Math.max(0,f.syncOffset(x));oe-=(oe+Ce)%188,oe<x.byteLength&&!s&&(this.remainderData=new Uint8Array(x.buffer,oe,x.buffer.byteLength-oe));for(var he=Ce;he<oe;he+=188)if(x[he]===71){var we=!!(x[he+1]&64),ve=((x[he+1]&31)<<8)+x[he+2],pe=(x[he+3]&48)>>4,se=void 0;if(pe>1){if(se=he+5+x[he+4],se===he+188)continue}else se=he+4;switch(ve){case P:we&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(x.subarray(se,he+188)),F.size+=he+188-se);break;case H:we&&(B&&(a=o(B))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),B={data:[],size:0}),B&&(B.data.push(x.subarray(se,he+188)),B.size+=he+188-se);break;case X:we&&(U&&(a=o(U))&&this.parseID3PES(a),U={data:[],size:0}),U&&(U.data.push(x.subarray(se,he+188)),U.size+=he+188-se);break;case 0:we&&(se+=x[se]+1),ne=this._pmtId=g(x,se);break;case ne:{we&&(se+=x[se]+1);var de=u(x,se,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);P=de.avc,P>0&&(v.pid=P),H=de.audio,H>0&&(p.pid=H,p.isAAC=de.isAAC),X=de.id3,X>0&&(b.pid=X),z&&!Z&&(E.logger.log("reparse from beginning"),z=!1,he=Ce-188),Z=this.pmtParsed=!0;break}case 17:case 8191:break;default:z=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,p.pesData=B,b.pesData=U;var Le={audioTrack:p,avcTrack:v,id3Track:b,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(Le),Le},m.flush=function(){var x=this.remainderData;this.remainderData=null;var h;return x?h=this.demux(x,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(x){var h=x.audioTrack,c=x.avcTrack,s=x.id3Track,a=c.pesData,v=h.pesData,p=s.pesData,b;a&&(b=o(a))?(this.parseAVCPES(b,!0),c.pesData=null):c.pesData=a,v&&(b=o(v))?(h.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),h.pesData=null):(v!=null&&v.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),p&&(b=o(p))?(this.parseID3PES(b),s.pesData=null):s.pesData=p},m.demuxSampleAes=function(x,h,c){var s=this.demux(x,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,h);return this.decrypt(s,a)},m.decrypt=function(x,h){return new Promise(function(c){var s=x.audioTrack,a=x.avcTrack;s.samples&&s.isAAC?h.decryptAacSamples(s.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(x)}):c(x)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,h){var c=this,s=this._avcTrack,a=this.parseAVCNALu(x.data),v=!1,p=this.avcSample,b,P=!1;x.data=null,p&&a.length&&!s.audFound&&(l(p,s),p=this.avcSample=y(!1,x.pts,x.dts,"")),a.forEach(function(F){switch(F.type){case 1:{b=!0,p||(p=c.avcSample=y(!0,x.pts,x.dts,"")),v&&(p.debug+="NDR "),p.frame=!0;var H=F.data;if(P&&H.length>4){var X=new R.default(H).readSliceType();(X===2||X===4||X===7||X===9)&&(p.key=!0)}break}case 5:b=!0,p||(p=c.avcSample=y(!0,x.pts,x.dts,"")),v&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{b=!0,v&&p&&(p.debug+="SEI ");var B=new R.default(w(F.data));B.readUByte();for(var U=0,z=0,Z=!1,ne=0;!Z&&B.bytesAvailable>1;){U=0;do ne=B.readUByte(),U+=ne;while(ne===255);z=0;do ne=B.readUByte(),z+=ne;while(ne===255);if(U===4&&B.bytesAvailable!==0){Z=!0;var oe=B.readUByte();if(oe===181){var Ce=B.readUShort();if(Ce===49){var he=B.readUInt();if(he===1195456820){var we=B.readUByte();if(we===3){for(var ve=B.readUByte(),pe=B.readUByte(),se=31&ve,de=[ve,pe],Le=0;Le<se;Le++)de.push(B.readUByte()),de.push(B.readUByte()),de.push(B.readUByte());d(c._txtTrack.samples,{type:3,pts:x.pts,bytes:de})}}}}}else if(U===5&&B.bytesAvailable!==0){if(Z=!0,z>16){for(var We=[],Te=0;Te<16;Te++)We.push(B.readUByte().toString(16)),(Te===3||Te===5||Te===7||Te===9)&&We.push("-");for(var xe=z-16,Oe=new Uint8Array(xe),ye=0;ye<xe;ye++)Oe[ye]=B.readUByte();d(c._txtTrack.samples,{pts:x.pts,payloadType:U,uuid:We.join(""),userData:Object(N.utf8ArrayToStr)(Oe),userDataBytes:Oe})}}else if(z<B.bytesAvailable)for(var me=0;me<z;me++)B.readUByte()}break}case 7:if(b=!0,P=!0,v&&p&&(p.debug+="SPS "),!s.sps){var Me=new R.default(F.data),Ne=Me.readSPS();s.width=Ne.width,s.height=Ne.height,s.pixelRatio=Ne.pixelRatio,s.sps=[F.data],s.duration=c._duration;for(var Ie=F.data.subarray(1,4),Ae="avc1.",Re=0;Re<3;Re++){var Ke=Ie[Re].toString(16);Ke.length<2&&(Ke="0"+Ke),Ae+=Ke}s.codec=Ae}break;case 8:b=!0,v&&p&&(p.debug+="PPS "),s.pps||(s.pps=[F.data]);break;case 9:b=!1,s.audFound=!0,p&&l(p,s),p=c.avcSample=y(!1,x.pts,x.dts,v?"AUD ":"");break;case 12:b=!1;break;default:b=!1,p&&(p.debug+="unknown NAL "+F.type+" ");break}if(p&&b){var ze=p.units;ze.push(F)}}),h&&p&&(l(p,s),this.avcSample=null)},m.getLastNalUnit=function(){var x,h=this.avcSample,c;if(!h||h.units.length===0){var s=this._avcTrack.samples;h=s[s.length-1]}if((x=h)!==null&&x!==void 0&&x.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(x){var h=x.byteLength,c=this._avcTrack,s=c.naluState||0,a=s,v=[],p=0,b,P,F,H=-1,X=0;for(s===-1&&(H=0,X=x[0]&31,s=0,p=1);p<h;){if(b=x[p++],!s){s=b?0:1;continue}if(s===1){s=b?0:2;continue}if(!b)s=3;else if(b===1){if(H>=0){var B={data:x.subarray(H,p-s-1),type:X};v.push(B)}else{var U=this.getLastNalUnit();if(U&&(a&&p<=4-a&&(U.state&&(U.data=U.data.subarray(0,U.data.byteLength-a))),P=p-s-1,P>0)){var z=new Uint8Array(U.data.byteLength+P);z.set(U.data,0),z.set(x.subarray(0,P),U.data.byteLength),U.data=z,U.state=0}}p<h?(F=x[p]&31,H=p,X=F,s=0):s=-1}else s=0}if(H>=0&&s>=0){var Z={data:x.subarray(H,h),type:X,state:s};v.push(Z)}if(v.length===0){var ne=this.getLastNalUnit();if(ne){var oe=new Uint8Array(ne.data.byteLength+x.byteLength);oe.set(ne.data,0),oe.set(x,ne.data.byteLength),ne.data=oe}}return c.naluState=s,v},m.parseAACPES=function(x){var h=0,c=this._audioTrack,s=this.aacOverFlow,a=x.data;if(s){this.aacOverFlow=null;var v=s.sample.unit.byteLength,p=Math.min(s.missing,v),b=v-p;s.sample.unit.set(a.subarray(0,p),b),c.samples.push(s.sample),h=s.missing}var P,F;for(P=h,F=a.length;P<F-1&&!W.isHeader(a,P);P++);if(P!==h){var H,X;if(P<F-1?(H="AAC PES did not start with ADTS header,offset:"+P,X=!1):(H="no ADTS header found in AAC PES",X=!0),E.logger.warn("parsing error:"+H),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:X,reason:H}),X)return}W.initTrackConfig(c,this.observer,a,P,this.audioCodec);var B;if(x.pts!==void 0)B=x.pts;else if(s){var U=W.getFrameDuration(c.samplerate);B=s.sample.pts+U}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var z=0;P<F;)if(W.isHeader(a,P)){if(P+5<F){var Z=W.appendFrame(c,a,P,B,z);if(Z)if(Z.missing)this.aacOverFlow=Z;else{P+=Z.length,z++;continue}}break}else P++},m.parseMPEGPES=function(x){var h=x.data,c=h.length,s=0,a=0,v=x.pts;if(v===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(M.isHeader(h,a)){var p=M.appendFrame(this._audioTrack,h,a,v,s);if(p)a+=p.length,s++;else break}else a++},m.parseID3PES=function(x){if(x.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},f}();C.minProbeByteLength=188;function y(f,m,L,x){return{key:f,frame:!1,pts:m,dts:L,units:[],debug:x,length:0}}function g(f,m){return(f[m+10]&31)<<8|f[m+11]}function u(f,m,L,x){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],s=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<s;){var v=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!x){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=v);break;case 21:h.id3===-1&&(h.id3=v);break;case 219:if(!x){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=v);break;case 3:case 4:L?h.audio===-1&&(h.audio=v,h.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((f[m+3]&15)<<8|f[m+4])+5}return h}function o(f){var m=0,L,x,h,c,s,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}L=a[0];var p=(L[0]<<16)+(L[1]<<8)+L[2];if(p===1){if(x=(L[4]<<8)+L[5],x&&x>f.size-6)return null;var b=L[7];b&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,b&64?(s=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-s>60*9e4&&(E.logger.warn(Math.round((c-s)/9e4)+"s delta between PTS and DTS, align them"),c=s)):s=c),h=L[8];var P=h+9;if(f.size<=P)return null;f.size-=P;for(var F=new Uint8Array(f.size),H=0,X=a.length;H<X;H++){L=a[H];var B=L.byteLength;if(P)if(P>B){P-=B;continue}else L=L.subarray(P),B-=P,P=0;F.set(L,m),m+=B}return x&&(x-=h+3),{data:F,pts:c,dts:s,len:x}}return null}function l(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var L=m.samples,x=L.length;if(x){var h=L[x-1];f.pts=h.pts,f.dts=h.dts}else{m.dropped++;return}}m.samples.push(f)}f.debug.length&&E.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function d(f,m){var L=f.length;if(L>0){if(m.pts>=f[L-1].pts)f.push(m);else for(var x=L-1;x>=0;x--)if(m.pts<f[x].pts){f.splice(x,0,m);break}}else f.push(m)}function w(f){for(var m=f.byteLength,L=[],x=1;x<m-2;)f[x]===0&&f[x+1]===0&&f[x+2]===3?(L.push(x+2),x+=2):x++;if(L.length===0)return f;var h=m-L.length,c=new Uint8Array(h),s=0;for(x=0;x<h;s++,x++)s===L[0]&&(s++,L.shift()),c[x]=f[s];return c}G.default=C},"./src/errors.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"ErrorTypes",function(){return W}),A.d(G,"ErrorDetails",function(){return M});var W;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(W||(W={}));var M;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"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(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return f});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W),R=A("./src/loader/playlist-loader.ts"),N=A("./src/loader/key-loader.ts"),k=A("./src/controller/id3-track-controller.ts"),D=A("./src/controller/latency-controller.ts"),O=A("./src/controller/level-controller.ts"),E=A("./src/controller/fragment-tracker.ts"),T=A("./src/controller/stream-controller.ts"),_=A("./src/is-supported.ts"),C=A("./src/utils/logger.ts"),y=A("./src/config.ts"),g=A("./node_modules/eventemitter3/index.js"),u=A.n(g),o=A("./src/events.ts"),l=A("./src/errors.ts");function d(m,L){for(var x=0;x<L.length;x++){var h=L[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function w(m,L,x){return L&&d(m.prototype,L),x&&d(m,x),m}var f=function(){m.isSupported=function(){return Object(_.isSupported)()};function m(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(y.mergeConfig)(m.DefaultConfig,x);this.userConfig=x,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(y.enableStreamingMode)(h);var c=h.abrController,s=h.bufferController,a=h.capLevelController,v=h.fpsController,p=this.abrController=new c(this),b=this.bufferController=new s(this),P=this.capLevelController=new a(this),F=new v(this),H=new R.default(this),X=new N.default(this),B=new k.default(this),U=this.levelController=new O.default(this),z=new E.FragmentTracker(this),Z=this.streamController=new T.default(this,z);P.setStreamController(Z),F.setStreamController(Z);var ne=[U,Z];this.networkControllers=ne;var oe=[H,X,p,b,P,F,B,z];this.audioTrackController=this.createController(h.audioTrackController,null,ne),this.createController(h.audioStreamController,z,ne),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ne),this.createController(h.subtitleStreamController,z,ne),this.createController(h.timelineController,null,oe),this.emeController=this.createController(h.emeController,null,oe),this.cmcdController=this.createController(h.cmcdController,null,oe),this.latencyController=this.createController(D.default,null,oe),this.coreComponents=oe}var L=m.prototype;return L.createController=function(h,c,s){if(h){var a=c?new h(this,c):new h(this);return s&&s.push(a),a}return null},L.on=function(h,c,s){s===void 0&&(s=this),this._emitter.on(h,c,s)},L.once=function(h,c,s){s===void 0&&(s=this),this._emitter.once(h,c,s)},L.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},L.off=function(h,c,s,a){s===void 0&&(s=this),this._emitter.off(h,c,s,a)},L.listeners=function(h){return this._emitter.listeners(h)},L.emit=function(h,c,s){return this._emitter.emit(h,c,s)},L.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(s){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:s})}return!1},L.listenerCount=function(h){return this._emitter.listenerCount(h)},L.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},L.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},L.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(h){this.stopLoad();var c=this.media,s=this.url,a=this.url=W.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},L.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},L.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},L.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},L.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},w(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var s=h.length,a=0;a<s;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,s;return c===-1&&h&&h.length?s=h.length-1:s=c,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:y.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();f.defaultConfig=void 0},"./src/is-supported.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isSupported",function(){return R}),A.d(G,"changeTypeSupported",function(){return N});var W=A("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var k=Object(W.getMediaSource)();if(!k)return!1;var D=M(),O=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!O&&!!E}function N(){var k,D=M();return typeof(D==null||((k=D.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return C}),A.d(G,"LoadError",function(){return g});var W=A("./src/polyfills/number.ts"),M=A("./src/errors.ts");function R(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,E(u,o)}function N(u){var o=typeof Map=="function"?new Map:void 0;return N=function(d){if(d===null||!O(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,w)}function w(){return k(d,arguments,T(this).constructor)}return w.prototype=Object.create(d.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),E(w,d)},N(u)}function k(u,o,l){return D()?k=Reflect.construct:k=function(w,f,m){var L=[null];L.push.apply(L,f);var x=Function.bind.apply(w,L),h=new x;return m&&E(h,m.prototype),h},k.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(u){return!1}}function O(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function E(u,o){return E=Object.setPrototypeOf||function(d,w){return d.__proto__=w,d},E(u,o)}function T(u){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},T(u)}var _=Math.pow(2,17),C=function(){function u(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,w){var f=this,m=d.url;if(!m)return Promise.reject(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var L=this.config,x=L.fLoader,h=L.loader;return new Promise(function(c,s){f.loader&&f.loader.destroy();var a=f.loader=d.loader=x?new x(L):new h(L),v=y(d),p={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};d.stats=a.stats,a.load(v,p,{onSuccess:function(P,F,H,X){f.resetLoader(d,a),c({frag:d,part:null,payload:P.data,networkDetails:X})},onError:function(P,F,H){f.resetLoader(d,a),s(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:P,networkDetails:H}))},onAbort:function(P,F,H){f.resetLoader(d,a),s(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:H}))},onTimeout:function(P,F,H){f.resetLoader(d,a),s(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:H}))},onProgress:function(P,F,H,X){w&&w({frag:d,part:null,payload:H,networkDetails:X})}})})},o.loadPart=function(d,w,f){var m=this;this.abort();var L=this.config,x=L.fLoader,h=L.loader;return new Promise(function(c,s){m.loader&&m.loader.destroy();var a=m.loader=d.loader=x?new x(L):new h(L),v=y(d,w),p={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};w.stats=a.stats,a.load(v,p,{onSuccess:function(P,F,H,X){m.resetLoader(d,a),m.updateStatsFromPart(d,w);var B={frag:d,part:w,payload:P.data,networkDetails:X};f(B),c(B)},onError:function(P,F,H){m.resetLoader(d,a),s(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:w,response:P,networkDetails:H}))},onAbort:function(P,F,H){d.stats.aborted=w.stats.aborted,m.resetLoader(d,a),s(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:w,networkDetails:H}))},onTimeout:function(P,F,H){m.resetLoader(d,a),s(new g({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:w,networkDetails:H}))}})})},o.updateStatsFromPart=function(d,w){var f=d.stats,m=w.stats,L=m.total;if(f.loaded+=m.loaded,L){var x=Math.round(d.duration/w.duration),h=Math.min(Math.round(f.loaded/L),x),c=x-h,s=c*Math.round(f.loaded/h);f.total=f.loaded+s}else f.total=Math.max(f.loaded,f.total);var a=f.loading,v=m.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(d,w){d.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},u}();function y(u,o){o===void 0&&(o=null);var l=o||u,d={frag:u,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},w=l.byteRangeStartOffset,f=l.byteRangeEndOffset;return Object(W.isFiniteNumber)(w)&&Object(W.isFiniteNumber)(f)&&(d.rangeStart=w,d.rangeEnd=f),d}var g=function(u){R(o,u);function o(l){for(var d,w=arguments.length,f=new Array(w>1?w-1:0),m=1;m<w;m++)f[m-1]=arguments[m];return d=u.call.apply(u,[this].concat(f))||this,d.data=void 0,d.data=l,d}return o}(N(Error))},"./src/loader/fragment.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"ElementaryStreamTypes",function(){return C}),A.d(G,"BaseSegment",function(){return y}),A.d(G,"Fragment",function(){return g}),A.d(G,"Part",function(){return u});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(M),N=A("./src/utils/logger.ts"),k=A("./src/loader/level-key.ts"),D=A("./src/loader/load-stats.ts");function O(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,E(o,l)}function E(o,l){return E=Object.setPrototypeOf||function(w,f){return w.__proto__=f,w},E(o,l)}function T(o,l){for(var d=0;d<l.length;d++){var w=l[d];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function _(o,l,d){return l&&T(o.prototype,l),d&&T(o,d),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var y=function(){function o(d){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[C.AUDIO]=null,w[C.VIDEO]=null,w[C.AUDIOVIDEO]=null,w),this.baseurl=d}var l=o.prototype;return l.setByteRange=function(w,f){var m=w.split("@",2),L=[];m.length===1?L[0]=f?f.byteRangeEndOffset:0:L[0]=parseInt(m[1]),L[1]=parseInt(m[0])+L[0],this._byteRange=L},_(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),g=function(o){O(l,o);function l(w,f){var m;return m=o.call(this,f)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new D.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=w,m}var d=l.prototype;return d.createInitializationVector=function(f){for(var m=new Uint8Array(16),L=12;L<16;L++)m[L]=f>>8*(15-L)&255;return m},d.setDecryptDataFromLevelKey=function(f,m){var L=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(L=k.LevelKey.fromURI(f.uri),L.method=f.method,L.iv=this.createInitializationVector(m),L.keyFormat="identity"),L},d.setElementaryStreamInfo=function(f,m,L,x,h,c){c===void 0&&(c=!1);var s=this.elementaryStreams,a=s[f];if(!a){s[f]={startPTS:m,endPTS:L,startDTS:x,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,h)},d.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null},_(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(W.isFiniteNumber)(this.programDateTime))return null;var f=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),l}(y),u=function(o){O(l,o);function l(d,w,f,m,L){var x;x=o.call(this,f)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new D.LoadStats,x.duration=d.decimalFloatingPoint("DURATION"),x.gap=d.bool("GAP"),x.independent=d.bool("INDEPENDENT"),x.relurl=d.enumeratedString("URI"),x.fragment=w,x.index=m;var h=d.enumeratedString("BYTERANGE");return h&&x.setByteRange(h,L),L&&(x.fragOffset=L.fragOffset+L.duration),x}return _(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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),l}(y)},"./src/loader/key-loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return N});var W=A("./src/events.ts"),M=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),N=function(){function k(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var D=k.prototype;return D._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var T=this.loaders[E];T&&T.destroy()}this.loaders={}},D.onKeyLoading=function(E,T){var _=T.frag,C=_.type,y=this.loaders[C];if(!_.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=_.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(y&&(R.logger.warn("abort previous key loader for type:"+C),y.abort()),!g){R.logger.warn("key uri is falsy");return}var o=u.loader,l=_.loader=this.loaders[C]=new o(u);this.decrypturl=g,this.decryptkey=null;var d={url:g,frag:_,responseType:"arraybuffer"},w={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,w,f)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:_}))},D.loadsuccess=function(E,T,_){var C=_.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(E.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:C})},D.loaderror=function(E,T){var _=T.frag,C=_.loader;C&&C.abort(),delete this.loaders[_.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:E})},D.loadtimeout=function(E,T){var _=T.frag,C=_.loader;C&&C.abort(),delete this.loaders[_.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},k}()},"./src/loader/level-details.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"LevelDetails",function(){return k});var W=A("./src/polyfills/number.ts");function M(D,O){for(var E=0;E<O.length;E++){var T=O[E];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(D,T.key,T)}}function R(D,O,E){return O&&M(D.prototype,O),E&&M(D,E),D}var N=10,k=function(){function D(E){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=E}var O=D.prototype;return O.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-T.lastPartSn,C=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!C||!!_,this.advanced=this.endSN>T.endSN||_>0||_===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},R(D,[{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||N}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var _=this.driftEnd-this.driftStart;return _*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),D}()},"./src/loader/level-key.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"LevelKey",function(){return k});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W);function R(D,O){for(var E=0;E<O.length;E++){var T=O[E];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(D,T.key,T)}}function N(D,O,E){return O&&R(D.prototype,O),E&&R(D,E),D}var k=function(){D.fromURL=function(E,T){return new D(E,T)},D.fromURI=function(E){return new D(E)};function D(O,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(W.buildAbsoluteURL)(O,E,{alwaysNormalize:!0}):this._uri=O}return N(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"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(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return l});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),R=A.n(M),N=A("./src/loader/fragment.ts"),k=A("./src/loader/level-details.ts"),D=A("./src/loader/level-key.ts"),O=A("./src/utils/attr-list.ts"),E=A("./src/utils/logger.ts"),T=A("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,y=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var x,h;return u.test((x=(h=M.parseURL(L))===null||h===void 0?void 0:h.path)!=null?x:"")}var l=function(){function L(){}return L.findGroup=function(h,c){for(var s=0;s<h.length;s++){var a=h[s];if(a.id===c)return a}},L.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var s=c.shift()+".";return s+=parseInt(c.shift()).toString(16),s+=("000"+parseInt(c.shift()).toString(16)).substr(-4),s}return h},L.resolve=function(h,c){return M.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(h,c){var s=[],a={},v=!1;_.lastIndex=0;for(var p;(p=_.exec(h))!=null;)if(p[1]){var b=new O.AttrList(p[1]),P={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:L.resolve(p[2],c)},F=b.decimalResolution("RESOLUTION");F&&(P.width=F.width,P.height=F.height),d((b.CODECS||"").split(/[ ,]+/).filter(function(X){return X}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=L.convertAVC1ToAVCOTI(P.videoCodec)),s.push(P)}else if(p[3]){var H=new O.AttrList(p[3]);H["DATA-ID"]&&(v=!0,a[H["DATA-ID"]]=H)}return{levels:s,sessionData:v?a:null}},L.parseMasterPlaylistMedia=function(h,c,s,a){a===void 0&&(a=[]);var v,p=[],b=0;for(C.lastIndex=0;(v=C.exec(h))!==null;){var P=new O.AttrList(v[1]);if(P.TYPE===s){var F={attrs:P,bitrate:0,id:b++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:s,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?L.resolve(P.URI,c):""};if(a.length){var H=L.findGroup(a,F.groupId)||a[0];w(F,H,"audioCodec"),w(F,H,"textCodec")}p.push(F)}}return p},L.parseLevelPlaylist=function(h,c,s,a,v){var p=new k.LevelDetails(c),b=p.fragments,P=null,F=0,H=0,X=0,B=0,U=null,z=new N.Fragment(a,c),Z,ne,oe,Ce=-1,he=!1;for(y.lastIndex=0,p.m3u8=h;(Z=y.exec(h))!==null;){he&&(he=!1,z=new N.Fragment(a,c),z.start=X,z.sn=F,z.cc=B,z.level=s,P&&(z.initSegment=P,z.rawProgramDateTime=P.rawProgramDateTime));var we=Z[1];if(we){z.duration=parseFloat(we);var ve=(" "+Z[2]).slice(1);z.title=ve||null,z.tagList.push(ve?["INF",we,ve]:["INF",we])}else if(Z[3])Object(W.isFiniteNumber)(z.duration)&&(z.start=X,oe&&(z.levelkey=oe),z.sn=F,z.level=s,z.cc=B,z.urlId=v,b.push(z),z.relurl=(" "+Z[3]).slice(1),m(z,U),U=z,X+=z.duration,F++,H=0,he=!0);else if(Z[4]){var pe=(" "+Z[4]).slice(1);U?z.setByteRange(pe,U):z.setByteRange(pe)}else if(Z[5])z.rawProgramDateTime=(" "+Z[5]).slice(1),z.tagList.push(["PROGRAM-DATE-TIME",z.rawProgramDateTime]),Ce===-1&&(Ce=b.length);else{if(Z=Z[0].match(g),!Z){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ne=1;ne<Z.length&&!(typeof Z[ne]!="undefined");ne++);var se=(" "+Z[ne]).slice(1),de=(" "+Z[ne+1]).slice(1),Le=Z[ne+2]?(" "+Z[ne+2]).slice(1):"";switch(se){case"PLAYLIST-TYPE":p.type=de.toUpperCase();break;case"MEDIA-SEQUENCE":F=p.startSN=parseInt(de);break;case"SKIP":{var We=new O.AttrList(de),Te=We.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(Te)){p.skippedSegments=Te;for(var xe=Te;xe--;)b.unshift(null);F+=Te}var Oe=We.enumeratedString("RECENTLY-REMOVED-DATERANGES");Oe&&(p.recentlyRemovedDateranges=Oe.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(de);break;case"VERSION":p.version=parseInt(de);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(de||Le)&&z.tagList.push(Le?[de,Le]:[de]);break;case"DIS":B++;case"GAP":z.tagList.push([se]);break;case"BITRATE":z.tagList.push([se,de]);break;case"DISCONTINUITY-SEQ":B=parseInt(de);break;case"KEY":{var ye,me=new O.AttrList(de),Me=me.enumeratedString("METHOD"),Ne=me.URI,Ie=me.hexadecimalInteger("IV"),Ae=me.enumeratedString("KEYFORMATVERSIONS"),Re=me.enumeratedString("KEYID"),Ke=(ye=me.enumeratedString("KEYFORMAT"))!=null?ye:"identity",ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ze.indexOf(Ke)>-1){E.logger.warn("Keyformat "+Ke+" is not supported from the manifest");continue}else if(Ke!=="identity")continue;Me&&(oe=D.LevelKey.fromURL(c,Ne),Ne&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(oe.method=Me,oe.keyFormat=Ke,Re&&(oe.keyID=Re),Ae&&(oe.keyFormatVersions=Ae),oe.iv=Ie));break}case"START":{var Ge=new O.AttrList(de),He=Ge.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(He)&&(p.startTimeOffset=He);break}case"MAP":{var ot=new O.AttrList(de);z.relurl=ot.URI,ot.BYTERANGE&&z.setByteRange(ot.BYTERANGE),z.level=s,z.sn="initSegment",oe&&(z.levelkey=oe),z.initSegment=null,P=z,he=!0;break}case"SERVER-CONTROL":{var Xe=new O.AttrList(de);p.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Be=new O.AttrList(de);p.partTarget=Be.decimalFloatingPoint("PART-TARGET");break}case"PART":{var be=p.partList;be||(be=p.partList=[]);var qe=H>0?be[be.length-1]:void 0,Ye=H++,Se=new N.Part(new O.AttrList(de),z,c,Ye,qe);be.push(Se),z.duration+=Se.duration;break}case"PRELOAD-HINT":{var ke=new O.AttrList(de);p.preloadHint=ke;break}case"RENDITION-REPORT":{var le=new O.AttrList(de);p.renditionReports=p.renditionReports||[],p.renditionReports.push(le);break}default:E.logger.warn("line parsed but not handled: "+Z);break}}}U&&!U.relurl?(b.pop(),X-=U.duration,p.partList&&(p.fragmentHint=U)):p.partList&&(m(z,U),z.cc=B,p.fragmentHint=z);var ie=b.length,ee=b[0],Y=b[ie-1];if(X+=p.skippedSegments*p.targetduration,X>0&&ie&&Y){p.averagetargetduration=X/ie;var $=Y.sn;p.endSN=$!=="initSegment"?$:0,ee&&(p.startCC=ee.cc,ee.initSegment||p.fragments.every(function(J){return J.relurl&&o(J.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),z=new N.Fragment(a,c),z.relurl=Y.relurl,z.level=s,z.sn="initSegment",ee.initSegment=z,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(X+=p.fragmentHint.duration),p.totalduration=X,p.endCC=B,Ce>0&&f(b,Ce),p},L}();function d(L,x){["video","audio","text"].forEach(function(h){var c=L.filter(function(a){return Object(T.isCodecType)(a,h)});if(c.length){var s=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[h+"Codec"]=s.length>0?s[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),x.unknownCodecs=L}function w(L,x,h){var c=x[h];c&&(L[h]=c)}function f(L,x){for(var h=L[x],c=x;c--;){var s=L[c];if(!s)return;s.programDateTime=h.programDateTime-s.duration*1e3,h=s}}function m(L,x){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):x!=null&&x.programDateTime&&(L.programDateTime=x.endProgramDateTime),Object(W.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),R=A("./src/errors.ts"),N=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),D=A("./src/loader/m3u8-parser.ts"),O=A("./src/types/loader.ts"),E=A("./src/utils/attr-list.ts");function T(y){var g=y.type;switch(g){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function _(y,g){var u=y.url;return(u===void 0||u.indexOf("data:")===0)&&(u=g.url),u}var C=function(){function y(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var g=y.prototype;return g.registerListeners=function(){var o=this.hls;o.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(o){var l=this.hls.config,d=l.pLoader,w=l.loader,f=d||w,m=new f(l);return o.loader=m,this.loaders[o.type]=m,m},g.getInternalLoader=function(o){return this.loaders[o.type]},g.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},g.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(o,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},g.onLevelLoading=function(o,l){var d=l.id,w=l.level,f=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:null,level:w,responseType:"text",type:O.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},g.onAudioTrackLoading=function(o,l){var d=l.id,w=l.groupId,f=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},g.onSubtitleTrackLoading=function(o,l){var d=l.id,w=l.groupId,f=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:w,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},g.load=function(o){var l,d=this.hls.config,w=this.getInternalLoader(o);if(w){var f=w.context;if(f&&f.url===o.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var m,L,x,h;switch(o.type){case O.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,L=d.manifestLoadingTimeOut,x=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:m=0,L=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,L=d.levelLoadingTimeOut,x=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var s=c.partTarget,a=c.targetduration;s&&a&&(L=Math.min(Math.max(s*3,a*.8)*1e3,L))}}var v={timeout:L,maxRetry:m,retryDelay:x,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,v,p)},g.loadsuccess=function(o,l,d,w){if(w===void 0&&(w=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,l,d,w);return}this.resetInternalLoader(d.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",w);return}l.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,d,w):this.handleMasterPlaylist(o,l,d,w)},g.loaderror=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,o)},g.loadtimeout=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},g.handleMasterPlaylist=function(o,l,d,w){var f=this.hls,m=o.data,L=_(o,d),x=D.default.parseMasterPlaylist(m,L),h=x.levels,c=x.sessionData;if(!h.length){this.handleManifestParsingError(o,d,"no level found in manifest",w);return}var s=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),v=D.default.parseMasterPlaylistMedia(m,L,"AUDIO",s),p=D.default.parseMasterPlaylistMedia(m,L,"SUBTITLES",a),b=D.default.parseMasterPlaylistMedia(m,L,"CLOSED-CAPTIONS");if(v.length){var P=v.some(function(F){return!F.url});!P&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}f.trigger(M.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:p,captions:b,url:L,stats:l,networkDetails:w,sessionData:c})},g.handleTrackOrLevelPlaylist=function(o,l,d,w){var f=this.hls,m=d.id,L=d.level,x=d.type,h=_(o,d),c=Object(W.isFiniteNumber)(m)?m:0,s=Object(W.isFiniteNumber)(L)?L:c,a=T(d),v=D.default.parseLevelPlaylist(o.data,h,s,a,c);if(!v.fragments.length){f.trigger(M.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(x===O.PlaylistContextType.MANIFEST){var p={attrs:new E.AttrList({}),bitrate:0,details:v,name:"",url:h};f.trigger(M.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:l,networkDetails:w,sessionData:null})}if(l.parsing.end=performance.now(),v.needSidxRanges){var b,P=(b=v.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:P,isSidxRequest:!0,type:x,level:L,levelDetails:v,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=v,this.handlePlaylistLoaded(o,l,d,w)},g.handleSidxRequest=function(o,l){var d=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var w=d.references,f=l.levelDetails;w.forEach(function(m,L){var x=m.info,h=f.fragments[L];h.byteRange.length===0&&h.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(o,l,d,w){this.hls.trigger(M.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:l,networkDetails:w})},g.handleNetworkError=function(o,l,d,w){d===void 0&&(d=!1),N.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=R.ErrorDetails.UNKNOWN,m=!1,L=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:f=d?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case O.PlaylistContextType.LEVEL:f=d?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.AUDIO_TRACK:f=d?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:f=d?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}L&&this.resetInternalLoader(o.type);var x={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:L,context:o,networkDetails:l};w&&(x.response=w),this.hls.trigger(M.Events.ERROR,x)},g.handlePlaylistLoaded=function(o,l,d,w){var f=d.type,m=d.level,L=d.id,x=d.groupId,h=d.loader,c=d.levelDetails,s=d.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",w);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:c,level:m||0,id:L||0,stats:l,networkDetails:w,deliveryDirectives:s});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:x||"",stats:l,networkDetails:w,deliveryDirectives:s});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:x||"",stats:l,networkDetails:w,deliveryDirectives:s});break}},y}();G.default=C},"./src/polyfills/number.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isFiniteNumber",function(){return W}),A.d(G,"MAX_SAFE_INTEGER",function(){return M});var W=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(te,G,A){"use strict";A.r(G);var W=function(){function M(){}return M.getSilentFrame=function(N,k){switch(N){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(k===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(k===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},M}();G.default=W},"./src/remux/mp4-generator.ts":function(te,G,A){"use strict";A.r(G);var W=Math.pow(2,32)-1,M=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in R.types)R.types.hasOwnProperty(k)&&(R.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var D=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),O=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:D,audio:O};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=T,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),y=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,_,y,_,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,E))},R.box=function(k){for(var D=8,O=arguments.length,E=new Array(O>1?O-1:0),T=1;T<O;T++)E[T-1]=arguments[T];for(var _=E.length,C=_;_--;)D+=E[_].byteLength;var y=new Uint8Array(D);for(y[0]=D>>24&255,y[1]=D>>16&255,y[2]=D>>8&255,y[3]=D&255,y.set(k,4),_=0,D=8;_<C;_++)y.set(E[_],D),D+=E[_].byteLength;return y},R.hdlr=function(k){return R.box(R.types.hdlr,R.HDLR_TYPES[k])},R.mdat=function(k){return R.box(R.types.mdat,k)},R.mdhd=function(k,D){D*=k;var O=Math.floor(D/(W+1)),E=Math.floor(D%(W+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,O>>24,O>>16&255,O>>8&255,O&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},R.mdia=function(k){return R.box(R.types.mdia,R.mdhd(k.timescale,k.duration),R.hdlr(k.type),R.minf(k))},R.mfhd=function(k){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},R.minf=function(k){return k.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(k)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(k))},R.moof=function(k,D,O){return R.box(R.types.moof,R.mfhd(k),R.traf(O,D))},R.moov=function(k){for(var D=k.length,O=[];D--;)O[D]=R.trak(k[D]);return R.box.apply(null,[R.types.moov,R.mvhd(k[0].timescale,k[0].duration)].concat(O).concat(R.mvex(k)))},R.mvex=function(k){for(var D=k.length,O=[];D--;)O[D]=R.trex(k[D]);return R.box.apply(null,[R.types.mvex].concat(O))},R.mvhd=function(k,D){D*=k;var O=Math.floor(D/(W+1)),E=Math.floor(D%(W+1)),T=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,O>>24,O>>16&255,O>>8&255,O&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,T)},R.sdtp=function(k){var D=k.samples||[],O=new Uint8Array(4+D.length),E,T;for(E=0;E<D.length;E++)T=D[E].flags,O[E+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return R.box(R.types.sdtp,O)},R.stbl=function(k){return R.box(R.types.stbl,R.stsd(k),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(k){var D=[],O=[],E,T,_;for(E=0;E<k.sps.length;E++)T=k.sps[E],_=T.byteLength,D.push(_>>>8&255),D.push(_&255),D=D.concat(Array.prototype.slice.call(T));for(E=0;E<k.pps.length;E++)T=k.pps[E],_=T.byteLength,O.push(_>>>8&255),O.push(_&255),O=O.concat(Array.prototype.slice.call(T));var C=R.box(R.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|k.sps.length].concat(D).concat([k.pps.length]).concat(O))),y=k.width,g=k.height,u=k.pixelRatio[0],o=k.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,y>>8&255,y&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(k){var D=k.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(k.config).concat([6,1,2]))},R.mp4a=function(k){var D=k.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),R.box(R.types.esds,R.esds(k)))},R.mp3=function(k){var D=k.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},R.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(k)):R.box(R.types.stsd,R.STSD,R.mp4a(k)):R.box(R.types.stsd,R.STSD,R.avc1(k))},R.tkhd=function(k){var D=k.id,O=k.duration*k.timescale,E=k.width,T=k.height,_=Math.floor(O/(W+1)),C=Math.floor(O%(W+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,T>>8&255,T&255,0,0]))},R.traf=function(k,D){var O=R.sdtp(k),E=k.id,T=Math.floor(D/(W+1)),_=Math.floor(D%(W+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,_>>24,_>>16&255,_>>8&255,_&255])),R.trun(k,O.length+16+20+8+16+8+8),O)},R.trak=function(k){return k.duration=k.duration||4294967295,R.box(R.types.trak,R.tkhd(k),R.mdia(k))},R.trex=function(k){var D=k.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(k,D){var O=k.samples||[],E=O.length,T=12+16*E,_=new Uint8Array(T),C,y,g,u,o,l;for(D+=8+T,_.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),C=0;C<E;C++)y=O[C],g=y.duration,u=y.size,o=y.flags,l=y.cts,_.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*C);return R.box(R.types.trun,_)},R.initSegment=function(k){R.types||R.init();var D=R.moov(k),O=new Uint8Array(R.FTYP.byteLength+D.byteLength);return O.set(R.FTYP),O.set(D,R.FTYP.byteLength),O},R}();M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0,G.default=M},"./src/remux/mp4-remuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return l}),A.d(G,"normalizePts",function(){return d});var W=A("./src/polyfills/number.ts"),M=A("./src/remux/aac-helper.ts"),R=A("./src/remux/mp4-generator.ts"),N=A("./src/events.ts"),k=A("./src/errors.ts"),D=A("./src/utils/logger.ts"),O=A("./src/types/loader.ts"),E=A("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(L[c]=h[c])}return L},T.apply(this,arguments)}var _=10*1e3,C=1024,y=1152,g=null,u=null,o=!1,l=function(){function L(h,c,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=s,this.ISGenerated=!1,g===null){var v=navigator.userAgent||"",p=v.match(/Chrome\/(\d+)/i);g=p?parseInt(p[1]):0}if(u===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);u=b?parseInt(b[1]):0}o=!!g&&g<75||!!u&&u<600}var x=L.prototype;return x.destroy=function(){},x.resetTimeStamp=function(c){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},x.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(c){var s=!1,a=c.reduce(function(v,p){var b=p.pts-v;return b<-4294967296?(s=!0,d(v,p.pts)):b>0?v:p.pts},c[0].pts);return s&&D.logger.debug("PTS rollover detected"),a},x.remux=function(c,s,a,v,p,b,P,F){var H,X,B,U,z,Z,ne=p,oe=p,Ce=c.pid>-1,he=s.pid>-1,we=s.samples.length,ve=c.samples.length>0,pe=we>1,se=(!Ce||ve)&&(!he||pe)||this.ISGenerated||P;if(se){this.ISGenerated||(B=this.generateIS(c,s,p));var de=this.isVideoContiguous,Le=-1;if(pe&&(Le=w(s.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(Z=!0,Le>0){D.logger.warn("[mp4-remuxer]: Dropped "+Le+" out of "+we+" video samples due to a missing keyframe");var We=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(Le),s.dropped+=Le,oe+=(s.samples[0].pts-We)/(s.timescale||9e4)}else Le===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+we+" video samples"),Z=!1);if(this.ISGenerated){if(ve&&pe){var Te=this.getVideoStartPts(s.samples),xe=d(c.samples[0].pts,Te)-Te,Oe=xe/s.inputTimeScale;ne+=Math.max(0,Oe),oe+=Math.max(0,-Oe)}if(ve){if(c.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(c,s,p)),X=this.remuxAudio(c,ne,this.isAudioContiguous,b,he||pe||F===O.PlaylistLevelType.AUDIO?oe:void 0),pe){var ye=X?X.endPTS-X.startPTS:0;s.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(c,s,p)),H=this.remuxVideo(s,oe,de,ye)}}else pe&&(H=this.remuxVideo(s,oe,de,0));H&&(H.firstKeyFrame=Le,H.independent=Le!==-1)}}return this.ISGenerated&&(a.samples.length&&(z=this.remuxID3(a,p)),v.samples.length&&(U=this.remuxText(v,p))),{audio:X,video:H,initSegment:B,independent:Z,text:U,id3:z}},x.generateIS=function(c,s,a){var v=c.samples,p=s.samples,b=this.typeSupported,P={},F=!Object(W.isFiniteNumber)(this._initPTS),H="audio/mp4",X,B,U;if(F&&(X=B=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(b.mpeg?(H="audio/mpeg",c.codec=""):b.mp3&&(c.codec="mp3")),P.audio={id:"audio",container:H,codec:c.codec,initSegment:!c.isAAC&&b.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(U=c.inputTimeScale,X=B=v[0].pts-Math.round(U*a))),s.sps&&s.pps&&p.length&&(s.timescale=s.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:R.default.initSegment([s]),metadata:{width:s.width,height:s.height}},F)){U=s.inputTimeScale;var z=this.getVideoStartPts(p),Z=Math.round(U*a);B=Math.min(B,d(p[0].dts,z)-Z),X=Math.min(X,z-Z)}if(Object.keys(P).length)return this.ISGenerated=!0,F&&(this._initPTS=X,this._initDTS=B),{tracks:P,initPTS:X,timescale:U}},x.remuxVideo=function(c,s,a,v){var p=c.inputTimeScale,b=c.samples,P=[],F=b.length,H=this._initPTS,X=this.nextAvcDts,B=8,U,z,Z,ne=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Ce=0,he=!1;if(!a||X===null){var we=s*p,ve=b[0].pts-d(b[0].dts,b[0].pts);X=we-ve}for(var pe=0;pe<F;pe++){var se=b[pe];if(se.pts=d(se.pts-H,X),se.dts=d(se.dts-H,X),se.dts>se.pts){var de=9e4*.2;Ce=Math.max(Math.min(Ce,se.pts-se.dts),-1*de)}se.dts<b[pe>0?pe-1:pe].dts&&(he=!0)}he&&b.sort(function(st,pt){var tt=st.dts-pt.dts,Rt=st.pts-pt.pts;return tt||Rt}),z=b[0].dts,Z=b[b.length-1].dts;var Le=Math.round((Z-z)/(F-1));if(Ce<0){if(Ce<Le*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-Le,!0)+" ms");for(var We=Ce,Te=0;Te<F;Te++)b[Te].dts=We=Math.max(We,b[Te].pts-Le),b[Te].pts=Math.max(We,b[Te].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Ce,!0)+" ms to overcome this issue");for(var xe=0;xe<F;xe++)b[xe].dts=b[xe].dts+Ce}z=b[0].dts}if(a){var Oe=z-X,ye=Oe>Le,me=Oe<-1;if(ye||me){ye?D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Oe,!0)+" ms ("+Oe+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Oe,!0)+" ms ("+Oe+"dts) overlapping between fragments detected"),z=X;var Me=b[0].pts-Oe;b[0].dts=z,b[0].pts=Me,D.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(Me,!0)+"/"+Object(E.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Oe,!0)+" ms")}}o&&(z=Math.max(0,z));for(var Ne=0,Ie=0,Ae=0;Ae<F;Ae++){for(var Re=b[Ae],Ke=Re.units,ze=Ke.length,Ge=0,He=0;He<ze;He++)Ge+=Ke[He].data.length;Ie+=Ge,Ne+=ze,Re.length=Ge,Re.dts=Math.max(Re.dts,z),Re.pts=Math.max(Re.pts,Re.dts,0),ne=Math.min(Re.pts,ne),oe=Math.max(Re.pts,oe)}Z=b[F-1].dts;var ot=Ie+4*Ne+8,Xe;try{Xe=new Uint8Array(ot)}catch(st){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ot,reason:"fail allocating video mdat "+ot});return}var Be=new DataView(Xe.buffer);Be.setUint32(0,ot),Xe.set(R.default.types.mdat,4);for(var be=0;be<F;be++){for(var qe=b[be],Ye=qe.units,Se=0,ke=0,le=Ye.length;ke<le;ke++){var ie=Ye[ke],ee=ie.data,Y=ie.data.byteLength;Be.setUint32(B,Y),B+=4,Xe.set(ee,B),B+=Y,Se+=4+Y}if(be<F-1)U=b[be+1].dts-qe.dts;else{var $=this.config,J=qe.dts-b[be>0?be-1:be].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var q=Math.floor($.maxBufferHole*p),ue=(v?ne+v*p:this.nextAudioPts)-qe.pts;ue>q?(U=ue-J,U<0&&(U=J),D.logger.log("[mp4-remuxer]: It is approximately "+ue/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=J}else U=J}var ge=Math.round(qe.pts-qe.dts);P.push(new f(qe.key,U,Se,ge))}if(P.length&&g&&g<70){var _e=P[0].flags;_e.dependsOn=2,_e.isNonSync=0}console.assert(U!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=X=Z+U,this.isVideoContiguous=!0;var Ve=R.default.moof(c.sequenceNumber++,z,T({},c,{samples:P})),Qe="video",Ze={data1:Ve,data2:Xe,startPTS:ne/p,endPTS:(oe+U)/p,startDTS:z/p,endDTS:X/p,type:Qe,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),Ze},x.remuxAudio=function(c,s,a,v,p){var b=c.inputTimeScale,P=c.samplerate?c.samplerate:b,F=b/P,H=c.isAAC?C:y,X=H*F,B=this._initPTS,U=!c.isAAC&&this.typeSupported.mpeg,z=[],Z=c.samples,ne=U?0:8,oe=this.nextAudioPts||-1,Ce=s*b;if(this.isAudioContiguous=a=a||Z.length&&oe>0&&(v&&Math.abs(Ce-oe)<9e3||Math.abs(d(Z[0].pts-B,Ce)-oe)<20*X),Z.forEach(function(ee){ee.pts=d(ee.pts-B,Ce)}),!a||oe<0){if(Z=Z.filter(function(ee){return ee.pts>=0}),!Z.length)return;p===0?oe=0:v?oe=Math.max(0,Ce):oe=Z[0].pts}if(c.isAAC)for(var he=p!==void 0,we=this.config.maxAudioFramesDrift,ve=0,pe=oe;ve<Z.length;ve++){var se=Z[ve],de=se.pts,Le=de-pe,We=Math.abs(1e3*Le/b);if(Le<=-we*X&&he)ve===0&&(D.logger.warn("Audio frame @ "+(de/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Le/b)+" ms."),this.nextAudioPts=oe=pe=de);else if(Le>=we*X&&We<_&&he){var Te=Math.round(Le/X);pe=de-Te*X,pe<0&&(Te--,pe+=X),ve===0&&(this.nextAudioPts=oe=pe),D.logger.warn("[mp4-remuxer]: Injecting "+Te+" audio frame @ "+(pe/b).toFixed(3)+"s due to "+Math.round(1e3*Le/b)+" ms gap.");for(var xe=0;xe<Te;xe++){var Oe=Math.max(pe,0),ye=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=se.unit.subarray()),Z.splice(ve,0,{unit:ye,pts:Oe}),pe+=X,ve++}}se.pts=pe,pe+=X}for(var me=null,Me=null,Ne,Ie=0,Ae=Z.length;Ae--;)Ie+=Z[Ae].unit.byteLength;for(var Re=0,Ke=Z.length;Re<Ke;Re++){var ze=Z[Re],Ge=ze.unit,He=ze.pts;if(Me!==null){var ot=z[Re-1];ot.duration=Math.round((He-Me)/F)}else if(a&&c.isAAC&&(He=oe),me=He,Ie>0){Ie+=ne;try{Ne=new Uint8Array(Ie)}catch(ee){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!U){var Xe=new DataView(Ne.buffer);Xe.setUint32(0,Ie),Ne.set(R.default.types.mdat,4)}}else return;Ne.set(Ge,ne);var Be=Ge.byteLength;ne+=Be,z.push(new f(!0,H,Be,0)),Me=He}var be=z.length;if(!be)return;var qe=z[z.length-1];this.nextAudioPts=oe=Me+F*qe.duration;var Ye=U?new Uint8Array(0):R.default.moof(c.sequenceNumber++,me/F,T({},c,{samples:z}));c.samples=[];var Se=me/b,ke=oe/b,le="audio",ie={data1:Ye,data2:Ne,startPTS:Se,endPTS:ke,startDTS:Se,endDTS:ke,type:le,hasAudio:!0,hasVideo:!1,nb:be};return this.isAudioContiguous=!0,console.assert(Ne.length,"MDAT length must not be zero"),ie},x.remuxEmptyAudio=function(c,s,a,v){var p=c.inputTimeScale,b=c.samplerate?c.samplerate:p,P=p/b,F=this.nextAudioPts,H=(F!==null?F:v.startDTS*p)+this._initDTS,X=v.endDTS*p+this._initDTS,B=P*C,U=Math.ceil((X-H)/B),z=M.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Z=[],ne=0;ne<U;ne++){var oe=H+ne*B;Z.push({unit:z,pts:oe,dts:oe})}return c.samples=Z,this.remuxAudio(c,s,a,!1)},x.remuxID3=function(c,s){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,b=this._initDTS,P=0;P<a;P++){var F=c.samples[P];F.pts=d(F.pts-p,s*v)/v,F.dts=d(F.dts-b,s*v)/v}var H=c.samples;return c.samples=[],{samples:H}},x.remuxText=function(c,s){var a=c.samples.length;if(!a)return;for(var v=c.inputTimeScale,p=this._initPTS,b=0;b<a;b++){var P=c.samples[b];P.pts=d(P.pts-p,s*v)/v}c.samples.sort(function(H,X){return H.pts-X.pts});var F=c.samples;return c.samples=[],{samples:F}},L}();function d(L,x){var h;if(x===null)return L;for(x<L?h=-8589934592:h=8589934592;Math.abs(L-x)>4294967296;)L+=h;return L}function w(L){for(var x=0;x<L.length;x++)if(L[x].key)return x;return-1}var f=function(x,h,c,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=s,this.flags=new m(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/fragment.ts"),N=A("./src/utils/logger.ts"),k=function(){function E(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var T=E.prototype;return T.destroy=function(){},T.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(C,y,g){this.audioCodec=y,this.videoCodec=g,this.generateInitSegment(C),this.emitInitSegment=!0},T.generateInitSegment=function(C){var y=this.audioCodec,g=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(M.parseInitSegment)(C);y||(y=O(u.audio,R.ElementaryStreamTypes.AUDIO)),g||(g=O(u.video,R.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:y+","+g,initSegment:C,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:y,initSegment:C,id:"audio"}:u.video?o.video={container:"video/mp4",codec:g,initSegment:C,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(C,y,g,u,o){var l=this.initPTS,d=this.lastEndDTS,w={audio:void 0,video:void 0,text:u,id3:g,initSegment:void 0};Object(W.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var f=y.samples;if(!f||!f.length)return w;var m={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(f),L=this.initData),!L||!L.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(l)||(this.initPTS=m.initPTS=l=D(L,f,d));var x=Object(M.getDuration)(f,L),h=d,c=x+h;Object(M.offsetStartDTS)(L,f,l),x>0?this.lastEndDTS=c:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!L.audio,a=!!L.video,v="";s&&(v+="audio"),a&&(v+="video");var p={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:s,hasVideo:a,nb:1,dropped:0};return w.audio=p.type==="audio"?p:void 0,w.video=p.type!=="audio"?p:void 0,w.text=u,w.id3=g,w.initSegment=m,w},E}(),D=function(T,_,C){return Object(M.getStartDTS)(T,_)-C};function O(E,T){var _=E==null?void 0:E.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||T===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=k},"./src/task-loop.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"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 R=M.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},M}()},"./src/types/cmcd.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"CMCDVersion",function(){return W}),A.d(G,"CMCDObjectType",function(){return M}),A.d(G,"CMCDStreamingFormat",function(){return R}),A.d(G,"CMCDStreamType",function(){return N});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 R;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(R||(R={}));var N;(function(k){k.VOD="v",k.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"HlsSkip",function(){return R}),A.d(G,"getSkipValue",function(){return N}),A.d(G,"HlsUrlParameters",function(){return k}),A.d(G,"Level",function(){return D});function W(O,E){for(var T=0;T<E.length;T++){var _=E[T];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(O,_.key,_)}}function M(O,E,T){return E&&W(O.prototype,E),T&&W(O,T),O}var R;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(R||(R={}));function N(O,E){var T=O.canSkipUntil,_=O.canSkipDateRanges,C=O.endSN,y=E!==void 0?E-C:0;return T&&y<T?_?R.v2:R.Yes:R.No}var k=function(){function O(T,_,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=_,this.skip=C}var E=O.prototype;return E.addDirectives=function(_){var C=new self.URL(_);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},O}(),D=function(){function O(E){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return M(O,[{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(T){var _=T%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),O}()},"./src/types/loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"PlaylistContextType",function(){return W}),A.d(G,"PlaylistLevelType",function(){return M});var W;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var M;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"ChunkMetadata",function(){return W});var W=function(N,k,D,O,E,T){O===void 0&&(O=0),E===void 0&&(E=-1),T===void 0&&(T=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=M(),this.buffering={audio:M(),video:M(),audiovideo:M()},this.level=N,this.sn=k,this.id=D,this.size=O,this.part=E,this.partial=T};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"AttrList",function(){return R});var W=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function N(D){typeof D=="string"&&(D=N.parseAttrList(D));for(var O in D)D.hasOwnProperty(O)&&(this[O]=D[O])}var k=N.prototype;return k.decimalInteger=function(O){var E=parseInt(this[O],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},k.hexadecimalInteger=function(O){if(this[O]){var E=(this[O]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var T=new Uint8Array(E.length/2),_=0;_<E.length/2;_++)T[_]=parseInt(E.slice(_*2,_*2+2),16);return T}else return null},k.hexadecimalIntegerAsNumber=function(O){var E=parseInt(this[O],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},k.decimalFloatingPoint=function(O){return parseFloat(this[O])},k.optionalFloat=function(O,E){var T=this[O];return T?parseFloat(T):E},k.enumeratedString=function(O){return this[O]},k.bool=function(O){return this[O]==="YES"},k.decimalResolution=function(O){var E=W.exec(this[O]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},N.parseAttrList=function(O){var E,T={},_='"';for(M.lastIndex=0;(E=M.exec(O))!==null;){var C=E[2];C.indexOf(_)===0&&C.lastIndexOf(_)===C.length-1&&(C=C.slice(1,-1)),T[E[1]]=C}return T},N}()},"./src/utils/binary-search.ts":function(te,G,A){"use strict";A.r(G);var W={search:function(R,N){for(var k=0,D=R.length-1,O=null,E=null;k<=D;){O=(k+D)/2|0,E=R[O];var T=N(E);if(T>0)k=O+1;else if(T<0)D=O-1;else return E}return null}};G.default=W},"./src/utils/buffer-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"BufferHelper",function(){return R});var W=A("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function N(){}return N.isBuffered=function(D,O){try{if(D){for(var E=N.getBuffered(D),T=0;T<E.length;T++)if(O>=E.start(T)&&O<=E.end(T))return!0}}catch(_){}return!1},N.bufferInfo=function(D,O,E){try{if(D){var T=N.getBuffered(D),_=[],C;for(C=0;C<T.length;C++)_.push({start:T.start(C),end:T.end(C)});return this.bufferedInfo(_,O,E)}}catch(y){}return{len:0,start:O,end:O,nextStart:void 0}},N.bufferedInfo=function(D,O,E){O=Math.max(0,O),D.sort(function(m,L){var x=m.start-L.start;return x||L.end-m.end});var T=[];if(E)for(var _=0;_<D.length;_++){var C=T.length;if(C){var y=T[C-1].end;D[_].start-y<E?D[_].end>y&&(T[C-1].end=D[_].end):T.push(D[_])}else T.push(D[_])}else T=D;for(var g=0,u,o=O,l=O,d=0;d<T.length;d++){var w=T[d].start,f=T[d].end;if(O+E>=w&&O<f)o=w,l=f,g=l-O;else if(O+E<w){u=w;break}}return{len:g,start:o||0,end:l||0,nextStart:u}},N.getBuffered=function(D){try{return D.buffered}catch(O){return W.logger.log("failed to get media.buffered",O),M}},N}()},"./src/utils/cea-608-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"Row",function(){return l}),A.d(G,"CaptionScreen",function(){return d});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},R=function(c){var s=c;return M.hasOwnProperty(c)&&(s=M[c]),String.fromCharCode(s)},N=15,k=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var y=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,v){this.verboseLevel>=a&&W.logger.log(this.time+" ["+a+"] "+v)},h}(),g=function(c){for(var s=[],a=0;a<c.length;a++)s.push(c[a].toString(16));return s},u=function(){function h(s,a,v,p,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=v||!1,this.background=p||"black",this.flash=b||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],p=0;p<v.length;p++){var b=v[p];a.hasOwnProperty(b)&&(this[b]=a[b])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(s,a,v,p,b,P){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new u(a,v,p,b,P)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),l=function(){function h(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new u}var c=h.prototype;return c.equals=function(a){for(var v=!0,p=0;p<k;p++)if(!this.chars[p].equals(a.chars[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<k;v++)this.chars[v].copy(a.chars[v])},c.isEmpty=function(){for(var a=!0,v=0;v<k;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var p=this.pos+1;p<v+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var v=R(a);if(this.pos>=k){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v<k;v++)this.chars[v].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],v=!0,p=0;p<k;p++){var b=this.chars[p].uchar;b!==" "&&(v=!1),a.push(b)}return v?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},h}(),d=function(){function h(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<N;a++)this.rows.push(new l(s));this.logger=s,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<N;a++)this.rows[a].clear();this.currRow=N-1},c.equals=function(a){for(var v=!0,p=0;p<N;p++)if(!this.rows[p].equals(a.rows[p])){v=!1;break}return v},c.copy=function(a){for(var v=0;v<N;v++)this.rows[v].copy(a.rows[v])},c.isEmpty=function(){for(var a=!0,v=0;v<N;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},c.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},c.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var p=0;p<N;p++)this.rows[p].clear();var b=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var F=P.rows[b].cueStartTime,H=this.logger.time;if(F&&H!==null&&F<H)for(var X=0;X<this.nrRollUpRows;X++)this.rows[v-this.nrRollUpRows+X+1].copy(P.rows[b+X])}}this.currRow=v;var B=this.rows[this.currRow];if(a.indent!==null){var U=a.indent,z=Math.max(U-1,0);B.setCursor(a.indent),a.color=B.chars[z].penState.foreground}var Z={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Z)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var v=[],p="",b=-1,P=0;P<N;P++){var F=this.rows[P].getTextString();F&&(b=P+1,a?v.push("Row "+b+": '"+F+"'"):v.push(F.trim()))}return v.length>0&&(a?p="["+v.join(" | ")+"]":p=v.join(`
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(s,a,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(v),this.nonDisplayedMemory=new d(v),this.lastOutputScreen=new d(v),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var p=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=b[p]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),f=function(){function h(s,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new y;this.channels=[null,new w(s,a,p),new w(s+1,v,p)],this.cmdHistory=x(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var p,b,P,F=!1;this.logger.time=a;for(var H=0;H<v.length;H+=2){if(b=v[H]&127,P=v[H+1]&127,b===0&&P===0)continue;if(this.logger.log(C.DATA,"["+g([v[H],v[H+1]])+"] -> ("+g([b,P])+")"),p=this.parseCmd(b,P),p||(p=this.parseMidrow(b,P)),p||(p=this.parsePAC(b,P)),p||(p=this.parseBackgroundAttributes(b,P)),!p&&(F=this.parseChars(b,P),F)){var X=this.currentChannel;if(X&&X>0){var B=this.channels[X];B.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+g([b,P])+" orig: "+g([v[H],v[H+1]]))}},c.parseCmd=function(a,v){var p=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,P=(a===23||a===31)&&v>=33&&v<=35;if(!(b||P))return!1;if(L(a,v,p))return m(null,null,p),this.logger.log(C.DEBUG,"Repeated command ("+g([a,v])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,H=this.channels[F];return a===20||a===21||a===28||a===29?v===32?H.ccRCL():v===33?H.ccBS():v===34?H.ccAOF():v===35?H.ccAON():v===36?H.ccDER():v===37?H.ccRU(2):v===38?H.ccRU(3):v===39?H.ccRU(4):v===40?H.ccFON():v===41?H.ccRDC():v===42?H.ccTR():v===43?H.ccRTD():v===44?H.ccEDM():v===45?H.ccCR():v===46?H.ccENM():v===47&&H.ccEOC():H.ccTO(v-32),m(a,v,p),this.currentChannel=F,!0},c.parseMidrow=function(a,v){var p=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[p];return b?(b.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+g([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var p,b=this.cmdHistory,P=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(P||F))return!1;if(L(a,v,b))return m(null,null,b),!0;var H=a<=23?1:2;v>=64&&v<=95?p=H===1?D[a]:E[a]:p=H===1?O[a]:T[a];var X=this.channels[H];return X?(X.setPAC(this.interpretPAC(p,v)),m(a,v,b),this.currentChannel=H,!0):!1},c.interpretPAC=function(a,v){var p,b={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?p=v-96:p=v-64,b.underline=(p&1)===1,p<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((p-16)/2)*4,b},c.parseChars=function(a,v){var p,b=null,P=null;if(a>=25?(p=2,P=a-8):(p=1,P=a),P>=17&&P<=19){var F;P===17?F=v+80:P===18?F=v+112:F=v+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+p),b=[F]}else a>=32&&a<=127&&(b=v===0?[a]:[a,v]);if(b){var H=g(b);this.logger.log(C.DEBUG,"Char codes = "+H.join(",")),m(a,v,this.cmdHistory)}return b},c.parseBackgroundAttributes=function(a,v){var p=(a===16||a===24)&&v>=32&&v<=47,b=(a===23||a===31)&&v>=45&&v<=47;if(!(p||b))return!1;var P,F={};a===16||a===24?(P=Math.floor((v-32)/2),F.background=_[P],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var H=a<=23?1:2,X=this.channels[H];return X.setBkgData(F),m(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=x()},c.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var p=this.channels[v];p&&p.cueSplitAtTime(a)}},h}();function m(h,c,s){s.a=h,s.b=c}function L(h,c,s){return s.a===h&&s.b===c}function x(){return{a:null,b:null}}G.default=f},"./src/utils/codecs.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"isCodecType",function(){return M}),A.d(G,"isCodecSupportedInMp4",function(){return R});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(N,k){var D=W[k];return!!D&&D[N.slice(0,4)]===!0}function R(N,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/utils/vttparser.ts"),M=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),N=/\s/,k={newCue:function(O,E,T,_){for(var C=[],y,g,u,o,l,d=self.VTTCue||self.TextTrackCue,w=0;w<_.rows.length;w++)if(y=_.rows[w],u=!0,o=0,l="",!y.isEmpty()){for(var f=0;f<y.chars.length;f++)N.test(y.chars[f].uchar)&&u?o++:(l+=y.chars[f].uchar,u=!1);y.cueStartTime=E,E===T&&(T+=1e-4),o>=16?o--:o++;var m=Object(W.fixLineBreaks)(l.trim()),L=Object(M.generateCueId)(E,T,m);(!O||!O.cues||!O.cues.getCueById(L))&&(g=new d(E,T,m),g.id=L,g.line=w+1,g.align="left",g.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(g))}return O&&C.length&&(C.sort(function(x,h){return x.line==="auto"||h.line==="auto"?0:x.line>8&&h.line>8?h.line-x.line:x.line-h.line}),C.forEach(function(x){return Object(R.addCueToTrack)(O,x)})),C}};G.default=k},"./src/utils/discontinuities.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"findFirstFragWithCC",function(){return N}),A.d(G,"shouldAlignOnDiscontinuities",function(){return k}),A.d(G,"findDiscontinuousReferenceFrag",function(){return D}),A.d(G,"adjustSlidingStart",function(){return E}),A.d(G,"alignStream",function(){return T}),A.d(G,"alignPDT",function(){return C}),A.d(G,"alignFragmentByPDTDelta",function(){return y}),A.d(G,"alignMediaPlaylistByPDT",function(){return g});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts"),R=A("./src/controller/level-helper.ts");function N(u,o){for(var l=null,d=0,w=u.length;d<w;d++){var f=u[d];if(f&&f.cc===o){l=f;break}}return l}function k(u,o,l){return!!(o.details&&(l.endCC>l.startCC||u&&u.cc<l.startCC))}function D(u,o){var l=u.fragments,d=o.fragments;if(!d.length||!l.length){M.logger.log("No fragments to align");return}var w=N(l,d[0].cc);if(!w||w&&!w.startPTS){M.logger.log("No frag in previous level to align on");return}return w}function O(u,o){if(u){var l=u.start+o;u.start=u.startPTS=l,u.endPTS=l+u.duration}}function E(u,o){for(var l=o.fragments,d=0,w=l.length;d<w;d++)O(l[d],u);o.fragmentHint&&O(o.fragmentHint,u),o.alignedSliding=!0}function T(u,o,l){if(!o)return;_(u,l,o),!l.alignedSliding&&o.details&&C(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(R.adjustSliding)(o.details,l)}function _(u,o,l){if(k(u,l,o)){var d=D(l.details,o);d&&Object(W.isFiniteNumber)(d.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(d.start,o))}}function C(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=u.fragments[0].programDateTime,w=(d-l)/1e3+o.fragments[0].start;w&&Object(W.isFiniteNumber)(w)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+w.toFixed(3)+" "+u.url+" "),E(w,u))}function y(u,o){var l=u.programDateTime;if(!l)return;var d=(l-o)/1e3;u.start=u.startPTS=d,u.endPTS=d+u.duration}function g(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=o.fragments[0].start,w=l-d*1e3;u.fragments.forEach(function(f){y(f,w)}),u.fragmentHint&&y(u.fragmentHint,w),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/utils/ewma.ts"),M=function(){function R(k,D,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(k),this.fast_=new W.default(D)}var N=R.prototype;return N.update=function(D,O){var E=this.slow_,T=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new W.default(D,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new W.default(O,T.getEstimate(),T.getTotalWeight()))},N.sample=function(D,O){D=Math.max(D,this.minDelayMs_);var E=8*O,T=D/1e3,_=E/T;this.fast_.sample(T,_),this.slow_.sample(T,_)},N.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},R}();G.default=M},"./src/utils/ewma.ts":function(te,G,A){"use strict";A.r(G);var W=function(){function M(N,k,D){k===void 0&&(k=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=k,this.totalWeight_=D}var R=M.prototype;return R.sample=function(k,D){var O=Math.pow(this.alpha_,k);this.estimate_=D*(1-O)+O*this.estimate_,this.totalWeight_+=k},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},M}();G.default=W},"./src/utils/fetch-loader.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"fetchSupported",function(){return y});var W=A("./src/polyfills/number.ts"),M=A("./src/loader/load-stats.ts"),R=A("./src/demux/chunk-cache.ts");function N(d,w){d.prototype=Object.create(w.prototype),d.prototype.constructor=d,T(d,w)}function k(d){var w=typeof Map=="function"?new Map:void 0;return k=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(m))return w.get(m);w.set(m,L)}function L(){return D(m,arguments,_(this).constructor)}return L.prototype=Object.create(m.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),T(L,m)},k(d)}function D(d,w,f){return O()?D=Reflect.construct:D=function(L,x,h){var c=[null];c.push.apply(c,x);var s=Function.bind.apply(L,c),a=new s;return h&&T(a,h.prototype),a},D.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 E(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function T(d,w){return T=Object.setPrototypeOf||function(m,L){return m.__proto__=L,m},T(d,w)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},_(d)}function C(){return C=Object.assign||function(d){for(var w=1;w<arguments.length;w++){var f=arguments[w];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(d[m]=f[m])}return d},C.apply(this,arguments)}function y(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var g=function(){function d(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new M.LoadStats}var w=d.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(m,L,x){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var s=u(m,this.controller.signal),a=x.onProgress,v=m.responseType==="arraybuffer",p=v?"byteLength":"length";this.context=m,this.config=L,this.callbacks=x,this.request=this.fetchSetup(m,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),x.onTimeout(c,m,h.response)},L.timeout),self.fetch(this.request).then(function(b){if(h.response=h.loader=b,!b.ok){var P=b.status,F=b.statusText;throw new l(F||"fetch, bad network response",P,b)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object(W.isFiniteNumber)(L.highWaterMark)?h.loadProgressively(b,c,m,L.highWaterMark,a):v?b.arrayBuffer():b.text()}).then(function(b){var P=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=b[p];var F={url:P.url,data:b};a&&!Object(W.isFiniteNumber)(L.highWaterMark)&&a(c,m,b,P),x.onSuccess(F,c,m,P)}).catch(function(b){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var P=b.code||0;x.onError({code:P,text:b.message},m,b.details)})},w.getCacheAge=function(){var m=null;if(this.response){var L=this.response.headers.get("age");m=L?parseFloat(L):null}return m},w.loadProgressively=function(m,L,x,h,c){h===void 0&&(h=0);var s=new R.default,a=m.body.getReader(),v=function p(){return a.read().then(function(b){if(b.done)return s.dataLength&&c(L,x,s.flush(),m),Promise.resolve(new ArrayBuffer(0));var P=b.value,F=P.length;return L.loaded+=F,F<h||s.dataLength?(s.push(P),s.dataLength>=h&&c(L,x,s.flush(),m)):c(L,x,P,m),p()}).catch(function(){return Promise.reject()})};return v()},d}();function u(d,w){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(C({},d.headers))};return d.rangeEnd&&f.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),f}function o(d,w){return new self.Request(d.url,w)}var l=function(d){N(w,d);function w(f,m,L){var x;return x=d.call(this,f)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=L,x}return w}(k(Error));G.default=g},"./src/utils/imsc1-ttml-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"IMSC1_CODEC",function(){return E}),A.d(G,"parseIMSC1",function(){return y});var W=A("./src/utils/mp4-tools.ts"),M=A("./src/utils/vttparser.ts"),R=A("./src/utils/vttcue.ts"),N=A("./src/demux/id3.ts"),k=A("./src/utils/timescale-conversion.ts"),D=A("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(h[a]=s[a])}return h},O.apply(this,arguments)}var E="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function y(h,c,s,a,v){var p=Object(W.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var b=p[0],P=Object(N.utf8ArrayToStr)(new Uint8Array(h,b.start,b.end-b.start)),F=Object(k.toTimescaleFromScale)(c,1,s);try{a(g(P,F))}catch(H){v(H)}}function g(h,c){var s=new DOMParser,a=s.parseFromString(h,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(p).reduce(function(B,U){return B[U]=v.getAttribute("ttp:"+U)||p[U],B},{}),P=v.getAttribute("xml:space")!=="preserve",F=o(u(v,"styling","style")),H=o(u(v,"layout","region")),X=u(v,"body","[begin]");return[].map.call(X,function(B){var U=l(B,P);if(!U||!B.hasAttribute("begin"))return null;var z=m(B.getAttribute("begin"),b),Z=m(B.getAttribute("dur"),b),ne=m(B.getAttribute("end"),b);if(z===null)throw f(B);if(ne===null){if(Z===null)throw f(B);ne=z+Z}var oe=new R.default(z-c,ne-c,U);oe.id=Object(D.generateCueId)(oe.startTime,oe.endTime,oe.text);var Ce=H[B.getAttribute("region")],he=F[B.getAttribute("style")];oe.position=10,oe.size=80;var we=d(Ce,he),ve=we.textAlign;if(ve){var pe=C[ve];pe&&(oe.lineAlign=pe),oe.align=ve}return O(oe,we),oe}).filter(function(B){return B!==null})}function u(h,c,s){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(h){return h.reduce(function(c,s){var a=s.getAttribute("xml:id");return a&&(c[a]=s),c},{})}function l(h,c){return[].slice.call(h.childNodes).reduce(function(s,a,v){var p;return a.nodeName==="br"&&v?s+`
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?l(a,c):c?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function d(h,c){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,p){var b=w(c,s,p)||w(h,s,p);return b&&(v[p]=b),v},{})}function w(h,c,s){return h.hasAttributeNS(c,s)?h.getAttributeNS(c,s):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var s=Object(M.parseTimeStamp)(h);return s===null&&(T.test(h)?s=L(h,c):_.test(h)&&(s=x(h,c))),s}function L(h,c){var s=T.exec(h),a=(s[4]|0)+(s[5]|0)/c.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/c.frameRate}function x(h,c){var s=_.exec(h),a=Number(s[1]),v=s[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"enableLogs",function(){return D}),A.d(G,"logger",function(){return O});var W=function(){},M={trace:W,debug:W,log:W,warn:W,info:W,error:W},R=M;function N(E){var T=self.console[E];return T?T.bind(self.console,"["+E+"] >"):W}function k(E){for(var T=arguments.length,_=new Array(T>1?T-1:0),C=1;C<T;C++)_[C-1]=arguments[C];_.forEach(function(y){R[y]=E[y]?E[y].bind(E):N(y)})}function D(E){if(self.console&&E===!0||typeof E=="object"){k(E,"debug","log","info","warn","error");try{R.log()}catch(T){R=M}}else R=M}var O=R},"./src/utils/mediakeys-helper.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"KeySystems",function(){return W}),A.d(G,"requestMediaKeySystemAccess",function(){return M});var W;(function(R){R.WIDEVINE="com.widevine.alpha",R.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(te,G,A){"use strict";A.r(G),A.d(G,"getMediaSource",function(){return W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"bin2str",function(){return k}),A.d(G,"readUint16",function(){return D}),A.d(G,"readUint32",function(){return O}),A.d(G,"writeUint32",function(){return E}),A.d(G,"findBox",function(){return T}),A.d(G,"parseSegmentIndex",function(){return _}),A.d(G,"parseInitSegment",function(){return C}),A.d(G,"getStartDTS",function(){return y}),A.d(G,"getDuration",function(){return g}),A.d(G,"computeRawDurationFromSamples",function(){return u}),A.d(G,"offsetStartDTS",function(){return o}),A.d(G,"segmentValidRange",function(){return l}),A.d(G,"appendUint8Array",function(){return d});var W=A("./src/utils/typed-array.ts"),M=A("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,N=[].push;function k(w){return String.fromCharCode.apply(null,w)}function D(w,f){"data"in w&&(f+=w.start,w=w.data);var m=w[f]<<8|w[f+1];return m<0?65536+m:m}function O(w,f){"data"in w&&(f+=w.start,w=w.data);var m=w[f]<<24|w[f+1]<<16|w[f+2]<<8|w[f+3];return m<0?4294967296+m:m}function E(w,f,m){"data"in w&&(f+=w.start,w=w.data),w[f]=m>>24,w[f+1]=m>>16&255,w[f+2]=m>>8&255,w[f+3]=m&255}function T(w,f){var m=[];if(!f.length)return m;var L,x,h;"data"in w?(L=w.data,x=w.start,h=w.end):(L=w,x=0,h=L.byteLength);for(var c=x;c<h;){var s=O(L,c),a=k(L.subarray(c+4,c+8)),v=s>1?c+s:h;if(a===f[0])if(f.length===1)m.push({data:L,start:c+8,end:v});else{var p=T({data:L,start:c+8,end:v},f.slice(1));p.length&&N.apply(m,p)}c=v}return m}function _(w){var f=T(w,["moov"]),m=f[0],L=m?m.end:null,x=T(w,["sidx"]);if(!x||!x[0])return null;var h=[],c=x[0],s=c.data[0],a=s===0?8:16,v=O(c,a);a+=4;var p=0,b=0;s===0?a+=8:a+=16,a+=2;var P=c.end+b,F=D(c,a);a+=2;for(var H=0;H<F;H++){var X=a,B=O(c,X);X+=4;var U=B&2147483647,z=(B&2147483648)>>>31;if(z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Z=O(c,X);X+=4,h.push({referenceSize:U,subsegmentDuration:Z,info:{duration:Z/v,start:P,end:P+U-1}}),P+=U,X+=4,a=X}return{earliestPresentationTime:p,timescale:v,version:s,referencesCount:F,references:h,moovEndOffset:L}}function C(w){for(var f=[],m=T(w,["moov","trak"]),L=0;L<m.length;L++){var x=m[L],h=T(x,["tkhd"])[0];if(h){var c=h.data[h.start],s=c===0?12:20,a=O(h,s),v=T(x,["mdia","mdhd"])[0];if(v){c=v.data[v.start],s=c===0?12:20;var p=O(v,s),b=T(x,["mdia","hdlr"])[0];if(b){var P=k(b.data.subarray(b.start+8,b.start+12)),F={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[P];if(F){var H=T(x,["mdia","minf","stbl","stsd"])[0],X=void 0;H&&(X=k(H.data.subarray(H.start+12,H.start+16))),f[a]={timescale:p,type:F},f[F]={timescale:p,id:a,codec:X}}}}}}var B=T(w,["moov","mvex","trex"]);return B.forEach(function(U){var z=O(U,4),Z=f[z];Z&&(Z.default={duration:O(U,12),flags:O(U,20)})}),f}function y(w,f){return T(f,["moof","traf"]).reduce(function(m,L){var x=T(L,["tfdt"])[0],h=x.data[x.start],c=T(L,["tfhd"]).reduce(function(s,a){var v=O(a,4),p=w[v];if(p){var b=O(x,4);h===1&&(b*=Math.pow(2,32),b+=O(x,8));var P=p.timescale||9e4,F=b/P;if(isFinite(F)&&(s===null||F<s))return F}return s},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function g(w,f){for(var m=0,L=0,x=0,h=T(w,["moof","traf"]),c=0;c<h.length;c++){var s=h[c],a=T(s,["tfhd"])[0],v=O(a,4),p=f[v];if(!p)continue;var b=p.default,P=O(a,0)|(b==null?void 0:b.flags),F=b==null?void 0:b.duration;P&8&&(P&2?F=O(a,12):F=O(a,8));for(var H=p.timescale||9e4,X=T(s,["trun"]),B=0;B<X.length;B++){if(F){var U=O(X[B],4);m=F*U}else m=u(X[B]);p.type===M.ElementaryStreamTypes.VIDEO?L+=m/H:p.type===M.ElementaryStreamTypes.AUDIO&&(x+=m/H)}}if(L===0&&x===0){var z=_(w);if(z!=null&&z.references)return z.references.reduce(function(Z,ne){return Z+ne.info.duration||0},0)}return L||x}function u(w){var f=O(w,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var L=0,x=O(w,4),h=0;h<x;h++){if(f&256){var c=O(w,m);L+=c,m+=4}f&512&&(m+=4),f&1024&&(m+=4),f&2048&&(m+=4)}return L}function o(w,f,m){T(f,["moof","traf"]).forEach(function(L){T(L,["tfhd"]).forEach(function(x){var h=O(x,4),c=w[h];if(!c)return;var s=c.timescale||9e4;T(L,["tfdt"]).forEach(function(a){var v=a.data[a.start],p=O(a,4);if(v===0)E(a,4,p-m*s);else{p*=Math.pow(2,32),p+=O(a,8),p-=m*s,p=Math.max(p,0);var b=Math.floor(p/(R+1)),P=Math.floor(p%(R+1));E(a,4,b),E(a,8,P)}})})})}function l(w){var f={valid:null,remainder:null},m=T(w,["moof"]);if(m){if(m.length<2)return f.remainder=w,f}else return f;var L=m[m.length-1];return f.valid=Object(W.sliceUint8)(w,0,L.start-8),f.remainder=Object(W.sliceUint8)(w,L.start-8),f}function d(w,f){var m=new Uint8Array(w.length+f.length);return m.set(w),m.set(f,w.length),m}},"./src/utils/output-filter.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"default",function(){return W});var W=function(){function M(N,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=k}var R=M.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(k,D,O){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=D,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"sendAddTrackEvent",function(){return M}),A.d(G,"addCueToTrack",function(){return R}),A.d(G,"clearCurrentCues",function(){return N}),A.d(G,"removeCuesInRange",function(){return k}),A.d(G,"getCuesInRange",function(){return O});var W=A("./src/utils/logger.ts");function M(E,T){var _;try{_=new Event("addtrack")}catch(C){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=E,T.dispatchEvent(_)}function R(E,T){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(T.id))try{if(E.addCue(T),!E.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(y){W.logger.debug("[texttrack-utils]: "+y);var C=new self.TextTrackCue(T.startTime,T.endTime,T.text);C.id=T.id,E.addCue(C)}_==="disabled"&&(E.mode=_)}function N(E){var T=E.mode;if(T==="disabled"&&(E.mode="hidden"),E.cues)for(var _=E.cues.length;_--;)E.removeCue(E.cues[_]);T==="disabled"&&(E.mode=T)}function k(E,T,_){var C=E.mode;if(C==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var y=O(E.cues,T,_),g=0;g<y.length;g++)E.removeCue(y[g]);C==="disabled"&&(E.mode=C)}function D(E,T){if(T<E[0].startTime)return 0;var _=E.length-1;if(T>E[_].endTime)return-1;for(var C=0,y=_;C<=y;){var g=Math.floor((y+C)/2);if(T<E[g].startTime)y=g-1;else if(T>E[g].startTime&&C<_)C=g+1;else return g}return E[C].startTime-T<T-E[y].startTime?C:y}function O(E,T,_){var C=[],y=D(E,T);if(y>-1)for(var g=y,u=E.length;g<u;g++){var o=E[g];if(o.startTime>=T&&o.endTime<=_)C.push(o);else if(o.startTime>_)return C}return C}},"./src/utils/time-ranges.ts":function(te,G,A){"use strict";A.r(G);var W={toString:function(R){for(var N="",k=R.length,D=0;D<k;D++)N+="["+R.start(D).toFixed(3)+","+R.end(D).toFixed(3)+"]";return N}};G.default=W},"./src/utils/timescale-conversion.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"toTimescaleFromBase",function(){return M}),A.d(G,"toTimescaleFromScale",function(){return R}),A.d(G,"toMsFromMpegTsClock",function(){return N}),A.d(G,"toMpegTsClockFromTimescale",function(){return k});var W=9e4;function M(D,O,E,T){E===void 0&&(E=1),T===void 0&&(T=!1);var _=D*O*E;return T?Math.round(_):_}function R(D,O,E,T){return E===void 0&&(E=1),T===void 0&&(T=!1),M(D,O,1/E,T)}function N(D,O){return O===void 0&&(O=!1),M(D,1e3,1/W,O)}function k(D,O){return O===void 0&&(O=1),M(D,W,1/O)}},"./src/utils/typed-array.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"sliceUint8",function(){return W});function W(M,R,N){return Uint8Array.prototype.slice?M.slice(R,N):new Uint8Array(Array.prototype.slice.call(M,R,N))}},"./src/utils/vttcue.ts":function(te,G,A){"use strict";A.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],M=["start","middle","end","left","right"];function R(E,T){if(typeof T!="string")return!1;if(!Array.isArray(E))return!1;var _=T.toLowerCase();return~E.indexOf(_)?_:!1}function N(E){return R(W,E)}function k(E){return R(M,E)}function D(E){for(var T=arguments.length,_=new Array(T>1?T-1:0),C=1;C<T;C++)_[C-1]=arguments[C];for(var y=1;y<arguments.length;y++){var g=arguments[y];for(var u in g)E[u]=g[u]}return E}function O(E,T,_){var C=this,y={enumerable:!0};C.hasBeenReset=!1;var g="",u=!1,o=E,l=T,d=_,w=null,f="",m=!0,L="auto",x="start",h=50,c="middle",s=50,a="middle";Object.defineProperty(C,"id",D({},y,{get:function(){return g},set:function(p){g=""+p}})),Object.defineProperty(C,"pauseOnExit",D({},y,{get:function(){return u},set:function(p){u=!!p}})),Object.defineProperty(C,"startTime",D({},y,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",D({},y,{get:function(){return l},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");l=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",D({},y,{get:function(){return d},set:function(p){d=""+p,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",D({},y,{get:function(){return w},set:function(p){w=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",D({},y,{get:function(){return f},set:function(p){var b=N(p);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",D({},y,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",D({},y,{get:function(){return L},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",D({},y,{get:function(){return x},set:function(p){var b=k(p);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",D({},y,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",D({},y,{get:function(){return c},set:function(p){var b=k(p);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");c=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",D({},y,{get:function(){return s},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",D({},y,{get:function(){return a},set:function(p){var b=k(p);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),C.displayState=void 0}return O.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"parseTimeStamp",function(){return R}),A.d(G,"fixLineBreaks",function(){return T}),A.d(G,"VTTParser",function(){return _});var W=A("./src/utils/vttcue.ts"),M=function(){function C(){}var y=C.prototype;return y.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},C}();function R(C){function y(u,o,l,d){return(u|0)*3600+(o|0)*60+(l|0)+parseFloat(d||0)}var g=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?y(g[2],g[3],0,g[4]):y(g[1],g[2],g[3],g[4]):null}var N=function(){function C(){this.values=Object.create(null)}var y=C.prototype;return y.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},y.get=function(u,o,l){return l?this.has(u)?this.values[u]:o[l]:this.has(u)?this.values[u]:o},y.has=function(u){return u in this.values},y.alt=function(u,o,l){for(var d=0;d<l.length;++d)if(o===l[d]){this.set(u,o);break}},y.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},y.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(u,l),!0}return!1},C}();function k(C,y,g,u){var o=u?C.split(u):[C];for(var l in o){if(typeof o[l]!="string")continue;var d=o[l].split(g);if(d.length!==2)continue;var w=d[0],f=d[1];y(w,f)}}var D=new W.default(0,0,""),O=D.align==="middle"?"middle":"center";function E(C,y,g){var u=C;function o(){var w=R(C);if(w===null)throw new Error("Malformed timestamp: "+u);return C=C.replace(/^[^\sa-zA-Z-]+/,""),w}function l(w,f){var m=new N;k(w,function(h,c){var s;switch(h){case"region":for(var a=g.length-1;a>=0;a--)if(g[a].id===c){m.set(h,g[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":s=c.split(","),m.integer(h,s[0]),m.percent(h,s[0])&&m.set("snapToLines",!1),m.alt(h,s[0],["auto"]),s.length===2&&m.alt("lineAlign",s[1],["start",O,"end"]);break;case"position":s=c.split(","),m.percent(h,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",O,"end","left","right"]);break}},/:/,/\s/),f.region=m.get("region",null),f.vertical=m.get("vertical","");var L=m.get("line","auto");L==="auto"&&D.line===-1&&(L=-1),f.line=L,f.lineAlign=m.get("lineAlign","start"),f.snapToLines=m.get("snapToLines",!0),f.size=m.get("size",100),f.align=m.get("align",O);var x=m.get("position","auto");x==="auto"&&D.position===50&&(x=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=x}function d(){C=C.replace(/^\s+/,"")}if(d(),y.startTime=o(),d(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);C=C.substr(3),d(),y.endTime=o(),d(),l(C,y)}function T(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var _=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new M,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var y=C.prototype;return y.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function l(){var x=o.buffer,h=0;for(x=T(x);h<x.length&&x[h]!=="\r"&&x[h]!==`
`;)++h;var c=x.substr(0,h);return x[h]==="\r"&&++h,x[h]===`
`&&++h,o.buffer=x.substr(h),c}function d(x){k(x,function(h,c){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=l();var f=w.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:w=l();switch(o.state){case"HEADER":/:/.test(w)?d(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new W.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(w,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=w.indexOf("-->")!==-1;if(!w||L&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},y.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(te,G,A){"use strict";A.r(G),A.d(G,"generateCueId",function(){return _}),A.d(G,"parseWebVTT",function(){return y});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/vttparser.ts"),R=A("./src/demux/id3.ts"),N=A("./src/utils/timescale-conversion.ts"),k=A("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,O=function(u,o,l){return l===void 0&&(l=0),u.substr(l,o.length)===o},E=function(u){var o=parseInt(u.substr(-3)),l=parseInt(u.substr(-6,2)),d=parseInt(u.substr(-9,2)),w=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(o)||!Object(W.isFiniteNumber)(l)||!Object(W.isFiniteNumber)(d)||!Object(W.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*l,o+=60*1e3*d,o+=60*60*1e3*w,o},T=function(u){for(var o=5381,l=u.length;l;)o=o*33^u.charCodeAt(--l);return(o>>>0).toString()};function _(g,u,o){return T(g.toString())+T(u.toString())+T(o)}var C=function(u,o,l){var d=u[o],w=u[d.prevCC];if(!w||!w.new&&d.new){u.ccOffset=u.presentationOffset=d.start,d.new=!1;return}for(;(f=w)!==null&&f!==void 0&&f.new;){var f;u.ccOffset+=d.start-w.start,d.new=!1,d=w,w=u[d.prevCC]}u.presentationOffset=l};function y(g,u,o,l,d,w,f,m){var L=new M.VTTParser,x=Object(R.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(D,`
`).split(`
`),h=[],c=Object(N.toMpegTsClockFromTimescale)(u,o),s="00:00.000",a=0,v=0,p,b=!0,P=!1;L.oncue=function(F){var H=l[d],X=l.ccOffset,B=(a-c)/9e4;if(H!=null&&H.new&&(v!==void 0?X=l.ccOffset=H.start:C(l,d,B)),B&&(X=B-l.presentationOffset),P){var U=F.endTime-F.startTime,z=Object(k.normalizePts)((F.startTime+X-v)*9e4,w*9e4)/9e4;F.startTime=z,F.endTime=z+U}var Z=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Z)),F.id||(F.id=_(F.startTime,F.endTime,Z)),F.endTime>0&&h.push(F)},L.onparsingerror=function(F){p=F},L.onflush=function(){if(p){m(p);return}f(h)},x.forEach(function(F){if(b)if(O(F,"X-TIMESTAMP-MAP=")){b=!1,P=!0,F.substr(16).split(",").forEach(function(H){O(H,"LOCAL:")?s=H.substr(6):O(H,"MPEGTS:")&&(a=parseInt(H.substr(7)))});try{v=E(s)/1e3}catch(H){P=!1,p=H}return}else F===""&&(b=!1);L.parse(F+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(te,G,A){"use strict";A.r(G);var W=A("./src/utils/logger.ts"),M=A("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,N=function(){function k(O){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=O?O.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var D=k.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},D.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(E,T,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=T,this.callbacks=_,this.retryDelay=T.retryDelay,this.loadInternal()},D.loadInternal=function(){var E=this.config,T=this.context;if(!E)return;var _=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var y=this.xhrSetup;try{if(y)try{y(_,T.url)}catch(o){_.open("GET",T.url,!0),y(_,T.url)}_.readyState||_.open("GET",T.url,!0);var g=this.context.headers;if(g)for(var u in g)_.setRequestHeader(u,g[u])}catch(o){this.callbacks.onError({code:_.status,text:o.message},T,_);return}T.rangeEnd&&_.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),_.send()},D.readystatechange=function(){var E=this.context,T=this.loader,_=this.stats;if(!E||!T)return;var C=T.readyState,y=this.config;if(_.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),C===4){T.onreadystatechange=null,T.onprogress=null;var g=T.status;if(g>=200&&g<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var u,o;if(E.responseType==="arraybuffer"?(u=T.response,o=u.byteLength):(u=T.responseText,o=u.length),_.loaded=_.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(_,E,u,T),!this.callbacks)return;var d={url:T.responseURL,data:u};this.callbacks.onSuccess(d,_,E,T)}else _.retry>=y.maxRetry||g>=400&&g<499?(W.logger.error(g+" while loading "+E.url),this.callbacks.onError({code:g,text:T.statusText},E,T)):(W.logger.warn(g+" while loading "+E.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,y.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout)},D.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(E){var T=this.stats;T.loaded=E.loaded,E.lengthComputable&&(T.total=E.total)},D.getCacheAge=function(){var E=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");E=T?parseFloat(T):null}return E},k}();G.default=N}}).default})},vHTk:function(mt,et,Q){mt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wMS7:function(mt,et,Q){/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.0.8/LICENSE */(function(te,G){mt.exports=G()})(this,function(){"use strict";function te(Te){if(Array.isArray(Te)){for(var xe=0,Oe=Array(Te.length);xe<Te.length;xe++)Oe[xe]=Te[xe];return Oe}else return Array.from(Te)}var G=Object.hasOwnProperty,A=Object.setPrototypeOf,W=Object.isFrozen,M=Object.keys,R=Object.freeze,N=Object.seal,k=Object.create,D=typeof Reflect!="undefined"&&Reflect,O=D.apply,E=D.construct;O||(O=function(xe,Oe,ye){return xe.apply(Oe,ye)}),R||(R=function(xe){return xe}),N||(N=function(xe){return xe}),E||(E=function(xe,Oe){return new(Function.prototype.bind.apply(xe,[null].concat(te(Oe))))});var T=h(Array.prototype.forEach),_=h(Array.prototype.indexOf),C=h(Array.prototype.join),y=h(Array.prototype.pop),g=h(Array.prototype.push),u=h(Array.prototype.slice),o=h(String.prototype.toLowerCase),l=h(String.prototype.match),d=h(String.prototype.replace),w=h(String.prototype.indexOf),f=h(String.prototype.trim),m=h(RegExp.prototype.test),L=c(RegExp),x=c(TypeError);function h(Te){return function(xe){for(var Oe=arguments.length,ye=Array(Oe>1?Oe-1:0),me=1;me<Oe;me++)ye[me-1]=arguments[me];return O(Te,xe,ye)}}function c(Te){return function(){for(var xe=arguments.length,Oe=Array(xe),ye=0;ye<xe;ye++)Oe[ye]=arguments[ye];return E(Te,Oe)}}function s(Te,xe){A&&A(Te,null);for(var Oe=xe.length;Oe--;){var ye=xe[Oe];if(typeof ye=="string"){var me=o(ye);me!==ye&&(W(xe)||(xe[Oe]=me),ye=me)}Te[ye]=!0}return Te}function a(Te){var xe=k(null),Oe=void 0;for(Oe in Te)O(G,Te,[Oe])&&(xe[Oe]=Te[Oe]);return xe}var v=R(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),p=R(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","audio","canvas","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","video","view","vkern"]),b=R(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=R(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),F=R(["#text"]),H=R(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns"]),X=R(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B=R(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),U=R(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z=N(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Z=N(/<%[\s\S]*|[\s\S]*%>/gm),ne=N(/^data-[\-\w.\u00B7-\uFFFF]/),oe=N(/^aria-[\-\w]+$/),Ce=N(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),he=N(/^(?:\w+script|data):/i),we=N(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Te){return typeof Te}:function(Te){return Te&&typeof Symbol=="function"&&Te.constructor===Symbol&&Te!==Symbol.prototype?"symbol":typeof Te};function pe(Te){if(Array.isArray(Te)){for(var xe=0,Oe=Array(Te.length);xe<Te.length;xe++)Oe[xe]=Te[xe];return Oe}else return Array.from(Te)}var se=function(){return typeof window=="undefined"?null:window},de=function(xe,Oe){if((typeof xe=="undefined"?"undefined":ve(xe))!=="object"||typeof xe.createPolicy!="function")return null;var ye=null,me="data-tt-policy-suffix";Oe.currentScript&&Oe.currentScript.hasAttribute(me)&&(ye=Oe.currentScript.getAttribute(me));var Me="dompurify"+(ye?"#"+ye:"");try{return xe.createPolicy(Me,{createHTML:function(Ie){return Ie}})}catch(Ne){return console.warn("TrustedTypes policy "+Me+" could not be created."),null}};function Le(){var Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:se(),xe=function(Ee){return Le(Ee)};if(xe.version="2.0.15",xe.removed=[],!Te||!Te.document||Te.document.nodeType!==9)return xe.isSupported=!1,xe;var Oe=Te.document,ye=!1,me=Te.document,Me=Te.DocumentFragment,Ne=Te.HTMLTemplateElement,Ie=Te.Node,Ae=Te.NodeFilter,Re=Te.NamedNodeMap,Ke=Re===void 0?Te.NamedNodeMap||Te.MozNamedAttrMap:Re,ze=Te.Text,Ge=Te.Comment,He=Te.DOMParser,ot=Te.trustedTypes;if(typeof Ne=="function"){var Xe=me.createElement("template");Xe.content&&Xe.content.ownerDocument&&(me=Xe.content.ownerDocument)}var Be=de(ot,Oe),be=Be&&Nt?Be.createHTML(""):"",qe=me,Ye=qe.implementation,Se=qe.createNodeIterator,ke=qe.getElementsByTagName,le=qe.createDocumentFragment,ie=Oe.importNode,ee=a(me).documentMode?me.documentMode:{},Y={};xe.isSupported=Ye&&typeof Ye.createHTMLDocument!="undefined"&&ee!==9;var $=z,J=Z,q=ne,ue=oe,ge=he,_e=we,Ve=Ce,Qe=null,Ze=s({},[].concat(pe(v),pe(p),pe(b),pe(P),pe(F))),st=null,pt=s({},[].concat(pe(H),pe(X),pe(B),pe(U))),tt=null,Rt=null,vt=!0,It=!0,Ut=!1,xt=!1,$t=!1,gr=!1,ir=!1,sr=!1,Jt=!1,Wr=!1,wt=!1,Nt=!1,At=!0,Et=!0,nt=!1,Ft={},vr=s({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","plaintext","script","style","svg","template","thead","title","video","xmp"]),yr=null,St=s({},["audio","video","img","source","image","track"]),Dr=null,Ir=s({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),Mr=null,Ue=me.createElement("form"),ft=function(Ee){if(Mr&&Mr===Ee)return;(!Ee||(typeof Ee=="undefined"?"undefined":ve(Ee))!=="object")&&(Ee={}),Ee=a(Ee),Qe="ALLOWED_TAGS"in Ee?s({},Ee.ALLOWED_TAGS):Ze,st="ALLOWED_ATTR"in Ee?s({},Ee.ALLOWED_ATTR):pt,Dr="ADD_URI_SAFE_ATTR"in Ee?s(a(Ir),Ee.ADD_URI_SAFE_ATTR):Ir,yr="ADD_DATA_URI_TAGS"in Ee?s(a(St),Ee.ADD_DATA_URI_TAGS):St,tt="FORBID_TAGS"in Ee?s({},Ee.FORBID_TAGS):{},Rt="FORBID_ATTR"in Ee?s({},Ee.FORBID_ATTR):{},Ft="USE_PROFILES"in Ee?Ee.USE_PROFILES:!1,vt=Ee.ALLOW_ARIA_ATTR!==!1,It=Ee.ALLOW_DATA_ATTR!==!1,Ut=Ee.ALLOW_UNKNOWN_PROTOCOLS||!1,xt=Ee.SAFE_FOR_JQUERY||!1,$t=Ee.SAFE_FOR_TEMPLATES||!1,gr=Ee.WHOLE_DOCUMENT||!1,Jt=Ee.RETURN_DOM||!1,Wr=Ee.RETURN_DOM_FRAGMENT||!1,wt=Ee.RETURN_DOM_IMPORT||!1,Nt=Ee.RETURN_TRUSTED_TYPE||!1,sr=Ee.FORCE_BODY||!1,At=Ee.SANITIZE_DOM!==!1,Et=Ee.KEEP_CONTENT!==!1,nt=Ee.IN_PLACE||!1,Ve=Ee.ALLOWED_URI_REGEXP||Ve,$t&&(It=!1),Wr&&(Jt=!0),Ft&&(Qe=s({},[].concat(pe(F))),st=[],Ft.html===!0&&(s(Qe,v),s(st,H)),Ft.svg===!0&&(s(Qe,p),s(st,X),s(st,U)),Ft.svgFilters===!0&&(s(Qe,b),s(st,X),s(st,U)),Ft.mathMl===!0&&(s(Qe,P),s(st,B),s(st,U))),Ee.ADD_TAGS&&(Qe===Ze&&(Qe=a(Qe)),s(Qe,Ee.ADD_TAGS)),Ee.ADD_ATTR&&(st===pt&&(st=a(st)),s(st,Ee.ADD_ATTR)),Ee.ADD_URI_SAFE_ATTR&&s(Dr,Ee.ADD_URI_SAFE_ATTR),Et&&(Qe["#text"]=!0),gr&&s(Qe,["html","head","body"]),Qe.table&&(s(Qe,["tbody"]),delete tt.tbody),R&&R(Ee),Mr=Ee},_r=function(Ee){g(xe.removed,{element:Ee});try{Ee.parentNode.removeChild(Ee)}catch(it){Ee.outerHTML=be}},Pr=function(Ee,it){try{g(xe.removed,{attribute:it.getAttributeNode(Ee),from:it})}catch(lt){g(xe.removed,{attribute:null,from:it})}it.removeAttribute(Ee)},je=function(Ee){var it=void 0,lt=void 0;if(sr)Ee="<remove></remove>"+Ee;else{var Lt=l(Ee,/^[\r\n\t ]+/);lt=Lt&&Lt[0]}var hr=Be?Be.createHTML(Ee):Ee;try{it=new He().parseFromString(hr,"text/html")}catch(Pt){}if(ye&&s(tt,["title"]),!it||!it.documentElement){it=Ye.createHTMLDocument("");var Qt=it,jt=Qt.body;jt.parentNode.removeChild(jt.parentNode.firstElementChild),jt.outerHTML=hr}return Ee&&lt&&it.body.insertBefore(me.createTextNode(lt),it.body.childNodes[0]||null),ke.call(it,gr?"html":"body")[0]};xe.isSupported&&function(){try{var dt=je("<x/><title>&lt;/title&gt;&lt;img&gt;");m(/<\/title/,dt.querySelector("title").innerHTML)&&(ye=!0)}catch(Ee){}}();var Vr=function(Ee){return Se.call(Ee.ownerDocument||Ee,Ee,Ae.SHOW_ELEMENT|Ae.SHOW_COMMENT|Ae.SHOW_TEXT,function(){return Ae.FILTER_ACCEPT},!1)},An=function(Ee){return Ee instanceof ze||Ee instanceof Ge?!1:typeof Ee.nodeName!="string"||typeof Ee.textContent!="string"||typeof Ee.removeChild!="function"||!(Ee.attributes instanceof Ke)||typeof Ee.removeAttribute!="function"||typeof Ee.setAttribute!="function"||typeof Ee.namespaceURI!="string"},ct=function(Ee){return(typeof Ie=="undefined"?"undefined":ve(Ie))==="object"?Ee instanceof Ie:Ee&&(typeof Ee=="undefined"?"undefined":ve(Ee))==="object"&&typeof Ee.nodeType=="number"&&typeof Ee.nodeName=="string"},cr=function(Ee,it,lt){if(!Y[Ee])return;T(Y[Ee],function(Lt){Lt.call(xe,it,lt,Mr)})},Hr=function(Ee){var it=void 0;if(cr("beforeSanitizeElements",Ee,null),An(Ee))return _r(Ee),!0;if(l(Ee.nodeName,/[\u0080-\uFFFF]/))return _r(Ee),!0;var lt=o(Ee.nodeName);if(cr("uponSanitizeElement",Ee,{tagName:lt,allowedTags:Qe}),(lt==="svg"||lt==="math")&&Ee.querySelectorAll("p, br").length!==0)return _r(Ee),!0;if(!Qe[lt]||tt[lt]){if(Et&&!vr[lt]&&typeof Ee.insertAdjacentHTML=="function")try{var Lt=Ee.innerHTML;Ee.insertAdjacentHTML("AfterEnd",Be?Be.createHTML(Lt):Lt)}catch(hr){}return _r(Ee),!0}return lt==="noscript"&&m(/<\/noscript/i,Ee.innerHTML)||lt==="noembed"&&m(/<\/noembed/i,Ee.innerHTML)?(_r(Ee),!0):(xt&&!ct(Ee.firstElementChild)&&(!ct(Ee.content)||!ct(Ee.content.firstElementChild))&&m(/</g,Ee.textContent)&&(g(xe.removed,{element:Ee.cloneNode()}),Ee.innerHTML?Ee.innerHTML=d(Ee.innerHTML,/</g,"&lt;"):Ee.innerHTML=d(Ee.textContent,/</g,"&lt;")),$t&&Ee.nodeType===3&&(it=Ee.textContent,it=d(it,$," "),it=d(it,J," "),Ee.textContent!==it&&(g(xe.removed,{element:Ee.cloneNode()}),Ee.textContent=it)),cr("afterSanitizeElements",Ee,null),!1)},Xr=function(Ee,it,lt){if(At&&(it==="id"||it==="name")&&(lt in me||lt in Ue))return!1;if(!(It&&m(q,it))){if(!(vt&&m(ue,it))){if(!st[it]||Rt[it])return!1;if(!Dr[it]){if(!m(Ve,d(lt,_e,""))){if(!((it==="src"||it==="xlink:href"||it==="href")&&Ee!=="script"&&w(lt,"data:")===0&&yr[Ee])){if(!(Ut&&!m(ge,d(lt,_e,"")))){if(lt)return!1}}}}}}return!0},fr=function(Ee){var it=void 0,lt=void 0,Lt=void 0,hr=void 0,Qt=void 0;cr("beforeSanitizeAttributes",Ee,null);var jt=Ee.attributes;if(!jt)return;var Pt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:st};for(Qt=jt.length;Qt--;){it=jt[Qt];var Dn=it,Cr=Dn.name,Ur=Dn.namespaceURI;if(lt=f(it.value),Lt=o(Cr),Pt.attrName=Lt,Pt.attrValue=lt,Pt.keepAttr=!0,Pt.forceKeepAttr=void 0,cr("uponSanitizeAttribute",Ee,Pt),lt=Pt.attrValue,Pt.forceKeepAttr)continue;if(Lt==="name"&&Ee.nodeName==="IMG"&&jt.id)hr=jt.id,jt=u(jt,[]),Pr("id",Ee),Pr(Cr,Ee),_(jt,hr)>Qt&&Ee.setAttribute("id",hr.value);else{if(Ee.nodeName==="INPUT"&&Lt==="type"&&lt==="file"&&Pt.keepAttr&&(st[Lt]||!Rt[Lt]))continue;Cr==="id"&&Ee.setAttribute(Cr,""),Pr(Cr,Ee)}if(!Pt.keepAttr)continue;if(xt&&m(/\/>/i,lt)){Pr(Cr,Ee);continue}if(m(/svg|math/i,Ee.namespaceURI)&&m(L("</("+C(M(vr),"|")+")","i"),lt)){Pr(Cr,Ee);continue}$t&&(lt=d(lt,$," "),lt=d(lt,J," "));var br=Ee.nodeName.toLowerCase();if(!Xr(br,Lt,lt))continue;try{Ur?Ee.setAttributeNS(Ur,Cr,lt):Ee.setAttribute(Cr,lt),y(xe.removed)}catch(Ci){}}cr("afterSanitizeAttributes",Ee,null)},kr=function dt(Ee){var it=void 0,lt=Vr(Ee);for(cr("beforeSanitizeShadowDOM",Ee,null);it=lt.nextNode();){if(cr("uponSanitizeShadowNode",it,null),Hr(it))continue;it.content instanceof Me&&dt(it.content),fr(it)}cr("afterSanitizeShadowDOM",Ee,null)};return xe.sanitize=function(dt,Ee){var it=void 0,lt=void 0,Lt=void 0,hr=void 0,Qt=void 0;if(dt||(dt="<!-->"),typeof dt!="string"&&!ct(dt)){if(typeof dt.toString!="function")throw x("toString is not a function");if(dt=dt.toString(),typeof dt!="string")throw x("dirty is not a string, aborting")}if(!xe.isSupported){if(ve(Te.toStaticHTML)==="object"||typeof Te.toStaticHTML=="function"){if(typeof dt=="string")return Te.toStaticHTML(dt);if(ct(dt))return Te.toStaticHTML(dt.outerHTML)}return dt}if(ir||ft(Ee),xe.removed=[],typeof dt=="string"&&(nt=!1),!nt)if(dt instanceof Ie)it=je("<!-->"),lt=it.ownerDocument.importNode(dt,!0),lt.nodeType===1&&lt.nodeName==="BODY"||lt.nodeName==="HTML"?it=lt:it.appendChild(lt);else{if(!Jt&&!$t&&!gr&&dt.indexOf("<")===-1)return Be&&Nt?Be.createHTML(dt):dt;if(it=je(dt),!it)return Jt?null:be}it&&sr&&_r(it.firstChild);for(var jt=Vr(nt?dt:it);Lt=jt.nextNode();){if(Lt.nodeType===3&&Lt===hr)continue;if(Hr(Lt))continue;Lt.content instanceof Me&&kr(Lt.content),fr(Lt),hr=Lt}if(hr=null,nt)return dt;if(Jt){if(Wr)for(Qt=le.call(it.ownerDocument);it.firstChild;)Qt.appendChild(it.firstChild);else Qt=it;return wt&&(Qt=ie.call(Oe,Qt,!0)),Qt}var Pt=gr?it.outerHTML:it.innerHTML;return $t&&(Pt=d(Pt,$," "),Pt=d(Pt,J," ")),Be&&Nt?Be.createHTML(Pt):Pt},xe.setConfig=function(dt){ft(dt),ir=!0},xe.clearConfig=function(){Mr=null,ir=!1},xe.isValidAttribute=function(dt,Ee,it){Mr||ft({});var lt=o(dt),Lt=o(Ee);return Xr(lt,Lt,it)},xe.addHook=function(dt,Ee){if(typeof Ee!="function")return;Y[dt]=Y[dt]||[],g(Y[dt],Ee)},xe.removeHook=function(dt){Y[dt]&&y(Y[dt])},xe.removeHooks=function(dt){Y[dt]&&(Y[dt]=[])},xe.removeAllHooks=function(){Y={}},xe}var We=Le();return We})}}]);