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.
144 lines
740 KiB
144 lines
740 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[242,5,6,7],{"+NIl":function(lt,Qe,oe){(function(ne){ne(oe("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function(V,L){"use strict";function G(C,S){C.cmdState.push(S)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var S=C.cmdState.pop();S&&S.closeBracket()}function B(C){for(var S=C.cmdState,y=S.length-1;y>=0;y--){var d=S[y];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function F(C,S,y){return function(){this.name=C,this.bracketNo=0,this.style=S,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var _={};_.importmodule=F("importmodule","tag",["string","builtin"]),_.documentclass=F("documentclass","tag",["","atom"]),_.usepackage=F("usepackage","tag",["atom"]),_.begin=F("begin","tag",["atom"]),_.end=F("end","tag",["atom"]),_.label=F("label","tag",["atom"]),_.ref=F("ref","tag",["atom"]),_.eqref=F("eqref","tag",["atom"]),_.cite=F("cite","tag",["atom"]),_.bibitem=F("bibitem","tag",["atom"]),_.Bibitem=F("Bibitem","tag",["atom"]),_.RBibitem=F("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,S){C.f=S}function T(C,S){var y;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return y=_.hasOwnProperty(d)?_[d]:_.DEFAULT,y=new y,G(S,y),D(S,P),y.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(S,function(s,u){return A(s,u,"\\]")}),"keyword";if(C.match("\\("))return D(S,function(s,u){return A(s,u,"\\)")}),"keyword";if(C.match("$$"))return D(S,function(s,u){return A(s,u,"$$")}),"keyword";if(C.match("$"))return D(S,function(s,u){return A(s,u,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(y=I(S),y)y.closeBracket(o),D(S,P);else return"error";return"bracket"}else return o=="{"||o=="["?(y=_.DEFAULT,y=new y,G(S,y),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),y=B(S),y.name=="begin"&&(y.argument=C.current()),y.styleIdentifier())}function A(C,S,y){if(C.eatSpace())return null;if(y&&C.match(y))return D(S,T),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function P(C,S){var y=C.peek(),d;return y=="{"||y=="["?(d=I(S),d.openBracket(y),C.eat(y),D(S,T),"bracket"):/[ \t\r]/.test(y)?(C.eat(y),null):(D(S,T),R(S),T(C,S))}return{startState:function(){var C=L.inMathMode?function(S,y){return A(S,y)}:T;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,S){return S.f(C,S)},blankLine:function(C){C.f=T,C.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(lt,Qe,oe){(function(ne){ne(oe("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(F,_,D){var T=D&&D!=ne.Init;if(_&&!T)F.on("blur",I),F.on("change",R),F.on("swapDoc",R),ne.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){G(F)}),R(F);else if(!_&&T){F.off("blur",I),F.off("change",R),F.off("swapDoc",R),ne.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),V(F);var A=F.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}_&&!F.hasFocus()&&I(F)});function V(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function L(F){V(F);var _=F.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=F.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var D=F.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),_.appendChild(D),F.display.lineSpace.insertBefore(_,F.display.lineSpace.firstChild)}function G(F){setTimeout(function(){var _=!1,D=F.getInputField();D.nodeName=="TEXTAREA"?_=!D.value:F.lineCount()==1&&(_=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),_?L(F):V(F)},20)}function I(F){B(F)&&L(F)}function R(F){var _=F.getWrapperElement(),D=B(F);_.className=_.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(F):V(F)}function B(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(lt,Qe,oe){(function(ne){ne(oe("VrN/"))})(function(ne){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(G,I){var R=G.indentUnit,B={},F=I.htmlMode?V:L;for(var _ in F)B[_]=F[_];for(var _ in I)B[_]=I[_];var D,T;function A(a,g){function p(U){return g.tokenize=U,U(a,g)}var v=a.next();if(v=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(S("atom","]]>")):null:a.match("--")?p(S("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(y(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=S("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",g.tokenize=P,"tag bracket");if(v=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function P(a,g){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return g.tokenize=A,D=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return D="equals",null;if(p=="<"){g.tokenize=A,g.state=u,g.tagName=g.tagStart=null;var v=g.tokenize(a,g);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(p)?(g.tokenize=C(p),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var g=function(p,v){for(;!p.eol();)if(p.next()==a){v.tokenize=P;break}return"string"};return g.isInAttribute=!0,g}function S(a,g){return function(p,v){for(;!p.eol();){if(p.match(g)){v.tokenize=A;break}p.next()}return a}}function y(a){return function(g,p){for(var v;(v=g.next())!=null;){if(v=="<")return p.tokenize=y(a+1),p.tokenize(g,p);if(v==">")if(a==1){p.tokenize=A;break}else return p.tokenize=y(a-1),p.tokenize(g,p)}return"meta"}}function d(a,g,p){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=p,(B.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,g){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!B.contextGrabbers.hasOwnProperty(p)||!B.contextGrabbers[p].hasOwnProperty(g))return;o(a)}}function u(a,g,p){return a=="openTag"?(p.tagStart=g.column(),E):a=="closeTag"?f:u}function E(a,g,p){return a=="word"?(p.tagName=g.current(),T="tag",b):B.allowMissingTagName&&a=="endTag"?(T="tag bracket",b(a,g,p)):(T="error",E)}function f(a,g,p){if(a=="word"){var v=g.current();return p.context&&p.context.tagName!=v&&B.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==v||B.matchClosing===!1?(T="tag",m):(T="tag error",w)}else return B.allowMissingTagName&&a=="endTag"?(T="tag bracket",m(a,g,p)):(T="error",w)}function m(a,g,p){return a!="endTag"?(T="error",m):(o(p),u)}function w(a,g,p){return T="error",m(a,g,p)}function b(a,g,p){if(a=="word")return T="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var v=p.tagName,M=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(v)?s(p,v):(s(p,v),p.context=new d(p,v,M==p.indented)),u}return T="error",b}function h(a,g,p){return a=="equals"?c:(B.allowMissing||(T="error"),b(a,g,p))}function c(a,g,p){return a=="string"?l:a=="word"&&B.allowUnquoted?(T="string",b):(T="error",b(a,g,p))}function l(a,g,p){return a=="string"?l:b(a,g,p)}return{startState:function(a){var g={tokenize:A,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;D=null;var p=g.tokenize(a,g);return(p||D)&&p!="comment"&&(T=null,g.state=g.state(D||p,a,g),T&&(p=T=="error"?p+" error":T)),p},indent:function(a,g,p){var v=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(v&&v.noIndent)return ne.Pass;if(a.tokenize!=P&&a.tokenize!=A)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var M=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(M&&M[1])for(;v;)if(v.tagName==M[2]){v=v.prev;break}else if(B.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(M)for(;v;){var U=B.contextGrabbers[v.tagName];if(U&&U.hasOwnProperty(M[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],p=a.context;p;p=p.prev)p.tagName&&g.push(p.tagName);return g.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return s}),oe.d(Qe,"b",function(){return b});var ne=oe("Ty5D"),V=oe("dI71"),L=oe("cDcd"),G=oe.n(L),I=oe("YS25"),R=oe("17x9"),B=oe.n(R),F=oe("wx14"),_=oe("zLVn"),D=oe("9R94"),T=function(c){Object(V.a)(l,c);function l(){for(var g,p=arguments.length,v=new Array(p),M=0;M<p;M++)v[M]=arguments[M];return g=c.call.apply(c,[this].concat(v))||this,g.history=Object(I.a)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},l}(G.a.Component),A=function(c){Object(V.a)(l,c);function l(){for(var g,p=arguments.length,v=new Array(p),M=0;M<p;M++)v[M]=arguments[M];return g=c.call.apply(c,[this].concat(v))||this,g.history=Object(I.b)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},l}(G.a.Component),P=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(I.c)(l,null,null,a):l},S=function(l){return l},y=G.a.forwardRef;typeof y=="undefined"&&(y=S);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=y(function(c,l){var a=c.innerRef,g=c.navigate,p=c.onClick,v=Object(_.a)(c,["innerRef","navigate","onClick"]),M=v.target,U=Object(F.a)({},v,{onClick:function(W){try{p&&p(W)}catch(O){throw W.preventDefault(),O}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!d(W)&&(W.preventDefault(),g())}});return S!==y?U.ref=l||a:U.ref=a,G.a.createElement("a",U)}),s=y(function(c,l){var a=c.component,g=a===void 0?o:a,p=c.replace,v=c.to,M=c.innerRef,U=Object(_.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(ne.e.Consumer,null,function(j){j||Object(D.a)(!1);var W=j.history,O=C(P(v,j.location),j.location),k=O?W.createHref(O):"",H=Object(F.a)({},U,{href:k,navigate:function(){var Z=P(v,j.location),te=p?W.replace:W.push;te(Z)}});return S!==y?H.ref=l||M:H.innerRef=M,G.a.createElement(g,H)})});if(!1)var u,E;var f=function(l){return l},m=G.a.forwardRef;typeof m=="undefined"&&(m=f);function w(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(g){return g}).join(" ")}var b=m(function(c,l){var a=c["aria-current"],g=a===void 0?"page":a,p=c.activeClassName,v=p===void 0?"active":p,M=c.activeStyle,U=c.className,j=c.exact,W=c.isActive,O=c.location,k=c.sensitive,H=c.strict,X=c.style,Z=c.to,te=c.innerRef,Ee=Object(_.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(ne.e.Consumer,null,function(fe){fe||Object(D.a)(!1);var Te=O||fe.location,pe=C(P(Z,Te),Te),ge=pe.pathname,ce=ge&&ge.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),he=ce?Object(ne.f)(Te.pathname,{path:ce,exact:j,sensitive:k,strict:H}):null,J=!!(W?W(he,Te):he),se=J?w(U,v):U,q=J?Object(F.a)({},X,{},M):X,ye=Object(F.a)({"aria-current":J&&g||null,className:se,style:q,to:pe},Ee);return f!==m?ye.ref=l||te:ye.innerRef=te,G.a.createElement(s,ye)})});if(!1)var h},"7ahc":function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return E});var ne=oe("k1fw"),V=oe("0Owb"),L=oe("+L6B"),G=oe("2/Rp"),I=oe("y8nQ"),R=oe("Vl3Y"),B=oe("tJVT"),F=oe("OaEy"),_=oe("2fM7"),D=oe("cDcd"),T=oe.n(D),A=oe("VrN/"),P=oe.n(A),C=oe("p77/"),S=oe.n(C),y=oe("c5Ni"),d=oe.n(y),o=_.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Qe.b=function(f){var m=f.callback,w=f.onCancel,b=Object(D.useState)("python"),h=Object(B.a)(b,2),c=h[0],l=h[1];function a(p){l(u[p][1])}function g(p){m(p)}return T.a.createElement(R.a,Object(V.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),T.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},T.a.createElement(_.a,{onChange:a},Object.keys(u).map(function(p){return T.a.createElement(o,{key:p,value:p},u[p][0])}))),T.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},T.a.createElement(E,{mode:c})),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(G.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function E(f){var m=f.value,w=f.onChange,b=f.mode,h=f.options,c=h===void 0?{}:h,l=Object(D.useRef)(),a=Object(D.useState)(),g=Object(B.a)(a,2),p=g[0],v=g[1];return Object(D.useEffect)(function(){if(p){function M(U){var j=U.getValue();w&&w(j)}return p.on("change",M),function(){p.off("change",M)}}},[p,w]),Object(D.useEffect)(function(){p&&p.setOption("mode",b)},[p,b]),Object(D.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(D.useEffect)(function(){if(l.current&&!p){var M=P.a.fromTextArea(l.current,Object(ne.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(M)}},[l.current,p]),T.a.createElement("div",{className:"my-codemirror-container"},T.a.createElement("textarea",{ref:l}))}},"8EBN":function(lt,Qe,oe){(function(ne){ne(oe("VrN/"))})(function(ne){"use strict";ne.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<ne.modeInfo.length;V++){var L=ne.modeInfo[V];L.mimes&&(L.mime=L.mimes[0])}ne.findModeByMIME=function(G){G=G.toLowerCase();for(var I=0;I<ne.modeInfo.length;I++){var R=ne.modeInfo[I];if(R.mime==G)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==G)return R}}if(/\+xml$/.test(G))return ne.findModeByMIME("application/xml");if(/\+json$/.test(G))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(G){G=G.toLowerCase();for(var I=0;I<ne.modeInfo.length;I++){var R=ne.modeInfo[I];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==G)return R}}},ne.findModeByFileName=function(G){for(var I=0;I<ne.modeInfo.length;I++){var R=ne.modeInfo[I];if(R.file&&R.file.test(G))return R}var B=G.lastIndexOf("."),F=B>-1&&G.substring(B+1,G.length);if(F)return ne.findModeByExtension(F)},ne.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I<ne.modeInfo.length;I++){var R=ne.modeInfo[I];if(R.name.toLowerCase()==G)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==G)return R}}}})},"9Bee":function(lt,Qe,oe){"use strict";var ne=oe("k1fw"),V=oe("tJVT"),L=oe("cDcd"),G=oe.n(L),I=oe("vg9a"),R=oe("DlQD"),B=oe.n(R),F=oe("rUJ1");function _(H,X){var Z=H.match(/^(\s+)(?:```)/);if(Z===null)return X;var te=Z[1];return X.split(`
|
|
`).map(function(Ee){var fe=Ee.match(/^\s+/);if(fe===null)return Ee;var Te=Object(V.a)(fe,1),pe=Te[0];return pe.length>=te.length?Ee.slice(te.length):Ee}).join(`
|
|
`)}var D=[],T=["<ul>"],A=new B.a.Renderer,P=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){D.length=0,T=["<ul>"]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(H,X,Z,te){if(X>=H.length||H[X].level<=Z)return X;var Ee=H[X];te.push("<li><a href='#"+Ee.anchor+"'>"+Ee.text+"</a>"),X++;var fe=[];return X=y(H,X,Ee.level,fe),fe.length>0&&(te.push("<ul>"),fe.forEach(function(Te){te.push(Te)}),te.push("</ul>")),te.push("</li>"),X=y(H,X,Z,te),X}function d(){return y(D,0,0,T),T.push("</ul>"),T.join("")}var o={heading:function(X){var Z=P.exec(X);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},fences:function(X){var Z=this.rules.block.fences.exec(X);if(Z){var te=Z[0],Ee=_(te,Z[3]||""),fe=Z[2]?Z[2].trim():Z[2];if(["latex","katex","math"].indexOf(fe)>=0){var Te=E(),pe=Ee;Ee=Te,f[Te]={type:"block",expression:pe}}return{type:"code",raw:te,lang:fe,text:Ee}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,E=function(){return"__special_katext_id_".concat(u++,"__")},f={};function m(){return f}function w(){u=0,f={}}function b(H){return H=H.replace(s,function(X,Z){var te=E();return f[te]={type:"inline",expression:Z},te}),H}var h=A.listitem;A.listitem=function(H){return h(b(H))};var c=A.paragraph;A.paragraph=function(H){return c(b(H))};var l=A.tablecell;A.tablecell=function(H,X){return l(b(H),X)},A.code=function(H,X,Z){var te=(X||"").match(/\S*/)[0];return te?["latex","katex","math"].indexOf(te)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(X,'">').concat(Z?H:Object(F.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(Z?H:Object(F.escape)(H,!0))+"</code></pre>"},A.heading=function(H,X,Z){var te=this.options.headerPrefix+Z.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return D.push({anchor:te,level:X,text:H}),"<h"+X+' id="'+te+'">'+H+"</h"+X+">"},B.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),B.a.use({tokenizer:o,renderer:A});var a=B.a,g=oe("SJMd"),p=oe("ulZh"),v=oe.n(p),M=oe("m3rI"),U=oe("Oy/b"),j=oe("p5ED"),W=/<pre[^>]*>/g;function O(H){var X=document.createElement("div");return X.innerHTML=H,X.childNodes.length===0?"":X.childNodes[0].nodeValue}var k=Qe.a=function(H){var X=H.value,Z=X===void 0?"":X,te=H.className,Ee=H.showTextOnly,fe=H.showLines,Te=H.style,pe=Te===void 0?{}:Te,ge=H.stylesPrev,ce=ge===void 0?{}:ge,he=String(Z),J=Object(L.useState)(""),se=Object(V.a)(J,2),q=se[0],ye=se[1],Se=Object(L.useMemo)(function(){try{var ke=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ie=/\"\/api\/attachments\/|\"\/attachments\/download\//g,De=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;he=he.replace(ke,"("+M.a.API_SERVER+"/api/attachments/").replace(Ie,'"'+M.a.API_SERVER+"/api/attachments/").replace(De,'"'+M.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),he=he.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Ve){}var Le=a(he),ze=m();if(he.match(/\[TOC\]/)&&(Le=Le.replace("<p>[TOC]</p>",d()),C()),Le=Le.replace(/(__special_katext_id_\d+__)/g,function(Ve,je){var Xe=ze[je],Be=Xe.type,He=Xe.expression;return Object(U.renderToString)(O(He)||"",{displayMode:Be==="block",throwOnError:!1,output:"html"})}),Le=Le.replace(/▁/g,"\u2581\u2581\u2581"),w(),Ee){var Ye=document.createElement("div");return Ye.innerHTML=Le,Ye.innerText}return setTimeout(function(){return _e()},500),Le},[he]),me=Object(L.useRef)();S.WebkitLineClamp=fe,fe&&(pe=Object(ne.a)(Object(ne.a)({},pe),S));function we(ke){var Ie=ke.target;if(Ie.tagName.toUpperCase()==="A"){var De=Ie.getAttribute("href");if(De.indexOf("office")>-1)ke.preventDefault(),ye(De);else if(De.startsWith("#")){ke.preventDefault();var Le=document.getElementById(De.replace("#",""));Le&&Le.scrollIntoView(!0)}}}var _e=function(){var Ie,De=(Ie=me.current)===null||Ie===void 0?void 0:Ie.querySelectorAll("video");De==null||De.forEach(function(Le){if(Le.oncontextmenu=function(){return!1},Le.src.indexOf(".m3u8")>-1&&!Le.canPlayType("application/vnd.apple.mpegurl")){if(v.a.isSupported()){var ze=new v.a;ze.loadSource(Le.src),ze.attachMedia(Le)}}})};return Object(L.useEffect)(function(){if(me.current&&Se&&(Se.match(W)&&window.PR.prettyPrint()),me.current)return me.current.addEventListener("click",we),function(){me.current.removeEventListener("click",we),w(),C()}},[Se,me.current,we]),G.a.createElement(G.a.Fragment,null,G.a.createElement("div",{ref:me,style:Object(ne.a)({},pe),className:"".concat(te||""," markdown-body "),dangerouslySetInnerHTML:{__html:Se}}),G.a.createElement(j.a,{close:!0,data:q,type:q!=null&&q.length?"office":"",style:Object(ne.a)({},ce),onClose:function(){return ye("")}}))}},"9VGf":function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return L});var ne=oe("cDcd"),V=oe.n(ne);function L(G,I){var R=Object(ne.useRef)();Object(ne.useEffect)(function(){R.current=G}),Object(ne.useEffect)(function(){function B(){R.current()}if(I!==null){var F=setInterval(B,I);return function(){return clearInterval(F)}}},[I])}},BU3w:function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return R});var ne=oe("MNnm"),V="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var F=document.querySelector("head");return F||document.body}function G(B){var F,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var D=document.createElement("style");if((F=_.csp)===null||F===void 0?void 0:F.nonce){var T;D.nonce=(T=_.csp)===null||T===void 0?void 0:T.nonce}D.innerHTML=B;var A=L(_),P=A.firstChild;return _.prepend&&A.prepend?A.prepend(D):_.prepend&&P?A.insertBefore(D,P):A.appendChild(D),D}var I=new Map;function R(B,F){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=L(_);if(!I.has(D)){var T=G("",_),A=T.parentNode;I.set(D,A),A.removeChild(T)}var P=Array.from(I.get(D).children).find(function(o){return o.tagName==="STYLE"&&o[V]===F});if(P){var C,S;if(((C=_.csp)===null||C===void 0?void 0:C.nonce)&&P.nonce!==((S=_.csp)===null||S===void 0?void 0:S.nonce)){var y;P.nonce=(y=_.csp)===null||y===void 0?void 0:y.nonce}return P.innerHTML!==B&&(P.innerHTML=B),P}var d=G(B,_);return d[V]=F,d}},Bd2K:function(lt,Qe,oe){(function(ne){ne(oe("VrN/"),oe("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(_,D,T){if(T!=ne.Init&&T&&_.removeKeyMap("autoCloseTags"),!D)return;var A={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(A["'/'"]=function(P){return R(P)}),(typeof D!="object"||D.whenOpening!==!1)&&(A["'>'"]=function(P){return G(P)}),_.addKeyMap(A)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function G(_){if(_.getOption("disableInput"))return ne.Pass;for(var D=_.listSelections(),T=[],A=_.getOption("autoCloseTags"),P=0;P<D.length;P++){if(!D[P].empty())return ne.Pass;var C=D[P].head,S=_.getTokenAt(C),y=ne.innerMode(_.getMode(),S.state),d=y.state,o=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(d),s=o&&o.name;if(!s)return ne.Pass;var u=y.mode.configuration=="html",E=typeof A=="object"&&A.dontCloseTags||u&&V,f=typeof A=="object"&&A.indentTags||u&&L;S.end>C.ch&&(s=s.slice(0,s.length-S.end+C.ch));var m=s.toLowerCase();if(!s||S.type=="string"&&(S.end!=C.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&o.close||S.string.indexOf("/")==C.ch-S.start-1||E&&B(E,m)>-1||F(_,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(d)||[],s,C,!0))return ne.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&B(w,s)>-1){T[P]={text:"/>",newPos:ne.Pos(C.line,C.ch+2)};continue}var b=f&&B(f,m)>-1;T[P]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+s+">",newPos:b?ne.Pos(C.line+1,0):ne.Pos(C.line,C.ch+1)}}for(var h=typeof A=="object"&&A.dontIndentOnAutoClose,P=D.length-1;P>=0;P--){var c=T[P];_.replaceRange(c.text,D[P].head,D[P].anchor,"+insert");var l=_.listSelections().slice(0);l[P]={head:c.newPos,anchor:c.newPos},_.setSelections(l),!h&&c.indent&&(_.indentLine(c.newPos.line,null,!0),_.indentLine(c.newPos.line+1,null,!0))}}function I(_,D){for(var T=_.listSelections(),A=[],P=D?"/":"</",C=_.getOption("autoCloseTags"),S=typeof C=="object"&&C.dontIndentOnSlash,y=0;y<T.length;y++){if(!T[y].empty())return ne.Pass;var d=T[y].head,o=_.getTokenAt(d),s=ne.innerMode(_.getMode(),o.state),u=s.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return ne.Pass;var E,f=s.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")E=P+"script";else if(f&&s.mode.name=="css")E=P+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!m||m.length&&F(_,m,m[m.length-1],d))return ne.Pass;E=P+m[m.length-1]}_.getLine(d.line).charAt(o.end)!=">"&&(E+=">"),A[y]=E}if(_.replaceSelections(A),T=_.listSelections(),!S)for(var y=0;y<T.length;y++)(y==T.length-1||T[y].head.line<T[y+1].head.line)&&_.indentLine(T[y].head.line)}function R(_){return _.getOption("disableInput")?ne.Pass:I(_,!0)}ne.commands.closeTag=function(_){return I(_)};function B(_,D){if(_.indexOf)return _.indexOf(D);for(var T=0,A=_.length;T<A;++T)if(_[T]==D)return T;return-1}function F(_,D,T,A,P){if(!ne.scanForClosingTag)return!1;var C=Math.min(_.lastLine()+1,A.line+500),S=ne.scanForClosingTag(_,A,null,C);if(!S||S.tag!=T)return!1;for(var y=P?1:0,d=D.length-1;d>=0&&D[d]==T;d--)++y;A=S.to;for(var d=1;d<y;d++){var o=ne.scanForClosingTag(_,A,null,C);if(!o||o.tag!=T)return!1;A=o.to}return!0}})},BjJ7:function(lt,Qe,oe){"use strict";oe.d(Qe,"d",function(){return V}),oe.d(Qe,"c",function(){return L}),oe.d(Qe,"e",function(){return G}),oe.d(Qe,"b",function(){return I}),oe.d(Qe,"a",function(){return B});var ne=oe("m3rI");function V(F){var _=!0;if(F.length>0){for(var D=0;D<F.length;D++)if(F[D].compile_success==0||!F[D].compile_success){_=!1;break}}else _=!1;return _}function L(F){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],T=0;T<F.length;T++){var A=F[T],P=_?"".concat(_,"/").concat(A.name):"".concat(A.name);D.push({title:A.name,isLeaf:!(A.type==="tree"),key:P})}return D}function G(F,_,D){for(var T=0;T<F.length;T++){var A=F[T];if(A.key===_){A.children=D;break}A.children&&G(A.children,_,D)}return F}function I(F,_,D){var T;return function(){var A=this,P=arguments,C=function(){T=null,D||F.apply(A,P)},S=D&&!T;clearTimeout(T),T=setTimeout(C,_),S&&F.apply(A,P)}}var R=!0,B=ne.a.API_SERVER},"C+DQ":function(lt,Qe,oe){},DlQD:function(lt,Qe,oe){(function(ne,V){lt.exports=V()})(this,function(){"use strict";function ne(ae,le){for(var ue=0;ue<le.length;ue++){var $=le[ue];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(ae,$.key,$)}}function V(ae,le,ue){return le&&ne(ae.prototype,le),ue&&ne(ae,ue),ae}function L(ae,le){if(!ae)return;if(typeof ae=="string")return G(ae,le);var ue=Object.prototype.toString.call(ae).slice(8,-1);if(ue==="Object"&&ae.constructor&&(ue=ae.constructor.name),ue==="Map"||ue==="Set")return Array.from(ae);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return G(ae,le)}function G(ae,le){(le==null||le>ae.length)&&(le=ae.length);for(var ue=0,$=new Array(le);ue<le;ue++)$[ue]=ae[ue];return $}function I(ae,le){var ue;if(typeof Symbol=="undefined"||ae[Symbol.iterator]==null){if(Array.isArray(ae)||(ue=L(ae))||le&&ae&&typeof ae.length=="number"){ue&&(ae=ue);var $=0;return function(){return $>=ae.length?{done:!0}:{done:!1,value:ae[$++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ue=ae[Symbol.iterator](),ue.next.bind(ue)}function R(ae,le){return le={exports:{}},ae(le,le.exports),le.exports}var B=R(function(ae){function le(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ue($){ae.exports.defaults=$}ae.exports={defaults:le(),getDefaults:le,changeDefaults:ue}}),F=B.defaults,_=B.getDefaults,D=B.changeDefaults,T=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,S={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(le){return S[le]};function d(ae,le){if(le){if(T.test(ae))return ae.replace(A,y)}else if(P.test(ae))return ae.replace(C,y);return ae}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ae){return ae.replace(o,function(le,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var u=/(^|[^\[])\^/g;function E(ae,le){ae=ae.source||ae,le=le||"";var ue={replace:function(Q,ee){return ee=ee.source||ee,ee=ee.replace(u,"$1"),ae=ae.replace(Q,ee),ue},getRegex:function(){return new RegExp(ae,le)}};return ue}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(ae,le,ue){if(ae){var $;try{$=decodeURIComponent(s(ue)).replace(f,"").toLowerCase()}catch(Q){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}le&&!m.test(ue)&&(ue=a(le,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(Q){return null}return ue}var b={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ae,le){b[" "+ae]||(h.test(ae)?b[" "+ae]=ae+"/":b[" "+ae]=M(ae,"/",!0)),ae=b[" "+ae];var ue=ae.indexOf(":")===-1;return le.substring(0,2)==="//"?ue?le:ae.replace(c,"$1")+le:le.charAt(0)==="/"?ue?le:ae.replace(l,"$1")+le:ae+le}var g={exec:function(){}};function p(ae){for(var le=1,ue,$;le<arguments.length;le++){ue=arguments[le];for($ in ue)Object.prototype.hasOwnProperty.call(ue,$)&&(ae[$]=ue[$])}return ae}function v(ae,le){var ue=ae.replace(/\|/g,function(ee,re,be){for(var Ce=!1,Me=re;--Me>=0&&be[Me]==="\\";)Ce=!Ce;return Ce?"|":" |"}),$=ue.split(/ \|/),Q=0;if($.length>le)$.splice(le);else for(;$.length<le;)$.push("");for(;Q<$.length;Q++)$[Q]=$[Q].trim().replace(/\\\|/g,"|");return $}function M(ae,le,ue){var $=ae.length;if($===0)return"";for(var Q=0;Q<$;){var ee=ae.charAt($-Q-1);if(ee===le&&!ue)Q++;else if(ee!==le&&ue)Q++;else break}return ae.substr(0,$-Q)}function U(ae,le){if(ae.indexOf(le[1])===-1)return-1;for(var ue=ae.length,$=0,Q=0;Q<ue;Q++)if(ae[Q]==="\\")Q++;else if(ae[Q]===le[0])$++;else if(ae[Q]===le[1]&&($--,$<0))return Q;return-1}function j(ae){ae&&ae.sanitize&&!ae.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:d,unescape:s,edit:E,cleanUrl:w,resolveUrl:a,noopTest:g,merge:p,splitCells:v,rtrim:M,findClosingBracket:U,checkSanitizeDeprecation:j},O=B.defaults,k=W.rtrim,H=W.splitCells,X=W.escape,Z=W.findClosingBracket;function te(ae,le,ue){var $=le.href,Q=le.title?X(le.title):null,ee=ae[1].replace(/\\([\[\]])/g,"$1");return ae[0].charAt(0)!=="!"?{type:"link",raw:ue,href:$,title:Q,text:ee}:{type:"image",raw:ue,href:$,title:Q,text:X(ee)}}function Ee(ae,le){var ue=ae.match(/^(\s+)(?:```)/);if(ue===null)return le;var $=ue[1];return le.split(`
|
|
`).map(function(Q){var ee=Q.match(/^\s+/);if(ee===null)return Q;var re=ee[0];return re.length>=$.length?Q.slice($.length):Q}).join(`
|
|
`)}var fe=function(){function ae(ue){this.options=ue||O}var le=ae.prototype;return le.space=function($){var Q=this.rules.block.newline.exec($);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},le.code=function($,Q){var ee=this.rules.block.code.exec($);if(ee){var re=Q[Q.length-1];if(re&&re.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var be=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?be:k(be,`
|
|
`)}}},le.fences=function($){var Q=this.rules.block.fences.exec($);if(Q){var ee=Q[0],re=Ee(ee,Q[3]||"");return{type:"code",raw:ee,lang:Q[2]?Q[2].trim():Q[2],text:re}}},le.heading=function($){var Q=this.rules.block.heading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},le.nptable=function($){var Q=this.rules.block.nptable.exec($);if(Q){var ee={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Q[0]};if(ee.header.length===ee.align.length){var re=ee.align.length,be;for(be=0;be<re;be++)/^ *-+: *$/.test(ee.align[be])?ee.align[be]="right":/^ *:-+: *$/.test(ee.align[be])?ee.align[be]="center":/^ *:-+ *$/.test(ee.align[be])?ee.align[be]="left":ee.align[be]=null;for(re=ee.cells.length,be=0;be<re;be++)ee.cells[be]=H(ee.cells[be],ee.header.length);return ee}}},le.hr=function($){var Q=this.rules.block.hr.exec($);if(Q)return{type:"hr",raw:Q[0]}},le.blockquote=function($){var Q=this.rules.block.blockquote.exec($);if(Q){var ee=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:ee}}},le.list=function($){var Q=this.rules.block.list.exec($);if(Q){for(var ee=Q[0],re=Q[2],be=re.length>1,Ce=re[re.length-1]===")",Me={type:"list",raw:ee,ordered:be,start:be?+re.slice(0,-1):"",loose:!1,items:[]},tt=Q[0].match(this.rules.block.item),dt=!1,it,Dt,mt,ot,It,yt,Yt,Wt=tt.length,pt=0;pt<Wt;pt++)it=tt[pt],ee=it,Dt=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(`
|
|
`)&&(Dt-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+Dt+"}","gm"),"")),pt!==Wt-1&&(mt=this.rules.block.bullet.exec(tt[pt+1])[0],(be?mt.length===1||!Ce&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==re)&&(ot=tt.slice(pt+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-ot.length),pt=Wt-1)),It=dt||/\n\n(?!\s*$)/.test(it),pt!==Wt-1&&(dt=it.charAt(it.length-1)===`
|
|
`,It||(It=dt)),It&&(Me.loose=!0),yt=/^\[[ xX]\] /.test(it),Yt=void 0,yt&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:ee,task:yt,checked:Yt,loose:It,text:it});return Me}},le.html=function($){var Q=this.rules.block.html.exec($);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):X(Q[0]):Q[0]}},le.def=function($){var Q=this.rules.block.def.exec($);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var ee=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:ee,raw:Q[0],href:Q[2],title:Q[3]}}},le.table=function($){var Q=this.rules.block.table.exec($);if(Q){var ee={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ee.header.length===ee.align.length){ee.raw=Q[0];var re=ee.align.length,be;for(be=0;be<re;be++)/^ *-+: *$/.test(ee.align[be])?ee.align[be]="right":/^ *:-+: *$/.test(ee.align[be])?ee.align[be]="center":/^ *:-+ *$/.test(ee.align[be])?ee.align[be]="left":ee.align[be]=null;for(re=ee.cells.length,be=0;be<re;be++)ee.cells[be]=H(ee.cells[be].replace(/^ *\| *| *\| *$/g,""),ee.header.length);return ee}}},le.lheading=function($){var Q=this.rules.block.lheading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},le.paragraph=function($){var Q=this.rules.block.paragraph.exec($);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
|
|
`?Q[1].slice(0,-1):Q[1]}},le.text=function($,Q){var ee=this.rules.block.text.exec($);if(ee){var re=Q[Q.length-1];return re&&re.type==="text"?{raw:ee[0],text:ee[0]}:{type:"text",raw:ee[0],text:ee[0]}}},le.escape=function($){var Q=this.rules.inline.escape.exec($);if(Q)return{type:"escape",raw:Q[0],text:X(Q[1])}},le.tag=function($,Q,ee){var re=this.rules.inline.tag.exec($);if(re)return!Q&&/^<a /i.test(re[0])?Q=!0:Q&&/^<\/a>/i.test(re[0])&&(Q=!1),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(re[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(re[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:re[0],inLink:Q,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):X(re[0]):re[0]}},le.link=function($){var Q=this.rules.inline.link.exec($);if(Q){var ee=Z(Q[2],"()");if(ee>-1){var re=Q[0].indexOf("!")===0?5:4,be=re+Q[1].length+ee;Q[2]=Q[2].substring(0,ee),Q[0]=Q[0].substring(0,be).trim(),Q[3]=""}var Ce=Q[2],Me="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);tt?(Ce=tt[1],Me=tt[3]):Me=""}else Me=Q[3]?Q[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=te(Q,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},Q[0]);return dt}},le.reflink=function($,Q){var ee;if((ee=this.rules.inline.reflink.exec($))||(ee=this.rules.inline.nolink.exec($))){var re=(ee[2]||ee[1]).replace(/\s+/g," ");if(re=Q[re.toLowerCase()],!re||!re.href){var be=ee[0].charAt(0);return{type:"text",raw:be,text:be}}var Ce=te(ee,re,ee[0]);return Ce}},le.strong=function($,Q,ee){ee===void 0&&(ee="");var re=this.rules.inline.strong.start.exec($);if(re&&(!re[1]||re[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*$.length);var be=re[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Ce;(re=be.exec(Q))!=null;)if(Ce=this.rules.inline.strong.middle.exec(Q.slice(0,re.index+3)),Ce)return{type:"strong",raw:$.slice(0,Ce[0].length),text:$.slice(2,Ce[0].length-2)}}},le.em=function($,Q,ee){ee===void 0&&(ee="");var re=this.rules.inline.em.start.exec($);if(re&&(!re[1]||re[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){Q=Q.slice(-1*$.length);var be=re[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Ce;(re=be.exec(Q))!=null;)if(Ce=this.rules.inline.em.middle.exec(Q.slice(0,re.index+2)),Ce)return{type:"em",raw:$.slice(0,Ce[0].length),text:$.slice(1,Ce[0].length-1)}}},le.codespan=function($){var Q=this.rules.inline.code.exec($);if(Q){var ee=Q[2].replace(/\n/g," "),re=/[^ ]/.test(ee),be=ee.startsWith(" ")&&ee.endsWith(" ");return re&&be&&(ee=ee.substring(1,ee.length-1)),ee=X(ee,!0),{type:"codespan",raw:Q[0],text:ee}}},le.br=function($){var Q=this.rules.inline.br.exec($);if(Q)return{type:"br",raw:Q[0]}},le.del=function($){var Q=this.rules.inline.del.exec($);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},le.autolink=function($,Q){var ee=this.rules.inline.autolink.exec($);if(ee){var re,be;return ee[2]==="@"?(re=X(this.options.mangle?Q(ee[1]):ee[1]),be="mailto:"+re):(re=X(ee[1]),be=re),{type:"link",raw:ee[0],text:re,href:be,tokens:[{type:"text",raw:re,text:re}]}}},le.url=function($,Q){var ee;if(ee=this.rules.inline.url.exec($)){var re,be;if(ee[2]==="@")re=X(this.options.mangle?Q(ee[0]):ee[0]),be="mailto:"+re;else{var Ce;do Ce=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(Ce!==ee[0]);re=X(ee[0]),ee[1]==="www."?be="http://"+re:be=re}return{type:"link",raw:ee[0],text:re,href:be,tokens:[{type:"text",raw:re,text:re}]}}},le.inlineText=function($,Q,ee){var re=this.rules.inline.text.exec($);if(re){var be;return Q?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):X(re[0]):re[0]:be=X(this.options.smartypants?ee(re[0]):re[0]),{type:"text",raw:re[0],text:be}}},ae}(),Te=W.noopTest,pe=W.edit,ge=W.merge,ce={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=pe(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=pe(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=pe(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._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",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=pe(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=pe(ce._paragraph).replace("hr",ce.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",ce._tag).getRegex(),ce.blockquote=pe(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=ge({},ce),ce.gfm=ge({},ce.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*|$)"}),ce.gfm.nptable=pe(ce.gfm.nptable).replace("hr",ce.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",ce._tag).getRegex(),ce.gfm.table=pe(ce.gfm.table).replace("hr",ce.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",ce._tag).getRegex(),ce.pedantic=ge({},ce.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Te,paragraph:pe(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=pe(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=pe(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=pe(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=pe(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=pe(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=pe(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=pe(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=pe(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=pe(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=pe(he._blockSkip,"g").getRegex(),he.overlapSkip=pe(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._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])?)+(?![-_])/,he.autolink=pe(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=pe(he.tag).replace("comment",ce._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=pe(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=pe(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=pe(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=ge({},he),he.pedantic=ge({},he.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:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=ge({},he.normal,{escape:pe(he.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=pe(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=ge({},he.gfm,{br:pe(he.br).replace("{2,}","*").getRegex(),text:pe(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ce,inline:he},se=B.defaults,q=J.block,ye=J.inline;function Se(ae){return ae.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 me(ae){var le="",ue,$,Q=ae.length;for(ue=0;ue<Q;ue++)$=ae.charCodeAt(ue),Math.random()>.5&&($="x"+$.toString(16)),le+="&#"+$+";";return le}var we=function(){function ae(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||se,this.options.tokenizer=this.options.tokenizer||new fe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:q.normal,inline:ye.normal};this.options.pedantic?($.block=q.pedantic,$.inline=ye.pedantic):this.options.gfm&&($.block=q.gfm,this.options.breaks?$.inline=ye.breaks:$.inline=ye.gfm),this.tokenizer.rules=$}ae.lex=function($,Q){var ee=new ae(Q);return ee.lex($)};var le=ae.prototype;return le.lex=function($){return $=$.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function($,Q,ee){Q===void 0&&(Q=[]),ee===void 0&&(ee=!0),$=$.replace(/^ +$/gm,"");for(var re,be,Ce,Me;$;){if(re=this.tokenizer.space($)){$=$.substring(re.raw.length),re.type&&Q.push(re);continue}if(re=this.tokenizer.code($,Q)){$=$.substring(re.raw.length),re.type?Q.push(re):(Me=Q[Q.length-1],Me.raw+=`
|
|
`+re.raw,Me.text+=`
|
|
`+re.text);continue}if(re=this.tokenizer.fences($)){$=$.substring(re.raw.length),Q.push(re);continue}if(re=this.tokenizer.heading($)){$=$.substring(re.raw.length),Q.push(re);continue}if(re=this.tokenizer.nptable($)){$=$.substring(re.raw.length),Q.push(re);continue}if(re=this.tokenizer.hr($)){$=$.substring(re.raw.length),Q.push(re);continue}if(re=this.tokenizer.blockquote($)){$=$.substring(re.raw.length),re.tokens=this.blockTokens(re.text,[],ee),Q.push(re);continue}if(re=this.tokenizer.list($)){for($=$.substring(re.raw.length),Ce=re.items.length,be=0;be<Ce;be++)re.items[be].tokens=this.blockTokens(re.items[be].text,[],!1);Q.push(re);continue}if(re=this.tokenizer.html($)){$=$.substring(re.raw.length),Q.push(re);continue}if(ee&&(re=this.tokenizer.def($))){$=$.substring(re.raw.length),this.tokens.links[re.tag]||(this.tokens.links[re.tag]={href:re.href,title:re.title});continue}if(re=this.tokenizer.table($)){$=$.substring(re.raw.length),Q.push(re);continue}if(re=this.tokenizer.lheading($)){$=$.substring(re.raw.length),Q.push(re);continue}if(ee&&(re=this.tokenizer.paragraph($))){$=$.substring(re.raw.length),Q.push(re);continue}if(re=this.tokenizer.text($,Q)){$=$.substring(re.raw.length),re.type?Q.push(re):(Me=Q[Q.length-1],Me.raw+=`
|
|
`+re.raw,Me.text+=`
|
|
`+re.text);continue}if($){var tt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return Q},le.inline=function($){var Q,ee,re,be,Ce,Me,tt=$.length;for(Q=0;Q<tt;Q++){Me=$[Q];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},be=Me.header.length,ee=0;ee<be;ee++)Me.tokens.header[ee]=[],this.inlineTokens(Me.header[ee],Me.tokens.header[ee]);for(be=Me.cells.length,ee=0;ee<be;ee++)for(Ce=Me.cells[ee],Me.tokens.cells[ee]=[],re=0;re<Ce.length;re++)Me.tokens.cells[ee][re]=[],this.inlineTokens(Ce[re],Me.tokens.cells[ee][re]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(be=Me.items.length,ee=0;ee<be;ee++)this.inline(Me.items[ee].tokens);break}}}return $},le.inlineTokens=function($,Q,ee,re,be){Q===void 0&&(Q=[]),ee===void 0&&(ee=!1),re===void 0&&(re=!1),be===void 0&&(be="");var Ce,Me=$,tt;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)dt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Ce=this.tokenizer.escape($)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.tag($,ee,re)){$=$.substring(Ce.raw.length),ee=Ce.inLink,re=Ce.inRawBlock,Q.push(Ce);continue}if(Ce=this.tokenizer.link($)){$=$.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,re)),Q.push(Ce);continue}if(Ce=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,re)),Q.push(Ce);continue}if(Ce=this.tokenizer.strong($,Me,be)){$=$.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],ee,re),Q.push(Ce);continue}if(Ce=this.tokenizer.em($,Me,be)){$=$.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],ee,re),Q.push(Ce);continue}if(Ce=this.tokenizer.codespan($)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.br($)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.del($)){$=$.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],ee,re),Q.push(Ce);continue}if(Ce=this.tokenizer.autolink($,me)){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(!ee&&(Ce=this.tokenizer.url($,me))){$=$.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.inlineText($,re,Se)){$=$.substring(Ce.raw.length),be=Ce.raw.slice(-1),Q.push(Ce);continue}if($){var it="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return Q},V(ae,null,[{key:"rules",get:function(){return{block:q,inline:ye}}}]),ae}(),_e=B.defaults,ke=W.cleanUrl,Ie=W.escape,De=function(){function ae(ue){this.options=ue||_e}var le=ae.prototype;return le.code=function($,Q,ee){var re=(Q||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight($,re);be!=null&&be!==$&&(ee=!0,$=be)}return re?'<pre><code class="'+this.options.langPrefix+Ie(re,!0)+'">'+(ee?$:Ie($,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ee?$:Ie($,!0))+`</code></pre>
|
|
`},le.blockquote=function($){return`<blockquote>
|
|
`+$+`</blockquote>
|
|
`},le.html=function($){return $},le.heading=function($,Q,ee,re){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+re.slug(ee)+'">'+$+"</h"+Q+`>
|
|
`:"<h"+Q+">"+$+"</h"+Q+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function($,Q,ee){var re=Q?"ol":"ul",be=Q&&ee!==1?' start="'+ee+'"':"";return"<"+re+be+`>
|
|
`+$+"</"+re+`>
|
|
`},le.listitem=function($){return"<li>"+$+`</li>
|
|
`},le.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function($){return"<p>"+$+`</p>
|
|
`},le.table=function($,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+Q+`</table>
|
|
`},le.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},le.tablecell=function($,Q){var ee=Q.header?"th":"td",re=Q.align?"<"+ee+' align="'+Q.align+'">':"<"+ee+">";return re+$+"</"+ee+`>
|
|
`},le.strong=function($){return"<strong>"+$+"</strong>"},le.em=function($){return"<em>"+$+"</em>"},le.codespan=function($){return"<code>"+$+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function($){return"<del>"+$+"</del>"},le.link=function($,Q,ee){if($=ke(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var re='<a href="'+Ie($)+'"';return Q&&(re+=' title="'+Q+'"'),re+=">"+ee+"</a>",re},le.image=function($,Q,ee){if($=ke(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var re='<img src="'+$+'" alt="'+ee+'"';return Q&&(re+=' title="'+Q+'"'),re+=this.options.xhtml?"/>":">",re},le.text=function($){return $},ae}(),Le=function(){function ae(){}var le=ae.prototype;return le.strong=function($){return $},le.em=function($){return $},le.codespan=function($){return $},le.del=function($){return $},le.html=function($){return $},le.text=function($){return $},le.link=function($,Q,ee){return""+ee},le.image=function($,Q,ee){return""+ee},le.br=function(){return""},ae}(),ze=function(){function ae(){this.seen={}}var le=ae.prototype;return le.slug=function($){var Q=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var ee=Q;do this.seen[ee]++,Q=ee+"-"+this.seen[ee];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},ae}(),Ye=B.defaults,Ve=W.unescape,je=function(){function ae(ue){this.options=ue||Ye,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new ze}ae.parse=function($,Q){var ee=new ae(Q);return ee.parse($)};var le=ae.prototype;return le.parse=function($,Q){Q===void 0&&(Q=!0);var ee="",re,be,Ce,Me,tt,dt,it,Dt,mt,ot,It,yt,Yt,Wt,pt,Tr,zr,lr,Sr=$.length;for(re=0;re<Sr;re++){ot=$[re];switch(ot.type){case"space":continue;case"hr":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,Ve(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(Dt="",it="",Me=ot.header.length,be=0;be<Me;be++)it+=this.renderer.tablecell(this.parseInline(ot.tokens.header[be]),{header:!0,align:ot.align[be]});for(Dt+=this.renderer.tablerow(it),mt="",Me=ot.cells.length,be=0;be<Me;be++){for(dt=ot.tokens.cells[be],it="",tt=dt.length,Ce=0;Ce<tt;Ce++)it+=this.renderer.tablecell(this.parseInline(dt[Ce]),{header:!1,align:ot.align[Ce]});mt+=this.renderer.tablerow(it)}ee+=this.renderer.table(Dt,mt);continue}case"blockquote":{mt=this.parse(ot.tokens),ee+=this.renderer.blockquote(mt);continue}case"list":{for(It=ot.ordered,yt=ot.start,Yt=ot.loose,Me=ot.items.length,mt="",be=0;be<Me;be++)pt=ot.items[be],Tr=pt.checked,zr=pt.task,Wt="",pt.task&&(lr=this.renderer.checkbox(Tr),Yt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=lr+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=lr+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:lr}):Wt+=lr),Wt+=this.parse(pt.tokens,Yt),mt+=this.renderer.listitem(Wt,zr,Tr);ee+=this.renderer.list(mt,It,yt);continue}case"html":{ee+=this.renderer.html(ot.text);continue}case"paragraph":{ee+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(mt=ot.tokens?this.parseInline(ot.tokens):ot.text;re+1<Sr&&$[re+1].type==="text";)ot=$[++re],mt+=`
|
|
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);ee+=Q?this.renderer.paragraph(mt):mt;continue}default:{var hr='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return ee},le.parseInline=function($,Q){Q=Q||this.renderer;var ee="",re,be,Ce=$.length;for(re=0;re<Ce;re++){be=$[re];switch(be.type){case"escape":{ee+=Q.text(be.text);break}case"html":{ee+=Q.html(be.text);break}case"link":{ee+=Q.link(be.href,be.title,this.parseInline(be.tokens,Q));break}case"image":{ee+=Q.image(be.href,be.title,be.text);break}case"strong":{ee+=Q.strong(this.parseInline(be.tokens,Q));break}case"em":{ee+=Q.em(this.parseInline(be.tokens,Q));break}case"codespan":{ee+=Q.codespan(be.text);break}case"br":{ee+=Q.br();break}case"del":{ee+=Q.del(this.parseInline(be.tokens,Q));break}case"text":{ee+=Q.text(be.text);break}default:{var Me='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return ee},ae}(),Xe=W.merge,Be=W.checkSanitizeDeprecation,He=W.escape,Ae=B.getDefaults,Ze=B.changeDefaults,$e=B.defaults;function Oe(ae,le,ue){if(typeof ae=="undefined"||ae===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ae!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ae)+", string expected");if(typeof le=="function"&&(ue=le,le=null),le=Xe({},Oe.defaults,le||{}),Be(le),ue){var $=le.highlight,Q;try{Q=we.lex(ae,le)}catch(Ce){return ue(Ce)}var ee=function(Me){var tt;if(!Me)try{tt=je.parse(Q,le)}catch(dt){Me=dt}return le.highlight=$,Me?ue(Me):ue(null,tt)};if(!$||$.length<3)return ee();if(delete le.highlight,!Q.length)return ee();var re=0;Oe.walkTokens(Q,function(Ce){Ce.type==="code"&&(re++,setTimeout(function(){$(Ce.text,Ce.lang,function(Me,tt){if(Me)return ee(Me);tt!=null&&tt!==Ce.text&&(Ce.text=tt,Ce.escaped=!0),re--,re===0&&ee()})},0))}),re===0&&ee();return}try{var be=we.lex(ae,le);return le.walkTokens&&Oe.walkTokens(be,le.walkTokens),je.parse(be,le)}catch(Ce){if(Ce.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+He(Ce.message+"",!0)+"</pre>";throw Ce}}Oe.options=Oe.setOptions=function(ae){return Xe(Oe.defaults,ae),Ze(Oe.defaults),Oe},Oe.getDefaults=Ae,Oe.defaults=$e,Oe.use=function(ae){var le=Xe({},ae);if(ae.renderer&&function(){var $=Oe.defaults.renderer||new De,Q=function(be){var Ce=$[be];$[be]=function(){for(var Me=arguments.length,tt=new Array(Me),dt=0;dt<Me;dt++)tt[dt]=arguments[dt];var it=ae.renderer[be].apply($,tt);return it===!1&&(it=Ce.apply($,tt)),it}};for(var ee in ae.renderer)Q(ee);le.renderer=$}(),ae.tokenizer&&function(){var $=Oe.defaults.tokenizer||new fe,Q=function(be){var Ce=$[be];$[be]=function(){for(var Me=arguments.length,tt=new Array(Me),dt=0;dt<Me;dt++)tt[dt]=arguments[dt];var it=ae.tokenizer[be].apply($,tt);return it===!1&&(it=Ce.apply($,tt)),it}};for(var ee in ae.tokenizer)Q(ee);le.tokenizer=$}(),ae.walkTokens){var ue=Oe.defaults.walkTokens;le.walkTokens=function($){ae.walkTokens($),ue&&ue($)}}Oe.setOptions(le)},Oe.walkTokens=function(ae,le){for(var ue=I(ae),$;!($=ue()).done;){var Q=$.value;le(Q);switch(Q.type){case"table":{for(var ee=I(Q.tokens.header),re;!(re=ee()).done;){var be=re.value;Oe.walkTokens(be,le)}for(var Ce=I(Q.tokens.cells),Me;!(Me=Ce()).done;)for(var tt=Me.value,dt=I(tt),it;!(it=dt()).done;){var Dt=it.value;Oe.walkTokens(Dt,le)}break}case"list":{Oe.walkTokens(Q.items,le);break}default:Q.tokens&&Oe.walkTokens(Q.tokens,le)}}},Oe.Parser=je,Oe.parser=je.parse,Oe.Renderer=De,Oe.TextRenderer=Le,Oe.Lexer=we,Oe.lexer=we.lex,Oe.Tokenizer=fe,Oe.Slugger=ze,Oe.parse=Oe;var Fe=Oe;return Fe})},ELLl:function(lt,Qe,oe){(function(ne){ne(oe("VrN/"))})(function(ne){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(S,y,d){d&&d!=ne.Init&&(S.removeKeyMap(I),S.state.closeBrackets=null),y&&(R(G(y,"pairs")),S.state.closeBrackets=y,S.addKeyMap(I))});function G(S,y){return y=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[y]!=null?S[y]:V[y]}var I={Backspace:_,Enter:D};function R(S){for(var y=0;y<S.length;y++){var d=S.charAt(y),o="'"+d+"'";I[o]||(I[o]=B(d))}}R(V.pairs+"`");function B(S){return function(y){return A(y,S)}}function F(S){var y=S.state.closeBrackets;if(!y||y.override)return y;var d=S.getModeAt(S.getCursor());return d.closeBrackets||y}function _(S){var y=F(S);if(!y||S.getOption("disableInput"))return ne.Pass;for(var d=G(y,"pairs"),o=S.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ne.Pass;var u=P(S,o[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}for(var s=o.length-1;s>=0;s--){var E=o[s].head;S.replaceRange("",L(E.line,E.ch-1),L(E.line,E.ch+1),"+delete")}}function D(S){var y=F(S),d=y&&G(y,"explode");if(!d||S.getOption("disableInput"))return ne.Pass;for(var o=S.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ne.Pass;var u=P(S,o[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}S.operation(function(){var E=S.lineSeparator()||`
|
|
`;S.replaceSelection(E+E,null),S.execCommand("goCharLeft"),o=S.listSelections();for(var f=0;f<o.length;f++){var m=o[f].head.line;S.indentLine(m,null,!0),S.indentLine(m+1,null,!0)}})}function T(S){var y=ne.cmpPos(S.anchor,S.head)>0;return{anchor:new L(S.anchor.line,S.anchor.ch+(y?-1:1)),head:new L(S.head.line,S.head.ch+(y?1:-1))}}function A(S,y){var d=F(S);if(!d||S.getOption("disableInput"))return ne.Pass;var o=G(d,"pairs"),s=o.indexOf(y);if(s==-1)return ne.Pass;for(var u=G(d,"closeBefore"),E=G(d,"triples"),f=o.charAt(s+1)==y,m=S.listSelections(),w=s%2==0,b,h=0;h<m.length;h++){var c=m[h],l=c.head,a,g=S.getRange(l,L(l.line,l.ch+1));if(w&&!c.empty())a="surround";else if((f||!w)&&g==y)f&&C(S,l)?a="both":E.indexOf(y)>=0&&S.getRange(l,L(l.line,l.ch+3))==y+y+y?a="skipThree":a="skip";else if(f&&l.ch>1&&E.indexOf(y)>=0&&S.getRange(L(l.line,l.ch-2),l)==y+y){if(l.ch>2&&/\bstring/.test(S.getTokenTypeAt(L(l.line,l.ch-2))))return ne.Pass;a="addFour"}else if(f){var p=l.ch==0?" ":S.getRange(L(l.line,l.ch-1),l);if(!ne.isWordChar(g)&&p!=y&&!ne.isWordChar(p))a="both";else return ne.Pass}else if(w&&(g.length===0||/\s/.test(g)||u.indexOf(g)>-1))a="both";else return ne.Pass;if(!b)b=a;else if(b!=a)return ne.Pass}var v=s%2?o.charAt(s-1):y,M=s%2?y:o.charAt(s+1);S.operation(function(){if(b=="skip")S.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)S.execCommand("goCharRight");else if(b=="surround"){for(var j=S.getSelections(),U=0;U<j.length;U++)j[U]=v+j[U]+M;S.replaceSelections(j,"around"),j=S.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=T(j[U]);S.setSelections(j)}else b=="both"?(S.replaceSelection(v+M,null),S.triggerElectric(v+M),S.execCommand("goCharLeft")):b=="addFour"&&(S.replaceSelection(v+v+v+v,"before"),S.execCommand("goCharRight"))})}function P(S,y){var d=S.getRange(L(y.line,y.ch-1),L(y.line,y.ch+1));return d.length==2?d:null}function C(S,y){var d=S.getTokenAt(L(y.line,y.ch+1));return/\bstring/.test(d.type)&&d.start==y.ch&&(y.ch==0||!/\bstring/.test(S.getTokenTypeAt(y)))}})},GfqC:function(lt,Qe,oe){"use strict";var ne=oe("cDcd"),V=oe.n(ne),L=oe("TSYQ"),G=oe.n(L);function I(W,O){var k="cannot "+W.method+" "+W.action+" "+O.status+"'",H=new Error(k);return H.status=O.status,H.method=W.method,H.url=W.action,H}function R(W){var O=W.responseText||W.response;if(!O)return O;try{return JSON.parse(O)}catch(k){return O}}function B(W){var O=new XMLHttpRequest;W.onProgress&&O.upload&&(O.upload.onprogress=function(Z){Z.total>0&&(Z.percent=Z.loaded/Z.total*100),W.onProgress(Z)});var k=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var Z=W.data[X];if(Array.isArray(Z)){Z.forEach(function(te){k.append(X+"[]",te)});return}k.append(X,W.data[X])}),W.file instanceof Blob?k.append(W.filename,W.file,W.file.name):k.append(W.filename,W.file),O.onerror=function(Z){W.onError(Z)},O.onload=function(){return O.status<200||O.status>=300?W.onError(I(W,O),R(O)):W.onSuccess(R(O),O)},O.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&O.setRequestHeader(X,H[X])}),O.send(k),{abort:function(){O.abort()}}}var F=+new Date,_=0;function D(){return"rc-upload-"+F+"-"+ ++_}function T(W,O){return W.indexOf(O,W.length-O.length)!==-1}var A=function(W,O){if(W&&O){var k=Array.isArray(O)?O:O.split(","),H=W.name||"",X=W.type||"",Z=X.replace(/\/.*$/,"");return k.some(function(te){var Ee=te.trim();return Ee.charAt(0)==="."?T(H.toLowerCase(),Ee.toLowerCase()):/\/\*$/.test(Ee)?Z===Ee.replace(/\/.*$/,""):X===Ee})}return!0};function P(W,O){var k=W.createReader(),H=[];function X(){k.readEntries(function(Z){var te=Array.prototype.slice.apply(Z);H=H.concat(te);var Ee=!te.length;Ee?O(H):X()})}X()}var C=function(O,k,H){var X=function Z(te,Ee){Ee=Ee||"",te.isFile?te.file(function(fe){H(fe)&&(te.fullPath&&!fe.webkitRelativePath&&(Object.defineProperties(fe,{webkitRelativePath:{writable:!0}}),fe.webkitRelativePath=te.fullPath.replace(/^\//,""),Object.defineProperties(fe,{webkitRelativePath:{writable:!1}})),k([fe]))}):te.isDirectory&&P(te,function(fe){fe.forEach(function(Te){Z(Te,""+Ee+te.name+"/")})})};O.forEach(function(Z){X(Z.webkitGetAsEntry())})},S=C,y=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var k=arguments[O];for(var H in k)Object.prototype.hasOwnProperty.call(k,H)&&(W[H]=k[H])}return W},d=function(){function W(O,k){var H=[],X=!0,Z=!1,te=void 0;try{for(var Ee=O[Symbol.iterator](),fe;!(X=(fe=Ee.next()).done)&&!(H.push(fe.value),k&&H.length===k);X=!0);}catch(Te){Z=!0,te=Te}finally{try{!X&&Ee.return&&Ee.return()}finally{if(Z)throw te}}return H}return function(O,k){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return W(O,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(O,k){for(var H=0;H<k.length;H++){var X=k[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,k,H){return k&&W(O.prototype,k),H&&W(O,H),O}}();function s(W,O,k){return O in W?Object.defineProperty(W,O,{value:k,enumerable:!0,configurable:!0,writable:!0}):W[O]=k,W}function u(W,O){var k={};for(var H in W){if(O.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;k[H]=W[H]}return k}function E(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function f(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function m(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}var w=function(O){return Object.keys(O).reduce(function(k,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(k[H]=O[H]),k},{})},b=function(W){m(O,W);function O(){var k,H,X,Z;E(this,O);for(var te=arguments.length,Ee=Array(te),fe=0;fe<te;fe++)Ee[fe]=arguments[fe];return Z=(H=(X=f(this,(k=O.__proto__||Object.getPrototypeOf(O)).call.apply(k,[this].concat(Ee))),X),X.state={uid:D()},X.reqs={},X.onChange=function(Te){var pe=Te.target.files;X.uploadFiles(pe),X.reset()},X.onClick=function(Te){var pe=X.fileInput;if(!pe)return;var ge=X.props,ce=ge.children,he=ge.onClick;ce&&ce.type==="button"&&(pe.parentNode.focus(),pe.parentNode.querySelector("button").blur()),pe.click(),he&&he(Te)},X.onKeyDown=function(Te){Te.key==="Enter"&&X.onClick()},X.onFileDrop=function(Te){var pe=X.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(X.props.directory)S(Array.prototype.slice.call(Te.dataTransfer.items),X.uploadFiles,function(ce){return A(ce,X.props.accept)});else{var ge=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(ce){return A(ce,X.props.accept)});pe===!1&&(ge=ge.slice(0,1)),X.uploadFiles(ge)}},X.uploadFiles=function(Te){var pe=Array.prototype.slice.call(Te);pe.map(function(ge){return ge.uid=D(),ge}).forEach(function(ge){X.upload(ge,pe)})},X.saveFileInput=function(Te){X.fileInput=Te},H),f(X,Z)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var Z=this,te=this.props;if(!te.beforeUpload)return setTimeout(function(){return Z.post(H)},0);var Ee=te.beforeUpload(H,X);Ee&&Ee.then?Ee.then(function(fe){var Te=Object.prototype.toString.call(fe);return Te==="[object File]"||Te==="[object Blob]"?Z.post(fe):Z.post(H)}).catch(function(fe){console.log(fe)}):Ee!==!1&&setTimeout(function(){return Z.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var Z=this.props,te=Z.onStart,Ee=Z.onProgress,fe=Z.transformFile,Te=fe===void 0?function(pe){return pe}:fe;new Promise(function(pe){var ge=Z.action;return typeof ge=="function"&&(ge=ge(H)),pe(ge)}).then(function(pe){var ge=H.uid,ce=Z.customRequest||B,he=Promise.resolve(Te(H)).then(function(J){var se=Z.data;return typeof se=="function"&&(se=se(J)),Promise.all([J,se])}).catch(function(J){console.error(J)});he.then(function(J){var se=d(J,2),q=se[0],ye=se[1],Se={action:pe,filename:Z.name,data:ye,file:q,headers:Z.headers,withCredentials:Z.withCredentials,method:Z.method||"post",onProgress:Ee?function(me){Ee(me,H)}:null,onSuccess:function(we,_e){delete X.reqs[ge],Z.onSuccess(we,H,_e)},onError:function(we,_e){delete X.reqs[ge],Z.onError(we,_e,H)}};te(H),X.reqs[ge]=ce(Se)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var Z=H;H&&H.uid&&(Z=H.uid),X[Z]&&X[Z].abort&&X[Z].abort(),delete X[Z]}else Object.keys(X).forEach(function(te){X[te]&&X[te].abort&&X[te].abort(),delete X[te]})}},{key:"render",value:function(){var H,X=this.props,Z=X.component,te=X.prefixCls,Ee=X.className,fe=X.disabled,Te=X.id,pe=X.style,ge=X.multiple,ce=X.accept,he=X.children,J=X.directory,se=X.openFileDialogOnClick,q=X.onMouseEnter,ye=X.onMouseLeave,Se=u(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),me=G()((H={},s(H,te,!0),s(H,te+"-disabled",fe),s(H,Ee,Ee),H)),we=fe?{}:{onClick:se?this.onClick:function(){},onKeyDown:se?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:ye,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(Z,y({},we,{className:me,role:"button",style:pe}),V.a.createElement("input",y({},w(Se),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(ke){return ke.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ce,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:ge,onChange:this.onChange})),he)}}]),O}(ne.Component),h=b,c=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var k=arguments[O];for(var H in k)Object.prototype.hasOwnProperty.call(k,H)&&(W[H]=k[H])}return W},l=function(){function W(O,k){for(var H=0;H<k.length;H++){var X=k[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,k,H){return k&&W(O.prototype,k),H&&W(O,H),O}}();function a(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function g(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function p(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}function v(){}var M=function(W){p(O,W);function O(){var k,H,X,Z;a(this,O);for(var te=arguments.length,Ee=Array(te),fe=0;fe<te;fe++)Ee[fe]=arguments[fe];return Z=(H=(X=g(this,(k=O.__proto__||Object.getPrototypeOf(O)).call.apply(k,[this].concat(Ee))),X),X.saveUploader=function(Te){X.uploader=Te},H),g(X,Z)}return l(O,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return V.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),O}(ne.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:v,onError:v,onSuccess:v,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=M,j=Qe.a=U},HmJG:function(lt,Qe,oe){},LdHM:function(lt,Qe,oe){"use strict";oe.d(Qe,"b",function(){return u}),oe.d(Qe,"a",function(){return f});var ne=oe("1OyB"),V=oe("vuIU"),L=oe("Ji7U"),G=oe("LK+K"),I=oe("cDcd"),R=oe("rePB"),B=oe("Ff2n"),F=oe("ODXe"),_=oe("4IlW"),D=oe("bX4T"),T=oe("YrtM"),A=oe("TSYQ"),P=oe.n(A),C=oe("+nKL"),S=oe("8OUc"),y=function(H,X){var Z=H.prefixCls,te=H.id,Ee=H.flattenOptions,fe=H.childrenAsData,Te=H.values,pe=H.searchValue,ge=H.multiple,ce=H.defaultActiveFirstOption,he=H.height,J=H.itemHeight,se=H.notFoundContent,q=H.open,ye=H.menuItemSelectedIcon,Se=H.virtual,me=H.onSelect,we=H.onToggleOpen,_e=H.onActiveValue,ke=H.onScroll,Ie=H.onMouseEnter,De="".concat(Z,"-item"),Le=Object(T.a)(function(){return Ee},[q,Ee],function(Fe,ae){return ae[0]&&Fe[1]!==ae[1]}),ze=I.useRef(null),Ye=function(ae){ae.preventDefault()},Ve=function(ae){ze.current&&ze.current.scrollTo({index:ae})},je=function(ae){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Le.length,$=0;$<ue;$+=1){var Q=(ae+$*le+ue)%ue,ee=Le[Q],re=ee.group,be=ee.data;if(!re&&!be.disabled)return Q}return-1},Xe=I.useState(function(){return je(0)}),Be=Object(F.a)(Xe,2),He=Be[0],Ae=Be[1],Ze=function(ae){Ae(ae);var le=Le[ae];if(!le){_e(null,-1);return}_e(le.data.value,ae)};I.useEffect(function(){Ze(ce!==!1?je(0):-1)},[Le.length,pe]),I.useEffect(function(){var Fe=setTimeout(function(){if(!ge&&q&&Te.size===1){var ae=Array.from(Te)[0],le=Le.findIndex(function(ue){var $=ue.data;return $.value===ae});Ze(le),Ve(le)}});return function(){return clearTimeout(Fe)}},[q]);var $e=function(ae){ae!==void 0&&me(ae,{selected:!Te.has(ae)}),ge||we(!1)};if(I.useImperativeHandle(X,function(){return{onKeyDown:function(ae){var le=ae.which;switch(le){case _.a.UP:case _.a.DOWN:{var ue=0;if(le===_.a.UP?ue=-1:le===_.a.DOWN&&(ue=1),ue!==0){var $=je(He+ue,ue);Ve($),Ze($)}break}case _.a.ENTER:{var Q=Le[He];Q&&!Q.data.disabled?$e(Q.data.value):$e(void 0),q&&ae.preventDefault();break}case _.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ae){Ve(ae)}}}),Le.length===0)return I.createElement("div",{role:"listbox",id:"".concat(te,"_list"),className:"".concat(De,"-empty"),onMouseDown:Ye},se);function Oe(Fe){var ae=Le[Fe];if(!ae)return null;var le=ae.data||{},ue=le.value,$=le.label,Q=le.children,ee=Object(D.a)(le,!0),re=fe?Q:$;return ae?I.createElement("div",Object.assign({"aria-label":typeof re=="string"?re:null},ee,{key:Fe,role:"option",id:"".concat(te,"_list_").concat(Fe),"aria-selected":Te.has(ue)}),ue):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(te,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe(He-1),Oe(He),Oe(He+1)),I.createElement(C.a,{itemKey:"key",ref:ze,data:Le,height:he,itemHeight:J,fullHeight:!1,onMouseDown:Ye,onScroll:ke,virtual:Se,onMouseEnter:Ie},function(Fe,ae){var le,ue=Fe.group,$=Fe.groupOption,Q=Fe.data,ee=Q.label,re=Q.key;if(ue)return I.createElement("div",{className:P()(De,"".concat(De,"-group"))},ee!==void 0?ee:re);var be=Q.disabled,Ce=Q.value,Me=Q.title,tt=Q.children,dt=Q.style,it=Q.className,Dt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),mt=Te.has(Ce),ot="".concat(De,"-option"),It=P()(De,ot,it,(le={},Object(R.a)(le,"".concat(ot,"-grouped"),$),Object(R.a)(le,"".concat(ot,"-active"),He===ae&&!be),Object(R.a)(le,"".concat(ot,"-disabled"),be),Object(R.a)(le,"".concat(ot,"-selected"),mt),le)),yt=fe?tt:ee,Yt=!ye||typeof ye=="function"||mt;return I.createElement("div",Object.assign({},Dt,{"aria-selected":mt,className:It,title:Me,onMouseMove:function(){if(He===ae||be)return;Ze(ae)},onClick:function(){be||$e(Ce)},style:dt}),I.createElement("div",{className:"".concat(ot,"-content")},yt||Ce),I.isValidElement(ye)||mt,Yt&&I.createElement(S.a,{className:"".concat(De,"-option-state"),customizeIcon:ye,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=I.forwardRef(y);d.displayName="OptionList";var o=d,s=function(){return null};s.isSelectOption=!0;var u=s,E=function(){return null};E.isSelectOptGroup=!0;var f=E,m=oe("VTBJ"),w=oe("Zm9Q");function b(k){var H=k.key,X=k.props,Z=X.children,te=X.value,Ee=Object(B.a)(X,["children","value"]);return Object(m.a)({key:H,value:te!==void 0?te:H,children:Z},Ee)}function h(k){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(k).map(function(X,Z){if(!I.isValidElement(X)||!X.type)return null;var te=X.type.isSelectOptGroup,Ee=X.key,fe=X.props,Te=fe.children,pe=Object(B.a)(fe,["children"]);return H||!te?b(X):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?Z:Ee,"__"),label:Ee},pe),{},{options:h(Te)})}).filter(function(X){return X})}var c=oe("2Qr1"),l=oe("qNPg"),a=oe("U8pU"),g=oe("Kwbf"),p=oe("WKfj");function v(k){var H=k.mode,X=k.options,Z=k.children,te=k.backfill,Ee=k.allowClear,fe=k.placeholder,Te=k.getInputElement,pe=k.showSearch,ge=k.onSearch,ce=k.defaultOpen,he=k.autoFocus,J=k.labelInValue,se=k.value,q=k.inputValue,ye=k.optionLabelProp,Se=H==="multiple"||H==="tags",me=pe!==void 0?pe:Se||H==="combobox",we=X||h(Z);if(Object(g.a)(H!=="tags"||we.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var _e=we.some(function(De){return De.options?De.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(g.a)(!_e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(H!=="combobox"||!ye,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(H==="combobox"||!te,"`backfill` only works with `combobox` mode."),Object(g.a)(H==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(g.b)(H!=="combobox"||!Te||!Ee||!fe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ge&&!me&&H!=="combobox"&&H!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!ce||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),se!=null){var ke=Object(p.d)(se);Object(g.a)(!J||ke.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Se||Array.isArray(se),"`value` should be array when `mode` is `multiple` or `tags`")}if(Z){var Ie=null;Object(w.a)(Z).some(function(De){if(!I.isValidElement(De)||!De.type)return!1;var Le=De.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var ze=Object(w.a)(De.props.children).every(function(Ye){return!I.isValidElement(Ye)||!De.type||Ye.type.isSelectOption?!0:(Ie=Ye.type,!1)});return!ze}return Ie=Le,!0}),Ie&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(g.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=v,U=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(k){Object(L.a)(X,k);var H=Object(G.a)(X);function X(){var Z;return Object(ne.a)(this,X),Z=H.apply(this,arguments),Z.selectRef=I.createRef(),Z.focus=function(){Z.selectRef.current.focus()},Z.blur=function(){Z.selectRef.current.blur()},Z}return Object(V.a)(X,[{key:"render",value:function(){return I.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),X}(I.Component);j.Option=u,j.OptGroup=f;var W=j,O=Qe.c=W},M8RZ:function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return _});var ne=oe("fWQN"),V=oe("mtLc"),L=oe("yKVA"),G=oe("879j"),I=oe("cDcd"),R=oe.n(I),B=oe("faye"),F=oe.n(B),_=function(D){Object(L.a)(A,D);var T=Object(G.a)(A);function A(P){var C;Object(ne.a)(this,A),C=T.call(this,P);var S=window.document;return C.node=S.createElement("div"),S.body.appendChild(C.node),C}return Object(V.a)(A,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(R.a.Component)},Ot1p:function(lt,Qe,oe){"use strict";var ne=oe("2qtc"),V=oe("kLXV"),L=oe("rAM+"),G=oe("miYZ"),I=oe("tsqr"),R=oe("tJVT"),B=oe("jrin"),F=oe("cDcd"),_=oe.n(F),D=oe("VrN/"),T=oe.n(D),A=oe("bdgK"),P=oe("p77/"),C=oe("Bd2K"),S=oe("ELLl"),y=oe("19Vz"),d=oe("lZu9"),o=oe("+NIl"),s=oe("kSUc"),u=oe("9Bee"),E=function(ae){var le=ae.value,ue=le===void 0?"":le,$=ae.className,Q=ae.showTextOnly,ee=ae.showLines,re=ae.style,be=re===void 0?{}:re,Ce=Object(F.useMemo)(function(){return""},[ue]);return _.a.createElement(_.a.Fragment,null,_.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ce}}))},f=oe("0Owb"),m=oe("dejd"),w=oe("C+DQ"),b=[{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(ae){var le=ae.onActionCallback,ue=ae.title,$=ae.icon,Q=ae.actionName,ee=ae.className,re=ee===void 0?"":ee,be=ae.children;function Ce(){le(Q)}return _.a.createElement("a",{title:ue,className:re,onClick:Ce},_.a.createElement("i",{className:"md-iconfont ".concat($)}),be)}var c=function(ae){var le=ae.watch,ue=ae.showNullButton,$=ae.onActionCallback,Q=ae.fullScreen,ee=ae.insertTemp,re=ae.hidetoolBar,be=[].concat(b,[{title:"".concat(le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return _.a.createElement("ul",{className:"markdown-toolbar-container"},!re&&be.map(function(Ce,Me){return _.a.createElement("li",{key:Me},Ce.actionName?_.a.createElement(h,Object(f.a)({},Ce,{onActionCallback:$})):_.a.createElement("span",{className:"v-line"}))}),ue?_.a.createElement("li",null,_.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$},_.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ee&&_.a.createElement("li",null,_.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ee),onActionCallback:$},_.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),_.a.createElement("li",{className:"btn-full-screen"},_.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:$})))},l=oe("M8RZ"),a=oe("+L6B"),g=oe("2/Rp"),p=oe("y8nQ"),v=oe("Vl3Y"),M=oe("5NDa"),U=oe("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},W=function(ae){var le=ae.callback,ue=ae.onCancel;function $(Q){le(Q)}return _.a.createElement(v.a,Object(f.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$}),_.a.createElement(v.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},_.a.createElement(U.a,null)),_.a.createElement(v.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},_.a.createElement(U.a,null)),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},O=oe("7ahc"),k=oe("HmJG"),H=oe("BjJ7"),X=v.a.useForm,Z={width:280,marginRight:10},te={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(ae){var le=ae.callback,ue=ae.onCancel,$=X(),Q=Object(R.a)($,1),ee=Q[0];function re(Me){le(Me)}function be(Me,tt){ee.setFieldsValue({src:"/api/attachments/".concat(Me.id),type:tt.type})}function Ce(Me){var tt=Me.target.files[0];Te(tt,be)}return _.a.createElement(v.a,Object(f.a)({form:ee},te,{className:"upload-image-panel",onFinish:re}),_.a.createElement(v.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},_.a.createElement("div",{className:"flex-container"},_.a.createElement(v.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},_.a.createElement(U.a,{style:Z})),_.a.createElement(fe,{onFileChange:Ce}))),_.a.createElement(v.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},_.a.createElement(U.a,{style:{width:264}})),_.a.createElement(v.a.Item,{style:{textAlign:"right"}},_.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))};function fe(ae){var le=ae.onFileChange;return _.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",_.a.createElement("input",{type:"file",onChange:le}))}function Te(ae,le){if(!ae)throw new String("\u6CA1\u6709\u6587\u4EF6");var ue=new FormData;ue.append("editormd-image-file",ae),ue.append("file_param_name","editormd-image-file"),ue.append("byxhr","true");var $=new window.XMLHttpRequest;$.withCredentials=!0,$.addEventListener("load",function(Q){le(JSON.parse(Q.target.responseText),ae)},!1),$.addEventListener("error",function(Q){console.error(Q)},!1),$.open("POST","".concat(H.a,"/api/attachments.json")),$.send(ue)}var pe=oe("giR+"),ge=oe("fyUT"),ce=oe("7Kak"),he=oe("9yH6"),J=he.a.Group,se={margin:"0 8px"},q=function(ae){var le=ae.callback,ue=ae.onCancel;function $(Q){le(Q)}return _.a.createElement(v.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$},_.a.createElement("div",{className:"flex-container"},_.a.createElement("span",{style:se},"\u5355\u5143\u683C\u6570\uFF1A"),_.a.createElement("span",{style:se},"\u884C\u6570"),_.a.createElement(v.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},_.a.createElement(ge.a,null)),_.a.createElement("span",{style:se},"\u5217\u6570"),_.a.createElement(v.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},_.a.createElement(ge.a,null))),_.a.createElement("div",{className:"flex-container",style:{marginTop:12}},_.a.createElement("span",{style:se},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),_.a.createElement(v.a.Item,{name:"align"},_.a.createElement(J,null,_.a.createElement(he.a,{value:"default"},_.a.createElement("i",{className:"fa fa-align-justify"})),_.a.createElement(he.a,{value:"left"},_.a.createElement("i",{className:"fa fa-align-left"})),_.a.createElement(he.a,{value:"center"},_.a.createElement("i",{className:"fa fa-align-center"})),_.a.createElement(he.a,{value:"right"},_.a.createElement("i",{className:"fa fa-align-right"}))))),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},ye=oe("m3rI"),Se="link",me="upload-image",we="code-block",_e="add-table",ke="------------",Ie={default:ke,left:":".concat(ke),center:":".concat(ke,":"),right:"".concat(ke,":")},De=oe("9VGf"),Le,ze;function Ye(){}var Ve=0,je=1e4,Xe="\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 He(ae){return/^\d+$/.test(ae)?"".concat(ae,"px"):ae}var Ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ze=Ae?"Cmd":"Ctrl",$e=(Le={},Object(B.a)(Le,Ze+"-B","bold"),Object(B.a)(Le,Ze+"-I","italic"),Le),Oe=(ze={},Object(B.a)(ze,Se,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(ze,we,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(ze,me,"\u6DFB\u52A0\u56FE\u7247"),Object(B.a)(ze,_e,"\u6DFB\u52A0\u8868\u683C"),ze),Fe=Qe.a=function(ae){var le=ae.defaultValue,ue=le===void 0?"":le,$=ae.onChange,Q=ae.width,ee=Q===void 0?"100%":Q,re=ae.height,be=re===void 0?400:re,Ce=ae.miniToolbar,Me=Ce===void 0?!1:Ce,tt=ae.isFocus,dt=tt===void 0?!1:tt,it=ae.watch,Dt=ae.insertTemp,mt=ae.mode,ot=mt===void 0?"markdown":mt,It=ae.id,yt=It===void 0?"markdown-editor-id":It,Yt=ae.showResizeBar,Wt=Yt===void 0?!1:Yt,pt=ae.noStorage,Tr=pt===void 0?!1:pt,zr=ae.showNullButton,lr=zr===void 0?!1:zr,Sr=ae.hidetoolBar,hr=Sr===void 0?!1:Sr,yi=ae.fullScreen,ur=yi===void 0?!1:yi,Vr=ae.onBlur,cn=ae.onCMBeforeChange,Ct=ae.onFullScreen,et=ae.className,wr=et===void 0?"":et,fn=ae.disablePaste,dr=fn===void 0?!1:fn,gt=ae.placeholder,Cr=gt===void 0?"":gt,Rr=ae.values,Xr=Rr===void 0?"":Rr,Ue=Object(F.useState)(null),ut=Object(R.a)(Ue,2),We=ut[0],Un=ut[1],hn=Object(F.useState)(ue),Yr=Object(R.a)(hn,2),$r=Yr[0],st=Yr[1],Qi=Object(F.useState)(it),Nn=Object(R.a)(Qi,2),cr=Nn[0],ar=Nn[1],bi=Object(F.useState)(ur),Bn=Object(R.a)(bi,2),rr=Bn[0],mn=Bn[1],Ei=Object(F.useState)(""),pn=Object(R.a)(Ei,2),Ar=pn[0],Lr=pn[1],xi=Object(F.useState)(0),jn=Object(R.a)(xi,2),Jr=jn[0],Wn=jn[1],Ti=Object(F.useState)(be),fr=Object(R.a)(Ti,2),Si=fr[0],wi=fr[1],gn=Object(F.useState)(!1),kr=Object(R.a)(gn,2),Ua=kr[0],Hn=kr[1],Qr=Object(F.useRef)(),Kn=Object(F.useRef)(),Pr=Object(F.useRef)(),Zr=Object(F.useRef)();Object(F.useEffect)(function(){st(Xr),We==null||We.setValue(Xr)},[Xr]),Object(F.useEffect)(function(){Ct==null||Ct(rr)},[rr]),Object(F.useEffect)(function(){if(Qr.current){var rt=T.a.fromTextArea(Qr.current,{mode:ot,lineNumbers:!Me,lineWrapping:!0,value:ue,autoCloseTags:!0,autoCloseBrackets:!0});dt&&rt.focus();function ct(ft,Et){if(dr){Et.preventDefault();return}var xt=Et.clipboardData;if(xt){var St=xt.types.toString(),Rt=xt.items,At=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(St==="Files"||xt.types.indexOf("Files")>-1){if(Et.preventDefault(),ot=="stex")return;try{var Gt,mr=Rt[1];((Gt=Rt[0])===null||Gt===void 0?void 0:Gt.kind)==="file"&&(mr=Rt[0]);var wt=mr.getAsFile(),Mr=wt.name.split(".").pop();Te(wt,function(zt){if(zt.id){var Ir,Fr,yn;(wt==null||((Ir=wt.type)===null||Ir===void 0)?void 0:Ir.indexOf("image"))>-1?rt.replaceSelection(".concat(zt.content_type,")")):(wt==null||((Fr=wt.type)===null||Fr===void 0)?void 0:Fr.indexOf("video"))>-1?rt.replaceSelection('<video width="100%" controls src="'.concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(wt==null||((yn=wt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?rt.replaceSelection('<a href="'.concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(wt.type,'&disposition=inline" target="_blank">').concat(wt.name,"</a>")):At.includes(Mr)?rt.replaceSelection('<a href="'.concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(wt.name,"</a>")):rt.replaceSelection("[".concat(wt.name,"](").concat(ye.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return rt.on("paste",ct),Un(rt),function(){rt.off("paste",ct)}}},[]);var Ci=Object(F.useCallback)(function(){if(Kn.current)try{}catch(rt){console.log(rt,"---- to set md editor body height")}},[Si,Kn,rr]);Object(F.useEffect)(function(){function rt(){var ft=new A.default(function(Et){var xt=Object(L.a)(Et),St;try{for(xt.s();!(St=xt.n()).done;){var Rt=St.value;(Rt.target.offsetHeight>0||Rt.target.offsetWidth>0)&&(Ci(),We.setSize("100%","100%"),We.refresh())}}catch(At){xt.e(At)}finally{xt.f()}});return ft.observe(Qr.current.parentElement),ft}if(We){var ct=rt();return function(){ct.unobserve(Qr.current.parentElement)}}},[We,Ci]),Object(F.useEffect)(function(){if(We){for(var rt=[],ct=function(){var Rt=Et[ft];xt=Object(R.a)(Rt,2);var At=xt[0],Gt=xt[1],mr=Object(B.a)({},At,function(){Gn(Gt)});rt.push(mr),We.addKeyMap(mr)},ft=0,Et=Object.entries($e);ft<Et.length;ft++){var xt;ct()}return function(){var St=Object(L.a)(rt),Rt;try{for(St.s();!(Rt=St.n()).done;){var At=Rt.value;We.removeKeyMap(At)}}catch(Gt){St.e(Gt)}finally{St.f()}}}},[We]),Object(F.useEffect)(function(){ur!==rr&&mn(ur)},[ur]),Object(De.a)(function(){if(!Tr&&Jr>0){var rt=new Date().getTime(),ct=window.sessionStorage.getItem(yt);rt>=Jr+je&&(!ct||ct!==$r)&&(window.sessionStorage.setItem(yt,$r),Hn(!0))}},je),Object(F.useEffect)(function(){ar(it)},[We,it]),Object(F.useEffect)(function(){We&&(dt&&We.focus())},[We,dt]),Object(F.useEffect)(function(){if(cr&&We){var rt=We.getScrollerElement();function ct(ft){var Et=ft.target;if(Zr.current){var xt=Et.scrollTop/Et.scrollHeight;Zr.current.scrollTop=Zr.current.scrollHeight*xt}}return rt.addEventListener("scroll",ct),function(){rt.removeEventListener("scroll",ct)}}},[We,cr]),Object(F.useEffect)(function(){if(We&&cn){function rt(ct,ft){cn(ct,ft)}return We.on("beforeChange",rt),function(){We.off("beforeChange",rt)}}},[We,cn]),Object(F.useEffect)(function(){if(We&&Vr){function rt(){Vr(We.getValue())}return We.on("blur",rt),function(){We.off("blur",rt)}}},[We,Vr]),Object(F.useEffect)(function(){if(We){function rt(ct){var ft=ct.getValue();st(ft),Wn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$&&$(ft)}return We.on("change",rt),function(){We.off("change",rt)}}},[We,$]),Object(F.useEffect)(function(){We&&(ue==null?(We.setValue(""),st("")):ue!==We.getValue()&&(We.setValue(ue),st(ue),We.setCursor(We.lineCount(),0)))},[We,ue]);var Gn=Object(F.useCallback)(function(rt){var ct=We.getCursor(),ft=We.getSelection(),Et=ft.split(`
|
|
`);switch(rt){case"bold":return We.replaceSelection("**"+ft+"**"),ft===""&&We.setCursor(ct.line,ct.ch+2),We.focus();case"italic":return We.replaceSelection("*"+ft+"*"),ft===""&&We.setCursor(ct.line,ct.ch+1),We.focus();case"code":return We.replaceSelection("`"+ft+"`"),ft===""&&We.setCursor(ct.line,ct.ch+1),We.focus();case"inline-latex":return We.replaceSelection("`$$"+ft+"$$`"),ft===""&&We.setCursor(ct.line,ct.ch+3),We.focus();case"latex":return We.replaceSelection("```latex\n"+ft+"\n```"),We.setCursor(ct.line+1,ft.length+1),We.focus();case"line-break":return We.replaceSelection(`<br/>
|
|
`),We.focus();case"list-ul":return ft===""?We.replaceSelection("- "+ft):We.replaceSelection(Et.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),We.focus();case"list-ol":return ft===""?We.replaceSelection("1. "+ft):We.replaceSelection(Et.map(function(xt,St){return xt===""?"":"".concat(St+1,". ").concat(xt)}).join(`
|
|
`)),We.focus();case"add-null-ch":return ft===""&&We.setCursor(ct.line,ct.ch+1),We.replaceSelection(Xe),We.focus();case"inster-template-1":return ft===""&&We.setCursor(ct.line,ct.ch),We.replaceSelection(Be),We.focus();case"eraser":return We.setValue(""),We.focus();case"trigger-watch":return ar(!cr),We.focus();case"trigger-full-screen":return mn(!rr),We.focus();case Se:Lr(Se);return;case we:Lr(we);return;case me:Lr(me);return;case _e:Lr(_e);return;default:throw new Error}},[We,cr,rr]),qr=Object(F.useCallback)(function(rt){Lr("");switch(Ar){case Se:var ct=rt.title,ft=rt.link;return We.replaceSelection("[".concat(ct,"](").concat(ft,")")),We.focus();case we:var Et=rt.language,xt=rt.content;return We.replaceSelection(["```"+Et,xt,"```"].join(`
|
|
`)),We.focus();case me:var St=rt.src,Rt=rt.alt;return We.replaceSelection(".concat(St,' "').concat(Rt,'" )')),We.focus();case _e:for(var At=rt.row,Gt=rt.col,mr=rt.align,wt=`
|
|
`,Mr=0;Mr<At;Mr++){for(var zt=[],Ir=[],Fr=0;Fr<Gt;Fr++)Mr===1&&Ir.push(Ie[mr]),zt.push(" ");Mr===1&&(wt+="| ".concat(Ir.join(" | "),` |
|
|
`)),wt+="| ".concat(zt.join(Gt===1?"":" | "),` |
|
|
`)}return We.replaceSelection(wt+`
|
|
`),We.focus();default:throw new Error}},[We,Ar]),vn=Object(F.useMemo)(function(){switch(Ar){case Se:return _.a.createElement(W,{callback:qr,onCancel:yr});case we:return _.a.createElement(O.b,{callback:qr,onCancel:yr});case me:return _.a.createElement(Ee,{callback:qr,onCancel:yr});case _e:return _.a.createElement(q,{callback:qr,onCancel:yr});default:return null}},[Ar]);function yr(){Lr("")}Object(F.useEffect)(function(){if(Pr.current){var rt=Pr.current,ct=!1,ft=0;function Et(Rt){ct=!0,ft=Rt.pageY}function xt(){ct=!1}function St(Rt){if(ct){var At=Rt.pageY-ft;At<0&&(At=0),At>300&&(At=300);var Gt=be+At+"px";wi(Gt)}}return rt.addEventListener("mousedown",Et),document.addEventListener("mousemove",St),document.addEventListener("mouseup",xt),function(){rt.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",xt)}}},[We,Pr]),Object(F.useEffect)(function(){wi(be)},[be]);var zn=He(ee),Ai=He(Si),Li={width:zn,height:Ai},Vn=Object(F.useMemo)(function(){if(Jr){var rt=new Date(Jr),ct=rt.getHours(),ft=rt.getMinutes(),Et=rt.getSeconds();return ct=ct<10?"0"+ct:ct,ft=ft<10?"0"+ft:ft,Et=Et<10?"0"+Et:Et,"".concat(ct,":").concat(ft,":").concat(Et)}return 0},[Jr]);function Na(){window.sessionStorage.removeItem(yt),Hn(!1),Wn(0)}function Zi(){Hn(!1),Wn(0),We.setValue(window.sessionStorage.getItem(yt))}return _.a.createElement(F.Fragment,null,_.a.createElement("div",{className:"markdown-editor-wrapper",ref:Kn},_.a.createElement("div",{className:"markdown-editor-container ".concat(wr," ").concat(cr?"on-preview":""," ").concat(Me?"mini":""," ").concat(rr?"full-screen":""),style:Li},_.a.createElement(c,{insertTemp:Dt,watch:cr,fullScreen:rr,showNullButton:lr,onActionCallback:Gn,hidetoolBar:hr}),_.a.createElement("div",{className:"markdown-editor-body"},_.a.createElement("div",{className:"codemirror-container"},_.a.createElement("textarea",{ref:Qr,placeholder:Cr})),cr?_.a.createElement("div",{ref:Zr,className:"preview-container"},ot==="stex"&&_.a.createElement(E,{value:$r}),ot!=="stex"&&_.a.createElement(u.a,{value:$r})):null))),Wt?_.a.createElement("a",{ref:Pr,className:"editor-resize"}):null,_.a.createElement(l.a,null,Oe[Ar]?_.a.createElement(V.a,{centered:!0,title:Oe[Ar],visible:!0,onCancel:yr,footer:null},vn):null))}},R7cW:function(lt,Qe,oe){"use strict";oe.r(Qe);var ne=oe("+L6B"),V=oe("2/Rp"),L=oe("DZo9"),G=oe("8z0m"),I=oe("0Owb"),R=oe("5NDa"),B=oe("5rEg"),F=oe("sPJy"),_=oe("bE4q"),D=oe("k1fw"),T=oe("oBTY"),A=oe("9og8"),P=oe("miYZ"),C=oe("tsqr"),S=oe("y8nQ"),y=oe("Vl3Y"),d=oe("tJVT"),o=oe("WmNS"),s=oe.n(o),u=oe("cDcd"),E=oe.n(u),f=oe("Ty5D"),m=oe("9kvl"),w=oe("55Ip"),b=oe("Ot1p"),h=oe("XYT7"),c=oe("m3rI"),l=oe("YiJy"),a=oe.n(l),g=function(v){var M,U=v.shixunHomeworks,j=v.newCourse,W=v.globalSetting,O=v.loading,k=v.dispatch,H=v.match,X=Object(f.i)(),Z=y.a.useForm(),te=Object(d.a)(Z,1),Ee=te[0],fe=Object(u.useState)({}),Te=Object(d.a)(fe,2),pe=Te[0],ge=Te[1],ce=Object(u.useState)(!1),he=Object(d.a)(ce,2),J=he[0],se=he[1],q=Object(u.useState)([]),ye=Object(d.a)(q,2),Se=ye[0],me=ye[1],we=Object(u.useState)([]),_e=Object(d.a)(we,2),ke=_e[0],Ie=_e[1],De=U.commonHomeWorkEditDefaultData,Le={name:"file",multiple:!0,action:c.a.API_SERVER+"/api/attachments.json",defaultFileList:Se,onChange:function(Xe){var Be=Xe.file.status;Be!=="uploading",Be==="done"?C.b.success("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):Be==="error"&&C.b.error("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(u.useEffect)(function(){Ye()},[X.topicId]);var ze=function(Xe){return Xe==null?void 0:Xe.map(function(Be){return{uid:Be.id,response:{id:Be.id},name:Be.title,status:"done",url:Be.url}})},Ye=function(){var je=Object(A.a)(s.a.mark(function Xe(){var Be;return s.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,k({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:X.topicId}});case 2:Be=Ae.sent,Be&&(Ee.setFieldsValue({name:Be.name}),Ee.setFieldsValue({description:Be.description}),Ee.setFieldsValue({reference_answer:Be.reference_answer}),me(Object(T.a)(ze(Be.attachments))),Ie(Object(T.a)(ze(Be.reference_attachments))),se(!0));case 4:case"end":return Ae.stop()}},Xe)}));return function(){return je.apply(this,arguments)}}(),Ve=function(){var je=Object(A.a)(s.a.mark(function Xe(Be){var He,Ae,Ze,$e;return s.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:return He=Object(D.a)({},pe),He.attachment_ids&&(He.attachment_ids=He==null||((Ae=He.attachment_ids.fileList)===null||Ae===void 0)?void 0:Ae.map(function(ae){var le;return(le=ae.response)===null||le===void 0?void 0:le.id})),He.reference_attachment_ids&&(He.reference_attachment_ids=He==null||((Ze=He.reference_attachment_ids.fileList)===null||Ze===void 0)?void 0:Ze.map(function(ae){var le;return(le=ae.response)===null||le===void 0?void 0:le.id})),Fe.next=5,Object(h.n)(Object(D.a)(Object(D.a)({id:X.topicId},He),{},{base_on_project:null,type:1}));case 5:$e=Fe.sent,$e&&m.d.push("/users/".concat(X.username,"/topics/").concat(X.topicId,"/").concat(X.topictype,"/normal/detail"));case 7:case"end":return Fe.stop()}},Xe)}));return function(Be){return je.apply(this,arguments)}}();return E.a.createElement("section",{className:a.a.bg},E.a.createElement("section",{className:"animated fadeIn"},E.a.createElement("aside",{className:"mt10"},E.a.createElement(_.a,{separator:">"},E.a.createElement(_.a.Item,null,E.a.createElement(w.a,{to:"/users/".concat(X.username,"/").concat(X.topictype==="personal"?"topics":"topicbank","/").concat(X.topictype)},X.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),E.a.createElement(_.a.Item,null,E.a.createElement(w.a,{to:"/users/".concat(X.username,"/topics/").concat(X.topicId,"/").concat(X.topictype,"/normal/detail")},"\u8BE6\u60C5")),E.a.createElement(_.a.Item,null,"\u7F16\u8F91")))),E.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),E.a.createElement(y.a,{form:Ee,className:a.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){ge(Object(D.a)({},Ee.getFieldsValue()))},onFinish:Ve},E.a.createElement("div",{className:a.a.fieldWrap},E.a.createElement(y.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},E.a.createElement(B.a,{maxLength:60,suffix:"".concat(((M=pe.name)===null||M===void 0?void 0:M.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),E.a.createElement("div",{className:a.a.mdWrap},E.a.createElement(y.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},E.a.createElement(b.a,{id:"topic-normal-description",watch:!0,defaultValue:De.description})),E.a.createElement("div",null,E.a.createElement(y.a.Item,{name:"attachment_ids"},J&&E.a.createElement(G.a,Object(I.a)({defaultFileList:Se},Le),E.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),E.a.createElement("div",{className:a.a.mdWrap},E.a.createElement(y.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},E.a.createElement(b.a,{id:"topic-normal-reference_answer",defaultValue:De.reference_answer,watch:!0})),E.a.createElement("div",null,E.a.createElement(y.a.Item,{name:"reference_attachment_ids"},J&&E.a.createElement(G.a,Object(I.a)({},Le,{defaultFileList:ke}),E.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),E.a.createElement("div",{className:a.a.backgroundFa},E.a.createElement("div",{className:"pt40 mb30"},E.a.createElement(y.a.Item,null,E.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(a.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),E.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:a.a.button,onClick:function(){return m.d.push("/users/".concat(X.username,"/topics/").concat(X.topicId,"/").concat(X.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};Qe.default=Object(m.a)(function(p){var v=p.shixunHomeworks,M=p.newCourse,U=p.loading,j=p.globalSetting;return{shixunHomeworks:v,newCourse:M,globalSetting:j,loading:U.effects}})(g)},SJMd:function(lt,Qe){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var oe,ne,V,L=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var F=window,_=["break,continue,do,else,for,if,return,while"],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"],T=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[T,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[T,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[T,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],S="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[T,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[_,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[_,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[A,C,P,y,d,o,s,u],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",w="kwd",b="com",h="typ",c="lit",l="pun",a="pln",g="tag",p="dec",v="src",M="atn",U="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(me){for(var we=0,_e=!1,ke=!1,Ie=0,De=me.length;Ie<De;++Ie){var Le=me[Ie];if(Le.ignoreCase)ke=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){_e=!0,ke=!1;break}}var ze={b:8,t:9,n:10,v:11,f:12,r:13};function Ye(He){var Ae=He.charCodeAt(0);if(Ae!==92)return Ae;var Ze=He.charAt(1);return Ae=ze[Ze],Ae||("0"<=Ze&&Ze<="7"?parseInt(He.substring(1),8):Ze==="u"||Ze==="x"?parseInt(He.substring(2),16):He.charCodeAt(1))}function Ve(He){if(He<32)return(He<16?"\\x0":"\\x")+He.toString(16);var Ae=String.fromCharCode(He);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function je(He){var Ae=He.substring(1,He.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ze=[],$e=Ae[0]==="^",Oe=["["];$e&&Oe.push("^");for(var Fe=$e?1:0,ae=Ae.length;Fe<ae;++Fe){var le=Ae[Fe];if(/\\[bdsw]/i.test(le))Oe.push(le);else{var ue=Ye(le),$;Fe+2<ae&&Ae[Fe+1]==="-"?($=Ye(Ae[Fe+2]),Fe+=2):$=ue,Ze.push([ue,$]),$<65||ue>122||($<65||ue>90||Ze.push([Math.max(65,ue)|32,Math.min($,90)|32]),$<97||ue>122||Ze.push([Math.max(97,ue)&~32,Math.min($,122)&~32]))}}Ze.sort(function(be,Ce){return be[0]-Ce[0]||Ce[1]-be[1]});for(var Q=[],ee=[],Fe=0;Fe<Ze.length;++Fe){var re=Ze[Fe];re[0]<=ee[1]+1?ee[1]=Math.max(ee[1],re[1]):Q.push(ee=re)}for(var Fe=0;Fe<Q.length;++Fe){var re=Q[Fe];Oe.push(Ve(re[0])),re[1]>re[0]&&(re[1]+1>re[0]&&Oe.push("-"),Oe.push(Ve(re[1])))}return Oe.push("]"),Oe.join("")}function Xe(He){for(var Ae=He.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ze=Ae.length,$e=[],Oe=0,Fe=0;Oe<Ze;++Oe){var ae=Ae[Oe];if(ae==="(")++Fe;else if(ae.charAt(0)==="\\"){var le=+ae.substring(1);le&&(le<=Fe?$e[le]=-1:Ae[Oe]=Ve(le))}}for(var Oe=1;Oe<$e.length;++Oe)$e[Oe]===-1&&($e[Oe]=++we);for(var Oe=0,Fe=0;Oe<Ze;++Oe){var ae=Ae[Oe];if(ae==="(")++Fe,$e[Fe]||(Ae[Oe]="(?:");else if(ae.charAt(0)==="\\"){var le=+ae.substring(1);le&&le<=Fe&&(Ae[Oe]="\\"+$e[le])}}for(var Oe=0;Oe<Ze;++Oe)Ae[Oe]==="^"&&Ae[Oe+1]!=="^"&&(Ae[Oe]="");if(He.ignoreCase&&_e)for(var Oe=0;Oe<Ze;++Oe){var ae=Ae[Oe],ue=ae.charAt(0);ae.length>=2&&ue==="["?Ae[Oe]=je(ae):ue!=="\\"&&(Ae[Oe]=ae.replace(/[a-zA-Z]/g,function(ee){var re=ee.charCodeAt(0);return"["+String.fromCharCode(re&~32,re|32)+"]"}))}return Ae.join("")}for(var Be=[],Ie=0,De=me.length;Ie<De;++Ie){var Le=me[Ie];if(Le.global||Le.multiline)throw new Error(""+Le);Be.push("(?:"+Xe(Le)+")")}return new RegExp(Be.join("|"),ke?"gi":"g")}function k(me,we){var _e=/(?:^|\s)nocode(?:\s|$)/,ke=[],Ie=0,De=[],Le=0;function ze(Ye){var Ve=Ye.nodeType;if(Ve==1){if(_e.test(Ye.className))return;for(var je=Ye.firstChild;je;je=je.nextSibling)ze(je);var Xe=Ye.nodeName.toLowerCase();(Xe==="br"||Xe==="li")&&(ke[Le]=`
|
|
`,De[Le<<1]=Ie++,De[Le++<<1|1]=Ye)}else if(Ve==3||Ve==4){var Be=Ye.nodeValue;Be.length&&(we?Be=Be.replace(/\r\n?/g,`
|
|
`):Be=Be.replace(/[ \t\r\n]+/g," "),ke[Le]=Be,De[Le<<1]=Ie,Ie+=Be.length,De[Le++<<1|1]=Ye)}}return ze(me),{sourceCode:ke.join("").replace(/\n$/,""),spans:De}}function H(me,we,_e,ke,Ie){if(!_e)return;var De={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:_e,spans:null,basePos:we,decorations:null};ke(De),Ie.push.apply(Ie,De.decorations)}var X=/\S/;function Z(me){for(var we=void 0,_e=me.firstChild;_e;_e=_e.nextSibling){var ke=_e.nodeType;we=ke===1?we?me:_e:ke===3&&X.test(_e.nodeValue)?me:we}return we===me?void 0:we}function te(me,we){var _e={},ke;(function(){for(var Le=me.concat(we),ze=[],Ye={},Ve=0,je=Le.length;Ve<je;++Ve){var Xe=Le[Ve],Be=Xe[3];if(Be)for(var He=Be.length;--He>=0;)_e[Be.charAt(He)]=Xe;var Ae=Xe[1],Ze=""+Ae;Ye.hasOwnProperty(Ze)||(ze.push(Ae),Ye[Ze]=null)}ze.push(/[\0-\uffff]/),ke=O(ze)})();var Ie=we.length,De=function(Le){for(var ze=Le.sourceCode,Ye=Le.basePos,Ve=Le.sourceNode,je=[Ye,a],Xe=0,Be=ze.match(ke)||[],He={},Ae=0,Ze=Be.length;Ae<Ze;++Ae){var $e=Be[Ae],Oe=He[$e],Fe=void 0,ae;if(typeof Oe=="string")ae=!1;else{var le=_e[$e.charAt(0)];if(le)Fe=$e.match(le[1]),Oe=le[0];else{for(var ue=0;ue<Ie;++ue)if(le=we[ue],Fe=$e.match(le[1]),Fe){Oe=le[0];break}Fe||(Oe=a)}ae=Oe.length>=5&&Oe.substring(0,5)==="lang-",ae&&!(Fe&&typeof Fe[1]=="string")&&(ae=!1,Oe=v),ae||(He[$e]=Oe)}var $=Xe;if(Xe+=$e.length,!ae)je.push(Ye+$,Oe);else{var Q=Fe[1],ee=$e.indexOf(Q),re=ee+Q.length;Fe[2]&&(re=$e.length-Fe[2].length,ee=re-Q.length);var be=Oe.substring(5);H(Ve,Ye+$,$e.substring(0,ee),De,je),H(Ve,Ye+$+ee,Q,he(be,Q),je),H(Ve,Ye+$+re,$e.substring(re),De,je)}}Le.decorations=je};return De}function Ee(me){var we=[],_e=[];me.tripleQuotedStrings?we.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?we.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&_e.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=me.hashComments;ke&&(me.cStyleComments?(ke>1?we.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),_e.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([b,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(_e.push([b,/^\/\/[^\r\n]*/,null]),_e.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=me.regexLiterals;if(Ie){var De=Ie>1?"":`
|
|
\r`,Le=De?".":"[\\S\\s]",ze="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";_e.push(["lang-regex",RegExp("^"+W+"("+ze+")")])}var Ye=me.types;Ye&&_e.push([h,Ye]);var Ve=(""+me.keywords).replace(/^ | $/g,"");Ve.length&&_e.push([w,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(je+="(?!s*/)"),_e.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(je),null]),te(we,_e)}var fe=Ee({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(me,we,_e){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,De=me.ownerDocument,Le=De.createElement("li");me.firstChild;)Le.appendChild(me.firstChild);var ze=[Le];function Ye(Ae){var Ze=Ae.nodeType;if(Ze==1&&!ke.test(Ae.className))if(Ae.nodeName==="br")Ve(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var $e=Ae.firstChild;$e;$e=$e.nextSibling)Ye($e);else if((Ze==3||Ze==4)&&_e){var Oe=Ae.nodeValue,Fe=Oe.match(Ie);if(Fe){var ae=Oe.substring(0,Fe.index);Ae.nodeValue=ae;var le=Oe.substring(Fe.index+Fe[0].length);if(le){var ue=Ae.parentNode;ue.insertBefore(De.createTextNode(le),Ae.nextSibling)}Ve(Ae),ae||Ae.parentNode.removeChild(Ae)}}}function Ve(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function Ze(Fe,ae){var le=ae?Fe.cloneNode(!1):Fe,ue=Fe.parentNode;if(ue){var $=Ze(ue,1),Q=Fe.nextSibling;$.appendChild(le);for(var ee=Q;ee;ee=Q)Q=ee.nextSibling,$.appendChild(ee)}return le}for(var $e=Ze(Ae.nextSibling,0),Oe;(Oe=$e.parentNode)&&Oe.nodeType===1;)$e=Oe;ze.push($e)}for(var je=0;je<ze.length;++je)Ye(ze[je]);we===(we|0)&&ze[0].setAttribute("value",we);var Xe=De.createElement("ol");Xe.className="linenums";for(var Be=Math.max(0,we-1|0)||0,je=0,He=ze.length;je<He;++je)Le=ze[je],Le.className="L"+(je+Be)%10,Le.firstChild||Le.appendChild(De.createTextNode("\xA0")),Xe.appendChild(Le);me.appendChild(Xe)}function pe(me){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var _e=/\n/g,ke=me.sourceCode,Ie=ke.length,De=0,Le=me.spans,ze=Le.length,Ye=0,Ve=me.decorations,je=Ve.length,Xe=0;Ve[je]=Ie;var Be,He;for(He=Be=0;He<je;)Ve[He]!==Ve[He+2]?(Ve[Be++]=Ve[He++],Ve[Be++]=Ve[He++]):He+=2;for(je=Be,He=Be=0;He<je;){for(var Ae=Ve[He],Ze=Ve[He+1],$e=He+2;$e+2<=je&&Ve[$e+1]===Ze;)$e+=2;Ve[Be++]=Ae,Ve[Be++]=Ze,He=$e}je=Ve.length=Be;var Oe=me.sourceNode,Fe="";Oe&&(Fe=Oe.style.display,Oe.style.display="none");try{for(var ae=null;Ye<ze;){var le=Le[Ye],ue=Le[Ye+2]||Ie,$=Ve[Xe+2]||Ie,$e=Math.min(ue,$),Q=Le[Ye+1],ee;if(Q.nodeType!==1&&(ee=ke.substring(De,$e))){we&&(ee=ee.replace(_e,"\r")),Q.nodeValue=ee;var re=Q.ownerDocument,be=re.createElement("span");be.className=Ve[Xe+1];var Ce=Q.parentNode;Ce.replaceChild(be,Q),be.appendChild(Q),De<ue&&(Le[Ye+1]=Q=re.createTextNode(ke.substring($e,ue)),Ce.insertBefore(Q,be.nextSibling))}De=$e,De>=ue&&(Ye+=2),De>=$&&(Xe+=2)}}finally{Oe&&(Oe.style.display=Fe)}}var ge={};function ce(me,we){for(var _e=we.length;--_e>=0;){var ke=we[_e];ge.hasOwnProperty(ke)?F.console&&console.warn("cannot override language handler %s",ke):ge[ke]=me}}function he(me,we){return me&&ge.hasOwnProperty(me)||(me=/^\s*</.test(we)?"default-markup":"default-code"),ge[me]}ce(fe,["default-code"]),ce(te([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ce(te([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ce(te([],[[U,/^[\s\S]+/]]),["uq.val"]),ce(Ee({keywords:A,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),ce(Ee({keywords:"null,true,false"}),["json"]),ce(Ee({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),ce(Ee({keywords:P,cStyleComments:!0}),["java"]),ce(Ee({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(Ee({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(Ee({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(Ee({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(Ee({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(Ee({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(te([],[[m,/^[\s\S]+/]]),["regex"]);function J(me){var we=me.langExtension;try{var _e=k(me.sourceNode,me.pre),ke=_e.sourceCode;me.sourceCode=ke,me.spans=_e.spans,me.basePos=0,he(we,ke)(me),pe(me)}catch(Ie){F.console&&console.log(Ie&&Ie.stack||Ie)}}function se(me,we,_e){var ke=_e||!1,Ie=we||null,De=document.createElement("div");De.innerHTML="<pre>"+me+"</pre>",De=De.firstChild,ke&&Te(De,ke,!0);var Le={langExtension:Ie,numberLines:ke,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Le),De.innerHTML}function q(me,we){var _e=we||document.body,ke=_e.ownerDocument||document;function Ie(le){return _e.getElementsByTagName(le)}for(var De=[Ie("pre"),Ie("code"),Ie("xmp")],Le=[],ze=0;ze<De.length;++ze)for(var Ye=0,Ve=De[ze].length;Ye<Ve;++Ye)Le.push(De[ze][Ye]);De=null;var je=Date;je.now||(je={now:function(){return+new Date}});var Xe=0,Be=/\blang(?:uage)?-([\w.]+)(?!\S)/,He=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,Ze=/pre|xmp/i,$e=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,Fe={};function ae(){for(var le=F.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;Xe<Le.length&&je.now()<le;Xe++){for(var ue=Le[Xe],$=Fe,Q=ue;Q=Q.previousSibling;){var ee=Q.nodeType,re=(ee===7||ee===8)&&Q.nodeValue;if(re?!/^\??prettify\b/.test(re):ee!==3||/\S/.test(Q.nodeValue))break;if(re){$={},re.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,pt,Tr){$[pt]=Tr});break}}var be=ue.className;if(($!==Fe||He.test(be))&&!Ae.test(be)){for(var Ce=!1,Me=ue.parentNode;Me;Me=Me.parentNode){var tt=Me.tagName;if(Oe.test(tt)&&Me.className&&He.test(Me.className)){Ce=!0;break}}if(!Ce){ue.className+=" prettyprinted";var dt=$.lang;if(!dt){dt=be.match(Be);var it;!dt&&(it=Z(ue))&&$e.test(it.tagName)&&(dt=it.className.match(Be)),dt&&(dt=dt[1])}var Dt;if(Ze.test(ue.tagName))Dt=1;else{var mt=ue.currentStyle,ot=ke.defaultView,It=mt?mt.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Dt=It&&It.substring(0,3)==="pre"}var yt=$.linenums;(yt=yt==="true"||+yt)||(yt=be.match(/\blinenums\b(?::(\d+))?/),yt=yt?yt[1]&&yt[1].length?+yt[1]:!0:!1),yt&&Te(ue,yt,Dt);var Yt={langExtension:dt,sourceNode:ue,numberLines:yt,pre:Dt,sourceCode:null,basePos:null,spans:null,decorations:null};J(Yt)}}}Xe<Le.length?F.setTimeout(ae,250):typeof me=="function"&&me()}ae()}var ye=F.PR={createSimpleLexer:te,registerLangHandler:ce,sourceDecorator:Ee,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:p,PR_KEYWORD:w,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:v,PR_STRING:m,PR_TAG:g,PR_TYPE:h,prettyPrintOne:L?F.prettyPrintOne=se:R=se,prettyPrint:B=L?F.prettyPrint=q:B=q},Se=F.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return ye})})()},"VrN/":function(lt,Qe,oe){(function(ne,V){lt.exports=V()})(this,function(){"use strict";var ne=navigator.userAgent,V=navigator.platform,L=/gecko\/\d/i.test(ne),G=/MSIE \d/.test(ne),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),R=/Edge\/(\d+)/.exec(ne),B=G||I||R,F=B&&(G?document.documentMode||6:+(R||I)[1]),_=!R&&/WebKit\//.test(ne),D=_&&/Qt\/\d+\.\d+/.test(ne),T=!R&&/Chrome\//.test(ne),A=/Opera\//.test(ne),P=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),S=/PhantomJS/.test(ne),y=!R&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),d=/Android/.test(ne),o=y||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=y||/Mac/.test(V),u=/\bCrOS\b/.test(ne),E=/win/i.test(V),f=A&&ne.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(A=!1,_=!0);var m=s&&(D||A&&(f==null||f<12.11)),w=L||B&&F>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var x=0;x<t.length;++x)i.appendChild(t[x]);return i}function g(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 v(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};y?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function k(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var x=r||0,N=i||0;;){var K=e.indexOf(" ",x);if(K<0||K>=t)return N+(t-x);N+=K-x,N+=n-N%n,x=K+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Z(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var te=50,Ee={toString:function(){return"CodeMirror.Pass"}},fe={scroll:!1},Te={origin:"*mouse"},pe={origin:"+move"};function ge(e,t,n){for(var r=0,i=0;;){var x=e.indexOf(" ",r);x==-1&&(x=e.length);var N=x-r;if(x==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=x-r,i+=n-i%n,r=x+1,i>=t)return r}}var ce=[""];function he(e){for(;ce.length<=e;)ce.push(J(ce)+" ");return ce[e]}function J(e){return e[e.length-1]}function se(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function q(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ye(){}function Se(e,t){var n;return Object.create?n=Object.create(e):(ye.prototype=e,n=new ye),t&&k(t,n),n}var me=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||me.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function ke(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 De(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,x=r<0?Math.ceil(i):Math.floor(i);if(x==t)return e(x)?t:n;e(x)?n=x:t=x+r}}function Ye(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,x=0;x<e.length;++x){var N=e[x];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",x),i=!0)}i||r(t,n,"ltr")}var Ve=null;function je(e,t,n){var r;Ve=null;for(var i=0;i<e.length;++i){var x=e[i];if(x.from<t&&x.to>t)return i;x.to==t&&(x.from!=x.to&&n=="before"?r=i:Ve=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:Ve=i)}return r!=null?r:Ve}var Xe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(Y){return Y<=247?e.charAt(Y):1424<=Y&&Y<=1524?"R":1536<=Y&&Y<=1785?t.charAt(Y-1536):1774<=Y&&Y<=2220?"r":8192<=Y&&Y<=8203?"w":Y==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,x=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function z(Y,ie,de){this.level=Y,this.from=ie,this.to=de}return function(Y,ie){var de=ie=="ltr"?"L":"R";if(Y.length==0||ie=="ltr"&&!r.test(Y))return!1;for(var xe=Y.length,ve=[],Re=0;Re<xe;++Re)ve.push(n(Y.charCodeAt(Re)));for(var Pe=0,Ne=de;Pe<xe;++Pe){var Ke=ve[Pe];Ke=="m"?ve[Pe]=Ne:Ne=Ke}for(var Je=0,Ge=de;Je<xe;++Je){var qe=ve[Je];qe=="1"&&Ge=="r"?ve[Je]="n":x.test(qe)&&(Ge=qe,qe=="r"&&(ve[Je]="R"))}for(var at=1,nt=ve[0];at<xe-1;++at){var ht=ve[at];ht=="+"&&nt=="1"&&ve[at+1]=="1"?ve[at]="1":ht==","&&nt==ve[at+1]&&(nt=="1"||nt=="n")&&(ve[at]=nt),nt=ht}for(var Tt=0;Tt<xe;++Tt){var Bt=ve[Tt];if(Bt==",")ve[Tt]="N";else if(Bt=="%"){var _t=void 0;for(_t=Tt+1;_t<xe&&ve[_t]=="%";++_t);for(var ir=Tt&&ve[Tt-1]=="!"||_t<xe&&ve[_t]=="1"?"1":"N",qt=Tt;qt<_t;++qt)ve[qt]=ir;Tt=_t-1}}for(var Pt=0,er=de;Pt<xe;++Pt){var Kt=ve[Pt];er=="L"&&Kt=="1"?ve[Pt]="L":x.test(Kt)&&(er=Kt)}for(var Ft=0;Ft<xe;++Ft)if(i.test(ve[Ft])){var Mt=void 0;for(Mt=Ft+1;Mt<xe&&i.test(ve[Mt]);++Mt);for(var Ot=(Ft?ve[Ft-1]:de)=="L",tr=(Mt<xe?ve[Mt]:de)=="L",In=Ot==tr?Ot?"L":"R":de,Gr=Ft;Gr<Mt;++Gr)ve[Gr]=In;Ft=Mt-1}for(var Xt=[],xr,jt=0;jt<xe;)if(N.test(ve[jt])){var Ia=jt;for(++jt;jt<xe&&N.test(ve[jt]);++jt);Xt.push(new z(0,Ia,jt))}else{var Or=jt,un=Xt.length,dn=ie=="rtl"?1:0;for(++jt;jt<xe&&ve[jt]!="L";++jt);for(var Jt=Or;Jt<jt;)if(K.test(ve[Jt])){Or<Jt&&(Xt.splice(un,0,new z(1,Or,Jt)),un+=dn);var Fn=Jt;for(++Jt;Jt<jt&&K.test(ve[Jt]);++Jt);Xt.splice(un,0,new z(2,Fn,Jt)),un+=dn,Or=Jt}else++Jt;Or<jt&&Xt.splice(un,0,new z(1,Or,jt))}return ie=="ltr"&&(Xt[0].level==1&&(xr=Y.match(/^\s+/))&&(Xt[0].from=xr[0].length,Xt.unshift(new z(0,0,xr[0].length))),J(Xt).level==1&&(xr=Y.match(/\s+$/))&&(J(Xt).to-=xr[0].length,Xt.push(new z(0,xe-xr[0].length,xe)))),ie=="rtl"?Xt.reverse():Xt}}();function Be(e,t){var n=e.order;return n==null&&(n=e.order=Xe(e.text,t)),n}var He=[],Ae=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]||He).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||He}function $e(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 x=Z(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function Oe(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function ae(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)Z(n,t[r])==-1&&n.push(t[r])}function le(e,t){return Ze(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ee(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function re(e){$(e),Q(e)}function be(e){return e.target||e.srcElement}function Ce(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(B&&F<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function dt(e){if(tt==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&F<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var it;function Dt(e){if(it!=null)return it;var t=l(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:it=r.right-n.right<3}var mt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var x=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=x.indexOf("\r");N!=-1?(n.push(x.slice(0,N)),t+=N+1):(n.push(x),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},It=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),yt=null;function Yt(e){if(yt!=null)return yt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return yt=Math.abs(n.left-r.left)>1}var Wt={},pt={};function Tr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function zr(e,t){pt[e]=t}function lr(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=Se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Sr(e,t){t=lr(t);var n=Wt[t.name];if(!n)return Sr(e,"text/plain");var r=n(e,t);if(hr.hasOwnProperty(t.name)){var i=hr[t.name];for(var x in i){if(!i.hasOwnProperty(x))continue;r.hasOwnProperty(x)&&(r["_"+x]=r[x]),r[x]=i[x]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var hr={};function yi(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};k(t,n)}function ur(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Vr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function cn(e,t,n){return e.startState?e.startState(t,n):!0}var Ct=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ct.prototype.eol=function(){return this.pos>=this.string.length},Ct.prototype.sol=function(){return this.pos==this.lineStart},Ct.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ct.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ct.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Ct.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ct.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ct.prototype.skipToEnd=function(){this.pos=this.string.length},Ct.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ct.prototype.backUp=function(e){this.pos-=e},Ct.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},Ct.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ct.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ct.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ct.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function et(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function wr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(x){var N=x.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function fn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function dr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function gt(e){if(e.parent==null)return null;for(var t=e.parent,n=Z(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Cr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],x=i.height;if(t<x){e=i;continue e}t-=x,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],z=K.height;if(t<z)break;t-=z}return n+N}function Rr(e,t){return t>=e.first&&t<e.first+e.size}function Xr(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 ut(e,t){return e.line-t.line||e.ch-t.ch}function We(e,t){return e.sticky==t.sticky&&ut(e,t)==0}function Un(e){return Ue(e.line,e.ch)}function hn(e,t){return ut(e,t)<0?t:e}function Yr(e,t){return ut(e,t)<0?e:t}function $r(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function st(e,t){if(t.line<e.first)return Ue(e.first,0);var n=e.first+e.size-1;return t.line>n?Ue(n,et(e,n).text.length):Qi(t,et(e,t.line).text.length)}function Qi(e,t){var n=e.ch;return n==null||n>t?Ue(e.line,t):n<0?Ue(e.line,0):e}function Nn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=st(e,t[r]);return n}var cr=function(e,t){this.state=e,this.lookAhead=t},ar=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ar.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ar.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ar.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ar.fromSaved=function(e,t,n){return t instanceof cr?new ar(e,ur(e.mode,t.state),n,t.lookAhead):new ar(e,ur(e.mode,t),n)},ar.prototype.save=function(e){var t=e!==!1?ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new cr(t,this.maxLookAhead):t};function bi(e,t,n,r){var i=[e.state.modeGen],x={};jn(e,t.text,e.doc.mode,n,function(Y,ie){return i.push(Y,ie)},x,r);for(var N=n.state,K=function(Y){n.baseTokens=i;var ie=e.state.overlays[Y],de=1,xe=0;n.state=!0,jn(e,t.text,ie.mode,n,function(ve,Re){for(var Pe=de;xe<ve;){var Ne=i[de];Ne>ve&&i.splice(de,1,ve,i[de+1],Ne),de+=2,xe=Math.min(ve,Ne)}if(!Re)return;if(ie.opaque)i.splice(Pe,de-Pe,ve,"overlay "+Re),de=Pe+2;else for(;Pe<de;Pe+=2){var Ke=i[Pe+1];i[Pe+1]=(Ke?Ke+" ":"")+"overlay "+Re}},x),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)K(z);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function Bn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=rr(e,gt(t)),i=t.text.length>e.options.maxHighlightLength&&ur(e.doc.mode,r.state),x=bi(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=x.styles,x.classes?t.styleClasses=x.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function rr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ar(r,!0,t);var x=Jr(e,t,n),N=x>r.first&&et(r,x-1).stateAfter,K=N?ar.fromSaved(r,N,x):new ar(r,cn(r.mode),x);return r.iter(x,t,function(z){mn(e,z.text,K);var Y=K.line;z.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function mn(e,t,n,r){var i=e.doc.mode,x=new Ct(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&Ei(i,n.state);!x.eol();)pn(i,x,n.state),x.start=x.pos}function Ei(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Vr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Vr(e,n).mode);var x=e.token(t,n);if(t.pos>t.start)return x}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ar=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Lr(e,t,n,r){var i=e.doc,x=i.mode,N;t=st(i,t);var K=et(i,t.line),z=rr(e,t.line,n),Y=new Ct(K.text,e.options.tabSize,z),ie;for(r&&(ie=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,N=pn(x,Y,z.state),r&&ie.push(new Ar(Y,N,ur(i.mode,z.state)));return r?ie:new Ar(Y,N,z.state)}function xi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function jn(e,t,n,r,i,x,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var z=0,Y=null,ie=new Ct(t,e.options.tabSize,r),de,xe=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),x);!ie.eol();){if(ie.pos>e.options.maxHighlightLength?(K=!1,N&&mn(e,t,r,ie.pos),ie.pos=t.length,de=null):de=xi(pn(n,ie,r.state,xe),x),xe){var ve=xe[0].name;ve&&(de="m-"+(de?ve+" "+de:ve))}if(!K||Y!=de){for(;z<ie.start;)z=Math.min(ie.start,z+5e3),i(z,Y);Y=de}ie.start=ie.pos}for(;z<ie.pos;){var Re=Math.min(ie.pos,z+5e3);i(Re,Y),z=Re}}function Jr(e,t,n){for(var r,i,x=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=x.first)return x.first;var z=et(x,K-1),Y=z.stateAfter;if(Y&&(!n||K+(Y instanceof cr?Y.lookAhead:0)<=x.modeFrontier))return K;var ie=H(z.text,null,e.options.tabSize);(i==null||r>ie)&&(i=K-1,r=ie)}return i}function Wn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=et(e,r).stateAfter;if(i&&(!(i instanceof cr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ti=!1,fr=!1;function Si(){Ti=!0}function wi(){fr=!0}function gn(e,t,n){this.marker=e,this.from=t,this.to=n}function kr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ua(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Hn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Qr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,K=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);if(K||x.from==t&&N.type=="bookmark"&&(!n||!x.marker.insertLeft)){var z=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);(r||(r=[])).push(new gn(N,x.from,z?null:x.to))}}return r}function Kn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,K=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);if(K||x.from==t&&N.type=="bookmark"&&(!n||x.marker.insertLeft)){var z=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);(r||(r=[])).push(new gn(N,z?null:x.from-t,x.to==null?null:x.to-t))}}return r}function Pr(e,t){if(t.full)return null;var n=Rr(e,t.from.line)&&et(e,t.from.line).markedSpans,r=Rr(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,N=ut(t.from,t.to)==0,K=Qr(n,i,N),z=Kn(r,x,N),Y=t.text.length==1,ie=J(t.text).length+(Y?i:0);if(K)for(var de=0;de<K.length;++de){var xe=K[de];if(xe.to==null){var ve=kr(z,xe.marker);ve?Y&&(xe.to=ve.to==null?null:ve.to+ie):xe.to=i}}if(z)for(var Re=0;Re<z.length;++Re){var Pe=z[Re];if(Pe.to!=null&&(Pe.to+=ie),Pe.from==null){var Ne=kr(K,Pe.marker);Ne||(Pe.from=ie,Y&&(K||(K=[])).push(Pe))}else Pe.from+=ie,Y&&(K||(K=[])).push(Pe)}K&&(K=Zr(K)),z&&z!=K&&(z=Zr(z));var Ke=[K];if(!Y){var Je=t.text.length-2,Ge;if(Je>0&&K)for(var qe=0;qe<K.length;++qe)K[qe].to==null&&(Ge||(Ge=[])).push(new gn(K[qe].marker,null,null));for(var at=0;at<Je;++at)Ke.push(Ge);Ke.push(z)}return Ke}function Zr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ve){if(ve.markedSpans)for(var Re=0;Re<ve.markedSpans.length;++Re){var Pe=ve.markedSpans[Re].marker;Pe.readOnly&&(!r||Z(r,Pe)==-1)&&(r||(r=[])).push(Pe)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var N=r[x],K=N.find(0),z=0;z<i.length;++z){var Y=i[z];if(ut(Y.to,K.from)<0||ut(Y.from,K.to)>0)continue;var ie=[z,1],de=ut(Y.from,K.from),xe=ut(Y.to,K.to);(de<0||!N.inclusiveLeft&&!de)&&ie.push({from:Y.from,to:K.from}),(xe>0||!N.inclusiveRight&&!xe)&&ie.push({from:K.to,to:Y.to}),i.splice.apply(i,ie),z+=ie.length-3}return i}function Gn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function qr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function vn(e){return e.inclusiveLeft?-1:0}function yr(e){return e.inclusiveRight?1:0}function zn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=ut(r.from,i.from)||vn(e)-vn(t);if(x)return-x;var N=ut(r.to,i.to)||yr(e)-yr(t);return N||t.id-e.id}function Ai(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=void 0,x=0;x<n.length;++x)i=n[x],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||zn(r,i.marker)<0)&&(r=i.marker);return r}function Li(e){return Ai(e,!0)}function Vn(e){return Ai(e,!1)}function Na(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var x=n[i];x.marker.collapsed&&(x.from==null||x.from<t)&&(x.to==null||x.to>t)&&(!r||zn(r,x.marker)<0)&&(r=x.marker)}return r}function Zi(e,t,n,r,i){var x=et(e,t),N=fr&&x.markedSpans;if(N)for(var K=0;K<N.length;++K){var z=N[K];if(!z.marker.collapsed)continue;var Y=z.marker.find(0),ie=ut(Y.from,n)||vn(z.marker)-vn(i),de=ut(Y.to,r)||yr(z.marker)-yr(i);if(ie>=0&&de<=0||ie<=0&&de>=0)continue;if(ie<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.to,n)>=0:ut(Y.to,n)>0)||ie>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.from,r)<=0:ut(Y.from,r)<0))return!0}}function rt(e){for(var t;t=Li(e);)e=t.find(-1,!0).line;return e}function ct(e){for(var t;t=Vn(e);)e=t.find(1,!0).line;return e}function ft(e){for(var t,n;t=Vn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Et(e,t){var n=et(e,t),r=rt(n);return n==r?t:gt(r)}function xt(e,t){if(t>e.lastLine())return t;var n=et(e,t),r;if(!St(e,n))return t;for(;r=Vn(n);)n=r.find(1,!0).line;return gt(n)+1}function St(e,t){var n=fr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Rt(e,t,r))return!0}}function Rt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Rt(e,r.line,kr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,x=0;x<t.markedSpans.length;++x)if(i=t.markedSpans[x],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Rt(e,t,i))return!0}function At(e){e=rt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var x=n.parent;x;n=x,x=n.parent)for(var N=0;N<x.children.length;++N){var K=x.children[N];if(K==n)break;t+=K.height}return t}function Gt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Li(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Vn(r);){var x=n.find(0,!0);t-=r.text.length-x.from.ch,r=x.to.line,t+=r.text.length-x.to.ch}return t}function mr(e){var t=e.display,n=e.doc;t.maxLine=et(n,n.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Gt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var wt=function(e,t,n){this.text=e,qr(this,t),this.height=n?n(this):1};wt.prototype.lineNo=function(){return gt(this)},ue(wt);function Mr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Gn(e),qr(e,n);var i=r?r(e):1;i!=e.height&&dr(e,i)}function zt(e){e.parent=null,Gn(e)}var Ir={},Fr={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Fr:Ir;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(e,t){var n=g("span",null,null,_?"padding-right: .1px":null),r={pre:g("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 x=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=Cs,Dt(e.display.measure)&&(N=Be(x,e.doc.direction))&&(r.addToken=Ls(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&>(x);Ds(x,r,Bn(e,x,K)),x.styleClasses&&(x.styleClasses.bgClass&&(r.bgClass=j(x.styleClasses.bgClass,r.bgClass||"")),x.styleClasses.textClass&&(r.textClass=j(x.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(dt(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(_){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function ws(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,x,N){if(!t)return;var K=e.splitSpaces?As(t,e.trailingSpace):t,z=e.cm.state.specialChars,Y=!1,ie;if(!z.test(t))e.col+=t.length,ie=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ie),B&&F<9&&(Y=!0),e.pos+=t.length;else{ie=document.createDocumentFragment();for(var de=0;;){z.lastIndex=de;var xe=z.exec(t),ve=xe?xe.index-de:t.length-de;if(ve){var Re=document.createTextNode(K.slice(de,de+ve));B&&F<9?ie.appendChild(a("span",[Re])):ie.appendChild(Re),e.map.push(e.pos,e.pos+ve,Re),e.col+=ve,e.pos+=ve}if(!xe)break;de+=ve+1;var Pe=void 0;if(xe[0]==" "){var Ne=e.cm.options.tabSize,Ke=Ne-e.col%Ne;Pe=ie.appendChild(a("span",he(Ke),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=Ke}else xe[0]=="\r"||xe[0]==`
|
|
`?(Pe=ie.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",xe[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(xe[0]),Pe.setAttribute("cm-text",xe[0]),B&&F<9?ie.appendChild(a("span",[Pe])):ie.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||Y||x||N){var Je=n||"";r&&(Je+=r),i&&(Je+=i);var Ge=a("span",[ie],Je,x);if(N)for(var qe in N)N.hasOwnProperty(qe)&&qe!="style"&&qe!="class"&&Ge.setAttribute(qe,N[qe]);return e.content.appendChild(Ge)}e.content.appendChild(ie)}function As(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var x=e.charAt(i);x==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(x="\xA0"),r+=x,n=x==" "}return r}function Ls(e,t){return function(n,r,i,x,N,K,z){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,ie=Y+r.length;;){for(var de=void 0,xe=0;xe<t.length&&!(de=t[xe],de.to>Y&&de.from<=Y);xe++);if(de.to>=ie)return e(n,r,i,x,N,K,z);e(n,r.slice(0,de.to-Y),i,x,null,K,z),x=null,r=r.slice(de.to-Y),Y=de.to}}}function ja(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ds(e,t,n){var r=e.markedSpans,i=e.text,x=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(x,x=n[N]),yn(n[N+1],t.cm.options));return}for(var K=i.length,z=0,Y=1,ie="",de,xe,ve=0,Re,Pe,Ne,Ke,Je;;){if(ve==z){Re=Pe=Ne=xe="",Je=null,Ke=null,ve=Infinity;for(var Ge=[],qe=void 0,at=0;at<r.length;++at){var nt=r[at],ht=nt.marker;if(ht.type=="bookmark"&&nt.from==z&&ht.widgetNode)Ge.push(ht);else if(nt.from<=z&&(nt.to==null||nt.to>z||ht.collapsed&&nt.to==z&&nt.from==z)){if(nt.to!=null&&nt.to!=z&&ve>nt.to&&(ve=nt.to,Pe=""),ht.className&&(Re+=" "+ht.className),ht.css&&(xe=(xe?xe+";":"")+ht.css),ht.startStyle&&nt.from==z&&(Ne+=" "+ht.startStyle),ht.endStyle&&nt.to==ve&&(qe||(qe=[])).push(ht.endStyle,nt.to),ht.title&&((Je||(Je={})).title=ht.title),ht.attributes)for(var Tt in ht.attributes)(Je||(Je={}))[Tt]=ht.attributes[Tt];ht.collapsed&&(!Ke||zn(Ke.marker,ht)<0)&&(Ke=nt)}else nt.from>z&&ve>nt.from&&(ve=nt.from)}if(qe)for(var Bt=0;Bt<qe.length;Bt+=2)qe[Bt+1]==ve&&(Pe+=" "+qe[Bt]);if(!Ke||Ke.from==z)for(var _t=0;_t<Ge.length;++_t)ja(t,0,Ge[_t]);if(Ke&&(Ke.from||0)==z){if(ja(t,(Ke.to==null?K+1:Ke.to)-z,Ke.marker,Ke.from==null),Ke.to==null)return;Ke.to==z&&(Ke=!1)}}if(z>=K)break;for(var ir=Math.min(K,ve);;){if(ie){var qt=z+ie.length;if(!Ke){var Pt=qt>ir?ie.slice(0,ir-z):ie;t.addToken(t,Pt,de?de+Re:Re,Ne,z+Pt.length==ve?Pe:"",xe,Je)}if(qt>=ir){ie=ie.slice(ir-z),z=ir;break}z=qt,Ne=""}ie=i.slice(x,x=n[Y++]),de=yn(n[Y++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=ft(t),this.size=this.rest?gt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=St(e,t)}function Di(e,t,n){for(var r=[],i,x=t;x<n;x=i){var N=new Wa(e.doc,et(e.doc,x),x);i=x+N.size,r.push(N)}return r}var bn=null;function _s(e){bn?bn.ops.push(e):e.ownsGroup=bn={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{bn=null,t(n)}}var Xn=null;function Ht(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;bn?i=bn.delayedCallbacks:Xn?i=Xn:(i=Xn=[],setTimeout(ks,0));for(var x=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)x(N)}function ks(){var e=Xn;Xn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?Ms(e,t):x=="gutter"?Ga(e,t,n,r):x=="class"?qi(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function Yn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&F<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=Yn(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ka(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function Ms(e,t){var n=t.text.className,r=Ka(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){Ps(e,t),t.line.wrapClass?Yn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ga(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=Yn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var N=Yn(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",Xr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),x)for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=e.display.gutterSpecs[z].className,ie=x.hasOwnProperty(Y)&&x[Y];ie&&K.appendChild(a("div",[ie],"CodeMirror-gutter-elt","left: "+r.gutterLeft[Y]+"px; width: "+r.gutterWidth[Y]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Fs(e,t,n,r){var i=Ka(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),Ga(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var x=Yn(n),N=0,K=t.widgets;N<K.length;++N){var z=K[N],Y=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Us(z,Y,n,r),e.display.input.setUneditable(Y),i&&z.above?x.insertBefore(Y,n.gutter||n.text):x.appendChild(Y),Ht(z,"redraw")}}function Us(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function $n(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Dr(e,t){for(var n=be(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function _i(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function br(e){return te-e.display.nativeBarWidth}function en(e){return e.display.scroller.clientWidth-br(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-br(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&en(e);if(!t.measure.heights||r&&t.measure.width!=i){var x=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var z=N[K],Y=N[K+1];Math.abs(z.bottom-Y.bottom)>2&&x.push((z.bottom+Y.top)/2-n.top)}}x.push(n.bottom-n.top)}}function Ya(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(gt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=rt(t);var n=gt(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function $a(e,t,n,r){return Er(e,En(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function En(e,t){var n=gt(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ha(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Er(e,t,n,r,i){t.before&&(n=-1);var x=n+(r||""),N;return t.cache.hasOwnProperty(x)?N=t.cache[x]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[x]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var Ja={left:0,right:0,top:0,bottom:0};function Qa(e,t,n){for(var r,i,x,N,K,z,Y=0;Y<e.length;Y+=3)if(K=e[Y],z=e[Y+1],t<K?(i=0,x=1,N="left"):t<z?(i=t-K,x=i+1):(Y==e.length-3||t==z&&e[Y+3]>t)&&(x=z-K,i=x-1,t>=z&&(N="right")),i!=null){if(r=e[Y+2],K==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],N="left";if(n=="right"&&i==z-K)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],N="right";break}return{node:r,start:i,end:x,collapse:N,coverStart:K,coverEnd:z}}function js(e,t){var n=Ja;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=Qa(t.map,n,r),x=i.node,N=i.start,K=i.end,z=i.collapse,Y;if(x.nodeType==3){for(var ie=0;ie<4;ie++){for(;N&&De(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&De(t.line.text.charAt(i.coverStart+K));)++K;if(B&&F<9&&N==0&&K==i.coverEnd-i.coverStart?Y=x.parentNode.getBoundingClientRect():Y=js(p(x,N,K).getClientRects(),r),Y.left||Y.right||N==0)break;K=N,N=N-1,z="right"}B&&F<11&&(Y=Hs(e.display.measure,Y))}else{N>0&&(z=r="right");var de;e.options.lineWrapping&&(de=x.getClientRects()).length>1?Y=de[r=="right"?de.length-1:0]:Y=x.getBoundingClientRect()}if(B&&F<9&&!N&&(!Y||!Y.left&&!Y.right)){var xe=x.parentNode.getClientRects()[0];xe?Y={left:xe.left,right:xe.left+Tn(e.display),top:xe.top,bottom:xe.bottom}:Y=Ja}for(var ve=Y.top-t.rect.top,Re=Y.bottom-t.rect.top,Pe=(ve+Re)/2,Ne=t.view.measure.heights,Ke=0;Ke<Ne.length-1&&!(Pe<Ne[Ke]);Ke++);var Je=Ke?Ne[Ke-1]:0,Ge=Ne[Ke],qe={left:(z=="right"?Y.right:Y.left)-t.rect.left,right:(z=="left"?Y.left:Y.right)-t.rect.left,top:Je,bottom:Ge};return!Y.left&&!Y.right&&(qe.bogus=!0),e.options.singleCursorHeightPerLine||(qe.rtop=ve,qe.rbottom=Re),qe}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Za(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function qa(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Za(e.display.view[t])}function Jn(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return T&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return T&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=$n(e.widgets[n]));return t}function Oi(e,t,n,r,i){if(!i){var x=na(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var N=At(t);if(r=="local"?N+=_i(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:to());var z=K.left+(r=="window"?0:eo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();else if(n=="local"||!n){var x=e.display.sizer.getBoundingClientRect();r+=x.left,i+=x.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ia(e,t,n,r,i){return r||(r=et(e.doc,t.line)),Oi(e,r,$a(e,r,t.ch,i),n)}function pr(e,t,n,r,i,x){r=r||et(e.doc,t.line),i||(i=En(e,r));function N(Re,Pe){var Ne=Er(e,i,Re,Pe?"right":"left",x);return Pe?Ne.left=Ne.right:Ne.right=Ne.left,Oi(e,r,Ne,n)}var K=Be(r,e.doc.direction),z=t.ch,Y=t.sticky;if(z>=r.text.length?(z=r.text.length,Y="before"):z<=0&&(z=0,Y="after"),!K)return N(Y=="before"?z-1:z,Y=="before");function ie(Re,Pe,Ne){var Ke=K[Pe],Je=Ke.level==1;return N(Ne?Re-1:Re,Je!=Ne)}var de=je(K,z,Y),xe=Ve,ve=ie(z,de,Y=="before");return xe!=null&&(ve.other=ie(z,xe,Y!="before")),ve}function no(e,t){var n=0;t=st(e.doc,t),e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=et(e.doc,t.line),i=At(r)+_i(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var x=Ue(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=Cr(r,n),x=r.first+r.size-1;if(i>x)return aa(r.first+r.size-1,et(r,x).text.length,null,1,1);t<0&&(t=0);for(var N=et(r,i);;){var K=Ks(e,N,i,t,n),z=Na(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var Y=z.find(1);if(Y.line==i)return Y;N=et(r,i=Y.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,x=ze(function(N){return Er(e,n,N-1).bottom<=r},i,0);return i=ze(function(N){return Er(e,n,N).top>r},x,i),{begin:x,end:i}}function ao(e,t,n,r){n||(n=En(e,t));var i=Oi(e,t,Er(e,n,r),"line").top;return io(e,t,n,i)}function sa(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=At(t);var x=En(e,t),N=na(t),K=0,z=t.text.length,Y=!0,ie=Be(t,e.doc.direction);if(ie){var de=(e.options.lineWrapping?zs:Gs)(e,t,n,x,ie,r,i);Y=de.level!=1,K=Y?de.from:de.to-1,z=Y?de.to:de.from-1}var xe=null,ve=null,Re=ze(function(at){var nt=Er(e,x,at);return nt.top+=N,nt.bottom+=N,sa(nt,r,i,!1)?(nt.top<=i&&nt.left<=r&&(xe=at,ve=nt),!0):!1},K,z),Pe,Ne,Ke=!1;if(ve){var Je=r-ve.left<ve.right-r,Ge=Je==Y;Re=xe+(Ge?0:1),Ne=Ge?"after":"before",Pe=Je?ve.left:ve.right}else{!Y&&(Re==z||Re==K)&&Re++,Ne=Re==0?"after":Re==t.text.length?"before":Er(e,x,Re-(Y?1:0)).bottom+N<=i==Y?"after":"before";var qe=pr(e,Ue(n,Re,Ne),"line",t,x);Pe=qe.left,Ke=i<qe.top?-1:i>=qe.bottom?1:0}return Re=Le(t.text,Re,1),aa(n,Re,Ne,Ke,r-Pe)}function Gs(e,t,n,r,i,x,N){var K=ze(function(de){var xe=i[de],ve=xe.level!=1;return sa(pr(e,Ue(n,ve?xe.to:xe.from,ve?"before":"after"),"line",t,r),x,N,!0)},0,i.length-1),z=i[K];if(K>0){var Y=z.level!=1,ie=pr(e,Ue(n,Y?z.from:z.to,Y?"after":"before"),"line",t,r);sa(ie,x,N,!0)&&ie.top>N&&(z=i[K-1])}return z}function zs(e,t,n,r,i,x,N){var K=io(e,t,r,N),z=K.begin,Y=K.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var ie=null,de=null,xe=0;xe<i.length;xe++){var ve=i[xe];if(ve.from>=Y||ve.to<=z)continue;var Re=ve.level!=1,Pe=Er(e,r,Re?Math.min(Y,ve.to)-1:Math.max(z,ve.from)).right,Ne=Pe<x?x-Pe+1e9:Pe-x;(!ie||de>Ne)&&(ie=ve,de=Ne)}return ie||(ie=i[i.length-1]),ie.from<z&&(ie={from:z,to:ie.to,level:ie.level}),ie.to>Y&&(ie={from:ie.from,to:Y,level:ie.level}),ie}var tn;function xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(tn==null){tn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)tn.appendChild(document.createTextNode("x")),tn.appendChild(a("br"));tn.appendChild(document.createTextNode("x"))}l(e.measure,tn);var n=tn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function la(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,N=0;x;x=x.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=x.offsetLeft+x.clientLeft+i,r[K]=x.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Tn(e.display)-3);return function(i){if(St(e.doc,i))return 0;var x=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(x+=i.widgets[N].height);return n?x+(Math.ceil(i.text.length/r)||1)*t:x+t}}function da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&dr(r,i)})}function rn(e,t,n,r){var i=e.display;if(!n&&be(t).getAttribute("cm-not-content")=="true")return null;var x,N,K=i.lineSpace.getBoundingClientRect();try{x=t.clientX-K.left,N=t.clientY-K.top}catch(de){return null}var z=oa(e,x,N),Y;if(r&&z.xRel>0&&(Y=et(e.doc,z.line).text).length==z.ch){var ie=H(Y,Y.length,e.options.tabSize)-Y.length;z=Ue(z.line,Math.max(0,Math.round((x-Xa(e.display).left)/Tn(e.display))-ie))}return z}function nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Qt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)fr&&Et(e.doc,t)<i.viewTo&&Nr(e);else if(n<=i.viewFrom)fr&&xt(e.doc,n+r)>i.viewFrom?Nr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Nr(e);else if(t<=i.viewFrom){var x=Ri(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):Nr(e)}else if(n>=i.viewTo){var N=Ri(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Nr(e)}else{var K=Ri(e,t,t,-1),z=Ri(e,n,n+r,1);K&&z?(i.view=i.view.slice(0,K.index).concat(Di(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Nr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Ur(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 x=r.view[nn(e,t)];if(x.node==null)return;var N=x.changes||(x.changes=[]);Z(N,n)==-1&&N.push(n)}function Nr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ri(e,t,n,r){var i=nn(e,t),x,N=e.display.view;if(!fr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,z=0;z<i;z++)K+=N[z].size;if(K!=t){if(r>0){if(i==N.length-1)return null;x=K+N[i].size-t,i++}else x=K-t;t+=x,n+=x}for(;Et(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Di(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Di(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Di(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,nn(e,n)))),r.viewTo=n}function so(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Qn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),x=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var z=K.empty();(z||e.options.showCursorWhenSelecting)&&uo(e,K.head,i),z||Xs(e,K,x)}return r}function uo(e,t,n){var r=pr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var x=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));x.style.display="",x.style.left=r.other.left+"px",x.style.top=r.other.top+"px",x.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,x=document.createDocumentFragment(),N=Xa(e.display),K=N.left,z=Math.max(r.sizerWidth,en(e)-r.sizer.offsetLeft)-N.right,Y=i.direction=="ltr";function ie(Ge,qe,at,nt){qe<0&&(qe=0),qe=Math.round(qe),nt=Math.round(nt),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ge+`px;
|
|
top: `+qe+"px; width: "+(at==null?z-Ge:at)+`px;
|
|
height: `+(nt-qe)+"px"))}function de(Ge,qe,at){var nt=et(i,Ge),ht=nt.text.length,Tt,Bt;function _t(Pt,er){return ia(e,Ue(Ge,Pt),"div",nt,er)}function ir(Pt,er,Kt){var Ft=ao(e,nt,null,Pt),Mt=er=="ltr"==(Kt=="after")?"left":"right",Ot=Kt=="after"?Ft.begin:Ft.end-(/\s/.test(nt.text.charAt(Ft.end-1))?2:1);return _t(Ot,Mt)[Mt]}var qt=Be(nt,i.direction);return Ye(qt,qe||0,at==null?ht:at,function(Pt,er,Kt,Ft){var Mt=Kt=="ltr",Ot=_t(Pt,Mt?"left":"right"),tr=_t(er-1,Mt?"right":"left"),In=qe==null&&Pt==0,Gr=at==null&&er==ht,Xt=Ft==0,xr=!qt||Ft==qt.length-1;if(tr.top-Ot.top<=3){var jt=(Y?In:Gr)&&Xt,Ia=(Y?Gr:In)&&xr,Or=jt?K:(Mt?Ot:tr).left,un=Ia?z:(Mt?tr:Ot).right;ie(Or,Ot.top,un-Or,Ot.bottom)}else{var dn,Jt,Fn,Fa;Mt?(dn=Y&&In&&Xt?K:Ot.left,Jt=Y?z:ir(Pt,Kt,"before"),Fn=Y?K:ir(er,Kt,"after"),Fa=Y&&Gr&&xr?z:tr.right):(dn=Y?ir(Pt,Kt,"before"):K,Jt=!Y&&In&&Xt?z:Ot.right,Fn=!Y&&Gr&&xr?K:tr.left,Fa=Y?ir(er,Kt,"after"):z),ie(dn,Ot.top,Jt-dn,Ot.bottom),Ot.bottom<tr.top&&ie(K,Ot.bottom,null,tr.top),ie(Fn,tr.top,Fa-Fn,tr.bottom)}(!Tt||ki(Ot,Tt)<0)&&(Tt=Ot),ki(tr,Tt)<0&&(Tt=tr),(!Bt||ki(Ot,Bt)<0)&&(Bt=Ot),ki(tr,Bt)<0&&(Bt=tr)}),{start:Tt,end:Bt}}var xe=t.from(),ve=t.to();if(xe.line==ve.line)de(xe.line,xe.ch,ve.ch);else{var Re=et(i,xe.line),Pe=et(i,ve.line),Ne=rt(Re)==rt(Pe),Ke=de(xe.line,xe.ch,Ne?Re.text.length+1:null).end,Je=de(ve.line,Ne?0:null,ve.ch).start;Ne&&(Ke.top<Je.top-2?(ie(Ke.right,Ke.top,null,Ke.bottom),ie(K,Je.top,Je.left,Je.bottom)):ie(Ke.right,Ke.top,Je.left-Ke.right,Ke.bottom)),Ke.bottom<Je.top&&ie(K,Ke.bottom,null,Je.top)}n.appendChild(x)}function ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Sn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Sn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),_&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ca(e)}function Sn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(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 Pi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],x=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&F<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var Y=i.node.getBoundingClientRect();N=Y.bottom-Y.top,!x&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var ie=i.line.height-N;if((ie>.005||ie<-.005)&&(dr(i.line,N),ho(i.line),i.rest))for(var de=0;de<i.rest.length;de++)ho(i.rest[de]);if(K>e.display.sizerWidth){var xe=Math.ceil(K/Tn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Mi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-_i(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=Cr(t,r),N=Cr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,z=n.ensure.to.line;K<x?(x=K,N=Cr(t,At(et(t,K))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(x=Cr(t,At(et(t,z))-e.wrapper.clientHeight),N=z)}return{from:x,to:Math.max(N,x+1)}}function Ys(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!S){var x=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-_i(e.display))+`px;
|
|
height: `+(t.bottom-t.top+br(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(x),x.scrollIntoView(i),e.display.lineSpace.removeChild(x)}}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 x=0;x<5;x++){var N=!1,K=pr(e,t),z=!n||n==t?K:pr(e,n);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-r,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+r};var Y=ha(e,i),ie=e.doc.scrollTop,de=e.doc.scrollLeft;if(Y.scrollTop!=null&&(qn(e,Y.scrollTop),Math.abs(e.doc.scrollTop-ie)>1&&(N=!0)),Y.scrollLeft!=null&&(an(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=ha(e,t);n.scrollTop!=null&&qn(e,n.scrollTop),n.scrollLeft!=null&&an(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=ta(e),N={};t.bottom-t.top>x&&(t.bottom=t.top+x);var K=e.doc.height+ea(n),z=t.top<r,Y=t.bottom>K-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+x){var ie=Math.min(t.top,(Y?K:t.bottom)-x);ie!=i&&(N.scrollTop=ie)}var de=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-de,ve=en(e)-n.gutters.offsetWidth,Re=t.right-t.left>ve;return Re&&(t.right=t.left+ve),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+de-(Re?0:10)):t.right>ve+xe-3&&(N.scrollLeft=t.right+(Re?0:10)-ve),N}function ma(e,t){if(t==null)return;Ii(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function wn(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Zn(e,t,n){(t!=null||n!=null)&&Ii(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ii(e),e.curOp.scrollToPos=t}function Ii(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Zn(e,i.scrollLeft,i.scrollTop)}function qn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||ga(e,{top:t}),po(e,t,!0),L&&ga(e),ri(e,100)}function po(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function an(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+br(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var on=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};on.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var x=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+x)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},on.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},on.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},on.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},on.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),x=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);x!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},on.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ti=function(){};ti.prototype.update=function(){return{bottom:0,right:0}},ti.prototype.setScrollLeft=function(){},ti.prototype.setScrollTop=function(){},ti.prototype.clear=function(){};function Cn(e,t){t||(t=ei(e));var n=e.display.barWidth,r=e.display.barHeight;go(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Pi(e),go(e,ei(e)),n=e.display.barWidth,r=e.display.barHeight}function go(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var vo={native:on,null:ti};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?an(e,t):qn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function sn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},_s(e.curOp)}function ln(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var x=0;x<t.length;x++)nl(t[x]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&mr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Fi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Pi(t),e.barMeasure=ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$a(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+br(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-en(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&an(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Cn(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&an(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,st(r,e.scrollToPos.from),st(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var x=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(x)for(var K=0;K<x.length;++K)x[K].lines.length||Oe(x[K],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Oe(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function nr(e,t){if(e.curOp)return t();sn(e);try{return t()}finally{ln(e)}}function Ut(e,t){return function(){if(e.curOp)return t.apply(e,arguments);sn(e);try{return t.apply(e,arguments)}finally{ln(e)}}}function $t(e){return function(){if(this.curOp)return e.apply(this,arguments);sn(this);try{return e.apply(this,arguments)}finally{ln(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);sn(t);try{return e.apply(this,arguments)}finally{ln(t)}}}function ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=rr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(x){if(r.line>=e.display.viewFrom){var N=x.styles,K=x.text.length>e.options.maxHighlightLength?ur(t.mode,r.state):null,z=bi(e,x,r,!0);K&&(r.state=K),x.styles=z.styles;var Y=x.styleClasses,ie=z.classes;ie?x.styleClasses=ie:Y&&(x.styleClasses=null);for(var de=!N||N.length!=x.styles.length||Y!=ie&&(!Y||!ie||Y.bgClass!=ie.bgClass||Y.textClass!=ie.textClass),xe=0;!de&&xe<N.length;++xe)de=N[xe]!=x.styles[xe];de&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&mn(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ri(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&nr(e,function(){for(var x=0;x<i.length;x++)Ur(e,i[x],"text")})}var Fi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Mi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=en(e),this.force=n,this.dims=la(e),this.events=[]};Fi.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Fi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=br(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=br(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!v(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Nr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&so(e)==0)return!1;xo(e)&&(Nr(e),t.dims=la(e));var i=r.first+r.size,x=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<x&&x-n.viewFrom<20&&(x=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),fr&&(x=Et(e.doc,x),N=xt(e.doc,N));var K=x!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,x,N),n.viewOffset=At(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=so(e);if(!K&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(Y),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==en(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(e),n.top)}),t.visible=Mi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Mi(e.display,e.doc,n));if(!pa(e,t))break;Pi(e);var i=ei(e);Qn(e),Cn(e,i),ya(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ga(e,t){var n=new Fi(e,t);if(pa(e,n)){Pi(e),bo(e,n);var r=ei(e);Qn(e),Cn(e,r),ya(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,N=x.firstChild;function K(Re){var Pe=Re.nextSibling;return _&&s&&e.display.currentWheelTarget==Re?Re.style.display="none":Re.parentNode.removeChild(Re),Pe}for(var z=r.view,Y=r.viewFrom,ie=0;ie<z.length;ie++){var de=z[ie];if(!de.hidden)if(!de.node||de.node.parentNode!=x){var xe=Fs(e,de,Y,n);x.insertBefore(xe,N)}else{for(;N!=de.node;)N=K(N);var ve=i&&t!=null&&t<=Y&&de.lineNumber;de.changes&&(Z(de.changes,"gutter")>-1&&(ve=!1),Ha(e,de,Y,n)),ve&&(c(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(Xr(e.options,Y)))),N=de.node.nextSibling}Y+=de.size}for(;N;)N=K(N)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+br(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,x=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=x),n[N].gutterBackground&&(n[N].gutterBackground.style.left=x));var K=n[N].alignable;if(K)for(var z=0;z<K.length;z++)K[z].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Xr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),x=i.firstChild.offsetWidth,N=i.offsetWidth-x;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(x,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",va(e.display),!0}return!1}function ba(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var x=e[i],N=null;if(typeof x!="string"&&(N=x.style,x=x.className),x=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:x,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function To(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],x=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+x));N&&(K.style.cssText=N),x=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",va(e)}function ni(e){To(e.display),Qt(e),Eo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=g("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=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=g("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[x],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+te+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&F<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!_&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Ui=0,or=null;B?or=-.53:L?or=15:T?or=-.7:P&&(or=-1/3);function So(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=So(e);return t.x*=or,t.y*=or,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,x=e.display,N=x.scroller,K=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&z))return;if(i&&s&&_){e:for(var Y=t.target,ie=x.view;Y!=N;Y=Y.parentNode)for(var de=0;de<ie.length;de++)if(ie[de].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!L&&!A&&or!=null){i&&z&&qn(e,Math.max(0,N.scrollTop+i*or)),an(e,Math.max(0,N.scrollLeft+r*or)),(!i||i&&z)&&$(t),x.wheelStartX=null;return}if(i&&or!=null){var xe=i*or,ve=e.doc.scrollTop,Re=ve+x.wrapper.clientHeight;xe<0?ve=Math.max(0,ve+xe-50):Re=Math.min(e.doc.height,Re+xe+50),ga(e,{top:ve,bottom:Re})}Ui<20&&(x.wheelStartX==null?(x.wheelStartX=N.scrollLeft,x.wheelStartY=N.scrollTop,x.wheelDX=r,x.wheelDY=i,setTimeout(function(){if(x.wheelStartX==null)return;var Pe=N.scrollLeft-x.wheelStartX,Ne=N.scrollTop-x.wheelStartY,Ke=Ne&&x.wheelDY&&Ne/x.wheelDY||Pe&&x.wheelDX&&Pe/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!Ke)return;or=(or*Ui+Ke)/(Ui+1),++Ui},200)):(x.wheelDX+=r,x.wheelDY+=i))}var sr=function(e,t){this.ranges=e,this.primIndex=t};sr.prototype.primary=function(){return this.ranges[this.primIndex]},sr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!We(n.anchor,r.anchor)||!We(n.head,r.head))return!1}return!0},sr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vt(Un(this.ranges[t].anchor),Un(this.ranges[t].head));return new sr(e,this.primIndex)},sr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},sr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ut(t,r.from())>=0&&ut(e,r.to())<=0)return n}return-1};var vt=function(e,t){this.anchor=e,this.head=t};vt.prototype.from=function(){return Yr(this.anchor,this.head)},vt.prototype.to=function(){return hn(this.anchor,this.head)},vt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function gr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ve){return ut(xe.from(),ve.from())}),n=Z(t,i);for(var x=1;x<t.length;x++){var N=t[x],K=t[x-1],z=ut(K.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var Y=Yr(K.from(),N.from()),ie=hn(K.to(),N.to()),de=K.empty()?N.from()==N.head:K.from()==K.head;x<=n&&--n,t.splice(--x,2,new vt(de?ie:Y,de?Y:ie))}}return new sr(t,n)}function Br(e,t){return new sr([new vt(e,t||e)],0)}function jr(e){return e.text?Ue(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(ut(e,t.from)<0)return e;if(ut(e,t.to)<=0)return jr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=jr(t).ch-t.to.ch),Ue(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new vt(Co(i.anchor,t),Co(i.head,t)))}return gr(e.cm,n,e.sel.primIndex)}function 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),x=i,N=0;N<t.length;N++){var K=t[N],z=Ao(K.from,i,x),Y=Ao(jr(K),i,x);if(i=K.to,x=Y,n=="around"){var ie=e.sel.ranges[N],de=ut(ie.head,ie.anchor)<0;r[N]=new vt(de?Y:z,de?z:Y)}else r[N]=new vt(z,z)}return new sr(r,e.sel.primIndex)}function xa(e){e.doc.mode=Sr(e.options,e.doc.modeOption),ii(e)}function ii(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ri(e,100),e.state.modeGen++,e.curOp&&Qt(e)}function Lo(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i(Je){return n?n[Je]:null}function x(Je,Ge,qe){Mr(Je,Ge,qe,r),Ht(Je,"change",Je,t)}function N(Je,Ge){for(var qe=[],at=Je;at<Ge;++at)qe.push(new wt(Y[at],i(at),r));return qe}var K=t.from,z=t.to,Y=t.text,ie=et(e,K.line),de=et(e,z.line),xe=J(Y),ve=i(Y.length-1),Re=z.line-K.line;if(t.full)e.insert(0,N(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Lo(e,t)){var Pe=N(0,Y.length-1);x(de,de.text,ve),Re&&e.remove(K.line,Re),Pe.length&&e.insert(K.line,Pe)}else if(ie==de)if(Y.length==1)x(ie,ie.text.slice(0,K.ch)+xe+ie.text.slice(z.ch),ve);else{var Ne=N(1,Y.length-1);Ne.push(new wt(xe+ie.text.slice(z.ch),ve,r)),x(ie,ie.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,Ne)}else if(Y.length==1)x(ie,ie.text.slice(0,K.ch)+Y[0]+de.text.slice(z.ch),i(0)),e.remove(K.line+1,Re);else{x(ie,ie.text.slice(0,K.ch)+Y[0],i(0)),x(de,xe+de.text.slice(z.ch),ve);var Ke=N(1,Y.length-1);Re>1&&e.remove(K.line+1,Re-1),e.insert(K.line+1,Ke)}Ht(e,"change",e,t)}function Wr(e,t,n){function r(i,x,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var z=i.linked[K];if(z.doc==x)continue;var Y=N&&z.sharedHist;if(n&&!Y)continue;t(z.doc,Y),r(z.doc,i,Y)}}r(e,null,!0)}function Do(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),_o(e),e.options.lineWrapping||mr(e),e.options.mode=t.modeOption,Qt(e)}function _o(e){(e.doc.direction=="rtl"?U:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){nr(e,function(){_o(e),Qt(e)})}function Ni(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Sa(e,t){var n={from:Un(t.from),to:jr(t),text:wr(e,t.from,t.to)};return ko(e,n,t.from.line,t.to.line+1),Wr(e,function(r){return ko(r,n,t.from.line,t.to.line+1)},!0),n}function Oo(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Oo(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Ro(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>x-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=J(N.changes),ut(t.from,t.to)==0&&ut(t.from,K.to)==0?K.to=jr(t):N.changes.push(Sa(e,t));else{var z=J(i.done);for((!z||!z.ranges)&&Bi(e.sel,i.done),N={changes:[Sa(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=x,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Oe(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,x=r&&r.origin;n==i.lastSelOp||x&&i.lastSelOrigin==x&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==x||pl(e,x,J(i.done),t))?i.done[i.done.length-1]=t:Bi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&Oo(i.undone)}function Bi(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ko(e,t,n,r){var i=t["spans_"+e.id],x=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[x]=N.markedSpans),++x})}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 Po(e,t){var n=yl(e,t),r=Pr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var x=n[i],N=r[i];if(x&&N){e:for(var K=0;K<N.length;++K){for(var z=N[K],Y=0;Y<x.length;++Y)if(x[Y].marker==z.marker)continue e;x.push(z)}}else N&&(n[i]=N)}return n}function An(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?sr.prototype.deepCopy.call(x):x);continue}var N=x.changes,K=[];r.push({changes:K});for(var z=0;z<N.length;++z){var Y=N[z],ie=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var de in Y)(ie=de.match(/^spans_(\d+)$/))&&(Z(t,Number(ie[1]))>-1&&(J(K)[de]=Y[de],delete Y[de]))}}return r}function wa(e,t,n,r){if(r){var i=e.anchor;if(n){var x=ut(t,i)<0;x!=ut(n,i)<0?(i=t,t=n):x!=ut(t,n)<0&&(t=n)}return new vt(i,t)}else return new vt(n||t,t)}function ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vt(e,new sr([wa(e.sel.primary(),t,n,i)],0),r)}function Mo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=wa(e.sel.ranges[x],t[x],null,i);var N=gr(e.cm,r,e.sel.primIndex);Vt(e,N,n)}function Ca(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Vt(e,gr(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){Vt(e,Br(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new vt(st(e,i[x].anchor),st(e,i[x].head))},origin:n&&n.origin};return Oe(e,"beforeSelectionChange",e,r),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?gr(e.cm,r.ranges,r.ranges.length-1):t}function Fo(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,Wi(e,t,n)):Vt(e,t,n)}function Vt(e,t,n){Wi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Wi(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ut(t.primary().head,e.sel.primary().head)<0?-1:1);Uo(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&wn(e.cm)}function Uo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ae(e.cm)),Ht(e,"cursorActivity",e)}function No(e){Uo(e,Bo(e,e.sel,null,!1))}function Bo(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var N=t.ranges[x],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],z=Hi(e,N.anchor,K&&K.anchor,n,r),Y=Hi(e,N.head,K&&K.head,n,r);(i||z!=N.anchor||Y!=N.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new vt(z,Y))}return i?gr(e.cm,i,t.primIndex):t}function Ln(e,t,n,r,i){var x=et(e,t.line);if(x.markedSpans)for(var N=0;N<x.markedSpans.length;++N){var K=x.markedSpans[N],z=K.marker,Y="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,ie="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ie?K.to>=t.ch:K.to>t.ch))){if(i&&(Oe(z,"beforeCursorEnter"),z.explicitlyCleared))if(x.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var de=z.find(r<0?1:-1),xe=void 0;if((r<0?ie:Y)&&(de=jo(e,de,-r,de&&de.line==t.line?x:null)),de&&de.line==t.line&&(xe=ut(de,n))&&(r<0?xe<0:xe>0))return Ln(e,de,t,r,i)}var ve=z.find(r<0?-1:1);return(r<0?Y:ie)&&(ve=jo(e,ve,r,ve.line==t.line?x:null)),ve?Ln(e,ve,t,r,i):null}}return t}function Hi(e,t,n,r,i){var x=r||1,N=Ln(e,t,n,x,i)||!i&&Ln(e,t,n,x,!0)||Ln(e,t,n,-x,i)||!i&&Ln(e,t,n,-x,!0);return N||(e.cantEdit=!0,Ue(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?st(e,Ue(t.line-1)):null:n>0&&t.ch==(r||et(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 Wo(e){e.setSelection(Ue(e.firstLine(),0),Ue(e.lastLine()),fe)}function Ho(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,x,N,K){i&&(r.from=st(e,i)),x&&(r.to=st(e,x)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Oe(e,"beforeChange",e,r),e.cm&&Oe(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 Dn(e,t,n){if(e.cm){if(!e.cm.curOp)return Ut(e.cm,Dn)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var r=Ti&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ko(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ko(e,t)}function Ko(e,t){if(t.text.length==1&&t.text[0]==""&&ut(t.from,t.to)==0)return;var n=Ea(e,t);Ro(e,t,n,e.cm?e.cm.curOp.id:NaN),ai(e,t,n,Pr(e,t));var r=[];Wr(e,function(i,x){!x&&Z(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),ai(i,t,null,Pr(i,t))})}function Ki(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,N=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,Y=0;Y<K.length&&!(x=K[Y],n?x.ranges&&!x.equals(e.sel):!x.ranges);Y++);if(Y==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=K.pop(),x.ranges){if(Bi(x,z),n&&!x.equals(e.sel)){Vt(e,x,{clearRedo:!1});return}N=x}else if(r){K.push(x);return}else break;var ie=[];Bi(N,z),z.push({changes:ie,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var de=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),xe=function(Pe){var Ne=x.changes[Pe];if(Ne.origin=t,de&&!Ho(e,Ne,!1))return K.length=0,{};ie.push(Sa(e,Ne));var Ke=Pe?Ea(e,Ne):J(K);ai(e,Ne,Ke,Po(e,Ne)),!Pe&&e.cm&&e.cm.scrollIntoView({from:Ne.from,to:jr(Ne)});var Je=[];Wr(e,function(Ge,qe){!qe&&Z(Je,Ge.history)==-1&&(Xo(Ge.history,Ne),Je.push(Ge.history)),ai(Ge,Ne,null,Po(Ge,Ne))})},ve=x.changes.length-1;ve>=0;--ve){var Re=xe(ve);if(Re)return Re.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new sr(se(e.sel.ranges,function(i){return new vt(Ue(i.anchor.line+t,i.anchor.ch),Ue(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Qt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Ur(e.cm,r,"gutter")}}function ai(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ut(e.cm,ai)(e,t,n,r);if(t.to.line<e.first){Go(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Go(e,i),t={from:Ue(e.first,0),to:Ue(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Ue(x,et(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wr(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Wi(e,n,fe),e.cantEdit&&Hi(e,Ue(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,x=t.from,N=t.to,K=!1,z=x.line;e.options.lineWrapping||(z=gt(rt(et(r,x.line))),r.iter(z,N.line+1,function(ve){if(ve==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ae(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(z,x.line+t.text.length,function(ve){var Re=Gt(ve);Re>i.maxLineLength&&(i.maxLine=ve,i.maxLineLength=Re,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Wn(r,x.line),ri(e,400);var Y=t.text.length-(N.line-x.line)-1;t.full?Qt(e):x.line==N.line&&t.text.length==1&&!Lo(e.doc,t)?Ur(e,x.line,"text"):Qt(e,x.line,N.line+1,Y);var ie=le(e,"changes"),de=le(e,"change");if(de||ie){var xe={from:x,to:N,text:t.text,removed:t.removed,origin:t.origin};de&&Ht(e,"change",e,xe),ie&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function _n(e,t,n,r,i){var x;r||(r=n),ut(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),Dn(e,{from:n,to:r,text:t,origin:i})}function zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(e,t,n,r){for(var i=0;i<e.length;++i){var x=e[i],N=!0;if(x.ranges){x.copied||(x=e[i]=x.deepCopy(),x.copied=!0);for(var K=0;K<x.ranges.length;K++)zo(x.ranges[K].anchor,t,n,r),zo(x.ranges[K].head,t,n,r);continue}for(var z=0;z<x.changes.length;++z){var Y=x.changes[z];if(n<Y.from.line)Y.from=Ue(Y.from.line+r,Y.from.ch),Y.to=Ue(Y.to.line+r,Y.to.ch);else if(t<=Y.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function oi(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=et(e,$r(e,t)):i=gt(t),i==null?null:(r(x,i)&&e.cm&&Ur(e.cm,i,n),x)}function si(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}si.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,zt(i),Ht(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function li(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}li.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var x=Math.min(t,i-e),N=r.height;if(r.removeInner(e,x),this.height-=N-r.height,i==x&&(this.children.splice(n--,1),r.parent=null),(t-=x)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof si))){var K=[];this.collapse(K),this.children=[new si(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],x=i.chunkSize();if(e<=x){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var z=new si(i.lines.slice(K,K+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=x}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new li(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Z(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new li(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],x=i.chunkSize();if(e<x){var N=Math.min(t,x-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=x}}};var ui=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};ui.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=gt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var x=$n(this);dr(n,Math.max(0,n.height-x)),e&&(nr(e,function(){Yo(e,n,-x),Ur(e,r,"widget")}),Ht(e,"lineWidgetCleared",e,this,r))},ui.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=$n(this)-t;if(!i)return;St(this.doc,r)||dr(r,r.height+i),n&&nr(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Ht(n,"lineWidgetChanged",n,e,gt(r))})},ue(ui);function Yo(e,t,n){At(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new ui(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),oi(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,x&&!St(e,N)){var z=At(N)<e.scrollTop;dr(N,N.height+$n(i)),z&&ma(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&Ht(x,"lineWidgetAdded",x,i,typeof t=="number"?t:gt(t)),i}var $o=0,Hr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++$o};Hr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&sn(e),le(this,"clear")){var n=this.find();n&&Ht(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var N=this.lines[x],K=kr(N.markedSpans,this);e&&!this.collapsed?Ur(e,gt(N),"text"):e&&(K.to!=null&&(i=gt(N)),K.from!=null&&(r=gt(N))),N.markedSpans=Ua(N.markedSpans,K),K.from==null&&this.collapsed&&!St(this.doc,N)&&e&&dr(N,xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var Y=rt(this.lines[z]),ie=Gt(Y);ie>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=ie,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Qt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&No(e.doc)),e&&Ht(e,"markerCleared",e,this,r,i),t&&ln(e),this.parent&&this.parent.clear()},Hr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],N=kr(x.markedSpans,this);if(N.from!=null&&(n=Ue(t?x:gt(x),N.from),e==-1))return n;if(N.to!=null&&(r=Ue(t?x:gt(x),N.to),e==1))return r}return n&&{from:n,to:r}},Hr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;nr(r,function(){var i=t.line,x=gt(t.line),N=ra(r,x);if(N&&(Za(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!St(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var z=$n(n)-K;z&&dr(i,i.height+z)}Ht(r,"markerChanged",r,e)})},Hr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Z(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Hr.prototype.detachLine=function(e){if(this.lines.splice(Z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Hr);function On(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ut(e.cm,On)(e,t,n,r,i);var x=new Hr(e,i),N=ut(t,n);if(r&&k(r,x,!1),N>0||N==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=g("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(Zi(e,t.line,t,n,x)||t.line!=n.line&&Zi(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}x.addToHistory&&Ro(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,Y;if(e.iter(K,n.line+1,function(de){z&&x.collapsed&&!z.options.lineWrapping&&rt(de)==z.display.maxLine&&(Y=!0),x.collapsed&&K!=t.line&&dr(de,0),Hn(de,new gn(x,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),x.collapsed&&e.iter(t.line,n.line+1,function(de){St(e,de)&&dr(de,0)}),x.clearOnEnter&&Ae(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++$o,x.atomic=!0),z){if(Y&&(z.curOp.updateMaxLine=!0),x.collapsed)Qt(z,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var ie=t.line;ie<=n.line;ie++)Ur(z,ie,"text");x.atomic&&No(z.doc),Ht(z,"markerAdded",z,x)}return x}var di=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ht(this,"clear")},di.prototype.find=function(e,t){return this.primary.find(e,t)},ue(di);function Tl(e,t,n,r,i){r=k(r),r.shared=!1;var x=[On(e,t,n,r,i)],N=x[0],K=r.widgetNode;return Wr(e,function(z){K&&(r.widgetNode=K.cloneNode(!0)),x.push(On(z,st(z,t),st(z,n),r,i));for(var Y=0;Y<z.linked.length;++Y)if(z.linked[Y].isParent)return;N=J(x)}),new di(x,N)}function Jo(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(),x=e.clipPos(i.from),N=e.clipPos(i.to);if(ut(x,N)){var K=On(e,x,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];Wr(i.primary.doc,function(z){return x.push(z)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];Z(x,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,Zt=function(e,t,n,r,i){if(!(this instanceof Zt))return new Zt(e,t,n,r,i);n==null&&(n=0),li.call(this,[new si([new wt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Ue(n,0);this.sel=Br(x),this.history=new Ni(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ta(this,{from:x,to:x,text:e}),Vt(this,Br(x),fe)};Zt.prototype=Se(li.prototype,{constructor:Zt,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Nt(function(e){var t=Ue(this.first,0),n=this.first+this.size-1;Dn(this,{from:t,to:Ue(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Zn(this.cm,0,0),Vt(this,Br(t),fe)}),replaceRange:function(e,t,n,r){t=st(this,t),n=n?st(this,n):t,_n(this,e,t,n,r)},getRange:function(e,t,n){var r=wr(this,st(this,e),st(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Rr(this,e))return et(this,e)},getLineNumber:function(e){return gt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=et(this,e)),rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return st(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nt(function(e,t,n){Io(this,st(this,typeof e=="number"?Ue(e,t||0):e),null,n)}),setSelection:Nt(function(e,t,n){Io(this,st(this,e),st(this,t||e),n)}),extendSelection:Nt(function(e,t,n){ji(this,st(this,e),t&&st(this,t),n)}),extendSelections:Nt(function(e,t){Mo(this,Nn(this,e),t)}),extendSelectionsBy:Nt(function(e,t){var n=se(this.sel.ranges,e);Mo(this,Nn(this,n),t)}),setSelections:Nt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new vt(st(this,e[i].anchor),st(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Vt(this,gr(this.cm,r,t),n)}),addSelection:Nt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new vt(st(this,e),st(this,t||e))),Vt(this,gr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=wr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=wr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Nt(function(e,t,n){for(var r=[],i=this.sel,x=0;x<i.ranges.length;x++){var N=i.ranges[x];r[x]={from:N.from(),to:N.to(),text:this.splitLines(e[x]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Dn(this,r[z]);K?Fo(this,K):this.cm&&wn(this.cm)}),undo:Nt(function(){Ki(this,"undo")}),redo:Nt(function(){Ki(this,"redo")}),undoSelection:Nt(function(){Ki(this,"undo",!0)}),redoSelection:Nt(function(){Ki(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 Ni(this.history.maxGeneration),Wr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:An(this.history.done),undone:An(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=An(e.done.slice(0),null,!0),t.undone=An(e.undone.slice(0),null,!0)},setGutterMarker:Nt(function(e,t,n){return oi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ke(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Nt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&oi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ke(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Rr(this,e))return null;if(t=e,e=et(this,e),!e)return null}else if(t=gt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Nt(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Nt(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",x=r[i];if(x)if(n==null)r[i]=null;else{var N=x.match(b(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=x.slice(0,N.index)+(!N.index||K==x.length?"":" ")+x.slice(K)||null}else return!1;return!0})}),addLineWidget:Nt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return On(this,st(this,e),st(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=st(this,e),On(this,e,e,n,"bookmark")},findMarksAt:function(e){e=st(this,e);var t=[],n=et(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=st(this,e),t=st(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(x){var N=x.markedSpans;if(N)for(var K=0;K<N.length;K++){var z=N[K];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var x=i.text.length+r;if(x>e)return t=e,!0;e-=x,++n}),st(this,Ue(n,t))},indexFromPos:function(e){e=st(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Zt(fn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Zt(fn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,Jo(this)),r},unlinkDoc:function(e){if(e instanceof Lt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(Jo(this));break}if(e.history==this.history){var r=[e.id];Wr(e,function(i){return r.push(i.id)},!0),e.history=new Ni(null),e.history.done=An(this.history.done,r),e.history.undone=An(this.history.undone,r)}},iterLinkedDocs:function(e){Wr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Nt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),Zt.prototype.eachLine=Zt.prototype.iter;var Qo=0;function Al(e){var t=this;if(Zo(t),Fe(t,e)||Dr(t.display,e))return;$(e),B&&(Qo=+new Date);var n=rn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,x=Array(i),N=0,K=function(){++N==i&&Ut(t,function(){n=st(t.doc,n);var ve={from:n,to:n,text:t.doc.splitLines(x.filter(function(Re){return Re!=null}).join(t.doc.lineSeparator())),origin:"paste"};Dn(t.doc,ve),Fo(t.doc,Br(st(t.doc,n),st(t.doc,jr(ve))))})()},z=function(ve,Re){if(t.options.allowDropFileTypes&&Z(t.options.allowDropFileTypes,ve.type)==-1){K();return}var Pe=new FileReader;Pe.onerror=function(){return K()},Pe.onload=function(){var Ne=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ne)){K();return}x[Re]=Ne,K()},Pe.readAsText(ve)},Y=0;Y<r.length;Y++)z(r[Y],Y);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ie=e.dataTransfer.getData("Text");if(ie){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),Wi(t.doc,Br(n,n)),de)for(var xe=0;xe<de.length;++xe)_n(t.doc,"",de[xe].anchor,de[xe].head,"drag");t.replaceSelection(ie,"around","paste"),t.display.input.focus()}}catch(ve){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-Qo<100)){re(t);return}if(Fe(e,t)||Dr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=rn(e,t);if(!n)return;var r=document.createDocumentFragment();uo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function Zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var x=0;x<n.length;x++)e(n[x])})}var es=!1;function _l(){if(es)return;Ol(),es=!0}function Ol(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Rl)},100))}),Ae(window,"blur",function(){return qo(Sn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Kr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ci=0;ci<10;ci++)Kr[ci+48]=Kr[ci+96]=String(ci);for(var Gi=65;Gi<=90;Gi++)Kr[Gi]=String.fromCharCode(Gi);for(var fi=1;fi<=12;fi++)Kr[fi+111]=Kr[fi+63235]="F"+fi;var _r={};_r.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},_r.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},_r.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},_r.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},_r.default=s?_r.macDefault:_r.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))x=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(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=se(n.split(" "),kl),x=0;x<i.length;x++){var N=void 0,K=void 0;x==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,x+1).join(" "),N="...");var z=t[K];if(!z)t[K]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function Rn(e,t,n,r){t=zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Rn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var N=Rn(e,t.fallthrough[x],n,r);if(N)return N}}}function ts(e){var t=typeof e=="string"?e:Kr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(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 ns(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=Kr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function zi(e){return typeof e=="string"?_r[e]:e}function kn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&ut(x.from,J(r).to)<=0;){var N=r.pop();if(ut(N.from,x.from)<0){x.from=N.from;break}}r.push(x)}nr(e,function(){for(var K=r.length-1;K>=0;K--)_n(e.doc,"",r[K].from,r[K].to,"+delete");wn(e)})}function Aa(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function La(e,t,n){var r=Aa(e,t.ch,n);return r==null?null:new Ue(t.line,r,n<0?"after":"before")}function Da(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=Be(n,t.doc.direction);if(x){var N=i<0?J(x):x[0],K=i<0==(N.level==1),z=K?"after":"before",Y;if(N.level>0||t.doc.direction=="rtl"){var ie=En(t,n);Y=i<0?n.text.length-1:0;var de=Er(t,ie,Y).top;Y=ze(function(xe){return Er(t,ie,xe).top==de},i<0==(N.level==1)?N.from:N.to-1,Y),z=="before"&&(Y=Aa(n,Y,1))}else Y=i<0?N.to:N.from;return new Ue(r,Y,z)}}return new Ue(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Be(t,e.doc.direction);if(!i)return La(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 x=je(i,n.ch,n.sticky),N=i[x];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return La(t,n,r);var K=function(Ke,Je){return Aa(t,Ke instanceof Ue?Ke.ch:Ke,Je)},z,Y=function(Ke){return e.options.lineWrapping?(z=z||En(e,t),ao(e,t,z,Ke)):{begin:0,end:t.text.length}},ie=Y(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var de=N.level==1==r<0,xe=K(n,de?1:-1);if(xe!=null&&(de?xe<=N.to&&xe<=ie.end:xe>=N.from&&xe>=ie.begin)){var ve=de?"before":"after";return new Ue(n.line,xe,ve)}}var Re=function(Ke,Je,Ge){for(var qe=function(Tt,Bt){return Bt?new Ue(n.line,K(Tt,1),"before"):new Ue(n.line,Tt,"after")};Ke>=0&&Ke<i.length;Ke+=Je){var at=i[Ke],nt=Je>0==(at.level!=1),ht=nt?Ge.begin:K(Ge.end,-1);if(at.from<=ht&&ht<at.to)return qe(ht,nt);if(ht=nt?at.from:K(at.to,-1),Ge.begin<=ht&&ht<Ge.end)return qe(ht,nt)}},Pe=Re(x+r,r,ie);if(Pe)return Pe;var Ne=r>0?ie.end:K(ie.begin,-1);return Ne!=null&&!(r>0&&Ne==t.text.length)&&(Pe=Re(r>0?0:i.length-1,r,Y(Ne)),Pe)?Pe:null}var hi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),fe)},killLine:function(e){return kn(e,function(t){if(t.empty()){var n=et(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to: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 kn(e,function(t){return{from:Ue(t.from().line,0),to:st(e.doc,Ue(t.to().line+1,0))}})},delLineLeft:function(e){return kn(e,function(t){return{from:Ue(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return kn(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 kn(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 is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},pe)},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")},pe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?as(e,t.head):r},pe)},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 x=n[i].from(),N=H(e.getLine(x.line),x.ch,r);t.push(he(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return nr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,x=et(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Ue(i.line,i.ch-1)),i.ch>0)i=new Ue(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Ue(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=et(e.doc,i.line-1).text;N&&(i=new Ue(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ue(i.line-1,N.length-1),i,"+transpose"))}}n.push(new vt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return nr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);wn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=et(e.doc,t),r=rt(n);return r!=n&&(t=gt(r)),Da(!0,e,r,t,1)}function Il(e,t){var n=et(e.doc,t),r=ct(n);return r!=n&&(t=gt(r)),Da(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=et(e.doc,n.line),i=Be(r,e.doc.direction);if(!i||i[0].level==0){var x=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=x&&t.ch;return Ue(n.line,N?0:x,n.sticky)}return n}function Vi(e,t,n){if(typeof t=="string"&&(t=hi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ee}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Rn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Rn(t,e.options.extraKeys,n,e)||Rn(t,e.options.keyMap,n,e)}var Ul=new X;function mi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ht(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?mi(e,"Shift-"+n,t,function(r){return Vi(e,r,!0)})||mi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vi(e,r)}):mi(e,n,t,function(r){return Vi(e,r)}):!1}function Nl(e,t,n){return mi(e,"'"+n+"'",t,function(r){return Vi(e,r,!0)})}var _a=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Fe(t,e))return;B&&F<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);A&&(_a=r?n:null,!r&&n==88&&!It&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Dr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==_a){_a=null,$(e);return}if(A&&(!e.which||e.which<10)&&ss(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Oa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Oa.prototype.compare=function(e,t,n){return this.time+jl>e&&ut(t,this.pos)==0&&n==this.button};var pi,gi;function Wl(e,t){var n=+new Date;return gi&&gi.compare(n,e,t)?(pi=gi=null,"triple"):pi&&pi.compare(n,e,t)?(gi=new Oa(n,e,t),pi=null,"double"):(pi=new Oa(n,e,t),gi=null,"single")}function cs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Dr(n,e)){_||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ra(t,e))return;var r=rn(t,e),i=Ce(e),x=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,x,e))return;i==1?r?Gl(t,r,x,e):be(e)==n.scroller&&$(e):i==2?(r&&ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):fo(t))}function Hl(e,t,n,r,i){var x="Click";return r=="double"?x="Double"+x:r=="triple"&&(x="Triple"+x),x=(t==1?"Left":t==2?"Middle":"Right")+x,mi(e,rs(x,i),i,function(N){if(typeof N=="string"&&(N=hi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=Ee}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var x=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=x?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(O(co,e),0):e.curOp.focus=M();var i=Kl(e,n,r),x=e.doc.sel,N;e.options.dragDrop&&Me&&!e.isReadOnly()&&n=="single"&&(N=x.contains(t))>-1&&(ut((N=x.ranges[N]).from(),t)<0||t.xRel>0)&&(ut(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,x=!1,N=Ut(e,function(Y){_&&(i.scroller.draggable=!1),e.state.draggingText=!1,$e(i.wrapper.ownerDocument,"mouseup",N),$e(i.wrapper.ownerDocument,"mousemove",K),$e(i.scroller,"dragstart",z),$e(i.scroller,"drop",N),x||($(Y),r.addNew||ji(e.doc,n,null,null,r.extend),_&&!P||B&&F==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Y){x=x||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},z=function(){return x=!0};_&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ae(i.wrapper.ownerDocument,"mouseup",N),Ae(i.wrapper.ownerDocument,"mousemove",K),Ae(i.scroller,"dragstart",z),Ae(i.scroller,"drop",N),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new vt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new vt(Ue(t.line,0),st(e.doc,Ue(t.line+1,0)));var r=n(e,t);return new vt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,x=e.doc;$(t);var N,K,z=x.sel,Y=z.ranges;if(r.addNew&&!r.extend?(K=x.sel.contains(n),K>-1?N=Y[K]:N=new vt(n,n)):(N=x.sel.primary(),K=x.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new vt(n,n)),n=rn(e,t,!0,!0),K=-1;else{var ie=fs(e,n,r.unit);r.extend?N=wa(N,ie.anchor,ie.head,r.extend):N=ie}r.addNew?K==-1?(K=Y.length,Vt(x,gr(e,Y.concat([N]),K),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[K].empty()&&r.unit=="char"&&!r.extend?(Vt(x,gr(e,Y.slice(0,K).concat(Y.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=x.sel):Ca(x,K,N,Te):(K=0,Vt(x,new sr([N],0),Te),z=x.sel);var de=n;function xe(Ge){if(ut(de,Ge)==0)return;if(de=Ge,r.unit=="rectangle"){for(var qe=[],at=e.options.tabSize,nt=H(et(x,n.line).text,n.ch,at),ht=H(et(x,Ge.line).text,Ge.ch,at),Tt=Math.min(nt,ht),Bt=Math.max(nt,ht),_t=Math.min(n.line,Ge.line),ir=Math.min(e.lastLine(),Math.max(n.line,Ge.line));_t<=ir;_t++){var qt=et(x,_t).text,Pt=ge(qt,Tt,at);Tt==Bt?qe.push(new vt(Ue(_t,Pt),Ue(_t,Pt))):qt.length>Pt&&qe.push(new vt(Ue(_t,Pt),Ue(_t,ge(qt,Bt,at))))}qe.length||qe.push(new vt(n,n)),Vt(x,gr(e,z.ranges.slice(0,K).concat(qe),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ge)}else{var er=N,Kt=fs(e,Ge,r.unit),Ft=er.anchor,Mt;ut(Kt.anchor,Ft)>0?(Mt=Kt.head,Ft=Yr(er.from(),Kt.anchor)):(Mt=Kt.anchor,Ft=hn(er.to(),Kt.head));var Ot=z.ranges.slice(0);Ot[K]=Xl(e,new vt(st(x,Ft),Mt)),Vt(x,gr(e,Ot,K),Te)}}var ve=i.wrapper.getBoundingClientRect(),Re=0;function Pe(Ge){var qe=++Re,at=rn(e,Ge,!0,r.unit=="rectangle");if(!at)return;if(ut(at,de)!=0){e.curOp.focus=M(),xe(at);var nt=Mi(i,x);(at.line>=nt.to||at.line<nt.from)&&setTimeout(Ut(e,function(){Re==qe&&Pe(Ge)}),150)}else{var ht=Ge.clientY<ve.top?-20:Ge.clientY>ve.bottom?20:0;ht&&setTimeout(Ut(e,function(){if(Re!=qe)return;i.scroller.scrollTop+=ht,Pe(Ge)}),50)}}function Ne(Ge){e.state.selectingText=!1,Re=Infinity,Ge&&($(Ge),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",Ke),$e(i.wrapper.ownerDocument,"mouseup",Je),x.history.lastSelOrigin=null}var Ke=Ut(e,function(Ge){Ge.buttons===0||!Ce(Ge)?Ne(Ge):Pe(Ge)}),Je=Ut(e,Ne);e.state.selectingText=Je,Ae(i.wrapper.ownerDocument,"mousemove",Ke),Ae(i.wrapper.ownerDocument,"mouseup",Je)}function Xl(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(ut(n,r)==0&&n.sticky==r.sticky)return t;var x=Be(i);if(!x)return t;var N=je(x,n.ch,n.sticky),K=x[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var z=N+(K.from==n.ch==(K.level!=1)?0:1);if(z==0||z==x.length)return t;var Y;if(r.line!=n.line)Y=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ie=je(x,r.ch,r.sticky),de=ie-N||(r.ch-n.ch)*(K.level==1?-1:1);ie==z-1||ie==z?Y=de<0:Y=de>0}var xe=x[z+(Y?-1:0)],ve=Y==(xe.level==1),Re=ve?xe.from:xe.to,Pe=ve?"after":"before";return n.ch==Re&&n.sticky==Pe?t:new vt(new Ue(n.line,Re,Pe),r)}function hs(e,t,n,r){var i,x;if(t.touches)i=t.touches[0].clientX,x=t.touches[0].clientY;else try{i=t.clientX,x=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(x>K.bottom||!le(e,n))return ee(t);x-=K.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=N.gutters.childNodes[z];if(Y&&Y.getBoundingClientRect().right>=i){var ie=Cr(e.doc,x),de=e.display.gutterSpecs[z];return Oe(e,n,e,ie,de.className,t),ee(t)}}}function Ra(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Dr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Jn(e)}var Pn={toString:function(){return"CodeMirror.Init"}},gs={},Xi={};function $l(e){var t=e.optionHandlers;function n(r,i,x,N){e.defaults[r]=i,x&&(t[r]=N?function(K,z,Y){Y!=Pn&&x(K,z,Y)}:x)}e.defineOption=n,e.Init=Pn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ii(r),Jn(r),Qt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],N=r.doc.first;r.doc.iter(function(z){for(var Y=0;;){var ie=z.text.indexOf(i,Y);if(ie==-1)break;Y=ie+i.length,x.push(Ue(N,ie))}N++});for(var K=x.length-1;K>=0;K--)_n(r.doc,i,x[K],Ue(x[K].line,x[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=Pn&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!E),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),ni(r)},!0),n("keyMap","default",function(r,i,x){var N=zi(i),K=x!=Pn&&zi(x);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ba(i,r.options.lineNumbers),ni(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Cn(r)},!0),n("scrollbarStyle","native",function(r){yo(r),Cn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ba(r.options.gutters,i),ni(r)},!0),n("firstLineNumber",1,ni,!0),n("lineNumberFormatter",function(r){return r},ni,!0),n("showCursorWhenSelecting",!1,Qn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Sn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Qn,!0),n("singleCursorHeightPerLine",!0,Qn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ii,!0),n("addModeClass",!1,ii,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,ii,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=Pn;if(!t!=!r){var i=e.display.dragFunctions,x=t?Ae:$e;x(e.display.scroller,"dragstart",i.start),x(e.display.scroller,"dragenter",i.enter),x(e.display.scroller,"dragover",i.over),x(e.display.scroller,"dragleave",i.leave),x(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),mr(e)),da(e),Qt(e),Jn(e),setTimeout(function(){return Cn(e)},100)}function Lt(e,t){var n=this;if(!(this instanceof Lt))return new Lt(e,t);this.options=t=t?k(t):{},k(gs,t,!1);var r=t.value;typeof r=="string"?r=new Zt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Lt.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new X,keySeq:null,specialChars:null},t.autofocus&&!o&&x.input.focus(),B&&F<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),sn(this),this.curOp.forceUpdate=!0,Do(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):Sn(this);for(var N in Xi)Xi.hasOwnProperty(N)&&Xi[N](this,t[N],Pn);xo(this),t.finishInit&&t.finishInit(this);for(var K=0;K<ka.length;++K)ka[K](this);ln(this),_&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}Lt.defaults=gs,Lt.optionHandlers=Xi;function Zl(e){var t=e.display;Ae(t.scroller,"mousedown",Ut(e,cs)),B&&F<11?Ae(t.scroller,"dblclick",Ut(e,function(z){if(Fe(e,z))return;var Y=rn(e,z);if(!Y||Ra(e,z)||Dr(e.display,z))return;$(z);var ie=e.findWordAt(Y);ji(e.doc,ie.anchor,ie.head)})):Ae(t.scroller,"dblclick",function(z){return Fe(e,z)||$(z)}),Ae(t.scroller,"contextmenu",function(z){return ms(e,z)}),Ae(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||ms(e,z)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function x(z){if(z.touches.length!=1)return!1;var Y=z.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function N(z,Y){if(Y.left==null)return!0;var ie=Y.left-z.left,de=Y.top-z.top;return ie*ie+de*de>20*20}Ae(t.scroller,"touchstart",function(z){if(!Fe(e,z)&&!x(z)&&!Ra(e,z)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(z){var Y=t.activeTouch;if(Y&&!Dr(t,z)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var ie=e.coordsChar(t.activeTouch,"page"),de;!Y.prev||N(Y,Y.prev)?de=new vt(ie,ie):!Y.prev.prev||N(Y,Y.prev.prev)?de=e.findWordAt(ie):de=new vt(Ue(ie.line,0),st(e.doc,Ue(ie.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),$(z)}i()}),Ae(t.scroller,"touchcancel",i),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qn(e,t.scroller.scrollTop),an(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(z){return wo(e,z)}),Ae(t.scroller,"DOMMouseScroll",function(z){return wo(e,z)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Fe(e,z)||re(z)},over:function(z){Fe(e,z)||(Dl(e,z),re(z))},start:function(z){return Ll(e,z)},drop:Ut(e,Al),leave:function(z){Fe(e,z)||Zo(e)}};var K=t.input.getField();Ae(K,"keyup",function(z){return us.call(e,z)}),Ae(K,"keydown",Ut(e,ls)),Ae(K,"keypress",Ut(e,ds)),Ae(K,"focus",function(z){return fa(e,z)}),Ae(K,"blur",function(z){return Sn(e,z)})}var ka=[];Lt.defineInitHook=function(e){return ka.push(e)};function vi(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=rr(e,t).state:n="prev");var N=e.options.tabSize,K=et(i,t),z=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var Y=K.text.match(/^\s*/)[0],ie;if(!r&&!/\S/.test(K.text))ie=0,n="not";else if(n=="smart"&&(ie=i.mode.indent(x,K.text.slice(Y.length),K.text),ie==Ee||ie>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ie=H(et(i,t-1).text,null,N):ie=0:n=="add"?ie=z+e.options.indentUnit:n=="subtract"?ie=z-e.options.indentUnit:typeof n=="number"&&(ie=z+n),ie=Math.max(0,ie);var de="",xe=0;if(e.options.indentWithTabs)for(var ve=Math.floor(ie/N);ve;--ve)xe+=N,de+=" ";if(xe<ie&&(de+=he(ie-xe)),de!=Y)return _n(i,de,Ue(t,0),Ue(t,Y.length),"+input"),K.stateAfter=null,!0;for(var Re=0;Re<i.sel.ranges.length;Re++){var Pe=i.sel.ranges[Re];if(Pe.head.line==t&&Pe.head.ch<Y.length){var Ne=Ue(t,Y.length);Ca(i,Re,new vt(Ne,Ne));break}}}var vr=null;function Yi(e){vr=e}function Pa(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,z=mt(t),Y=null;if(K&&r.ranges.length>1)if(vr&&vr.text.join(`
|
|
`)==t){if(r.ranges.length%vr.text.length==0){Y=[];for(var ie=0;ie<vr.text.length;ie++)Y.push(x.splitLines(vr.text[ie]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=se(z,function(Ke){return[Ke]}));for(var de=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ve=r.ranges[xe],Re=ve.from(),Pe=ve.to();ve.empty()&&(n&&n>0?Re=Ue(Re.line,Re.ch-n):e.state.overwrite&&!K?Pe=Ue(Pe.line,Math.min(et(x,Pe.line).text.length,Pe.ch+J(z).length)):K&&vr&&vr.lineWise&&vr.text.join(`
|
|
`)==z.join(`
|
|
`)&&(Re=Pe=Ue(Re.line,0)));var Ne={from:Re,to:Pe,text:Y?Y[xe%Y.length]:z,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Dn(e.doc,Ne),Ht(e,"inputRead",e,Ne)}t&&!K&&ys(e,t),wn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&nr(t,function(){return Pa(t,n,0,null,"paste")}),!0}function ys(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var x=e.getModeAt(i.head),N=!1;if(x.electricChars){for(var K=0;K<x.electricChars.length;K++)if(t.indexOf(x.electricChars.charAt(K))>-1){N=vi(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=vi(e,i.head.line,"smart")));N&&Ht(e,"electricInput",e,i.head.line)}}function bs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:Ue(i,0),head:Ue(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return _?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),Es(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var x=this.options,N=x[r];if(x[r]==i&&r!="mode")return;x[r]=i,t.hasOwnProperty(r)&&Ut(this,t[r])(this,i,N),Oe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,x=0;x<i.length;++x)if(i[x]==r||i[x].name==r)return i.splice(x,1),!0},addOverlay:$t(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");q(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,Qt(this)}),removeOverlay:$t(function(r){for(var i=this.state.overlays,x=0;x<i.length;++x){var N=i[x].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(x,1),this.state.modeGen++,Qt(this);return}}}),indentLine:$t(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Rr(this.doc,r)&&vi(this,r,i,x)}),indentSelection:$t(function(r){for(var i=this.doc.sel.ranges,x=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>x&&(vi(this,K.head.line,r,!0),x=K.head.line,N==this.doc.sel.primIndex&&wn(this));else{var z=K.from(),Y=K.to(),ie=Math.max(x,z.line);x=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var de=ie;de<x;++de)vi(this,de,r);var xe=this.doc.sel.ranges;z.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Ca(this.doc,N,new vt(z,xe[N].to()),fe)}}}),getTokenAt:function(r,i){return Lr(this,r,i)},getLineTokens:function(r,i){return Lr(this,Ue(r),i,!0)},getTokenTypeAt:function(r){r=st(this.doc,r);var i=Bn(this,et(this.doc,r.line)),x=0,N=(i.length-1)/2,K=r.ch,z;if(K==0)z=i[2];else for(;;){var Y=x+N>>1;if((Y?i[Y*2-1]:0)>=K)N=Y;else if(i[Y*2+1]<K)x=Y+1;else{z=i[Y*2+2];break}}var ie=z?z.indexOf("overlay "):-1;return ie<0?z:ie==0?null:z.slice(0,ie-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var x=[];if(!n.hasOwnProperty(i))return x;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&x.push(N[K[i]]);else if(K[i])for(var z=0;z<K[i].length;z++){var Y=N[K[i][z]];Y&&x.push(Y)}else K.helperType&&N[K.helperType]?x.push(N[K.helperType]):N[K.name]&&x.push(N[K.name]);for(var ie=0;ie<N._global.length;ie++){var de=N._global[ie];de.pred(K,this)&&Z(x,de.val)==-1&&x.push(de.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=$r(x,r==null?x.first+x.size-1:r),rr(this,r+1,i).state},cursorCoords:function(r,i){var x,N=this.doc.sel.primary();return r==null?x=N.head:typeof r=="object"?x=st(this.doc,r):x=r?N.from():N.to(),pr(this,x,i||"page")},charCoords:function(r,i){return ia(this,st(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,Cr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var N=!1,K;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,N=!0),K=et(this.doc,r)}else K=r;return Oi(this,K,{top:0,left:0},i||"page",x||N).top+(N?this.doc.height-At(K):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Tn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,N,K){var z=this.display;r=pr(this,st(this.doc,r));var Y=r.bottom,ie=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")Y=r.top;else if(N=="above"||N=="near"){var de=Math.max(z.wrapper.clientHeight,this.doc.height),xe=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>de)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=de&&(Y=r.bottom),ie+i.offsetWidth>xe&&(ie=xe-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(ie=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ie=0:K=="middle"&&(ie=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ie+"px"),x&&Js(this,{left:ie,top:Y,right:ie+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:$t(ls),triggerOnKeyPress:$t(ds),triggerOnKeyUp:us,triggerOnMouseDown:$t(cs),execCommand:function(r){if(hi.hasOwnProperty(r))return hi[r].call(null,this)},triggerElectric:$t(function(r){ys(this,r)}),findPosH:function(r,i,x,N){var K=1;i<0&&(K=-1,i=-i);for(var z=st(this.doc,r),Y=0;Y<i&&!(z=Ma(this.doc,z,K,x,N),z.hitSide);++Y);return z},moveH:$t(function(r,i){var x=this;this.extendSelectionsBy(function(N){return x.display.shift||x.doc.extend||N.empty()?Ma(x.doc,N.head,r,i,x.options.rtlMoveVisually):r<0?N.from():N.to()},pe)}),deleteH:$t(function(r,i){var x=this.doc.sel,N=this.doc;x.somethingSelected()?N.replaceSelection("",null,"+delete"):kn(this,function(K){var z=Ma(N,K.head,r,i,!1);return r<0?{from:z,to:K.head}:{from:K.head,to:z}})}),findPosV:function(r,i,x,N){var K=1,z=N;i<0&&(K=-1,i=-i);for(var Y=st(this.doc,r),ie=0;ie<i;++ie){var de=pr(this,Y,"div");if(z==null?z=de.left:de.left=z,Y=Ts(this,de,K,x),Y.hitSide)break}return Y},moveV:$t(function(r,i){var x=this,N=this.doc,K=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ie){if(z)return r<0?ie.from():ie.to();var de=pr(x,ie.head,"div");ie.goalColumn!=null&&(de.left=ie.goalColumn),K.push(de.left);var xe=Ts(x,de,r,i);return i=="page"&&ie==N.sel.primary()&&ma(x,ia(x,xe,"div").top-de.top),xe},pe),K.length)for(var Y=0;Y<N.sel.ranges.length;Y++)N.sel.ranges[Y].goalColumn=K[Y]}),findWordAt:function(r){var i=this.doc,x=et(i,r.line).text,N=r.ch,K=r.ch;if(x){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||K==x.length)&&N?--N:++K;for(var Y=x.charAt(N),ie=_e(Y,z)?function(de){return _e(de,z)}:/\s/.test(Y)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!_e(de)};N>0&&ie(x.charAt(N-1));)--N;for(;K<x.length&&ie(x.charAt(K));)++K}return new vt(Ue(r.line,N),Ue(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$t(function(r,i){Zn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-br(this)-this.display.barHeight,width:r.scrollWidth-br(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:en(this)}},scrollIntoView:$t(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from: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):mo(this,r.from,r.to,r.margin)}),setSize:$t(function(r,i){var x=this,N=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&qa(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(z){if(z.widgets){for(var Y=0;Y<z.widgets.length;Y++)if(z.widgets[Y].noHScroll){Ur(x,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Oe(this,"refresh",this)}),operation:function(r){return nr(this,r)},startOperation:function(){return sn(this)},endOperation:function(){return ln(this)},refresh:$t(function(){var r=this.display.cachedTextHeight;Qt(this),this.curOp.forceUpdate=!0,Jn(this),Zn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-xn(this.display))>.5||this.options.lineWrapping)&&da(this),Oe(this,"refresh",this)}),swapDoc:$t(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Do(this,r),Jn(this),this.display.input.reset(),Zn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ht(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ue(e),e.registerHelper=function(r,i,x){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=x},e.registerGlobalHelper=function(r,i,x,N){e.registerHelper(r,i,N),n[r]._global.push({pred:x,val:N})}}function Ma(e,t,n,r,i){var x=t,N=n,K=et(e,t.line),z=i&&e.direction=="rtl"?-n:n;function Y(){var Je=t.line+z;return Je<e.first||Je>=e.first+e.size?!1:(t=new Ue(Je,t.ch,t.sticky),K=et(e,Je))}function ie(Je){var Ge;if(r=="codepoint"){var qe=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(qe)?Ge=null:Ge=new Ue(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(qe>=55296&&qe<56320?2:1))),-n)}else i?Ge=Ml(e.cm,K,t,n):Ge=La(K,t,n);if(Ge==null)if(!Je&&Y())t=Da(i,e.cm,K,t.line,z);else return!1;else t=Ge;return!0}if(r=="char"||r=="codepoint")ie();else if(r=="column")ie(!0);else if(r=="word"||r=="group")for(var de=null,xe=r=="group",ve=e.cm&&e.cm.getHelper(t,"wordChars"),Re=!0;!(n<0&&!ie(!Re));Re=!1){var Pe=K.text.charAt(t.ch)||`
|
|
`,Ne=_e(Pe,ve)?"w":xe&&Pe==`
|
|
`?"n":!xe||/\s/.test(Pe)?null:"p";if(xe&&!Re&&!Ne&&(Ne="s"),de&&de!=Ne){n<0&&(n=1,ie(),t.sticky="after");break}if(Ne&&(de=Ne),n>0&&!ie(!Re))break}var Ke=Hi(e,t,x,N,!0);return We(x,Ke)&&(Ke.hitSide=!0),Ke}function Ts(e,t,n,r){var i=e.doc,x=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*xn(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var Y;!(Y=oa(e,x,N),!Y.outside);){if(n<0?N<=0:N>=i.height){Y.hitSide=!0;break}N+=n*5}return Y}var bt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};bt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Ae(i,"paste",function(K){if(!x(K)||Fe(r,K)||vs(K,r))return;F<=11&&setTimeout(Ut(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Ae(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Ae(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(i,"touchstart",function(){return n.forceCompositionEnd()}),Ae(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!x(K)||Fe(r,K))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=bs(r);Yi({lineWise:!0,text:z.text}),K.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,fe),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Y=vr.text.join(`
|
|
`);if(K.clipboardData.setData("Text",Y),K.clipboardData.getData("Text")==Y){K.preventDefault();return}}var ie=xs(),de=ie.firstChild;r.display.lineSpace.insertBefore(ie,r.display.lineSpace.firstChild),de.value=vr.text.join(`
|
|
`);var xe=document.activeElement;W(de),setTimeout(function(){r.display.lineSpace.removeChild(ie),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Ae(i,"copy",N),Ae(i,"cut",N)},bt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},bt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},bt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},bt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},bt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var x=$i(t,e.anchorNode,e.anchorOffset),N=$i(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&N&&!N.bad&&ut(Yr(x,N),r)==0&&ut(hn(x,N),i)==0)return;var K=t.display.view,z=r.line>=t.display.viewFrom&&Ss(t,r)||{node:K[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Ss(t,i);if(!Y){var ie=K[K.length-1].measure,de=ie.maps?ie.maps[ie.maps.length-1]:ie.map;Y={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!z||!Y){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),ve;try{ve=p(z.node,z.offset,Y.offset,Y.node)}catch(Re){}ve&&(!L&&t.state.focused?(e.collapse(z.node,z.offset),ve.collapsed||(e.removeAllRanges(),e.addRange(ve))):(e.removeAllRanges(),e.addRange(ve)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},bt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},bt.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},bt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},bt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},bt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},bt.prototype.blur=function(){this.div.blur()},bt.prototype.getField=function(){return this.div},bt.prototype.supportsTouch=function(){return!0},bt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():nr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},bt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},bt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&T&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=$i(t,e.anchorNode,e.anchorOffset),r=$i(t,e.focusNode,e.focusOffset);n&&r&&nr(t,function(){Vt(t.doc,Br(n,r),fe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},bt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ue(r.line-1,et(e.doc,r.line-1).length)),i.ch==et(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 x,N,K;r.line==t.viewFrom||(x=nn(e,r.line))==0?(N=gt(t.view[0].line),K=t.view[0].node):(N=gt(t.view[x].line),K=t.view[x-1].node.nextSibling);var z=nn(e,i.line),Y,ie;if(z==t.view.length-1?(Y=t.viewTo-1,ie=t.lineDiv.lastChild):(Y=gt(t.view[z+1].line)-1,ie=t.view[z+1].node.previousSibling),!K)return!1;for(var de=e.doc.splitLines(tu(e,K,ie,N,Y)),xe=wr(e.doc,Ue(N,0),Ue(Y,et(e.doc,Y).text.length));de.length>1&&xe.length>1;)if(J(de)==J(xe))de.pop(),xe.pop(),Y--;else if(de[0]==xe[0])de.shift(),xe.shift(),N++;else break;for(var ve=0,Re=0,Pe=de[0],Ne=xe[0],Ke=Math.min(Pe.length,Ne.length);ve<Ke&&Pe.charCodeAt(ve)==Ne.charCodeAt(ve);)++ve;for(var Je=J(de),Ge=J(xe),qe=Math.min(Je.length-(de.length==1?ve:0),Ge.length-(xe.length==1?ve:0));Re<qe&&Je.charCodeAt(Je.length-Re-1)==Ge.charCodeAt(Ge.length-Re-1);)++Re;if(de.length==1&&xe.length==1&&N==r.line)for(;ve&&ve>r.ch&&Je.charCodeAt(Je.length-Re-1)==Ge.charCodeAt(Ge.length-Re-1);)ve--,Re++;de[de.length-1]=Je.slice(0,Je.length-Re).replace(/^\u200b+/,""),de[0]=de[0].slice(ve).replace(/\u200b+$/,"");var at=Ue(N,ve),nt=Ue(Y,xe.length?J(xe).length-Re:0);if(de.length>1||de[0]||ut(at,nt))return _n(e.doc,de,at,nt,"+input"),!0},bt.prototype.ensurePolled=function(){this.forceCompositionEnd()},bt.prototype.reset=function(){this.forceCompositionEnd()},bt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},bt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},bt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&nr(this.cm,function(){return Qt(e.cm)})},bt.prototype.setUneditable=function(e){e.contentEditable="false"},bt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Ut(this.cm,Pa)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},bt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},bt.prototype.onContextMenu=function(){},bt.prototype.resetPosition=function(){},bt.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Ya(n,r,t.line),x=Be(r,e.doc.direction),N="left";if(x){var K=je(x,t.ch);N=K%2?"right":"left"}var z=Qa(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Mn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",N=!1,K=e.doc.lineSeparator(),z=!1;function Y(ve){return function(Re){return Re.id==ve}}function ie(){N&&(x+=K,z&&(x+=K),N=z=!1)}function de(ve){ve&&(ie(),x+=ve)}function xe(ve){if(ve.nodeType==1){var Re=ve.getAttribute("cm-text");if(Re){de(Re);return}var Pe=ve.getAttribute("cm-marker"),Ne;if(Pe){var Ke=e.findMarks(Ue(r,0),Ue(i+1,0),Y(+Pe));Ke.length&&(Ne=Ke[0].find(0))&&de(wr(e.doc,Ne.from,Ne.to).join(K));return}if(ve.getAttribute("contenteditable")=="false")return;var Je=/^(pre|div|p|li|table|br)$/i.test(ve.nodeName);if(!/^br$/i.test(ve.nodeName)&&ve.textContent.length==0)return;Je&&ie();for(var Ge=0;Ge<ve.childNodes.length;Ge++)xe(ve.childNodes[Ge]);/^(pre|p)$/i.test(ve.nodeName)&&(z=!0),Je&&(N=!0)}else ve.nodeType==3&&de(ve.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,z=!1;return x}function $i(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Mn(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 x=e.display.view[i];if(x.node==r)return ru(x,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!v(r,t))return Mn(Ue(gt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?J(e.rest):e.line;return Mn(Ue(gt(x),x.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var z=e.measure,Y=z.maps;function ie(Ne,Ke,Je){for(var Ge=-1;Ge<(Y?Y.length:0);Ge++)for(var qe=Ge<0?z.map:Y[Ge],at=0;at<qe.length;at+=3){var nt=qe[at+2];if(nt==Ne||nt==Ke){var ht=gt(Ge<0?e.line:e.rest[Ge]),Tt=qe[at]+Je;return(Je<0||nt!=Ne)&&(Tt=qe[at+(Je?1:0)]),Ue(ht,Tt)}}}var de=ie(N,K,n);if(de)return Mn(de,i);for(var xe=K.nextSibling,ve=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(de=ie(xe,xe.firstChild,0),de)return Mn(Ue(de.line,de.ch-ve),i);ve+=xe.textContent.length}for(var Re=K.previousSibling,Pe=n;Re;Re=Re.previousSibling){if(de=ie(Re,Re.firstChild,-1),de)return Mn(Ue(de.line,de.ch+Pe),i);Pe+=Re.textContent.length}}var kt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};kt.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),y&&(i.style.width="0px"),Ae(i,"input",function(){B&&F>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(N){if(Fe(r,N)||vs(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(N){if(Fe(r,N))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=bs(r);Yi({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,fe):(n.prevInput="",i.value=K.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",x),Ae(i,"copy",x),Ae(e.scroller,"paste",function(N){if(Dr(e,N)||Fe(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Ae(e.lineSpace,"selectstart",function(N){Dr(e,N)||$(N)}),Ae(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},kt.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},kt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},kt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=pr(e,n.sel.primary().head,"div"),x=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-x.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-x.left))}return r},kt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},kt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&F>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&F>=9&&(this.hasSelection=null))},kt.prototype.getField=function(){return this.textarea},kt.prototype.supportsTouch=function(){return!1},kt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},kt.prototype.blur=function(){this.textarea.blur()},kt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},kt.prototype.receivedFocus=function(){this.slowPoll()},kt.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()})},kt.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)},kt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&F>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var x=i.charCodeAt(0);if(x==8203&&!r&&(r="\u200B"),x==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return nr(t,function(){Pa(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},kt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},kt.prototype.onKeyPress=function(){B&&F>=9&&(this.hasSelection=null),this.fastPoll()},kt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=rn(n,e),N=r.scroller.scrollTop;if(!x||A)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(x)==-1&&Ut(n,Vt)(n.doc,Br(x),fe);var z=i.style.cssText,Y=t.wrapper.style.cssText,ie=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ie.top-5)+"px; left: "+(e.clientX-ie.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var de;_&&(de=window.scrollY),r.input.focus(),_&&window.scrollTo(null,de),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ve,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Pe=n.somethingSelected(),Ne="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=Ne,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ne.length,r.selForContextMenu=n.doc.sel}}function ve(){if(t.contextMenuPending!=ve)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=z,B&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&F<9)&&xe();var Pe=0,Ne=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ut(n,Wo)(n):Pe++<10?r.detectingSelectAll=setTimeout(Ne,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ne,200)}}if(B&&F>=9&&xe(),w){re(e);var Re=function(){$e(window,"mouseup",Re),setTimeout(ve,20)};Ae(window,"mouseup",Re)}else setTimeout(ve,50)},kt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},kt.prototype.setUneditable=function(){},kt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?k(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var x=e.form;i=x.submit;try{var N=x.submit=function(){r(),x.submit=i,x.submit(),x.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Lt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=$e,e.on=Ae,e.wheelEventPixels=cl,e.Doc=Zt,e.splitLines=mt,e.countColumn=H,e.findColumn=ge,e.isWordChar=we,e.Pass=Ee,e.signal=Oe,e.Line=wt,e.changeEnd=jr,e.scrollbarModel=vo,e.Pos=Ue,e.cmpPos=ut,e.modes=Wt,e.mimeModes=pt,e.resolveMode=lr,e.getMode=Sr,e.modeExtensions=hr,e.extendMode=yi,e.copyState=ur,e.startState=cn,e.innerMode=Vr,e.commands=hi,e.keyMap=_r,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=Rn,e.normalizeKeyMap=Pl,e.StringStream=Ct,e.SharedTextMarker=di,e.TextMarker=Hr,e.LineWidget=ui,e.e_preventDefault=$,e.e_stopPropagation=Q,e.e_stop=re,e.addClass=U,e.contains=v,e.rmClass=h,e.keyNames=Kr}$l(Lt),ql(Lt);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in Zt.prototype)Zt.prototype.hasOwnProperty(Ji)&&Z(au,Ji)<0&&(Lt.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(Zt.prototype[Ji]));return ue(Zt),Lt.inputStyles={textarea:kt,contenteditable:bt},Lt.defineMode=function(e){!Lt.defaults.mode&&e!="null"&&(Lt.defaults.mode=e),Tr.apply(this,arguments)},Lt.defineMIME=zr,Lt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Lt.defineMIME("text/plain","null"),Lt.defineExtension=function(e,t){Lt.prototype[e]=t},Lt.defineDocExtension=function(e,t){Zt.prototype[e]=t},Lt.fromTextArea=nu,iu(Lt),Lt.version="5.58.2",Lt})},Y1PL:function(lt,Qe,oe){"use strict";oe.r(Qe),oe.d(Qe,"ResizableTextArea",function(){return Z});var ne=oe("wx14"),V=oe("1OyB"),L=oe("vuIU"),G=oe("Ji7U"),I=oe("LK+K"),R=oe("cDcd"),B=oe("VTBJ"),F=oe("rePB"),_=oe("Zm9Q"),D=oe("Kwbf"),T=oe("c+Xe"),A=oe("m+aA"),P=oe("bdgK"),C=new Map;function S(fe){fe.forEach(function(Te){var pe,ge=Te.target;(pe=C.get(ge))===null||pe===void 0||pe.forEach(function(ce){return ce(ge)})})}var y=new P.default(S),d=null,o=null;function s(fe,Te){C.has(fe)||(C.set(fe,new Set),y.observe(fe)),C.get(fe).add(Te)}function u(fe,Te){C.has(fe)&&(C.get(fe).delete(Te),C.get(fe).size||(y.unobserve(fe),C.delete(fe)))}var E=function(fe){Object(G.a)(pe,fe);var Te=Object(I.a)(pe);function pe(){return Object(V.a)(this,pe),Te.apply(this,arguments)}return Object(L.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(R.Component),f=R.createContext(null);function m(fe){var Te=fe.children,pe=fe.onBatchResize,ge=R.useRef(0),ce=R.useRef([]),he=R.useContext(f),J=R.useCallback(function(se,q,ye){ge.current+=1;var Se=ge.current;ce.current.push({size:se,element:q,data:ye}),Promise.resolve().then(function(){Se===ge.current&&(pe==null||pe(ce.current),ce.current=[])}),he==null||he(se,q,ye)},[pe,he]);return R.createElement(f.Provider,{value:J},Te)}function w(fe){var Te=fe.children,pe=fe.disabled,ge=R.useRef(null),ce=R.useRef(null),he=R.useContext(f),J=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),se=R.isValidElement(Te)&&Object(T.c)(Te),q=se?Te.ref:null,ye=R.useMemo(function(){return Object(T.a)(q,ge)},[q,ge]),Se=R.useRef(fe);Se.current=fe;var me=R.useCallback(function(we){var _e=Se.current,ke=_e.onResize,Ie=_e.data,De=we.getBoundingClientRect(),Le=De.width,ze=De.height,Ye=we.offsetWidth,Ve=we.offsetHeight,je=Math.floor(Le),Xe=Math.floor(ze);if(J.current.width!==je||J.current.height!==Xe||J.current.offsetWidth!==Ye||J.current.offsetHeight!==Ve){var Be={width:je,height:Xe,offsetWidth:Ye,offsetHeight:Ve};J.current=Be;var He=Ye===Math.round(Le)?Le:Ye,Ae=Ve===Math.round(ze)?ze:Ve,Ze=Object(B.a)(Object(B.a)({},Be),{},{offsetWidth:He,offsetHeight:Ae});he==null||he(Ze,we,Ie),ke&&Promise.resolve().then(function(){ke(Ze,we)})}},[]);return R.useEffect(function(){var we=Object(A.a)(ge.current)||Object(A.a)(ce.current);return we&&!pe&&s(we,me),function(){return u(we,me)}},[ge.current,pe]),R.createElement(E,{ref:ce},se?R.cloneElement(Te,{ref:ye}):Te)}var b="rc-observer-key";function h(fe){var Te=fe.children,pe=Object(_.a)(Te);return pe.map(function(ge,ce){var he=(ge==null?void 0:ge.key)||"".concat(b,"-").concat(ce);return R.createElement(w,Object(ne.a)({},fe,{key:he}),ge)})}h.Collection=m;var c=h,l=oe("bT9E"),a=oe("TSYQ"),g=oe.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
|
|
`,v=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},U;function j(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=fe.getAttribute("id")||fe.getAttribute("data-reactid")||fe.getAttribute("name");if(Te&&M[pe])return M[pe];var ge=window.getComputedStyle(fe),ce=ge.getPropertyValue("box-sizing")||ge.getPropertyValue("-moz-box-sizing")||ge.getPropertyValue("-webkit-box-sizing"),he=parseFloat(ge.getPropertyValue("padding-bottom"))+parseFloat(ge.getPropertyValue("padding-top")),J=parseFloat(ge.getPropertyValue("border-bottom-width"))+parseFloat(ge.getPropertyValue("border-top-width")),se=v.map(function(ye){return"".concat(ye,":").concat(ge.getPropertyValue(ye))}).join(";"),q={sizingStyle:se,paddingSize:he,borderSize:J,boxSizing:ce};return Te&&pe&&(M[pe]=q),q}function W(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ge=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),fe.getAttribute("wrap")?U.setAttribute("wrap",fe.getAttribute("wrap")):U.removeAttribute("wrap");var ce=j(fe,Te),he=ce.paddingSize,J=ce.borderSize,se=ce.boxSizing,q=ce.sizingStyle;U.setAttribute("style","".concat(q,";").concat(p)),U.value=fe.value||fe.placeholder||"";var ye=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,me=U.scrollHeight,we;if(se==="border-box"?me+=J:se==="content-box"&&(me-=he),pe!==null||ge!==null){U.value=" ";var _e=U.scrollHeight-he;pe!==null&&(ye=_e*pe,se==="border-box"&&(ye=ye+he+J),me=Math.max(ye,me)),ge!==null&&(Se=_e*ge,se==="border-box"&&(Se=Se+he+J),we=me>Se?"":"hidden",me=Math.min(Se,me))}return{height:me,minHeight:ye,maxHeight:Se,overflowY:we,resize:"none"}}var O=oe("Gytx"),k=oe.n(O),H;(function(fe){fe[fe.NONE=0]="NONE",fe[fe.RESIZING=1]="RESIZING",fe[fe.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(fe){Object(G.a)(pe,fe);var Te=Object(I.a)(pe);function pe(ge){var ce;return Object(V.a)(this,pe),ce=Te.call(this,ge),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(he){ce.textArea=he},ce.handleResize=function(he){var J=ce.state.resizeStatus,se=ce.props,q=se.autoSize,ye=se.onResize;if(J!==H.NONE)return;typeof ye=="function"&&ye(he),q&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var he=ce.props.autoSize;if(!he||!ce.textArea)return;var J=he.minRows,se=he.maxRows,q=W(ce.textArea,!1,J,se);ce.setState({textareaStyles:q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:H.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:H.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var he=ce.props,J=he.prefixCls,se=J===void 0?"rc-textarea":J,q=he.autoSize,ye=he.onResize,Se=he.className,me=he.disabled,we=ce.state,_e=we.textareaStyles,ke=we.resizeStatus,Ie=Object(l.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=g()(se,Se,Object(F.a)({},"".concat(se,"-disabled"),me));"value"in Ie&&(Ie.value=Ie.value||"");var Le=Object(B.a)(Object(B.a)(Object(B.a)({},ce.props.style),_e),ke===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ce.handleResize,disabled:!(q||ye)},R.createElement("textarea",Object(ne.a)({},Ie,{className:De,style:Le,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:H.NONE},ce}return Object(L.a)(pe,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!k()(ce.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 ce=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,he)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(R.Component),Z=X,te=function(fe){Object(G.a)(pe,fe);var Te=Object(I.a)(pe);function pe(ge){var ce;Object(V.a)(this,pe),ce=Te.call(this,ge),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(J){ce.resizableTextArea=J},ce.handleChange=function(J){var se=ce.props.onChange;ce.setValue(J.target.value,function(){ce.resizableTextArea.resizeTextarea()}),se&&se(J)},ce.handleKeyDown=function(J){var se=ce.props,q=se.onPressEnter,ye=se.onKeyDown;J.keyCode===13&&q&&q(J),ye&&ye(J)};var he=typeof ge.value=="undefined"||ge.value===null?ge.defaultValue:ge.value;return ce.state={value:he},ce}return Object(L.a)(pe,[{key:"setValue",value:function(ce,he){"value"in this.props||this.setState({value:ce},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(Z,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),pe}(R.Component),Ee=Qe.default=te},YiJy:function(lt,Qe,oe){lt.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return E});var ne=oe("k1fw"),V=oe("miYZ"),L=oe("tsqr"),G=oe("rAM+"),I=oe("tJVT"),R=oe("PpiC"),B=oe("cDcd"),F=oe.n(B),_=oe("bdgK");function D(f,m,w,b,h){var c=m.getWordUntilPosition(w),l={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=b.map(function(g){return{label:g,kind:f.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:l}});return h.map(function(g){a.push(Object(ne.a)(Object(ne.a)({},g),{},{range:l}))}),a}var T=function(f){var m={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(l,a){var g=D(f,l,a,w,[m]);return{suggestions:g}}});var b=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(l,a){var g=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=D(f,l,a,b,g);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(l,a){var g=[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=D(f,l,a,h,g);return{suggestions:p}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=oe("LvDl");function C(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function S(){}var y=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=f;if(Array.isArray(f)){for(var w=0;w<f.length;w++){var b=d[f[w]];if(b)return b}return m[0]}return d[m]||m}var s=null,u=Qe.b=function(f){var m=f.width,w=m===void 0?"100%":m,b=f.height,h=b===void 0?"100%":b,c=f.value,l=f.language,a=l===void 0?"javascript":l,g=f.style,p=g===void 0?{}:g,v=f.options,M=v===void 0?{}:v,U=f.overrideServices,j=U===void 0?{}:U,W=f.theme,O=W===void 0?"vs-dark":W,k=f.onEditBlur,H=f.onSave,X=f.autoHeight,Z=X===void 0?!1:X,te=f.forbidCopy,Ee=te===void 0?!1:te,fe=f.onChange,Te=fe===void 0?S:fe,pe=f.editorDidMount,ge=pe===void 0?S:pe,ce=f.onFocus,he=ce===void 0?S:ce,J=f.filename,se=J===void 0?"educoder.txt":J,q=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ye=Object(B.useRef)(),Se=Object(B.useRef)({}),me=Object(B.useRef)(),we=Object(B.useRef)(!1),_e=Object(B.useRef)(),ke=Object(B.useState)(!1),Ie=Object(I.a)(ke,2),De=Ie[0],Le=Ie[1];function ze(){var ee;return ye.current&&(ee=new _.default(function(re){var be=Object(G.a)(re),Ce;try{for(be.s();!(Ce=be.n()).done;){var Me=Ce.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(tt){be.e(tt)}finally{be.f()}}),ee.observe(ye.current)),ee}function Ye(){L.b.warn(decodeURIComponent(A))}var Ve=function(){var re=Se.current.instance;if(c!=null&&re&&De){var be=re.getModel();be&&c!==be.getValue()&&(y=!0,be.setValue(c),re.layout(),y=!1)}};Object(B.useEffect)(function(){me.current&&clearTimeout(me.current),me.current=setTimeout(function(){Ve()},500)},[c,De,Se.current]);function je(){var ee=Se.current.instance;if(ee){var re=ee.getSelection(),be=Se.current.pastePos||{},Ce=new s.Range(be.startLineNumber||re.endLineNumber,be.startColumn||re.endColumn,be.endLineNumber||re.endLineNumber,be.endColumn||re.endColumn);setTimeout(function(){ee.executeEdits("",[{range:Ce,text:""}])},300)}}function Xe(ee){(window.navigator.platform.match("Mac")?ee.metaKey:ee.ctrlKey)&&ee.keyCode==83&&(ee.preventDefault(),H())}var Be=function(){if(Z&&Se.current.instance){var re=Se.current.instance.getContentHeight();$(re<h?h:re)}else $(h)};function He(ee){var re=document.createEvent("MouseEvents");re.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ee.dispatchEvent(re)}function Ae(ee,re){var be=window.URL||window.webkitURL||window,Ce=new Blob([re]),Me=document.createElementNS("http://www.w3.org/1999/xhtml","a");Me.href=be.createObjectURL(Ce),Me.download=ee,He(Me)}Object(B.useEffect)(function(){Be()},[Be]),Object(B.useEffect)(function(){ye.current&&!De&&oe.e(27).then(oe.t.bind(null,"M/lh",7)).then(function(ee){try{s=ee,Se.current.instance=s.editor.create(ye.current,{value:c,language:o(a),theme:O,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var re=Se.current.instance;if(ge(re,s),setTimeout(function(){Be(),Se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ae(se||"educoder.txt",re.getValue())}})},500),Se.current.subscription=re.onDidChangeModelContent(function(Ce){we.current?clearTimeout(_e.current):(Be(),Te(re.getValue(),Ce)),_e.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||T(s),Ee&&(re.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ye(),null}),re.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ye(),null})),window.Monaco=s,k&&re.onDidBlurEditorWidget(function(){k(re.getValue())}),he&&re.onDidFocusEditorText(function(){he(re.getValue())}),Ee){re.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ye(),null}),re.onDidPaste(function(Ce){Se.current.pastePos=Ce});try{window.addEventListener("paste",je)}catch(Ce){}}var be=ze();return Le(!0),function(){var Ce=Se.current.instance;Ce.dispose();var Me=Ce.getModel();Me&&Me.dispose(),Se.current.subscription&&Se.current.subscription.dispose(),Ee&&window.removeEventListener("paste",je),be.unobserve(ye.current)}}catch(Ce){}})},[]),Object(B.useEffect)(function(){var ee=Se.current.instance;if(ee&&De)return document.addEventListener("keydown",Xe,!1),function(){document.removeEventListener("keydown",Xe)}},[H,De]),Object(B.useEffect)(function(){var ee=Se.current.instance;if(ee&&De){var re=o(a);s.editor.setModelLanguage(ee.getModel(),re),console.log("language:",a,ee.getModel(),re)}},[a,De]),Object(B.useEffect)(function(){var ee=Se.current.instance;ee&&De&&s.editor.setTheme(O)},[O,De]),Object(B.useEffect)(function(){var ee=Se.current.instance;ee&&De&&(ee.updateOptions(Object(ne.a)({},M)),setTimeout(function(){ee.getModel().updateOptions(Object(ne.a)({},M))},200))},[JSON.stringify(M),De]),Object(B.useEffect)(function(){var ee=Se.current.instance;ee&&De&&ee.layout()},[w,h,De]);var Ze=Object(B.useState)(C(w)),$e=Object(I.a)(Ze,2),Oe=$e[0],Fe=$e[1],ae=Object(B.useState)(C(h)),le=Object(I.a)(ae,2),ue=le[0],$=le[1],Q=Object(ne.a)(Object(ne.a)({},p),{},{width:Oe,height:ue});return F.a.createElement("div",{className:"my-monaco-editor",ref:ye,style:Q})};function E(f){var m=f.width,w=m===void 0?"100%":m,b=f.height,h=b===void 0?"100%":b,c=f.original,l=f.modified,a=f.language,g=f.options,p=g===void 0?{}:g,v=Object(B.useRef)(),M=Object(B.useState)(null),U=Object(I.a)(M,2),j=U[0],W=U[1];function O(Z){var te;return v.current&&(te=new _.default(function(Ee){var fe=Object(G.a)(Ee),Te;try{for(fe.s();!(Te=fe.n()).done;){var pe=Te.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&Z.layout()}}catch(ge){fe.e(ge)}finally{fe.f()}}),te.observe(v.current)),te}Object(B.useEffect)(function(){v.current&&oe.e(27).then(oe.t.bind(null,"M/lh",7)).then(function(Z){s=Z;var te=s.editor.createDiffEditor(v.current,Object(ne.a)(Object(ne.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}));W(te);var Ee=O(te);return function(){te.dispose();var fe=te.getModel();fe&&fe.dispose(),Ee.unobserve(v.current)}})},[]),Object(B.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(l,a)})},[c,l,a,j]);var k=C(w),H=C(h),X={width:k,height:H};return F.a.createElement("div",{className:"my-diff-editor",ref:v,style:X})}},ZpRC:function(lt,Qe,oe){"use strict";function ne(T){return typeof T=="object"&&T!=null&&T.nodeType===1}function V(T,A){return(!A||T!=="hidden")&&T!=="visible"&&T!=="clip"}function L(T,A){if(T.clientHeight<T.scrollHeight||T.clientWidth<T.scrollWidth){var P=getComputedStyle(T,null);return V(P.overflowY,A)||V(P.overflowX,A)||function(C){var S=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!S&&(S.clientHeight<C.scrollHeight||S.clientWidth<C.scrollWidth)}(T)}return!1}function G(T,A,P,C,S,y,d,o){return y<T&&d>A||y>T&&d<A?0:y<=T&&o<=P||d>=A&&o>=P?y-T-C:d>A&&o<P||y<T&&o>P?d-A+S:0}var I=function(T,A){var P=window,C=A.scrollMode,S=A.block,y=A.inline,d=A.boundary,o=A.skipOverflowHiddenElements,s=typeof d=="function"?d:function(_e){return _e!==d};if(!ne(T))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,E=[],f=T;ne(f)&&s(f);){if((f=f.parentElement)===u){E.push(f);break}f!=null&&f===document.body&&L(f)&&!L(document.documentElement)||f!=null&&L(f,o)&&E.push(f)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,w=P.visualViewport?P.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=T.getBoundingClientRect(),l=c.height,a=c.width,g=c.top,p=c.right,v=c.bottom,M=c.left,U=S==="start"||S==="nearest"?g:S==="end"?v:g+l/2,j=y==="center"?M+a/2:y==="end"?p:M,W=[],O=0;O<E.length;O++){var k=E[O],H=k.getBoundingClientRect(),X=H.height,Z=H.width,te=H.top,Ee=H.right,fe=H.bottom,Te=H.left;if(C==="if-needed"&&g>=0&&M>=0&&v<=w&&p<=m&&g>=te&&v<=fe&&M>=Te&&p<=Ee)return W;var pe=getComputedStyle(k),ge=parseInt(pe.borderLeftWidth,10),ce=parseInt(pe.borderTopWidth,10),he=parseInt(pe.borderRightWidth,10),J=parseInt(pe.borderBottomWidth,10),se=0,q=0,ye="offsetWidth"in k?k.offsetWidth-k.clientWidth-ge-he:0,Se="offsetHeight"in k?k.offsetHeight-k.clientHeight-ce-J:0;if(u===k)se=S==="start"?U:S==="end"?U-w:S==="nearest"?G(h,h+w,w,ce,J,h+U,h+U+l,l):U-w/2,q=y==="start"?j:y==="center"?j-m/2:y==="end"?j-m:G(b,b+m,m,ge,he,b+j,b+j+a,a),se=Math.max(0,se+h),q=Math.max(0,q+b);else{se=S==="start"?U-te-ce:S==="end"?U-fe+J+Se:S==="nearest"?G(te,fe,X,ce,J+Se,U,U+l,l):U-(te+X/2)+Se/2,q=y==="start"?j-Te-ge:y==="center"?j-(Te+Z/2)+ye/2:y==="end"?j-Ee+he+ye:G(Te,Ee,Z,ge,he+ye,j,j+a,a);var me=k.scrollLeft,we=k.scrollTop;U+=we-(se=Math.max(0,Math.min(we+se,k.scrollHeight-X+Se))),j+=me-(q=Math.max(0,Math.min(me+q,k.scrollWidth-Z+ye)))}W.push({el:k,top:se,left:q})}return W};function R(T){return T===Object(T)&&Object.keys(T).length!==0}function B(T,A){A===void 0&&(A="auto");var P="scrollBehavior"in document.body.style;T.forEach(function(C){var S=C.el,y=C.top,d=C.left;S.scroll&&P?S.scroll({top:y,left:d,behavior:A}):(S.scrollTop=y,S.scrollLeft=d)})}function F(T){return T===!1?{block:"end",inline:"nearest"}:R(T)?T:{block:"start",inline:"nearest"}}function _(T,A){var P=!T.ownerDocument.documentElement.contains(T);if(R(A)&&typeof A.behavior=="function")return A.behavior(P?[]:I(T,A));if(P)return;var C=F(A);return B(I(T,C),C.behavior)}var D=Qe.a=_},Zss7:function(lt,Qe,oe){var ne;(function(V){var L=/^\s+/,G=/\s+$/,I=0,R=V.round,B=V.min,F=V.max,_=V.random;function D(J,se){if(J=J||"",se=se||{},J instanceof D)return J;if(!(this instanceof D))return new D(J,se);var q=T(J);this._originalInput=J,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=R(100*this._a)/100,this._format=se.format||q.format,this._gradientType=se.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=q.ok,this._tc_id=I++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),se,q,ye,Se,me,we;return se=J.r/255,q=J.g/255,ye=J.b/255,se<=.03928?Se=se/12.92:Se=V.pow((se+.055)/1.055,2.4),q<=.03928?me=q/12.92:me=V.pow((q+.055)/1.055,2.4),ye<=.03928?we=ye/12.92:we=V.pow((ye+.055)/1.055,2.4),.2126*Se+.7152*me+.0722*we},setAlpha:function(J){return this._a=W(J),this._roundA=R(100*this._a)/100,this},toHsv:function(){var J=S(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=S(this._r,this._g,this._b),se=R(J.h*360),q=R(J.s*100),ye=R(J.v*100);return this._a==1?"hsv("+se+", "+q+"%, "+ye+"%)":"hsva("+se+", "+q+"%, "+ye+"%, "+this._roundA+")"},toHsl:function(){var J=P(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=P(this._r,this._g,this._b),se=R(J.h*360),q=R(J.s*100),ye=R(J.l*100);return this._a==1?"hsl("+se+", "+q+"%, "+ye+"%)":"hsla("+se+", "+q+"%, "+ye+"%, "+this._roundA+")"},toHex:function(J){return d(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(O(this._r,255)*100)+"%",g:R(O(this._g,255)*100)+"%",b:R(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%)":"rgba("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var se="#"+s(this._r,this._g,this._b,this._a),q=se,ye=this._gradientType?"GradientType = 1, ":"";if(J){var Se=D(J);q="#"+s(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+ye+"startColorstr="+se+",endColorstr="+q+")"},toString:function(J){var se=!!J;J=J||this._format;var q=!1,ye=this._a<1&&this._a>=0,Se=!se&&ye&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Se?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(q=this.toRgbString()),J==="prgb"&&(q=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(q=this.toHexString()),J==="hex3"&&(q=this.toHexString(!0)),J==="hex4"&&(q=this.toHex8String(!0)),J==="hex8"&&(q=this.toHex8String()),J==="name"&&(q=this.toName()),J==="hsl"&&(q=this.toHslString()),J==="hsv"&&(q=this.toHsvString()),q||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(J,se){var q=J.apply(null,[this].concat([].slice.call(se)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(E,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function(J,se){return J.apply(null,[this].concat([].slice.call(se)))},analogous:function(){return this._applyCombination(p,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},D.fromRatio=function(J,se){if(typeof J=="object"){var q={};for(var ye in J)J.hasOwnProperty(ye)&&(ye==="a"?q[ye]=J[ye]:q[ye]=Ee(J[ye]));J=q}return D(J,se)};function T(J){var se={r:0,g:0,b:0},q=1,ye=null,Se=null,me=null,we=!1,_e=!1;return typeof J=="string"&&(J=ce(J)),typeof J=="object"&&(ge(J.r)&&ge(J.g)&&ge(J.b)?(se=A(J.r,J.g,J.b),we=!0,_e=String(J.r).substr(-1)==="%"?"prgb":"rgb"):ge(J.h)&&ge(J.s)&&ge(J.v)?(ye=Ee(J.s),Se=Ee(J.v),se=y(J.h,ye,Se),we=!0,_e="hsv"):ge(J.h)&&ge(J.s)&&ge(J.l)&&(ye=Ee(J.s),me=Ee(J.l),se=C(J.h,ye,me),we=!0,_e="hsl"),J.hasOwnProperty("a")&&(q=J.a)),q=W(q),{ok:we,format:J.format||_e,r:B(255,F(se.r,0)),g:B(255,F(se.g,0)),b:B(255,F(se.b,0)),a:q}}function A(J,se,q){return{r:O(J,255)*255,g:O(se,255)*255,b:O(q,255)*255}}function P(J,se,q){J=O(J,255),se=O(se,255),q=O(q,255);var ye=F(J,se,q),Se=B(J,se,q),me,we,_e=(ye+Se)/2;if(ye==Se)me=we=0;else{var ke=ye-Se;we=_e>.5?ke/(2-ye-Se):ke/(ye+Se);switch(ye){case J:me=(se-q)/ke+(se<q?6:0);break;case se:me=(q-J)/ke+2;break;case q:me=(J-se)/ke+4;break}me/=6}return{h:me,s:we,l:_e}}function C(J,se,q){var ye,Se,me;J=O(J,360),se=O(se,100),q=O(q,100);function we(Ie,De,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?Ie+(De-Ie)*6*Le:Le<1/2?De:Le<2/3?Ie+(De-Ie)*(2/3-Le)*6:Ie}if(se===0)ye=Se=me=q;else{var _e=q<.5?q*(1+se):q+se-q*se,ke=2*q-_e;ye=we(ke,_e,J+1/3),Se=we(ke,_e,J),me=we(ke,_e,J-1/3)}return{r:ye*255,g:Se*255,b:me*255}}function S(J,se,q){J=O(J,255),se=O(se,255),q=O(q,255);var ye=F(J,se,q),Se=B(J,se,q),me,we,_e=ye,ke=ye-Se;if(we=ye===0?0:ke/ye,ye==Se)me=0;else{switch(ye){case J:me=(se-q)/ke+(se<q?6:0);break;case se:me=(q-J)/ke+2;break;case q:me=(J-se)/ke+4;break}me/=6}return{h:me,s:we,v:_e}}function y(J,se,q){J=O(J,360)*6,se=O(se,100),q=O(q,100);var ye=V.floor(J),Se=J-ye,me=q*(1-se),we=q*(1-Se*se),_e=q*(1-(1-Se)*se),ke=ye%6,Ie=[q,we,me,me,_e,q][ke],De=[_e,q,q,we,me,me][ke],Le=[me,me,_e,q,q,we][ke];return{r:Ie*255,g:De*255,b:Le*255}}function d(J,se,q,ye){var Se=[te(R(J).toString(16)),te(R(se).toString(16)),te(R(q).toString(16))];return ye&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0):Se.join("")}function o(J,se,q,ye,Se){var me=[te(R(J).toString(16)),te(R(se).toString(16)),te(R(q).toString(16)),te(fe(ye))];return Se&&me[0].charAt(0)==me[0].charAt(1)&&me[1].charAt(0)==me[1].charAt(1)&&me[2].charAt(0)==me[2].charAt(1)&&me[3].charAt(0)==me[3].charAt(1)?me[0].charAt(0)+me[1].charAt(0)+me[2].charAt(0)+me[3].charAt(0):me.join("")}function s(J,se,q,ye){var Se=[te(fe(ye)),te(R(J).toString(16)),te(R(se).toString(16)),te(R(q).toString(16))];return Se.join("")}D.equals=function(J,se){return!J||!se?!1:D(J).toRgbString()==D(se).toRgbString()},D.random=function(){return D.fromRatio({r:_(),g:_(),b:_()})};function u(J,se){se=se===0?0:se||10;var q=D(J).toHsl();return q.s-=se/100,q.s=k(q.s),D(q)}function E(J,se){se=se===0?0:se||10;var q=D(J).toHsl();return q.s+=se/100,q.s=k(q.s),D(q)}function f(J){return D(J).desaturate(100)}function m(J,se){se=se===0?0:se||10;var q=D(J).toHsl();return q.l+=se/100,q.l=k(q.l),D(q)}function w(J,se){se=se===0?0:se||10;var q=D(J).toRgb();return q.r=F(0,B(255,q.r-R(255*-(se/100)))),q.g=F(0,B(255,q.g-R(255*-(se/100)))),q.b=F(0,B(255,q.b-R(255*-(se/100)))),D(q)}function b(J,se){se=se===0?0:se||10;var q=D(J).toHsl();return q.l-=se/100,q.l=k(q.l),D(q)}function h(J,se){var q=D(J).toHsl(),ye=(q.h+se)%360;return q.h=ye<0?360+ye:ye,D(q)}function c(J){var se=D(J).toHsl();return se.h=(se.h+180)%360,D(se)}function l(J){var se=D(J).toHsl(),q=se.h;return[D(J),D({h:(q+120)%360,s:se.s,l:se.l}),D({h:(q+240)%360,s:se.s,l:se.l})]}function a(J){var se=D(J).toHsl(),q=se.h;return[D(J),D({h:(q+90)%360,s:se.s,l:se.l}),D({h:(q+180)%360,s:se.s,l:se.l}),D({h:(q+270)%360,s:se.s,l:se.l})]}function g(J){var se=D(J).toHsl(),q=se.h;return[D(J),D({h:(q+72)%360,s:se.s,l:se.l}),D({h:(q+216)%360,s:se.s,l:se.l})]}function p(J,se,q){se=se||6,q=q||30;var ye=D(J).toHsl(),Se=360/q,me=[D(J)];for(ye.h=(ye.h-(Se*se>>1)+720)%360;--se;)ye.h=(ye.h+Se)%360,me.push(D(ye));return me}function v(J,se){se=se||6;for(var q=D(J).toHsv(),ye=q.h,Se=q.s,me=q.v,we=[],_e=1/se;se--;)we.push(D({h:ye,s:Se,v:me})),me=(me+_e)%1;return we}D.mix=function(J,se,q){q=q===0?0:q||50;var ye=D(J).toRgb(),Se=D(se).toRgb(),me=q/100,we={r:(Se.r-ye.r)*me+ye.r,g:(Se.g-ye.g)*me+ye.g,b:(Se.b-ye.b)*me+ye.b,a:(Se.a-ye.a)*me+ye.a};return D(we)},D.readability=function(J,se){var q=D(J),ye=D(se);return(V.max(q.getLuminance(),ye.getLuminance())+.05)/(V.min(q.getLuminance(),ye.getLuminance())+.05)},D.isReadable=function(J,se,q){var ye=D.readability(J,se),Se,me;me=!1,Se=he(q);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":me=ye>=4.5;break;case"AAlarge":me=ye>=3;break;case"AAAsmall":me=ye>=7;break}return me},D.mostReadable=function(J,se,q){var ye=null,Se=0,me,we,_e,ke;q=q||{},we=q.includeFallbackColors,_e=q.level,ke=q.size;for(var Ie=0;Ie<se.length;Ie++)me=D.readability(J,se[Ie]),me>Se&&(Se=me,ye=D(se[Ie]));return D.isReadable(J,ye,{level:_e,size:ke})||!we?ye:(q.includeFallbackColors=!1,D.mostReadable(J,["#fff","#000"],q))};var M=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=D.hexNames=j(M);function j(J){var se={};for(var q in J)J.hasOwnProperty(q)&&(se[J[q]]=q);return se}function W(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function O(J,se){X(J)&&(J="100%");var q=Z(J);return J=B(se,F(0,parseFloat(J))),q&&(J=parseInt(J*se,10)/100),V.abs(J-se)<1e-6?1:J%se/parseFloat(se)}function k(J){return B(1,F(0,J))}function H(J){return parseInt(J,16)}function X(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function Z(J){return typeof J=="string"&&J.indexOf("%")!=-1}function te(J){return J.length==1?"0"+J:""+J}function Ee(J){return J<=1&&(J=J*100+"%"),J}function fe(J){return V.round(parseFloat(J)*255).toString(16)}function Te(J){return H(J)/255}var pe=function(){var J="[-\\+]?\\d+%?",se="[-\\+]?\\d*\\.\\d+%?",q="(?:"+se+")|(?:"+J+")",ye="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Se="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+ye),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+ye),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+ye),hsva:new RegExp("hsva"+Se),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ge(J){return!!pe.CSS_UNIT.exec(J)}function ce(J){J=J.replace(L,"").replace(G,"").toLowerCase();var se=!1;if(M[J])J=M[J],se=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;return(q=pe.rgb.exec(J))?{r:q[1],g:q[2],b:q[3]}:(q=pe.rgba.exec(J))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=pe.hsl.exec(J))?{h:q[1],s:q[2],l:q[3]}:(q=pe.hsla.exec(J))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=pe.hsv.exec(J))?{h:q[1],s:q[2],v:q[3]}:(q=pe.hsva.exec(J))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=pe.hex8.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),a:Te(q[4]),format:se?"name":"hex8"}:(q=pe.hex6.exec(J))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),format:se?"name":"hex"}:(q=pe.hex4.exec(J))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),a:Te(q[4]+""+q[4]),format:se?"name":"hex8"}:(q=pe.hex3.exec(J))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),format:se?"name":"hex"}:!1}function he(J){var se,q;return J=J||{level:"AA",size:"small"},se=(J.level||"AA").toUpperCase(),q=(J.size||"small").toLowerCase(),se!=="AA"&&se!=="AAA"&&(se="AA"),q!=="small"&&q!=="large"&&(q="small"),{level:se,size:q}}lt.exports?lt.exports=D:!(ne=function(){return D}.call(Qe,oe,Qe,lt),ne!==void 0&&(lt.exports=ne))})(Math)},bT9E:function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return V});var ne=oe("VTBJ");function V(L,G){var I=Object(ne.a)({},L);return Array.isArray(G)&&G.forEach(function(R){delete I[R]}),I}},c5Ni:function(lt,Qe,oe){},dejd:function(lt,Qe,oe){},dmUQ:function(lt,Qe,oe){"use strict";var ne=oe("Ff2n"),V=oe("rePB"),L=oe("1OyB"),G=oe("vuIU"),I=oe("Ji7U"),R=oe("md7G"),B=oe("foSv"),F=oe("cDcd"),_=oe.n(F),D=oe("TSYQ"),T=oe.n(D),A=oe("4IlW");function P(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(l,v).enumerable})),g.push.apply(g,p)}return g}function C(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?P(Object(g),!0).forEach(function(p){Object(V.a)(l,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):P(Object(g)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(g,p))})}return l}function S(l){var a=y();return function(){var p=Object(B.a)(l),v;if(a){var M=Object(B.a)(this).constructor;v=Reflect.construct(p,arguments,M)}else v=p.apply(this,arguments);return Object(R.a)(this,v)}}function y(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,E=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},w=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},b=function(l){Object(I.a)(g,l);var a=S(g);function g(p){var v;Object(L.a)(this,g),v=a.call(this,p),v.onKeyDown=function(j){var W=v.props,O=W.onKeyDown,k=W.onPressEnter;if(j.keyCode===A.a.UP){var H=v.getRatio(j);v.up(j,H,null),v.stop()}else if(j.keyCode===A.a.DOWN){var X=v.getRatio(j);v.down(j,X,null),v.stop()}else j.keyCode===A.a.ENTER&&k&&k(j);if(v.recordCursorPosition(),v.lastKeyCode=j.keyCode,O){for(var Z=arguments.length,te=new Array(Z>1?Z-1:0),Ee=1;Ee<Z;Ee++)te[Ee-1]=arguments[Ee];O.apply(void 0,[j].concat(te))}},v.onKeyUp=function(j){var W=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),W){for(var O=arguments.length,k=new Array(O>1?O-1:0),H=1;H<O;H++)k[H-1]=arguments[H];W.apply(void 0,[j].concat(k))}},v.onChange=function(j){var W=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(j)),v.setState({inputValue:v.rawInput}),W(v.toNumber(v.rawInput))},v.onMouseUp=function(){var j=v.props.onMouseUp;v.recordCursorPosition(),j&&j.apply(void 0,arguments)},v.onFocus=function(){var j;v.setState({focused:!0}),(j=v.props).onFocus.apply(j,arguments)},v.onBlur=function(){var j=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var W=v.getCurrentValidValue(v.state.inputValue),O=v.setValue(W,d);if(j){var k=v.input.value,H=v.getInputDisplayValue({focus:!1,value:O});v.input.value=H&&Number(H),j.apply(void 0,arguments),v.input.value=k}},v.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},v.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},v.getPrecision=function(j){if(m(v.props.precision))return v.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var O=0;return W.indexOf(".")>=0&&(O=W.length-W.indexOf(".")-1),O},v.getInputDisplayValue=function(j){var W=j||v.state,O=W.focused,k=W.inputValue,H=W.value,X;O?X=k:X=v.toPrecisionAsStep(H),X==null&&(X="");var Z=v.formatWrapper(X);return m(v.props.decimalSeparator)&&(Z=Z.toString().replace(".",v.props.decimalSeparator)),Z},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(j){}},v.restoreByAfter=function(j){if(j===void 0)return!1;var W=v.input.value,O=W.lastIndexOf(j);if(O===-1)return!1;var k=v.cursorBefore.length;return v.lastKeyCode===A.a.DELETE&&v.cursorBefore.charAt(k-1)===j[0]?(v.fixCaret(k,k),!0):O+j.length===W.length?(v.fixCaret(O,O),!0):!1},v.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,O){var k=j.substring(O);return v.restoreByAfter(k)})},v.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(j,W,O){v.pressingUpOrDown=!0,v.step("down",j,W,O)},v.up=function(j,W,O){v.pressingUpOrDown=!0,v.step("up",j,W,O)},v.saveInput=function(j){v.input=j};var M=p.value;M===void 0&&(M=p.defaultValue),v.state={focused:p.autoFocus};var U=v.getValidValue(v.toNumber(M));return v.state=C(C({},v.state),{},{inputValue:v.toPrecisionAsStep(U),value:U}),v}return Object(G.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var M=this.props,U=M.value,j=M.onChange,W=M.max,O=M.min,k=this.state.focused;if(v){if(!w(v.value,U)||!w(v.max,W)||!w(v.min,O)){var H=k?U:this.getValidValue(U),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var Z="value"in this.props?U:this.state.value;"max"in this.props&&v.max!==W&&typeof Z=="number"&&Z>W&&j&&j(W),"min"in this.props&&v.min!==O&&typeof Z=="number"&&Z<O&&j&&j(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var te=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?te=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(te=this.cursorStart):te=this.input.value.length,this.fixCaret(te,te)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ee){}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(v){var M=v;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(v){var M=v.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(v);return isNaN(j)?v:(j<M&&(j=M),j>U&&(j=U),j)}},{key:"setValue",value:function(v,M){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),W=this.state.value,O=W===void 0?null:W,k=this.state.inputValue,H=k===void 0?null:k,X=typeof j=="number"?j.toFixed(U):"".concat(j),Z=j!==O||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(v)},M),Z&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,W=U.step;if(m(j))return j;var O=this.getPrecision(M),k=this.getPrecision(W),H=this.getPrecision(v);return v?Math.max(H,O+k):O+k}},{key:"getPrecisionFactor",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(v,M);return Math.pow(10,U)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var M=Math.abs(this.getMaxPrecision(v));return isNaN(M)?v.toString():Number(v).toFixed(M)}},{key:"toNumber",value:function(v){var M=this.props.precision,U=this.state.focused,j=v&&v.length>16&&U;return this.isNotCompleteNumber(v)||j?v:m(M)?Math.round(v*Math.pow(10,M))/Math.pow(10,M):Number(v)}},{key:"upStep",value:function(v,M){var U=this.props.step,j=this.getPrecisionFactor(v,M),W=Math.abs(this.getMaxPrecision(v,M)),O=((j*v+j*U*M)/j).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(v,M){var U=this.props.step,j=this.getPrecisionFactor(v,M),W=Math.abs(this.getMaxPrecision(v,M)),O=((j*v-j*U*M)/j).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(v,M){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var O=this.props;if(O.disabled)return;var k=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(k))return;var H=this["".concat(v,"Step")](k,j),X=H>O.max||H<O.min;if(H>O.max?H=O.max:H<O.min&&(H=O.min),this.setValue(H,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){U[v](M,j,!0)},W?u:E)}},{key:"fixCaret",value:function(v,M){if(v===void 0||M===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(v!==U||M!==j)&&this.input.setSelectionRange(v,M)}catch(W){}}},{key:"render",value:function(){var v,M=this.props,U=M.prefixCls,j=M.disabled,W=M.readOnly,O=M.useTouch,k=M.autoComplete,H=M.upHandler,X=M.downHandler,Z=M.className,te=M.max,Ee=M.min,fe=M.style,Te=M.title,pe=M.onMouseEnter,ge=M.onMouseLeave,ce=M.onMouseOver,he=M.onMouseOut,J=M.required,se=M.onClick,q=M.tabIndex,ye=M.type,Se=M.placeholder,me=M.id,we=M.inputMode,_e=M.pattern,ke=M.step,Ie=M.maxLength,De=M.autoFocus,Le=M.name,ze=M.onPaste,Ye=M.onInput,Ve=Object(ne.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),je=this.state,Xe=je.value,Be=je.focused,He=T()(U,(v={},Object(V.a)(v,Z,!!Z),Object(V.a)(v,"".concat(U,"-disabled"),j),Object(V.a)(v,"".concat(U,"-focused"),Be),v)),Ae={};Object.keys(Ve).forEach(function(re){(re.substr(0,5)==="data-"||re.substr(0,5)==="aria-"||re==="role")&&(Ae[re]=Ve[re])});var Ze=!W&&!j,$e=this.getInputDisplayValue(null),Oe=(Xe||Xe===0)&&(isNaN(Xe)||Number(Xe)>=te),Fe=(Xe||Xe===0)&&(isNaN(Xe)||Number(Xe)<=Ee),ae=Oe||j||W,le=Fe||j||W,ue=T()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(V.a)({},"".concat(U,"-handler-up-disabled"),ae)),$=T()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(V.a)({},"".concat(U,"-handler-down-disabled"),le)),Q=O?{onTouchStart:ae?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ae?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=O?{onTouchStart:le?d:this.down,onTouchEnd:this.stop}:{onMouseDown:le?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:He,style:fe,title:Te,onMouseEnter:pe,onMouseLeave:ge,onMouseOver:ce,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(U,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":ae,className:ue}),H||_.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),_.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:$}),X||_.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),_.a.createElement("div",{className:"".concat(U,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ee,"aria-valuemax":te,"aria-valuenow":Xe,required:J,type:ye,placeholder:Se,onPaste:ze,onClick:se,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:q,autoComplete:k,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:De,maxLength:Ie,readOnly:W,disabled:j,max:te,min:Ee,step:ke,name:Le,title:Te,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:_e,inputMode:we,onInput:Ye},Ae))))}}]),g}(_.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var h=b,c=Qe.a=h},h78n:function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return v});var ne=oe("cDcd"),V=oe.n(ne),L=oe("TSYQ"),G=oe.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(ne.useRef)()}),O=Object(ne.useRef)();return Object(ne.useEffect)(function(){var k=Date.now(),H=!1;Object.keys(W).forEach(function(X){var Z=W[X].current;if(!Z)return;H=!0;var te=Z.style;te.transitionDuration=".3s, .3s, .3s, .06s",O.current&&k-O.current<100&&(te.transitionDuration="0s, 0s")}),H&&(O.current=Date.now())}),[W]};function B(){return B=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(U[O]=W[O])}return U},B.apply(this,arguments)}function F(U,j){return P(U)||A(U,j)||D(U,j)||_()}function _(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(U,j){if(!U)return;if(typeof U=="string")return T(U,j);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return T(U,j)}function T(U,j){(j==null||j>U.length)&&(j=U.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=U[W];return O}function A(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],O=!0,k=!1,H=void 0;try{for(var X=U[Symbol.iterator](),Z;!(O=(Z=X.next()).done)&&!(W.push(Z.value),j&&W.length===j);O=!0);}catch(te){k=!0,H=te}finally{try{!O&&X.return!=null&&X.return()}finally{if(k)throw H}}return W}function P(U){if(Array.isArray(U))return U}function C(U,j){if(U==null)return{};var W=S(U,j),O,k;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(k=0;k<H.length;k++){if(O=H[k],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;W[O]=U[O]}}return W}function S(U,j){if(U==null)return{};var W={},O=Object.keys(U),k,H;for(H=0;H<O.length;H++){if(k=O[H],j.indexOf(k)>=0)continue;W[k]=U[k]}return W}var y=function(j){var W=j.className,O=j.percent,k=j.prefixCls,H=j.strokeColor,X=j.strokeLinecap,Z=j.strokeWidth,te=j.style,Ee=j.trailColor,fe=j.trailWidth,Te=j.transition,pe=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete pe.gapPosition;var ge=Array.isArray(O)?O:[O],ce=Array.isArray(H)?H:[H],he=R(ge),J=F(he,1),se=J[0],q=Z/2,ye=100-Z/2,Se="M ".concat(X==="round"?q:0,",").concat(q,`
|
|
L `).concat(X==="round"?ye:100,",").concat(q),me="0 0 100 ".concat(Z),we=0;return V.a.createElement("svg",B({className:G()("".concat(k,"-line"),W),viewBox:me,preserveAspectRatio:"none",style:te},pe),V.a.createElement("path",{className:"".concat(k,"-line-trail"),d:Se,strokeLinecap:X,stroke:Ee,strokeWidth:fe||Z,fillOpacity:"0"}),ge.map(function(_e,ke){var Ie={strokeDasharray:"".concat(_e,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=ce[ke]||ce[ce.length-1];return we+=_e,V.a.createElement("path",{key:ke,className:"".concat(k,"-line-path"),d:Se,strokeLinecap:X,stroke:De,strokeWidth:Z,fillOpacity:"0",ref:se[ke],style:Ie})}))};y.defaultProps=I;var d=y;function o(){return o=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(U[O]=W[O])}return U},o.apply(this,arguments)}function s(U,j){return w(U)||m(U,j)||E(U,j)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(U,j){if(!U)return;if(typeof U=="string")return f(U,j);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return f(U,j)}function f(U,j){(j==null||j>U.length)&&(j=U.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=U[W];return O}function m(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],O=!0,k=!1,H=void 0;try{for(var X=U[Symbol.iterator](),Z;!(O=(Z=X.next()).done)&&!(W.push(Z.value),j&&W.length===j);O=!0);}catch(te){k=!0,H=te}finally{try{!O&&X.return!=null&&X.return()}finally{if(k)throw H}}return W}function w(U){if(Array.isArray(U))return U}function b(U,j){if(U==null)return{};var W=h(U,j),O,k;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(k=0;k<H.length;k++){if(O=H[k],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;W[O]=U[O]}}return W}function h(U,j){if(U==null)return{};var W={},O=Object.keys(U),k,H;for(H=0;H<O.length;H++){if(k=O[H],j.indexOf(k)>=0)continue;W[k]=U[k]}return W}var c=0;function l(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function g(U,j,W,O){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-O/2,Z=0,te=-X,Ee=0,fe=-2*X;switch(H){case"left":Z=-X,te=0,Ee=2*X,fe=0;break;case"right":Z=X,te=0,Ee=-2*X,fe=0;break;case"bottom":te=X,fe=2*X;break;default:}var Te="M 50,50 m ".concat(Z,",").concat(te,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(Ee,",").concat(-fe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-Ee,",").concat(fe),pe=Math.PI*2*X,ge={stroke:W,strokeDasharray:"".concat(j/100*(pe-k),"px ").concat(pe,"px"),strokeDashoffset:"-".concat(k/2+U/100*(pe-k),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:ge}}var p=function(j){var W=j.prefixCls,O=j.strokeWidth,k=j.trailWidth,H=j.gapDegree,X=j.gapPosition,Z=j.trailColor,te=j.strokeLinecap,Ee=j.style,fe=j.className,Te=j.strokeColor,pe=j.percent,ge=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ce=Object(ne.useMemo)(function(){return c+=1,c},[]),he=g(0,100,Z,O,H,X),J=he.pathString,se=he.pathStyle,q=a(pe),ye=a(Te),Se=ye.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),me=R(q),we=s(me,1),_e=we[0],ke=function(){var De=0;return q.map(function(Le,ze){var Ye=ye[ze]||ye[ye.length-1],Ve=Object.prototype.toString.call(Ye)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ce,")"):"",je=g(De,Le,Ye,O,H,X);return De+=Le,V.a.createElement("path",{key:ze,className:"".concat(W,"-circle-path"),d:je.pathString,stroke:Ve,strokeLinecap:te,strokeWidth:O,opacity:Le===0?0:1,fillOpacity:"0",style:je.pathStyle,ref:_e[ze]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),fe),viewBox:"0 0 100 100",style:Ee},ge),Se&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ce),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(Ie,De){return l(Ie)-l(De)}).map(function(Ie,De){return V.a.createElement("stop",{key:De,offset:Ie,stopColor:Se[Ie]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:Z,strokeLinecap:te,strokeWidth:k||O,fillOpacity:"0",style:se}),ke().reverse())};p.defaultProps=I;var v=p,M={Line:d,Circle:v}},kSUc:function(lt,Qe,oe){},lZu9:function(lt,Qe,oe){(function(ne){ne(oe("VrN/"),oe("1eCo"),oe("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function(V,L){var G=ne.getMode(V,"text/html"),I=G.name=="null";function R(O){if(ne.findModeByName){var k=ne.findModeByName(O);k&&(O=k.mime||k.mimes[0])}var H=ne.getMode(V,O);return H.name=="null"?null:H}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var F in B)B.hasOwnProperty(F)&&L.tokenTypeOverrides[F]&&(B[F]=L.tokenTypeOverrides[F]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,T=/^\[(x| )\](?=\s)/i,A=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(O,k,H){return k.f=k.inline=H,H(O,k)}function u(O,k,H){return k.f=k.block=H,H(O,k)}function E(O){return!O||!/\S/.test(O.string)}function f(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==w){var k=I;if(!k){var H=ne.innerMode(G,O.htmlState);k=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}k&&(O.f=l,O.block=m,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function m(O,k){var H=O.column()===k.indentation,X=E(k.prevLine.stream),Z=k.indentedCode,te=k.prevLine.hr,Ee=k.list!==!1,fe=(k.listStack[k.listStack.length-1]||0)+3;k.indentedCode=!1;var Te=k.indentation;if(k.indentationDiff===null&&(k.indentationDiff=k.indentation,Ee)){for(k.list=null;Te<k.listStack[k.listStack.length-1];)k.listStack.pop(),k.listStack.length?k.indentation=k.listStack[k.listStack.length-1]:k.list=!1;k.list!==!1&&(k.indentationDiff=Te-k.listStack[k.listStack.length-1])}var pe=!X&&!te&&!k.prevLine.header&&(!Ee||!Z)&&!k.prevLine.fencedCodeEnd,ge=(k.list===!1||te||X)&&k.indentation<=fe&&O.match(_),ce=null;if(k.indentationDiff>=4&&(Z||k.prevLine.fencedCodeEnd||k.prevLine.header||X))return O.skipToEnd(),k.indentedCode=!0,B.code;if(O.eatSpace())return null;if(H&&k.indentation<=fe&&(ce=O.match(A))&&ce[1].length<=6)return k.quote=0,k.header=ce[1].length,k.thisLine.header=!0,L.highlightFormatting&&(k.formatting="header"),k.f=k.inline,h(k);if(k.indentation<=fe&&O.eat(">"))return k.quote=H?1:k.quote+1,L.highlightFormatting&&(k.formatting="quote"),O.eatSpace(),h(k);if(!ge&&!k.setext&&H&&k.indentation<=fe&&(ce=O.match(D))){var he=ce[1]?"ol":"ul";return k.indentation=Te+O.current().length,k.list=!0,k.quote=0,k.listStack.push(k.indentation),k.em=!1,k.strong=!1,k.code=!1,k.strikethrough=!1,L.taskLists&&O.match(T,!1)&&(k.taskList=!0),k.f=k.inline,L.highlightFormatting&&(k.formatting=["list","list-"+he]),h(k)}else{if(H&&k.indentation<=fe&&(ce=O.match(S,!0)))return k.quote=0,k.fencedEndRE=new RegExp(ce[1]+"+ *$"),k.localMode=L.fencedCodeBlockHighlighting&&R(ce[2]||L.fencedCodeBlockDefaultMode),k.localMode&&(k.localState=ne.startState(k.localMode)),k.f=k.block=b,L.highlightFormatting&&(k.formatting="code-block"),k.code=-1,h(k);if(k.setext||(!pe||!Ee)&&!k.quote&&k.list===!1&&!k.code&&!ge&&!y.test(O.string)&&(ce=O.lookAhead(1))&&(ce=ce.match(P)))return k.setext?(k.header=k.setext,k.setext=0,O.skipToEnd(),L.highlightFormatting&&(k.formatting="header")):(k.header=ce[0].charAt(0)=="="?1:2,k.setext=k.header),k.thisLine.header=!0,k.f=k.inline,h(k);if(ge)return O.skipToEnd(),k.hr=!0,k.thisLine.hr=!0,B.hr;if(O.peek()==="[")return s(O,k,M)}return s(O,k,k.inline)}function w(O,k){var H=G.token(O,k.htmlState);if(!I){var X=ne.innerMode(G,k.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||k.md_inside&&O.current().indexOf(">")>-1)&&(k.f=l,k.block=m,k.htmlState=null)}return H}function b(O,k){var H=k.listStack[k.listStack.length-1]||0,X=k.indentation<H,Z=H+3;if(k.fencedEndRE&&k.indentation<=Z&&(X||O.match(k.fencedEndRE))){L.highlightFormatting&&(k.formatting="code-block");var te;return X||(te=h(k)),k.localMode=k.localState=null,k.block=m,k.f=l,k.fencedEndRE=null,k.code=0,k.thisLine.fencedCodeEnd=!0,X?u(O,k,k.block):te}else return k.localMode?k.localMode.token(O,k.localState):(O.skipToEnd(),B.code)}function h(O){var k=[];if(O.formatting){k.push(B.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var H=0;H<O.formatting.length;H++)k.push(B.formatting+"-"+O.formatting[H]),O.formatting[H]==="header"&&k.push(B.formatting+"-"+O.formatting[H]+"-"+O.header),O.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=O.quote?k.push(B.formatting+"-"+O.formatting[H]+"-"+O.quote):k.push("error"))}if(O.taskOpen)return k.push("meta"),k.length?k.join(" "):null;if(O.taskClosed)return k.push("property"),k.length?k.join(" "):null;if(O.linkHref?k.push(B.linkHref,"url"):(O.strong&&k.push(B.strong),O.em&&k.push(B.em),O.strikethrough&&k.push(B.strikethrough),O.emoji&&k.push(B.emoji),O.linkText&&k.push(B.linkText),O.code&&k.push(B.code),O.image&&k.push(B.image),O.imageAltText&&k.push(B.imageAltText,"link"),O.imageMarker&&k.push(B.imageMarker)),O.header&&k.push(B.header,B.header+"-"+O.header),O.quote&&(k.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=O.quote?k.push(B.quote+"-"+O.quote):k.push(B.quote+"-"+L.maxBlockquoteDepth)),O.list!==!1){var X=(O.listStack.length-1)%3;X?X===1?k.push(B.list2):k.push(B.list3):k.push(B.list1)}return O.trailingSpaceNewLine?k.push("trailing-space-new-line"):O.trailingSpace&&k.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),k.length?k.join(" "):null}function c(O,k){return O.match(C,!0)?h(k):void 0}function l(O,k){var H=k.text(O,k);if(typeof H!="undefined")return H;if(k.list)return k.list=null,h(k);if(k.taskList){var X=O.match(T,!0)[1]===" ";return X?k.taskOpen=!0:k.taskClosed=!0,L.highlightFormatting&&(k.formatting="task"),k.taskList=!1,h(k)}if(k.taskOpen=!1,k.taskClosed=!1,k.header&&O.match(/^#+$/,!0))return L.highlightFormatting&&(k.formatting="header"),h(k);var Z=O.next();if(k.linkTitle){k.linkTitle=!1;var te=Z;Z==="("&&(te=")"),te=(te+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ee="^\\s*(?:[^"+te+"\\\\]+|\\\\\\\\|\\\\.)"+te;if(O.match(new RegExp(Ee),!0))return B.linkHref}if(Z==="`"){var fe=k.formatting;L.highlightFormatting&&(k.formatting="code"),O.eatWhile("`");var Te=O.current().length;if(k.code==0&&(!k.quote||Te==1))return k.code=Te,h(k);if(Te==k.code){var pe=h(k);return k.code=0,pe}else return k.formatting=fe,h(k)}else if(k.code)return h(k);if(Z==="\\"&&(O.next(),L.highlightFormatting)){var ge=h(k),ce=B.formatting+"-escape";return ge?ge+" "+ce:ce}if(Z==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return k.imageMarker=!0,k.image=!0,L.highlightFormatting&&(k.formatting="image"),h(k);if(Z==="["&&k.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return k.imageMarker=!1,k.imageAltText=!0,L.highlightFormatting&&(k.formatting="image"),h(k);if(Z==="]"&&k.imageAltText){L.highlightFormatting&&(k.formatting="image");var ge=h(k);return k.imageAltText=!1,k.image=!1,k.inline=k.f=g,ge}if(Z==="["&&!k.image)return k.linkText&&O.match(/^.*?\]/)||(k.linkText=!0,L.highlightFormatting&&(k.formatting="link")),h(k);if(Z==="]"&&k.linkText){L.highlightFormatting&&(k.formatting="link");var ge=h(k);return k.linkText=!1,k.inline=k.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?g:l,ge}if(Z==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var ge=h(k);return ge?ge+=" ":ge="",ge+B.linkInline}if(Z==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var ge=h(k);return ge?ge+=" ":ge="",ge+B.linkEmail}if(L.xml&&Z==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=O.string.indexOf(">",O.pos);if(he!=-1){var J=O.string.substring(O.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(k.md_inside=!0)}return O.backUp(1),k.htmlState=ne.startState(G),u(O,k,w)}if(L.xml&&Z==="<"&&O.match(/^\/\w*?>/))return k.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var se=1,q=O.pos==1?" ":O.string.charAt(O.pos-2);se<3&&O.eat(Z);)se++;var ye=O.peek()||" ",Se=!/\s/.test(ye)&&(!d.test(ye)||/\s/.test(q)||d.test(q)),me=!/\s/.test(q)&&(!d.test(q)||/\s/.test(ye)||d.test(ye)),we=null,_e=null;if(se%2&&(!k.em&&Se&&(Z==="*"||!me||d.test(q))?we=!0:k.em==Z&&me&&(Z==="*"||!Se||d.test(ye))&&(we=!1)),se>1&&(!k.strong&&Se&&(Z==="*"||!me||d.test(q))?_e=!0:k.strong==Z&&me&&(Z==="*"||!Se||d.test(ye))&&(_e=!1)),_e!=null||we!=null){L.highlightFormatting&&(k.formatting=we==null?"strong":_e==null?"em":"strong em"),we===!0&&(k.em=Z),_e===!0&&(k.strong=Z);var pe=h(k);return we===!1&&(k.em=!1),_e===!1&&(k.strong=!1),pe}}else if(Z===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return h(k);O.backUp(1)}if(L.strikethrough){if(Z==="~"&&O.eatWhile(Z)){if(k.strikethrough){L.highlightFormatting&&(k.formatting="strikethrough");var pe=h(k);return k.strikethrough=!1,pe}else if(O.match(/^[^\s]/,!1))return k.strikethrough=!0,L.highlightFormatting&&(k.formatting="strikethrough"),h(k)}else if(Z===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return h(k);O.backUp(2)}}if(L.emoji&&Z===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){k.emoji=!0,L.highlightFormatting&&(k.formatting="emoji");var ke=h(k);return k.emoji=!1,ke}return Z===" "&&(O.match(/^ +$/,!1)?k.trailingSpace++:k.trailingSpace&&(k.trailingSpaceNewLine=!0)),h(k)}function a(O,k){var H=O.next();if(H===">"){k.f=k.inline=l,L.highlightFormatting&&(k.formatting="link");var X=h(k);return X?X+=" ":X="",X+B.linkInline}return O.match(/^[^>]+/,!0),B.linkInline}function g(O,k){if(O.eatSpace())return null;var H=O.next();return H==="("||H==="["?(k.f=k.inline=v(H==="("?")":"]"),L.highlightFormatting&&(k.formatting="link-string"),k.linkHref=!0,h(k)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(O){return function(k,H){var X=k.next();if(X===O){H.f=H.inline=l,L.highlightFormatting&&(H.formatting="link-string");var Z=h(H);return H.linkHref=!1,Z}return k.match(p[O]),H.linkHref=!0,h(H)}}function M(O,k){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(k.f=U,O.next(),L.highlightFormatting&&(k.formatting="link"),k.linkText=!0,h(k)):s(O,k,l)}function U(O,k){if(O.match(/^\]:/,!0)){k.f=k.inline=j,L.highlightFormatting&&(k.formatting="link");var H=h(k);return k.linkText=!1,H}return O.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(O,k){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?k.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),k.f=k.inline=l,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&ne.copyState(G,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?ne.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,k){if(k.formatting=!1,O!=k.thisLine.stream){if(k.header=0,k.hr=!1,O.match(/^\s*$/,!0))return f(k),null;if(k.prevLine=k.thisLine,k.thisLine={stream:O},k.taskList=!1,k.trailingSpace=0,k.trailingSpaceNewLine=!1,!k.localState&&(k.f=k.block,k.f!=w)){var H=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(k.indentation=H,k.indentationDiff=null,H>0)return null}}return k.f(O,k)},innerMode:function(O){return O.block==w?{state:O.htmlState,mode:G}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:W}},indent:function(O,k,H){return O.block==w&&G.indent?G.indent(O.htmlState,k,H):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,k,H):ne.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},osHv:function(lt,Qe,oe){(function(ne){ne(oe("VrN/"))})(function(ne){"use strict";var V=ne.Pos;function L(d,o){return d.line-o.line||d.ch-o.ch}var G="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(d,o,s,u){this.line=o,this.ch=s,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function F(d,o){var s=d.cm.getTokenTypeAt(V(d.line,o));return s&&/\btag\b/.test(s)}function _(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function D(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function T(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(_(d))continue;return}if(!F(d,o+1)){d.ch=o+1;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function A(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(D(d))continue;return}if(!F(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var s=R.exec(d.text);if(s&&s.index==o)return s}}function P(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(_(d))continue;return}if(!F(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(D(d))continue;return}if(!F(d,o+1)){d.ch=o;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function S(d,o){for(var s=[];;){var u=P(d),E,f=d.line,m=d.ch-(u?u[0].length:0);if(!u||!(E=T(d)))return;if(E=="selfClose")continue;if(u[1]){for(var w=s.length-1;w>=0;--w)if(s[w]==u[2]){s.length=w;break}if(w<0&&(!o||o==u[2]))return{tag:u[2],from:V(f,m),to:V(d.line,d.ch)}}else s.push(u[2])}}function y(d,o){for(var s=[];;){var u=C(d);if(!u)return;if(u=="selfClose"){A(d);continue}var E=d.line,f=d.ch,m=A(d);if(!m)return;if(m[1])s.push(m[2]);else{for(var w=s.length-1;w>=0;--w)if(s[w]==m[2]){s.length=w;break}if(w<0&&(!o||o==m[2]))return{tag:m[2],from:V(d.line,d.ch),to:V(E,f)}}}}ne.registerHelper("fold","xml",function(d,o){for(var s=new B(d,o.line,0);;){var u=P(s);if(!u||s.line!=o.line)return;var E=T(s);if(!E)return;if(!u[1]&&E!="selfClose"){var f=V(s.line,s.ch),m=S(s,u[2]);return m&&L(m.from,f)>0?{from:f,to:m.from}:null}}}),ne.findMatchingTag=function(d,o,s){var u=new B(d,o.line,o.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var E=T(u),f=E&&V(u.line,u.ch),m=E&&A(u);if(!E||!m||L(u,o)>0)return;var w={from:V(u.line,u.ch),to:f,tag:m[2]};return E=="selfClose"?{open:w,close:null,at:"open"}:m[1]?{open:y(u,m[2]),close:w,at:"close"}:(u=new B(d,f.line,f.ch,s),{open:w,close:S(u,m[2]),at:"open"})},ne.findEnclosingTag=function(d,o,s,u){for(var E=new B(d,o.line,o.ch,s);;){var f=y(E,u);if(!f)break;var m=new B(d,o.line,o.ch,s),w=S(m,f.tag);if(w)return{open:f,close:w}}},ne.scanForClosingTag=function(d,o,s,u){var E=new B(d,o.line,o.ch,u?{from:0,to:u}:null);return S(E,s)}})},p5ED:function(lt,Qe,oe){"use strict";var ne=oe("+L6B"),V=oe("2/Rp"),L=oe("5Dmo"),G=oe("3S7+"),I=oe("k1fw"),R=oe("tJVT"),B=oe("cDcd"),F=oe.n(B),_=oe("vHTk"),D=oe.n(_),T=oe("yEEn"),A=oe("ZW9T"),P=oe("1vsH");Qe.a=function(C){var S=C.name,y=C.data,d=C.theme,o=C.type,s=C.filename,u=C.monacoEditor,E=C.className,f=C.style,m=C.close,w=C.onClose,b=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],g=Object(B.useState)(""),p=Object(R.a)(g,2),v=p[0],M=p[1],U=Object(B.useRef)();s&&(u.filename=s),Object(B.useEffect)(function(){var O,k,H=(O=document.cookie)===null||O===void 0||((k=O.replace(/\s/g,""))===null||k===void 0)?void 0:k.split(";");H==null||H.map(function(X){var Z=X.split("=");Z[0]==="_educoder_session"&&M(Z[1])})},[]);var j=function(){if(y.startsWith("http")||y.startsWith("/")){W();return}Object(P.x)(s||"educoder",y,s)},W=function(){Object(P.v)(s||S,y)};return console.log("data:",y,"fileanme:",s," name:",S),F.a.createElement("div",{style:Object(I.a)({},f||{}),className:"".concat(b&&D.a.bgBlack," ").concat(o?D.a.wrp:"hide")},m&&F.a.createElement("div",{className:D.a.close,ref:U},F.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},F.a.createElement("span",{onClick:W},F.a.createElement("i",{className:"icon-quxiaozhiding"}))),F.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},F.a.createElement("span",{className:"",onClick:w},F.a.createElement("i",{className:"icon-guanbi1"})))),F.a.createElement("div",{className:"".concat(D.a[E]," ").concat(E," ").concat(D.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&F.a.createElement(A.b,u)),o==="audio"&&F.a.createElement("audio",{src:"".concat(y!=null&&y.startsWith("/")||(y==null?void 0:y.indexOf("https://"))>-1?y:"data:audio/mp3;base64,").concat(y),autoPlay:!0}),o==="video"&&F.a.createElement(F.a.Fragment,null,y!=null&&y.startsWith("/")?F.a.createElement("video",{controls:!0,src:"".concat(y),autoPlay:!0}):F.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(y),autoPlay:!0})),o==="pdf"&&F.a.createElement("embed",{className:D.a.embed,src:y}),o==="image"&&F.a.createElement(F.a.Fragment,null,F.a.createElement("img",{src:"".concat(y!=null&&y.startsWith("/")||(y==null?void 0:y.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(y)})),o==="other"&&F.a.createElement("div",null,F.a.createElement(V.a,{type:"primary",size:"large",onClick:j},F.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&F.a.createElement(V.a,{type:"primary",size:"large",onClick:j},F.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(lt,Qe,oe){},"rAM+":function(lt,Qe,oe){"use strict";oe.d(Qe,"a",function(){return V});var ne=oe("Qw5x");function V(L,G){var I;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(I=Object(ne.a)(L))||G&&L&&typeof L.length=="number"){I&&(L=I);var R=0,B=function(){};return{s:B,n:function(){return R>=L.length?{done:!0}:{done:!1,value:L[R++]}},e:function(A){throw A},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var F=!0,_=!1,D;return{s:function(){I=L[Symbol.iterator]()},n:function(){var A=I.next();return F=A.done,A},e:function(A){_=!0,D=A},f:function(){try{!F&&I.return!=null&&I.return()}finally{if(_)throw D}}}}},rUJ1:function(lt,Qe){const oe=/[&<>"']/,ne=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>G[b];function R(b,h){if(h){if(oe.test(b))return b.replace(ne,I)}else if(V.test(b))return b.replace(L,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(b){return b.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const _=/(^|[^\[])\^/g;function D(b,h){b=b.source||b,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(_,"$1"),b=b.replace(l,a),c),getRegex:()=>new RegExp(b,h)};return c}const T=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(b,h,c){if(b){let l;try{l=decodeURIComponent(F(c)).replace(T,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!A.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},S=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,h){C[" "+b]||(S.test(b)?C[" "+b]=b+"/":C[" "+b]=f(b,"/",!0)),b=C[" "+b];const c=b.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:b.replace(y,"$1")+h:h.charAt(0)==="/"?c?h:b.replace(d,"$1")+h:b+h}const s={exec:function(){}};function u(b){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(b[l]=c[l])}return b}function E(b,h){const c=b.replace(/\|/g,(g,p,v)=>{let M=!1,U=p;for(;--U>=0&&v[U]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function f(b,h,c){const l=b.length;if(l===0)return"";let a=0;for(;a<l;){const g=b.charAt(l-a-1);if(g===h&&!c)a++;else if(g!==h&&c)a++;else break}return b.substr(0,l-a)}function m(b,h){if(b.indexOf(h[1])===-1)return-1;const c=b.length;let l=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===h[0])l++;else if(b[a]===h[1]&&(l--,l<0))return a;return-1}function w(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}lt.exports={escape:R,unescape:F,edit:D,cleanUrl:P,resolveUrl:o,noopTest:s,merge:u,splitCells:E,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:w}},ulZh:function(lt,Qe,oe){typeof window!="undefined"&&function(V,L){lt.exports=L()}(this,function(){return function(ne){var V={};function L(G){if(V[G])return V[G].exports;var I=V[G]={i:G,l:!1,exports:{}};return ne[G].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=ne,L.c=V,L.d=function(G,I,R){L.o(G,I)||Object.defineProperty(G,I,{enumerable:!0,get:R})},L.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},L.t=function(G,I){if(I&1&&(G=L(G)),I&8)return G;if(I&4&&typeof G=="object"&&G&&G.__esModule)return G;var R=Object.create(null);if(L.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:G}),I&2&&typeof G!="string")for(var B in G)L.d(R,B,function(F){return G[F]}.bind(null,B));return R},L.n=function(G){var I=G&&G.__esModule?function(){return G.default}:function(){return G};return L.d(I,"a",I),I},L.o=function(G,I){return Object.prototype.hasOwnProperty.call(G,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,V,L){"use strict";var G=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function B(T,A,P){this.fn=T,this.context=A,this.once=P||!1}function F(T,A,P,C,S){if(typeof P!="function")throw new TypeError("The listener must be a function");var y=new B(P,C||T,S),d=I?I+A:A;return T._events[d]?T._events[d].fn?T._events[d]=[T._events[d],y]:T._events[d].push(y):(T._events[d]=y,T._eventsCount++),T}function _(T,A){--T._eventsCount===0?T._events=new R:delete T._events[A]}function D(){this._events=new R,this._eventsCount=0}D.prototype.eventNames=function(){var A=[],P,C;if(this._eventsCount===0)return A;for(C in P=this._events)G.call(P,C)&&A.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(P)):A},D.prototype.listeners=function(A){var P=I?I+A:A,C=this._events[P];if(!C)return[];if(C.fn)return[C.fn];for(var S=0,y=C.length,d=new Array(y);S<y;S++)d[S]=C[S].fn;return d},D.prototype.listenerCount=function(A){var P=I?I+A:A,C=this._events[P];return C?C.fn?1:C.length:0},D.prototype.emit=function(A,P,C,S,y,d){var o=I?I+A:A;if(!this._events[o])return!1;var s=this._events[o],u=arguments.length,E,f;if(s.fn){s.once&&this.removeListener(A,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,P),!0;case 3:return s.fn.call(s.context,P,C),!0;case 4:return s.fn.call(s.context,P,C,S),!0;case 5:return s.fn.call(s.context,P,C,S,y),!0;case 6:return s.fn.call(s.context,P,C,S,y,d),!0}for(f=1,E=new Array(u-1);f<u;f++)E[f-1]=arguments[f];s.fn.apply(s.context,E)}else{var m=s.length,w;for(f=0;f<m;f++){s[f].once&&this.removeListener(A,s[f].fn,void 0,!0);switch(u){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,P);break;case 3:s[f].fn.call(s[f].context,P,C);break;case 4:s[f].fn.call(s[f].context,P,C,S);break;default:if(!E)for(w=1,E=new Array(u-1);w<u;w++)E[w-1]=arguments[w];s[f].fn.apply(s[f].context,E)}}}return!0},D.prototype.on=function(A,P,C){return F(this,A,P,C,!1)},D.prototype.once=function(A,P,C){return F(this,A,P,C,!0)},D.prototype.removeListener=function(A,P,C,S){var y=I?I+A:A;if(!this._events[y])return this;if(!P)return _(this,y),this;var d=this._events[y];if(d.fn)d.fn===P&&(!S||d.once)&&(!C||d.context===C)&&_(this,y);else{for(var o=0,s=[],u=d.length;o<u;o++)(d[o].fn!==P||S&&!d[o].once||C&&d[o].context!==C)&&s.push(d[o]);s.length?this._events[y]=s.length===1?s[0]:s:_(this,y)}return this},D.prototype.removeAllListeners=function(A){var P;return A?(P=I?I+A:A,this._events[P]&&_(this,P)):(this._events=new R,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,ne.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,V,L){(function(G){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(D,T,A){if(A=A||{},D=D.trim(),T=T.trim(),!T){if(!A.alwaysNormalize)return D;var P=_.parseURL(D);if(!P)throw new Error("Error trying to parse base URL.");return P.path=_.normalizePath(P.path),_.buildURLFromParts(P)}var C=_.parseURL(T);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return A.alwaysNormalize?(C.path=_.normalizePath(C.path),_.buildURLFromParts(C)):T;var S=_.parseURL(D);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var y=R.exec(S.path);S.netLoc=y[1],S.path=y[2]}S.netLoc&&!S.path&&(S.path="/");var d={scheme:S.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=S.netLoc,C.path[0]!=="/"))if(!C.path)d.path=S.path,C.params||(d.params=S.params,C.query||(d.query=S.query));else{var o=S.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=_.normalizePath(s)}return d.path===null&&(d.path=A.alwaysNormalize?_.normalizePath(C.path):C.path),_.buildURLFromParts(d)},parseURL:function(D){var T=I.exec(D);return T?{scheme:T[1]||"",netLoc:T[2]||"",path:T[3]||"",params:T[4]||"",query:T[5]||"",fragment:T[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(F,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};ne.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,V,L){function G(A){var P={};function C(y){if(P[y])return P[y].exports;var d=P[y]={i:y,l:!1,exports:{}};return A[y].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=A,C.c=P,C.i=function(y){return y},C.d=function(y,d,o){C.o(y,d)||Object.defineProperty(y,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},C.n=function(y){var d=y&&y.__esModule?function(){return y.default}:function(){return y};return C.d(d,"a",d),d},C.o=function(y,d){return Object.prototype.hasOwnProperty.call(y,d)},C.p="/",C.oe=function(y){throw console.error(y),y};var S=C(C.s=ENTRY_MODULE);return S.default||S}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(A){return!isNaN(1*A)}function _(A,P,C){var S={};S[C]=[];var y=P.toString(),d=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return S;for(var o=d[1],s=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),u;u=s.exec(y);){if(u[3]==="dll-reference")continue;S[C].push(u[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");u=s.exec(y);)A[u[2]]||(S[C].push(u[1]),A[u[2]]=L(u[1]).m),S[u[2]]=S[u[2]]||[],S[u[2]].push(u[4]);for(var E=Object.keys(S),f=0;f<E.length;f++)for(var m=0;m<S[E[f]].length;m++)F(S[E[f]][m])&&(S[E[f]][m]=1*S[E[f]][m]);return S}function D(A){var P=Object.keys(A);return P.reduce(function(C,S){return C||A[S].length>0},!1)}function T(A,P){for(var C={main:[P]},S={main:[]},y={main:{}};D(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var s=d[o],u=C[s],E=u.pop();if(y[s]=y[s]||{},y[s][E]||!A[s][E])continue;y[s][E]=!0,S[s]=S[s]||[],S[s].push(E);for(var f=_(A,A[s][E],s),m=Object.keys(f),w=0;w<m.length;w++)C[m[w]]=C[m[w]]||[],C[m[w]]=C[m[w]].concat(f[m[w]])}return S}ne.exports=function(A,P){P=P||{};var C={main:L.m},S=P.all?{main:Object.keys(C.main)}:T(C,A),y="";Object.keys(S).filter(function(E){return E!=="main"}).forEach(function(E){for(var f=0;S[E][f];)f++;S[E].push(f),C[E][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+E+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+S[E].map(function(m){return""+JSON.stringify(m)+": "+C[E][m].toString()}).join(",")+`});
|
|
`}),y=y+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+S.main.map(function(E){return""+JSON.stringify(E)+": "+C.main[E].toString()}).join(",")+"}))(self);";var d=new window.Blob([y],{type:"text/javascript"});if(P.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"hlsDefaultConfig",function(){return w}),L.d(V,"mergeConfig",function(){return h}),L.d(V,"enableStreamingMode",function(){return c});var G=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),R=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),F=L("./src/controller/subtitle-track-controller.ts"),_=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),T=L("./src/controller/cap-level-controller.ts"),A=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),S=L("./src/utils/xhr-loader.ts"),y=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),s=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(l[p]=g[p])}return l},u.apply(this,arguments)}function E(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(v){return Object.getOwnPropertyDescriptor(l,v).enumerable})),g.push.apply(g,p)}return g}function f(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?E(Object(g),!0).forEach(function(p){m(l,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):E(Object(g)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(g,p))})}return l}function m(l,a,g){return a in l?Object.defineProperty(l,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):l[a]=g,l}var w=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:_.default,capLevelController:T.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:F.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:P.default,cmcdController:C.default});function b(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},l,a)}function c(l){var a=l.loader;if(a!==y.default&&a!==S.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var g=Object(y.fetchSupported)();g&&(l.loader=y.default,l.progressive=!0,l.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/errors.ts"),_=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function T(C,S){for(var y=0;y<S.length;y++){var d=S[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function A(C,S,y){return S&&T(C.prototype,S),y&&T(C,y),C}var P=function(){function C(y){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=y;var d=y.config;this.bwEstimator=new I.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var S=C.prototype;return S.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(d,o){var s=o.frag;if(s.type===_.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(d,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,E=s.config,f=s.media;if(!d||!f)return;var m=o?o.stats:d.stats,w=o?o.duration:d.duration;if(m.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||f.paused||!f.playbackRate||!f.readyState)return;var b=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(b<=500*w/h)return;var c=s.levels,l=s.minAutoLevel,a=c[d.level],g=m.total||Math.max(m.loaded,Math.round(w*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/b),v=(g-m.loaded)/p,M=f.currentTime,U=(B.BufferHelper.bufferInfo(f,M,E.maxBufferHole).end-M)/h;if(U>=2*w/h||v<=U)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var O=c[W].maxBitrate;if(j=w*O/(8*.8*p),j<U)break}if(j>=v)return;var k=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(G.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+v.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(b,m.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:m})},S.onFragLoaded=function(d,o){var s=o.frag,u=o.part;if(s.type===_.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(s.sn)){var E=u?u.stats:s.stats,f=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],w=(m.loaded?m.loaded.bytes:0)+E.loaded,b=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:w,duration:b},m.realBitrate=Math.round(8*w/b)}if(s.bitrateTest){var h={stats:E,frag:s,part:u,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},S.onFragBuffered=function(d,o){var s=o.frag,u=o.part,E=u?u.stats:s.stats;if(E.aborted)return;if(s.type!==_.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=E.parsing.end-E.loading.start;this.bwEstimator.sample(f,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},S.onError=function(d,o){switch(o.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.maxAutoLevel,E=s.config,f=s.minAutoLevel,m=s.media,w=o?o.duration:d?d.duration:0,b=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(m,b,E.maxBufferHole).end-b)/h,a=this.findBestLevel(c,f,u,l,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=w?Math.min(w,E.maxStarvationDelay):E.maxStarvationDelay,p=E.abrBandWidthFactor,v=E.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var U=w?Math.min(w,E.maxLoadingDelay):E.maxLoadingDelay;g=U-M,D.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),p=v=1}}return a=this.findBestLevel(c,f,u,l+g,p,v),Math.max(a,0)},S.findBestLevel=function(d,o,s,u,E,f){for(var m,w=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(m=l.details)!==null&&m!==void 0&&m.live),g=l==null?void 0:l.codecSet,p=b?b.duration:w?w.duration:0,v=s;v>=o;v--){var M=c[v];if(!M||g&&M.codecSet!==g)continue;var U=M.details,j=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||p,W=void 0;v<=h?W=E*d:W=f*d;var O=c[v].maxBitrate,k=O*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(W)+"/"+O+"/"+j+"/"+u+"/"+k),W>O&&(!k||a&&!this.bitrateTestDelay||k<u))return v}return-1},A(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),C}();V.default=P},"./src/controller/audio-stream-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-tracker.ts"),_=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),T=L("./src/loader/fragment.ts"),A=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),S=L("./src/controller/fragment-finders.ts"),y=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},s.apply(this,arguments)}function u(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,E(w,b)}function E(w,b){return E=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},E(w,b)}var f=100,m=function(w){u(b,w);function b(c,l){var a;return a=w.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(R.Events.ERROR,this.onError,this),l.on(R.Events.BUFFER_RESET,this.onBufferReset,this),l.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(R.Events.ERROR,this.onError,this),l.off(R.Events.BUFFER_RESET,this.onBufferReset,this),l.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var g=a.frag,p=a.id,v=a.initPTS;if(p==="main"){var M=g.cc;this.initPTS[g.cc]=v,this.log("InitPTS for cc: "+M+" found from main: "+v),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,g=this.trackId,p=a==null||((l=a[g])===null||l===void 0)?void 0:l.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var v,M=performance.now(),U=this.retryDate;(!U||M>=U||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,O=j.part,k=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var X=k.flush(),Z={frag:W,part:O,payload:X,networkDetails:null};this._handleFragmentLoadProgress(Z),H&&w.prototype._handleFragmentLoadComplete.call(this,Z)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var te=this.getLoadPosition(),Ee=B.BufferHelper.bufferInfo(this.mediaBuffer,te,this.config.maxBufferHole),fe=Object(S.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,W);fe<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,g=this.hls,p=this.levels,v=this.media,M=this.trackId,U=g.config;if(!p||!p[M])return;if(!v&&(this.startFragRequested||!U.startFragPrefetch))return;var j=p[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,T.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(O===null)return;var k=O.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(k>=H&&!X)return;if(!X&&this._streamEnded(O,W)){g.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var Z=W.fragments,te=Z[0].start,Ee=O.end;if(X){var fe=this.getLoadPosition();Ee=fe,W.PTSKnown&&fe<te&&((O.end>te||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=te+.05))}var Te=this.getNextFragment(Ee,W);if(!Te){this.bufferFlushed=!0;return}((l=Te.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=Te.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Te,W):this.loadFragment(Te,W,Ee)},h.getMaxBufferLength=function(){var l=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(p){return new _.Level(p)})},h.onAudioTrackSwitching=function(l,a){var g=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(f):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var g,p=this.levels,v=a.details,M=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var U=p[M],j=0;if(v.live||(g=U.details)!==null&&g!==void 0&&g.live){var W=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!W)return;!U.details&&v.hasProgramDateTime&&W.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(v,W),j=v.fragments[0].start):j=this.alignPlaylists(v,U.details)}U.details=v,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(U.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,g=l.frag,p=l.part,v=l.payload,M=this.config,U=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var W=j[U];console.assert(W,"Audio track is defined on fragment load progress");var O=W.details;console.assert(O,"Audio track details are defined on fragment load progress");var k=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new P.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[g.cc],Z=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var te=!1,Ee=p?p.index:-1,fe=Ee!==-1,Te=new C.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,v.byteLength,Ee,fe);H.push(v,Z,k,"",g,p,O.totalduration,te,Te,X)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+U);var pe=this.waitingData=this.waitingData||{frag:g,part:p,cache:new A.default,complete:!1},ge=pe.cache;ge.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var g=a.frag,p=a.part;if(g.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(p?" p: "+p.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,p)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var g=!0,p=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);p&&p.len>.5&&(g=!this.reduceMaxBufferLength(p.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var g=a.type;g===T.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,g="audio",p=this.hls,v=l.remuxResult,M=l.chunkMeta,U=this.getCurrentContext(M);if(!U){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=U.frag,W=U.part,O=v.audio,k=v.text,H=v.id3,X=v.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,j,M),p.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:X.tracks})),O){var Z=O.startPTS,te=O.endPTS,Ee=O.startDTS,fe=O.endDTS;W&&(W.elementaryStreams[T.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:te,startDTS:Ee,endDTS:fe}),j.setElementaryStreamInfo(T.ElementaryStreamTypes.AUDIO,Z,te,Ee,fe),this.bufferFragmentData(O,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var Te=s({frag:j,id:g},H);p.trigger(R.Events.FRAG_PARSING_METADATA,Te)}if(k){var pe=s({frag:j,id:g},k);p.trigger(R.Events.FRAG_PARSING_USERDATA,pe)}},h._bufferInitSegment=function(l,a,g){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var p=l.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,l);var v=p.initSegment;if(v!=null&&v.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:v};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(l,a,g){var p=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||p===F.FragmentState.NOT_LOADED||p===F.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,l,a,g)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:g})},b}(I.default);V.default=m},"./src/controller/audio-track-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function F(P,C){for(var S=0;S<C.length;S++){var y=C[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(P,y.key,y)}}function _(P,C,S){return C&&F(P.prototype,C),S&&F(P,S),P}function D(P,C){P.prototype=Object.create(C.prototype),P.prototype.constructor=P,T(P,C)}function T(P,C){return T=Object.setPrototypeOf||function(y,d){return y.__proto__=d,y},T(P,C)}var A=function(P){D(C,P);function C(y){var d;return d=P.call(this,y,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var S=C.prototype;return S.registerListeners=function(){var d=this.hls;d.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},S.onAudioTrackLoaded=function(d,o){var s=o.id,u=o.details,E=this.tracksInGroup[s];if(!E){this.warn("Invalid audio track id "+s);return}var f=E.details;E.details=o.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,f))},S.onLevelLoading=function(d,o){this.switchLevel(o.level)},S.onLevelSwitching=function(d,o){this.switchLevel(o.level)},S.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!u.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var E={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},S.onError=function(d,o){if(P.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},S.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],E=u.id,f=u.groupId,m=f===void 0?"":f,w=u.name,b=u.type,h=u.url;if(this.trackId=d,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:m,name:w,type:b,url:h}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},S.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(d){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var u=o[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},S.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,u=o.groupId,E=o.url;if(d)try{E=d.addDirectives(E)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:E,id:s,groupId:u,deliveryDirectives:d||null})}},_(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),C}(R.default);V.default=A},"./src/controller/base-playlist-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return _});var G=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),R=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),_=function(){function D(A,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,P+":"),this.warn=B.logger.warn.bind(B.logger,P+":"),this.hls=A}var T=D.prototype;return T.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},T.onError=function(P,C){C.fatal&&C.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},T.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},T.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},T.stopLoad=function(){this.canLoad=!1,this.clearTimer()},T.switchParams=function(P,C){var S=C==null?void 0:C.renditionReports;if(S)for(var y=0;y<S.length;y++){var d=S[y],o=""+d.URI;if(o===P.substr(-o.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var E=Math.min(C.age-C.partTarget,C.targetduration);u!==void 0&&E>C.partTarget&&(u+=1)}if(Object(G.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(G.isFiniteNumber)(u)?u:void 0,I.HlsSkip.No)}}},T.loadPlaylist=function(P){},T.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},T.playlistLoaded=function(P,C,S){var y=this,d=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||S!=null&&S.live){if(d.reloaded(S),S&&this.log("live playlist "+P+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),S&&d.fragments.length>0&&Object(R.mergeDetails)(S,d),!this.canLoad||!d.live)return;var u,E=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,w=d.lastPartSn,b=d.endSN,h=d.lastPartIndex,c=h!==-1,l=w===b,a=m?0:h;c?(E=l?b+1:w,f=l?a:h+1):E=b+1;var g=d.age,p=g+d.ageHeader,v=Math.min(p-d.partTarget,d.targetduration*1.5);if(v>0){if(S&&v>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var M=Math.floor(v/d.targetduration);if(E+=M,f!==void 0){var U=Math.round(v%d.targetduration/d.partTarget);f+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+v+" skip sn "+M+" to part "+f)}d.tuneInGoal=v}if(u=this.getDeliveryDirectives(d,C.deliveryDirectives,E,f),m||!l){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,C.deliveryDirectives,E,f);var j=Object(R.computeReloadInterval)(d,o);E!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(u)},j)}else this.clearTimer()},T.getDeliveryDirectives=function(P,C,S,y){var d=Object(I.getSkipValue)(P,S);return C!=null&&C.skip&&P.deltaUpdateFailed&&(S=C.msn,y=C.part,d=I.HlsSkip.No),new I.HlsUrlParameters(S,y,d)},T.retryLoadingOrFail=function(P){var C=this,S=this.hls.config,y=this.retryCount<S.levelLoadingMaxRetry;if(y){var d;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(d=P.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return y},D}()},"./src/controller/base-stream-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"State",function(){return b}),L.d(V,"default",function(){return h});var G=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),R=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts"),_=L("./src/events.ts"),D=L("./src/errors.ts"),T=L("./src/types/transmuxer.ts"),A=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),S=L("./src/controller/level-helper.ts"),y=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function u(c,l){for(var a=0;a<l.length;a++){var g=l[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(c,g.key,g)}}function E(c,l,a){return l&&u(c.prototype,l),a&&u(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,w(c,l)}function w(c,l){return w=Object.setPrototypeOf||function(g,p){return g.__proto__=p,g},w(c,l)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){m(l,c);function l(g,p,v){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=b.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=v,M.log=F.logger.log.bind(F.logger,v+":"),M.warn=F.logger.warn.bind(F.logger,v+":"),M.hls=g,M.fragmentLoader=new y.default(g.config),M.fragmentTracker=p,M.config=g.config,M.decrypter=new d.default(g,g.config),g.on(_.Events.KEY_LOADED,M.onKeyLoaded,f(M)),M}var a=l.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=b.STOPPED},a._streamEnded=function(p,v){var M=this.fragCurrent,U=this.fragmentTracker;if(!v.live&&M&&M.sn===v.endSN&&!p.nextStart){var j=U.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(p,v){var M=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.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,v=this.fragCurrent,M=this.media,U=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,O=B.BufferHelper.bufferInfo(U||M,W,p.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(v&&!O.len){var k=p.maxFragLookUpTolerance,H=v.start-k,X=v.start+v.duration+k,Z=W>X;(W<H||Z)&&(Z&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,v){if(this.state!==b.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var M=this.levels[v.frag.level].details;M&&this.loadFragment(v.frag,M,v.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(_.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,v){this.log("Loading key for "+p.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=b.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(_.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,v,M){this._loadFragForPlayback(p,v,M)},a._loadFragForPlayback=function(p,v,M){var U=this,j=function(O){if(U.fragContextChanged(p)){U.warn("Fragment "+p.sn+(O.part?" p: "+O.part.index:"")+" of level "+p.level+" was dropped during download."),U.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,U._handleFragmentLoadProgress(O)};this._doFragLoad(p,v,M,j).then(function(W){if(!W)return;U.fragLoadError=0;var O=U.state;if(U.fragContextChanged(p)){(O===b.FRAG_LOADING||O===b.BACKTRACKING||!U.fragCurrent&&O===b.PARSING)&&(U.fragmentTracker.removeFragment(p),U.state=b.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+p.sn+" of level "+p.level),U.hls.trigger(_.Events.FRAG_LOADED,W),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(p,W),U.resetFragmentLoading(p);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,v,M){if(M===void 0&&(M=null),!(p-v))return;var U={startOffset:p,endOffset:v,type:M};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(p){var v=this;this._doFragLoad(p).then(function(M){if(!M||v.fragContextChanged(p)||!v.levels)throw new Error("init load aborted");return M}).then(function(M){var U=v.hls,j=M.payload,W=p.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(k){var H=self.performance.now();return U.trigger(_.Events.FRAG_DECRYPTED,{frag:p,payload:k,stats:{tstart:O,tdecrypt:H}}),M.payload=k,M})}return M}).then(function(M){var U=v.fragCurrent,j=v.hls,W=v.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[p.level].details;console.assert(O,"Level details are defined when init segment is loaded");var k=p.stats;v.state=b.IDLE,v.fragLoadError=0,p.data=new Uint8Array(M.payload),k.parsing.start=k.buffering.start=self.performance.now(),k.parsing.end=k.buffering.end=self.performance.now(),M.frag===U&&j.trigger(_.Events.FRAG_BUFFERED,{stats:k,frag:U,part:null,id:p.type}),v.tick()}).catch(function(M){v.warn(M),v.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var v=this.fragCurrent;return!p||!v||p.level!==v.level||p.sn!==v.sn||p.urlId!==v.urlId},a.fragBufferedComplete=function(p,v){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var v=this.transmuxer;if(!v)return;var M=p.frag,U=p.part,j=p.partsLoaded,W=!j||j.length===0||j.some(function(k){return!k}),O=new T.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,U?U.index:-1,!W);v.flush(O)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,v,M,U){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(p.start,M||0),this.config.lowLatencyMode&&v){var W=v.partList;if(W&&U){M>p.end&&v.fragmentHint&&(p=v.fragmentHint);var O=this.getNextPart(W,p,M);if(O>-1){var k=W[O];return this.log("Loading part sn: "+p.sn+" p: "+k.index+" cc: "+p.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=k.start+k.duration,this.state=b.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:p,part:W[O],targetBufferTime:M}),this.doFragPartsLoad(p,W,O,U).catch(function(H){return j.handleFragLoadError(H)})}else if(!p.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=b.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:p,targetBufferTime:M}),this.fragmentLoader.load(p,U).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(p,v,M,U){var j=this;return new Promise(function(W,O){var k=[],H=function X(Z){var te=v[Z];j.fragmentLoader.loadPart(p,te,U).then(function(Ee){k[te.index]=Ee;var fe=Ee.part;j.hls.trigger(_.Events.FRAG_LOADED,Ee);var Te=v[Z+1];if(Te&&Te.fragment===p)X(Z+1);else return W({frag:p,part:fe,partsLoaded:k})}).catch(O)};H(M)})},a.handleFragLoadError=function(p){var v=p.data;return v&&v.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(_.Events.ERROR,v),null},a._handleTransmuxerFlush=function(p){var v=this.getCurrentContext(p);if(!v||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=v.frag,U=v.part,j=v.level,W=self.performance.now();M.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(M,U,j,p.partial)},a.getCurrentContext=function(p){var v=this.levels,M=p.level,U=p.sn,j=p.part;if(!v||!v[M])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+M+". The current chunk will not be buffered."),null;var W=v[M],O=j>-1?Object(S.getPartWith)(W,U,j):null,k=O?O.fragment:Object(S.getFragmentWithSN)(W,U,this.fragCurrent);return k?{frag:k,part:O,level:W}:null},a.bufferFragmentData=function(p,v,M,U){if(!p||this.state!==b.PARSING)return;var j=p.data1,W=p.data2,O=j;if(j&&W&&(O=Object(A.appendUint8Array)(j,W)),!O||!O.length)return;var k={type:p.type,frag:v,part:M,chunkMeta:U,parent:v.type,data:O};this.hls.trigger(_.Events.BUFFER_APPENDING,k),p.dropped&&p.independent&&!M&&this.flushBufferGap(v)},a.flushBufferGap=function(p){var v=this.media;if(!v)return;if(!B.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,p.start);return}var M=v.currentTime,U=B.BufferHelper.bufferInfo(v,M,0),j=p.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),O=Math.max(Math.min(p.start-W,U.end-W),M+W);p.start-O>W&&this.flushMainBuffer(O,p.start)},a.getFwdBufferInfo=function(p,v){var M=this.config,U=this.getLoadPosition();if(!Object(G.isFiniteNumber)(U))return null;var j=B.BufferHelper.bufferInfo(p,U,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,v);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(p,U,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var v=this.config,M;return p?M=Math.max(8*v.maxBufferSize/p,v.maxBufferLength):M=v.maxBufferLength,Math.min(M,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var v=this.config,M=p||v.maxBufferLength;return v.maxMaxBufferLength>=M?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,v){var M,U,j=v.fragments,W=j.length;if(!W)return null;var O=this.config,k=j[0].start,H;if(v.live){var X=O.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(v,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:p)}else p<=k&&(H=j[0]);if(!H){var Z=O.lowLatencyMode?v.partEnd:v.fragmentEnd;H=this.getFragmentAtPosition(p,Z,v)}return(M=H)!==null&&M!==void 0&&M.initSegment&&!((U=H)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(p,v,M){for(var U=-1,j=!1,W=!0,O=0,k=p.length;O<k;O++){var H=p[O];if(W=W&&!H.independent,U>-1&&M<H.start)break;var X=H.loaded;!X&&(j||H.independent||W)&&H.fragment===v&&(U=O),j=X}return U},a.loadedEndOfParts=function(p,v){var M=p[p.length-1];return M&&v>M.start&&M.loaded},a.getInitialLiveFragment=function(p,v){var M=this.fragPrevious,U=null;if(M){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),U=Object(C.findFragmentByPDT)(v,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=M.sn+1;if(j>=p.startSN&&j<=p.endSN){var W=v[j-p.startSN];M.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(C.findFragWithCC)(v,M.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(U=this.getFragmentAtPosition(O,this.bitrateTest?p.fragmentEnd:p.edge,p))}return U},a.getFragmentAtPosition=function(p,v,M){var U=this.config,j=this.fragPrevious,W=M.fragments,O=M.endSN,k=M.fragmentHint,H=U.maxFragLookUpTolerance,X=!!(U.lowLatencyMode&&M.partList&&k);X&&k&&!this.bitrateTest&&(W=W.concat(k),O=k.sn);var Z;if(p<v){var te=p>v-H?0:H;Z=Object(C.findFragmentByPTS)(j,W,p,te)}else Z=W[W.length-1];if(Z){var Ee=Z.sn-M.startSN,fe=j&&Z.level===j.level,Te=W[Ee+1],pe=this.fragmentTracker.getState(Z);if(pe===R.FragmentState.BACKTRACKED){Z=null;for(var ge=Ee;W[ge]&&this.fragmentTracker.getState(W[ge])===R.FragmentState.BACKTRACKED;)j?Z=W[ge--]:Z=W[--ge];Z||(Z=Te)}else j&&Z.sn===j.sn&&!X&&(fe&&(Z.sn<O&&this.fragmentTracker.getState(Te)!==R.FragmentState.OK?(this.log("SN "+Z.sn+" just loaded, load next one: "+Te.sn),Z=Te):Z=null))}return Z},a.synchronizeToLiveEdge=function(p){var v=this.config,M=this.media;if(!M)return;var U=this.hls.liveSyncPosition,j=M.currentTime,W=p.fragments[0].start,O=p.edge,k=j>=W-v.maxFragLookUpTolerance&&j<=O;if(U!==null&&M.duration>U&&(j<U||!k)){var H=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*p.targetduration;(!k&&M.readyState<4||j<O-H)&&(this.loadedmetadata||(this.nextLoadPosition=U),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+U.toFixed(3)),M.currentTime=U))}},a.alignPlaylists=function(p,v){var M=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,W=U!==null?M[U]:null,O=p.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var k=p.fragments[0].start,H=!v,X=p.alignedSliding&&Object(G.isFiniteNumber)(k);if(H||!X&&!k){Object(P.alignStream)(j,W,p);var Z=p.fragments[0].start;return this.log("Live playlist sliding: "+Z.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+O),Z}return k},a.waitForCdnTuneIn=function(p){var v=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*v)},a.setStartPosition=function(p,v){var M=this.startPosition;if(M<v&&(M=-1),M===-1||this.lastCurrentTime===-1){var U=p.startTimeOffset;Object(G.isFiniteNumber)(U)?(M=v+U,U<0&&(M+=p.totalduration),M=Math.min(Math.max(v,M),v+p.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+M),this.startPosition=M):p.live?M=this.hls.liveSyncPosition||v:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var p=this.media,v=0;return this.loadedmetadata&&p?v=p.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},a.handleFragLoadAborted=function(p,v){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(v?" part"+v.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(p,v){if(v.fatal)return;var M=v.frag;if(!M||M.type!==p)return;var U=this.fragCurrent;console.assert(U&&M.sn===U.sn&&M.level===U.level&&M.urlId===U.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+p+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(F.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(p,v,M){if(!p)return;var U=B.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(v,U,M),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[p].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,v,M,U){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(p.elementaryStreams).reduce(function(k,H){var X=p.elementaryStreams[H];if(X){var Z=X.endPTS-X.startPTS;if(Z<=0)return j.warn("Could not parse fragment "+p.sn+" "+H+" duration reliably ("+Z+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),k||!1;var te=U?0:Object(S.updateFragPTSDTS)(W,p,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return j.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:te,type:H,frag:p,start:X.startPTS,end:X.endPTS}),!0}return k},!1);O?(this.state=b.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:p,part:v})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(l,[{key:"state",get:function(){return this._state},set:function(p){var v=this._state;v!==p&&(this._state=p,this.log(v+"->"+p))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),F=L("./src/utils/buffer-helper.ts"),_=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),T=L("./src/controller/buffer-operation-queue.ts"),A=Object(_.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function S(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,u=o.media,E=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:u})),E&&E.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var y=S.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new T.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(o,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(o,s){var u=this.media=s.media;if(u&&A){var E=this.mediaSource=new A;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(E),this._objectUrl=u.src}},y.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(E){R.logger.warn("[buffer-controller]: onMediaDetaching: "+E.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var u=o.sourceBuffer[s];try{u&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[s]=void 0)}catch(E){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",E)}}),this._initSourceBuffer()},y.onBufferCodecs=function(o,s){var u=this,E=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(E){var m=u.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var w=s[f],b=w.codec,h=w.levelCodec,c=w.container,l=(m.levelCodec||m.codec).replace(P,"$1"),a=(h||b).replace(P,"$1");if(l!==a){var g=c+";codecs="+(h||b);u.appendChangeType(f,g)}}}else u.pendingTracks[f]=s[f]}),E)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(o,s){var u=this,E=this.operationQueue,f={execute:function(){var w=u.sourceBuffer[o];w&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),w.changeType(s)),E.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};E.append(f,o)},y.onBufferAppending=function(o,s){var u=this,E=this.hls,f=this.operationQueue,m=this.tracks,w=s.data,b=s.type,h=s.frag,c=s.part,l=s.chunkMeta,a=l.buffering[b],g=self.performance.now();a.start=g;var p=h.stats.buffering,v=c?c.stats.buffering:null;p.start===0&&(p.start=g),v&&v.start===0&&(v.start=g);var M=m.audio,U=b==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),U){var O=u.sourceBuffer[b];if(O){var k=h.start-O.timestampOffset;Math.abs(k)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+k+") sn: "+h.sn+")"),O.timestampOffset=h.start)}}u.appendExecutor(w,b)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,p.first===0&&(p.first=O),v&&v.first===0&&(v.first=O);var k=u.sourceBuffer,H={};for(var X in k)H[X]=F.BufferHelper.getBuffered(k[X]);u.appendError=0,u.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(O){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",O);var k={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?k.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,k.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>E.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),k.fatal=!0)),E.trigger(I.Events.ERROR,k)}};f.append(j,b)},y.onBufferFlushing=function(o,s){var u=this,E=this.operationQueue,f=function(w){return{execute:u.removeExecutor.bind(u,w,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(I.Events.BUFFER_FLUSHED,{type:w})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",h)}}};s.type?E.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){E.append(f(m),m)})},y.onFragParsed=function(o,s){var u=this,E=s.frag,f=s.part,m=[],w=f?f.elementaryStreams:E.elementaryStreams;w[D.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(w[D.ElementaryStreamTypes.AUDIO]&&m.push("audio"),w[D.ElementaryStreamTypes.VIDEO]&&m.push("video"));var b=function(){var c=self.performance.now();E.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var l=f?f.stats:E.stats;u.hls.trigger(I.Events.FRAG_BUFFERED,{frag:E,part:f,stats:l,id:E.type})};m.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(b,m)},y.onFragChanged=function(o,s){this.flushBackBuffer()},y.onBufferEos=function(o,s){var u=this,E=this.getSourceBufferTypes().reduce(function(f,m){var w=u.sourceBuffer[m];return(!s.type||s.type===m)&&(w&&!w.ended&&(w.ended=!0,R.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),f&&!!(!w||w.ended)},!0);E&&this.blockBuffers(function(){var f=u.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},y.onLevelUpdated=function(o,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var o=this.hls,s=this.details,u=this.media,E=this.sourceBuffer;if(!u||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(m)||m<0)return;var w=u.currentTime,b=s.levelTargetDuration,h=Math.max(m,b),c=Math.floor(w/b)*b-h;f.forEach(function(l){var a=E[l];if(a){var g=F.BufferHelper.getBuffered(a);g.length>0&&c>g.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,u=this.media,E=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=u.duration,w=Object(G.isFiniteNumber)(E.duration)?E.duration:0;o.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(o)):(f>w&&f>m||!Object(G.isFiniteNumber)(m))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),E.duration=f)},y.updateSeekableRange=function(o){var s=this.mediaSource,u=o.fragments,E=u.length;if(E&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,u[0].start),m=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,m)}},y.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,E=Object.keys(u).length;if(E&&!o||E===2){this.createSourceBuffers(u),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(m){s.executeNext(m)})}},y.createSourceBuffers=function(o){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var E=0;for(var f in o)if(!s[f]){var m=o[f];if(!m)throw Error("source buffer exists for track "+f+", however track does not");var w=m.levelCodec||m.codec,b=m.container+";codecs="+w;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=s[f]=u.addSourceBuffer(b),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:w,container:m.container,levelCodec:m.levelCodec,id:m.id},E++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:b})}}E&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(o){var s=this.operationQueue,u=s.current(o);u.onStart()},y._onSBUpdateEnd=function(o){var s=this.operationQueue,u=s.current(o);u.onComplete(),s.shiftAndExecuteNext(o)},y._onSBUpdateError=function(o,s){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(s)},y.removeExecutor=function(o,s,u){var E=this.media,f=this.mediaSource,m=this.operationQueue,w=this.sourceBuffer,b=w[o];if(!E||!f||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(E.duration)?E.duration:Infinity,c=Object(G.isFiniteNumber)(f.duration)?f.duration:Infinity,l=Math.max(0,s),a=Math.min(u,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(l,a)):m.shiftAndExecuteNext(o)},y.appendExecutor=function(o,s){var u=this.operationQueue,E=this.sourceBuffer,f=E[s];if(!f){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(o)},y.blockBuffers=function(o,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var E=this.operationQueue,f=s.map(function(m){return E.appendBlocker(m)});Promise.all(f).then(function(){o(),s.forEach(function(m){var w=u.sourceBuffer[m];(!w||!w.updating)&&E.shiftAndExecuteNext(m)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(o,s,u){var E=this.sourceBuffer[o];if(!E)return;var f=u.bind(this,o);this.listeners[o].push({event:s,listener:f}),E.addEventListener(s,f)},y.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(u){s.removeEventListener(u.event,u.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return I});var G=L("./src/utils/logger.ts"),I=function(){function R(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var B=R.prototype;return B.append=function(_,D){var T=this.queues[D];T.push(_),T.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(_,D){var T=this.queues[D];T.unshift(_),this.executeNext(D)},B.appendBlocker=function(_){var D,T=new Promise(function(P){D=P}),A={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,_),T},B.executeNext=function(_){var D=this.buffers,T=this.queues,A=D[_],P=T[_];if(P.length){var C=P[0];try{C.execute()}catch(S){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(S),(!A||!A.updating)&&(P.shift(),this.executeNext(_))}}},B.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},B.current=function(_){return this.queues[_][0]},R}()},"./src/controller/cap-level-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/events.ts");function I(F,_){for(var D=0;D<_.length;D++){var T=_[D];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(F,T.key,T)}}function R(F,_,D){return _&&I(F.prototype,_),D&&I(F,D),F}var B=function(){function F(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=F.prototype;return _.setStreamController=function(T){this.streamController=T},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var T=this.hls;T.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),T.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),T.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),T.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var T=this.hls;T.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),T.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),T.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),T.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(T,A){F.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},_.onMediaAttaching=function(T,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},_.onManifestParsed=function(T,A){var P=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},_.onBufferCodecs=function(T,A){var P=this.hls;P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var T=this.hls.levels;if(T.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(T.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},_.getMaxLevel=function(T){var A=this,P=this.hls.levels;if(!P.length)return-1;var C=P.filter(function(S,y){return F.isLevelAllowed(y,A.restrictedLevels)&&y<=T});return this.clientRect=null,F.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},_.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()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var T=this.media,A={width:0,height:0};if(T){var P=T.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||T.width||0,A.height=P.bottom-P.top||T.height||0)}return this.clientRect=A,A},F.isLevelAllowed=function(T,A){return A===void 0&&(A=[]),A.indexOf(T)===-1},F.getMaxLevelByMediaSize=function(T,A,P){if(!T||!T.length)return-1;for(var C=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},S=T.length-1,y=0;y<T.length;y+=1){var d=T[y];if((d.width>=A||d.height>=P)&&C(d,T[y+1])){S=y;break}}return S},R(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var T=1;try{T=self.devicePixelRatio}catch(A){}return T}}]),F}();V.default=B},"./src/controller/cmcd-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var G=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function F(S,y){for(var d=0;d<y.length;d++){var o=y[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(S,o.key,o)}}function _(S,y,d){return y&&F(S.prototype,y),d&&F(S,d),S}function D(S,y){var d=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(d)return(d=d.call(S)).next.bind(d);if(Array.isArray(S)||(d=T(S))||y&&S&&typeof S.length=="number"){d&&(S=d);var o=0;return function(){return o>=S.length?{done:!0}:{done:!1,value:S[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T(S,y){if(!S)return;if(typeof S=="string")return A(S,y);var d=Object.prototype.toString.call(S).slice(8,-1);if(d==="Object"&&S.constructor&&(d=S.constructor.name),d==="Map"||d==="Set")return Array.from(S);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return A(S,y)}function A(S,y){(y==null||y>S.length)&&(y=S.length);for(var d=0,o=new Array(y);d<y;d++)o[d]=S[d];return o}function P(){return P=Object.assign||function(S){for(var y=1;y<arguments.length;y++){var d=arguments[y];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(S[o]=d[o])}return S},P.apply(this,arguments)}var C=function(){function S(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(E){try{o.apply(E,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){B.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(E){try{var f=E.frag,m=o.hls.levels[f.level],w=o.getObjectType(f),b={d:f.duration*1e3,ot:w};(w===I.CMCDObjectType.VIDEO||w===I.CMCDObjectType.AUDIO||w==I.CMCDObjectType.MUXED)&&(b.br=m.bitrate/1e3,b.tb=o.getTopBandwidth(w),b.bl=o.getBufferLength(w)),o.apply(E,b)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||S.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var y=S.prototype;return y.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(o,s){var u,E;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(E=s.tracks.video)===null||E===void 0?void 0:E.buffer},y.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(o,s){s===void 0&&(s={}),P(s,this.createData());var u=s.ot===I.CMCDObjectType.INIT||s.ot===I.CMCDObjectType.VIDEO||s.ot===I.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var E=S.toHeaders(s);if(!Object.keys(E).length)return;o.headers||(o.headers={}),P(o.headers,E)}else{var f=S.toQuery(s);if(!f)return;o.url=S.appendQueryToUri(o.url,f)}},y.getObjectType=function(o){var s=o.type;return s==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:s==="audio"?I.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(o){for(var s=0,u=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,E=D(u),f;!(f=E()).done;){var m=f.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},y.getBufferLength=function(o){var s=this.hls.media,u=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var E=R.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return E.len*1e3},y.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,u=o||this.config.loader;return function(){function E(m){this.loader=void 0,this.loader=new u(m)}var f=E.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,b,h){s(w),this.loader.load(w,b,h)},_(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},y.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,u=o||this.config.loader;return function(){function E(m){this.loader=void 0,this.loader=new u(m)}var f=E.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,b,h){s(w),this.loader.load(w,b,h)},_(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},S.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},S.serialize=function(o){for(var s=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},E=function(U){return Math.round(U)},f=function(U){return E(U/100)*100},m=function(U){return encodeURIComponent(U)},w={br:E,d:E,bl:f,dl:f,mtp:f,nor:m,rtp:f,tb:E},b=Object.keys(o||{}).sort(),h=D(b),c;!(c=h()).done;){var l=c.value,a=o[l];if(!u(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var g=w[l];g&&(a=g(a));var p=typeof a,v=void 0;l==="ot"||l==="sf"||l==="st"?v=l+"="+a:p==="boolean"?v=l:p==="number"?v=l+"="+a:v=l+"="+JSON.stringify(a),s.push(v)}return s.join(",")},S.toHeaders=function(o){for(var s=Object.keys(o),u={},E=["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},w=0,b=s;w<b.length;w++){var h=b[w],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var l=0;l<f.length;l++){var a=S.serialize(f[l]);a&&(u["CMCD-"+E[l]]=a)}return u},S.toQuery=function(o){return"CMCD="+encodeURIComponent(S.serialize(o))},S.appendQueryToUri=function(o,s){if(!s)return o;var u=o.includes("?")?"&":"?";return""+o+u+s},S}()},"./src/controller/eme-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function F(C,S){for(var y=0;y<S.length;y++){var d=S[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function _(C,S,y){return S&&F(C.prototype,S),y&&F(C,y),C}var D=3,T=function(S,y,d){var o={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),y.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[o]},A=function(S,y,d,o){switch(S){case B.KeySystems.WIDEVINE:return T(y,d,o);default:throw new Error("Unknown key-system: "+S)}},P=function(){function C(y){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=y,this._config=y.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var S=C.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},S._attemptKeySystemAccess=function(d,o,s){var u=this,E=A(d,o,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,E);this.mediaKeysPromise=f.then(function(m){return u._onMediaKeySystemAccessObtained(d,m)}),f.catch(function(m){R.logger.error('Failed to obtain key-system "'+d+'" access:',m)})},S._onMediaKeySystemAccessObtained=function(d,o){var s=this;R.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var E=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return u.mediaKeys=f,R.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),f});return E.catch(function(f){R.logger.error("Failed to create media-keys:",f)}),E},S._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},S._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){o._onKeySessionMessage(d,s.message)},!1)},S._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},S.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(E){if(!o._media)return;o._attemptSetMediaKeys(E),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},S._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(d,o){var s=this,u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var E=u.mediaKeysSession;if(!E){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,E.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(f){R.logger.error("Error generating key-session request:",f),s.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(d,o,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,s);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,u,d),E=void 0}catch(f){R.logger.error(f)}try{u.readyState||u.open("POST",d,!0),E&&E.call(this.hls,u,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return u},S._onLicenseRequestReadyStageChange=function(d,o,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var E=d.response,f=this._licenseResponseCallback;if(f)try{E=f.call(this.hls,d,o)}catch(w){R.logger.error(w)}u(E)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=D-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,u)}break}},S._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},S._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),E=this._createLicenseXhr(u,d,o);R.logger.log("Sending license request to URL: "+u);var f=this._generateLicenseRequestChallenge(s,d);E.send(f)}catch(m){R.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var s=o.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),u=o.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,u)},_(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=P},"./src/controller/fps-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=function(){function B(_){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=_,this.registerListeners()}var F=B.prototype;return F.setStreamController=function(D){this.streamController=D},F.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(D,T){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=T.media instanceof self.HTMLVideoElement?T.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(D,T,A){var P=performance.now();if(T){if(this.lastTime){var C=P-this.lastTime,S=A-this.lastDroppedFrames,y=T-this.lastDecodedFrames,d=1e3*S/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:S,currentDecoded:y,totalDroppedFrames:A}),d>0&&S>o.config.fpsDroppedMonitoringThreshold*y){var s=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=T}},F.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var T=D.getVideoPlaybackQuality();this.checkFPS(D,T.totalVideoFrames,T.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"findFragmentByPDT",function(){return R}),L.d(V,"findFragmentByPTS",function(){return B}),L.d(V,"fragmentWithinToleranceTest",function(){return F}),L.d(V,"pdtWithinToleranceTest",function(){return _}),L.d(V,"findFragWithCC",function(){return D});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function R(T,A,P){if(A===null||!Array.isArray(T)||!T.length||!Object(G.isFiniteNumber)(A))return null;var C=T[0].programDateTime;if(A<(C||0))return null;var S=T[T.length-1].endProgramDateTime;if(A>=(S||0))return null;P=P||0;for(var y=0;y<T.length;++y){var d=T[y];if(_(A,P,d))return d}return null}function B(T,A,P,C){P===void 0&&(P=0),C===void 0&&(C=0);var S=null;if(T?S=A[T.sn-A[0].sn+1]||null:P===0&&A[0].start===0&&(S=A[0]),S&&F(P,C,S)===0)return S;var y=I.default.search(A,F.bind(null,P,C));return y||S}function F(T,A,P){T===void 0&&(T=0),A===void 0&&(A=0);var C=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-C<=T?1:P.start-C>T&&P.start?-1:0}function _(T,A,P){var C=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,S=P.endProgramDateTime||0;return S-C>T}function D(T,A){return I.default.search(T,function(P){return P.cc<A?1:P.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"FragmentState",function(){return R}),L.d(V,"FragmentTracker",function(){return B});var G=L("./src/events.ts"),I=L("./src/types/loader.ts"),R;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(R||(R={}));var B=function(){function D(A){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=A,this._registerListeners()}var T=D.prototype;return T._registerListeners=function(){var P=this.hls;P.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},T._unregisterListeners=function(){var P=this.hls;P.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},T.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},T.getAppendedFrag=function(P,C){if(C===I.PlaylistLevelType.MAIN){var S=this.activeFragment,y=this.activeParts;if(!S)return null;if(y)for(var d=y.length;d--;){var o=y[d],s=o?o.end:S.appendedPTS;if(o.start<=P&&s!==void 0&&P<=s)return d>9&&(this.activeParts=y.slice(d-9)),o}else if(S.start<=P&&S.appendedPTS!==void 0&&P<=S.appendedPTS)return S}return this.getBufferedFrag(P,C)},T.getBufferedFrag=function(P,C){for(var S=this.fragments,y=Object.keys(S),d=y.length;d--;){var o=S[y[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=P&&P<=s.end)return s}}return null},T.detectEvictedFragments=function(P,C,S){var y=this;Object.keys(this.fragments).forEach(function(d){var o=y.fragments[d];if(!o)return;if(!o.buffered){o.body.type===S&&y.removeFragment(o.body);return}var s=o.range[P];if(!s)return;s.time.some(function(u){var E=!y.isTimeBuffered(u.startPTS,u.endPTS,C);return E&&y.removeFragment(o.body),E})})},T.detectPartialFragments=function(P){var C=this,S=this.timeRanges,y=P.frag,d=P.part;if(!S||y.sn==="initSegment")return;var o=_(y),s=this.fragments[o];if(!s)return;Object.keys(S).forEach(function(u){var E=y.elementaryStreams[u];if(!E)return;var f=S[u],m=d!==null||E.partial===!0;s.range[u]=C.getBufferedTimes(y,d,m,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},T.fragBuffered=function(P){var C=_(P),S=this.fragments[C];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},T.getBufferedTimes=function(P,C,S,y){for(var d={time:[],partial:S},o=C?C.start:P.start,s=C?C.end:P.end,u=P.minEndPTS||s,E=P.maxStartPTS||o,f=0;f<y.length;f++){var m=y.start(f)-this.bufferPadding,w=y.end(f)+this.bufferPadding;if(E>=m&&u<=w){d.time.push({startPTS:Math.max(o,y.start(f)),endPTS:Math.min(s,y.end(f))});break}else if(o<w&&s>m)d.partial=!0,d.time.push({startPTS:Math.max(o,y.start(f)),endPTS:Math.min(s,y.end(f))});else if(s<=m)break}return d},T.getPartialFragment=function(P){var C=null,S,y,d,o=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(E){var f=u[E];if(!f)return;F(f)&&(y=f.body.start-s,d=f.body.end+s,P>=y&&P<=d&&(S=Math.min(P-y,d-P),o<=S&&(C=f.body,o=S)))}),C},T.getState=function(P){var C=_(P),S=this.fragments[C];return S?S.buffered?F(S)?R.PARTIAL:R.OK:S.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},T.backtrack=function(P,C){var S=_(P),y=this.fragments[S];if(!y||y.backtrack)return null;var d=y.backtrack=C||y.loaded;return y.loaded=null,d},T.getBacktrackData=function(P){var C=_(P),S=this.fragments[C];if(S){var y,d=S.backtrack;if(d!=null&&(y=d.payload)!==null&&y!==void 0&&y.byteLength)return d;this.removeFragment(P)}return null},T.isTimeBuffered=function(P,C,S){for(var y,d,o=0;o<S.length;o++){if(y=S.start(o)-this.bufferPadding,d=S.end(o)+this.bufferPadding,P>=y&&C<=d)return!0;if(C<=y)return!1}return!1},T.onFragLoaded=function(P,C){var S=C.frag,y=C.part;if(S.sn==="initSegment"||S.bitrateTest||y)return;var d=_(S);this.fragments[d]={body:S,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},T.onBufferAppended=function(P,C){var S=this,y=C.frag,d=C.part,o=C.timeRanges;if(y.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=y,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var E=o[u];if(S.detectEvictedFragments(u,E),!d)for(var f=0;f<E.length;f++)y.appendedPTS=Math.max(E.end(f),y.appendedPTS||0)})},T.onFragBuffered=function(P,C){this.detectPartialFragments(C)},T.hasFragment=function(P){var C=_(P);return!!this.fragments[C]},T.removeFragmentsInRange=function(P,C,S){var y=this;Object.keys(this.fragments).forEach(function(d){var o=y.fragments[d];if(!o)return;if(o.buffered){var s=o.body;s.type===S&&s.start<C&&s.end>P&&y.removeFragment(s)}})},T.removeFragment=function(P){var C=_(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[C]},T.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function F(D){var T,A;return D.buffered&&(((T=D.range.video)===null||T===void 0?void 0:T.partial)||((A=D.range.audio)===null||A===void 0?void 0:A.partial))}function _(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"STALL_MINIMUM_DURATION_MS",function(){return F}),L.d(V,"MAX_START_GAP_JUMP",function(){return _}),L.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(V,"SKIP_BUFFER_RANGE_START",function(){return T}),L.d(V,"default",function(){return A});var G=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts"),B=L("./src/utils/logger.ts"),F=250,_=2,D=.1,T=.05,A=function(){function P(S,y,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=S,this.media=y,this.fragmentTracker=d,this.hls=o}var C=P.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(y){var d=this.config,o=this.media,s=this.stalled,u=o.currentTime,E=o.seeking,f=this.seeking&&!E,m=!this.seeking&&E;if(this.seeking=E,u!==y){if(this.moved=!0,s!==null){if(this.stallReported){var w=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var b=G.BufferHelper.bufferInfo(o,u,0),h=b.len>0,c=b.nextStart||0;if(!h&&!c)return;if(E){var l=b.len>_,a=!c||c-u>_&&!this.fragmentTracker.getPartialFragment(u);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,p=Math.max(c,b.start||0)-u,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=v==null||((g=v.details)===null||g===void 0)?void 0:g.live,U=M?v.details.targetduration*2:_;if(p>0&&p<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!E&&W>=F&&this._reportStall(b.len);var O=G.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(O,W)},C._tryFixBufferStall=function(y,d){var o=this.config,s=this.fragmentTracker,u=this.media,E=u.currentTime,f=s.getPartialFragment(E);if(f){var m=this._trySkipBufferHole(f);if(m)return}y.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(y){var d=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+y+")"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},C._trySkipBufferHole=function(y){for(var d=this.config,o=this.hls,s=this.media,u=s.currentTime,E=0,f=G.BufferHelper.getBuffered(s),m=0;m<f.length;m++){var w=f.start(m);if(u+d.maxBufferHole>=E&&u<w){var b=Math.max(w+T,s.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,y&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+b,frag:y}),b}E=f.end(m)}return 0},C._tryNudgeBuffer=function(){var y=this.config,d=this.hls,o=this.media,s=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<y.nudgeMaxRetry){var E=s+u*y.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+E),o.currentTime=E,d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+y.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/demux/id3.ts"),B=.25,F=function(){function _(T){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=T,this._registerListeners()}var D=_.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var A=this.hls;A.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var A=this.hls;A.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(A,P){this.media=P.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(A){if(!this.media)return;for(var P=0;P<A.length;P++){var C=A[P];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(A,P){if(!this.media)return;var C=P.frag,S=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<S.length;d++){var o=R.getID3Frames(S[d].data);if(o){var s=S[d].pts,u=d<S.length-1?S[d+1].pts:C.end,E=u-s;E<=0&&(u=s+B);for(var f=0;f<o.length;f++){var m=o[f];if(!R.isTimeStampFrame(m)){var w=new y(s,u,"");w.value=m,this.id3Track.addCue(w)}}}}},D.onBufferFlushing=function(A,P){var C=P.startOffset,S=P.endOffset,y=P.type;if(!y||y==="audio"){var d=this.id3Track;d&&Object(I.removeCuesInRange)(d,C,S)}},_}();V.default=F},"./src/controller/latency-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return _});var G=L("./src/errors.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts");function B(D,T){for(var A=0;A<T.length;A++){var P=T[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function F(D,T,A){return T&&B(D.prototype,T),A&&B(D,A),D}var _=function(){function D(A){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var T=D.prototype;return T.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},T.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},T.onMediaAttached=function(P,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},T.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},T.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},T.onLevelUpdated=function(P,C){var S=C.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},T.onError=function(P,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},T.timeupdate=function(){var P=this.media,C=this.levelDetails;if(!P||!C)return;this.currentTime=P.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var y=this.config,d=y.lowLatencyMode,o=y.maxLiveSyncPlaybackRate;if(!d||o===1)return;var s=this.targetLatency;if(s===null)return;var u=S-s,E=Math.min(this.maxLatency,s+C.targetduration),f=u<E;if(C.live&&f&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,w))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},T.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},T.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},F(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,C=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:C?P.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var C=P.holdBack,S=P.partHoldBack,y=P.targetduration,d=this.config,o=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,E=this.hls.userConfig,f=u&&S||C;(E.liveSyncDuration||E.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:s*y);var m=y,w=1;return f+Math.min(this.stallCount*w,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),C=this.targetLatency,S=this.levelDetails;if(P===null||C===null||S===null)return null;var y=S.edge,d=P-C-this.edgeStalled,o=y-S.totalduration,s=y-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(o,d),s)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var C=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-C,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,C=this.levelDetails;if(!P||!C)return 0;var S=P.buffered.length;return S?P.buffered.end(S-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return d});var G=L("./src/types/level.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),F=L("./src/controller/level-helper.ts"),_=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function T(){return T=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var E in u)Object.prototype.hasOwnProperty.call(u,E)&&(o[E]=u[E])}return o},T.apply(this,arguments)}function A(o,s){for(var u=0;u<s.length;u++){var E=s[u];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(o,E.key,E)}}function P(o,s,u){return s&&A(o.prototype,s),u&&A(o,u),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,S(o,s)}function S(o,s){return S=Object.setPrototypeOf||function(E,f){return E.__proto__=f,E},S(o,s)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(s,o);function s(E){var f;return f=o.call(this,E,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var u=s.prototype;return u._registerListeners=function(){var f=this.hls;f.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(I.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var f=this.hls;f.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(I.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(f,m){var w=[],b=[],h=[],c,l={},a,g=!1,p=!1,v=!1;if(m.levels.forEach(function(W){var O=W.attrs;g=g||!!(W.width&&W.height),p=p||!!W.videoCodec,v=v||!!W.audioCodec,y&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var k=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[k],a?a.url.push(W.url):(a=new G.Level(W),l[k]=a,w.push(a)),O&&(O.AUDIO&&Object(F.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(F.addGroupId)(a,"text",O.SUBTITLES))}),(g||p)&&v&&(w=w.filter(function(W){var O=W.videoCodec,k=W.width,H=W.height;return!!O||!!(k&&H)})),w=w.filter(function(W){var O=W.audioCodec,k=W.videoCodec;return(!O||Object(B.isCodecSupportedInMp4)(O,"audio"))&&(!k||Object(B.isCodecSupportedInMp4)(k,"video"))}),m.audioTracks&&(b=m.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(b)),m.subtitles&&(h=m.subtitles,Object(F.assignTrackIdsByGroup)(h)),w.length>0){c=w[0].bitrate,w.sort(function(W,O){return W.bitrate-O.bitrate}),this._levels=w;for(var M=0;M<w.length;M++)if(w[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+c);break}var U=v&&!p,j={levels:w,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:v,video:p,altAudio:!U&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var w=m.context,b=this._levels[this.currentLevelIndex];if(w&&(w.type===D.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&w.groupId===b.audioGroupIds[b.urlId]||w.type===D.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&w.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;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&&(l=m.frag.level)):l=m.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(c=!1),l=w.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=m.level,h=!0;break}l!==void 0&&this.recoverLevel(m,l,h,c)},u.recoverLevel=function(f,m,w,b){var h=f.details,c=this._levels[m];if(c.loadError++,w){var l=this.retryLoadingOrFail(f);if(l)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var g=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(h+": switch to "+g),f.levelRetry=!0,this.hls.nextAutoLevel=g)}}},u.redundantFailover=function(f){var m=this._levels[f],w=m.url.length;if(w>1){var b=(m.urlId+1)%w;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=f}},u.onFragLoaded=function(f,m){var w=m.frag;if(w!==void 0&&w.type===D.PlaylistLevelType.MAIN){var b=this._levels[w.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},u.onLevelLoaded=function(f,m){var w,b=m.level,h=m.details,c=this._levels[b];if(!c){var l;this.warn("Invalid level index "+b),(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,m,c.details)):(w=m.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(h.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(f,m){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<w.audioGroupIds.length;c++)if(w.audioGroupIds[c]===h){b=c;break}b!==w.urlId&&(w.urlId=b,this.startLoad())}},u.loadPlaylist=function(f){var m=this.currentLevelIndex,w=this._levels[m];if(this.canLoad&&w&&w.url.length>0){var b=w.urlId,h=w.url[b];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 "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:m,id:b,deliveryDirectives:f||null})}},u.removeLevel=function(f,m){var w=function(c,l){return l!==m},b=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(w),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(w)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(w)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},P(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var m,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===f&&(m=w[f])!==null&&m!==void 0&&m.details)return;if(f<0||f>=w.length){var b=f<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:b,reason:"invalid level idx"}),b)return;f=Math.min(f,w.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=w[h],l=w[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=T({},l,{level:f,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var g=l.details;if(!g||g.live){var p=this.switchParams(l.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)}}]),s}(_.default)},"./src/controller/level-helper.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"addGroupId",function(){return R}),L.d(V,"assignTrackIdsByGroup",function(){return B}),L.d(V,"updatePTS",function(){return F}),L.d(V,"updateFragPTSDTS",function(){return D}),L.d(V,"mergeDetails",function(){return T}),L.d(V,"mapPartIntersection",function(){return A}),L.d(V,"mapFragmentIntersection",function(){return P}),L.d(V,"adjustSliding",function(){return C}),L.d(V,"addSliding",function(){return S}),L.d(V,"computeReloadInterval",function(){return y}),L.d(V,"getFragmentWithSN",function(){return d}),L.d(V,"getPartWith",function(){return o});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function R(s,u,E){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(E);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(E);break}}function B(s){var u={};s.forEach(function(E){var f=E.groupId||"";E.id=u[f]=u[f]||0,u[f]++})}function F(s,u,E){var f=s[u],m=s[E];_(f,m)}function _(s,u){var E=u.startPTS;if(Object(G.isFiniteNumber)(E)){var f=0,m;u.sn>s.sn?(f=E-s.start,m=s):(f=s.start-E,m=u),m.duration!==f&&(m.duration=f)}else if(u.sn>s.sn){var w=s.cc===u.cc;w&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function D(s,u,E,f,m,w){var b=f-E;b<=0&&(I.logger.warn("Fragment should have a positive duration",u),f=E+u.duration,w=m+u.duration);var h=E,c=f,l=u.startPTS,a=u.endPTS;if(Object(G.isFiniteNumber)(l)){var g=Math.abs(l-E);Object(G.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(g,u.deltaPTS):u.deltaPTS=g,h=Math.max(E,l),E=Math.min(E,l),m=Math.min(m,u.startDTS),c=Math.min(f,a),f=Math.max(f,a),w=Math.max(w,u.endDTS)}u.duration=f-E;var p=E-u.start;u.appendedPTS=f,u.start=u.startPTS=E,u.maxStartPTS=h,u.startDTS=m,u.endPTS=f,u.minEndPTS=c,u.endDTS=w;var v=u.sn;if(!s||v<s.startSN||v>s.endSN)return 0;var M,U=v-s.startSN,j=s.fragments;for(j[U]=u,M=U;M>0;M--)_(j[M],j[M-1]);for(M=U;M<j.length-1;M++)_(j[M],j[M+1]);return s.fragmentHint&&_(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,p}function T(s,u){for(var E=null,f=s.fragments,m=f.length-1;m>=0;m--){var w=f[m].initSegment;if(w){E=w;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,h;if(P(s,u,function(M,U){M.relurl&&(b=M.cc-U.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.isFiniteNumber)(M.endPTS)&&(U.start=U.startPTS=M.startPTS,U.startDTS=M.startDTS,U.appendedPTS=M.appendedPTS,U.maxStartPTS=M.maxStartPTS,U.endPTS=M.endPTS,U.endDTS=M.endDTS,U.minEndPTS=M.minEndPTS,U.duration=M.endPTS-M.startPTS,U.duration&&(h=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=M.elementaryStreams,U.loader=M.loader,U.stats=M.stats,U.urlId=M.urlId,M.initSegment&&(U.initSegment=M.initSegment,E=M.initSegment)}),E){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(M){var U;(!M.initSegment||M.initSegment.relurl===((U=E)===null||U===void 0?void 0:U.relurl))&&(M.initSegment=E)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(M){return!M}),u.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=u.skippedSegments;l--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=b}u.skippedSegments&&(u.startCC=u.fragments[0].cc),A(s.partList,u.partList,function(M,U){U.elementaryStreams=M.elementaryStreams,U.stats=M.stats}),h?D(u,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(s,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var p=u.advancedDateTime;if(u.advanced&&p){var v=u.edge;u.driftStart||(u.driftStartTime=p,u.driftStart=v),u.driftEndTime=p,u.driftEnd=v}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function A(s,u,E){if(s&&u)for(var f=0,m=0,w=s.length;m<=w;m++){var b=s[m],h=u[m+f];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?E(b,h):f--}}function P(s,u,E){for(var f=u.skippedSegments,m=Math.max(s.startSN,u.startSN)-u.startSN,w=(s.fragmentHint?1:0)+(f?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,b=u.startSN-s.startSN,h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,l=m;l<=w;l++){var a=c[b+l],g=h[l];f&&!g&&l<f&&(g=u.fragments[l]=a),a&&g&&E(a,g)}}function C(s,u){var E=u.startSN+u.skippedSegments-s.startSN,f=s.fragments;if(E<0||E>=f.length)return;S(u,f[E].start)}function S(s,u){if(u){for(var E=s.fragments,f=s.skippedSegments;f<E.length;f++)E[f].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function y(s,u){var E=1e3*s.levelTargetDuration,f=E/2,m=s.age,w=m>0&&m<E*3,b=u.loading.end-u.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(w){var l=333*s.misses;h=Math.max(Math.min(f,b*2),l),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=f;else w?(c=Math.min(c||E/2,m),s.availabilityDelay=c,h=c+E-m):h=E-b;return Math.round(h)}function d(s,u,E){if(!s||!s.details)return null;var f=s.details,m=f.fragments[u-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===u?m:u<f.startSN&&E&&E.sn===u?E:null)}function o(s,u,E){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var m=f.length;m--;){var w=f[m];if(w.index===E&&w.fragment.sn===u)return w}return null}},"./src/controller/stream-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return f});var G=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/is-supported.ts"),B=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),_=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),T=L("./src/loader/fragment.ts"),A=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),S=L("./src/errors.ts"),y=L("./src/utils/logger.ts");function d(m,w){for(var b=0;b<w.length;b++){var h=w[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,w,b){return w&&d(m.prototype,w),b&&d(m,b),m}function s(m,w){m.prototype=Object.create(w.prototype),m.prototype.constructor=m,u(m,w)}function u(m,w){return u=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},u(m,w)}var E=100,f=function(m){s(w,m);function w(h,c){var l;return l=m.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var b=w.prototype;return b._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,g=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var p,v=self.performance.now(),M=this.retryDate;(!M||v>=M||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,l,a=this.hls,g=this.levelLastLoaded,p=this.levels,v=this.media,M=a.config,U=a.nextLoadLevel;if(g===null||!v&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[U])return;var j=p[U];this.level=a.nextLoadLevel=U;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=I.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,D.PlaylistLevelType.MAIN);if(O===null)return;var k=O.len,H=this.getMaxBufferLength(j.maxBitrate);if(k>=H)return;if(this._streamEnded(O,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,X),this.state=I.State.ENDED;return}var Z=O.end,te=this.getNextFragment(Z,W);if(this.couldBacktrack&&!this.fragPrevious&&te&&te.sn!=="initSegment"){var Ee=te.sn-W.startSN;Ee>1&&(te=W.fragments[Ee-1],this.fragmentTracker.removeFragment(te))}if(te&&this.fragmentTracker.getState(te)===_.FragmentState.OK&&this.nextLoadPosition>Z){var fe=this.audioOnly&&!this.altAudio?T.ElementaryStreamTypes.AUDIO:T.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,fe,D.PlaylistLevelType.MAIN),te=this.getNextFragment(this.nextLoadPosition,W)}if(!te)return;te.initSegment&&!te.initSegment.data&&!this.bitrateTest&&(te=te.initSegment),((c=te.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=te.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(te,W):this.loadFragment(te,W,Z)},b.loadFragment=function(c,l,a){var g,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===_.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else p=_.FragmentState.NOT_LOADED}p===_.FragmentState.NOT_LOADED||p===_.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,l,a)):p===_.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,D.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,D.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,g=this.getAppendedFrag(l.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!l.paused&&c){var p=this.hls.nextLoadLevel,v=c[p],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*M)+1:a=0}else a=0;var U=this.getBufferedFrag(l.currentTime+a);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,O=j.duration,k=Math.max(U.end,W+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,l){m.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},b.onMediaAttached=function(c,l){m.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,l){var a=!1,g=!1,p;l.levels.forEach(function(v){p=v.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var g=a[l.level];(!g.details||g.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(g.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,l){var a,g=this.levels,p=l.level,v=l.details,M=v.totalduration;if(!g){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+M);var U=this.fragCurrent;U&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==l.level&&U.loader&&(this.state=I.State.IDLE,U.loader.abort()));var j=g[p],W=0;if(v.live||(a=j.details)!==null&&a!==void 0&&a.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;W=this.alignPlaylists(v,j.details)}if(j.details=v,this.levelLastLoaded=p,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:v,level:p}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=I.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,W),this.tick()},b._handleFragmentLoadProgress=function(c){var l,a=c.frag,g=c.part,p=c.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=v[a.level],U=M.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=U.PTSKnown||!U.live,O=(l=a.initSegment)===null||l===void 0?void 0:l.data,k=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new A.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=g?g.index:-1,Z=X!==-1,te=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,X,Z),Ee=this.initPTS[a.cc];H.push(p,O,k,j,a,g,U.totalduration,W,te,Ee)},b.onAudioTrackSwitching=function(c,l){var a=this.altAudio,g=!!l.url,p=l.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:p})}},b.onAudioTrackSwitched=function(c,l){var a=l.id,g=!!this.hls.audioTracks[a].url;if(g){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=g,this.tick()},b.onBufferCreated=function(c,l){var a=l.tracks,g,p,v=!1;for(var M in a){var U=a[M];if(U.id==="main"){if(p=M,g=U,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else v=!0}v&&g?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,l){var a=l.frag,g=l.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var p=g?g.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,g)},b.onError=function(c,l){switch(l.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,l);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=F.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,l){var a=l.type;if(a!==T.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===T.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,D.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,l){this.levels=l.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){y.logger.log("could not seek to "+a+", already seeking at "+l);return}var g=F.BufferHelper.getBuffered(c),p=g.length?g.start(0):0,v=p-a;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+v+" to match buffer start"),a+=v,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},b._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},b._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var g=l.hls;if(!a||g.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=I.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),g.trigger(B.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var l,a="main",g=this.hls,p=c.remuxResult,v=c.chunkMeta,M=this.getCurrentContext(v);if(!M){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var U=M.frag,j=M.part,W=M.level,O=p.video,k=p.text,H=p.id3,X=p.initSegment,Z=this.altAudio?void 0:p.audio;if(this.fragContextChanged(U))return;if(this.state=I.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,U,v),g.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:X.tracks}));var te=X.initPTS,Ee=X.timescale;Object(G.isFiniteNumber)(te)&&(this.initPTS[U.cc]=te,g.trigger(B.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:te,timescale:Ee}))}if(O&&p.independent!==!1){if(W.details){var fe=O.startPTS,Te=O.endPTS,pe=O.startDTS,ge=O.endDTS;if(j)j.elementaryStreams[O.type]={startPTS:fe,endPTS:Te,startDTS:pe,endDTS:ge};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<fe){this.backtrack(U);return}U.setElementaryStreamInfo(O.type,U.start,Te,U.start,ge,!0)}U.setElementaryStreamInfo(O.type,fe,Te,pe,ge),this.bufferFragmentData(O,U,j,v)}}else if(p.independent===!1){this.backtrack(U);return}if(Z){var he=Z.startPTS,J=Z.endPTS,se=Z.startDTS,q=Z.endDTS;j&&(j.elementaryStreams[T.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:J,startDTS:se,endDTS:q}),U.setElementaryStreamInfo(T.ElementaryStreamTypes.AUDIO,he,J,se,q),this.bufferFragmentData(Z,U,j,v)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var ye={frag:U,id:a,samples:H.samples};g.trigger(B.Events.FRAG_PARSING_METADATA,ye)}if(k){var Se={frag:U,id:a,samples:k.samples};g.trigger(B.Events.FRAG_PARSING_USERDATA,Se)}},b._bufferInitSegment=function(c,l,a,g){var p=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var v=l.audio,M=l.video,U=l.audiovideo;if(v){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),v.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),v.levelCodec=j,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(O){var k=l[O],H=k.initSegment;H!=null&&H.byteLength&&p.hls.trigger(B.Events.BUFFER_APPENDING,{type:O,data:H,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(F.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):F.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var g=this.fragPlaying,p=l.level;(!g||l.sn!==g.sn||g.level!==p||l.urlId!==g.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!g||g.level!==p)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=l)}}},o(w,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"SubtitleStreamController",function(){return s});var G=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),F=L("./src/utils/discontinuities.ts"),_=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),T=L("./src/controller/base-stream-controller.ts"),A=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function C(u,E){for(var f=0;f<E.length;f++){var m=E[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function S(u,E,f){return E&&C(u.prototype,E),f&&C(u,f),u}function y(u,E){u.prototype=Object.create(E.prototype),u.prototype.constructor=u,d(u,E)}function d(u,E){return d=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},d(u,E)}var o=500,s=function(u){y(E,u);function E(m,w){var b;return b=u.call(this,m,w,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var f=E.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var w=this.hls;w.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(G.Events.ERROR,this.onError,this),w.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var w=this.hls;w.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(G.Events.ERROR,this.onError,this),w.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=T.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(w,b){this.mainDetails=b.details},f.onSubtitleFragProcessed=function(w,b){var h=b.frag,c=b.success;if(this.fragPrevious=h,this.state=T.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,g=h.start,p=0;p<l.length;p++)if(g>=l[p].start&&g<=l[p].end){a=l[p];break}var v=h.start+h.duration;a?a.end=v:(a={start:g,end:v},l.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(w,b){var h=b.startOffset,c=b.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var g=a[l].details,p=g.targetduration,v=c-p;if(v<=0)return;b.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(M){for(var U=0;U<M.length;){if(M[U].end<=v){M.shift();continue}else if(M[U].start<v)M[U].start=v;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(h,v,A.PlaylistLevelType.SUBTITLE)}},f.onError=function(w,b){var h,c=b.frag;if(!c||c.type!==A.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=T.State.IDLE},f.onSubtitleTracksUpdated=function(w,b){var h=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new P.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(w,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(w,b){var h,c=b.details,l=b.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var p=g[a];if(l>=g.length||l!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var M=v.fragments[0];if(!p.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(c,v):M&&Object(_.addSliding)(c,M.start);else{var U=this.alignPlaylists(c,p.details);U===0&&M&&Object(_.addSliding)(c,M.start)}}if(p.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===T.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},f._handleFragmentLoadComplete=function(w){var b=w.frag,h=w.payload,c=b.decryptdata,l=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(g){var p=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:b,payload:g,stats:{tstart:a,tdecrypt:p}})})}},f.doTick=function(){if(!this.media){this.state=T.State.IDLE;return}if(this.state===T.State.IDLE){var w,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var c=h[b].details,l=c.targetduration,a=this.config,g=this.media,p=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-l,a.maxBufferHole),v=p.end,M=p.len,U=this.getMaxBufferLength()+l;if(M>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,O=c.edge,k,H=this.fragPrevious;if(v<O){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(k=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,X)),k||(k=Object(B.findFragmentByPTS)(H,j,v,X),!k&&H&&H.start<j[0].start&&(k=j[0]))}else k=j[W-1];(w=k)!==null&&w!==void 0&&w.encrypted?(I.logger.log("Loading key for "+k.sn),this.state=T.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:k})):k&&this.fragmentTracker.getState(k)===D.FragmentState.NOT_LOADED&&this.loadFragment(k,c,v)}},f.loadFragment=function(w,b,h){this.fragCurrent=w,u.prototype.loadFragment.call(this,w,b,h)},S(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(T.default)},"./src/controller/subtitle-track-controller.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function F(C,S){for(var y=0;y<S.length;y++){var d=S[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function _(C,S,y){return S&&F(C.prototype,S),y&&F(C,y),C}function D(C,S){C.prototype=Object.create(S.prototype),C.prototype.constructor=C,T(C,S)}function T(C,S){return T=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},T(C,S)}var A=function(C){D(S,C);function S(d){var o;return o=C.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var y=S.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},y.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},y.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},y.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},y.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=P(this.media.textTracks);o.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},y.onSubtitleTrackLoaded=function(o,s){var u=s.id,E=s.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+u);return}var w=m.details;m.details=s.details,this.log("subtitle track "+u+" loaded ["+E.startSN+"-"+E.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,w))},y.onLevelLoading=function(o,s){this.switchLevel(s.level)},y.onLevelSwitching=function(o,s){this.switchLevel(s.level)},y.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(b){return!u||b.groupId===u});this.tracksInGroup=f;var m=this.findTrackId(E==null?void 0:E.name)||this.findTrackId();this.groupId=u;var w={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,w),m!==-1&&this.setSubtitleTrack(m,E)}},y.findTrackId=function(o){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var E=s[u];if((!this.selectDefaultTrack||E.default)&&(!o||o===E.name))return E.id}return-1},y.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},y.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,E=s.groupId,f=s.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 "+u),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:f,id:u,groupId:E,deliveryDirectives:o||null})}},y.toggleTrackModes=function(o){var s=this,u=this.media,E=this.subtitleDisplay,f=this.trackId;if(!u)return;var m=P(u.textTracks),w=m.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var b=w[f];b&&(b.mode="disabled")}var h=w[o];h&&(h.mode=E?"showing":"hidden")},y.setSubtitleTrack=function(o,s){var u,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=E[o])!==null&&u!==void 0&&u.details)||o<-1||o>=E.length)return;this.clearTimer();var f=E[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var m=f.id,w=f.groupId,b=w===void 0?"":w,h=f.name,c=f.type,l=f.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:b,name:h,type:c,url:l});var a=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=P(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")o=u;else if(s[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},_(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),S}(R.default);function P(C){for(var S=[],y=0;y<C.length;y++){var d=C[y];d.kind==="subtitles"&&d.label&&S.push(C[y])}return S}V.default=A},"./src/controller/timeline-controller.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"TimelineController",function(){return P});var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),F=L("./src/utils/webvtt-parser.ts"),_=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),T=L("./src/types/loader.ts"),A=L("./src/utils/logger.ts"),P=function(){function d(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new B.default(this,"textTrack1"),E=new B.default(this,"textTrack2"),f=new B.default(this,"textTrack3"),m=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,u,E),this.cea608Parser2=new R.default(3,f,m)}s.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(I.Events.FRAG_LOADING,this.onFragLoading,this),s.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var u=this.hls;u.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(I.Events.FRAG_LOADING,this.onFragLoading,this),u.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,E,f,m,w){for(var b=!1,h=w.length;h--;){var c=w[h],l=S(c[0],c[1],E,f);if(l>=0&&(c[0]=Math.min(c[0],E),c[1]=Math.max(c[1],f),b=!0,l/(f-E)>.5))return}if(b||w.push([E,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,E,f,m)}else{var g=this.Cues.newCue(null,E,f,m);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:g,track:u})}},o.onInitPtsFound=function(u,E){var f=this,m=E.frag,w=E.id,b=E.initPTS,h=E.timescale,c=this.unparsedVttFrags;w==="main"&&(this.initPTS[m.cc]=b,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){f.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(u){var E=this.media;if(E)for(var f=0;f<E.textTracks.length;f++){var m=E.textTracks[f];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var E=this.captionsProperties,f=this.captionsTracks,m=this.media,w=E[u],b=w.label,h=w.languageCode,c=this.getExistingTrack(u);if(c)f[u]=c,Object(_.clearCurrentCues)(f[u]),Object(_.sendAddTrackEvent)(f[u],m);else{var l=this.createTextTrack("captions",b,h);l&&(l[u]=!0,f[u]=l)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var E=this.captionsProperties[u];if(!E)return;var f=E.label,m={_id:u,label:f,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,E,f){var m=this.media;return m?m.addTextTrack(u,E,f):void 0},o.onMediaAttaching=function(u,E){this.media=E.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(E){Object(_.clearCurrentCues)(u[E]),delete u[E]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var E=u.textTracks;if(E)for(var f=0;f<E.length;f++)Object(_.clearCurrentCues)(E[f])},o.onSubtitleTracksUpdated=function(u,E){var f=this;this.textTracks=[];var m=E.subtitleTracks||[],w=m.some(function(l){return l.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var b=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(l,a){var g;if(a<h.length){for(var p=null,v=0;v<h.length;v++)if(C(h[v],l)){p=h[v];break}p&&(g=p)}g?Object(_.clearCurrentCues)(g):(g=f.createTextTrack("subtitles",l.name,l.lang),g&&(g.mode="disabled")),g&&(g.groupId=l.groupId,f.textTracks.push(g))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,E){var f=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(m){var w=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!w)return;var b="textTrack"+w[1],h=f.captionsProperties[b];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(u,E){var f=this.cea608Parser1,m=this.cea608Parser2,w=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(E.frag.type===T.PlaylistLevelType.MAIN){var h,c,l=E.frag.sn,a=(h=E==null||((c=E.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===w+1||l===w&&a===b+1||(f.reset(),m.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(u,E){var f=E.frag,m=E.payload,w=this.initPTS,b=this.unparsedVttFrags;if(f.type===T.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(G.isFiniteNumber)(w[f.cc])){b.push(E),w.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],l=this.vttCCs;l[f.cc]||(l[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===D.IMSC1_CODEC?this._parseIMSC1(f,m):this._parseVTTs(f,m,l)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,E){var f=this,m=this.hls;Object(D.parseIMSC1)(E,this.initPTS[u.cc],this.timescale[u.cc],function(w){f._appendCues(w,u.level),m.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(w){A.logger.log("Failed to parse IMSC1: "+w),m.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:w})})},o._parseVTTs=function(u,E,f){var m=this,w=this.hls;Object(F.parseWebVTT)(E,this.initPTS[u.cc],this.timescale[u.cc],f,u.cc,u.start,function(b){m._appendCues(b,u.level),w.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(b){m._fallbackToIMSC1(u,E),A.logger.log("Failed to parse VTT cue: "+b),w.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:b})})},o._fallbackToIMSC1=function(u,E){var f=this,m=this.tracks[u.level];m.textCodec||Object(D.parseIMSC1)(E,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=D.IMSC1_CODEC,f._parseIMSC1(u,E)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,E){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[E];if(m.mode==="disabled")return;u.forEach(function(h){return Object(_.addCueToTrack)(m,h)})}else{var w=this.tracks[E],b=w.default?"default":"subtitles"+E;f.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:u,track:b})}},o.onFragDecrypted=function(u,E){var f=E.frag;if(f.type===T.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(I.Events.FRAG_LOADED,E)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,E){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var w=0;w<E.samples.length;w++){var b=E.samples[w].bytes;if(b){var h=this.extractCea608Data(b);f.addData(E.samples[w].pts,h[0]),m.addData(E.samples[w].pts,h[1])}}},o.onBufferFlushing=function(u,E){var f=E.startOffset,m=E.endOffset,w=E.endOffsetSubtitles,b=E.type,h=this.media;if(!h||h.currentTime<m)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(_.removeCuesInRange)(c[a],f,m)})}if(this.config.renderTextTracksNatively&&(f===0&&w!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(_.removeCuesInRange)(l[a],f,w)})}},o.extractCea608Data=function(u){for(var E=u[0]&31,f=2,m=[[],[]],w=0;w<E;w++){var b=u[f++],h=127&u[f++],c=127&u[f++],l=(4&b)!==0,a=3&b;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function S(d,o,s,u){return Math.min(o,u)-Math.max(d,s)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(B,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=F}var R=I.prototype;return R.decrypt=function(F,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,F)},I}()},"./src/crypt/aes-decryptor.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"removePadding",function(){return I}),L.d(V,"default",function(){return R});var G=L("./src/utils/typed-array.ts");function I(B){var F=B.byteLength,_=F&&new DataView(B.buffer).getUint8(F-1);return _?Object(G.sliceUint8)(B,0,F-_):B}var R=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var F=B.prototype;return F.uint8ArrayToUint32Array_=function(D){for(var T=new DataView(D),A=new Uint32Array(4),P=0;P<4;P++)A[P]=T.getUint32(P*4);return A},F.initTable=function(){var D=this.sBox,T=this.invSBox,A=this.subMix,P=A[0],C=A[1],S=A[2],y=A[3],d=this.invSubMix,o=d[0],s=d[1],u=d[2],E=d[3],f=new Uint32Array(256),m=0,w=0,b=0;for(b=0;b<256;b++)b<128?f[b]=b<<1:f[b]=b<<1^283;for(b=0;b<256;b++){var h=w^w<<1^w<<2^w<<3^w<<4;h=h>>>8^h&255^99,D[m]=h,T[h]=m;var c=f[m],l=f[c],a=f[l],g=f[h]*257^h*16843008;P[m]=g<<24|g>>>8,C[m]=g<<16|g>>>16,S[m]=g<<8|g>>>24,y[m]=g,g=a*16843009^l*65537^c*257^m*16843008,o[h]=g<<24|g>>>8,s[h]=g<<16|g>>>16,u[h]=g<<8|g>>>24,E[h]=g,m?(m=c^f[f[f[a^c]]],w^=f[f[w]]):m=w=1}},F.expandKey=function(D){for(var T=this.uint8ArrayToUint32Array_(D),A=!0,P=0;P<T.length&&A;)A=T[P]===this.key[P],P++;if(A)return;this.key=T;var C=this.keySize=T.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var S=this.ksRows=(C+6+1)*4,y,d,o=this.keySchedule=new Uint32Array(S),s=this.invKeySchedule=new Uint32Array(S),u=this.sBox,E=this.rcon,f=this.invSubMix,m=f[0],w=f[1],b=f[2],h=f[3],c,l;for(y=0;y<S;y++){if(y<C){c=o[y]=T[y];continue}l=c,y%C===0?(l=l<<8|l>>>24,l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255],l^=E[y/C|0]<<24):C>6&&y%C===4&&(l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255]),o[y]=c=(o[y-C]^l)>>>0}for(d=0;d<S;d++)y=S-d,d&3?l=o[y]:l=o[y-4],d<4||y<=4?s[d]=l:s[d]=m[u[l>>>24]]^w[u[l>>>16&255]]^b[u[l>>>8&255]]^h[u[l&255]],s[d]=s[d]>>>0},F.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},F.decrypt=function(D,T,A){for(var P=this.keySize+6,C=this.invKeySchedule,S=this.invSBox,y=this.invSubMix,d=y[0],o=y[1],s=y[2],u=y[3],E=this.uint8ArrayToUint32Array_(A),f=E[0],m=E[1],w=E[2],b=E[3],h=new Int32Array(D),c=new Int32Array(h.length),l,a,g,p,v,M,U,j,W,O,k,H,X,Z,te=this.networkToHostOrderSwap;T<h.length;){for(W=te(h[T]),O=te(h[T+1]),k=te(h[T+2]),H=te(h[T+3]),v=W^C[0],M=H^C[1],U=k^C[2],j=O^C[3],X=4,Z=1;Z<P;Z++)l=d[v>>>24]^o[M>>16&255]^s[U>>8&255]^u[j&255]^C[X],a=d[M>>>24]^o[U>>16&255]^s[j>>8&255]^u[v&255]^C[X+1],g=d[U>>>24]^o[j>>16&255]^s[v>>8&255]^u[M&255]^C[X+2],p=d[j>>>24]^o[v>>16&255]^s[M>>8&255]^u[U&255]^C[X+3],v=l,M=a,U=g,j=p,X=X+4;l=S[v>>>24]<<24^S[M>>16&255]<<16^S[U>>8&255]<<8^S[j&255]^C[X],a=S[M>>>24]<<24^S[U>>16&255]<<16^S[j>>8&255]<<8^S[v&255]^C[X+1],g=S[U>>>24]<<24^S[j>>16&255]<<16^S[v>>8&255]<<8^S[M&255]^C[X+2],p=S[j>>>24]<<24^S[v>>16&255]<<16^S[M>>8&255]<<8^S[U&255]^C[X+3],c[T]=te(l^f),c[T+1]=te(p^m),c[T+2]=te(g^w),c[T+3]=te(a^b),f=W,m=O,w=k,b=H,T=T+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return T});var G=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),R=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),_=L("./src/utils/typed-array.ts"),D=16,T=function(){function A(C,S,y){var d=y===void 0?{}:y,o=d.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=S,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=A.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var y=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(y):y},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(S,y,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),y,d);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),y,d).then(o)},P.softwareDecrypt=function(S,y,d){var o=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(S=Object(F.appendUint8Array)(u,S),this.remainderData=null);var E=this.getValidChunk(S);if(!E.length)return null;o&&(d=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new R.default),f.expandKey(y);var m=s;return this.currentResult=f.decrypt(E.buffer,0,d),this.currentIV=Object(_.sliceUint8)(E,-16).buffer,m||null},P.webCryptoDecrypt=function(S,y,d){var o=this,s=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new I.default(s,y)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var E=new G.default(s,d);return E.decrypt(S.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,S,y,d)})},P.onWebCryptoError=function(S,y,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,d,o)},P.getValidChunk=function(S){var y=S,d=S.length-S.length%D;return d!==S.length&&(y=Object(_.sliceUint8)(S,0,d),this.remainderData=Object(_.sliceUint8)(S,d)),y},P.logOnce=function(S){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(B,F){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=F}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function F(T,A){T.prototype=Object.create(A.prototype),T.prototype.constructor=T,_(T,A)}function _(T,A){return _=Object.setPrototypeOf||function(C,S){return C.__proto__=S,C},_(T,A)}var D=function(T){F(A,T);function A(C,S){var y;return y=T.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=C,y.config=S,y}var P=A.prototype;return P.resetInitSegment=function(S,y,d){T.prototype.resetInitSegment.call(this,S,y,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var y=B.getID3Data(S,0)||[],d=y.length,o=S.length;d<o;d++)if(I.probe(S,d))return R.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(S,y){return I.canParse(S,y)},P.appendFrame=function(S,y,d){I.initTrackConfig(S,this.observer,y,d,S.manifestCodec);var o=I.appendFrame(S,y,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(G.default);D.minProbeByteLength=9,V.default=D},"./src/demux/adts.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"getAudioConfig",function(){return B}),L.d(V,"isHeaderPattern",function(){return F}),L.d(V,"getHeaderLength",function(){return _}),L.d(V,"getFullFrameLength",function(){return D}),L.d(V,"canGetFrameLength",function(){return T}),L.d(V,"isHeader",function(){return A}),L.d(V,"canParse",function(){return P}),L.d(V,"probe",function(){return C}),L.d(V,"initTrackConfig",function(){return S}),L.d(V,"getFrameDuration",function(){return y}),L.d(V,"parseFrameHeader",function(){return d}),L.d(V,"appendFrame",function(){return o});var G=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts");function B(s,u,E,f){var m,w,b,h,c=navigator.userAgent.toLowerCase(),l=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[E+2]&192)>>>6)+1;var g=(u[E+2]&60)>>>2;if(g>a.length-1){s.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return b=(u[E+2]&1)<<2,b|=(u[E+3]&192)>>>6,G.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+g),/firefox/i.test(c)?g>=6?(m=5,h=new Array(4),w=g-3):(m=2,h=new Array(2),w=g):c.indexOf("android")!==-1?(m=2,h=new Array(2),w=g):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&g>=6?w=g-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(g>=6&&b===1||/vivaldi/i.test(c))||!f&&b===1)&&(m=2,h=new Array(2)),w=g)),h[0]=m<<3,h[0]|=(g&14)>>1,h[1]|=(g&1)<<7,h[1]|=b<<3,m===5&&(h[1]|=(w&14)>>1,h[2]=(w&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[g],channelCount:b,codec:"mp4a.40."+m,manifestCodec:l}}function F(s,u){return s[u]===255&&(s[u+1]&246)===240}function _(s,u){return s[u+1]&1?7:9}function D(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function T(s,u){return u+5<s.length}function A(s,u){return u+1<s.length&&F(s,u)}function P(s,u){return T(s,u)&&F(s,u)&&D(s,u)<=s.length-u}function C(s,u){if(A(s,u)){var E=_(s,u);if(u+E>=s.length)return!1;var f=D(s,u);if(f<=E)return!1;var m=u+f;return m===s.length||A(s,m)}return!1}function S(s,u,E,f,m){if(!s.samplerate){var w=B(u,E,f,m);if(!w)return;s.config=w.config,s.samplerate=w.samplerate,s.channelCount=w.channelCount,s.codec=w.codec,s.manifestCodec=w.manifestCodec,G.logger.log("parsed codec:"+s.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function y(s){return 1024*9e4/s}function d(s,u,E,f,m){var w=_(s,u),b=D(s,u);if(b-=w,b>0){var h=E+f*m;return{headerLength:w,frameLength:b,stamp:h}}}function o(s,u,E,f,m){var w=y(s.samplerate),b=d(u,E,f,m,w);if(b){var h=b.frameLength,c=b.headerLength,l=b.stamp,a=c+h,g=Math.max(0,E+a-u.length),p;g?(p=new Uint8Array(a-c),p.set(u.subarray(E+c,u.length),0)):p=u.subarray(E+c,E+a);var v={unit:p,pts:l};return g||s.samples.push(v),{sample:v,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"initPTSFn",function(){return D});var G=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),R=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),F=L("./src/utils/typed-array.ts"),_=function(){function T(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=T.prototype;return A.resetInitSegment=function(C,S,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(C,S){return!1},A.appendFrame=function(C,S,y){},A.demux=function(C,S){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var y=I.getID3Data(C,0),d=y?y.length:0,o,s,u=this._audioTrack,E=this._id3Track,f=y?I.getTimeStamp(y):void 0,m=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(f,S)),y&&y.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),s=this.initPTS;d<m;){if(this.canParse(C,d)){var w=this.appendFrame(u,C,d);w?(this.frameIndex++,s=w.sample.pts,d+=w.length,o=d):d=m}else I.canParse(C,d)?(y=I.getID3Data(C,d),E.samples.push({pts:s,dts:s,data:y}),d+=y.length,o=d):d++;if(d===m&&o!==m){var b=Object(F.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:u,avcTrack:Object(R.dummyTrack)(),id3Track:E,textTrack:Object(R.dummyTrack)()}},A.demuxSampleAes=function(C,S,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(C){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},A.destroy=function(){},T}(),D=function(A,P){return Object(G.isFiniteNumber)(A)?A*90:P*9e4};V.default=_},"./src/demux/chunk-cache.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(_){this.chunks.push(_),this.dataLength+=_.length},B.flush=function(){var _=this.chunks,D=this.dataLength,T;if(_.length)_.length===1?T=_[0]:T=I(_,D);else return new Uint8Array(0);return this.reset(),T},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,B){for(var F=new Uint8Array(B),_=0,D=0;D<R.length;D++){var T=R[D];F.set(T,_),_+=T.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/utils/logger.ts"),I=function(){function R(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var _=this.data,D=this.bytesAvailable,T=_.byteLength-D,A=new Uint8Array(4),P=Math.min(4,D);if(P===0)throw new Error("no bytes available");A.set(_.subarray(T,T+P)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},B.skipBits=function(_){var D;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,D=_>>3,_-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},B.readBits=function(_){var D=Math.min(this.bitsAvailable,_),T=this.word>>>32-D;return _>32&&G.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=_-D,D>0&&this.bitsAvailable?T<<D|this.readBits(D):T},B.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},B.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(_){for(var D=8,T=8,A,P=0;P<_;P++)T!==0&&(A=this.readEG(),T=(D+A+256)%256),D=T===0?D:T},B.readSPS=function(){var _=0,D=0,T=0,A=0,P,C,S,y=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),E=this.skipEG.bind(this),f=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);y();var w=y();if(d(5),u(3),y(),f(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var b=o();if(b===3&&u(1),f(),f(),u(1),s())for(C=b!==3?8:12,S=0;S<C;S++)s()&&(S<6?m(16):m(64))}f();var h=o();if(h===0)o();else if(h===1)for(u(1),E(),E(),P=o(),S=0;S<P;S++)E();f(),u(1);var c=o(),l=o(),a=d(1);a===0&&u(1),u(1),s()&&(_=o(),D=o(),T=o(),A=o());var g=[1,1];if(s()&&s()){var p=y();switch(p){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((c+1)*16-_*2-D*2),height:(2-a)*(l+1)*16-(a?2:4)*(T+A),pixelRatio:g}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=I},"./src/demux/id3.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"isHeader",function(){return G}),L.d(V,"isFooter",function(){return I}),L.d(V,"getID3Data",function(){return R}),L.d(V,"canParse",function(){return F}),L.d(V,"getTimeStamp",function(){return _}),L.d(V,"isTimeStampFrame",function(){return D}),L.d(V,"getID3Frames",function(){return A}),L.d(V,"decodeFrame",function(){return P}),L.d(V,"utf8ArrayToStr",function(){return o}),L.d(V,"testables",function(){return s});var G=function(m,w){return w+10<=m.length&&(m[w]===73&&m[w+1]===68&&m[w+2]===51&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},I=function(m,w){return w+10<=m.length&&(m[w]===51&&m[w+1]===68&&m[w+2]===73&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},R=function(m,w){for(var b=w,h=0;G(m,w);){h+=10;var c=B(m,w+6);h+=c,I(m,w+10)&&(h+=10),w+=h}return h>0?m.subarray(b,b+h):void 0},B=function(m,w){var b=0;return b=(m[w]&127)<<21,b|=(m[w+1]&127)<<14,b|=(m[w+2]&127)<<7,b|=m[w+3]&127,b},F=function(m,w){return G(m,w)&&B(m,w+6)+10<=m.length-w},_=function(m){for(var w=A(m),b=0;b<w.length;b++){var h=w[b];if(D(h))return d(h)}return},D=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},T=function(m){var w=String.fromCharCode(m[0],m[1],m[2],m[3]),b=B(m,4),h=10;return{type:w,size:b,data:m.subarray(h,h+b)}},A=function(m){for(var w=0,b=[];G(m,w);){var h=B(m,w+6);w+=10;for(var c=w+h;w+8<c;){var l=T(m.subarray(w)),a=P(l);a&&b.push(a),w+=l.size+10}I(m,w)&&(w+=10)}return b},P=function(m){return m.type==="PRIV"?C(m):m.type[0]==="W"?y(m):S(m)},C=function(m){if(m.size<2)return;var w=o(m.data,!0),b=new Uint8Array(m.data.subarray(w.length+1));return{key:m.type,info:w,data:b.buffer}},S=function(m){if(m.size<2)return;if(m.type==="TXXX"){var w=1,b=o(m.data.subarray(w),!0);w+=b.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:b,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},y=function(m){if(m.type==="WXXX"){if(m.size<2)return;var w=1,b=o(m.data.subarray(w),!0);w+=b.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:b,data:h}}var c=o(m.data);return{key:m.type,data:c}},d=function(m){if(m.data.byteLength===8){var w=new Uint8Array(m.data),b=w[3]&1,h=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,w){w===void 0&&(w=!1);var b=E();if(b){var h=b.decode(m);if(w){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=m.length,a,g,p,v="",M=0;M<l;){if(a=m[M++],a===0&&w)return v;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:v+=String.fromCharCode(a);break;case 12:case 13:g=m[M++],v+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=m[M++],p=m[M++],v+=String.fromCharCode((a&15)<<12|(g&63)<<6|(p&63)<<0);break;default:}}return v},s={decodeTextFrame:S},u;function E(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function F(T,A){T.prototype=Object.create(A.prototype),T.prototype.constructor=T,_(T,A)}function _(T,A){return _=Object.setPrototypeOf||function(C,S){return C.__proto__=S,C},_(T,A)}var D=function(T){F(A,T);function A(){return T.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(S,y,d){T.prototype.resetInitSegment.call(this,S,y,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var y=I.getID3Data(S,0)||[],d=y.length,o=S.length;d<o;d++)if(B.probe(S,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(S,y){return B.canParse(S,y)},P.appendFrame=function(S,y,d){return this.initPTS===null?void 0:B.appendFrame(S,y,d,this.initPTS,this.frameIndex)},A}(G.default);D.minProbeByteLength=4,V.default=D},"./src/demux/mp4demuxer.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(_,D){this.remainderData=null,this.config=void 0,this.config=D}var F=B.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},B.probe=function(D){return Object(G.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},F.demux=function(D){var T=D,A=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(T=Object(G.appendUint8Array)(this.remainderData,D));var P=Object(G.segmentValidRange)(T);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=T;return{audioTrack:Object(I.dummyTrack)(),avcTrack:A,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.flush=function(){var D=Object(I.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:D,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.demuxSampleAes=function(D,T,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"appendFrame",function(){return _}),L.d(V,"parseHeader",function(){return D}),L.d(V,"isHeaderPattern",function(){return T}),L.d(V,"isHeader",function(){return A}),L.d(V,"canParse",function(){return P}),L.d(V,"probe",function(){return C});var G=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function _(S,y,d,o,s){if(d+24>y.length)return;var u=D(y,d);if(u&&d+u.frameLength<=y.length){var E=u.samplesPerFrame*9e4/u.sampleRate,f=o+s*E,m={unit:y.subarray(d,d+u.frameLength),pts:f,dts:f};return S.config=[],S.channelCount=u.channelCount,S.samplerate=u.sampleRate,S.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function D(S,y){var d=S[y+1]>>3&3,o=S[y+1]>>1&3,s=S[y+2]>>4&15,u=S[y+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var E=S[y+2]>>1&1,f=S[y+3]>>6,m=d===3?3-o:o===3?3:4,w=I[m*14+s-1]*1e3,b=d===3?0:d===2?1:2,h=R[b*3+u],c=f===3?1:2,l=B[d][o],a=F[o],g=l*8*a,p=Math.floor(l*w/h+E)*a;if(G===null){var v=navigator.userAgent||"",M=v.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var U=!!G&&G<=87;return U&&o===2&&w>=224e3&&f===0&&(S[y+3]=S[y+3]|128),{sampleRate:h,channelCount:c,frameLength:p,samplesPerFrame:g}}}function T(S,y){return S[y]===255&&(S[y+1]&224)===224&&(S[y+1]&6)!==0}function A(S,y){return y+1<S.length&&T(S,y)}function P(S,y){var d=4;return T(S,y)&&d<=S.length-y}function C(S,y){if(y+1<S.length&&T(S,y)){var d=4,o=D(S,y),s=d;o!=null&&o.frameLength&&(s=o.frameLength);var u=y+s;return u===S.length||A(S,u)}return!1}},"./src/demux/sample-aes.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),R=function(){function B(_,D,T){this.keyData=void 0,this.decrypter=void 0,this.keyData=T,this.decrypter=new G.default(_,D,{removePKCS7Padding:!1})}var F=B.prototype;return F.decryptBuffer=function(D,T){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,T)},F.decryptAacSample=function(D,T,A,P){var C=D[T].unit,S=C.subarray(16,C.length-C.length%16),y=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),d=this;this.decryptBuffer(y,function(o){var s=new Uint8Array(o);C.set(s,16),P||d.decryptAacSamples(D,T+1,A)})},F.decryptAacSamples=function(D,T,A){for(;;T++){if(T>=D.length){A();return}if(D[T].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(D,T,A,P),!P)return}},F.getAvcEncryptedData=function(D){for(var T=Math.floor((D.length-48)/160)*16+16,A=new Int8Array(T),P=0,C=32;C<=D.length-16;C+=160,P+=16)A.set(D.subarray(C,C+16),P);return A},F.getAvcDecryptedUnit=function(D,T){for(var A=new Uint8Array(T),P=0,C=32;C<=D.length-16;C+=160,P+=16)D.set(A.subarray(P,P+16),C);return D},F.decryptAvcSample=function(D,T,A,P,C,S){var y=Object(I.discardEPB)(C.data),d=this.getAvcEncryptedData(y),o=this;this.decryptBuffer(d.buffer,function(s){C.data=o.getAvcDecryptedUnit(y,s),S||o.decryptAvcSamples(D,T,A+1,P)})},F.decryptAvcSamples=function(D,T,A,P){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;T++,A=0){if(T>=D.length){P();return}for(var C=D[T].units;!(A>=C.length);A++){var S=C[A];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(D,T,A,P,S,y),!y)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var G=L("./node_modules/webworkify-webpack/index.js"),I=L.n(G),R=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),F=L("./src/utils/logger.ts"),_=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),T=L("./node_modules/eventemitter3/index.js"),A=L.n(T),P=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function S(d,o,s,u){var E=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=u;var f=d.config,m=function(l,a){a=a||{},a.frag=E.frag,a.id=E.id,d.trigger(l,a)};this.observer=new T.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,m),this.observer.on(R.Events.ERROR,m);var w={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:w,vendor:b,id:o,config:JSON.stringify(f)})}catch(c){F.logger.warn("Error in worker:",c),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,w,f,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,w,f,b,o)}var y=S.prototype;return y.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},y.push=function(o,s,u,E,f,m,w,b,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,p=m?m.start:f.start,v=f.decryptdata,M=this.frag,U=!(M&&f.cc===M.cc),j=!(M&&h.level===M.level),W=M?h.sn-M.sn:-1,O=this.part?h.part-this.part.index:1,k=!j&&(W===1||W===0&&O===1),H=self.performance.now();(j||W||f.stats.parsing.start===0)&&(f.stats.parsing.start=H),m&&(O||!k)&&(m.stats.parsing.start=H);var X=new B.TransmuxState(U,k,b,j,p);if(!k||U){F.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+k+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+p);var Z=new B.TransmuxConfig(u,E,s,w,c);this.configureTransmuxer(Z)}if(this.frag=f,this.part=m,g)g.postMessage({cmd:"demux",data:o,decryptdata:v,chunkMeta:h,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var te=a.push(o,v,h,X);Object(B.isPromise)(te)?te.then(function(Ee){l.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(te)}},y.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:o});else if(u){var f=u.flush(o);Object(B.isPromise)(f)?f.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},y.handleFlushResult=function(o,s){var u=this;o.forEach(function(E){u.handleTransmuxComplete(E)}),this.onFlush(s)},y.onWorkerMessage=function(o){var s=o.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},y.configureTransmuxer=function(o){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},y.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},S}()},"./src/demux/transmuxer-worker.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return _});var G=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),F=L.n(B);function _(C){var S=new B.EventEmitter,y=function(o,s){C.postMessage({event:o,data:s})};S.on(I.Events.FRAG_DECRYPTED,y),S.on(I.Events.ERROR,y),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new G.default(S,o.typeSupported,s,o.vendor,o.id),Object(R.enableLogs)(s.debug),y("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var u=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(u)?u.then(function(m){D(C,m)}):D(C,u);break}case"flush":{var E=o.chunkMeta,f=C.transmuxer.flush(E);Object(G.isPromise)(f)?f.then(function(m){A(C,m,E)}):A(C,f,E);break}default:break}})}function D(C,S){if(P(S.remuxResult))return;var y=[],d=S.remuxResult,o=d.audio,s=d.video;o&&T(y,o),s&&T(y,s),C.postMessage({event:"transmuxComplete",data:S},y)}function T(C,S){S.data1&&C.push(S.data1.buffer),S.data2&&C.push(S.data2.buffer)}function A(C,S,y){S.forEach(function(d){D(C,d)}),C.postMessage({event:"flush",data:y})}function P(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return s}),L.d(V,"isPromise",function(){return f}),L.d(V,"TransmuxConfig",function(){return m}),L.d(V,"TransmuxState",function(){return w});var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),F=L("./src/demux/mp4demuxer.ts"),_=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),T=L("./src/remux/mp4-remuxer.ts"),A=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),S=L("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(b){S.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var d=[{demux:_.default,remux:T.default},{demux:F.default,remux:A.default},{demux:B.default,remux:T.default},{demux:D.default,remux:T.default}],o=1024;d.forEach(function(b){var h=b.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function b(c,l,a,g,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 P.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=g,this.id=p}var h=b.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,g,p){var v=this,M=g.transmuxing;M.executeStart=y();var U=new Uint8Array(l),j=this.cache,W=this.config,O=this.currentTransmuxState,k=this.transmuxConfig;p&&(this.currentTransmuxState=p);var H=u(U,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var Z=X.softwareDecrypt(U,H.key.buffer,H.iv.buffer);if(!Z)return M.executeEnd=y(),E(g);U=new Uint8Array(Z)}else return this.decryptionPromise=X.webCryptoDecrypt(U,H.key.buffer,H.iv.buffer).then(function(we){var _e=v.push(we,null,g);return v.decryptionPromise=null,_e}),this.decryptionPromise}var te=p||O,Ee=te.contiguous,fe=te.discontinuity,Te=te.trackSwitch,pe=te.accurateTimeOffset,ge=te.timeOffset,ce=k.audioCodec,he=k.videoCodec,J=k.defaultInitPts,se=k.duration,q=k.initSegmentData;if((fe||Te)&&this.resetInitSegment(q,ce,he,se),fe&&this.resetInitialTimestamp(J),Ee||this.resetContiguity(),this.needsProbing(U,fe,Te)){if(j.dataLength){var ye=j.flush();U=Object(C.appendUint8Array)(ye,U)}this.configureTransmuxer(U,k)}var Se=this.transmux(U,H,ge,pe,g),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,M.executeEnd=y(),Se},h.flush=function(l){var a=this,g=l.transmuxing;g.executeStart=y();var p=this.decrypter,v=this.cache,M=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(p){var O=p.flush();O&&j.push(this.push(O,null,l))}var k=v.dataLength;v.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return k>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=y(),[E(l)];var Z=H.flush(W);return f(Z)?Z.then(function(te){return a.flushRemux(j,te,l),j}):(this.flushRemux(j,Z,l),j)},h.flushRemux=function(l,a,g){var p=a.audioTrack,v=a.avcTrack,M=a.id3Track,U=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,O=j.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var k=this.remuxer.remux(p,v,M,U,O,W,!0,this.id);l.push({remuxResult:k,chunkMeta:g}),g.transmuxing.executeEnd=y()},h.resetInitialTimestamp=function(l){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(l),g.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,g,p){var v=this.demuxer,M=this.remuxer;if(!v||!M)return;v.resetInitSegment(a,g,p),M.resetInitSegment(l,a,g)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,g,p,v){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,g,p,v):M=this.transmuxUnencrypted(l,g,p,v),M},h.transmuxUnencrypted=function(l,a,g,p){var v=this.demuxer.demux(l,a,!1,!this.config.progressive),M=v.audioTrack,U=v.avcTrack,j=v.id3Track,W=v.textTrack,O=this.remuxer.remux(M,U,j,W,a,g,!1,this.id);return{remuxResult:O,chunkMeta:p}},h.transmuxSampleAes=function(l,a,g,p,v){var M=this;return this.demuxer.demuxSampleAes(l,a,g).then(function(U){var j=M.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,g,p,!1,M.id);return{remuxResult:j,chunkMeta:v}})},h.configureTransmuxer=function(l,a){for(var g=this.config,p=this.observer,v=this.typeSupported,M=this.vendor,U=a.audioCodec,j=a.defaultInitPts,W=a.duration,O=a.initSegmentData,k=a.videoCodec,H,X=0,Z=d.length;X<Z;X++)if(d[X].demux.probe(l)){H=d[X];break}H||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:F.default,remux:A.default});var te=this.demuxer,Ee=this.remuxer,fe=H.remux,Te=H.demux;(!Ee||!(Ee instanceof fe))&&(this.remuxer=new fe(p,g,v,M)),(!te||!(te instanceof Te))&&(this.demuxer=new Te(p,g,v),this.probe=Te.probe),this.resetInitSegment(O,U,k,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,g){return!this.demuxer||!this.remuxer||a||g},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new R.default(this.observer,this.config)),l},b}();function u(b,h){var c=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var E=function(h){return{remuxResult:{},chunkMeta:h}};function f(b){return"then"in b&&b.then instanceof Function}var m=function(h,c,l,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=g},w=function(h,c,l,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"discardEPB",function(){return E});var G=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),R=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),F=L("./src/demux/sample-aes.ts"),_=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),T=L("./src/utils/logger.ts"),A=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},C=function(){function f(w,b,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=w,this.config=b,this.typeSupported=h}f.probe=function(b){var h=f.syncOffset(b);return h<0?!1:(h&&T.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),c=0;c<h;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},f.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:P[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(b,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=b,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(b,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,g=this._avcTrack,p=this._audioTrack,v=this._id3Track,M=g.pid,U=g.pesData,j=p.pid,W=v.pid,O=p.pesData,k=v.pesData,H=!1,X=this.pmtParsed,Z=this._pmtId,te=b.length;if(this.remainderData&&(b=Object(D.appendUint8Array)(this.remainderData,b),te=b.length,this.remainderData=null),te<188&&!l)return this.remainderData=b,{audioTrack:p,avcTrack:g,id3Track:v,textTrack:this._txtTrack};var Ee=Math.max(0,f.syncOffset(b));te-=(te+Ee)%188,te<b.byteLength&&!l&&(this.remainderData=new Uint8Array(b.buffer,te,b.buffer.byteLength-te));for(var fe=Ee;fe<te;fe+=188)if(b[fe]===71){var Te=!!(b[fe+1]&64),pe=((b[fe+1]&31)<<8)+b[fe+2],ge=(b[fe+3]&48)>>4,ce=void 0;if(ge>1){if(ce=fe+5+b[fe+4],ce===fe+188)continue}else ce=fe+4;switch(pe){case M:Te&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(ce,fe+188)),U.size+=fe+188-ce);break;case j:Te&&(O&&(a=o(O))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(b.subarray(ce,fe+188)),O.size+=fe+188-ce);break;case W:Te&&(k&&(a=o(k))&&this.parseID3PES(a),k={data:[],size:0}),k&&(k.data.push(b.subarray(ce,fe+188)),k.size+=fe+188-ce);break;case 0:Te&&(ce+=b[ce]+1),Z=this._pmtId=y(b,ce);break;case Z:{Te&&(ce+=b[ce]+1);var he=d(b,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=he.avc,M>0&&(g.pid=M),j=he.audio,j>0&&(p.pid=j,p.isAAC=he.isAAC),W=he.id3,W>0&&(v.pid=W),H&&!X&&(T.logger.log("reparse from beginning"),H=!1,fe=Ee-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=U,p.pesData=O,v.pesData=k;var J={audioTrack:p,avcTrack:g,id3Track:v,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},m.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(b){var h=b.audioTrack,c=b.avcTrack,l=b.id3Track,a=c.pesData,g=h.pesData,p=l.pesData,v;a&&(v=o(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,g&&(v=o(g))?(h.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),h.pesData=null):(g!=null&&g.size&&T.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=g),p&&(v=o(p))?(this.parseID3PES(v),l.pesData=null):l.pesData=p},m.demuxSampleAes=function(b,h,c){var l=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new F.default(this.observer,this.config,h);return this.decrypt(l,a)},m.decrypt=function(b,h){return new Promise(function(c){var l=b.audioTrack,a=b.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(b,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(b.data),g=!1,p=this.avcSample,v,M=!1;b.data=null,p&&a.length&&!l.audFound&&(s(p,l),p=this.avcSample=S(!1,b.pts,b.dts,"")),a.forEach(function(U){switch(U.type){case 1:{v=!0,p||(p=c.avcSample=S(!0,b.pts,b.dts,"")),g&&(p.debug+="NDR "),p.frame=!0;var j=U.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(p.key=!0)}break}case 5:v=!0,p||(p=c.avcSample=S(!0,b.pts,b.dts,"")),g&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{v=!0,g&&p&&(p.debug+="SEI ");var O=new R.default(E(U.data));O.readUByte();for(var k=0,H=0,X=!1,Z=0;!X&&O.bytesAvailable>1;){k=0;do Z=O.readUByte(),k+=Z;while(Z===255);H=0;do Z=O.readUByte(),H+=Z;while(Z===255);if(k===4&&O.bytesAvailable!==0){X=!0;var te=O.readUByte();if(te===181){var Ee=O.readUShort();if(Ee===49){var fe=O.readUInt();if(fe===1195456820){var Te=O.readUByte();if(Te===3){for(var pe=O.readUByte(),ge=O.readUByte(),ce=31&pe,he=[pe,ge],J=0;J<ce;J++)he.push(O.readUByte()),he.push(O.readUByte()),he.push(O.readUByte());u(c._txtTrack.samples,{type:3,pts:b.pts,bytes:he})}}}}}else if(k===5&&O.bytesAvailable!==0){if(X=!0,H>16){for(var se=[],q=0;q<16;q++)se.push(O.readUByte().toString(16)),(q===3||q===5||q===7||q===9)&&se.push("-");for(var ye=H-16,Se=new Uint8Array(ye),me=0;me<ye;me++)Se[me]=O.readUByte();u(c._txtTrack.samples,{pts:b.pts,payloadType:k,uuid:se.join(""),userData:Object(B.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(H<O.bytesAvailable)for(var we=0;we<H;we++)O.readUByte()}break}case 7:if(v=!0,M=!0,g&&p&&(p.debug+="SPS "),!l.sps){var _e=new R.default(U.data),ke=_e.readSPS();l.width=ke.width,l.height=ke.height,l.pixelRatio=ke.pixelRatio,l.sps=[U.data],l.duration=c._duration;for(var Ie=U.data.subarray(1,4),De="avc1.",Le=0;Le<3;Le++){var ze=Ie[Le].toString(16);ze.length<2&&(ze="0"+ze),De+=ze}l.codec=De}break;case 8:v=!0,g&&p&&(p.debug+="PPS "),l.pps||(l.pps=[U.data]);break;case 9:v=!1,l.audFound=!0,p&&s(p,l),p=c.avcSample=S(!1,b.pts,b.dts,g?"AUD ":"");break;case 12:v=!1;break;default:v=!1,p&&(p.debug+="unknown NAL "+U.type+" ");break}if(p&&v){var Ye=p.units;Ye.push(U)}}),h&&p&&(s(p,l),this.avcSample=null)},m.getLastNalUnit=function(){var b,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(b){var h=b.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,g=[],p=0,v,M,U,j=-1,W=0;for(l===-1&&(j=0,W=b[0]&31,l=0,p=1);p<h;){if(v=b[p++],!l){l=v?0:1;continue}if(l===1){l=v?0:2;continue}if(!v)l=3;else if(v===1){if(j>=0){var O={data:b.subarray(j,p-l-1),type:W};g.push(O)}else{var k=this.getLastNalUnit();if(k&&(a&&p<=4-a&&(k.state&&(k.data=k.data.subarray(0,k.data.byteLength-a))),M=p-l-1,M>0)){var H=new Uint8Array(k.data.byteLength+M);H.set(k.data,0),H.set(b.subarray(0,M),k.data.byteLength),k.data=H,k.state=0}}p<h?(U=b[p]&31,j=p,W=U,l=0):l=-1}else l=0}if(j>=0&&l>=0){var X={data:b.subarray(j,h),type:W,state:l};g.push(X)}if(g.length===0){var Z=this.getLastNalUnit();if(Z){var te=new Uint8Array(Z.data.byteLength+b.byteLength);te.set(Z.data,0),te.set(b,Z.data.byteLength),Z.data=te}}return c.naluState=l,g},m.parseAACPES=function(b){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=b.data;if(l){this.aacOverFlow=null;var g=l.sample.unit.byteLength,p=Math.min(l.missing,g),v=g-p;l.sample.unit.set(a.subarray(0,p),v),c.samples.push(l.sample),h=l.missing}var M,U;for(M=h,U=a.length;M<U-1&&!G.isHeader(a,M);M++);if(M!==h){var j,W;if(M<U-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),T.logger.warn("parsing error:"+j),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,M,this.audioCodec);var O;if(b.pts!==void 0)O=b.pts;else if(l){var k=G.getFrameDuration(c.samplerate);O=l.sample.pts+k}else{T.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<U;)if(G.isHeader(a,M)){if(M+5<U){var X=G.appendFrame(c,a,M,O,H);if(X)if(X.missing)this.aacOverFlow=X;else{M+=X.length,H++;continue}}break}else M++},m.parseMPEGPES=function(b){var h=b.data,c=h.length,l=0,a=0,g=b.pts;if(g===void 0){T.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(I.isHeader(h,a)){var p=I.appendFrame(this._audioTrack,h,a,g,l);if(p)a+=p.length,l++;else break}else a++},m.parseID3PES=function(b){if(b.pts===void 0){T.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},f}();C.minProbeByteLength=188;function S(f,m,w,b){return{key:f,frame:!1,pts:m,dts:w,units:[],debug:b,length:0}}function y(f,m){return(f[m+10]&31)<<8|f[m+11]}function d(f,m,w,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],l=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<l;){var g=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!b){T.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=g);break;case 21:h.id3===-1&&(h.id3=g);break;case 219:if(!b){T.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=g);break;case 3:case 4:w?h.audio===-1&&(h.audio=g,h.isAAC=!1):T.logger.log("MPEG audio found, not supported in this browser");break;case 36:T.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,w,b,h,c,l,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}w=a[0];var p=(w[0]<<16)+(w[1]<<8)+w[2];if(p===1){if(b=(w[4]<<8)+w[5],b&&b>f.size-6)return null;var v=w[7];v&192&&(c=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,v&64?(l=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,c-l>60*9e4&&(T.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=w[8];var M=h+9;if(f.size<=M)return null;f.size-=M;for(var U=new Uint8Array(f.size),j=0,W=a.length;j<W;j++){w=a[j];var O=w.byteLength;if(M)if(M>O){M-=O;continue}else w=w.subarray(M),O-=M,M=0;U.set(w,m),m+=O}return b&&(b-=h+3),{data:U,pts:c,dts:l,len:b}}return null}function s(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var w=m.samples,b=w.length;if(b){var h=w[b-1];f.pts=h.pts,f.dts=h.dts}else{m.dropped++;return}}m.samples.push(f)}f.debug.length&&T.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function u(f,m){var w=f.length;if(w>0){if(m.pts>=f[w-1].pts)f.push(m);else for(var b=w-1;b>=0;b--)if(m.pts<f[b].pts){f.splice(b,0,m);break}}else f.push(m)}function E(f){for(var m=f.byteLength,w=[],b=1;b<m-2;)f[b]===0&&f[b+1]===0&&f[b+2]===3?(w.push(b+2),b+=2):b++;if(w.length===0)return f;var h=m-w.length,c=new Uint8Array(h),l=0;for(b=0;b<h;l++,b++)l===w[0]&&(l++,w.shift()),c[b]=f[l];return c}V.default=C},"./src/errors.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"ErrorTypes",function(){return G}),L.d(V,"ErrorDetails",function(){return I});var G;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(G||(G={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"Events",function(){return G});var G;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(G||(G={}))},"./src/hls.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return f});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G),R=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),F=L("./src/controller/id3-track-controller.ts"),_=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),T=L("./src/controller/fragment-tracker.ts"),A=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),S=L("./src/config.ts"),y=L("./node_modules/eventemitter3/index.js"),d=L.n(y),o=L("./src/events.ts"),s=L("./src/errors.ts");function u(m,w){for(var b=0;b<w.length;b++){var h=w[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function E(m,w,b){return w&&u(m.prototype,w),b&&u(m,b),m}var f=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(S.mergeConfig)(m.DefaultConfig,b);this.userConfig=b,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(S.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,g=h.fpsController,p=this.abrController=new c(this),v=this.bufferController=new l(this),M=this.capLevelController=new a(this),U=new g(this),j=new R.default(this),W=new B.default(this),O=new F.default(this),k=this.levelController=new D.default(this),H=new T.FragmentTracker(this),X=this.streamController=new A.default(this,H);M.setStreamController(X),U.setStreamController(X);var Z=[k,X];this.networkControllers=Z;var te=[j,W,p,v,M,U,O,H];this.audioTrackController=this.createController(h.audioTrackController,null,Z),this.createController(h.audioStreamController,H,Z),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,Z),this.createController(h.subtitleStreamController,H,Z),this.createController(h.timelineController,null,te),this.emeController=this.createController(h.emeController,null,te),this.cmcdController=this.createController(h.cmcdController,null,te),this.latencyController=this.createController(_.default,null,te),this.coreComponents=te}var w=m.prototype;return w.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},w.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},w.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},w.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},w.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},w.listeners=function(h){return this._emitter.listeners(h)},w.emit=function(h,c,l){return this._emitter.emit(h,c,l)},w.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},w.listenerCount=function(h){return this._emitter.listenerCount(h)},w.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},w.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},w.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},w.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},w.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},w.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},w.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},E(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 l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:S.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"isSupported",function(){return R}),L.d(V,"changeTypeSupported",function(){return B});var G=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var F=Object(G.getMediaSource)();if(!F)return!1;var _=I(),D=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),T=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!D&&!!T}function B(){var F,_=I();return typeof(_==null||((F=_.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C}),L.d(V,"LoadError",function(){return y});var G=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,T(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(u){if(u===null||!D(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,E)}function E(){return F(u,arguments,A(this).constructor)}return E.prototype=Object.create(u.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),T(E,u)},B(d)}function F(d,o,s){return _()?F=Reflect.construct:F=function(E,f,m){var w=[null];w.push.apply(w,f);var b=Function.bind.apply(E,w),h=new b;return m&&T(h,m.prototype),h},F.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function D(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function T(d,o){return T=Object.setPrototypeOf||function(u,E){return u.__proto__=E,u},T(d,o)}function A(d){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},A(d)}var P=Math.pow(2,17),C=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,E){var f=this,m=u.url;if(!m)return Promise.reject(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var w=this.config,b=w.fLoader,h=w.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=u.loader=b?new b(w):new h(w),g=S(u),p={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:P};u.stats=a.stats,a.load(g,p,{onSuccess:function(M,U,j,W){f.resetLoader(u,a),c({frag:u,part:null,payload:M.data,networkDetails:W})},onError:function(M,U,j){f.resetLoader(u,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:M,networkDetails:j}))},onAbort:function(M,U,j){f.resetLoader(u,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(M,U,j){f.resetLoader(u,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(M,U,j,W){E&&E({frag:u,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(u,E,f){var m=this;this.abort();var w=this.config,b=w.fLoader,h=w.loader;return new Promise(function(c,l){m.loader&&m.loader.destroy();var a=m.loader=u.loader=b?new b(w):new h(w),g=S(u,E),p={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:P};E.stats=a.stats,a.load(g,p,{onSuccess:function(M,U,j,W){m.resetLoader(u,a),m.updateStatsFromPart(u,E);var O={frag:u,part:E,payload:M.data,networkDetails:W};f(O),c(O)},onError:function(M,U,j){m.resetLoader(u,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:E,response:M,networkDetails:j}))},onAbort:function(M,U,j){u.stats.aborted=E.stats.aborted,m.resetLoader(u,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:E,networkDetails:j}))},onTimeout:function(M,U,j){m.resetLoader(u,a),l(new y({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:E,networkDetails:j}))}})})},o.updateStatsFromPart=function(u,E){var f=u.stats,m=E.stats,w=m.total;if(f.loaded+=m.loaded,w){var b=Math.round(u.duration/E.duration),h=Math.min(Math.round(f.loaded/w),b),c=b-h,l=c*Math.round(f.loaded/h);f.total=f.loaded+l}else f.total=Math.max(f.loaded,f.total);var a=f.loading,g=m.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(u,E){u.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},d}();function S(d,o){o===void 0&&(o=null);var s=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},E=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(G.isFiniteNumber)(E)&&Object(G.isFiniteNumber)(f)&&(u.rangeStart=E,u.rangeEnd=f),u}var y=function(d){R(o,d);function o(s){for(var u,E=arguments.length,f=new Array(E>1?E-1:0),m=1;m<E;m++)f[m-1]=arguments[m];return u=d.call.apply(d,[this].concat(f))||this,u.data=void 0,u.data=s,u}return o}(B(Error))},"./src/loader/fragment.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"ElementaryStreamTypes",function(){return C}),L.d(V,"BaseSegment",function(){return S}),L.d(V,"Fragment",function(){return y}),L.d(V,"Part",function(){return d});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/utils/logger.ts"),F=L("./src/loader/level-key.ts"),_=L("./src/loader/load-stats.ts");function D(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,T(o,s)}function T(o,s){return T=Object.setPrototypeOf||function(E,f){return E.__proto__=f,E},T(o,s)}function A(o,s){for(var u=0;u<s.length;u++){var E=s[u];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(o,E.key,E)}}function P(o,s,u){return s&&A(o.prototype,s),u&&A(o,u),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var S=function(){function o(u){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[C.AUDIO]=null,E[C.VIDEO]=null,E[C.AUDIOVIDEO]=null,E),this.baseurl=u}var s=o.prototype;return s.setByteRange=function(E,f){var m=E.split("@",2),w=[];m.length===1?w[0]=f?f.byteRangeEndOffset:0:w[0]=parseInt(m[1]),w[1]=parseInt(m[0])+w[0],this._byteRange=w},P(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(E){this._url=E}}]),o}(),y=function(o){D(s,o);function s(E,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 _.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=E,m}var u=s.prototype;return u.createInitializationVector=function(f){for(var m=new Uint8Array(16),w=12;w<16;w++)m[w]=f>>8*(15-w)&255;return m},u.setDecryptDataFromLevelKey=function(f,m){var w=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(w=F.LevelKey.fromURI(f.uri),w.method=f.method,w.iv=this.createInitializationVector(m),w.keyFormat="identity"),w},u.setElementaryStreamInfo=function(f,m,w,b,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[f];if(!a){l[f]={startPTS:m,endPTS:w,startDTS:b,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,h)},u.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null},P(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.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(G.isFiniteNumber)(this.programDateTime))return null;var f=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(S),d=function(o){D(s,o);function s(u,E,f,m,w){var b;b=o.call(this,f)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new _.LoadStats,b.duration=u.decimalFloatingPoint("DURATION"),b.gap=u.bool("GAP"),b.independent=u.bool("INDEPENDENT"),b.relurl=u.enumeratedString("URI"),b.fragment=E,b.index=m;var h=u.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,w),w&&(b.fragOffset=w.fragOffset+w.duration),b}return P(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),s}(S)},"./src/loader/key-loader.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return B});var G=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=function(){function F(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var _=F.prototype;return _._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var T in this.loaders){var A=this.loaders[T];A&&A.destroy()}this.loaders={}},_.onKeyLoading=function(T,A){var P=A.frag,C=P.type,S=this.loaders[C];if(!P.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=P.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(S&&(R.logger.warn("abort previous key loader for type:"+C),S.abort()),!y){R.logger.warn("key uri is falsy");return}var o=d.loader,s=P.loader=this.loaders[C]=new o(d);this.decrypturl=y,this.decryptkey=null;var u={url:y,frag:P,responseType:"arraybuffer"},E={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,E,f)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:P}))},_.loadsuccess=function(T,A,P){var C=P.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(T.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},_.loaderror=function(T,A){var P=A.frag,C=P.loader;C&&C.abort(),delete this.loaders[P.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:T})},_.loadtimeout=function(T,A){var P=A.frag,C=P.loader;C&&C.abort(),delete this.loaders[P.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},F}()},"./src/loader/level-details.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"LevelDetails",function(){return F});var G=L("./src/polyfills/number.ts");function I(_,D){for(var T=0;T<D.length;T++){var A=D[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(_,A.key,A)}}function R(_,D,T){return D&&I(_.prototype,D),T&&I(_,T),_}var B=10,F=function(){function _(T){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=T}var D=_.prototype;return D.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-A.lastPartSn,C=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!C||!!P,this.advanced=this.endSN>A.endSN||P>0||P===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},R(_,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var P=this.driftEnd-this.driftStart;return P*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"LevelKey",function(){return F});var G=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(G);function R(_,D){for(var T=0;T<D.length;T++){var A=D[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(_,A.key,A)}}function B(_,D,T){return D&&R(_.prototype,D),T&&R(_,T),_}var F=function(){_.fromURL=function(T,A){return new _(T,A)},_.fromURI=function(T){return new _(T)};function _(D,T){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,T?this._uri=Object(G.buildAbsoluteURL)(D,T,{alwaysNormalize:!0}):this._uri=D}return B(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"LoadStats",function(){return G});var G=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return s});var G=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/loader/fragment.ts"),F=L("./src/loader/level-details.ts"),_=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),T=L("./src/utils/logger.ts"),A=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var b,h;return d.test((b=(h=I.parseURL(w))===null||h===void 0?void 0:h.path)!=null?b:"")}var s=function(){function w(){}return w.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},w.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},w.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(h,c){var l=[],a={},g=!1;P.lastIndex=0;for(var p;(p=P.exec(h))!=null;)if(p[1]){var v=new D.AttrList(p[1]),M={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:w.resolve(p[2],c)},U=v.decimalResolution("RESOLUTION");U&&(M.width=U.width,M.height=U.height),u((v.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=w.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(p[3]){var j=new D.AttrList(p[3]);j["DATA-ID"]&&(g=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:g?a:null}},w.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var g,p=[],v=0;for(C.lastIndex=0;(g=C.exec(h))!==null;){var M=new D.AttrList(g[1]);if(M.TYPE===l){var U={attrs:M,bitrate:0,id:v++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?w.resolve(M.URI,c):""};if(a.length){var j=w.findGroup(a,U.groupId)||a[0];E(U,j,"audioCodec"),E(U,j,"textCodec")}p.push(U)}}return p},w.parseLevelPlaylist=function(h,c,l,a,g){var p=new F.LevelDetails(c),v=p.fragments,M=null,U=0,j=0,W=0,O=0,k=null,H=new B.Fragment(a,c),X,Z,te,Ee=-1,fe=!1;for(S.lastIndex=0,p.m3u8=h;(X=S.exec(h))!==null;){fe&&(fe=!1,H=new B.Fragment(a,c),H.start=W,H.sn=U,H.cc=O,H.level=l,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var Te=X[1];if(Te){H.duration=parseFloat(Te);var pe=(" "+X[2]).slice(1);H.title=pe||null,H.tagList.push(pe?["INF",Te,pe]:["INF",Te])}else if(X[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,te&&(H.levelkey=te),H.sn=U,H.level=l,H.cc=O,H.urlId=g,v.push(H),H.relurl=(" "+X[3]).slice(1),m(H,k),k=H,W+=H.duration,U++,j=0,fe=!0);else if(X[4]){var ge=(" "+X[4]).slice(1);k?H.setByteRange(ge,k):H.setByteRange(ge)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Ee===-1&&(Ee=v.length);else{if(X=X[0].match(y),!X){T.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z<X.length&&!(typeof X[Z]!="undefined");Z++);var ce=(" "+X[Z]).slice(1),he=(" "+X[Z+1]).slice(1),J=X[Z+2]?(" "+X[Z+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":p.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":U=p.startSN=parseInt(he);break;case"SKIP":{var se=new D.AttrList(he),q=se.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(q)){p.skippedSegments=q;for(var ye=q;ye--;)v.unshift(null);U+=q}var Se=se.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(p.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(he);break;case"VERSION":p.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(he||J)&&H.tagList.push(J?[he,J]:[he]);break;case"DIS":O++;case"GAP":H.tagList.push([ce]);break;case"BITRATE":H.tagList.push([ce,he]);break;case"DISCONTINUITY-SEQ":O=parseInt(he);break;case"KEY":{var me,we=new D.AttrList(he),_e=we.enumeratedString("METHOD"),ke=we.URI,Ie=we.hexadecimalInteger("IV"),De=we.enumeratedString("KEYFORMATVERSIONS"),Le=we.enumeratedString("KEYID"),ze=(me=we.enumeratedString("KEYFORMAT"))!=null?me:"identity",Ye=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ye.indexOf(ze)>-1){T.logger.warn("Keyformat "+ze+" is not supported from the manifest");continue}else if(ze!=="identity")continue;_e&&(te=_.LevelKey.fromURL(c,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(_e)>=0&&(te.method=_e,te.keyFormat=ze,Le&&(te.keyID=Le),De&&(te.keyFormatVersions=De),te.iv=Ie));break}case"START":{var Ve=new D.AttrList(he),je=Ve.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(je)&&(p.startTimeOffset=je);break}case"MAP":{var Xe=new D.AttrList(he);H.relurl=Xe.URI,Xe.BYTERANGE&&H.setByteRange(Xe.BYTERANGE),H.level=l,H.sn="initSegment",te&&(H.levelkey=te),H.initSegment=null,M=H,fe=!0;break}case"SERVER-CONTROL":{var Be=new D.AttrList(he);p.canBlockReload=Be.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Be.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Be.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Be.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Be.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var He=new D.AttrList(he);p.partTarget=He.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=p.partList;Ae||(Ae=p.partList=[]);var Ze=j>0?Ae[Ae.length-1]:void 0,$e=j++,Oe=new B.Part(new D.AttrList(he),H,c,$e,Ze);Ae.push(Oe),H.duration+=Oe.duration;break}case"PRELOAD-HINT":{var Fe=new D.AttrList(he);p.preloadHint=Fe;break}case"RENDITION-REPORT":{var ae=new D.AttrList(he);p.renditionReports=p.renditionReports||[],p.renditionReports.push(ae);break}default:T.logger.warn("line parsed but not handled: "+X);break}}}k&&!k.relurl?(v.pop(),W-=k.duration,p.partList&&(p.fragmentHint=k)):p.partList&&(m(H,k),H.cc=O,p.fragmentHint=H);var le=v.length,ue=v[0],$=v[le-1];if(W+=p.skippedSegments*p.targetduration,W>0&&le&&$){p.averagetargetduration=W/le;var Q=$.sn;p.endSN=Q!=="initSegment"?Q:0,ue&&(p.startCC=ue.cc,ue.initSegment||p.fragments.every(function(ee){return ee.relurl&&o(ee.relurl)})&&(T.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=$.relurl,H.level=l,H.sn="initSegment",ue.initSegment=H,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(W+=p.fragmentHint.duration),p.totalduration=W,p.endCC=O,Ee>0&&f(v,Ee),p},w}();function u(w,b){["video","audio","text"].forEach(function(h){var c=w.filter(function(a){return Object(A.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=l.length>0?l[0]:c[0],w=w.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=w}function E(w,b,h){var c=b[h];c&&(w[h]=c)}function f(w,b){for(var h=w[b],c=b;c--;){var l=w[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function m(w,b){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):b!=null&&b.programDateTime&&(w.programDateTime=b.endProgramDateTime),Object(G.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),_=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),T=L("./src/utils/attr-list.ts");function A(S){var y=S.type;switch(y){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function P(S,y){var d=S.url;return(d===void 0||d.indexOf("data:")===0)&&(d=y.url),d}var C=function(){function S(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var y=S.prototype;return y.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(o){var s=this.hls.config,u=s.pLoader,E=s.loader,f=u||E,m=new f(s);return o.loader=m,this.loaders[o.type]=m,m},y.getInternalLoader=function(o){return this.loaders[o.type]},y.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},y.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(o,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},y.onLevelLoading=function(o,s){var u=s.id,E=s.level,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:null,level:E,responseType:"text",type:D.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},y.onAudioTrackLoading=function(o,s){var u=s.id,E=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:E,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},y.onSubtitleTrackLoading=function(o,s){var u=s.id,E=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:E,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},y.load=function(o){var s,u=this.hls.config,E=this.getInternalLoader(o);if(E){var f=E.context;if(f&&f.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),E.abort()}var m,w,b,h;switch(o.type){case D.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,w=u.manifestLoadingTimeOut,b=u.manifestLoadingRetryDelay,h=u.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:m=0,w=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,w=u.levelLoadingTimeOut,b=u.levelLoadingRetryDelay,h=u.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(w=Math.min(Math.max(l*3,a*.8)*1e3,w))}}var g={timeout:w,maxRetry:m,retryDelay:b,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(o,g,p)},y.loadsuccess=function(o,s,u,E){if(E===void 0&&(E=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,s,u,E);return}this.resetInternalLoader(u.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",E);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,u,E):this.handleMasterPlaylist(o,s,u,E)},y.loaderror=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,o)},y.loadtimeout=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},y.handleMasterPlaylist=function(o,s,u,E){var f=this.hls,m=o.data,w=P(o,u),b=_.default.parseMasterPlaylist(m,w),h=b.levels,c=b.sessionData;if(!h.length){this.handleManifestParsingError(o,u,"no level found in manifest",E);return}var l=h.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=h.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),g=_.default.parseMasterPlaylistMedia(m,w,"AUDIO",l),p=_.default.parseMasterPlaylistMedia(m,w,"SUBTITLES",a),v=_.default.parseMasterPlaylistMedia(m,w,"CLOSED-CAPTIONS");if(g.length){var M=g.some(function(U){return!U.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new T.AttrList({}),bitrate:0,url:""}))}f.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:p,captions:v,url:w,stats:s,networkDetails:E,sessionData:c})},y.handleTrackOrLevelPlaylist=function(o,s,u,E){var f=this.hls,m=u.id,w=u.level,b=u.type,h=P(o,u),c=Object(G.isFiniteNumber)(m)?m:0,l=Object(G.isFiniteNumber)(w)?w:c,a=A(u),g=_.default.parseLevelPlaylist(o.data,h,l,a,c);if(!g.fragments.length){f.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(b===D.PlaylistContextType.MANIFEST){var p={attrs:new T.AttrList({}),bitrate:0,details:g,name:"",url:h};f.trigger(I.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:s,networkDetails:E,sessionData:null})}if(s.parsing.end=performance.now(),g.needSidxRanges){var v,M=(v=g.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:M,isSidxRequest:!0,type:b,level:w,levelDetails:g,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=g,this.handlePlaylistLoaded(o,s,u,E)},y.handleSidxRequest=function(o,s){var u=Object(F.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var E=u.references,f=s.levelDetails;E.forEach(function(m,w){var b=m.info,h=f.fragments[w];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(o,s,u,E){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:s,networkDetails:E})},y.handleNetworkError=function(o,s,u,E){u===void 0&&(u=!1),B.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=R.ErrorDetails.UNKNOWN,m=!1,w=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:f=u?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case D.PlaylistContextType.LEVEL:f=u?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.AUDIO_TRACK:f=u?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:f=u?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}w&&this.resetInternalLoader(o.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:w,context:o,networkDetails:s};E&&(b.response=E),this.hls.trigger(I.Events.ERROR,b)},y.handlePlaylistLoaded=function(o,s,u,E){var f=u.type,m=u.level,w=u.id,b=u.groupId,h=u.loader,c=u.levelDetails,l=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",E);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:m||0,id:w||0,stats:s,networkDetails:E,deliveryDirectives:l});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:w||0,groupId:b||"",stats:s,networkDetails:E,deliveryDirectives:l});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:w||0,groupId:b||"",stats:s,networkDetails:E,deliveryDirectives:l});break}},S}();V.default=C},"./src/polyfills/number.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"isFiniteNumber",function(){return G}),L.d(V,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,V,L){"use strict";L.r(V);var G=function(){function I(){}return I.getSilentFrame=function(B,F){switch(B){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===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(F===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(F===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(F===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(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();V.default=G},"./src/remux/mp4-generator.ts":function(ne,V,L){"use strict";L.r(V);var G=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var F;for(F in R.types)R.types.hasOwnProperty(F)&&(R.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var _=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:_,audio:D};var T=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=A,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 P=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,P,S,P,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,T))},R.box=function(F){for(var _=8,D=arguments.length,T=new Array(D>1?D-1:0),A=1;A<D;A++)T[A-1]=arguments[A];for(var P=T.length,C=P;P--;)_+=T[P].byteLength;var S=new Uint8Array(_);for(S[0]=_>>24&255,S[1]=_>>16&255,S[2]=_>>8&255,S[3]=_&255,S.set(F,4),P=0,_=8;P<C;P++)S.set(T[P],_),_+=T[P].byteLength;return S},R.hdlr=function(F){return R.box(R.types.hdlr,R.HDLR_TYPES[F])},R.mdat=function(F){return R.box(R.types.mdat,F)},R.mdhd=function(F,_){_*=F;var D=Math.floor(_/(G+1)),T=Math.floor(_%(G+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,T>>24,T>>16&255,T>>8&255,T&255,85,196,0,0]))},R.mdia=function(F){return R.box(R.types.mdia,R.mdhd(F.timescale,F.duration),R.hdlr(F.type),R.minf(F))},R.mfhd=function(F){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},R.minf=function(F){return F.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(F)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(F))},R.moof=function(F,_,D){return R.box(R.types.moof,R.mfhd(F),R.traf(D,_))},R.moov=function(F){for(var _=F.length,D=[];_--;)D[_]=R.trak(F[_]);return R.box.apply(null,[R.types.moov,R.mvhd(F[0].timescale,F[0].duration)].concat(D).concat(R.mvex(F)))},R.mvex=function(F){for(var _=F.length,D=[];_--;)D[_]=R.trex(F[_]);return R.box.apply(null,[R.types.mvex].concat(D))},R.mvhd=function(F,_){_*=F;var D=Math.floor(_/(G+1)),T=Math.floor(_%(G+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,T>>24,T>>16&255,T>>8&255,T&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,A)},R.sdtp=function(F){var _=F.samples||[],D=new Uint8Array(4+_.length),T,A;for(T=0;T<_.length;T++)A=_[T].flags,D[T+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return R.box(R.types.sdtp,D)},R.stbl=function(F){return R.box(R.types.stbl,R.stsd(F),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(F){var _=[],D=[],T,A,P;for(T=0;T<F.sps.length;T++)A=F.sps[T],P=A.byteLength,_.push(P>>>8&255),_.push(P&255),_=_.concat(Array.prototype.slice.call(A));for(T=0;T<F.pps.length;T++)A=F.pps[T],P=A.byteLength,D.push(P>>>8&255),D.push(P&255),D=D.concat(Array.prototype.slice.call(A));var C=R.box(R.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|F.sps.length].concat(_).concat([F.pps.length]).concat(D))),S=F.width,y=F.height,d=F.pixelRatio[0],o=F.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,S>>8&255,S&255,y>>8&255,y&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(F){var _=F.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(F.config).concat([6,1,2]))},R.mp4a=function(F){var _=F.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,F.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),R.box(R.types.esds,R.esds(F)))},R.mp3=function(F){var _=F.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,F.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},R.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(F)):R.box(R.types.stsd,R.STSD,R.mp4a(F)):R.box(R.types.stsd,R.STSD,R.avc1(F))},R.tkhd=function(F){var _=F.id,D=F.duration*F.timescale,T=F.width,A=F.height,P=Math.floor(D/(G+1)),C=Math.floor(D%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&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,T>>8&255,T&255,0,0,A>>8&255,A&255,0,0]))},R.traf=function(F,_){var D=R.sdtp(F),T=F.id,A=Math.floor(_/(G+1)),P=Math.floor(_%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,P>>24,P>>16&255,P>>8&255,P&255])),R.trun(F,D.length+16+20+8+16+8+8),D)},R.trak=function(F){return F.duration=F.duration||4294967295,R.box(R.types.trak,R.tkhd(F),R.mdia(F))},R.trex=function(F){var _=F.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(F,_){var D=F.samples||[],T=D.length,A=12+16*T,P=new Uint8Array(A),C,S,y,d,o,s;for(_+=8+A,P.set([0,0,15,1,T>>>24&255,T>>>16&255,T>>>8&255,T&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),C=0;C<T;C++)S=D[C],y=S.duration,d=S.size,o=S.flags,s=S.cts,P.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return R.box(R.types.trun,P)},R.initSegment=function(F){R.types||R.init();var _=R.moov(F),D=new Uint8Array(R.FTYP.byteLength+_.byteLength);return D.set(R.FTYP),D.set(_,R.FTYP.byteLength),D},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,V.default=I},"./src/remux/mp4-remuxer.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return s}),L.d(V,"normalizePts",function(){return u});var G=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),R=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),F=L("./src/errors.ts"),_=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),T=L("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},A.apply(this,arguments)}var P=10*1e3,C=1024,S=1152,y=null,d=null,o=!1,s=function(){function w(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,y===null){var g=navigator.userAgent||"",p=g.match(/Chrome\/(\d+)/i);y=p?parseInt(p[1]):0}if(d===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);d=v?parseInt(v[1]):0}o=!!y&&y<75||!!d&&d<600}var b=w.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(g,p){var v=p.pts-g;return v<-4294967296?(l=!0,u(g,p.pts)):v>0?g:p.pts},c[0].pts);return l&&_.logger.debug("PTS rollover detected"),a},b.remux=function(c,l,a,g,p,v,M,U){var j,W,O,k,H,X,Z=p,te=p,Ee=c.pid>-1,fe=l.pid>-1,Te=l.samples.length,pe=c.samples.length>0,ge=Te>1,ce=(!Ee||pe)&&(!fe||ge)||this.ISGenerated||M;if(ce){this.ISGenerated||(O=this.generateIS(c,l,p));var he=this.isVideoContiguous,J=-1;if(ge&&(J=E(l.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,J>0){_.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+Te+" video samples due to a missing keyframe");var se=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,te+=(l.samples[0].pts-se)/(l.timescale||9e4)}else J===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),X=!1);if(this.ISGenerated){if(pe&&ge){var q=this.getVideoStartPts(l.samples),ye=u(c.samples[0].pts,q)-q,Se=ye/l.inputTimeScale;Z+=Math.max(0,Se),te+=Math.max(0,-Se)}if(pe){if(c.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(c,l,p)),W=this.remuxAudio(c,Z,this.isAudioContiguous,v,fe||ge||U===D.PlaylistLevelType.AUDIO?te:void 0),ge){var me=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(c,l,p)),j=this.remuxVideo(l,te,he,me)}}else ge&&(j=this.remuxVideo(l,te,he,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,p)),g.samples.length&&(k=this.remuxText(g,p))),{audio:W,video:j,initSegment:O,independent:X,text:k,id3:H}},b.generateIS=function(c,l,a){var g=c.samples,p=l.samples,v=this.typeSupported,M={},U=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,O,k;if(U&&(W=O=Infinity),c.config&&g.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(j="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(k=c.inputTimeScale,W=O=g[0].pts-Math.round(k*a))),l.sps&&l.pps&&p.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},U)){k=l.inputTimeScale;var H=this.getVideoStartPts(p),X=Math.round(k*a);O=Math.min(O,u(p[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(M).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=O),{tracks:M,initPTS:W,timescale:k}},b.remuxVideo=function(c,l,a,g){var p=c.inputTimeScale,v=c.samples,M=[],U=v.length,j=this._initPTS,W=this.nextAvcDts,O=8,k,H,X,Z=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,Ee=0,fe=!1;if(!a||W===null){var Te=l*p,pe=v[0].pts-u(v[0].dts,v[0].pts);W=Te-pe}for(var ge=0;ge<U;ge++){var ce=v[ge];if(ce.pts=u(ce.pts-j,W),ce.dts=u(ce.dts-j,W),ce.dts>ce.pts){var he=9e4*.2;Ee=Math.max(Math.min(Ee,ce.pts-ce.dts),-1*he)}ce.dts<v[ge>0?ge-1:ge].dts&&(fe=!0)}fe&&v.sort(function(Dt,mt){var ot=Dt.dts-mt.dts,It=Dt.pts-mt.pts;return ot||It}),H=v[0].dts,X=v[v.length-1].dts;var J=Math.round((X-H)/(U-1));if(Ee<0){if(Ee<J*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(T.toMsFromMpegTsClock)(-J,!0)+" ms");for(var se=Ee,q=0;q<U;q++)v[q].dts=se=Math.max(se,v[q].pts-J),v[q].pts=Math.max(se,v[q].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(T.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var ye=0;ye<U;ye++)v[ye].dts=v[ye].dts+Ee}H=v[0].dts}if(a){var Se=H-W,me=Se>J,we=Se<-1;if(me||we){me?_.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),H=W;var _e=v[0].pts-Se;v[0].dts=H,v[0].pts=_e,_.logger.log("Video: First PTS/DTS adjusted: "+Object(T.toMsFromMpegTsClock)(_e,!0)+"/"+Object(T.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(T.toMsFromMpegTsClock)(Se,!0)+" ms")}}o&&(H=Math.max(0,H));for(var ke=0,Ie=0,De=0;De<U;De++){for(var Le=v[De],ze=Le.units,Ye=ze.length,Ve=0,je=0;je<Ye;je++)Ve+=ze[je].data.length;Ie+=Ve,ke+=Ye,Le.length=Ve,Le.dts=Math.max(Le.dts,H),Le.pts=Math.max(Le.pts,Le.dts,0),Z=Math.min(Le.pts,Z),te=Math.max(Le.pts,te)}X=v[U-1].dts;var Xe=Ie+4*ke+8,Be;try{Be=new Uint8Array(Xe)}catch(Dt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Xe,reason:"fail allocating video mdat "+Xe});return}var He=new DataView(Be.buffer);He.setUint32(0,Xe),Be.set(R.default.types.mdat,4);for(var Ae=0;Ae<U;Ae++){for(var Ze=v[Ae],$e=Ze.units,Oe=0,Fe=0,ae=$e.length;Fe<ae;Fe++){var le=$e[Fe],ue=le.data,$=le.data.byteLength;He.setUint32(O,$),O+=4,Be.set(ue,O),O+=$,Oe+=4+$}if(Ae<U-1)k=v[Ae+1].dts-Ze.dts;else{var Q=this.config,ee=Ze.dts-v[Ae>0?Ae-1:Ae].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var re=Math.floor(Q.maxBufferHole*p),be=(g?Z+g*p:this.nextAudioPts)-Ze.pts;be>re?(k=be-ee,k<0&&(k=ee),_.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=ee}else k=ee}var Ce=Math.round(Ze.pts-Ze.dts);M.push(new f(Ze.key,k,Oe,Ce))}if(M.length&&y&&y<70){var Me=M[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(k!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+k,this.isVideoContiguous=!0;var tt=R.default.moof(c.sequenceNumber++,H,A({},c,{samples:M})),dt="video",it={data1:tt,data2:Be,startPTS:Z/p,endPTS:(te+k)/p,startDTS:H/p,endDTS:W/p,type:dt,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Be.length,"MDAT length must not be zero"),it},b.remuxAudio=function(c,l,a,g,p){var v=c.inputTimeScale,M=c.samplerate?c.samplerate:v,U=v/M,j=c.isAAC?C:S,W=j*U,O=this._initPTS,k=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,Z=k?0:8,te=this.nextAudioPts||-1,Ee=l*v;if(this.isAudioContiguous=a=a||X.length&&te>0&&(g&&Math.abs(Ee-te)<9e3||Math.abs(u(X[0].pts-O,Ee)-te)<20*W),X.forEach(function(ue){ue.pts=u(ue.pts-O,Ee)}),!a||te<0){if(X=X.filter(function(ue){return ue.pts>=0}),!X.length)return;p===0?te=0:g?te=Math.max(0,Ee):te=X[0].pts}if(c.isAAC)for(var fe=p!==void 0,Te=this.config.maxAudioFramesDrift,pe=0,ge=te;pe<X.length;pe++){var ce=X[pe],he=ce.pts,J=he-ge,se=Math.abs(1e3*J/v);if(J<=-Te*W&&fe)pe===0&&(_.logger.warn("Audio frame @ "+(he/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/v)+" ms."),this.nextAudioPts=te=ge=he);else if(J>=Te*W&&se<P&&fe){var q=Math.round(J/W);ge=he-q*W,ge<0&&(q--,ge+=W),pe===0&&(this.nextAudioPts=te=ge),_.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(ge/v).toFixed(3)+"s due to "+Math.round(1e3*J/v)+" ms gap.");for(var ye=0;ye<q;ye++){var Se=Math.max(ge,0),me=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);me||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),me=ce.unit.subarray()),X.splice(pe,0,{unit:me,pts:Se}),ge+=W,pe++}}ce.pts=ge,ge+=W}for(var we=null,_e=null,ke,Ie=0,De=X.length;De--;)Ie+=X[De].unit.byteLength;for(var Le=0,ze=X.length;Le<ze;Le++){var Ye=X[Le],Ve=Ye.unit,je=Ye.pts;if(_e!==null){var Xe=H[Le-1];Xe.duration=Math.round((je-_e)/U)}else if(a&&c.isAAC&&(je=te),we=je,Ie>0){Ie+=Z;try{ke=new Uint8Array(Ie)}catch(ue){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!k){var Be=new DataView(ke.buffer);Be.setUint32(0,Ie),ke.set(R.default.types.mdat,4)}}else return;ke.set(Ve,Z);var He=Ve.byteLength;Z+=He,H.push(new f(!0,j,He,0)),_e=je}var Ae=H.length;if(!Ae)return;var Ze=H[H.length-1];this.nextAudioPts=te=_e+U*Ze.duration;var $e=k?new Uint8Array(0):R.default.moof(c.sequenceNumber++,we/U,A({},c,{samples:H}));c.samples=[];var Oe=we/v,Fe=te/v,ae="audio",le={data1:$e,data2:ke,startPTS:Oe,endPTS:Fe,startDTS:Oe,endDTS:Fe,type:ae,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),le},b.remuxEmptyAudio=function(c,l,a,g){var p=c.inputTimeScale,v=c.samplerate?c.samplerate:p,M=p/v,U=this.nextAudioPts,j=(U!==null?U:g.startDTS*p)+this._initDTS,W=g.endDTS*p+this._initDTS,O=M*C,k=Math.ceil((W-j)/O),H=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],Z=0;Z<k;Z++){var te=j+Z*O;X.push({unit:H,pts:te,dts:te})}return c.samples=X,this.remuxAudio(c,l,a,!1)},b.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,p=this._initPTS,v=this._initDTS,M=0;M<a;M++){var U=c.samples[M];U.pts=u(U.pts-p,l*g)/g,U.dts=u(U.dts-v,l*g)/g}var j=c.samples;return c.samples=[],{samples:j}},b.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,p=this._initPTS,v=0;v<a;v++){var M=c.samples[v];M.pts=u(M.pts-p,l*g)/g}c.samples.sort(function(j,W){return j.pts-W.pts});var U=c.samples;return c.samples=[],{samples:U}},w}();function u(w,b){var h;if(b===null)return w;for(b<w?h=-8589934592:h=8589934592;Math.abs(w-b)>4294967296;)w+=h;return w}function E(w){for(var b=0;b<w.length;b++)if(w[b].key)return b;return-1}var f=function(b,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new m(b)},m=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),F=function(){function T(){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 A=T.prototype;return A.destroy=function(){},A.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(C,S,y){this.audioCodec=S,this.videoCodec=y,this.generateInitSegment(C),this.emitInitSegment=!0},A.generateInitSegment=function(C){var S=this.audioCodec,y=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(I.parseInitSegment)(C);S||(S=D(d.audio,R.ElementaryStreamTypes.AUDIO)),y||(y=D(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:S+","+y,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:S,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:y,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(C,S,y,d,o){var s=this.initPTS,u=this.lastEndDTS,E={audio:void 0,video:void 0,text:d,id3:y,initSegment:void 0};Object(G.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var f=S.samples;if(!f||!f.length)return E;var m={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(f),w=this.initData),!w||!w.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=_(w,f,u));var b=Object(I.getDuration)(f,w),h=u,c=b+h;Object(I.offsetStartDTS)(w,f,s),b>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!w.audio,a=!!w.video,g="";l&&(g+="audio"),a&&(g+="video");var p={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:g,hasAudio:l,hasVideo:a,nb:1,dropped:0};return E.audio=p.type==="audio"?p:void 0,E.video=p.type!=="audio"?p:void 0,E.text=d,E.id3=y,E.initSegment=m,E},T}(),_=function(A,P,C){return Object(I.getStartDTS)(A,P)-C};function D(T,A){var P=T==null?void 0:T.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=F},"./src/task-loop.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"CMCDVersion",function(){return G}),L.d(V,"CMCDObjectType",function(){return I}),L.d(V,"CMCDStreamingFormat",function(){return R}),L.d(V,"CMCDStreamType",function(){return B});var G=1,I;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(I||(I={}));var R;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(R||(R={}));var B;(function(F){F.VOD="v",F.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"HlsSkip",function(){return R}),L.d(V,"getSkipValue",function(){return B}),L.d(V,"HlsUrlParameters",function(){return F}),L.d(V,"Level",function(){return _});function G(D,T){for(var A=0;A<T.length;A++){var P=T[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function I(D,T,A){return T&&G(D.prototype,T),A&&G(D,A),D}var R;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(R||(R={}));function B(D,T){var A=D.canSkipUntil,P=D.canSkipDateRanges,C=D.endSN,S=T!==void 0?T-C:0;return A&&S<A?P?R.v2:R.Yes:R.No}var F=function(){function D(A,P,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=P,this.skip=C}var T=D.prototype;return T.addDirectives=function(P){var C=new self.URL(P);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()},D}(),_=function(){function D(T){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=[T.url],this.attrs=T.attrs,this.bitrate=T.bitrate,T.details&&(this.details=T.details),this.id=T.id||0,this.name=T.name,this.width=T.width||0,this.height=T.height||0,this.audioCodec=T.audioCodec,this.videoCodec=T.videoCodec,this.unknownCodecs=T.unknownCodecs,this.codecSet=[T.videoCodec,T.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return I(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var P=A%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),D}()},"./src/types/loader.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"PlaylistContextType",function(){return G}),L.d(V,"PlaylistLevelType",function(){return I});var G;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"ChunkMetadata",function(){return G});var G=function(B,F,_,D,T,A){D===void 0&&(D=0),T===void 0&&(T=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=F,this.id=_,this.size=D,this.part=T,this.partial=A};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"AttrList",function(){return R});var G=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(_){typeof _=="string"&&(_=B.parseAttrList(_));for(var D in _)_.hasOwnProperty(D)&&(this[D]=_[D])}var F=B.prototype;return F.decimalInteger=function(D){var T=parseInt(this[D],10);return T>Number.MAX_SAFE_INTEGER?Infinity:T},F.hexadecimalInteger=function(D){if(this[D]){var T=(this[D]||"0x").slice(2);T=(T.length&1?"0":"")+T;for(var A=new Uint8Array(T.length/2),P=0;P<T.length/2;P++)A[P]=parseInt(T.slice(P*2,P*2+2),16);return A}else return null},F.hexadecimalIntegerAsNumber=function(D){var T=parseInt(this[D],16);return T>Number.MAX_SAFE_INTEGER?Infinity:T},F.decimalFloatingPoint=function(D){return parseFloat(this[D])},F.optionalFloat=function(D,T){var A=this[D];return A?parseFloat(A):T},F.enumeratedString=function(D){return this[D]},F.bool=function(D){return this[D]==="YES"},F.decimalResolution=function(D){var T=G.exec(this[D]);return T===null?void 0:{width:parseInt(T[1],10),height:parseInt(T[2],10)}},B.parseAttrList=function(D){var T,A={},P='"';for(I.lastIndex=0;(T=I.exec(D))!==null;){var C=T[2];C.indexOf(P)===0&&C.lastIndexOf(P)===C.length-1&&(C=C.slice(1,-1)),A[T[1]]=C}return A},B}()},"./src/utils/binary-search.ts":function(ne,V,L){"use strict";L.r(V);var G={search:function(R,B){for(var F=0,_=R.length-1,D=null,T=null;F<=_;){D=(F+_)/2|0,T=R[D];var A=B(T);if(A>0)F=D+1;else if(A<0)_=D-1;else return T}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"BufferHelper",function(){return R});var G=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(_,D){try{if(_){for(var T=B.getBuffered(_),A=0;A<T.length;A++)if(D>=T.start(A)&&D<=T.end(A))return!0}}catch(P){}return!1},B.bufferInfo=function(_,D,T){try{if(_){var A=B.getBuffered(_),P=[],C;for(C=0;C<A.length;C++)P.push({start:A.start(C),end:A.end(C)});return this.bufferedInfo(P,D,T)}}catch(S){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(_,D,T){D=Math.max(0,D),_.sort(function(m,w){var b=m.start-w.start;return b||w.end-m.end});var A=[];if(T)for(var P=0;P<_.length;P++){var C=A.length;if(C){var S=A[C-1].end;_[P].start-S<T?_[P].end>S&&(A[C-1].end=_[P].end):A.push(_[P])}else A.push(_[P])}else A=_;for(var y=0,d,o=D,s=D,u=0;u<A.length;u++){var E=A[u].start,f=A[u].end;if(D+T>=E&&D<f)o=E,s=f,y=s-D;else if(D+T<E){d=E;break}}return{len:y,start:o||0,end:s||0,nextStart:d}},B.getBuffered=function(_){try{return _.buffered}catch(D){return G.logger.log("failed to get media.buffered",D),I}},B}()},"./src/utils/cea-608-parser.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"Row",function(){return s}),L.d(V,"CaptionScreen",function(){return u});var G=L("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(c){var l=c;return I.hasOwnProperty(c)&&(l=I[c]),String.fromCharCode(l)},B=15,F=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},T={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var S=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,g){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+g)},h}(),y=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,g,p,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=g||!1,this.background=p||"black",this.flash=v||!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 g=["foreground","underline","italics","background","flash"],p=0;p<g.length;p++){var v=g[p];a.hasOwnProperty(v)&&(this[v]=a[v])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,g,p,v,M){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,g,p,v,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<F;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var g=!0,p=0;p<F;p++)if(!this.chars[p].equals(a.chars[p])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<F;g++)this.chars[g].copy(a.chars[g])},c.isEmpty=function(){for(var a=!0,g=0;g<F;g++)if(!this.chars[g].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>F&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},c.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var p=this.pos+1;p<g+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(g)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var g=R(a);if(this.pos>=F){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var g;for(g=a;g<F;g++)this.chars[g].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=[],g=!0,p=0;p<F;p++){var v=this.chars[p].uchar;v!==" "&&(g=!1),a.push(v)}return g?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},h}(),u=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var g=!0,p=0;p<B;p++)if(!this.rows[p].equals(a.rows[p])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<B;g++)this.rows[g].copy(a.rows[g])},c.isEmpty=function(){for(var a=!0,g=0;g<B;g++)if(!this.rows[g].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 g=this.rows[this.currRow];g.insertChar(a)},c.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},c.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var p=0;p<B;p++)this.rows[p].clear();var v=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var U=M.rows[v].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[g-this.nrRollUpRows+W+1].copy(M.rows[v+W])}}this.currRow=g;var O=this.rows[this.currRow];if(a.indent!==null){var k=a.indent,H=Math.max(k-1,0);O.setCursor(a.indent),a.color=O.chars[H].penState.foreground}var X={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(X)},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,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var g=[],p="",v=-1,M=0;M<B;M++){var U=this.rows[M].getTextString();U&&(v=M+1,a?g.push("Row "+v+": '"+U+"'"):g.push(U.trim()))}return g.length>0&&(a?p="["+g.join(" | ")+"]":p=g.join(`
|
|
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),E=function(){function h(l,a,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(g),this.nonDisplayedMemory=new u(g),this.lastOutputScreen=new u(g),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);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 g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var p=Math.floor(a/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=v[p]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),f=function(){function h(l,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new S;this.channels=[null,new E(l,a,p),new E(l+1,g,p)],this.cmdHistory=b(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,g){this.channels[a].setHandler(g)},c.addData=function(a,g){var p,v,M,U=!1;this.logger.time=a;for(var j=0;j<g.length;j+=2){if(v=g[j]&127,M=g[j+1]&127,v===0&&M===0)continue;if(this.logger.log(C.DATA,"["+y([g[j],g[j+1]])+"] -> ("+y([v,M])+")"),p=this.parseCmd(v,M),p||(p=this.parseMidrow(v,M)),p||(p=this.parsePAC(v,M)),p||(p=this.parseBackgroundAttributes(v,M)),!p&&(U=this.parseChars(v,M),U)){var W=this.currentChannel;if(W&&W>0){var O=this.channels[W];O.insertChars(U)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!U&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+y([v,M])+" orig: "+y([g[j],g[j+1]]))}},c.parseCmd=function(a,g){var p=this.cmdHistory,v=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,M=(a===23||a===31)&&g>=33&&g<=35;if(!(v||M))return!1;if(w(a,g,p))return m(null,null,p),this.logger.log(C.DEBUG,"Repeated command ("+y([a,g])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,j=this.channels[U];return a===20||a===21||a===28||a===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),m(a,g,p),this.currentChannel=U,!0},c.parseMidrow=function(a,g){var p=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[p];return v?(v.ccMIDROW(g),this.logger.log(C.DEBUG,"MIDROW ("+y([a,g])+")"),!0):!1}return!1},c.parsePAC=function(a,g){var p,v=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,U=(a===16||a===24)&&g>=64&&g<=95;if(!(M||U))return!1;if(w(a,g,v))return m(null,null,v),!0;var j=a<=23?1:2;g>=64&&g<=95?p=j===1?_[a]:T[a]:p=j===1?D[a]:A[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(p,g)),m(a,g,v),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,g){var p,v={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?p=g-96:p=g-64,v.underline=(p&1)===1,p<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((p-16)/2)*4,v},c.parseChars=function(a,g){var p,v=null,M=null;if(a>=25?(p=2,M=a-8):(p=1,M=a),M>=17&&M<=19){var U;M===17?U=g+80:M===18?U=g+112:U=g+144,this.logger.log(C.INFO,"Special char '"+R(U)+"' in channel "+p),v=[U]}else a>=32&&a<=127&&(v=g===0?[a]:[a,g]);if(v){var j=y(v);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),m(a,g,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(a,g){var p=(a===16||a===24)&&g>=32&&g<=47,v=(a===23||a===31)&&g>=45&&g<=47;if(!(p||v))return!1;var M,U={};a===16||a===24?(M=Math.floor((g-32)/2),U.background=P[M],g%2===1&&(U.background=U.background+"_semi")):g===45?U.background="transparent":(U.foreground="black",g===47&&(U.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(U),m(a,g,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var p=this.channels[g];p&&p.cueSplitAtTime(a)}},h}();function m(h,c,l){l.a=h,l.b=c}function w(h,c,l){return l.a===h&&l.b===c}function b(){return{a:null,b:null}}V.default=f},"./src/utils/codecs.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"isCodecType",function(){return I}),L.d(V,"isCodecSupportedInMp4",function(){return R});var G={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(B,F){var _=G[F];return!!_&&_[B.slice(0,4)]===!0}function R(B,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),B=/\s/,F={newCue:function(D,T,A,P){for(var C=[],S,y,d,o,s,u=self.VTTCue||self.TextTrackCue,E=0;E<P.rows.length;E++)if(S=P.rows[E],d=!0,o=0,s="",!S.isEmpty()){for(var f=0;f<S.chars.length;f++)B.test(S.chars[f].uchar)&&d?o++:(s+=S.chars[f].uchar,d=!1);S.cueStartTime=T,T===A&&(A+=1e-4),o>=16?o--:o++;var m=Object(G.fixLineBreaks)(s.trim()),w=Object(I.generateCueId)(T,A,m);(!D||!D.cues||!D.cues.getCueById(w))&&(y=new u(T,A,m),y.id=w,y.line=E+1,y.align="left",y.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(y))}return D&&C.length&&(C.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),C.forEach(function(b){return Object(R.addCueToTrack)(D,b)})),C}};V.default=F},"./src/utils/discontinuities.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"findFirstFragWithCC",function(){return B}),L.d(V,"shouldAlignOnDiscontinuities",function(){return F}),L.d(V,"findDiscontinuousReferenceFrag",function(){return _}),L.d(V,"adjustSlidingStart",function(){return T}),L.d(V,"alignStream",function(){return A}),L.d(V,"alignPDT",function(){return C}),L.d(V,"alignFragmentByPDTDelta",function(){return S}),L.d(V,"alignMediaPlaylistByPDT",function(){return y});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),R=L("./src/controller/level-helper.ts");function B(d,o){for(var s=null,u=0,E=d.length;u<E;u++){var f=d[u];if(f&&f.cc===o){s=f;break}}return s}function F(d,o,s){return!!(o.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function _(d,o){var s=d.fragments,u=o.fragments;if(!u.length||!s.length){I.logger.log("No fragments to align");return}var E=B(s,u[0].cc);if(!E||E&&!E.startPTS){I.logger.log("No frag in previous level to align on");return}return E}function D(d,o){if(d){var s=d.start+o;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function T(d,o){for(var s=o.fragments,u=0,E=s.length;u<E;u++)D(s[u],d);o.fragmentHint&&D(o.fragmentHint,d),o.alignedSliding=!0}function A(d,o,s){if(!o)return;P(d,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(R.adjustSliding)(o.details,s)}function P(d,o,s){if(F(d,s,o)){var u=_(s.details,o);u&&Object(G.isFiniteNumber)(u.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),T(u.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,E=(u-s)/1e3+o.fragments[0].start;E&&Object(G.isFiniteNumber)(E)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+E.toFixed(3)+" "+d.url+" "),T(E,d))}function S(d,o){var s=d.programDateTime;if(!s)return;var u=(s-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function y(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=o.fragments[0].start,E=s-u*1e3;d.fragments.forEach(function(f){S(f,E)}),d.fragmentHint&&S(d.fragmentHint,E),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/utils/ewma.ts"),I=function(){function R(F,_,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new G.default(F),this.fast_=new G.default(_)}var B=R.prototype;return B.update=function(_,D){var T=this.slow_,A=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new G.default(_,T.getEstimate(),T.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new G.default(D,A.getEstimate(),A.getTotalWeight()))},B.sample=function(_,D){_=Math.max(_,this.minDelayMs_);var T=8*D,A=_/1e3,P=T/A;this.fast_.sample(A,P),this.slow_.sample(A,P)},B.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=I},"./src/utils/ewma.ts":function(ne,V,L){"use strict";L.r(V);var G=function(){function I(B,F,_){F===void 0&&(F=0),_===void 0&&(_=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=F,this.totalWeight_=_}var R=I.prototype;return R.sample=function(F,_){var D=Math.pow(this.alpha_,F);this.estimate_=_*(1-D)+D*this.estimate_,this.totalWeight_+=F},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},I}();V.default=G},"./src/utils/fetch-loader.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"fetchSupported",function(){return S});var G=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),R=L("./src/demux/chunk-cache.ts");function B(u,E){u.prototype=Object.create(E.prototype),u.prototype.constructor=u,A(u,E)}function F(u){var E=typeof Map=="function"?new Map:void 0;return F=function(m){if(m===null||!T(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E!="undefined"){if(E.has(m))return E.get(m);E.set(m,w)}function w(){return _(m,arguments,P(this).constructor)}return w.prototype=Object.create(m.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),A(w,m)},F(u)}function _(u,E,f){return D()?_=Reflect.construct:_=function(w,b,h){var c=[null];c.push.apply(c,b);var l=Function.bind.apply(w,c),a=new l;return h&&A(a,h.prototype),a},_.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 T(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function A(u,E){return A=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},A(u,E)}function P(u){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},P(u)}function C(){return C=Object.assign||function(u){for(var E=1;E<arguments.length;E++){var f=arguments[E];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])}return u},C.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var y=function(){function u(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var E=u.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(m,w,b){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(m,this.controller.signal),a=b.onProgress,g=m.responseType==="arraybuffer",p=g?"byteLength":"length";this.context=m,this.config=w,this.callbacks=b,this.request=this.fetchSetup(m,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(c,m,h.response)},w.timeout),self.fetch(this.request).then(function(v){if(h.response=h.loader=v,!v.ok){var M=v.status,U=v.statusText;throw new s(U||"fetch, bad network response",M,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(w.highWaterMark)?h.loadProgressively(v,c,m,w.highWaterMark,a):g?v.arrayBuffer():v.text()}).then(function(v){var M=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[p];var U={url:M.url,data:v};a&&!Object(G.isFiniteNumber)(w.highWaterMark)&&a(c,m,v,M),b.onSuccess(U,c,m,M)}).catch(function(v){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=v.code||0;b.onError({code:M,text:v.message},m,v.details)})},E.getCacheAge=function(){var m=null;if(this.response){var w=this.response.headers.get("age");m=w?parseFloat(w):null}return m},E.loadProgressively=function(m,w,b,h,c){h===void 0&&(h=0);var l=new R.default,a=m.body.getReader(),g=function p(){return a.read().then(function(v){if(v.done)return l.dataLength&&c(w,b,l.flush(),m),Promise.resolve(new ArrayBuffer(0));var M=v.value,U=M.length;return w.loaded+=U,U<h||l.dataLength?(l.push(M),l.dataLength>=h&&c(w,b,l.flush(),m)):c(w,b,M,m),p()}).catch(function(){return Promise.reject()})};return g()},u}();function d(u,E){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(C({},u.headers))};return u.rangeEnd&&f.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),f}function o(u,E){return new self.Request(u.url,E)}var s=function(u){B(E,u);function E(f,m,w){var b;return b=u.call(this,f)||this,b.code=void 0,b.details=void 0,b.code=m,b.details=w,b}return E}(F(Error));V.default=y},"./src/utils/imsc1-ttml-parser.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"IMSC1_CODEC",function(){return T}),L.d(V,"parseIMSC1",function(){return S});var G=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),_=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},D.apply(this,arguments)}var T="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(h,c,l,a,g){var p=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var v=p[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(h,v.start,v.end-v.start)),U=Object(F.toTimescaleFromScale)(c,1,l);try{a(y(M,U))}catch(j){g(j)}}function y(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(p).reduce(function(O,k){return O[k]=g.getAttribute("ttp:"+k)||p[k],O},{}),M=g.getAttribute("xml:space")!=="preserve",U=o(d(g,"styling","style")),j=o(d(g,"layout","region")),W=d(g,"body","[begin]");return[].map.call(W,function(O){var k=s(O,M);if(!k||!O.hasAttribute("begin"))return null;var H=m(O.getAttribute("begin"),v),X=m(O.getAttribute("dur"),v),Z=m(O.getAttribute("end"),v);if(H===null)throw f(O);if(Z===null){if(X===null)throw f(O);Z=H+X}var te=new R.default(H-c,Z-c,k);te.id=Object(_.generateCueId)(te.startTime,te.endTime,te.text);var Ee=j[O.getAttribute("region")],fe=U[O.getAttribute("style")];te.position=10,te.size=80;var Te=u(Ee,fe),pe=Te.textAlign;if(pe){var ge=C[pe];ge&&(te.lineAlign=ge),te.align=pe}return D(te,Te),te}).filter(function(O){return O!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,g){var p;return a.nodeName==="br"&&g?l+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?s(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function u(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,p){var v=E(c,l,p)||E(h,l,p);return v&&(g[p]=v),g},{})}function E(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var l=Object(I.parseTimeStamp)(h);return l===null&&(A.test(h)?l=w(h,c):P.test(h)&&(l=b(h,c))),l}function w(h,c){var l=A.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function b(h,c){var l=P.exec(h),a=Number(l[1]),g=l[2];switch(g){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(ne,V,L){"use strict";L.r(V),L.d(V,"enableLogs",function(){return _}),L.d(V,"logger",function(){return D});var G=function(){},I={trace:G,debug:G,log:G,warn:G,info:G,error:G},R=I;function B(T){var A=self.console[T];return A?A.bind(self.console,"["+T+"] >"):G}function F(T){for(var A=arguments.length,P=new Array(A>1?A-1:0),C=1;C<A;C++)P[C-1]=arguments[C];P.forEach(function(S){R[S]=T[S]?T[S].bind(T):B(S)})}function _(T){if(self.console&&T===!0||typeof T=="object"){F(T,"debug","log","info","warn","error");try{R.log()}catch(A){R=I}}else R=I}var D=R},"./src/utils/mediakeys-helper.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"KeySystems",function(){return G}),L.d(V,"requestMediaKeySystemAccess",function(){return I});var G;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(G||(G={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"bin2str",function(){return F}),L.d(V,"readUint16",function(){return _}),L.d(V,"readUint32",function(){return D}),L.d(V,"writeUint32",function(){return T}),L.d(V,"findBox",function(){return A}),L.d(V,"parseSegmentIndex",function(){return P}),L.d(V,"parseInitSegment",function(){return C}),L.d(V,"getStartDTS",function(){return S}),L.d(V,"getDuration",function(){return y}),L.d(V,"computeRawDurationFromSamples",function(){return d}),L.d(V,"offsetStartDTS",function(){return o}),L.d(V,"segmentValidRange",function(){return s}),L.d(V,"appendUint8Array",function(){return u});var G=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function F(E){return String.fromCharCode.apply(null,E)}function _(E,f){"data"in E&&(f+=E.start,E=E.data);var m=E[f]<<8|E[f+1];return m<0?65536+m:m}function D(E,f){"data"in E&&(f+=E.start,E=E.data);var m=E[f]<<24|E[f+1]<<16|E[f+2]<<8|E[f+3];return m<0?4294967296+m:m}function T(E,f,m){"data"in E&&(f+=E.start,E=E.data),E[f]=m>>24,E[f+1]=m>>16&255,E[f+2]=m>>8&255,E[f+3]=m&255}function A(E,f){var m=[];if(!f.length)return m;var w,b,h;"data"in E?(w=E.data,b=E.start,h=E.end):(w=E,b=0,h=w.byteLength);for(var c=b;c<h;){var l=D(w,c),a=F(w.subarray(c+4,c+8)),g=l>1?c+l:h;if(a===f[0])if(f.length===1)m.push({data:w,start:c+8,end:g});else{var p=A({data:w,start:c+8,end:g},f.slice(1));p.length&&B.apply(m,p)}c=g}return m}function P(E){var f=A(E,["moov"]),m=f[0],w=m?m.end:null,b=A(E,["sidx"]);if(!b||!b[0])return null;var h=[],c=b[0],l=c.data[0],a=l===0?8:16,g=D(c,a);a+=4;var p=0,v=0;l===0?a+=8:a+=16,a+=2;var M=c.end+v,U=_(c,a);a+=2;for(var j=0;j<U;j++){var W=a,O=D(c,W);W+=4;var k=O&2147483647,H=(O&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=D(c,W);W+=4,h.push({referenceSize:k,subsegmentDuration:X,info:{duration:X/g,start:M,end:M+k-1}}),M+=k,W+=4,a=W}return{earliestPresentationTime:p,timescale:g,version:l,referencesCount:U,references:h,moovEndOffset:w}}function C(E){for(var f=[],m=A(E,["moov","trak"]),w=0;w<m.length;w++){var b=m[w],h=A(b,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=D(h,l),g=A(b,["mdia","mdhd"])[0];if(g){c=g.data[g.start],l=c===0?12:20;var p=D(g,l),v=A(b,["mdia","hdlr"])[0];if(v){var M=F(v.data.subarray(v.start+8,v.start+12)),U={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(U){var j=A(b,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=F(j.data.subarray(j.start+12,j.start+16))),f[a]={timescale:p,type:U},f[U]={timescale:p,id:a,codec:W}}}}}}var O=A(E,["moov","mvex","trex"]);return O.forEach(function(k){var H=D(k,4),X=f[H];X&&(X.default={duration:D(k,12),flags:D(k,20)})}),f}function S(E,f){return A(f,["moof","traf"]).reduce(function(m,w){var b=A(w,["tfdt"])[0],h=b.data[b.start],c=A(w,["tfhd"]).reduce(function(l,a){var g=D(a,4),p=E[g];if(p){var v=D(b,4);h===1&&(v*=Math.pow(2,32),v+=D(b,8));var M=p.timescale||9e4,U=v/M;if(isFinite(U)&&(l===null||U<l))return U}return l},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function y(E,f){for(var m=0,w=0,b=0,h=A(E,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=A(l,["tfhd"])[0],g=D(a,4),p=f[g];if(!p)continue;var v=p.default,M=D(a,0)|(v==null?void 0:v.flags),U=v==null?void 0:v.duration;M&8&&(M&2?U=D(a,12):U=D(a,8));for(var j=p.timescale||9e4,W=A(l,["trun"]),O=0;O<W.length;O++){if(U){var k=D(W[O],4);m=U*k}else m=d(W[O]);p.type===I.ElementaryStreamTypes.VIDEO?w+=m/j:p.type===I.ElementaryStreamTypes.AUDIO&&(b+=m/j)}}if(w===0&&b===0){var H=P(E);if(H!=null&&H.references)return H.references.reduce(function(X,Z){return X+Z.info.duration||0},0)}return w||b}function d(E){var f=D(E,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var w=0,b=D(E,4),h=0;h<b;h++){if(f&256){var c=D(E,m);w+=c,m+=4}f&512&&(m+=4),f&1024&&(m+=4),f&2048&&(m+=4)}return w}function o(E,f,m){A(f,["moof","traf"]).forEach(function(w){A(w,["tfhd"]).forEach(function(b){var h=D(b,4),c=E[h];if(!c)return;var l=c.timescale||9e4;A(w,["tfdt"]).forEach(function(a){var g=a.data[a.start],p=D(a,4);if(g===0)T(a,4,p-m*l);else{p*=Math.pow(2,32),p+=D(a,8),p-=m*l,p=Math.max(p,0);var v=Math.floor(p/(R+1)),M=Math.floor(p%(R+1));T(a,4,v),T(a,8,M)}})})})}function s(E){var f={valid:null,remainder:null},m=A(E,["moof"]);if(m){if(m.length<2)return f.remainder=E,f}else return f;var w=m[m.length-1];return f.valid=Object(G.sliceUint8)(E,0,w.start-8),f.remainder=Object(G.sliceUint8)(E,w.start-8),f}function u(E,f){var m=new Uint8Array(E.length+f.length);return m.set(E),m.set(f,E.length),m}},"./src/utils/output-filter.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"default",function(){return G});var G=function(){function I(B,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=F}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(F,_,D){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=_,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"sendAddTrackEvent",function(){return I}),L.d(V,"addCueToTrack",function(){return R}),L.d(V,"clearCurrentCues",function(){return B}),L.d(V,"removeCuesInRange",function(){return F}),L.d(V,"getCuesInRange",function(){return D});var G=L("./src/utils/logger.ts");function I(T,A){var P;try{P=new Event("addtrack")}catch(C){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=T,A.dispatchEvent(P)}function R(T,A){var P=T.mode;if(P==="disabled"&&(T.mode="hidden"),T.cues&&!T.cues.getCueById(A.id))try{if(T.addCue(A),!T.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(S){G.logger.debug("[texttrack-utils]: "+S);var C=new self.TextTrackCue(A.startTime,A.endTime,A.text);C.id=A.id,T.addCue(C)}P==="disabled"&&(T.mode=P)}function B(T){var A=T.mode;if(A==="disabled"&&(T.mode="hidden"),T.cues)for(var P=T.cues.length;P--;)T.removeCue(T.cues[P]);A==="disabled"&&(T.mode=A)}function F(T,A,P){var C=T.mode;if(C==="disabled"&&(T.mode="hidden"),T.cues&&T.cues.length>0)for(var S=D(T.cues,A,P),y=0;y<S.length;y++)T.removeCue(S[y]);C==="disabled"&&(T.mode=C)}function _(T,A){if(A<T[0].startTime)return 0;var P=T.length-1;if(A>T[P].endTime)return-1;for(var C=0,S=P;C<=S;){var y=Math.floor((S+C)/2);if(A<T[y].startTime)S=y-1;else if(A>T[y].startTime&&C<P)C=y+1;else return y}return T[C].startTime-A<A-T[S].startTime?C:S}function D(T,A,P){var C=[],S=_(T,A);if(S>-1)for(var y=S,d=T.length;y<d;y++){var o=T[y];if(o.startTime>=A&&o.endTime<=P)C.push(o);else if(o.startTime>P)return C}return C}},"./src/utils/time-ranges.ts":function(ne,V,L){"use strict";L.r(V);var G={toString:function(R){for(var B="",F=R.length,_=0;_<F;_++)B+="["+R.start(_).toFixed(3)+","+R.end(_).toFixed(3)+"]";return B}};V.default=G},"./src/utils/timescale-conversion.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"toTimescaleFromBase",function(){return I}),L.d(V,"toTimescaleFromScale",function(){return R}),L.d(V,"toMsFromMpegTsClock",function(){return B}),L.d(V,"toMpegTsClockFromTimescale",function(){return F});var G=9e4;function I(_,D,T,A){T===void 0&&(T=1),A===void 0&&(A=!1);var P=_*D*T;return A?Math.round(P):P}function R(_,D,T,A){return T===void 0&&(T=1),A===void 0&&(A=!1),I(_,D,1/T,A)}function B(_,D){return D===void 0&&(D=!1),I(_,1e3,1/G,D)}function F(_,D){return D===void 0&&(D=1),I(_,G,1/D)}},"./src/utils/typed-array.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"sliceUint8",function(){return G});function G(I,R,B){return Uint8Array.prototype.slice?I.slice(R,B):new Uint8Array(Array.prototype.slice.call(I,R,B))}},"./src/utils/vttcue.ts":function(ne,V,L){"use strict";L.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],I=["start","middle","end","left","right"];function R(T,A){if(typeof A!="string")return!1;if(!Array.isArray(T))return!1;var P=A.toLowerCase();return~T.indexOf(P)?P:!1}function B(T){return R(G,T)}function F(T){return R(I,T)}function _(T){for(var A=arguments.length,P=new Array(A>1?A-1:0),C=1;C<A;C++)P[C-1]=arguments[C];for(var S=1;S<arguments.length;S++){var y=arguments[S];for(var d in y)T[d]=y[d]}return T}function D(T,A,P){var C=this,S={enumerable:!0};C.hasBeenReset=!1;var y="",d=!1,o=T,s=A,u=P,E=null,f="",m=!0,w="auto",b="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",_({},S,{get:function(){return y},set:function(p){y=""+p}})),Object.defineProperty(C,"pauseOnExit",_({},S,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(C,"startTime",_({},S,{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",_({},S,{get:function(){return s},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",_({},S,{get:function(){return u},set:function(p){u=""+p,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",_({},S,{get:function(){return E},set:function(p){E=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",_({},S,{get:function(){return f},set:function(p){var v=B(p);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",_({},S,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",_({},S,{get:function(){return w},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",_({},S,{get:function(){return b},set:function(p){var v=F(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");b=v,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",_({},S,{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",_({},S,{get:function(){return c},set:function(p){var v=F(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",_({},S,{get:function(){return l},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");l=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",_({},S,{get:function(){return a},set:function(p){var v=F(p);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,this.hasBeenReset=!0}})),C.displayState=void 0}return D.prototype.getCueAsHTML=function(){var T=self.WebVTT;return T.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"parseTimeStamp",function(){return R}),L.d(V,"fixLineBreaks",function(){return A}),L.d(V,"VTTParser",function(){return P});var G=L("./src/utils/vttcue.ts"),I=function(){function C(){}var S=C.prototype;return S.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function S(d,o,s,u){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(u||0)}var y=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?S(y[2],y[3],0,y[4]):S(y[1],y[2],y[3],y[4]):null}var B=function(){function C(){this.values=Object.create(null)}var S=C.prototype;return S.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},S.get=function(d,o,s){return s?this.has(d)?this.values[d]:o[s]:this.has(d)?this.values[d]:o},S.has=function(d){return d in this.values},S.alt=function(d,o,s){for(var u=0;u<s.length;++u)if(o===s[u]){this.set(d,o);break}},S.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},S.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},C}();function F(C,S,y,d){var o=d?C.split(d):[C];for(var s in o){if(typeof o[s]!="string")continue;var u=o[s].split(y);if(u.length!==2)continue;var E=u[0],f=u[1];S(E,f)}}var _=new G.default(0,0,""),D=_.align==="middle"?"middle":"center";function T(C,S,y){var d=C;function o(){var E=R(C);if(E===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),E}function s(E,f){var m=new B;F(E,function(h,c){var l;switch(h){case"region":for(var a=y.length-1;a>=0;a--)if(y[a].id===c){m.set(h,y[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),m.integer(h,l[0]),m.percent(h,l[0])&&m.set("snapToLines",!1),m.alt(h,l[0],["auto"]),l.length===2&&m.alt("lineAlign",l[1],["start",D,"end"]);break;case"position":l=c.split(","),m.percent(h,l[0]),l.length===2&&m.alt("positionAlign",l[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",D,"end","left","right"]);break}},/:/,/\s/),f.region=m.get("region",null),f.vertical=m.get("vertical","");var w=m.get("line","auto");w==="auto"&&_.line===-1&&(w=-1),f.line=w,f.lineAlign=m.get("lineAlign","start"),f.snapToLines=m.get("snapToLines",!0),f.size=m.get("size",100),f.align=m.get("align",D);var b=m.get("position","auto");b==="auto"&&_.position===50&&(b=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=b}function u(){C=C.replace(/^\s+/,"")}if(u(),S.startTime=o(),u(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),u(),S.endTime=o(),u(),s(C,S)}function A(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=C.prototype;return S.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function s(){var b=o.buffer,h=0;for(b=A(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
|
|
`;)++h;var c=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
|
|
`&&++h,o.buffer=b.substr(h),c}function u(b){F(b,function(h,c){},/:/)}try{var E="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;E=s();var f=E.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:E=s();switch(o.state){case"HEADER":/:/.test(E)?u(E):E||(o.state="ID");continue;case"NOTE":E||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){o.state="NOTE";break}if(!E)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",E.indexOf("-->")===-1){o.cue.id=E;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{T(E,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=E.indexOf("-->")!==-1;if(!E||w&&(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+=E}continue;case"BADCUE":E||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(ne,V,L){"use strict";L.r(V),L.d(V,"generateCueId",function(){return P}),L.d(V,"parseWebVTT",function(){return S});var G=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),F=L("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,D=function(d,o,s){return s===void 0&&(s=0),d.substr(s,o.length)===o},T=function(d){var o=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),E=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*u,o+=60*60*1e3*E,o},A=function(d){for(var o=5381,s=d.length;s;)o=o*33^d.charCodeAt(--s);return(o>>>0).toString()};function P(y,d,o){return A(y.toString())+A(d.toString())+A(o)}var C=function(d,o,s){var u=d[o],E=d[u.prevCC];if(!E||!E.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(f=E)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=u.start-E.start,u.new=!1,u=E,E=d[u.prevCC]}d.presentationOffset=s};function S(y,d,o,s,u,E,f,m){var w=new I.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(_,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,g=0,p,v=!0,M=!1;w.oncue=function(U){var j=s[u],W=s.ccOffset,O=(a-c)/9e4;if(j!=null&&j.new&&(g!==void 0?W=s.ccOffset=j.start:C(s,u,O)),O&&(W=O-s.presentationOffset),M){var k=U.endTime-U.startTime,H=Object(F.normalizePts)((U.startTime+W-g)*9e4,E*9e4)/9e4;U.startTime=H,U.endTime=H+k}var X=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(X)),U.id||(U.id=P(U.startTime,U.endTime,X)),U.endTime>0&&h.push(U)},w.onparsingerror=function(U){p=U},w.onflush=function(){if(p){m(p);return}f(h)},b.forEach(function(U){if(v)if(D(U,"X-TIMESTAMP-MAP=")){v=!1,M=!0,U.substr(16).split(",").forEach(function(j){D(j,"LOCAL:")?l=j.substr(6):D(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{g=T(l)/1e3}catch(j){M=!1,p=j}return}else U===""&&(v=!1);w.parse(U+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(ne,V,L){"use strict";L.r(V);var G=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function F(D){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=D?D.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var _=F.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var T=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),T&&(T.onreadystatechange=null,T.onprogress=null,T.readyState!==4&&(this.stats.aborted=!0,T.abort()))},_.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(T,A,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=T,this.config=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},_.loadInternal=function(){var T=this.config,A=this.context;if(!T)return;var P=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var S=this.xhrSetup;try{if(S)try{S(P,A.url)}catch(o){P.open("GET",A.url,!0),S(P,A.url)}P.readyState||P.open("GET",A.url,!0);var y=this.context.headers;if(y)for(var d in y)P.setRequestHeader(d,y[d])}catch(o){this.callbacks.onError({code:P.status,text:o.message},A,P);return}A.rangeEnd&&P.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout),P.send()},_.readystatechange=function(){var T=this.context,A=this.loader,P=this.stats;if(!T||!A)return;var C=A.readyState,S=this.config;if(P.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),C===4){A.onreadystatechange=null,A.onprogress=null;var y=A.status;if(y>=200&&y<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var d,o;if(T.responseType==="arraybuffer"?(d=A.response,o=d.byteLength):(d=A.responseText,o=d.length),P.loaded=P.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(P,T,d,A),!this.callbacks)return;var u={url:A.responseURL,data:d};this.callbacks.onSuccess(u,P,T,A)}else P.retry>=S.maxRetry||y>=400&&y<499?(G.logger.error(y+" while loading "+T.url),this.callbacks.onError({code:y,text:A.statusText},T,A)):(G.logger.warn(y+" while loading "+T.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,S.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},_.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var T=this.callbacks;T&&(this.abortInternal(),T.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(T){var A=this.stats;A.loaded=T.loaded,T.lengthComputable&&(A.total=T.total)},_.getCacheAge=function(){var T=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");T=A?parseFloat(A):null}return T},F}();V.default=B}}).default})},vHTk:function(lt,Qe,oe){lt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|