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.
138 lines
733 KiB
138 lines
733 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[169,6,7],{"+NIl":function(ft,tt,de){(function(te){te(de("VrN/"))})(function(te){"use strict";te.defineMode("stex",function(G,L){"use strict";function V(C,w){C.cmdState.push(w)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function P(C){var w=C.cmdState.pop();w&&w.closeBracket()}function B(C){for(var w=C.cmdState,E=w.length-1;E>=0;E--){var l=w[E];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function U(C,w,E){return function(){this.name=C,this.bracketNo=0,this.style=w,this.styles=E,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=U("importmodule","tag",["string","builtin"]),_.documentclass=U("documentclass","tag",["","atom"]),_.usepackage=U("usepackage","tag",["atom"]),_.begin=U("begin","tag",["atom"]),_.end=U("end","tag",["atom"]),_.label=U("label","tag",["atom"]),_.ref=U("ref","tag",["atom"]),_.eqref=U("eqref","tag",["atom"]),_.cite=U("cite","tag",["atom"]),_.bibitem=U("bibitem","tag",["atom"]),_.Bibitem=U("Bibitem","tag",["atom"]),_.RBibitem=U("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,w){C.f=w}function g(C,w){var E;if(C.match(/^\\[a-zA-Z@]+/)){var l=C.current().slice(1);return E=_.hasOwnProperty(l)?_[l]:_.DEFAULT,E=new E,V(w,E),D(w,R),E.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(w,function(s,u){return T(s,u,"\\]")}),"keyword";if(C.match("\\("))return D(w,function(s,u){return T(s,u,"\\)")}),"keyword";if(C.match("$$"))return D(w,function(s,u){return T(s,u,"$$")}),"keyword";if(C.match("$"))return D(w,function(s,u){return T(s,u,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=I(w),E)E.closeBracket(o),D(w,R);else return"error";return"bracket"}else return o=="{"||o=="["?(E=_.DEFAULT,E=new E,V(w,E),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),E=B(w),E.name=="begin"&&(E.argument=C.current()),E.styleIdentifier())}function T(C,w,E){if(C.eatSpace())return null;if(E&&C.match(E))return D(w,g),"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 l=C.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(C.skipToEnd(),"comment"):"error"}function R(C,w){var E=C.peek(),l;return E=="{"||E=="["?(l=I(w),l.openBracket(E),C.eat(E),D(w,g),"bracket"):/[ \t\r]/.test(E)?(C.eat(E),null):(D(w,g),P(w),g(C,w))}return{startState:function(){var C=L.inMathMode?function(w,E){return T(w,E)}:g;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,w){return w.f(C,w)},blankLine:function(C){C.f=g,C.cmdState.length=0},lineComment:"%"}}),te.defineMIME("text/x-stex","stex"),te.defineMIME("text/x-latex","stex")})},"19Vz":function(ft,tt,de){(function(te){te(de("VrN/"))})(function(te){te.defineOption("placeholder","",function(U,_,D){var g=D&&D!=te.Init;if(_&&!g)U.on("blur",I),U.on("change",P),U.on("swapDoc",P),te.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){V(U)}),P(U);else if(!_&&g){U.off("blur",I),U.off("change",P),U.off("swapDoc",P),te.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),G(U);var T=U.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}_&&!U.hasFocus()&&I(U)});function G(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function L(U){G(U);var _=U.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=U.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var D=U.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),_.appendChild(D),U.display.lineSpace.insertBefore(_,U.display.lineSpace.firstChild)}function V(U){setTimeout(function(){var _=!1,D=U.getInputField();D.nodeName=="TEXTAREA"?_=!D.value:U.lineCount()==1&&(_=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),_?L(U):G(U)},20)}function I(U){B(U)&&L(U)}function P(U){var _=U.getWrapperElement(),D=B(U);_.className=_.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(U):G(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(ft,tt,de){(function(te){te(de("VrN/"))})(function(te){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};te.defineMode("xml",function(V,I){var P=V.indentUnit,B={},U=I.htmlMode?G:L;for(var _ in U)B[_]=U[_];for(var _ in I)B[_]=I[_];var D,g;function T(a,v){function m(F){return v.tokenize=F,F(a,v)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(w("atom","]]>")):null:a.match("--")?m(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=w("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",v.tokenize=R,"tag bracket");if(b=="&"){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}T.isInText=!0;function R(a,v){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return v.tokenize=T,D=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return D="equals",null;if(m=="<"){v.tokenize=T,v.state=u,v.tagName=v.tagStart=null;var b=v.tokenize(a,v);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(m)?(v.tokenize=C(m),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(m,b){for(;!m.eol();)if(m.next()==a){b.tokenize=R;break}return"string"};return v.isInAttribute=!0,v}function w(a,v){return function(m,b){for(;!m.eol();){if(m.match(v)){b.tokenize=T;break}m.next()}return a}}function E(a){return function(v,m){for(var b;(b=v.next())!=null;){if(b=="<")return m.tokenize=E(a+1),m.tokenize(v,m);if(b==">")if(a==1){m.tokenize=T;break}else return m.tokenize=E(a-1),m.tokenize(v,m)}return"meta"}}function l(a,v,m){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,v){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(v))return;o(a)}}function u(a,v,m){return a=="openTag"?(m.tagStart=v.column(),S):a=="closeTag"?p:u}function S(a,v,m){return a=="word"?(m.tagName=v.current(),g="tag",y):B.allowMissingTagName&&a=="endTag"?(g="tag bracket",y(a,v,m)):(g="error",S)}function p(a,v,m){if(a=="word"){var b=v.current();return m.context&&m.context.tagName!=b&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==b||B.matchClosing===!1?(g="tag",h):(g="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(g="tag bracket",h(a,v,m)):(g="error",A)}function h(a,v,m){return a!="endTag"?(g="error",h):(o(m),u)}function A(a,v,m){return g="error",h(a,v,m)}function y(a,v,m){if(a=="word")return g="attribute",c;if(a=="endTag"||a=="selfcloseTag"){var b=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(b)?s(m,b):(s(m,b),m.context=new l(m,b,M==m.indented)),u}return g="error",y}function c(a,v,m){return a=="equals"?f:(B.allowMissing||(g="error"),y(a,v,m))}function f(a,v,m){return a=="string"?d:a=="word"&&B.allowUnquoted?(g="string",y):(g="error",y(a,v,m))}function d(a,v,m){return a=="string"?d:y(a,v,m)}return{startState:function(a){var v={tokenize:T,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;D=null;var m=v.tokenize(a,v);return(m||D)&&m!="comment"&&(g=null,v.state=v.state(D||m,a,v),g&&(m=g=="error"?m+" error":g)),m},indent:function(a,v,m){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(b&&b.noIndent)return te.Pass;if(a.tokenize!=R&&a.tokenize!=T)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(v))return 0;var M=v&&/^<(\/)?([\w_:\.-]*)/.exec(v);if(M&&M[1])for(;b;)if(b.tagName==M[2]){b=b.prev;break}else if(B.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(M)for(;b;){var F=B.contextGrabbers[b.tagName];if(F&&F.hasOwnProperty(M[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],m=a.context;m;m=m.prev)m.tagName&&v.push(m.tagName);return v.reverse()}}}),te.defineMIME("text/xml","xml"),te.defineMIME("application/xml","xml"),te.mimeModes.hasOwnProperty("text/html")||te.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(ft,tt,de){"use strict";var te=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function L(){if(!te)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return te(G)}var V=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(R){return typeof R=="string"&&V.test(R)}for(var P=I,B=[],U=0;U<256;++U)B.push((U+256).toString(16).substr(1));function _(R){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(B[R[C+0]]+B[R[C+1]]+B[R[C+2]]+B[R[C+3]]+"-"+B[R[C+4]]+B[R[C+5]]+"-"+B[R[C+6]]+B[R[C+7]]+"-"+B[R[C+8]]+B[R[C+9]]+"-"+B[R[C+10]]+B[R[C+11]]+B[R[C+12]]+B[R[C+13]]+B[R[C+14]]+B[R[C+15]]).toLowerCase();if(!P(w))throw TypeError("Stringified UUID is invalid");return w}var D=_;function g(R,C,w){R=R||{};var E=R.random||(R.rng||L)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,C){w=w||0;for(var l=0;l<16;++l)C[w+l]=E[l];return C}return D(E)}var T=tt.a=g},"7ahc":function(ft,tt,de){"use strict";de.d(tt,"a",function(){return S});var te=de("k1fw"),G=de("0Owb"),L=de("+L6B"),V=de("2/Rp"),I=de("y8nQ"),P=de("Vl3Y"),B=de("tJVT"),U=de("OaEy"),_=de("2fM7"),D=de("cDcd"),g=de.n(D),T=de("VrN/"),R=de.n(T),C=de("p77/"),w=de.n(C),E=de("c5Ni"),l=de.n(E),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"]};tt.b=function(p){var h=p.callback,A=p.onCancel,y=Object(D.useState)("python"),c=Object(B.a)(y,2),f=c[0],d=c[1];function a(m){d(u[m][1])}function v(m){h(m)}return g.a.createElement(P.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),g.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(_.a,{onChange:a},Object.keys(u).map(function(m){return g.a.createElement(o,{key:m,value:m},u[m][0])}))),g.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(S,{mode:f})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(V.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function S(p){var h=p.value,A=p.onChange,y=p.mode,c=p.options,f=c===void 0?{}:c,d=Object(D.useRef)(),a=Object(D.useState)(),v=Object(B.a)(a,2),m=v[0],b=v[1];return Object(D.useEffect)(function(){if(m){function M(F){var j=F.getValue();A&&A(j)}return m.on("change",M),function(){m.off("change",M)}}},[m,A]),Object(D.useEffect)(function(){m&&m.setOption("mode",y)},[m,y]),Object(D.useEffect)(function(){m&&((h!==m.getValue()||h==="")&&setTimeout(function(){m.setValue(h||" ")},300))},[m,h]),Object(D.useEffect)(function(){if(d.current&&!m){var M=R.a.fromTextArea(d.current,Object(te.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));b(M)}},[d.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:d}))}},"7ixt":function(ft,tt,de){"use strict";de.d(tt,"a",function(){return L});var te={adjustX:1,adjustY:1},G=[0,0],L={left:{points:["cr","cl"],overflow:te,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:te,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:te,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:te,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:te,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:te,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:te,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:te,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:te,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:te,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:te,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:te,offset:[-4,0],targetOffset:G}},V=L},"8EBN":function(ft,tt,de){(function(te){te(de("VrN/"))})(function(te){"use strict";te.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G<te.modeInfo.length;G++){var L=te.modeInfo[G];L.mimes&&(L.mime=L.mimes[0])}te.findModeByMIME=function(V){V=V.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var P=te.modeInfo[I];if(P.mime==V)return P;if(P.mimes){for(var B=0;B<P.mimes.length;B++)if(P.mimes[B]==V)return P}}if(/\+xml$/.test(V))return te.findModeByMIME("application/xml");if(/\+json$/.test(V))return te.findModeByMIME("application/json")},te.findModeByExtension=function(V){V=V.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var P=te.modeInfo[I];if(P.ext){for(var B=0;B<P.ext.length;B++)if(P.ext[B]==V)return P}}},te.findModeByFileName=function(V){for(var I=0;I<te.modeInfo.length;I++){var P=te.modeInfo[I];if(P.file&&P.file.test(V))return P}var B=V.lastIndexOf("."),U=B>-1&&V.substring(B+1,V.length);if(U)return te.findModeByExtension(U)},te.findModeByName=function(V){V=V.toLowerCase();for(var I=0;I<te.modeInfo.length;I++){var P=te.modeInfo[I];if(P.name.toLowerCase()==V)return P;if(P.alias){for(var B=0;B<P.alias.length;B++)if(P.alias[B].toLowerCase()==V)return P}}}})},"8hTe":function(ft,tt,de){ft.exports={button:"button___1wy9m"}},"9Bee":function(ft,tt,de){"use strict";var te=de("DYRE"),G=de("zeV3"),L=de("+L6B"),V=de("2/Rp"),I=de("k1fw"),P=de("tJVT"),B=de("cDcd"),U=de.n(B),_=de("vg9a"),D=de("DlQD"),g=de.n(D),T=de("rUJ1");function R(ge,he){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return he;var ae=ce[1];return he.split(`
|
|
`).map(function(me){var Q=me.match(/^\s+/);if(Q===null)return me;var ne=Object(P.a)(Q,1),Z=ne[0];return Z.length>=ae.length?me.slice(ae.length):me}).join(`
|
|
`)}var C=[],w=["<ul>"],E=new g.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,w=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(ge,he,ce,ae){if(he>=ge.length||ge[he].level<=ce)return he;var me=ge[he];ae.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),he++;var Q=[];return he=u(ge,he,me.level,Q),Q.length>0&&(ae.push("<ul>"),Q.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),he=u(ge,he,ce,ae),he}function S(){return u(C,0,0,w),w.push("</ul>"),w.join("")}var p={heading:function(he){var ce=l.exec(he);if(ce)return{type:"heading",raw:ce[0],depth:ce[1].length,text:ce[2]}},fences:function(he){var ce=this.rules.block.fences.exec(he);if(ce){var ae=ce[0],me=R(ae,ce[3]||""),Q=ce[2]?ce[2].trim():ce[2];if(["latex","katex","math"].indexOf(Q)>=0){var ne=y(),Z=me;me=ne,c[ne]={type:"block",expression:Z}}return{type:"code",raw:ae,lang:Q,text:me}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,y=function(){return"__special_katext_id_".concat(A++,"__")},c={};function f(){return c}function d(){A=0,c={}}function a(ge){return ge=ge.replace(h,function(he,ce){var ae=y();return c[ae]={type:"inline",expression:ce},ae}),ge}var v=E.listitem;E.listitem=function(ge){return v(a(ge))};var m=E.paragraph;E.paragraph=function(ge){return m(a(ge))};var b=E.tablecell;E.tablecell=function(ge,he){return b(a(ge),he)},E.code=function(ge,he,ce){var ae=(he||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(he,'">').concat(ce?ge:Object(T.escape)(ge,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ce?ge:Object(T.escape)(ge,!0))+"</code></pre>"},E.heading=function(ge,he,ce){var ae=this.options.headerPrefix+ce.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:ae,level:he,text:ge}),"<h"+he+' id="'+ae+'">'+ge+"</h"+he+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:p,renderer:E});var M=g.a,F=de("SJMd"),j=de("ulZh"),W=de.n(j),k=de("m3rI"),O=de("Oy/b"),K=de("p5ED"),Y=de("8hTe"),q=de.n(Y),ie=/<pre[^>]*>/g;function Te(ge){var he=document.createElement("div");return he.innerHTML=ge,he.childNodes.length===0?"":he.childNodes[0].nodeValue}var ve=tt.a=function(ge){var he=ge.value,ce=he===void 0?"":he,ae=ge.edit,me=ae===void 0?!1:ae,Q=ge.className,ne=ge.showTextOnly,Z=ge.showLines,Ee=ge.replaces,Ae=ge.zoomImg,be=ge.hasMask,Se=ge.style,Re=Se===void 0?{}:Se,Fe=ge.stylesPrev,Ie=Fe===void 0?{}:Fe,ke=String(ce),Oe=Object(B.useRef)(),$e=Object(B.useRef)(),ze=Object(B.useState)(""),Ve=Object(P.a)(ze,2),Ge=Ve[0],rt=Ve[1],Qe=Object(B.useState)("office"),Ye=Object(P.a)(Qe,2),Ce=Ye[0],qe=Ye[1],Xe=Object(B.useMemo)(function(){try{var ue=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,$=/\"\/api\/attachments\/|\"\/attachments\/download\//g,J=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ke=ke.replace(ue,"("+k.a.API_SERVER+"/api/attachments/").replace($,'"'+k.a.API_SERVER+"/api/attachments/").replace(J,'"'+k.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(we){}var ee=M(ke),oe=f();if(ke.match(/\[TOC\]/)&&(ee=ee.replace("<p>[TOC]</p>",S()),o()),ee=ee.replace(/(__special_katext_id_\d+__)/g,function(we,Pe){var je=oe[Pe],Ze=je.type,We=je.expression;return Object(O.renderToString)(Te(We)||"",{displayMode:Ze==="block",throwOnError:!1,output:"html"})}),ee=ee.replace(/▁/g,"\u2581\u2581\u2581"),d(),ne){var fe=document.createElement("div");return fe.innerHTML=ee,fe.innerText}return setTimeout(function(){return pe()},500),ee},[ke]),Le=Object(B.useRef)();s.WebkitLineClamp=Z,Z&&(Re=Object(I.a)(Object(I.a)({},Re),s));function _e(ue){var $=ue.target;if($.tagName.toUpperCase()==="IMG"){if(Ae){var J=$.getAttribute("src");rt(J),qe("image")}}else if($.tagName.toUpperCase()==="A"){var ee=$.getAttribute("href");if(ee.indexOf("office")>-1)ue.preventDefault(),rt(ee),qe("office");else if(ee.indexOf("application/pdf")>-1)ue.preventDefault(),rt(ee),qe("pdf");else if(ee.indexOf("text/html")>-1)ue.preventDefault(),rt(ee),qe("html");else if(ee.startsWith("#")){ue.preventDefault();var oe=document.getElementById(ee.replace("#",""));oe&&oe.scrollIntoView(!0)}}}var pe=function(){var $,J=($=Le.current)===null||$===void 0?void 0:$.querySelectorAll("video");J==null||J.forEach(function(ee){if(ee.oncontextmenu=function(){return!1},ee.src.indexOf(".m3u8")>-1&&!ee.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var oe=new W.a;oe.loadSource(ee.src),oe.attachMedia(ee)}}})};Object(B.useEffect)(function(){if(Le.current&&Xe&&(Xe.match(ie)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",_e),function(){Le.current.removeEventListener("click",_e),d(),o()}},[Xe,Le.current,_e]);var le=function($){if(!me)return;$.target.nodeName==="IMG"?(Oe.current.style.display="flex",Oe.current.style.width=$.target.clientWidth+"px",Oe.current.style.height=$.target.clientHeight+"px",Oe.current.style.top=$.target.offsetTop+"px",Oe.current.style.left=$.target.offsetLeft+"px",$e.current.src=$.target.getAttribute("src")):Oe.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:Le,style:Object(I.a)({},Re),className:"".concat(Q||""," markdown-body ").concat(q.a.mdBody),onMouseOver:le,dangerouslySetInnerHTML:{__html:Xe}}),U.a.createElement("div",{ref:Oe,className:q.a.button},U.a.createElement(G.a,null,U.a.createElement(V.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(V.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:$e,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(K.a,{close:!0,data:Ge,type:Ge!=null&&Ge.length?Ce:"",style:Object(I.a)({},Ie),onClose:function(){return rt("")}}))}},"9VGf":function(ft,tt,de){"use strict";de.d(tt,"a",function(){return L});var te=de("cDcd"),G=de.n(te);function L(V,I){var P=Object(te.useRef)();Object(te.useEffect)(function(){P.current=V}),Object(te.useEffect)(function(){function B(){P.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},"9ivq":function(ft,tt,de){},Bd2K:function(ft,tt,de){(function(te){te(de("VrN/"),de("osHv"))})(function(te){te.defineOption("autoCloseTags",!1,function(_,D,g){if(g!=te.Init&&g&&_.removeKeyMap("autoCloseTags"),!D)return;var T={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(T["'/'"]=function(R){return P(R)}),(typeof D!="object"||D.whenOpening!==!1)&&(T["'>'"]=function(R){return V(R)}),_.addKeyMap(T)});var G=["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 V(_){if(_.getOption("disableInput"))return te.Pass;for(var D=_.listSelections(),g=[],T=_.getOption("autoCloseTags"),R=0;R<D.length;R++){if(!D[R].empty())return te.Pass;var C=D[R].head,w=_.getTokenAt(C),E=te.innerMode(_.getMode(),w.state),l=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(l),s=o&&o.name;if(!s)return te.Pass;var u=E.mode.configuration=="html",S=typeof T=="object"&&T.dontCloseTags||u&&G,p=typeof T=="object"&&T.indentTags||u&&L;w.end>C.ch&&(s=s.slice(0,s.length-w.end+C.ch));var h=s.toLowerCase();if(!s||w.type=="string"&&(w.end!=C.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==C.ch-w.start-1||S&&B(S,h)>-1||U(_,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(l)||[],s,C,!0))return te.Pass;var A=typeof T=="object"&&T.emptyTags;if(A&&B(A,s)>-1){g[R]={text:"/>",newPos:te.Pos(C.line,C.ch+2)};continue}var y=p&&B(p,h)>-1;g[R]={indent:y,text:">"+(y?`
|
|
|
|
`:"")+"</"+s+">",newPos:y?te.Pos(C.line+1,0):te.Pos(C.line,C.ch+1)}}for(var c=typeof T=="object"&&T.dontIndentOnAutoClose,R=D.length-1;R>=0;R--){var f=g[R];_.replaceRange(f.text,D[R].head,D[R].anchor,"+insert");var d=_.listSelections().slice(0);d[R]={head:f.newPos,anchor:f.newPos},_.setSelections(d),!c&&f.indent&&(_.indentLine(f.newPos.line,null,!0),_.indentLine(f.newPos.line+1,null,!0))}}function I(_,D){for(var g=_.listSelections(),T=[],R=D?"/":"</",C=_.getOption("autoCloseTags"),w=typeof C=="object"&&C.dontIndentOnSlash,E=0;E<g.length;E++){if(!g[E].empty())return te.Pass;var l=g[E].head,o=_.getTokenAt(l),s=te.innerMode(_.getMode(),o.state),u=s.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=l.ch-1))return te.Pass;var S,p=s.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(p&&s.mode.name=="javascript")S=R+"script";else if(p&&s.mode.name=="css")S=R+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!h||h.length&&U(_,h,h[h.length-1],l))return te.Pass;S=R+h[h.length-1]}_.getLine(l.line).charAt(o.end)!=">"&&(S+=">"),T[E]=S}if(_.replaceSelections(T),g=_.listSelections(),!w)for(var E=0;E<g.length;E++)(E==g.length-1||g[E].head.line<g[E+1].head.line)&&_.indentLine(g[E].head.line)}function P(_){return _.getOption("disableInput")?te.Pass:I(_,!0)}te.commands.closeTag=function(_){return I(_)};function B(_,D){if(_.indexOf)return _.indexOf(D);for(var g=0,T=_.length;g<T;++g)if(_[g]==D)return g;return-1}function U(_,D,g,T,R){if(!te.scanForClosingTag)return!1;var C=Math.min(_.lastLine()+1,T.line+500),w=te.scanForClosingTag(_,T,null,C);if(!w||w.tag!=g)return!1;for(var E=R?1:0,l=D.length-1;l>=0&&D[l]==g;l--)++E;T=w.to;for(var l=1;l<E;l++){var o=te.scanForClosingTag(_,T,null,C);if(!o||o.tag!=g)return!1;T=o.to}return!0}})},BjJ7:function(ft,tt,de){"use strict";de.d(tt,"d",function(){return G}),de.d(tt,"c",function(){return L}),de.d(tt,"e",function(){return V}),de.d(tt,"b",function(){return I}),de.d(tt,"a",function(){return B});var te=de("m3rI");function G(U){var _=!0;if(U.length>0){for(var D=0;D<U.length;D++)if(U[D].compile_success==0||!U[D].compile_success){_=!1;break}}else _=!1;return _}function L(U){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],g=0;g<U.length;g++){var T=U[g],R=_?"".concat(_,"/").concat(T.name):"".concat(T.name);D.push({title:T.name,isLeaf:!(T.type==="tree"),key:R})}return D}function V(U,_,D){for(var g=0;g<U.length;g++){var T=U[g];if(T.key===_){T.children=D;break}T.children&&V(T.children,_,D)}return U}function I(U,_,D){var g;return function(){var T=this,R=arguments,C=function(){g=null,D||U.apply(T,R)},w=D&&!g;clearTimeout(g),g=setTimeout(C,_),w&&U.apply(T,R)}}var P=!0,B=te.a.API_SERVER},"C+DQ":function(ft,tt,de){},DlQD:function(ft,tt,de){(function(te,G){ft.exports=G()})(this,function(){"use strict";function te(pe,le){for(var ue=0;ue<le.length;ue++){var $=le[ue];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(pe,$.key,$)}}function G(pe,le,ue){return le&&te(pe.prototype,le),ue&&te(pe,ue),pe}function L(pe,le){if(!pe)return;if(typeof pe=="string")return V(pe,le);var ue=Object.prototype.toString.call(pe).slice(8,-1);if(ue==="Object"&&pe.constructor&&(ue=pe.constructor.name),ue==="Map"||ue==="Set")return Array.from(pe);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return V(pe,le)}function V(pe,le){(le==null||le>pe.length)&&(le=pe.length);for(var ue=0,$=new Array(le);ue<le;ue++)$[ue]=pe[ue];return $}function I(pe,le){var ue;if(typeof Symbol=="undefined"||pe[Symbol.iterator]==null){if(Array.isArray(pe)||(ue=L(pe))||le&&pe&&typeof pe.length=="number"){ue&&(pe=ue);var $=0;return function(){return $>=pe.length?{done:!0}:{done:!1,value:pe[$++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ue=pe[Symbol.iterator](),ue.next.bind(ue)}function P(pe,le){return le={exports:{}},pe(le,le.exports),le.exports}var B=P(function(pe){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($){pe.exports.defaults=$}pe.exports={defaults:le(),getDefaults:le,changeDefaults:ue}}),U=B.defaults,_=B.getDefaults,D=B.changeDefaults,g=/[&<>"']/,T=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(le){return w[le]};function l(pe,le){if(le){if(g.test(pe))return pe.replace(T,E)}else if(R.test(pe))return pe.replace(C,E);return pe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(pe){return pe.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 S(pe,le){pe=pe.source||pe,le=le||"";var ue={replace:function(J,ee){return ee=ee.source||ee,ee=ee.replace(u,"$1"),pe=pe.replace(J,ee),ue},getRegex:function(){return new RegExp(pe,le)}};return ue}var p=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(pe,le,ue){if(pe){var $;try{$=decodeURIComponent(s(ue)).replace(p,"").toLowerCase()}catch(J){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}le&&!h.test(ue)&&(ue=a(le,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(J){return null}return ue}var y={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(pe,le){y[" "+pe]||(c.test(pe)?y[" "+pe]=pe+"/":y[" "+pe]=M(pe,"/",!0)),pe=y[" "+pe];var ue=pe.indexOf(":")===-1;return le.substring(0,2)==="//"?ue?le:pe.replace(f,"$1")+le:le.charAt(0)==="/"?ue?le:pe.replace(d,"$1")+le:pe+le}var v={exec:function(){}};function m(pe){for(var le=1,ue,$;le<arguments.length;le++){ue=arguments[le];for($ in ue)Object.prototype.hasOwnProperty.call(ue,$)&&(pe[$]=ue[$])}return pe}function b(pe,le){var ue=pe.replace(/\|/g,function(ee,oe,fe){for(var we=!1,Pe=oe;--Pe>=0&&fe[Pe]==="\\";)we=!we;return we?"|":" |"}),$=ue.split(/ \|/),J=0;if($.length>le)$.splice(le);else for(;$.length<le;)$.push("");for(;J<$.length;J++)$[J]=$[J].trim().replace(/\\\|/g,"|");return $}function M(pe,le,ue){var $=pe.length;if($===0)return"";for(var J=0;J<$;){var ee=pe.charAt($-J-1);if(ee===le&&!ue)J++;else if(ee!==le&&ue)J++;else break}return pe.substr(0,$-J)}function F(pe,le){if(pe.indexOf(le[1])===-1)return-1;for(var ue=pe.length,$=0,J=0;J<ue;J++)if(pe[J]==="\\")J++;else if(pe[J]===le[0])$++;else if(pe[J]===le[1]&&($--,$<0))return J;return-1}function j(pe){pe&&pe.sanitize&&!pe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:l,unescape:s,edit:S,cleanUrl:A,resolveUrl:a,noopTest:v,merge:m,splitCells:b,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},k=B.defaults,O=W.rtrim,K=W.splitCells,Y=W.escape,q=W.findClosingBracket;function ie(pe,le,ue){var $=le.href,J=le.title?Y(le.title):null,ee=pe[1].replace(/\\([\[\]])/g,"$1");return pe[0].charAt(0)!=="!"?{type:"link",raw:ue,href:$,title:J,text:ee}:{type:"image",raw:ue,href:$,title:J,text:Y(ee)}}function Te(pe,le){var ue=pe.match(/^(\s+)(?:```)/);if(ue===null)return le;var $=ue[1];return le.split(`
|
|
`).map(function(J){var ee=J.match(/^\s+/);if(ee===null)return J;var oe=ee[0];return oe.length>=$.length?J.slice($.length):J}).join(`
|
|
`)}var ve=function(){function pe(ue){this.options=ue||k}var le=pe.prototype;return le.space=function($){var J=this.rules.block.newline.exec($);if(J)return J[0].length>1?{type:"space",raw:J[0]}:{raw:`
|
|
`}},le.code=function($,J){var ee=this.rules.block.code.exec($);if(ee){var oe=J[J.length-1];if(oe&&oe.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var fe=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:O(fe,`
|
|
`)}}},le.fences=function($){var J=this.rules.block.fences.exec($);if(J){var ee=J[0],oe=Te(ee,J[3]||"");return{type:"code",raw:ee,lang:J[2]?J[2].trim():J[2],text:oe}}},le.heading=function($){var J=this.rules.block.heading.exec($);if(J)return{type:"heading",raw:J[0],depth:J[1].length,text:J[2]}},le.nptable=function($){var J=this.rules.block.nptable.exec($);if(J){var ee={type:"table",header:K(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[],raw:J[0]};if(ee.header.length===ee.align.length){var oe=ee.align.length,fe;for(fe=0;fe<oe;fe++)/^ *-+: *$/.test(ee.align[fe])?ee.align[fe]="right":/^ *:-+: *$/.test(ee.align[fe])?ee.align[fe]="center":/^ *:-+ *$/.test(ee.align[fe])?ee.align[fe]="left":ee.align[fe]=null;for(oe=ee.cells.length,fe=0;fe<oe;fe++)ee.cells[fe]=K(ee.cells[fe],ee.header.length);return ee}}},le.hr=function($){var J=this.rules.block.hr.exec($);if(J)return{type:"hr",raw:J[0]}},le.blockquote=function($){var J=this.rules.block.blockquote.exec($);if(J){var ee=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:ee}}},le.list=function($){var J=this.rules.block.list.exec($);if(J){for(var ee=J[0],oe=J[2],fe=oe.length>1,we=oe[oe.length-1]===")",Pe={type:"list",raw:ee,ordered:fe,start:fe?+oe.slice(0,-1):"",loose:!1,items:[]},je=J[0].match(this.rules.block.item),Ze=!1,We,mt,ut,at,Et,xt,St,Dt=je.length,yt=0;yt<Dt;yt++)We=je[yt],ee=We,mt=We.length,We=We.replace(/^ *([*+-]|\d+[.)]) */,""),~We.indexOf(`
|
|
`)&&(mt-=We.length,We=this.options.pedantic?We.replace(/^ {1,4}/gm,""):We.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),yt!==Dt-1&&(ut=this.rules.block.bullet.exec(je[yt+1])[0],(fe?ut.length===1||!we&&ut[ut.length-1]===")":ut.length>1||this.options.smartLists&&ut!==oe)&&(at=je.slice(yt+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-at.length),yt=Dt-1)),Et=Ze||/\n\n(?!\s*$)/.test(We),yt!==Dt-1&&(Ze=We.charAt(We.length-1)===`
|
|
`,Et||(Et=Ze)),Et&&(Pe.loose=!0),xt=/^\[[ xX]\] /.test(We),St=void 0,xt&&(St=We[1]!==" ",We=We.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:ee,task:xt,checked:St,loose:Et,text:We});return Pe}},le.html=function($){var J=this.rules.block.html.exec($);if(J)return{type:this.options.sanitize?"paragraph":"html",raw:J[0],pre:!this.options.sanitizer&&(J[1]==="pre"||J[1]==="script"||J[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):Y(J[0]):J[0]}},le.def=function($){var J=this.rules.block.def.exec($);if(J){J[3]&&(J[3]=J[3].substring(1,J[3].length-1));var ee=J[1].toLowerCase().replace(/\s+/g," ");return{tag:ee,raw:J[0],href:J[2],title:J[3]}}},le.table=function($){var J=this.rules.block.table.exec($);if(J){var ee={type:"table",header:K(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ee.header.length===ee.align.length){ee.raw=J[0];var oe=ee.align.length,fe;for(fe=0;fe<oe;fe++)/^ *-+: *$/.test(ee.align[fe])?ee.align[fe]="right":/^ *:-+: *$/.test(ee.align[fe])?ee.align[fe]="center":/^ *:-+ *$/.test(ee.align[fe])?ee.align[fe]="left":ee.align[fe]=null;for(oe=ee.cells.length,fe=0;fe<oe;fe++)ee.cells[fe]=K(ee.cells[fe].replace(/^ *\| *| *\| *$/g,""),ee.header.length);return ee}}},le.lheading=function($){var J=this.rules.block.lheading.exec($);if(J)return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:J[1]}},le.paragraph=function($){var J=this.rules.block.paragraph.exec($);if(J)return{type:"paragraph",raw:J[0],text:J[1].charAt(J[1].length-1)===`
|
|
`?J[1].slice(0,-1):J[1]}},le.text=function($,J){var ee=this.rules.block.text.exec($);if(ee){var oe=J[J.length-1];return oe&&oe.type==="text"?{raw:ee[0],text:ee[0]}:{type:"text",raw:ee[0],text:ee[0]}}},le.escape=function($){var J=this.rules.inline.escape.exec($);if(J)return{type:"escape",raw:J[0],text:Y(J[1])}},le.tag=function($,J,ee){var oe=this.rules.inline.tag.exec($);if(oe)return!J&&/^<a /i.test(oe[0])?J=!0:J&&/^<\/a>/i.test(oe[0])&&(J=!1),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(oe[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(oe[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:oe[0],inLink:J,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):Y(oe[0]):oe[0]}},le.link=function($){var J=this.rules.inline.link.exec($);if(J){var ee=q(J[2],"()");if(ee>-1){var oe=J[0].indexOf("!")===0?5:4,fe=oe+J[1].length+ee;J[2]=J[2].substring(0,ee),J[0]=J[0].substring(0,fe).trim(),J[3]=""}var we=J[2],Pe="";if(this.options.pedantic){var je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);je?(we=je[1],Pe=je[3]):Pe=""}else Pe=J[3]?J[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var Ze=ie(J,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},J[0]);return Ze}},le.reflink=function($,J){var ee;if((ee=this.rules.inline.reflink.exec($))||(ee=this.rules.inline.nolink.exec($))){var oe=(ee[2]||ee[1]).replace(/\s+/g," ");if(oe=J[oe.toLowerCase()],!oe||!oe.href){var fe=ee[0].charAt(0);return{type:"text",raw:fe,text:fe}}var we=ie(ee,oe,ee[0]);return we}},le.strong=function($,J,ee){ee===void 0&&(ee="");var oe=this.rules.inline.strong.start.exec($);if(oe&&(!oe[1]||oe[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){J=J.slice(-1*$.length);var fe=oe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var we;(oe=fe.exec(J))!=null;)if(we=this.rules.inline.strong.middle.exec(J.slice(0,oe.index+3)),we)return{type:"strong",raw:$.slice(0,we[0].length),text:$.slice(2,we[0].length-2)}}},le.em=function($,J,ee){ee===void 0&&(ee="");var oe=this.rules.inline.em.start.exec($);if(oe&&(!oe[1]||oe[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){J=J.slice(-1*$.length);var fe=oe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var we;(oe=fe.exec(J))!=null;)if(we=this.rules.inline.em.middle.exec(J.slice(0,oe.index+2)),we)return{type:"em",raw:$.slice(0,we[0].length),text:$.slice(1,we[0].length-1)}}},le.codespan=function($){var J=this.rules.inline.code.exec($);if(J){var ee=J[2].replace(/\n/g," "),oe=/[^ ]/.test(ee),fe=ee.startsWith(" ")&&ee.endsWith(" ");return oe&&fe&&(ee=ee.substring(1,ee.length-1)),ee=Y(ee,!0),{type:"codespan",raw:J[0],text:ee}}},le.br=function($){var J=this.rules.inline.br.exec($);if(J)return{type:"br",raw:J[0]}},le.del=function($){var J=this.rules.inline.del.exec($);if(J)return{type:"del",raw:J[0],text:J[1]}},le.autolink=function($,J){var ee=this.rules.inline.autolink.exec($);if(ee){var oe,fe;return ee[2]==="@"?(oe=Y(this.options.mangle?J(ee[1]):ee[1]),fe="mailto:"+oe):(oe=Y(ee[1]),fe=oe),{type:"link",raw:ee[0],text:oe,href:fe,tokens:[{type:"text",raw:oe,text:oe}]}}},le.url=function($,J){var ee;if(ee=this.rules.inline.url.exec($)){var oe,fe;if(ee[2]==="@")oe=Y(this.options.mangle?J(ee[0]):ee[0]),fe="mailto:"+oe;else{var we;do we=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(we!==ee[0]);oe=Y(ee[0]),ee[1]==="www."?fe="http://"+oe:fe=oe}return{type:"link",raw:ee[0],text:oe,href:fe,tokens:[{type:"text",raw:oe,text:oe}]}}},le.inlineText=function($,J,ee){var oe=this.rules.inline.text.exec($);if(oe){var fe;return J?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):Y(oe[0]):oe[0]:fe=Y(this.options.smartypants?ee(oe[0]):oe[0]),{type:"text",raw:oe[0],text:fe}}},pe}(),ge=W.noopTest,he=W.edit,ce=W.merge,ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=he(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=he(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=he(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=he(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=he(ae._paragraph).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.blockquote=he(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=ce({},ae),ae.gfm=ce({},ae.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ae.gfm.nptable=he(ae.gfm.nptable).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.gfm.table=he(ae.gfm.table).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.pedantic=ce({},ae.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ge,paragraph:he(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=he(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=he(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=he(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=he(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=he(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=he(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=he(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=he(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=he(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=he(me._blockSkip,"g").getRegex(),me.overlapSkip=he(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,me.autolink=he(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=he(me.tag).replace("comment",ae._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=he(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=he(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=he(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=ce({},me),me.pedantic=ce({},me.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=ce({},me.normal,{escape:he(me.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=he(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=ce({},me.gfm,{br:he(me.br).replace("{2,}","*").getRegex(),text:he(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Q={block:ae,inline:me},ne=B.defaults,Z=Q.block,Ee=Q.inline;function Ae(pe){return pe.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function be(pe){var le="",ue,$,J=pe.length;for(ue=0;ue<J;ue++)$=pe.charCodeAt(ue),Math.random()>.5&&($="x"+$.toString(16)),le+="&#"+$+";";return le}var Se=function(){function pe(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||ne,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Z.normal,inline:Ee.normal};this.options.pedantic?($.block=Z.pedantic,$.inline=Ee.pedantic):this.options.gfm&&($.block=Z.gfm,this.options.breaks?$.inline=Ee.breaks:$.inline=Ee.gfm),this.tokenizer.rules=$}pe.lex=function($,J){var ee=new pe(J);return ee.lex($)};var le=pe.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($,J,ee){J===void 0&&(J=[]),ee===void 0&&(ee=!0),$=$.replace(/^ +$/gm,"");for(var oe,fe,we,Pe;$;){if(oe=this.tokenizer.space($)){$=$.substring(oe.raw.length),oe.type&&J.push(oe);continue}if(oe=this.tokenizer.code($,J)){$=$.substring(oe.raw.length),oe.type?J.push(oe):(Pe=J[J.length-1],Pe.raw+=`
|
|
`+oe.raw,Pe.text+=`
|
|
`+oe.text);continue}if(oe=this.tokenizer.fences($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(oe=this.tokenizer.heading($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(oe=this.tokenizer.nptable($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(oe=this.tokenizer.hr($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(oe=this.tokenizer.blockquote($)){$=$.substring(oe.raw.length),oe.tokens=this.blockTokens(oe.text,[],ee),J.push(oe);continue}if(oe=this.tokenizer.list($)){for($=$.substring(oe.raw.length),we=oe.items.length,fe=0;fe<we;fe++)oe.items[fe].tokens=this.blockTokens(oe.items[fe].text,[],!1);J.push(oe);continue}if(oe=this.tokenizer.html($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(ee&&(oe=this.tokenizer.def($))){$=$.substring(oe.raw.length),this.tokens.links[oe.tag]||(this.tokens.links[oe.tag]={href:oe.href,title:oe.title});continue}if(oe=this.tokenizer.table($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(oe=this.tokenizer.lheading($)){$=$.substring(oe.raw.length),J.push(oe);continue}if(ee&&(oe=this.tokenizer.paragraph($))){$=$.substring(oe.raw.length),J.push(oe);continue}if(oe=this.tokenizer.text($,J)){$=$.substring(oe.raw.length),oe.type?J.push(oe):(Pe=J[J.length-1],Pe.raw+=`
|
|
`+oe.raw,Pe.text+=`
|
|
`+oe.text);continue}if($){var je="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(je);break}else throw new Error(je)}}return J},le.inline=function($){var J,ee,oe,fe,we,Pe,je=$.length;for(J=0;J<je;J++){Pe=$[J];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},fe=Pe.header.length,ee=0;ee<fe;ee++)Pe.tokens.header[ee]=[],this.inlineTokens(Pe.header[ee],Pe.tokens.header[ee]);for(fe=Pe.cells.length,ee=0;ee<fe;ee++)for(we=Pe.cells[ee],Pe.tokens.cells[ee]=[],oe=0;oe<we.length;oe++)Pe.tokens.cells[ee][oe]=[],this.inlineTokens(we[oe],Pe.tokens.cells[ee][oe]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(fe=Pe.items.length,ee=0;ee<fe;ee++)this.inline(Pe.items[ee].tokens);break}}}return $},le.inlineTokens=function($,J,ee,oe,fe){J===void 0&&(J=[]),ee===void 0&&(ee=!1),oe===void 0&&(oe=!1),fe===void 0&&(fe="");var we,Pe=$,je;if(this.tokens.links){var Ze=Object.keys(this.tokens.links);if(Ze.length>0)for(;(je=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)Ze.includes(je[0].slice(je[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(je=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(we=this.tokenizer.escape($)){$=$.substring(we.raw.length),J.push(we);continue}if(we=this.tokenizer.tag($,ee,oe)){$=$.substring(we.raw.length),ee=we.inLink,oe=we.inRawBlock,J.push(we);continue}if(we=this.tokenizer.link($)){$=$.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,oe)),J.push(we);continue}if(we=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,oe)),J.push(we);continue}if(we=this.tokenizer.strong($,Pe,fe)){$=$.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ee,oe),J.push(we);continue}if(we=this.tokenizer.em($,Pe,fe)){$=$.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ee,oe),J.push(we);continue}if(we=this.tokenizer.codespan($)){$=$.substring(we.raw.length),J.push(we);continue}if(we=this.tokenizer.br($)){$=$.substring(we.raw.length),J.push(we);continue}if(we=this.tokenizer.del($)){$=$.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ee,oe),J.push(we);continue}if(we=this.tokenizer.autolink($,be)){$=$.substring(we.raw.length),J.push(we);continue}if(!ee&&(we=this.tokenizer.url($,be))){$=$.substring(we.raw.length),J.push(we);continue}if(we=this.tokenizer.inlineText($,oe,Ae)){$=$.substring(we.raw.length),fe=we.raw.slice(-1),J.push(we);continue}if($){var We="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return J},G(pe,null,[{key:"rules",get:function(){return{block:Z,inline:Ee}}}]),pe}(),Re=B.defaults,Fe=W.cleanUrl,Ie=W.escape,ke=function(){function pe(ue){this.options=ue||Re}var le=pe.prototype;return le.code=function($,J,ee){var oe=(J||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight($,oe);fe!=null&&fe!==$&&(ee=!0,$=fe)}return oe?'<pre><code class="'+this.options.langPrefix+Ie(oe,!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($,J,ee,oe){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+oe.slug(ee)+'">'+$+"</h"+J+`>
|
|
`:"<h"+J+">"+$+"</h"+J+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function($,J,ee){var oe=J?"ol":"ul",fe=J&&ee!==1?' start="'+ee+'"':"";return"<"+oe+fe+`>
|
|
`+$+"</"+oe+`>
|
|
`},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($,J){return J&&(J="<tbody>"+J+"</tbody>"),`<table>
|
|
<thead>
|
|
`+$+`</thead>
|
|
`+J+`</table>
|
|
`},le.tablerow=function($){return`<tr>
|
|
`+$+`</tr>
|
|
`},le.tablecell=function($,J){var ee=J.header?"th":"td",oe=J.align?"<"+ee+' align="'+J.align+'">':"<"+ee+">";return oe+$+"</"+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($,J,ee){if($=Fe(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var oe='<a href="'+Ie($)+'"';return J&&(oe+=' title="'+J+'"'),oe+=">"+ee+"</a>",oe},le.image=function($,J,ee){if($=Fe(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var oe='<img src="'+$+'" alt="'+ee+'"';return J&&(oe+=' title="'+J+'"'),oe+=this.options.xhtml?"/>":">",oe},le.text=function($){return $},pe}(),Oe=function(){function pe(){}var le=pe.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($,J,ee){return""+ee},le.image=function($,J,ee){return""+ee},le.br=function(){return""},pe}(),$e=function(){function pe(){this.seen={}}var le=pe.prototype;return le.slug=function($){var J=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(J)){var ee=J;do this.seen[ee]++,J=ee+"-"+this.seen[ee];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},pe}(),ze=B.defaults,Ve=W.unescape,Ge=function(){function pe(ue){this.options=ue||ze,this.options.renderer=this.options.renderer||new ke,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new $e}pe.parse=function($,J){var ee=new pe(J);return ee.parse($)};var le=pe.prototype;return le.parse=function($,J){J===void 0&&(J=!0);var ee="",oe,fe,we,Pe,je,Ze,We,mt,ut,at,Et,xt,St,Dt,yt,or,kr,ur,gr=$.length;for(oe=0;oe<gr;oe++){at=$[oe];switch(at.type){case"space":continue;case"hr":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(at.tokens),at.depth,Ve(this.parseInline(at.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(at.text,at.lang,at.escaped);continue}case"table":{for(mt="",We="",Pe=at.header.length,fe=0;fe<Pe;fe++)We+=this.renderer.tablecell(this.parseInline(at.tokens.header[fe]),{header:!0,align:at.align[fe]});for(mt+=this.renderer.tablerow(We),ut="",Pe=at.cells.length,fe=0;fe<Pe;fe++){for(Ze=at.tokens.cells[fe],We="",je=Ze.length,we=0;we<je;we++)We+=this.renderer.tablecell(this.parseInline(Ze[we]),{header:!1,align:at.align[we]});ut+=this.renderer.tablerow(We)}ee+=this.renderer.table(mt,ut);continue}case"blockquote":{ut=this.parse(at.tokens),ee+=this.renderer.blockquote(ut);continue}case"list":{for(Et=at.ordered,xt=at.start,St=at.loose,Pe=at.items.length,ut="",fe=0;fe<Pe;fe++)yt=at.items[fe],or=yt.checked,kr=yt.task,Dt="",yt.task&&(ur=this.renderer.checkbox(or),St?yt.tokens.length>0&&yt.tokens[0].type==="text"?(yt.tokens[0].text=ur+" "+yt.tokens[0].text,yt.tokens[0].tokens&&yt.tokens[0].tokens.length>0&&yt.tokens[0].tokens[0].type==="text"&&(yt.tokens[0].tokens[0].text=ur+" "+yt.tokens[0].tokens[0].text)):yt.tokens.unshift({type:"text",text:ur}):Dt+=ur),Dt+=this.parse(yt.tokens,St),ut+=this.renderer.listitem(Dt,kr,or);ee+=this.renderer.list(ut,Et,xt);continue}case"html":{ee+=this.renderer.html(at.text);continue}case"paragraph":{ee+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(ut=at.tokens?this.parseInline(at.tokens):at.text;oe+1<gr&&$[oe+1].type==="text";)at=$[++oe],ut+=`
|
|
`+(at.tokens?this.parseInline(at.tokens):at.text);ee+=J?this.renderer.paragraph(ut):ut;continue}default:{var hr='Token with "'+at.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return ee},le.parseInline=function($,J){J=J||this.renderer;var ee="",oe,fe,we=$.length;for(oe=0;oe<we;oe++){fe=$[oe];switch(fe.type){case"escape":{ee+=J.text(fe.text);break}case"html":{ee+=J.html(fe.text);break}case"link":{ee+=J.link(fe.href,fe.title,this.parseInline(fe.tokens,J));break}case"image":{ee+=J.image(fe.href,fe.title,fe.text);break}case"strong":{ee+=J.strong(this.parseInline(fe.tokens,J));break}case"em":{ee+=J.em(this.parseInline(fe.tokens,J));break}case"codespan":{ee+=J.codespan(fe.text);break}case"br":{ee+=J.br();break}case"del":{ee+=J.del(this.parseInline(fe.tokens,J));break}case"text":{ee+=J.text(fe.text);break}default:{var Pe='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return ee},pe}(),rt=W.merge,Qe=W.checkSanitizeDeprecation,Ye=W.escape,Ce=B.getDefaults,qe=B.changeDefaults,Xe=B.defaults;function Le(pe,le,ue){if(typeof pe=="undefined"||pe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof pe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(pe)+", string expected");if(typeof le=="function"&&(ue=le,le=null),le=rt({},Le.defaults,le||{}),Qe(le),ue){var $=le.highlight,J;try{J=Se.lex(pe,le)}catch(we){return ue(we)}var ee=function(Pe){var je;if(!Pe)try{je=Ge.parse(J,le)}catch(Ze){Pe=Ze}return le.highlight=$,Pe?ue(Pe):ue(null,je)};if(!$||$.length<3)return ee();if(delete le.highlight,!J.length)return ee();var oe=0;Le.walkTokens(J,function(we){we.type==="code"&&(oe++,setTimeout(function(){$(we.text,we.lang,function(Pe,je){if(Pe)return ee(Pe);je!=null&&je!==we.text&&(we.text=je,we.escaped=!0),oe--,oe===0&&ee()})},0))}),oe===0&&ee();return}try{var fe=Se.lex(pe,le);return le.walkTokens&&Le.walkTokens(fe,le.walkTokens),Ge.parse(fe,le)}catch(we){if(we.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+Ye(we.message+"",!0)+"</pre>";throw we}}Le.options=Le.setOptions=function(pe){return rt(Le.defaults,pe),qe(Le.defaults),Le},Le.getDefaults=Ce,Le.defaults=Xe,Le.use=function(pe){var le=rt({},pe);if(pe.renderer&&function(){var $=Le.defaults.renderer||new ke,J=function(fe){var we=$[fe];$[fe]=function(){for(var Pe=arguments.length,je=new Array(Pe),Ze=0;Ze<Pe;Ze++)je[Ze]=arguments[Ze];var We=pe.renderer[fe].apply($,je);return We===!1&&(We=we.apply($,je)),We}};for(var ee in pe.renderer)J(ee);le.renderer=$}(),pe.tokenizer&&function(){var $=Le.defaults.tokenizer||new ve,J=function(fe){var we=$[fe];$[fe]=function(){for(var Pe=arguments.length,je=new Array(Pe),Ze=0;Ze<Pe;Ze++)je[Ze]=arguments[Ze];var We=pe.tokenizer[fe].apply($,je);return We===!1&&(We=we.apply($,je)),We}};for(var ee in pe.tokenizer)J(ee);le.tokenizer=$}(),pe.walkTokens){var ue=Le.defaults.walkTokens;le.walkTokens=function($){pe.walkTokens($),ue&&ue($)}}Le.setOptions(le)},Le.walkTokens=function(pe,le){for(var ue=I(pe),$;!($=ue()).done;){var J=$.value;le(J);switch(J.type){case"table":{for(var ee=I(J.tokens.header),oe;!(oe=ee()).done;){var fe=oe.value;Le.walkTokens(fe,le)}for(var we=I(J.tokens.cells),Pe;!(Pe=we()).done;)for(var je=Pe.value,Ze=I(je),We;!(We=Ze()).done;){var mt=We.value;Le.walkTokens(mt,le)}break}case"list":{Le.walkTokens(J.items,le);break}default:J.tokens&&Le.walkTokens(J.tokens,le)}}},Le.Parser=Ge,Le.parser=Ge.parse,Le.Renderer=ke,Le.TextRenderer=Oe,Le.Lexer=Se,Le.lexer=Se.lex,Le.Tokenizer=ve,Le.Slugger=$e,Le.parse=Le;var _e=Le;return _e})},ELLl:function(ft,tt,de){(function(te){te(de("VrN/"))})(function(te){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=te.Pos;te.defineOption("autoCloseBrackets",!1,function(w,E,l){l&&l!=te.Init&&(w.removeKeyMap(I),w.state.closeBrackets=null),E&&(P(V(E,"pairs")),w.state.closeBrackets=E,w.addKeyMap(I))});function V(w,E){return E=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[E]!=null?w[E]:G[E]}var I={Backspace:_,Enter:D};function P(w){for(var E=0;E<w.length;E++){var l=w.charAt(E),o="'"+l+"'";I[o]||(I[o]=B(l))}}P(G.pairs+"`");function B(w){return function(E){return T(E,w)}}function U(w){var E=w.state.closeBrackets;if(!E||E.override)return E;var l=w.getModeAt(w.getCursor());return l.closeBrackets||E}function _(w){var E=U(w);if(!E||w.getOption("disableInput"))return te.Pass;for(var l=V(E,"pairs"),o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return te.Pass;var u=R(w,o[s].head);if(!u||l.indexOf(u)%2!=0)return te.Pass}for(var s=o.length-1;s>=0;s--){var S=o[s].head;w.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function D(w){var E=U(w),l=E&&V(E,"explode");if(!l||w.getOption("disableInput"))return te.Pass;for(var o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return te.Pass;var u=R(w,o[s].head);if(!u||l.indexOf(u)%2!=0)return te.Pass}w.operation(function(){var S=w.lineSeparator()||`
|
|
`;w.replaceSelection(S+S,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var p=0;p<o.length;p++){var h=o[p].head.line;w.indentLine(h,null,!0),w.indentLine(h+1,null,!0)}})}function g(w){var E=te.cmpPos(w.anchor,w.head)>0;return{anchor:new L(w.anchor.line,w.anchor.ch+(E?-1:1)),head:new L(w.head.line,w.head.ch+(E?1:-1))}}function T(w,E){var l=U(w);if(!l||w.getOption("disableInput"))return te.Pass;var o=V(l,"pairs"),s=o.indexOf(E);if(s==-1)return te.Pass;for(var u=V(l,"closeBefore"),S=V(l,"triples"),p=o.charAt(s+1)==E,h=w.listSelections(),A=s%2==0,y,c=0;c<h.length;c++){var f=h[c],d=f.head,a,v=w.getRange(d,L(d.line,d.ch+1));if(A&&!f.empty())a="surround";else if((p||!A)&&v==E)p&&C(w,d)?a="both":S.indexOf(E)>=0&&w.getRange(d,L(d.line,d.ch+3))==E+E+E?a="skipThree":a="skip";else if(p&&d.ch>1&&S.indexOf(E)>=0&&w.getRange(L(d.line,d.ch-2),d)==E+E){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(L(d.line,d.ch-2))))return te.Pass;a="addFour"}else if(p){var m=d.ch==0?" ":w.getRange(L(d.line,d.ch-1),d);if(!te.isWordChar(v)&&m!=E&&!te.isWordChar(m))a="both";else return te.Pass}else if(A&&(v.length===0||/\s/.test(v)||u.indexOf(v)>-1))a="both";else return te.Pass;if(!y)y=a;else if(y!=a)return te.Pass}var b=s%2?o.charAt(s-1):E,M=s%2?E:o.charAt(s+1);w.operation(function(){if(y=="skip")w.execCommand("goCharRight");else if(y=="skipThree")for(var F=0;F<3;F++)w.execCommand("goCharRight");else if(y=="surround"){for(var j=w.getSelections(),F=0;F<j.length;F++)j[F]=b+j[F]+M;w.replaceSelections(j,"around"),j=w.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=g(j[F]);w.setSelections(j)}else y=="both"?(w.replaceSelection(b+M,null),w.triggerElectric(b+M),w.execCommand("goCharLeft")):y=="addFour"&&(w.replaceSelection(b+b+b+b,"before"),w.execCommand("goCharRight"))})}function R(w,E){var l=w.getRange(L(E.line,E.ch-1),L(E.line,E.ch+1));return l.length==2?l:null}function C(w,E){var l=w.getTokenAt(L(E.line,E.ch+1));return/\bstring/.test(l.type)&&l.start==E.ch&&(E.ch==0||!/\bstring/.test(w.getTokenTypeAt(E)))}})},GfqC:function(ft,tt,de){"use strict";var te=de("cDcd"),G=de.n(te),L=de("TSYQ"),V=de.n(L);function I(W,k){var O="cannot "+W.method+" "+W.action+" "+k.status+"'",K=new Error(O);return K.status=k.status,K.method=W.method,K.url=W.action,K}function P(W){var k=W.responseText||W.response;if(!k)return k;try{return JSON.parse(k)}catch(O){return k}}function B(W){var k=new XMLHttpRequest;W.onProgress&&k.upload&&(k.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var O=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var q=W.data[Y];if(Array.isArray(q)){q.forEach(function(ie){O.append(Y+"[]",ie)});return}O.append(Y,W.data[Y])}),W.file instanceof Blob?O.append(W.filename,W.file,W.file.name):O.append(W.filename,W.file),k.onerror=function(q){W.onError(q)},k.onload=function(){return k.status<200||k.status>=300?W.onError(I(W,k),P(k)):W.onSuccess(P(k),k)},k.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in k&&(k.withCredentials=!0);var K=W.headers||{};return K["X-Requested-With"]!==null&&k.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function(Y){K[Y]!==null&&k.setRequestHeader(Y,K[Y])}),k.send(O),{abort:function(){k.abort()}}}var U=+new Date,_=0;function D(){return"rc-upload-"+U+"-"+ ++_}function g(W,k){return W.indexOf(k,W.length-k.length)!==-1}var T=function(W,k){if(W&&k){var O=Array.isArray(k)?k:k.split(","),K=W.name||"",Y=W.type||"",q=Y.replace(/\/.*$/,"");return O.some(function(ie){var Te=ie.trim();return Te.charAt(0)==="."?g(K.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?q===Te.replace(/\/.*$/,""):Y===Te})}return!0};function R(W,k){var O=W.createReader(),K=[];function Y(){O.readEntries(function(q){var ie=Array.prototype.slice.apply(q);K=K.concat(ie);var Te=!ie.length;Te?k(K):Y()})}Y()}var C=function(k,O,K){var Y=function q(ie,Te){Te=Te||"",ie.isFile?ie.file(function(ve){K(ve)&&(ie.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=ie.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),O([ve]))}):ie.isDirectory&&R(ie,function(ve){ve.forEach(function(ge){q(ge,""+Te+ie.name+"/")})})};k.forEach(function(q){Y(q.webkitGetAsEntry())})},w=C,E=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var O=arguments[k];for(var K in O)Object.prototype.hasOwnProperty.call(O,K)&&(W[K]=O[K])}return W},l=function(){function W(k,O){var K=[],Y=!0,q=!1,ie=void 0;try{for(var Te=k[Symbol.iterator](),ve;!(Y=(ve=Te.next()).done)&&!(K.push(ve.value),O&&K.length===O);Y=!0);}catch(ge){q=!0,ie=ge}finally{try{!Y&&Te.return&&Te.return()}finally{if(q)throw ie}}return K}return function(k,O){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return W(k,O);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(k,O){for(var K=0;K<O.length;K++){var Y=O[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(k,Y.key,Y)}}return function(k,O,K){return O&&W(k.prototype,O),K&&W(k,K),k}}();function s(W,k,O){return k in W?Object.defineProperty(W,k,{value:O,enumerable:!0,configurable:!0,writable:!0}):W[k]=O,W}function u(W,k){var O={};for(var K in W){if(k.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;O[K]=W[K]}return O}function S(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function p(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function h(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}var A=function(k){return Object.keys(k).reduce(function(O,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(O[K]=k[K]),O},{})},y=function(W){h(k,W);function k(){var O,K,Y,q;S(this,k);for(var ie=arguments.length,Te=Array(ie),ve=0;ve<ie;ve++)Te[ve]=arguments[ve];return q=(K=(Y=p(this,(O=k.__proto__||Object.getPrototypeOf(k)).call.apply(O,[this].concat(Te))),Y),Y.state={uid:D()},Y.reqs={},Y.onChange=function(ge){var he=ge.target.files;Y.uploadFiles(he),Y.reset()},Y.onClick=function(ge){var he=Y.fileInput;if(!he)return;var ce=Y.props,ae=ce.children,me=ce.onClick;ae&&ae.type==="button"&&(he.parentNode.focus(),he.parentNode.querySelector("button").blur()),he.click(),me&&me(ge)},Y.onKeyDown=function(ge){ge.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(ge){var he=Y.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(Y.props.directory)w(Array.prototype.slice.call(ge.dataTransfer.items),Y.uploadFiles,function(ae){return T(ae,Y.props.accept)});else{var ce=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(ae){return T(ae,Y.props.accept)});he===!1&&(ce=ce.slice(0,1)),Y.uploadFiles(ce)}},Y.uploadFiles=function(ge){var he=Array.prototype.slice.call(ge);he.map(function(ce){return ce.uid=D(),ce}).forEach(function(ce){Y.upload(ce,he)})},Y.saveFileInput=function(ge){Y.fileInput=ge},K),p(Y,q)}return o(k,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,Y){var q=this,ie=this.props;if(!ie.beforeUpload)return setTimeout(function(){return q.post(K)},0);var Te=ie.beforeUpload(K,Y);Te&&Te.then?Te.then(function(ve){var ge=Object.prototype.toString.call(ve);return ge==="[object File]"||ge==="[object Blob]"?q.post(ve):q.post(K)}).catch(function(ve){console.log(ve)}):Te!==!1&&setTimeout(function(){return q.post(K)},0);return}},{key:"post",value:function(K){var Y=this;if(!this._isMounted)return;var q=this.props,ie=q.onStart,Te=q.onProgress,ve=q.transformFile,ge=ve===void 0?function(he){return he}:ve;new Promise(function(he){var ce=q.action;return typeof ce=="function"&&(ce=ce(K)),he(ce)}).then(function(he){var ce=K.uid,ae=q.customRequest||B,me=Promise.resolve(ge(K)).then(function(Q){var ne=q.data;return typeof ne=="function"&&(ne=ne(Q)),Promise.all([Q,ne])}).catch(function(Q){console.error(Q)});me.then(function(Q){var ne=l(Q,2),Z=ne[0],Ee=ne[1],Ae={action:he,filename:q.name,data:Ee,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Te?function(be){Te(be,K)}:null,onSuccess:function(Se,Re){delete Y.reqs[ce],q.onSuccess(Se,K,Re)},onError:function(Se,Re){delete Y.reqs[ce],q.onError(Se,Re,K)}};ie(K),Y.reqs[ce]=ae(Ae)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(K){var Y=this.reqs;if(K){var q=K;K&&K.uid&&(q=K.uid),Y[q]&&Y[q].abort&&Y[q].abort(),delete Y[q]}else Object.keys(Y).forEach(function(ie){Y[ie]&&Y[ie].abort&&Y[ie].abort(),delete Y[ie]})}},{key:"render",value:function(){var K,Y=this.props,q=Y.component,ie=Y.prefixCls,Te=Y.className,ve=Y.disabled,ge=Y.id,he=Y.style,ce=Y.multiple,ae=Y.accept,me=Y.children,Q=Y.directory,ne=Y.openFileDialogOnClick,Z=Y.onMouseEnter,Ee=Y.onMouseLeave,Ae=u(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),be=V()((K={},s(K,ie,!0),s(K,ie+"-disabled",ve),s(K,Te,Te),K)),Se=ve?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return G.a.createElement(q,E({},Se,{className:be,role:"button",style:he}),G.a.createElement("input",E({},A(Ae),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(Fe){return Fe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:Q?"directory":null,webkitdirectory:Q?"webkitdirectory":null,multiple:ce,onChange:this.onChange})),me)}}]),k}(te.Component),c=y,f=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var O=arguments[k];for(var K in O)Object.prototype.hasOwnProperty.call(O,K)&&(W[K]=O[K])}return W},d=function(){function W(k,O){for(var K=0;K<O.length;K++){var Y=O[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(k,Y.key,Y)}}return function(k,O,K){return O&&W(k.prototype,O),K&&W(k,K),k}}();function a(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function v(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function m(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}function b(){}var M=function(W){m(k,W);function k(){var O,K,Y,q;a(this,k);for(var ie=arguments.length,Te=Array(ie),ve=0;ve<ie;ve++)Te[ve]=arguments[ve];return q=(K=(Y=v(this,(O=k.__proto__||Object.getPrototypeOf(k)).call.apply(O,[this].concat(Te))),Y),Y.saveUploader=function(ge){Y.uploader=ge},K),v(Y,q)}return d(k,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return G.a.createElement(c,f({},this.props,{ref:this.saveUploader}))}}]),k}(te.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:b,onError:b,onSuccess:b,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=tt.a=F},Gytx:function(ft,tt){ft.exports=function(te,G,L,V){var I=L?L.call(V,te,G):void 0;if(I!==void 0)return!!I;if(te===G)return!0;if(typeof te!="object"||!te||typeof G!="object"||!G)return!1;var P=Object.keys(te),B=Object.keys(G);if(P.length!==B.length)return!1;for(var U=Object.prototype.hasOwnProperty.bind(G),_=0;_<P.length;_++){var D=P[_];if(!U(D))return!1;var g=te[D],T=G[D];if(I=L?L.call(V,g,T,D):void 0,I===!1||I===void 0&&g!==T)return!1}return!0}},HmJG:function(ft,tt,de){},LdHM:function(ft,tt,de){"use strict";de.d(tt,"b",function(){return u}),de.d(tt,"a",function(){return p});var te=de("1OyB"),G=de("vuIU"),L=de("Ji7U"),V=de("LK+K"),I=de("cDcd"),P=de("rePB"),B=de("Ff2n"),U=de("ODXe"),_=de("4IlW"),D=de("bX4T"),g=de("YrtM"),T=de("TSYQ"),R=de.n(T),C=de("+nKL"),w=de("8OUc"),E=function(K,Y){var q=K.prefixCls,ie=K.id,Te=K.flattenOptions,ve=K.childrenAsData,ge=K.values,he=K.searchValue,ce=K.multiple,ae=K.defaultActiveFirstOption,me=K.height,Q=K.itemHeight,ne=K.notFoundContent,Z=K.open,Ee=K.menuItemSelectedIcon,Ae=K.virtual,be=K.onSelect,Se=K.onToggleOpen,Re=K.onActiveValue,Fe=K.onScroll,Ie=K.onMouseEnter,ke="".concat(q,"-item"),Oe=Object(g.a)(function(){return Te},[Z,Te],function(_e,pe){return pe[0]&&_e[1]!==pe[1]}),$e=I.useRef(null),ze=function(pe){pe.preventDefault()},Ve=function(pe){$e.current&&$e.current.scrollTo({index:pe})},Ge=function(pe){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Oe.length,$=0;$<ue;$+=1){var J=(pe+$*le+ue)%ue,ee=Oe[J],oe=ee.group,fe=ee.data;if(!oe&&!fe.disabled)return J}return-1},rt=I.useState(function(){return Ge(0)}),Qe=Object(U.a)(rt,2),Ye=Qe[0],Ce=Qe[1],qe=function(pe){Ce(pe);var le=Oe[pe];if(!le){Re(null,-1);return}Re(le.data.value,pe)};I.useEffect(function(){qe(ae!==!1?Ge(0):-1)},[Oe.length,he]),I.useEffect(function(){var _e=setTimeout(function(){if(!ce&&Z&&ge.size===1){var pe=Array.from(ge)[0],le=Oe.findIndex(function(ue){var $=ue.data;return $.value===pe});qe(le),Ve(le)}});return function(){return clearTimeout(_e)}},[Z]);var Xe=function(pe){pe!==void 0&&be(pe,{selected:!ge.has(pe)}),ce||Se(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(pe){var le=pe.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 $=Ge(Ye+ue,ue);Ve($),qe($)}break}case _.a.ENTER:{var J=Oe[Ye];J&&!J.data.disabled?Xe(J.data.value):Xe(void 0),Z&&pe.preventDefault();break}case _.a.ESC:Se(!1)}},onKeyUp:function(){},scrollTo:function(pe){Ve(pe)}}}),Oe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),className:"".concat(ke,"-empty"),onMouseDown:ze},ne);function Le(_e){var pe=Oe[_e];if(!pe)return null;var le=pe.data||{},ue=le.value,$=le.label,J=le.children,ee=Object(D.a)(le,!0),oe=ve?J:$;return pe?I.createElement("div",Object.assign({"aria-label":typeof oe=="string"?oe:null},ee,{key:_e,role:"option",id:"".concat(ie,"_list_").concat(_e),"aria-selected":ge.has(ue)}),ue):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),style:{height:0,width:0,overflow:"hidden"}},Le(Ye-1),Le(Ye),Le(Ye+1)),I.createElement(C.a,{itemKey:"key",ref:$e,data:Oe,height:me,itemHeight:Q,fullHeight:!1,onMouseDown:ze,onScroll:Fe,virtual:Ae,onMouseEnter:Ie},function(_e,pe){var le,ue=_e.group,$=_e.groupOption,J=_e.data,ee=J.label,oe=J.key;if(ue)return I.createElement("div",{className:R()(ke,"".concat(ke,"-group"))},ee!==void 0?ee:oe);var fe=J.disabled,we=J.value,Pe=J.title,je=J.children,Ze=J.style,We=J.className,mt=Object(B.a)(J,["disabled","value","title","children","style","className"]),ut=ge.has(we),at="".concat(ke,"-option"),Et=R()(ke,at,We,(le={},Object(P.a)(le,"".concat(at,"-grouped"),$),Object(P.a)(le,"".concat(at,"-active"),Ye===pe&&!fe),Object(P.a)(le,"".concat(at,"-disabled"),fe),Object(P.a)(le,"".concat(at,"-selected"),ut),le)),xt=ve?je:ee,St=!Ee||typeof Ee=="function"||ut;return I.createElement("div",Object.assign({},mt,{"aria-selected":ut,className:Et,title:Pe,onMouseMove:function(){if(Ye===pe||fe)return;qe(pe)},onClick:function(){fe||Xe(we)},style:Ze}),I.createElement("div",{className:"".concat(at,"-content")},xt||we),I.isValidElement(Ee)||ut,St&&I.createElement(w.a,{className:"".concat(ke,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:ut}},ut?"\u2713":null))}))},l=I.forwardRef(E);l.displayName="OptionList";var o=l,s=function(){return null};s.isSelectOption=!0;var u=s,S=function(){return null};S.isSelectOptGroup=!0;var p=S,h=de("VTBJ"),A=de("Zm9Q");function y(O){var K=O.key,Y=O.props,q=Y.children,ie=Y.value,Te=Object(B.a)(Y,["children","value"]);return Object(h.a)({key:K,value:ie!==void 0?ie:K,children:q},Te)}function c(O){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(O).map(function(Y,q){if(!I.isValidElement(Y)||!Y.type)return null;var ie=Y.type.isSelectOptGroup,Te=Y.key,ve=Y.props,ge=ve.children,he=Object(B.a)(ve,["children"]);return K||!ie?y(Y):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Te===null?q:Te,"__"),label:Te},he),{},{options:c(ge)})}).filter(function(Y){return Y})}var f=de("2Qr1"),d=de("qNPg"),a=de("U8pU"),v=de("Kwbf"),m=de("WKfj");function b(O){var K=O.mode,Y=O.options,q=O.children,ie=O.backfill,Te=O.allowClear,ve=O.placeholder,ge=O.getInputElement,he=O.showSearch,ce=O.onSearch,ae=O.defaultOpen,me=O.autoFocus,Q=O.labelInValue,ne=O.value,Z=O.inputValue,Ee=O.optionLabelProp,Ae=K==="multiple"||K==="tags",be=he!==void 0?he:Ae||K==="combobox",Se=Y||c(q);if(Object(v.a)(K!=="tags"||Se.every(function(ke){return!ke.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var Re=Se.some(function(ke){return ke.options?ke.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in ke?ke.value:ke.key)=="number"});Object(v.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(K!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(K==="combobox"||!ie,"`backfill` only works with `combobox` mode."),Object(v.a)(K==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(v.b)(K!=="combobox"||!ge||!Te||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ce&&!be&&K!=="combobox"&&K!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ae||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Fe=Object(m.d)(ne);Object(v.a)(!Q||Fe.every(function(ke){return Object(a.a)(ke)==="object"&&("key"in ke||"value"in ke)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Ae||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var Ie=null;Object(A.a)(q).some(function(ke){if(!I.isValidElement(ke)||!ke.type)return!1;var Oe=ke.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var $e=Object(A.a)(ke.props.children).every(function(ze){return!I.isValidElement(ze)||!ke.type||ze.type.isSelectOption?!0:(Ie=ze.type,!1)});return!$e}return Ie=Oe,!0}),Ie&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(v.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=b,F=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:M,fillOptionsWithMissingValue:f.a}),j=function(O){Object(L.a)(Y,O);var K=Object(V.a)(Y);function Y(){var q;return Object(te.a)(this,Y),q=K.apply(this,arguments),q.selectRef=I.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(G.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=u,j.OptGroup=p;var W=j,k=tt.c=W},M8RZ:function(ft,tt,de){"use strict";de.d(tt,"a",function(){return _});var te=de("fWQN"),G=de("mtLc"),L=de("yKVA"),V=de("879j"),I=de("cDcd"),P=de.n(I),B=de("faye"),U=de.n(B),_=function(D){Object(L.a)(T,D);var g=Object(V.a)(T);function T(R){var C;Object(te.a)(this,T),C=g.call(this,R);var w=window.document;return C.node=w.createElement("div"),w.body.appendChild(C.node),C}return Object(G.a)(T,[{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)}}]),T}(P.a.Component)},OLES:function(ft,tt,de){"use strict";var te=de("U8pU"),G=de("VTBJ"),L=de("Ff2n"),V=de("cDcd"),I=de("uciX"),P=de("7ixt"),B=function(R){var C=R.overlay,w=R.prefixCls,E=R.id,l=R.overlayInnerStyle;return V.createElement("div",{className:"".concat(w,"-inner"),id:E,role:"tooltip",style:l},typeof C=="function"?C():C)},U=B,_=function(R,C){var w=R.overlayClassName,E=R.trigger,l=E===void 0?["hover"]:E,o=R.mouseEnterDelay,s=o===void 0?0:o,u=R.mouseLeaveDelay,S=u===void 0?.1:u,p=R.overlayStyle,h=R.prefixCls,A=h===void 0?"rc-tooltip":h,y=R.children,c=R.onVisibleChange,f=R.afterVisibleChange,d=R.transitionName,a=R.animation,v=R.placement,m=v===void 0?"right":v,b=R.align,M=b===void 0?{}:b,F=R.destroyTooltipOnHide,j=F===void 0?!1:F,W=R.defaultVisible,k=R.getTooltipContainer,O=R.overlayInnerStyle,K=Object(L.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Y=Object(V.useRef)(null);Object(V.useImperativeHandle)(C,function(){return Y.current});var q=Object(G.a)({},K);"visible"in R&&(q.popupVisible=R.visible);var ie=function(){var ce=R.arrowContent,ae=ce===void 0?null:ce,me=R.overlay,Q=R.id;return[V.createElement("div",{className:"".concat(A,"-arrow"),key:"arrow"},ae),V.createElement(U,{key:"content",prefixCls:A,id:Q,overlay:me,overlayInnerStyle:O})]},Te=!1,ve=!1;if(typeof j=="boolean")Te=j;else if(j&&Object(te.a)(j)==="object"){var ge=j.keepParent;Te=ge===!0,ve=ge===!1}return V.createElement(I.a,Object.assign({popupClassName:w,prefixCls:A,popup:ie,action:l,builtinPlacements:P.a,popupPlacement:m,ref:Y,popupAlign:M,getPopupContainer:k,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:W,destroyPopupOnHide:Te,autoDestroy:ve,mouseLeaveDelay:S,popupStyle:p,mouseEnterDelay:s},q),y)},D=Object(V.forwardRef)(_),g=tt.a=D},Ot1p:function(ft,tt,de){"use strict";var te=de("2qtc"),G=de("kLXV"),L=de("rAM+"),V=de("miYZ"),I=de("tsqr"),P=de("9og8"),B=de("tJVT"),U=de("jrin"),_=de("WmNS"),D=de.n(_),g=de("cDcd"),T=de.n(g),R=de("VrN/"),C=de.n(R),w=de("bdgK"),E=de("p77/"),l=de("Bd2K"),o=de("ELLl"),s=de("19Vz"),u=de("lZu9"),S=de("+NIl"),p=de("kSUc"),h=de("9Bee"),A=function(fe){var we=fe.value,Pe=we===void 0?"":we,je=fe.className,Ze=fe.showTextOnly,We=fe.showLines,mt=fe.style,ut=mt===void 0?{}:mt,at=Object(g.useMemo)(function(){return""},[Pe]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:at}}))},y=de("0Owb"),c=de("dejd"),f=de("C+DQ"),d=de("1vsH"),a=de("m3rI"),v=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(fe){var we=fe.onActionCallback,Pe=fe.title,je=fe.icon,Ze=fe.actionName,We=fe.className,mt=We===void 0?"":We,ut=fe.children;function at(){we(Ze)}return T.a.createElement("a",{title:Pe,className:mt,onClick:at},T.a.createElement("i",{className:"md-iconfont ".concat(je)}),ut)}var b=function(fe){var we=fe.watch,Pe=fe.showNullButton,je=fe.onActionCallback,Ze=fe.fullScreen,We=fe.insertTemp,mt=fe.hidetoolBar,ut=fe.uuid,at=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.G)("_educoder_session"),"&key=").concat(ut,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Et=[].concat(v,[{title:"".concat(we?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(we?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return T.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Et.map(function(xt,St){return T.a.createElement("li",{key:St},xt.actionName?T.a.createElement(m,Object(y.a)({},xt,{onActionCallback:je})):T.a.createElement("span",{className:"v-line"}))}),Pe?T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:je},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,We&&T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(We),onActionCallback:je},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(m,{icon:"".concat(Ze?"icon-shrink":"icon-enlarge"),title:Ze?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:je})))},M=de("M8RZ"),F=de("+L6B"),j=de("2/Rp"),W=de("y8nQ"),k=de("Vl3Y"),O=de("5NDa"),K=de("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},q=function(fe){var we=fe.callback,Pe=fe.onCancel;function je(Ze){we(Ze)}return T.a.createElement(k.a,Object(y.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:je}),T.a.createElement(k.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement(K.a,null)),T.a.createElement(k.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement(K.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(j.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},ie=de("7ahc"),Te=de("HmJG"),ve=de("BjJ7"),ge=k.a.useForm,he={width:280,marginRight:10},ce={labelCol:{span:5},wrapperCol:{span:19}},ae=function(fe){var we=fe.callback,Pe=fe.onCancel,je=ge(),Ze=Object(B.a)(je,1),We=Ze[0];function mt(Et){we(Et)}function ut(Et,xt){if(Et.status===-1){I.b.error(Et.message);return}We.setFieldsValue({src:"/api/attachments/".concat(Et.id),type:xt.type})}function at(Et){var xt=Et.target.files[0];Q(xt,ut)}return T.a.createElement(k.a,Object(y.a)({form:We},ce,{className:"upload-image-panel",onFinish:mt}),T.a.createElement(k.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(k.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},T.a.createElement(K.a,{style:he})),T.a.createElement(me,{onFileChange:at}))),T.a.createElement(k.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},T.a.createElement(K.a,{style:{width:264}})),T.a.createElement(k.a.Item,{style:{textAlign:"right"}},T.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(j.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))};function me(fe){var we=fe.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:we}))}function Q(fe,we){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Pe=new FormData;Pe.append("editormd-image-file",fe),Pe.append("file_param_name","editormd-image-file"),Pe.append("byxhr","true");var je=new window.XMLHttpRequest;je.withCredentials=!0,je.addEventListener("load",function(Ze){we(JSON.parse(Ze.target.responseText),fe)},!1),je.addEventListener("error",function(Ze){console.error(Ze)},!1),je.open("POST","".concat(ve.a,"/api/attachments.json")),je.send(Pe)}var ne=de("giR+"),Z=de("fyUT"),Ee=de("7Kak"),Ae=de("9yH6"),be=Ae.a.Group,Se={margin:"0 8px"},Re=function(fe){var we=fe.callback,Pe=fe.onCancel;function je(Ze){we(Ze)}return T.a.createElement(k.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:je},T.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},T.a.createElement("span",{style:Se},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:Se},"\u884C\u6570"),T.a.createElement(k.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(Z.a,null)),T.a.createElement("span",{style:Se},"\u5217\u6570"),T.a.createElement(k.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(Z.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},T.a.createElement("span",{style:Se},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(k.a.Item,{name:"align"},T.a.createElement(be,null,T.a.createElement(Ae.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(Ae.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(Ae.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(Ae.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(j.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},Fe=de("ErOA"),Ie=de("7Cbv"),ke="link",Oe="upload-image",$e="code-block",ze="add-table",Ve="------------",Ge={default:Ve,left:":".concat(Ve),center:":".concat(Ve,":"),right:"".concat(Ve,":")},rt=de("9VGf"),Qe,Ye;function Ce(){}var qe=0,Xe=1e4,Le="\u2581",_e=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function pe(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,ue=le?"Cmd":"Ctrl",$=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],J=(Qe={},Object(U.a)(Qe,ue+"-B","bold"),Object(U.a)(Qe,ue+"-I","italic"),Qe),ee=(Ye={},Object(U.a)(Ye,ke,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Ye,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Ye,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Ye,ze,"\u6DFB\u52A0\u8868\u683C"),Ye),oe=tt.a=function(fe){var we=fe.defaultValue,Pe=we===void 0?"":we,je=fe.onChange,Ze=fe.width,We=Ze===void 0?"100%":Ze,mt=fe.height,ut=mt===void 0?400:mt,at=fe.miniToolbar,Et=at===void 0?!1:at,xt=fe.isFocus,St=xt===void 0?!1:xt,Dt=fe.watch,yt=fe.insertTemp,or=fe.mode,kr=or===void 0?"markdown":or,ur=fe.id,gr=ur===void 0?"markdown-editor-id":ur,hr=fe.showResizeBar,ia=hr===void 0?!1:hr,Ar=fe.noStorage,Hn=Ar===void 0?!1:Ar,Kn=fe.showNullButton,Mt=Kn===void 0?!1:Kn,nt=fe.hidetoolBar,Pr=nt===void 0?!1:nt,pn=fe.fullScreen,Zt=pn===void 0?!1:pn,wt=fe.onBlur,vr=fe.onCMBeforeChange,Mr=fe.onFullScreen,mn=fe.className,Ne=mn===void 0?"":mn,dt=fe.disablePaste,Gn=dt===void 0?!1:dt,gn=fe.placeholder,vn=gn===void 0?"":gn,Jr=fe.values,yn=Jr===void 0?"":Jr,ht=Object(g.useState)(null),Ai=Object(B.a)(ht,2),Ue=Ai[0],bn=Ai[1],pr=Object(g.useState)(Pe),zn=Object(B.a)(pr,2),Zr=zn[0],yr=zn[1],Vn=Object(g.useState)(Dt),Xn=Object(B.a)(Vn,2),br=Xn[0],Yn=Xn[1],Li=Object(g.useState)(Zt),$n=Object(B.a)(Li,2),xr=$n[0],Di=$n[1],aa=Object(g.useState)(""),Qn=Object(B.a)(aa,2),$t=Qn[0],Wr=Qn[1],oa=Object(g.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Jn=qr[1],sa=Object(g.useState)(ut),Oi=Object(B.a)(sa,2),Ri=Oi[0],xn=Oi[1],ki=Object(g.useState)(!1),Pi=Object(B.a)(ki,2),la=Pi[0],En=Pi[1],en=Object(g.useRef)(Object(Ie.a)()),tn=Object(g.useRef)(!1),Tn=Object(g.useRef)(),_r=Object(g.useRef)(),Ir=Object(g.useRef)(),Fr=Object(g.useRef)(),Sn=Object(g.useRef)(),Mi=function(){var it=Object(P.a)(D.a.mark(function ct(){var st,gt;return D.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Ot.next=2,Object(Fe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=Ot.sent,gt!=null&&(st=gt.attachments)!==null&&st!==void 0&&st.length&&(console.log("cm:",Ue,_r),gt.attachments.map(function(bt){bt.content_type.indexOf("image")>-1?Ue.replaceSelection(".concat(bt.content_type,")")):bt.content_type.indexOf("video")>-1?Ue.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):bt.content_type.indexOf("pdf")>-1?Ue.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Ue.replaceSelection("[".concat(bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,")"))}));case 4:case"end":return Ot.stop()}},ct)}));return function(){return it.apply(this,arguments)}}();Object(g.useEffect)(function(){yr(yn),Ue==null||Ue.setValue(yn)},[yn]),Object(g.useEffect)(function(){Mr==null||Mr(xr)},[xr]),Object(g.useEffect)(function(){if(_r.current){var it=C.a.fromTextArea(_r.current,{mode:kr,lineNumbers:!Et,lineWrapping:!0,value:Pe,autoCloseTags:!0,autoCloseBrackets:!0});St&&it.focus();function ct(st,gt){if(Gn){gt.preventDefault();return}var Tt=gt.clipboardData;if(Tt){var Ot=Tt.types.toString(),bt=Tt.items;if(Ot==="Files"||Tt.types.indexOf("Files")>-1){if(gt.preventDefault(),kr=="stex")return;try{var Ut,qt=bt[1];((Ut=bt[0])===null||Ut===void 0?void 0:Ut.kind)==="file"&&(qt=bt[0]);var vt=qt.getAsFile(),Nr=vt.name.split(".").pop();Q(vt,function(Ct){if(Ct.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(Ct.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):$.includes(Nr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ct),it.on("dragleave",function(st,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(st,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(st,gt){Ir.current.classList.add("mouse-hover-md");var Tt;if(Tt=gt.dataTransfer.files,Tt.length>0){gt.preventDefault(),gt.stopPropagation();for(var Ot=function(qt){var vt=Tt[qt],Nr=vt.name.split(".").pop();Q(vt,function(Ct){if(Ct.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection(".concat(Ct.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(vt.type,'&disposition=inline" target="_blank">').concat(vt.name,"</a>")):$.includes(Nr)?it.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(vt.name,"</a>")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},bt=0;bt<Tt.length;bt++)Ot(bt)}}),bn(it),function(){it.off("paste",ct)}}},[]);var dr=Object(g.useCallback)(function(){if(Ir.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Ri,Ir,xr]);Object(g.useEffect)(function(){function it(){var st=new w.default(function(gt){var Tt=Object(L.a)(gt),Ot;try{for(Tt.s();!(Ot=Tt.n()).done;){var bt=Ot.value;(bt.target.offsetHeight>0||bt.target.offsetWidth>0)&&(dr(),Ue.setSize("100%","100%"),Ue.refresh())}}catch(Ut){Tt.e(Ut)}finally{Tt.f()}});return st.observe(_r.current.parentElement),st}if(Ue){var ct=it();return function(){ct.unobserve(_r.current.parentElement)}}},[Ue,dr]),Object(g.useEffect)(function(){if(Ue){for(var it=[],ct=function(){var bt=gt[st];Tt=Object(B.a)(bt,2);var Ut=Tt[0],qt=Tt[1],vt=Object(U.a)({},Ut,function(){_i(qt)});it.push(vt),Ue.addKeyMap(vt)},st=0,gt=Object.entries(J);st<gt.length;st++){var Tt;ct()}return Tn.current=setInterval(function(){tn.current&&Mi()},4e3),function(){clearInterval(Tn.current);var Ot=Object(L.a)(it),bt;try{for(Ot.s();!(bt=Ot.n()).done;){var Ut=bt.value;Ue.removeKeyMap(Ut)}}catch(qt){Ot.e(qt)}finally{Ot.f()}}}},[Ue]),Object(g.useEffect)(function(){Zt!==xr&&Di(Zt)},[Zt]),Object(rt.a)(function(){if(!Hn&&Er>0){var it=new Date().getTime(),ct=window.sessionStorage.getItem(gr);it>=Er+Xe&&(!ct||ct!==Zr)&&(window.sessionStorage.setItem(gr,Zr),En(!0))}},Xe),Object(g.useEffect)(function(){Yn(Dt)},[Ue,Dt]),Object(g.useEffect)(function(){Ue&&(St&&Ue.focus())},[Ue,St]),Object(g.useEffect)(function(){if(br&&Ue){var it=Ue.getScrollerElement();function ct(st){var gt=st.target;if(Sn.current){var Tt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*Tt}}return it.addEventListener("scroll",ct),function(){it.removeEventListener("scroll",ct)}}},[Ue,br]),Object(g.useEffect)(function(){if(Ue&&vr){function it(ct,st){vr(ct,st)}return Ue.on("beforeChange",it),function(){Ue.off("beforeChange",it)}}},[Ue,vr]),Object(g.useEffect)(function(){if(Ue&&wt){function it(){wt(Ue.getValue())}return Ue.on("blur",it),function(){Ue.off("blur",it)}}},[Ue,wt]),Object(g.useEffect)(function(){if(Ue){function it(ct){var st=ct.getValue();yr(st),Jn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),je&&je(st)}return Ue.on("change",it),function(){Ue.off("change",it)}}},[Ue,je]),Object(g.useEffect)(function(){Ue&&(Pe==null?(Ue.setValue(""),yr("")):Pe!==Ue.getValue()&&(Ue.setValue(Pe),yr(Pe),Ue.setCursor(Ue.lineCount(),0)))},[Ue,Pe]);var _i=Object(g.useCallback)(function(it){var ct=Ue.getCursor(),st=Ue.getSelection(),gt=st.split(`
|
|
`);switch(it){case"bold":return Ue.replaceSelection("**"+st+"**"),st===""&&Ue.setCursor(ct.line,ct.ch+2),Ue.focus();case"italic":return Ue.replaceSelection("*"+st+"*"),st===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"code":return Ue.replaceSelection("`"+st+"`"),st===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.focus();case"inline-latex":return Ue.replaceSelection("`$$"+st+"$$`"),st===""&&Ue.setCursor(ct.line,ct.ch+3),Ue.focus();case"latex":return Ue.replaceSelection("```latex\n"+st+"\n```"),Ue.setCursor(ct.line+1,st.length+1),Ue.focus();case"line-break":return Ue.replaceSelection(`<br/>
|
|
`),Ue.focus();case"list-ul":return st===""?Ue.replaceSelection("- "+st):Ue.replaceSelection(gt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
|
|
`)),Ue.focus();case"list-ol":return st===""?Ue.replaceSelection("1. "+st):Ue.replaceSelection(gt.map(function(Tt,Ot){return Tt===""?"":"".concat(Ot+1,". ").concat(Tt)}).join(`
|
|
`)),Ue.focus();case"add-null-ch":return st===""&&Ue.setCursor(ct.line,ct.ch+1),Ue.replaceSelection(Le),Ue.focus();case"inster-template-1":return st===""&&Ue.setCursor(ct.line,ct.ch),Ue.replaceSelection(_e),Ue.focus();case"eraser":return Ue.setValue(""),Ue.focus();case"trigger-watch":return Yn(!br),Ue.focus();case"trigger-full-screen":return Di(!xr),Ue.focus();case ke:Wr(ke);return;case $e:Wr($e);return;case Oe:Wr(Oe);return;case ze:Wr(ze);return;default:throw new Error}},[Ue,br,xr]),wn=Object(g.useCallback)(function(it){Wr("");switch($t){case ke:var ct=it.title,st=it.link;return Ue.replaceSelection("[".concat(ct,"](").concat(st,")")),Ue.focus();case $e:var gt=it.language,Tt=it.content;return Ue.replaceSelection(["```"+gt,Tt,"```"].join(`
|
|
`)),Ue.focus();case Oe:var Ot=it.src,bt=it.alt;return bt?Ue.replaceSelection(".concat(Ot,' "').concat(bt,'" )')):Ue.replaceSelection("")),Ue.focus();case ze:for(var Ut=it.row,qt=it.col,vt=it.align,Nr=`
|
|
`,Ct=0;Ct<Ut;Ct++){for(var er=[],Vt=[],mr=0;mr<qt;mr++)Ct===1&&Vt.push(Ge[vt]),er.push(" ");Ct===1&&(Nr+="| ".concat(Vt.join(" | "),` |
|
|
`)),Nr+="| ".concat(er.join(qt===1?"":" | "),` |
|
|
`)}return Ue.replaceSelection(Nr+`
|
|
`),Ue.focus();default:throw new Error}},[Ue,$t]),Zn=Object(g.useMemo)(function(){switch($t){case ke:return T.a.createElement(q,{callback:wn,onCancel:Hr});case $e:return T.a.createElement(ie.b,{callback:wn,onCancel:Hr});case Oe:return T.a.createElement(ae,{callback:wn,onCancel:Hr});case ze:return T.a.createElement(Re,{callback:wn,onCancel:Hr});default:return null}},[$t]);function Hr(){Wr("")}Object(g.useEffect)(function(){if(Fr.current){var it=Fr.current,ct=!1,st=0;function gt(bt){ct=!0,st=bt.pageY}function Tt(){ct=!1}function Ot(bt){if(ct){var Ut=bt.pageY-st;Ut<0&&(Ut=0),Ut>300&&(Ut=300);var qt=ut+Ut+"px";xn(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",Ot),document.addEventListener("mouseup",Tt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",Ot),document.removeEventListener("mouseup",Tt)}}},[Ue,Fr]),Object(g.useEffect)(function(){xn(ut)},[ut]);var Lr=pe(We),qn=pe(Ri),Tr={width:Lr,height:qn},ei=Object(g.useMemo)(function(){if(Er){var it=new Date(Er),ct=it.getHours(),st=it.getMinutes(),gt=it.getSeconds();return ct=ct<10?"0"+ct:ct,st=st<10?"0"+st:st,gt=gt<10?"0"+gt:gt,"".concat(ct,":").concat(st,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(gr),En(!1),Jn(0)}function rn(){En(!1),Jn(0),Ue.setValue(window.sessionStorage.getItem(gr))}function ua(it,ct){var st=Ue.getValue();st=st.replace(it,ct),yr(st),Ue==null||Ue.setValue(st)}return T.a.createElement(g.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},T.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(br?"on-preview":""," ").concat(Et?"mini":""," ").concat(xr?"full-screen":""),style:Tr},T.a.createElement(b,{insertTemp:yt,watch:br,fullScreen:xr,showNullButton:Mt,onActionCallback:_i,hidetoolBar:Pr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:_r,placeholder:vn})),br?T.a.createElement("div",{ref:Sn,className:"preview-container"},kr==="stex"&&T.a.createElement(A,{value:Zr}),kr!=="stex"&&T.a.createElement(h.a,{edit:!0,value:Zr,replaces:ua})):null))),ia?T.a.createElement("a",{ref:Fr,className:"editor-resize"}):null,T.a.createElement(M.a,null,ee[$t]?T.a.createElement(G.a,{centered:!0,title:ee[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Zn):null))}},SJMd:function(ft,tt){/**
|
|
* @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 de,te,G,L=!1,V,I;window.PR_SHOULD_USE_CONTINUATION=!0;var P,B;(function(){var U=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"],g=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[g,"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"],w="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",E=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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"],S=[T,C,R,E,l,o,s,u],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",A="kwd",y="com",c="typ",f="lit",d="pun",a="pln",v="tag",m="dec",b="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(be){for(var Se=0,Re=!1,Fe=!1,Ie=0,ke=be.length;Ie<ke;++Ie){var Oe=be[Ie];if(Oe.ignoreCase)Fe=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Fe=!1;break}}var $e={b:8,t:9,n:10,v:11,f:12,r:13};function ze(Ye){var Ce=Ye.charCodeAt(0);if(Ce!==92)return Ce;var qe=Ye.charAt(1);return Ce=$e[qe],Ce||("0"<=qe&&qe<="7"?parseInt(Ye.substring(1),8):qe==="u"||qe==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function Ve(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Ce=String.fromCharCode(Ye);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Ge(Ye){var Ce=Ye.substring(1,Ye.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),qe=[],Xe=Ce[0]==="^",Le=["["];Xe&&Le.push("^");for(var _e=Xe?1:0,pe=Ce.length;_e<pe;++_e){var le=Ce[_e];if(/\\[bdsw]/i.test(le))Le.push(le);else{var ue=ze(le),$;_e+2<pe&&Ce[_e+1]==="-"?($=ze(Ce[_e+2]),_e+=2):$=ue,qe.push([ue,$]),$<65||ue>122||($<65||ue>90||qe.push([Math.max(65,ue)|32,Math.min($,90)|32]),$<97||ue>122||qe.push([Math.max(97,ue)&~32,Math.min($,122)&~32]))}}qe.sort(function(fe,we){return fe[0]-we[0]||we[1]-fe[1]});for(var J=[],ee=[],_e=0;_e<qe.length;++_e){var oe=qe[_e];oe[0]<=ee[1]+1?ee[1]=Math.max(ee[1],oe[1]):J.push(ee=oe)}for(var _e=0;_e<J.length;++_e){var oe=J[_e];Le.push(Ve(oe[0])),oe[1]>oe[0]&&(oe[1]+1>oe[0]&&Le.push("-"),Le.push(Ve(oe[1])))}return Le.push("]"),Le.join("")}function rt(Ye){for(var Ce=Ye.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),qe=Ce.length,Xe=[],Le=0,_e=0;Le<qe;++Le){var pe=Ce[Le];if(pe==="(")++_e;else if(pe.charAt(0)==="\\"){var le=+pe.substring(1);le&&(le<=_e?Xe[le]=-1:Ce[Le]=Ve(le))}}for(var Le=1;Le<Xe.length;++Le)Xe[Le]===-1&&(Xe[Le]=++Se);for(var Le=0,_e=0;Le<qe;++Le){var pe=Ce[Le];if(pe==="(")++_e,Xe[_e]||(Ce[Le]="(?:");else if(pe.charAt(0)==="\\"){var le=+pe.substring(1);le&&le<=_e&&(Ce[Le]="\\"+Xe[le])}}for(var Le=0;Le<qe;++Le)Ce[Le]==="^"&&Ce[Le+1]!=="^"&&(Ce[Le]="");if(Ye.ignoreCase&&Re)for(var Le=0;Le<qe;++Le){var pe=Ce[Le],ue=pe.charAt(0);pe.length>=2&&ue==="["?Ce[Le]=Ge(pe):ue!=="\\"&&(Ce[Le]=pe.replace(/[a-zA-Z]/g,function(ee){var oe=ee.charCodeAt(0);return"["+String.fromCharCode(oe&~32,oe|32)+"]"}))}return Ce.join("")}for(var Qe=[],Ie=0,ke=be.length;Ie<ke;++Ie){var Oe=be[Ie];if(Oe.global||Oe.multiline)throw new Error(""+Oe);Qe.push("(?:"+rt(Oe)+")")}return new RegExp(Qe.join("|"),Fe?"gi":"g")}function O(be,Se){var Re=/(?:^|\s)nocode(?:\s|$)/,Fe=[],Ie=0,ke=[],Oe=0;function $e(ze){var Ve=ze.nodeType;if(Ve==1){if(Re.test(ze.className))return;for(var Ge=ze.firstChild;Ge;Ge=Ge.nextSibling)$e(Ge);var rt=ze.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(Fe[Oe]=`
|
|
`,ke[Oe<<1]=Ie++,ke[Oe++<<1|1]=ze)}else if(Ve==3||Ve==4){var Qe=ze.nodeValue;Qe.length&&(Se?Qe=Qe.replace(/\r\n?/g,`
|
|
`):Qe=Qe.replace(/[ \t\r\n]+/g," "),Fe[Oe]=Qe,ke[Oe<<1]=Ie,Ie+=Qe.length,ke[Oe++<<1|1]=ze)}}return $e(be),{sourceCode:Fe.join("").replace(/\n$/,""),spans:ke}}function K(be,Se,Re,Fe,Ie){if(!Re)return;var ke={sourceNode:be,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:Se,decorations:null};Fe(ke),Ie.push.apply(Ie,ke.decorations)}var Y=/\S/;function q(be){for(var Se=void 0,Re=be.firstChild;Re;Re=Re.nextSibling){var Fe=Re.nodeType;Se=Fe===1?Se?be:Re:Fe===3&&Y.test(Re.nodeValue)?be:Se}return Se===be?void 0:Se}function ie(be,Se){var Re={},Fe;(function(){for(var Oe=be.concat(Se),$e=[],ze={},Ve=0,Ge=Oe.length;Ve<Ge;++Ve){var rt=Oe[Ve],Qe=rt[3];if(Qe)for(var Ye=Qe.length;--Ye>=0;)Re[Qe.charAt(Ye)]=rt;var Ce=rt[1],qe=""+Ce;ze.hasOwnProperty(qe)||($e.push(Ce),ze[qe]=null)}$e.push(/[\0-\uffff]/),Fe=k($e)})();var Ie=Se.length,ke=function(Oe){for(var $e=Oe.sourceCode,ze=Oe.basePos,Ve=Oe.sourceNode,Ge=[ze,a],rt=0,Qe=$e.match(Fe)||[],Ye={},Ce=0,qe=Qe.length;Ce<qe;++Ce){var Xe=Qe[Ce],Le=Ye[Xe],_e=void 0,pe;if(typeof Le=="string")pe=!1;else{var le=Re[Xe.charAt(0)];if(le)_e=Xe.match(le[1]),Le=le[0];else{for(var ue=0;ue<Ie;++ue)if(le=Se[ue],_e=Xe.match(le[1]),_e){Le=le[0];break}_e||(Le=a)}pe=Le.length>=5&&Le.substring(0,5)==="lang-",pe&&!(_e&&typeof _e[1]=="string")&&(pe=!1,Le=b),pe||(Ye[Xe]=Le)}var $=rt;if(rt+=Xe.length,!pe)Ge.push(ze+$,Le);else{var J=_e[1],ee=Xe.indexOf(J),oe=ee+J.length;_e[2]&&(oe=Xe.length-_e[2].length,ee=oe-J.length);var fe=Le.substring(5);K(Ve,ze+$,Xe.substring(0,ee),ke,Ge),K(Ve,ze+$+ee,J,me(fe,J),Ge),K(Ve,ze+$+oe,Xe.substring(oe),ke,Ge)}}Oe.decorations=Ge};return ke}function Te(be){var Se=[],Re=[];be.tripleQuotedStrings?Se.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):be.multiLineStrings?Se.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Se.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),be.verbatimStrings&&Re.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Fe=be.hashComments;Fe&&(be.cStyleComments?(Fe>1?Se.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Se.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Se.push([y,/^#[^\r\n]*/,null,"#"])),be.cStyleComments&&(Re.push([y,/^\/\/[^\r\n]*/,null]),Re.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=be.regexLiterals;if(Ie){var ke=Ie>1?"":`
|
|
\r`,Oe=ke?".":"[\\S\\s]",$e="/(?=[^/*"+ke+"])(?:[^/\\x5B\\x5C"+ke+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+ke+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+W+"("+$e+")")])}var ze=be.types;ze&&Re.push([c,ze]);var Ve=(""+be.keywords).replace(/^ | $/g,"");Ve.length&&Re.push([A,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),Se.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Ge="^.[^\\s\\w.$@'\"`/\\\\]*";return be.regexLiterals&&(Ge+="(?!s*/)"),Re.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(Ge),null]),ie(Se,Re)}var ve=Te({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(be,Se,Re){for(var Fe=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,ke=be.ownerDocument,Oe=ke.createElement("li");be.firstChild;)Oe.appendChild(be.firstChild);var $e=[Oe];function ze(Ce){var qe=Ce.nodeType;if(qe==1&&!Fe.test(Ce.className))if(Ce.nodeName==="br")Ve(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var Xe=Ce.firstChild;Xe;Xe=Xe.nextSibling)ze(Xe);else if((qe==3||qe==4)&&Re){var Le=Ce.nodeValue,_e=Le.match(Ie);if(_e){var pe=Le.substring(0,_e.index);Ce.nodeValue=pe;var le=Le.substring(_e.index+_e[0].length);if(le){var ue=Ce.parentNode;ue.insertBefore(ke.createTextNode(le),Ce.nextSibling)}Ve(Ce),pe||Ce.parentNode.removeChild(Ce)}}}function Ve(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function qe(_e,pe){var le=pe?_e.cloneNode(!1):_e,ue=_e.parentNode;if(ue){var $=qe(ue,1),J=_e.nextSibling;$.appendChild(le);for(var ee=J;ee;ee=J)J=ee.nextSibling,$.appendChild(ee)}return le}for(var Xe=qe(Ce.nextSibling,0),Le;(Le=Xe.parentNode)&&Le.nodeType===1;)Xe=Le;$e.push(Xe)}for(var Ge=0;Ge<$e.length;++Ge)ze($e[Ge]);Se===(Se|0)&&$e[0].setAttribute("value",Se);var rt=ke.createElement("ol");rt.className="linenums";for(var Qe=Math.max(0,Se-1|0)||0,Ge=0,Ye=$e.length;Ge<Ye;++Ge)Oe=$e[Ge],Oe.className="L"+(Ge+Qe)%10,Oe.firstChild||Oe.appendChild(ke.createTextNode("\xA0")),rt.appendChild(Oe);be.appendChild(rt)}function he(be){var Se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Se=Se&&+Se[1]<=8;var Re=/\n/g,Fe=be.sourceCode,Ie=Fe.length,ke=0,Oe=be.spans,$e=Oe.length,ze=0,Ve=be.decorations,Ge=Ve.length,rt=0;Ve[Ge]=Ie;var Qe,Ye;for(Ye=Qe=0;Ye<Ge;)Ve[Ye]!==Ve[Ye+2]?(Ve[Qe++]=Ve[Ye++],Ve[Qe++]=Ve[Ye++]):Ye+=2;for(Ge=Qe,Ye=Qe=0;Ye<Ge;){for(var Ce=Ve[Ye],qe=Ve[Ye+1],Xe=Ye+2;Xe+2<=Ge&&Ve[Xe+1]===qe;)Xe+=2;Ve[Qe++]=Ce,Ve[Qe++]=qe,Ye=Xe}Ge=Ve.length=Qe;var Le=be.sourceNode,_e="";Le&&(_e=Le.style.display,Le.style.display="none");try{for(var pe=null;ze<$e;){var le=Oe[ze],ue=Oe[ze+2]||Ie,$=Ve[rt+2]||Ie,Xe=Math.min(ue,$),J=Oe[ze+1],ee;if(J.nodeType!==1&&(ee=Fe.substring(ke,Xe))){Se&&(ee=ee.replace(Re,"\r")),J.nodeValue=ee;var oe=J.ownerDocument,fe=oe.createElement("span");fe.className=Ve[rt+1];var we=J.parentNode;we.replaceChild(fe,J),fe.appendChild(J),ke<ue&&(Oe[ze+1]=J=oe.createTextNode(Fe.substring(Xe,ue)),we.insertBefore(J,fe.nextSibling))}ke=Xe,ke>=ue&&(ze+=2),ke>=$&&(rt+=2)}}finally{Le&&(Le.style.display=_e)}}var ce={};function ae(be,Se){for(var Re=Se.length;--Re>=0;){var Fe=Se[Re];ce.hasOwnProperty(Fe)?U.console&&console.warn("cannot override language handler %s",Fe):ce[Fe]=be}}function me(be,Se){return be&&ce.hasOwnProperty(be)||(be=/^\s*</.test(Se)?"default-markup":"default-code"),ce[be]}ae(ve,["default-code"]),ae(ie([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(ie([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(ie([],[[F,/^[\s\S]+/]]),["uq.val"]),ae(Te({keywords:T,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ae(Te({keywords:"null,true,false"}),["json"]),ae(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ae(Te({keywords:R,cStyleComments:!0}),["java"]),ae(Te({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(Te({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(Te({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(Te({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(ie([],[[h,/^[\s\S]+/]]),["regex"]);function Q(be){var Se=be.langExtension;try{var Re=O(be.sourceNode,be.pre),Fe=Re.sourceCode;be.sourceCode=Fe,be.spans=Re.spans,be.basePos=0,me(Se,Fe)(be),he(be)}catch(Ie){U.console&&console.log(Ie&&Ie.stack||Ie)}}function ne(be,Se,Re){var Fe=Re||!1,Ie=Se||null,ke=document.createElement("div");ke.innerHTML="<pre>"+be+"</pre>",ke=ke.firstChild,Fe&&ge(ke,Fe,!0);var Oe={langExtension:Ie,numberLines:Fe,sourceNode:ke,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Q(Oe),ke.innerHTML}function Z(be,Se){var Re=Se||document.body,Fe=Re.ownerDocument||document;function Ie(le){return Re.getElementsByTagName(le)}for(var ke=[Ie("pre"),Ie("code"),Ie("xmp")],Oe=[],$e=0;$e<ke.length;++$e)for(var ze=0,Ve=ke[$e].length;ze<Ve;++ze)Oe.push(ke[$e][ze]);ke=null;var Ge=Date;Ge.now||(Ge={now:function(){return+new Date}});var rt=0,Qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,qe=/pre|xmp/i,Xe=/^code$/i,Le=/^(?:pre|code|xmp)$/i,_e={};function pe(){for(var le=U.PR_SHOULD_USE_CONTINUATION?Ge.now()+250:Infinity;rt<Oe.length&&Ge.now()<le;rt++){for(var ue=Oe[rt],$=_e,J=ue;J=J.previousSibling;){var ee=J.nodeType,oe=(ee===7||ee===8)&&J.nodeValue;if(oe?!/^\??prettify\b/.test(oe):ee!==3||/\S/.test(J.nodeValue))break;if(oe){$={},oe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,yt,or){$[yt]=or});break}}var fe=ue.className;if(($!==_e||Ye.test(fe))&&!Ce.test(fe)){for(var we=!1,Pe=ue.parentNode;Pe;Pe=Pe.parentNode){var je=Pe.tagName;if(Le.test(je)&&Pe.className&&Ye.test(Pe.className)){we=!0;break}}if(!we){ue.className+=" prettyprinted";var Ze=$.lang;if(!Ze){Ze=fe.match(Qe);var We;!Ze&&(We=q(ue))&&Xe.test(We.tagName)&&(Ze=We.className.match(Qe)),Ze&&(Ze=Ze[1])}var mt;if(qe.test(ue.tagName))mt=1;else{var ut=ue.currentStyle,at=Fe.defaultView,Et=ut?ut.whiteSpace:at&&at.getComputedStyle?at.getComputedStyle(ue,null).getPropertyValue("white-space"):0;mt=Et&&Et.substring(0,3)==="pre"}var xt=$.linenums;(xt=xt==="true"||+xt)||(xt=fe.match(/\blinenums\b(?::(\d+))?/),xt=xt?xt[1]&&xt[1].length?+xt[1]:!0:!1),xt&&ge(ue,xt,mt);var St={langExtension:Ze,sourceNode:ue,numberLines:xt,pre:mt,sourceCode:null,basePos:null,spans:null,decorations:null};Q(St)}}}rt<Oe.length?U.setTimeout(pe,250):typeof be=="function"&&be()}pe()}var Ee=U.PR={createSimpleLexer:ie,registerLangHandler:ae,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:y,PR_DECLARATION:m,PR_KEYWORD:A,PR_LITERAL:f,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:b,PR_STRING:h,PR_TAG:v,PR_TYPE:c,prettyPrintOne:L?U.prettyPrintOne=ne:P=ne,prettyPrint:B=L?U.prettyPrint=Z:B=Z},Ae=U.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(ft,tt,de){(function(te,G){ft.exports=G()})(this,function(){"use strict";var te=navigator.userAgent,G=navigator.platform,L=/gecko\/\d/i.test(te),V=/MSIE \d/.test(te),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(te),P=/Edge\/(\d+)/.exec(te),B=V||I||P,U=B&&(V?document.documentMode||6:+(P||I)[1]),_=!P&&/WebKit\//.test(te),D=_&&/Qt\/\d+\.\d+/.test(te),g=!P&&/Chrome\//.test(te),T=/Opera\//.test(te),R=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(te),w=/PhantomJS/.test(te),E=!P&&/AppleWebKit/.test(te)&&/Mobile\/\w+/.test(te),l=/Android/.test(te),o=E||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(te),s=E||/Mac/.test(G),u=/\bCrOS\b/.test(te),S=/win/i.test(G),p=T&&te.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(T=!1,_=!0);var h=s&&(D||T&&(p==null||p<12.11)),A=L||B&&U>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var n=e.className,r=y(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(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 v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function b(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};E?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function k(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function O(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 K(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 H=e.indexOf(" ",x);if(H<0||H>=t)return N+(t-x);N+=H-x,N+=n-N%n,x=H+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=k(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ie=50,Te={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},ge={origin:"*mouse"},he={origin:"+move"};function ce(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 ae=[""];function me(e){for(;ae.length<=e;)ae.push(Q(ae)+" ");return ae[e]}function Q(e){return e[e.length-1]}function ne(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ae(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&O(t,n),n}var be=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Se(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||be.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&Se(e)?!0:t.test(e):Se(e)}function Fe(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 ke(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Oe(e,t,n){for(;(n<0?t>0:t<e.length)&&ke(e.charAt(t));)t+=n;return t}function $e(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 ze(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 Ge(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 rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,x=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function z(X,re,se){this.level=X,this.from=re,this.to=se}return function(X,re){var se=re=="ltr"?"L":"R";if(X.length==0||re=="ltr"&&!r.test(X))return!1;for(var xe=X.length,ye=[],De=0;De<xe;++De)ye.push(n(X.charCodeAt(De)));for(var Me=0,Be=se;Me<xe;++Me){var He=ye[Me];He=="m"?ye[Me]=Be:Be=He}for(var Je=0,Ke=se;Je<xe;++Je){var et=ye[Je];et=="1"&&Ke=="r"?ye[Je]="n":x.test(et)&&(Ke=et,et=="r"&&(ye[Je]="R"))}for(var lt=1,ot=ye[0];lt<xe-1;++lt){var pt=ye[lt];pt=="+"&&ot=="1"&&ye[lt+1]=="1"?ye[lt]="1":pt==","&&ot==ye[lt+1]&&(ot=="1"||ot=="n")&&(ye[lt]=ot),ot=pt}for(var Rt=0;Rt<xe;++Rt){var Ht=ye[Rt];if(Ht==",")ye[Rt]="N";else if(Ht=="%"){var Pt=void 0;for(Pt=Rt+1;Pt<xe&&ye[Pt]=="%";++Pt);for(var lr=Rt&&ye[Rt-1]=="!"||Pt<xe&&ye[Pt]=="1"?"1":"N",nr=Rt;nr<Pt;++nr)ye[nr]=lr;Rt=Pt-1}}for(var Ft=0,ir=se;Ft<xe;++Ft){var zt=ye[Ft];ir=="L"&&zt=="1"?ye[Ft]="L":x.test(zt)&&(ir=zt)}for(var Bt=0;Bt<xe;++Bt)if(i.test(ye[Bt])){var Nt=void 0;for(Nt=Bt+1;Nt<xe&&i.test(ye[Nt]);++Nt);for(var _t=(Bt?ye[Bt-1]:se)=="L",ar=(Nt<xe?ye[Nt]:se)=="L",jn=_t==ar?_t?"L":"R":se,Qr=Bt;Qr<Nt;++Qr)ye[Qr]=jn;Bt=Nt-1}for(var Yt=[],Rr,Kt=0;Kt<xe;)if(N.test(ye[Kt])){var Va=Kt;for(++Kt;Kt<xe&&N.test(ye[Kt]);++Kt);Yt.push(new z(0,Va,Kt))}else{var jr=Kt,fn=Yt.length,hn=re=="rtl"?1:0;for(++Kt;Kt<xe&&ye[Kt]!="L";++Kt);for(var Jt=jr;Jt<Kt;)if(H.test(ye[Jt])){jr<Jt&&(Yt.splice(fn,0,new z(1,jr,Jt)),fn+=hn);var Wn=Jt;for(++Jt;Jt<Kt&&H.test(ye[Jt]);++Jt);Yt.splice(fn,0,new z(2,Wn,Jt)),fn+=hn,jr=Jt}else++Jt;jr<Kt&&Yt.splice(fn,0,new z(1,jr,Kt))}return re=="ltr"&&(Yt[0].level==1&&(Rr=X.match(/^\s+/))&&(Yt[0].from=Rr[0].length,Yt.unshift(new z(0,0,Rr[0].length))),Q(Yt).level==1&&(Rr=X.match(/\s+$/))&&(Q(Yt).to-=Rr[0].length,Yt.push(new z(0,xe-Rr[0].length,xe)))),re=="rtl"?Yt.reverse():Yt}}();function Qe(e,t){var n=e.order;return n==null&&(n=e.order=rt(e.text,t)),n}var Ye=[],Ce=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]||Ye).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||Ye}function Xe(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=q(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function Le(e,t){var n=qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function _e(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Le(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function pe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)q(n,t[r])==-1&&n.push(t[r])}function le(e,t){return qe(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Ce(this,t,n)},e.prototype.off=function(t,n){Xe(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function J(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ee(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function oe(e){$(e),J(e)}function fe(e){return e.target||e.srcElement}function we(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 Pe=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),je;function Ze(e){if(je==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(je=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=je?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var We;function mt(e){if(We!=null)return We;var t=d(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:We=r.right-n.right<3}var ut=`
|
|
|
|
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/)},at=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},Et=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function St(e){if(xt!=null)return xt;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return xt=Math.abs(n.left-r.left)>1}var Dt={},yt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function kr(e,t){yt[e]=t}function ur(e){if(typeof e=="string"&&yt.hasOwnProperty(e))e=yt[e];else if(e&&typeof e.name=="string"&&yt.hasOwnProperty(e.name)){var t=yt[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ur("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ur("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function gr(e,t){t=ur(t);var n=Dt[t.name];if(!n)return gr(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 ia(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};O(t,n)}function Ar(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Hn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kn(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function Pr(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 pn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Zt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function wt(e){if(e.parent==null)return null;for(var t=e.parent,n=q(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 vr(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 H=e.lines[N],z=H.height;if(t<z)break;t-=z}return n+N}function Mr(e,t){return t>=e.first&&t<e.first+e.size}function mn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ne(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ne))return new Ne(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function Gn(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function gn(e){return Ne(e.line,e.ch)}function vn(e,t){return dt(e,t)<0?t:e}function Jr(e,t){return dt(e,t)<0?e:t}function yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(e,t){if(t.line<e.first)return Ne(e.first,0);var n=e.first+e.size-1;return t.line>n?Ne(n,nt(e,n).text.length):Ai(t,nt(e,t.line).text.length)}function Ai(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Ue(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}var bn=function(e,t){this.state=e,this.lookAhead=t},pr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};pr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},pr.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}},pr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},pr.fromSaved=function(e,t,n){return t instanceof bn?new pr(e,Ar(e.mode,t.state),n,t.lookAhead):new pr(e,Ar(e.mode,t),n)},pr.prototype.save=function(e){var t=e!==!1?Ar(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],x={};xr(e,t.text,e.doc.mode,n,function(X,re){return i.push(X,re)},x,r);for(var N=n.state,H=function(X){n.baseTokens=i;var re=e.state.overlays[X],se=1,xe=0;n.state=!0,xr(e,t.text,re.mode,n,function(ye,De){for(var Me=se;xe<ye;){var Be=i[se];Be>ye&&i.splice(se,1,ye,i[se+1],Be),se+=2,xe=Math.min(ye,Be)}if(!De)return;if(re.opaque)i.splice(Me,se-Me,ye,"overlay "+De),se=Me+2;else for(;Me<se;Me+=2){var He=i[Me+1];i[Me+1]=(He?He+" ":"")+"overlay "+De}},x),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)H(z);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function Zr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=yr(e,wt(t)),i=t.text.length>e.options.maxHighlightLength&&Ar(e.doc.mode,r.state),x=zn(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 yr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new pr(r,!0,t);var x=Di(e,t,n),N=x>r.first&&nt(r,x-1).stateAfter,H=N?pr.fromSaved(r,N,x):new pr(r,Kn(r.mode),x);return r.iter(x,t,function(z){Vn(e,z.text,H);var X=H.line;z.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&X<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Vn(e,t,n,r){var i=e.doc.mode,x=new Mt(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&Xn(i,n.state);!x.eol();)br(i,x,n.state),x.start=x.pos}function Xn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Hn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function br(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Hn(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 Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Li(e,t,n,r){var i=e.doc,x=i.mode,N;t=ht(i,t);var H=nt(i,t.line),z=yr(e,t.line,n),X=new Mt(H.text,e.options.tabSize,z),re;for(r&&(re=[]);(r||X.pos<t.ch)&&!X.eol();)X.start=X.pos,N=br(x,X,z.state),r&&re.push(new Yn(X,N,Ar(i.mode,z.state)));return r?re:new Yn(X,N,z.state)}function $n(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function xr(e,t,n,r,i,x,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var z=0,X=null,re=new Mt(t,e.options.tabSize,r),se,xe=e.options.addModeClass&&[null];for(t==""&&$n(Xn(n,r.state),x);!re.eol();){if(re.pos>e.options.maxHighlightLength?(H=!1,N&&Vn(e,t,r,re.pos),re.pos=t.length,se=null):se=$n(br(n,re,r.state,xe),x),xe){var ye=xe[0].name;ye&&(se="m-"+(se?ye+" "+se:ye))}if(!H||X!=se){for(;z<re.start;)z=Math.min(re.start,z+5e3),i(z,X);X=se}re.start=re.pos}for(;z<re.pos;){var De=Math.min(re.pos,z+5e3);i(De,X),z=De}}function Di(e,t,n){for(var r,i,x=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=x.first)return x.first;var z=nt(x,H-1),X=z.stateAfter;if(X&&(!n||H+(X instanceof bn?X.lookAhead:0)<=x.modeFrontier))return H;var re=K(z.text,null,e.options.tabSize);(i==null||r>re)&&(i=H-1,r=re)}return i}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=nt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Qn=!1,$t=!1;function Wr(){Qn=!0}function oa(){$t=!0}function qr(e,t,n){this.marker=e,this.from=t,this.to=n}function Er(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Jn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Oi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,H=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);if(H||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 qr(N,x.from,z?null:x.to))}}return r}function Ri(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,H=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);if(H||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 qr(N,z?null:x.from-t,x.to==null?null:x.to-t))}}return r}function xn(e,t){if(t.full)return null;var n=Mr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Mr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,N=dt(t.from,t.to)==0,H=Oi(n,i,N),z=Ri(r,x,N),X=t.text.length==1,re=Q(t.text).length+(X?i:0);if(H)for(var se=0;se<H.length;++se){var xe=H[se];if(xe.to==null){var ye=Er(z,xe.marker);ye?X&&(xe.to=ye.to==null?null:ye.to+re):xe.to=i}}if(z)for(var De=0;De<z.length;++De){var Me=z[De];if(Me.to!=null&&(Me.to+=re),Me.from==null){var Be=Er(H,Me.marker);Be||(Me.from=re,X&&(H||(H=[])).push(Me))}else Me.from+=re,X&&(H||(H=[])).push(Me)}H&&(H=ki(H)),z&&z!=H&&(z=ki(z));var He=[H];if(!X){var Je=t.text.length-2,Ke;if(Je>0&&H)for(var et=0;et<H.length;++et)H[et].to==null&&(Ke||(Ke=[])).push(new qr(H[et].marker,null,null));for(var lt=0;lt<Je;++lt)He.push(Ke);He.push(z)}return He}function ki(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Pi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ye){if(ye.markedSpans)for(var De=0;De<ye.markedSpans.length;++De){var Me=ye.markedSpans[De].marker;Me.readOnly&&(!r||q(r,Me)==-1)&&(r||(r=[])).push(Me)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var N=r[x],H=N.find(0),z=0;z<i.length;++z){var X=i[z];if(dt(X.to,H.from)<0||dt(X.from,H.to)>0)continue;var re=[z,1],se=dt(X.from,H.from),xe=dt(X.to,H.to);(se<0||!N.inclusiveLeft&&!se)&&re.push({from:X.from,to:H.from}),(xe>0||!N.inclusiveRight&&!xe)&&re.push({from:H.to,to:X.to}),i.splice.apply(i,re),z+=re.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function En(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function en(e){return e.inclusiveLeft?-1:0}function tn(e){return e.inclusiveRight?1:0}function Tn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),x=dt(r.from,i.from)||en(e)-en(t);if(x)return-x;var N=dt(r.to,i.to)||tn(e)-tn(t);return N||t.id-e.id}function _r(e,t){var n=$t&&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||Tn(r,i.marker)<0)&&(r=i.marker);return r}function Ir(e){return _r(e,!0)}function Fr(e){return _r(e,!1)}function Sn(e,t){var n=$t&&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||Tn(r,x.marker)<0)&&(r=x.marker)}return r}function Mi(e,t,n,r,i){var x=nt(e,t),N=$t&&x.markedSpans;if(N)for(var H=0;H<N.length;++H){var z=N[H];if(!z.marker.collapsed)continue;var X=z.marker.find(0),re=dt(X.from,n)||en(z.marker)-en(i),se=dt(X.to,r)||tn(z.marker)-tn(i);if(re>=0&&se<=0||re<=0&&se>=0)continue;if(re<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?dt(X.to,n)>=0:dt(X.to,n)>0)||re>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?dt(X.from,r)<=0:dt(X.from,r)<0))return!0}}function dr(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function _i(e){for(var t;t=Fr(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Fr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Zn(e,t){var n=nt(e,t),r=dr(n);return n==r?t:wt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Lr(e,n))return t;for(;r=Fr(n);)n=r.find(1,!0).line;return wt(n)+1}function Lr(e,t){var n=$t&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&qn(e,t,r))return!0}}function qn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return qn(e,r.line,Er(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,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)&&qn(e,t,i))return!0}function Tr(e){e=dr(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 H=x.children[N];if(H==n)break;t+=H.height}return t}function ei(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ir(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Fr(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 Ii(e){var t=e.display,n=e.doc;t.maxLine=nt(n,n.first),t.maxLineLength=ei(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ei(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,En(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return wt(this)},ue(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),En(e,n);var i=r?r(e):1;i!=e.height&&Zt(e,i)}function it(e){e.parent=null,la(e)}var ct={},st={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?st:ct;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Tt(e,t){var n=v("span",null,null,_?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var x=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=bt,mt(e.display.measure)&&(N=Qe(x,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&wt(x);Nr(x,r,Zr(e,x,H)),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(Ze(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 Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Ot(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 bt(e,t,n,r,i,x,N){if(!t)return;var H=e.splitSpaces?Ut(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,re;if(!z.test(t))e.col+=t.length,re=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,re),B&&U<9&&(X=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var se=0;;){z.lastIndex=se;var xe=z.exec(t),ye=xe?xe.index-se:t.length-se;if(ye){var De=document.createTextNode(H.slice(se,se+ye));B&&U<9?re.appendChild(a("span",[De])):re.appendChild(De),e.map.push(e.pos,e.pos+ye,De),e.col+=ye,e.pos+=ye}if(!xe)break;se+=ye+1;var Me=void 0;if(xe[0]==" "){var Be=e.cm.options.tabSize,He=Be-e.col%Be;Me=re.appendChild(a("span",me(He),"cm-tab")),Me.setAttribute("role","presentation"),Me.setAttribute("cm-text"," "),e.col+=He}else xe[0]=="\r"||xe[0]==`
|
|
`?(Me=re.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Me.setAttribute("cm-text",xe[0]),e.col+=1):(Me=e.cm.options.specialCharPlaceholder(xe[0]),Me.setAttribute("cm-text",xe[0]),B&&U<9?re.appendChild(a("span",[Me])):re.appendChild(Me),e.col+=1);e.map.push(e.pos,e.pos+1,Me),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||X||x||N){var Je=n||"";r&&(Je+=r),i&&(Je+=i);var Ke=a("span",[re],Je,x);if(N)for(var et in N)N.hasOwnProperty(et)&&et!="style"&&et!="class"&&Ke.setAttribute(et,N[et]);return e.content.appendChild(Ke)}e.content.appendChild(re)}function Ut(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 qt(e,t){return function(n,r,i,x,N,H,z){i=i?i+" cm-force-border":"cm-force-border";for(var X=n.pos,re=X+r.length;;){for(var se=void 0,xe=0;xe<t.length&&!(se=t[xe],se.to>X&&se.from<=X);xe++);if(se.to>=re)return e(n,r,i,x,N,H,z);e(n,r.slice(0,se.to-X),i,x,null,H,z),x=null,r=r.slice(se.to-X),X=se.to}}}function vt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Nr(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]),gt(n[N+1],t.cm.options));return}for(var H=i.length,z=0,X=1,re="",se,xe,ye=0,De,Me,Be,He,Je;;){if(ye==z){De=Me=Be=xe="",Je=null,He=null,ye=Infinity;for(var Ke=[],et=void 0,lt=0;lt<r.length;++lt){var ot=r[lt],pt=ot.marker;if(pt.type=="bookmark"&&ot.from==z&&pt.widgetNode)Ke.push(pt);else if(ot.from<=z&&(ot.to==null||ot.to>z||pt.collapsed&&ot.to==z&&ot.from==z)){if(ot.to!=null&&ot.to!=z&&ye>ot.to&&(ye=ot.to,Me=""),pt.className&&(De+=" "+pt.className),pt.css&&(xe=(xe?xe+";":"")+pt.css),pt.startStyle&&ot.from==z&&(Be+=" "+pt.startStyle),pt.endStyle&&ot.to==ye&&(et||(et=[])).push(pt.endStyle,ot.to),pt.title&&((Je||(Je={})).title=pt.title),pt.attributes)for(var Rt in pt.attributes)(Je||(Je={}))[Rt]=pt.attributes[Rt];pt.collapsed&&(!He||Tn(He.marker,pt)<0)&&(He=ot)}else ot.from>z&&ye>ot.from&&(ye=ot.from)}if(et)for(var Ht=0;Ht<et.length;Ht+=2)et[Ht+1]==ye&&(Me+=" "+et[Ht]);if(!He||He.from==z)for(var Pt=0;Pt<Ke.length;++Pt)vt(t,0,Ke[Pt]);if(He&&(He.from||0)==z){if(vt(t,(He.to==null?H+1:He.to)-z,He.marker,He.from==null),He.to==null)return;He.to==z&&(He=!1)}}if(z>=H)break;for(var lr=Math.min(H,ye);;){if(re){var nr=z+re.length;if(!He){var Ft=nr>lr?re.slice(0,lr-z):re;t.addToken(t,Ft,se?se+De:De,Be,z+Ft.length==ye?Me:"",xe,Je)}if(nr>=lr){re=re.slice(lr-z),z=lr;break}z=nr,Be=""}re=i.slice(x,x=n[X++]),se=gt(n[X++],t.cm.options)}}}function Ct(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?wt(Q(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Lr(e,t)}function er(e,t,n){for(var r=[],i,x=t;x<n;x=i){var N=new Ct(e.doc,nt(e.doc,x),x);i=x+N.size,r.push(N)}return r}var Vt=null;function mr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Rs(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 ks(e,t){var n=e.ownsGroup;if(!n)return;try{Rs(n)}finally{Vt=null,t(n)}}var ti=null;function Gt(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ti?i=ti:(i=ti=[],setTimeout(Ps,0));for(var x=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)x(N)}function Ps(){var e=ti;ti=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?_s(e,t):x=="gutter"?Qa(e,t,n,r):x=="class"?da(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function ri(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&U<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ri(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Tt(e,t)}function _s(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ms(e,t),t.line.wrapClass?ri(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ri(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var N=ri(t),H=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",mn(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 X=e.display.gutterSpecs[z].className,re=x.hasOwnProperty(X)&&x[X];re&&H.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[X]+"px; width: "+r.gutterWidth[X]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ja(e,t,n)}function Fs(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Qa(e,t,n,r),Ja(e,t,r),t.node}function Ja(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var x=ri(n),N=0,H=t.widgets;N<H.length;++N){var z=H[N],X=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||X.setAttribute("cm-ignore-events","true"),Ns(z,X,n,r),e.display.input.setUneditable(X),i&&z.above?x.insertBefore(X,n.gutter||n.text):x.appendChild(X),Gt(z,"redraw")}}function Ns(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ni(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Ur(e,t){for(var n=fe(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 Fi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(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 Dr(e){return ie-e.display.nativeBarWidth}function nn(e){return e.display.scroller.clientWidth-Dr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Dr(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&nn(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(),H=0;H<N.length-1;H++){var z=N[H],X=N[H+1];Math.abs(z.bottom-X.bottom)>2&&x.push((z.bottom+X.top)/2-n.top)}}x.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(wt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=dr(t);var n=wt(t),r=e.display.externalMeasured=new Ct(e.doc,t,n);r.lineN=n;var i=r.built=Tt(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Or(e,Cn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Cn(e,t){var n=wt(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Or(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||(Us(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 ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,x,N,H,z,X=0;X<e.length;X+=3)if(H=e[X],z=e[X+1],t<H?(i=0,x=1,N="left"):t<z?(i=t-H,x=i+1):(X==e.length-3||t==z&&e[X+3]>t)&&(x=z-H,i=x-1,t>=z&&(N="right")),i!=null){if(r=e[X+2],H==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],N="left";if(n=="right"&&i==z-H)for(;X<e.length-3&&e[X+3]==e[X+4]&&!e[X+5].insertLeft;)r=e[(X+=3)+2],N="right";break}return{node:r,start:i,end:x,collapse:N,coverStart:H,coverEnd:z}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),x=i.node,N=i.start,H=i.end,z=i.collapse,X;if(x.nodeType==3){for(var re=0;re<4;re++){for(;N&&ke(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&ke(t.line.text.charAt(i.coverStart+H));)++H;if(B&&U<9&&N==0&&H==i.coverEnd-i.coverStart?X=x.parentNode.getBoundingClientRect():X=js(m(x,N,H).getClientRects(),r),X.left||X.right||N==0)break;H=N,N=N-1,z="right"}B&&U<11&&(X=Hs(e.display.measure,X))}else{N>0&&(z=r="right");var se;e.options.lineWrapping&&(se=x.getClientRects()).length>1?X=se[r=="right"?se.length-1:0]:X=x.getBoundingClientRect()}if(B&&U<9&&!N&&(!X||!X.left&&!X.right)){var xe=x.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+Ln(e.display),top:xe.top,bottom:xe.bottom}:X=ro}for(var ye=X.top-t.rect.top,De=X.bottom-t.rect.top,Me=(ye+De)/2,Be=t.view.measure.heights,He=0;He<Be.length-1&&!(Me<Be[He]);He++);var Je=He?Be[He-1]:0,Ke=Be[He],et={left:(z=="right"?X.right:X.left)-t.rect.left,right:(z=="left"?X.left:X.right)-t.rect.left,top:Je,bottom:Ke};return!X.left&&!X.right&&(et.bogus=!0),e.options.singleCursorHeightPerLine||(et.rtop=ye,et.rbottom=De),et}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!St(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ii(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return g&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return g&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ni(e.widgets[n]));return t}function Ni(e,t,n,r,i){if(!i){var x=pa(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var N=Tr(t);if(r=="local"?N+=Fi(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:so());var z=H.left+(r=="window"?0:oo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var 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 ma(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Ni(e,r,to(e,r,t.ch,i),n)}function Sr(e,t,n,r,i,x){r=r||nt(e.doc,t.line),i||(i=Cn(e,r));function N(De,Me){var Be=Or(e,i,De,Me?"right":"left",x);return Me?Be.left=Be.right:Be.right=Be.left,Ni(e,r,Be,n)}var H=Qe(r,e.doc.direction),z=t.ch,X=t.sticky;if(z>=r.text.length?(z=r.text.length,X="before"):z<=0&&(z=0,X="after"),!H)return N(X=="before"?z-1:z,X=="before");function re(De,Me,Be){var He=H[Me],Je=He.level==1;return N(Be?De-1:De,Je!=Be)}var se=Ge(H,z,X),xe=Ve,ye=re(z,se,X=="before");return xe!=null&&(ye.other=re(z,xe,X!="before")),ye}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=Ln(e.display)*t.ch);var r=nt(e.doc,t.line),i=Tr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var x=Ne(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=vr(r,n),x=r.first+r.size-1;if(i>x)return ga(r.first+r.size-1,nt(r,x).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var H=Ks(e,N,i,t,n),z=Sn(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!z)return H;var X=z.find(1);if(X.line==i)return X;N=nt(r,i=X.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,x=$e(function(N){return Or(e,n,N-1).bottom<=r},i,0);return i=$e(function(N){return Or(e,n,N).top>r},x,i),{begin:x,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Ni(e,t,Or(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=Tr(t);var x=Cn(e,t),N=pa(t),H=0,z=t.text.length,X=!0,re=Qe(t,e.doc.direction);if(re){var se=(e.options.lineWrapping?zs:Gs)(e,t,n,x,re,r,i);X=se.level!=1,H=X?se.from:se.to-1,z=X?se.to:se.from-1}var xe=null,ye=null,De=$e(function(lt){var ot=Or(e,x,lt);return ot.top+=N,ot.bottom+=N,ya(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(xe=lt,ye=ot),!0):!1},H,z),Me,Be,He=!1;if(ye){var Je=r-ye.left<ye.right-r,Ke=Je==X;De=xe+(Ke?0:1),Be=Ke?"after":"before",Me=Je?ye.left:ye.right}else{!X&&(De==z||De==H)&&De++,Be=De==0?"after":De==t.text.length?"before":Or(e,x,De-(X?1:0)).bottom+N<=i==X?"after":"before";var et=Sr(e,Ne(n,De,Be),"line",t,x);Me=et.left,He=i<et.top?-1:i>=et.bottom?1:0}return De=Oe(t.text,De,1),ga(n,De,Be,He,r-Me)}function Gs(e,t,n,r,i,x,N){var H=$e(function(se){var xe=i[se],ye=xe.level!=1;return ya(Sr(e,Ne(n,ye?xe.to:xe.from,ye?"before":"after"),"line",t,r),x,N,!0)},0,i.length-1),z=i[H];if(H>0){var X=z.level!=1,re=Sr(e,Ne(n,X?z.from:z.to,X?"after":"before"),"line",t,r);ya(re,x,N,!0)&&re.top>N&&(z=i[H-1])}return z}function zs(e,t,n,r,i,x,N){var H=co(e,t,r,N),z=H.begin,X=H.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var re=null,se=null,xe=0;xe<i.length;xe++){var ye=i[xe];if(ye.from>=X||ye.to<=z)continue;var De=ye.level!=1,Me=Or(e,r,De?Math.min(X,ye.to)-1:Math.max(z,ye.from)).right,Be=Me<x?x-Me+1e9:Me-x;(!re||se>Be)&&(re=ye,se=Be)}return re||(re=i[i.length-1]),re.from<z&&(re={from:z,to:re.to,level:re.level}),re.to>X&&(re={from:re.from,to:X,level:re.level}),re}var an;function An(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}d(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function Ln(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,N=0;x;x=x.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=x.offsetLeft+x.clientLeft+i,r[H]=x.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=An(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ln(e.display)-3);return function(i){if(Lr(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 Ea(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&Zt(r,i)})}function on(e,t,n,r){var i=e.display;if(!n&&fe(t).getAttribute("cm-not-content")=="true")return null;var x,N,H=i.lineSpace.getBoundingClientRect();try{x=t.clientX-H.left,N=t.clientY-H.top}catch(se){return null}var z=va(e,x,N),X;if(r&&z.xRel>0&&(X=nt(e.doc,z.line).text).length==z.ch){var re=K(X,X.length,e.options.tabSize)-X.length;z=Ne(z.line,Math.max(0,Math.round((x-qa(e.display).left)/Ln(e.display))-re))}return z}function sn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function tr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)$t&&Zn(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)$t&&Hr(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var x=Ui(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Ui(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var H=Ui(e,t,t,-1),z=Ui(e,n,n+r,1);H&&z?(i.view=i.view.slice(0,H.index).concat(er(e,H.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n<X.lineN?X.lineN+=r:t<X.lineN+X.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var x=r.view[sn(e,t)];if(x.node==null)return;var N=x.changes||(x.changes=[]);q(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ui(e,t,n,r){var i=sn(e,t),x,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,z=0;z<i;z++)H+=N[z].size;if(H!=t){if(r>0){if(i==N.length-1)return null;x=H+N[i].size-t,i++}else x=H-t;t+=x,n+=x}for(;Zn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(sn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(er(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function po(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ai(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(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 H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var z=H.empty();(z||e.options.showCursorWhenSelecting)&&go(e,H.head,i),z||Xs(e,H,x)}return r}function go(e,t,n){var r=Sr(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 Bi(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=qa(e.display),H=N.left,z=Math.max(r.sizerWidth,nn(e)-r.sizer.offsetLeft)-N.right,X=i.direction=="ltr";function re(Ke,et,lt,ot){et<0&&(et=0),et=Math.round(et),ot=Math.round(ot),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ke+`px;
|
|
top: `+et+"px; width: "+(lt==null?z-Ke:lt)+`px;
|
|
height: `+(ot-et)+"px"))}function se(Ke,et,lt){var ot=nt(i,Ke),pt=ot.text.length,Rt,Ht;function Pt(Ft,ir){return ma(e,Ne(Ke,Ft),"div",ot,ir)}function lr(Ft,ir,zt){var Bt=fo(e,ot,null,Ft),Nt=ir=="ltr"==(zt=="after")?"left":"right",_t=zt=="after"?Bt.begin:Bt.end-(/\s/.test(ot.text.charAt(Bt.end-1))?2:1);return Pt(_t,Nt)[Nt]}var nr=Qe(ot,i.direction);return ze(nr,et||0,lt==null?pt:lt,function(Ft,ir,zt,Bt){var Nt=zt=="ltr",_t=Pt(Ft,Nt?"left":"right"),ar=Pt(ir-1,Nt?"right":"left"),jn=et==null&&Ft==0,Qr=lt==null&&ir==pt,Yt=Bt==0,Rr=!nr||Bt==nr.length-1;if(ar.top-_t.top<=3){var Kt=(X?jn:Qr)&&Yt,Va=(X?Qr:jn)&&Rr,jr=Kt?H:(Nt?_t:ar).left,fn=Va?z:(Nt?ar:_t).right;re(jr,_t.top,fn-jr,_t.bottom)}else{var hn,Jt,Wn,Xa;Nt?(hn=X&&jn&&Yt?H:_t.left,Jt=X?z:lr(Ft,zt,"before"),Wn=X?H:lr(ir,zt,"after"),Xa=X&&Qr&&Rr?z:ar.right):(hn=X?lr(Ft,zt,"before"):H,Jt=!X&&jn&&Yt?z:_t.right,Wn=!X&&Qr&&Rr?H:ar.left,Xa=X?lr(ir,zt,"after"):z),re(hn,_t.top,Jt-hn,_t.bottom),_t.bottom<ar.top&&re(H,_t.bottom,null,ar.top),re(Wn,ar.top,Xa-Wn,ar.bottom)}(!Rt||Bi(_t,Rt)<0)&&(Rt=_t),Bi(ar,Rt)<0&&(Rt=ar),(!Ht||Bi(_t,Ht)<0)&&(Ht=_t),Bi(ar,Ht)<0&&(Ht=ar)}),{start:Rt,end:Ht}}var xe=t.from(),ye=t.to();if(xe.line==ye.line)se(xe.line,xe.ch,ye.ch);else{var De=nt(i,xe.line),Me=nt(i,ye.line),Be=dr(De)==dr(Me),He=se(xe.line,xe.ch,Be?De.text.length+1:null).end,Je=se(ye.line,Be?0:null,ye.ch).start;Be&&(He.top<Je.top-2?(re(He.right,He.top,null,He.bottom),re(H,Je.top,Je.left,Je.bottom)):re(He.right,He.top,Je.left-He.right,He.bottom)),He.bottom<Je.top&&re(H,He.bottom,null,Je.top)}n.appendChild(x)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Dn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Dn(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),_&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Dn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],x=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(B&&U<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var X=i.node.getBoundingClientRect();N=X.bottom-X.top,!x&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-X.left-1)}var re=i.line.height-N;if((re>.005||re<-.005)&&(Zt(i.line,N),bo(i.line),i.rest))for(var se=0;se<i.rest.length;se++)bo(i.rest[se]);if(H>e.display.sizerWidth){var xe=Math.ceil(H/Ln(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Wi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,x=vr(t,r),N=vr(t,i);if(n&&n.ensure){var H=n.ensure.from.line,z=n.ensure.to.line;H<x?(x=H,N=vr(t,Tr(nt(t,H))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(x=vr(t,Tr(nt(t,z))-e.wrapper.clientHeight),N=z)}return{from:x,to:Math.max(N,x+1)}}function Ys(e,t){if(_e(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&&!w){var x=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Dr(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?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var N=!1,H=Sr(e,t),z=!n||n==t?H:Sr(e,n);i={left:Math.min(H.left,z.left),top:Math.min(H.top,z.top)-r,right:Math.max(H.left,z.left),bottom:Math.max(H.bottom,z.bottom)+r};var X=wa(e,i),re=e.doc.scrollTop,se=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(N=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-se)>1&&(N=!0)),!N)break}return i}function Qs(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=An(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=fa(e),N={};t.bottom-t.top>x&&(t.bottom=t.top+x);var H=e.doc.height+ca(n),z=t.top<r,X=t.bottom>H-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+x){var re=Math.min(t.top,(X?H:t.bottom)-x);re!=i&&(N.scrollTop=re)}var se=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-se,ye=nn(e)-n.gutters.offsetWidth,De=t.right-t.left>ye;return De&&(t.right=t.left+ye),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+se-(De?0:10)):t.right>ye+xe-3&&(N.scrollLeft=t.right+(De?0:10)-ye),N}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function On(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);xo(e,n,r,t.margin)}}function xo(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),Eo(e,t,!0),L&&La(e),di(e,100)}function Eo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ln(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Dr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ce(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ce(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var 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}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=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 Y,this.disableVert=new Y},un.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)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function Rn(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ce(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function dn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&ks(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&&Ii(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Dr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ln(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Rn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Eo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ln(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var x=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(x)for(var H=0;H<x.length;++H)x[H].lines.length||Le(x[H],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Le(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function sr(e,t){if(e.curOp)return t();dn(e);try{return t()}finally{cn(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);dn(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function Qt(e){return function(){if(this.curOp)return e.apply(this,arguments);dn(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);dn(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function di(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,k(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=yr(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,H=x.text.length>e.options.maxHighlightLength?Ar(t.mode,r.state):null,z=zn(e,x,r,!0);H&&(r.state=H),x.styles=z.styles;var X=x.styleClasses,re=z.classes;re?x.styleClasses=re:X&&(x.styleClasses=null);for(var se=!N||N.length!=x.styles.length||X!=re&&(!X||!re||X.bgClass!=re.bgClass||X.textClass!=re.textClass),xe=0;!se&&xe<N.length;++xe)se=N[xe]!=x.styles[xe];se&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&Vn(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&sr(e,function(){for(var x=0;x<i.length;x++)Kr(e,i[x],"text")})}var Ki=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Wi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nn(e),this.force=n,this.dims=ba(e),this.events=[]};Ki.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Ki.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Le.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Dr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Dr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!b(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&b(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&po(e)==0)return!1;Lo(e)&&(Gr(e),t.dims=ba(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)),$t&&(x=Zn(e.doc,x),N=Hr(e.doc,N));var H=x!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,x,N),n.viewOffset=Tr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=po(e);if(!H&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!Aa(e,t))break;ji(e);var i=li(e);ai(e),Rn(e,i),Oa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var n=new Ki(e,t);if(Aa(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),Rn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,N=x.firstChild;function H(De){var Me=De.nextSibling;return _&&s&&e.display.currentWheelTarget==De?De.style.display="none":De.parentNode.removeChild(De),Me}for(var z=r.view,X=r.viewFrom,re=0;re<z.length;re++){var se=z[re];if(!se.hidden)if(!se.node||se.node.parentNode!=x){var xe=Fs(e,se,X,n);x.insertBefore(xe,N)}else{for(;N!=se.node;)N=H(N);var ye=i&&t!=null&&t<=X&&se.lineNumber;se.changes&&(q(se.changes,"gutter")>-1&&(ye=!1),Ya(e,se,X,n)),ye&&(f(se.lineNumber),se.lineNumber.appendChild(document.createTextNode(mn(e.options,X)))),N=se.node.nextSibling}X+=se.size}for(;N;)N=H(N)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Dr(e)+"px"}function Ao(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,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 H=n[N].alignable;if(H)for(var z=0;z<H.length;z++)H[z].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=mn(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",Da(e.display),!0}return!1}function Ra(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 Do(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],x=i.className,N=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+x));N&&(H.style.cssText=N),x=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ci(e){Do(e.display),tr(e),Ao(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=v("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: "+ie+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!_&&!(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=Ra(r.gutters,r.lineNumbers),Do(i),n.init(i)}var Gi=0,cr=null;B?cr=-.53:L?cr=15:g?cr=-.7:R&&(cr=-1/3);function Oo(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=Oo(e);return t.x*=cr,t.y*=cr,t}function Ro(e,t){var n=Oo(t),r=n.x,i=n.y,x=e.display,N=x.scroller,H=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&z))return;if(i&&s&&_){e:for(var X=t.target,re=x.view;X!=N;X=X.parentNode)for(var se=0;se<re.length;se++)if(re[se].node==X){e.display.currentWheelTarget=X;break e}}if(r&&!L&&!T&&cr!=null){i&&z&&si(e,Math.max(0,N.scrollTop+i*cr)),ln(e,Math.max(0,N.scrollLeft+r*cr)),(!i||i&&z)&&$(t),x.wheelStartX=null;return}if(i&&cr!=null){var xe=i*cr,ye=e.doc.scrollTop,De=ye+x.wrapper.clientHeight;xe<0?ye=Math.max(0,ye+xe-50):De=Math.min(e.doc.height,De+xe+50),La(e,{top:ye,bottom:De})}Gi<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 Me=N.scrollLeft-x.wheelStartX,Be=N.scrollTop-x.wheelStartY,He=Be&&x.wheelDY&&Be/x.wheelDY||Me&&x.wheelDX&&Me/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!He)return;cr=(cr*Gi+He)/(Gi+1),++Gi},200)):(x.wheelDX+=r,x.wheelDY+=i))}var fr=function(e,t){this.ranges=e,this.primIndex=t};fr.prototype.primary=function(){return this.ranges[this.primIndex]},fr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Gn(n.anchor,r.anchor)||!Gn(n.head,r.head))return!1}return!0},fr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new At(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new fr(e,this.primIndex)},fr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},fr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(dt(t,r.from())>=0&&dt(e,r.to())<=0)return n}return-1};var At=function(e,t){this.anchor=e,this.head=t};At.prototype.from=function(){return Jr(this.anchor,this.head)},At.prototype.to=function(){return vn(this.anchor,this.head)},At.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function wr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ye){return dt(xe.from(),ye.from())}),n=q(t,i);for(var x=1;x<t.length;x++){var N=t[x],H=t[x-1],z=dt(H.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var X=Jr(H.from(),N.from()),re=vn(H.to(),N.to()),se=H.empty()?N.from()==N.head:H.from()==H.head;x<=n&&--n,t.splice(--x,2,new At(se?re:X,se?X:re))}}return new fr(t,n)}function zr(e,t){return new fr([new At(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,Q(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Ne(n,r)}function ka(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new At(ko(i.anchor,t),ko(i.head,t)))}return wr(e.cm,n,e.sel.primIndex)}function Po(e,t,n){return e.line==t.line?Ne(n.line,e.ch-t.ch+n.ch):Ne(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ne(e.first,0),x=i,N=0;N<t.length;N++){var H=t[N],z=Po(H.from,i,x),X=Po(Vr(H),i,x);if(i=H.to,x=X,n=="around"){var re=e.sel.ranges[N],se=dt(re.head,re.anchor)<0;r[N]=new At(se?X:z,se?z:X)}else r[N]=new At(z,z)}return new fr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=gr(e.options,e.doc.modeOption),fi(e)}function fi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,di(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Mo(e,t){return t.from.ch==0&&t.to.ch==0&&Q(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(Je){return n?n[Je]:null}function x(Je,Ke,et){ua(Je,Ke,et,r),Gt(Je,"change",Je,t)}function N(Je,Ke){for(var et=[],lt=Je;lt<Ke;++lt)et.push(new rn(X[lt],i(lt),r));return et}var H=t.from,z=t.to,X=t.text,re=nt(e,H.line),se=nt(e,z.line),xe=Q(X),ye=i(X.length-1),De=z.line-H.line;if(t.full)e.insert(0,N(0,X.length)),e.remove(X.length,e.size-X.length);else if(Mo(e,t)){var Me=N(0,X.length-1);x(se,se.text,ye),De&&e.remove(H.line,De),Me.length&&e.insert(H.line,Me)}else if(re==se)if(X.length==1)x(re,re.text.slice(0,H.ch)+xe+re.text.slice(z.ch),ye);else{var Be=N(1,X.length-1);Be.push(new rn(xe+re.text.slice(z.ch),ye,r)),x(re,re.text.slice(0,H.ch)+X[0],i(0)),e.insert(H.line+1,Be)}else if(X.length==1)x(re,re.text.slice(0,H.ch)+X[0]+se.text.slice(z.ch),i(0)),e.remove(H.line+1,De);else{x(re,re.text.slice(0,H.ch)+X[0],i(0)),x(se,xe+se.text.slice(z.ch),ye);var He=N(1,X.length-1);De>1&&e.remove(H.line+1,De-1),e.insert(H.line+1,He)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,x,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var z=i.linked[H];if(z.doc==x)continue;var X=N&&z.sharedHist;if(n&&!X)continue;t(z.doc,X),r(z.doc,i,X)}}r(e,null,!0)}function _o(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Pa(e),Io(e),e.options.lineWrapping||Ii(e),e.options.mode=t.modeOption,tr(e)}function Io(e){(e.doc.direction=="rtl"?F:c)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){sr(e,function(){Io(e),tr(e)})}function zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function _a(e,t){var n={from:gn(t.from),to:Vr(t),text:Pr(e,t.from,t.to)};return Uo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Uo(r,n,t.from.line,t.to.line+1)},!0),n}function Fo(e){for(;e.length;){var t=Q(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(e.done),Q(e.done);if(e.done.length&&!Q(e.done).ranges)return Q(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Q(e.done)}function No(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,N,H;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=pl(i,i.lastOp==r)))H=Q(N.changes),dt(t.from,t.to)==0&&dt(t.from,H.to)==0?H.to=Vr(t):N.changes.push(_a(e,t));else{var z=Q(i.done);for((!z||!z.ranges)&&Vi(e.sel,i.done),N={changes:[_a(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,H||Le(e,"historyAdded")}function ml(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||ml(e,x,Q(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&Fo(i.undone)}function Vi(e,t){var n=Q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Uo(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 Bo(e,t){var n=yl(e,t),r=xn(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 H=0;H<N.length;++H){for(var z=N[H],X=0;X<x.length;++X)if(x[X].marker==z.marker)continue e;x.push(z)}}else N&&(n[i]=N)}return n}function kn(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?fr.prototype.deepCopy.call(x):x);continue}var N=x.changes,H=[];r.push({changes:H});for(var z=0;z<N.length;++z){var X=N[z],re=void 0;if(H.push({from:X.from,to:X.to,text:X.text}),t)for(var se in X)(re=se.match(/^spans_(\d+)$/))&&(q(t,Number(re[1]))>-1&&(Q(H)[se]=X[se],delete X[se]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var x=dt(t,i)<0;x!=dt(n,i)<0?(i=t,t=n):x!=dt(t,n)<0&&(t=n)}return new At(i,t)}else return new At(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new fr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=Ia(e.sel.ranges[x],t[x],null,i);var N=wr(e.cm,r,e.sel.primIndex);Xt(e,N,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xt(e,wr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Xt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new At(ht(e,i[x].anchor),ht(e,i[x].head))},origin:n&&n.origin};return Le(e,"beforeSelectionChange",e,r),e.cm&&Le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?wr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=Q(r);i&&i.ranges?(r[r.length-1]=t,Yi(e,t,n)):Xt(e,t,n)}function Xt(e,t,n){Yi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Yi(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&On(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,pe(e.cm)),Gt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var N=t.ranges[x],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],z=$i(e,N.anchor,H&&H.anchor,n,r),X=$i(e,N.head,H&&H.head,n,r);(i||z!=N.anchor||X!=N.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new At(z,X))}return i?wr(e.cm,i,t.primIndex):t}function Pn(e,t,n,r,i){var x=nt(e,t.line);if(x.markedSpans)for(var N=0;N<x.markedSpans.length;++N){var H=x.markedSpans[N],z=H.marker,X="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,re="selectRight"in z?!z.selectRight:z.inclusiveRight;if((H.from==null||(X?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(re?H.to>=t.ch:H.to>t.ch))){if(i&&(Le(z,"beforeCursorEnter"),z.explicitlyCleared))if(x.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var se=z.find(r<0?1:-1),xe=void 0;if((r<0?re:X)&&(se=Vo(e,se,-r,se&&se.line==t.line?x:null)),se&&se.line==t.line&&(xe=dt(se,n))&&(r<0?xe<0:xe>0))return Pn(e,se,t,r,i)}var ye=z.find(r<0?-1:1);return(r<0?X:re)&&(ye=Vo(e,ye,r,ye.line==t.line?x:null)),ye?Pn(e,ye,t,r,i):null}}return t}function $i(e,t,n,r,i){var x=r||1,N=Pn(e,t,n,x,i)||!i&&Pn(e,t,n,x,!0)||Pn(e,t,n,-x,i)||!i&&Pn(e,t,n,-x,!0);return N||(e.cantEdit=!0,Ne(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Ne(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+n)}function Xo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),ve)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,x,N,H){i&&(r.from=ht(e,i)),x&&(r.to=ht(e,x)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),Le(e,"beforeChange",e,r),e.cm&&Le(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Mn(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,Mn)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Qn&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=ka(e,t);No(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,xn(e,t));var r=[];Xr(e,function(i,x){!x&&q(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,xn(i,t))})}function Qi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,N=e.sel,H=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,X=0;X<H.length&&!(x=H[X],n?x.ranges&&!x.equals(e.sel):!x.ranges);X++);if(X==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=H.pop(),x.ranges){if(Vi(x,z),n&&!x.equals(e.sel)){Xt(e,x,{clearRedo:!1});return}N=x}else if(r){H.push(x);return}else break;var re=[];Vi(N,z),z.push({changes:re,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var se=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),xe=function(Me){var Be=x.changes[Me];if(Be.origin=t,se&&!Yo(e,Be,!1))return H.length=0,{};re.push(_a(e,Be));var He=Me?ka(e,Be):Q(H);hi(e,Be,He,Bo(e,Be)),!Me&&e.cm&&e.cm.scrollIntoView({from:Be.from,to:Vr(Be)});var Je=[];Xr(e,function(Ke,et){!et&&q(Je,Ke.history)==-1&&(qo(Ke.history,Be),Je.push(Ke.history)),hi(Ke,Be,null,Bo(Ke,Be))})},ye=x.changes.length-1;ye>=0;--ye){var De=xe(ye);if(De)return De.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new fr(ne(e.sel.ranges,function(i){return new At(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function hi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,hi)(e,t,n,r);if(t.to.line<e.first){Qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Qo(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[Q(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Ne(x,nt(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=ka(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,i=e.display,x=t.from,N=t.to,H=!1,z=x.line;e.options.lineWrapping||(z=wt(dr(nt(r,x.line))),r.iter(z,N.line+1,function(ye){if(ye==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&pe(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(z,x.line+t.text.length,function(ye){var De=ei(ye);De>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=De,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),aa(r,x.line),di(e,400);var X=t.text.length-(N.line-x.line)-1;t.full?tr(e):x.line==N.line&&t.text.length==1&&!Mo(e.doc,t)?Kr(e,x.line,"text"):tr(e,x.line,N.line+1,X);var re=le(e,"changes"),se=le(e,"change");if(se||re){var xe={from:x,to:N,text:t.text,removed:t.removed,origin:t.origin};se&&Gt(e,"change",e,xe),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function _n(e,t,n,r,i){var x;r||(r=n),dt(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),Mn(e,{from:n,to:r,text:t,origin:i})}function Jo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(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 H=0;H<x.ranges.length;H++)Jo(x.ranges[H].anchor,t,n,r),Jo(x.ranges[H].head,t,n,r);continue}for(var z=0;z<x.changes.length;++z){var X=x.changes[z];if(n<X.from.line)X.from=Ne(X.from.line+r,X.from.ch),X.to=Ne(X.to.line+r,X.to.ch);else if(t<=X.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function pi(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=nt(e,yn(e,t)):i=wt(t),i==null?null:(r(x,i)&&e.cm&&Kr(e.cm,i,n),x)}function mi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}mi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,it(i),Gt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function gi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}gi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var 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 mi))){var H=[];this.collapse(H),this.children=[new mi(H)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],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,H=N;H<i.lines.length;){var z=new mi(i.lines.slice(H,H+=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 gi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new gi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],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 vi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=wt(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=ni(this);Zt(n,Math.max(0,n.height-x)),e&&(sr(e,function(){es(e,n,-x),Kr(e,r,"widget")}),Gt(e,"lineWidgetCleared",e,this,r))},vi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ni(this)-t;if(!i)return;Lr(this.doc,r)||Zt(r,r.height+i),n&&sr(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Gt(n,"lineWidgetChanged",n,e,wt(r))})},ue(vi);function es(e,t,n){Tr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function El(e,t,n,r){var i=new vi(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),pi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,x&&!Lr(e,N)){var z=Tr(N)<e.scrollTop;Zt(N,N.height+ni(i)),z&&Ca(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&Gt(x,"lineWidgetAdded",x,i,typeof t=="number"?t:wt(t)),i}var ts=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&dn(e),le(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var N=this.lines[x],H=Er(N.markedSpans,this);e&&!this.collapsed?Kr(e,wt(N),"text"):e&&(H.to!=null&&(i=wt(N)),H.from!=null&&(r=wt(N))),N.markedSpans=Jn(N.markedSpans,H),H.from==null&&this.collapsed&&!Lr(this.doc,N)&&e&&Zt(N,An(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var X=dr(this.lines[z]),re=ei(X);re>e.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],N=Er(x.markedSpans,this);if(N.from!=null&&(n=Ne(t?x:wt(x),N.from),e==-1))return n;if(N.to!=null&&(r=Ne(t?x:wt(x),N.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;sr(r,function(){var i=t.line,x=wt(t.line),N=ha(r,x);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Lr(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var z=ni(n)-H;z&&Zt(i,i.height+z)}Gt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Yr);function In(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jt(e.cm,In)(e,t,n,r,i);var x=new Yr(e,i),N=dt(t,n);if(r&&O(r,x,!1),N>0||N==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=v("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(Mi(e,t.line,t,n,x)||t.line!=n.line&&Mi(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}x.addToHistory&&No(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,z=e.cm,X;if(e.iter(H,n.line+1,function(se){z&&x.collapsed&&!z.options.lineWrapping&&dr(se)==z.display.maxLine&&(X=!0),x.collapsed&&H!=t.line&&Zt(se,0),sa(se,new qr(x,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),x.collapsed&&e.iter(t.line,n.line+1,function(se){Lr(e,se)&&Zt(se,0)}),x.clearOnEnter&&Ce(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++ts,x.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),x.collapsed)tr(z,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var re=t.line;re<=n.line;re++)Kr(z,re,"text");x.atomic&&Go(z.doc),Gt(z,"markerAdded",z,x)}return x}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};yi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Gt(this,"clear")},yi.prototype.find=function(e,t){return this.primary.find(e,t)},ue(yi);function Tl(e,t,n,r,i){r=O(r),r.shared=!1;var x=[In(e,t,n,r,i)],N=x[0],H=r.widgetNode;return Xr(e,function(z){H&&(r.widgetNode=H.cloneNode(!0)),x.push(In(z,ht(z,t),ht(z,n),r,i));for(var X=0;X<z.linked.length;++X)if(z.linked[X].isParent)return;N=Q(x)}),new yi(x,N)}function rs(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),x=e.clipPos(i.from),N=e.clipPos(i.to);if(dt(x,N)){var H=In(e,x,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];Xr(i.primary.doc,function(z){return x.push(z)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];q(x,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),gi.call(this,[new mi([new rn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Ne(n,0);this.sel=zr(x),this.history=new zi(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:x,to:x,text:e}),Xt(this,zr(x),ve)};rr.prototype=Ae(gi.prototype,{constructor:rr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=pn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;Mn(this,{from:t,to:Ne(n,nt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oi(this.cm,0,0),Xt(this,zr(t),ve)}),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,_n(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(this,ht(this,e),ht(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Mr(this,e))return nt(this,e)},getLineNumber:function(e){return wt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(this,e)),dr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wt(function(e,t,n){Wo(this,ht(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Wo(this,ht(this,e),ht(this,t||e),n)}),extendSelection:Wt(function(e,t,n){Xi(this,ht(this,e),t&&ht(this,t),n)}),extendSelections:Wt(function(e,t){jo(this,Ue(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);jo(this,Ue(this,n),t)}),setSelections:Wt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new At(ht(this,e[i].anchor),ht(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xt(this,wr(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new At(ht(this,e),ht(this,t||e))),Xt(this,wr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Pr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Pr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Wt(function(e,t,n){for(var r=[],i=this.sel,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 H=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Mn(this,r[z]);H?Ho(this,H):this.cm&&On(this.cm)}),undo:Wt(function(){Qi(this,"undo")}),redo:Wt(function(){Qi(this,"redo")}),undoSelection:Wt(function(){Qi(this,"undo",!0)}),redoSelection:Wt(function(){Qi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new zi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:kn(this.history.done),undone:kn(this.history.undone)}},setHistory:function(e){var t=this.history=new zi(this.history.maxGeneration);t.done=kn(e.done.slice(0),null,!0),t.undone=kn(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return pi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Fe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&pi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Fe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mr(this,e))return null;if(t=e,e=nt(this,e),!e)return null}else if(t=wt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Wt(function(e,t,n){return pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(y(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Wt(function(e,t,n){return pi(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(y(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=x.slice(0,N.index)+(!N.index||H==x.length?"":" ")+x.slice(H)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return In(this,ht(this,e),ht(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ht(this,e),In(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=nt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(x){var N=x.markedSpans;if(N)for(var H=0;H<N.length;H++){var z=N[H];!(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}),ht(this,Ne(n,t))},indexFromPos:function(e){e=ht(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(pn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(pn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof kt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(rs(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new zi(null),e.history.done=kn(this.history.done,r),e.history.undone=kn(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ut(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Wt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var ns=0;function Al(e){var t=this;if(is(t),_e(t,e)||Ur(t.display,e))return;$(e),B&&(ns=+new Date);var n=on(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,x=Array(i),N=0,H=function(){++N==i&&jt(t,function(){n=ht(t.doc,n);var ye={from:n,to:n,text:t.doc.splitLines(x.filter(function(De){return De!=null}).join(t.doc.lineSeparator())),origin:"paste"};Mn(t.doc,ye),Ho(t.doc,zr(ht(t.doc,n),ht(t.doc,Vr(ye))))})()},z=function(ye,De){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,ye.type)==-1){H();return}var Me=new FileReader;Me.onerror=function(){return H()},Me.onload=function(){var Be=Me.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Be)){H();return}x[De]=Be,H()},Me.readAsText(ye)},X=0;X<r.length;X++)z(r[X],X);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var re=e.dataTransfer.getData("Text");if(re){var se;if(t.state.draggingText&&!t.state.draggingText.copy&&(se=t.listSelections()),Yi(t.doc,zr(n,n)),se)for(var xe=0;xe<se.length;++xe)_n(t.doc,"",se[xe].anchor,se[xe].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(ye){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){oe(t);return}if(_e(e,t)||Ur(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),T&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=on(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var x=0;x<n.length;x++)e(n[x])})}var os=!1;function Ol(){if(os)return;Rl(),os=!0}function Rl(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(kl)},100))}),Ce(window,"blur",function(){return as(Dn)})}function kl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},bi=0;bi<10;bi++)$r[bi+48]=$r[bi+96]=String(bi);for(var Ji=65;Ji<=90;Ji++)$r[Ji]=String.fromCharCode(Ji);for(var xi=1;xi<=12;xi++)$r[xi+111]=$r[xi+63235]="F"+xi;var Br={};Br.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Br.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Br.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Br.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Br.default=s?Br.macDefault:Br.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))x=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ne(n.split(" "),Pl),x=0;x<i.length;x++){var N=void 0,H=void 0;x==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,x+1).join(" "),N="...");var z=t[H];if(!z)t[H]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var X in t)e[X]=t[X];return e}function Fn(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 Fn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var N=Fn(e,t.fallthrough[x],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(T&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function Zi(e){return typeof e=="string"?Br[e]:e}function Nn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&dt(x.from,Q(r).to)<=0;){var N=r.pop();if(dt(N.from,x.from)<0){x.from=N.from;break}}r.push(x)}sr(e,function(){for(var H=r.length-1;H>=0;H--)_n(e.doc,"",r[H].from,r[H].to,"+delete");On(e)})}function Na(e,t,n){var r=Oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ua(e,t,n){var r=Na(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=Qe(n,t.doc.direction);if(x){var N=i<0?Q(x):x[0],H=i<0==(N.level==1),z=H?"after":"before",X;if(N.level>0||t.doc.direction=="rtl"){var re=Cn(t,n);X=i<0?n.text.length-1:0;var se=Or(t,re,X).top;X=$e(function(xe){return Or(t,re,xe).top==se},i<0==(N.level==1)?N.from:N.to-1,X),z=="before"&&(X=Na(n,X,1))}else X=i<0?N.to:N.from;return new Ne(r,X,z)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function _l(e,t,n,r){var i=Qe(t,e.doc.direction);if(!i)return Ua(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=Ge(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 Ua(t,n,r);var H=function(He,Je){return Na(t,He instanceof Ne?He.ch:He,Je)},z,X=function(He){return e.options.lineWrapping?(z=z||Cn(e,t),fo(e,t,z,He)):{begin:0,end:t.text.length}},re=X(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var se=N.level==1==r<0,xe=H(n,se?1:-1);if(xe!=null&&(se?xe<=N.to&&xe<=re.end:xe>=N.from&&xe>=re.begin)){var ye=se?"before":"after";return new Ne(n.line,xe,ye)}}var De=function(He,Je,Ke){for(var et=function(Rt,Ht){return Ht?new Ne(n.line,H(Rt,1),"before"):new Ne(n.line,Rt,"after")};He>=0&&He<i.length;He+=Je){var lt=i[He],ot=Je>0==(lt.level!=1),pt=ot?Ke.begin:H(Ke.end,-1);if(lt.from<=pt&&pt<lt.to)return et(pt,ot);if(pt=ot?lt.from:H(lt.to,-1),Ke.begin<=pt&&pt<Ke.end)return et(pt,ot)}},Me=De(x+r,r,re);if(Me)return Me;var Be=r>0?re.end:H(re.begin,-1);return Be!=null&&!(r>0&&Be==t.text.length)&&(Me=De(r>0?0:i.length-1,r,X(Be)),Me)?Me:null}var Ei={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Nn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Nn(e,function(t){return{from:Ne(t.from().line,0),to:ht(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Nn(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Nn(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 Nn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},he)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},he)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},he)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var x=n[i].from(),N=K(e.getLine(x.line),x.ch,r);t.push(me(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return sr(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=nt(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=nt(e.doc,i.line-1).text;N&&(i=new Ne(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ne(i.line-1,N.length-1),i,"+transpose"))}}n.push(new At(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return sr(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);On(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=nt(e.doc,t),r=dr(n);return r!=n&&(t=wt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=nt(e.doc,t),r=_i(n);return r!=n&&(t=wt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=nt(e.doc,n.line),i=Qe(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 Ne(n.line,N?0:x,n.sticky)}return n}function qi(e,t,n){if(typeof t=="string"&&(t=Ei[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Te}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=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Nl=new Y;function Ti(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ti(e,"Shift-"+n,t,function(r){return qi(e,r,!0)})||Ti(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return qi(e,r)}):Ti(e,n,t,function(r){return qi(e,r)}):!1}function Ul(e,t,n){return Ti(e,"'"+n+"'",t,function(r){return qi(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),_e(t,e))return;B&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);T&&(ja=r?n:null,!r&&n==88&&!Et&&(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;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),Xe(document,"keyup",n),Xe(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),_e(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Ur(t.display,e)||_e(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(T&&n==ja){ja=null,$(e);return}if(T&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Ul(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(_e(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Ur(n,e)){_||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=we(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):fe(e)==n.scroller&&$(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):yo(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,Ti(e,ls(x,i),i,function(N){if(typeof N=="string"&&(N=Ei[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var 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(k(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),x=e.doc.sel,N;e.options.dragDrop&&Pe&&!e.isReadOnly()&&n=="single"&&(N=x.contains(t))>-1&&(dt((N=x.ranges[N]).from(),t)<0||t.xRel>0)&&(dt(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=jt(e,function(X){_&&(i.scroller.draggable=!1),e.state.draggingText=!1,Xe(i.wrapper.ownerDocument,"mouseup",N),Xe(i.wrapper.ownerDocument,"mousemove",H),Xe(i.scroller,"dragstart",z),Xe(i.scroller,"drop",N),x||($(X),r.addNew||Xi(e.doc,n,null,null,r.extend),_&&!R||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(X){x=x||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.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(),Ce(i.wrapper.ownerDocument,"mouseup",N),Ce(i.wrapper.ownerDocument,"mousemove",H),Ce(i.scroller,"dragstart",z),Ce(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new At(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new At(Ne(t.line,0),ht(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new At(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,x=e.doc;$(t);var N,H,z=x.sel,X=z.ranges;if(r.addNew&&!r.extend?(H=x.sel.contains(n),H>-1?N=X[H]:N=new At(n,n)):(N=x.sel.primary(),H=x.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new At(n,n)),n=on(e,t,!0,!0),H=-1;else{var re=ys(e,n,r.unit);r.extend?N=Ia(N,re.anchor,re.head,r.extend):N=re}r.addNew?H==-1?(H=X.length,Xt(x,wr(e,X.concat([N]),H),{scroll:!1,origin:"*mouse"})):X.length>1&&X[H].empty()&&r.unit=="char"&&!r.extend?(Xt(x,wr(e,X.slice(0,H).concat(X.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),z=x.sel):Fa(x,H,N,ge):(H=0,Xt(x,new fr([N],0),ge),z=x.sel);var se=n;function xe(Ke){if(dt(se,Ke)==0)return;if(se=Ke,r.unit=="rectangle"){for(var et=[],lt=e.options.tabSize,ot=K(nt(x,n.line).text,n.ch,lt),pt=K(nt(x,Ke.line).text,Ke.ch,lt),Rt=Math.min(ot,pt),Ht=Math.max(ot,pt),Pt=Math.min(n.line,Ke.line),lr=Math.min(e.lastLine(),Math.max(n.line,Ke.line));Pt<=lr;Pt++){var nr=nt(x,Pt).text,Ft=ce(nr,Rt,lt);Rt==Ht?et.push(new At(Ne(Pt,Ft),Ne(Pt,Ft))):nr.length>Ft&&et.push(new At(Ne(Pt,Ft),Ne(Pt,ce(nr,Ht,lt))))}et.length||et.push(new At(n,n)),Xt(x,wr(e,z.ranges.slice(0,H).concat(et),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ke)}else{var ir=N,zt=ys(e,Ke,r.unit),Bt=ir.anchor,Nt;dt(zt.anchor,Bt)>0?(Nt=zt.head,Bt=Jr(ir.from(),zt.anchor)):(Nt=zt.anchor,Bt=vn(ir.to(),zt.head));var _t=z.ranges.slice(0);_t[H]=Xl(e,new At(ht(x,Bt),Nt)),Xt(x,wr(e,_t,H),ge)}}var ye=i.wrapper.getBoundingClientRect(),De=0;function Me(Ke){var et=++De,lt=on(e,Ke,!0,r.unit=="rectangle");if(!lt)return;if(dt(lt,se)!=0){e.curOp.focus=M(),xe(lt);var ot=Wi(i,x);(lt.line>=ot.to||lt.line<ot.from)&&setTimeout(jt(e,function(){De==et&&Me(Ke)}),150)}else{var pt=Ke.clientY<ye.top?-20:Ke.clientY>ye.bottom?20:0;pt&&setTimeout(jt(e,function(){if(De!=et)return;i.scroller.scrollTop+=pt,Me(Ke)}),50)}}function Be(Ke){e.state.selectingText=!1,De=Infinity,Ke&&($(Ke),i.input.focus()),Xe(i.wrapper.ownerDocument,"mousemove",He),Xe(i.wrapper.ownerDocument,"mouseup",Je),x.history.lastSelOrigin=null}var He=jt(e,function(Ke){Ke.buttons===0||!we(Ke)?Be(Ke):Me(Ke)}),Je=jt(e,Be);e.state.selectingText=Je,Ce(i.wrapper.ownerDocument,"mousemove",He),Ce(i.wrapper.ownerDocument,"mouseup",Je)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var x=Qe(i);if(!x)return t;var N=Ge(x,n.ch,n.sticky),H=x[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var z=N+(H.from==n.ch==(H.level!=1)?0:1);if(z==0||z==x.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=Ge(x,r.ch,r.sticky),se=re-N||(r.ch-n.ch)*(H.level==1?-1:1);re==z-1||re==z?X=se<0:X=se>0}var xe=x[z+(X?-1:0)],ye=X==(xe.level==1),De=ye?xe.from:xe.to,Me=ye?"after":"before";return n.ch==De&&n.sticky==Me?t:new At(new Ne(n.line,De,Me),r)}function bs(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,H=N.lineDiv.getBoundingClientRect();if(x>H.bottom||!le(e,n))return ee(t);x-=H.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var X=N.gutters.childNodes[z];if(X&&X.getBoundingClientRect().right>=i){var re=vr(e.doc,x),se=e.display.gutterSpecs[z];return Le(e,n,e,re,se.className,t),ee(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(Ur(e.display,t)||Yl(e,t))return;if(_e(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Un={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,x,N){e.defaults[r]=i,x&&(t[r]=N?function(H,z,X){X!=Un&&x(H,z,X)}:x)}e.defineOption=n,e.Init=Un,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],N=r.doc.first;r.doc.iter(function(z){for(var X=0;;){var re=z.text.indexOf(i,X);if(re==-1)break;X=re+i.length,x.push(Ne(N,re))}N++});for(var H=x.length-1;H>=0;H--)_n(r.doc,i,x[H],Ne(x[H].line,x[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=Un&&r.refresh()}),n("specialCharPlaceholder",Ot,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",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Es(r),ci(r)},!0),n("keyMap","default",function(r,i,x){var N=Zi(i),H=x!=Un&&Zi(x);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rn(r)},!0),n("scrollbarStyle","native",function(r){wo(r),Rn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Dn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,fi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Un;if(!t!=!r){var i=e.display.dragFunctions,x=t?Ce:Xe;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 Jl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),Ea(e),tr(e),ii(e),setTimeout(function(){return Rn(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?O(t):{},O(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new kt.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&x.input.focus(),B&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),dn(this),this.curOp.forceUpdate=!0,_o(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Dn(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Un);Lo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ka.length;++H)Ka[H](this);cn(this),_&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}kt.defaults=Ts,kt.optionHandlers=ea;function Zl(e){var t=e.display;Ce(t.scroller,"mousedown",jt(e,vs)),B&&U<11?Ce(t.scroller,"dblclick",jt(e,function(z){if(_e(e,z))return;var X=on(e,z);if(!X||Ha(e,z)||Ur(e.display,z))return;$(z);var re=e.findWordAt(X);Xi(e.doc,re.anchor,re.head)})):Ce(t.scroller,"dblclick",function(z){return _e(e,z)||$(z)}),Ce(t.scroller,"contextmenu",function(z){return xs(e,z)}),Ce(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||xs(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 X=z.touches[0];return X.radiusX<=1&&X.radiusY<=1}function N(z,X){if(X.left==null)return!0;var re=X.left-z.left,se=X.top-z.top;return re*re+se*se>20*20}Ce(t.scroller,"touchstart",function(z){if(!_e(e,z)&&!x(z)&&!Ha(e,z)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!Ur(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var re=e.coordsChar(t.activeTouch,"page"),se;!X.prev||N(X,X.prev)?se=new At(re,re):!X.prev.prev||N(X,X.prev.prev)?se=e.findWordAt(re):se=new At(Ne(re.line,0),ht(e.doc,Ne(re.line+1,0))),e.setSelection(se.anchor,se.head),e.focus(),$(z)}i()}),Ce(t.scroller,"touchcancel",i),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(z){return Ro(e,z)}),Ce(t.scroller,"DOMMouseScroll",function(z){return Ro(e,z)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){_e(e,z)||oe(z)},over:function(z){_e(e,z)||(Dl(e,z),oe(z))},start:function(z){return Ll(e,z)},drop:jt(e,Al),leave:function(z){_e(e,z)||is(e)}};var H=t.input.getField();Ce(H,"keyup",function(z){return ms.call(e,z)}),Ce(H,"keydown",jt(e,ps)),Ce(H,"keypress",jt(e,gs)),Ce(H,"focus",function(z){return Sa(e,z)}),Ce(H,"blur",function(z){return Dn(e,z)})}var Ka=[];kt.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=yr(e,t).state:n="prev");var N=e.options.tabSize,H=nt(i,t),z=K(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var X=H.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(H.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(x,H.text.slice(X.length),H.text),re==Te||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=K(nt(i,t-1).text,null,N):re=0:n=="add"?re=z+e.options.indentUnit:n=="subtract"?re=z-e.options.indentUnit:typeof n=="number"&&(re=z+n),re=Math.max(0,re);var se="",xe=0;if(e.options.indentWithTabs)for(var ye=Math.floor(re/N);ye;--ye)xe+=N,se+=" ";if(xe<re&&(se+=me(re-xe)),se!=X)return _n(i,se,Ne(t,0),Ne(t,X.length),"+input"),H.stateAfter=null,!0;for(var De=0;De<i.sel.ranges.length;De++){var Me=i.sel.ranges[De];if(Me.head.line==t&&Me.head.ch<X.length){var Be=Ne(t,X.length);Fa(i,De,new At(Be,Be));break}}}var Cr=null;function ta(e){Cr=e}function Ga(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,z=ut(t),X=null;if(H&&r.ranges.length>1)if(Cr&&Cr.text.join(`
|
|
`)==t){if(r.ranges.length%Cr.text.length==0){X=[];for(var re=0;re<Cr.text.length;re++)X.push(x.splitLines(Cr.text[re]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(X=ne(z,function(He){return[He]}));for(var se=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var ye=r.ranges[xe],De=ye.from(),Me=ye.to();ye.empty()&&(n&&n>0?De=Ne(De.line,De.ch-n):e.state.overwrite&&!H?Me=Ne(Me.line,Math.min(nt(x,Me.line).text.length,Me.ch+Q(z).length)):H&&Cr&&Cr.lineWise&&Cr.text.join(`
|
|
`)==z.join(`
|
|
`)&&(De=Me=Ne(De.line,0)));var Be={from:De,to:Me,text:X?X[xe%X.length]:z,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,Be),Gt(e,"inputRead",e,Be)}t&&!H&&ws(e,t),On(e),e.curOp.updateInput<2&&(e.curOp.updateInput=se),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&sr(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var x=e.getModeAt(i.head),N=!1;if(x.electricChars){for(var H=0;H<x.electricChars.length;H++)if(t.indexOf(x.electricChars.charAt(H))>-1){N=Ci(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ci(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){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"),E&&(e.style.border="1px solid black"),As(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)&&jt(this,t[r])(this,i,N),Le(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](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:Qt(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,tr(this)}),removeOverlay:Qt(function(r){for(var i=this.state.overlays,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++,tr(this);return}}}),indentLine:Qt(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mr(this.doc,r)&&Ci(this,r,i,x)}),indentSelection:Qt(function(r){for(var i=this.doc.sel.ranges,x=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>x&&(Ci(this,H.head.line,r,!0),x=H.head.line,N==this.doc.sel.primIndex&&On(this));else{var z=H.from(),X=H.to(),re=Math.max(x,z.line);x=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var se=re;se<x;++se)Ci(this,se,r);var xe=this.doc.sel.ranges;z.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Fa(this.doc,N,new At(z,xe[N].to()),ve)}}}),getTokenAt:function(r,i){return Li(this,r,i)},getLineTokens:function(r,i){return Li(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Zr(this,nt(this.doc,r.line)),x=0,N=(i.length-1)/2,H=r.ch,z;if(H==0)z=i[2];else for(;;){var X=x+N>>1;if((X?i[X*2-1]:0)>=H)N=X;else if(i[X*2+1]<H)x=X+1;else{z=i[X*2+2];break}}var re=z?z.indexOf("overlay "):-1;return re<0?z:re==0?null:z.slice(0,re-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var x=[];if(!n.hasOwnProperty(i))return x;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&x.push(N[H[i]]);else if(H[i])for(var z=0;z<H[i].length;z++){var X=N[H[i][z]];X&&x.push(X)}else H.helperType&&N[H.helperType]?x.push(N[H.helperType]):N[H.name]&&x.push(N[H.name]);for(var re=0;re<N._global.length;re++){var se=N._global[re];se.pred(H,this)&&q(x,se.val)==-1&&x.push(se.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=yn(x,r==null?x.first+x.size-1:r),yr(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=ht(this.doc,r):x=r?N.from():N.to(),Sr(this,x,i||"page")},charCoords:function(r,i){return ma(this,ht(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var N=!1,H;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),H=nt(this.doc,r)}else H=r;return Ni(this,H,{top:0,left:0},i||"page",x||N).top+(N?this.doc.height-Tr(H):0)},defaultTextHeight:function(){return An(this.display)},defaultCharWidth:function(){return Ln(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,N,H){var z=this.display;r=Sr(this,ht(this.doc,r));var X=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")X=r.top;else if(N=="above"||N=="near"){var se=Math.max(z.wrapper.clientHeight,this.doc.height),xe=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>se)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=se&&(X=r.bottom),re+i.offsetWidth>xe&&(re=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",H=="right"?(re=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?re=0:H=="middle"&&(re=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),x&&Qs(this,{left:re,top:X,right:re+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Qt(ps),triggerOnKeyPress:Qt(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Qt(vs),execCommand:function(r){if(Ei.hasOwnProperty(r))return Ei[r].call(null,this)},triggerElectric:Qt(function(r){ws(this,r)}),findPosH:function(r,i,x,N){var H=1;i<0&&(H=-1,i=-i);for(var z=ht(this.doc,r),X=0;X<i&&!(z=za(this.doc,z,H,x,N),z.hitSide);++X);return z},moveH:Qt(function(r,i){var x=this;this.extendSelectionsBy(function(N){return x.display.shift||x.doc.extend||N.empty()?za(x.doc,N.head,r,i,x.options.rtlMoveVisually):r<0?N.from():N.to()},he)}),deleteH:Qt(function(r,i){var x=this.doc.sel,N=this.doc;x.somethingSelected()?N.replaceSelection("",null,"+delete"):Nn(this,function(H){var z=za(N,H.head,r,i,!1);return r<0?{from:z,to:H.head}:{from:H.head,to:z}})}),findPosV:function(r,i,x,N){var H=1,z=N;i<0&&(H=-1,i=-i);for(var X=ht(this.doc,r),re=0;re<i;++re){var se=Sr(this,X,"div");if(z==null?z=se.left:se.left=z,X=Ds(this,se,H,x),X.hitSide)break}return X},moveV:Qt(function(r,i){var x=this,N=this.doc,H=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(re){if(z)return r<0?re.from():re.to();var se=Sr(x,re.head,"div");re.goalColumn!=null&&(se.left=re.goalColumn),H.push(se.left);var xe=Ds(x,se,r,i);return i=="page"&&re==N.sel.primary()&&Ca(x,ma(x,xe,"div").top-se.top),xe},he),H.length)for(var X=0;X<N.sel.ranges.length;X++)N.sel.ranges[X].goalColumn=H[X]}),findWordAt:function(r){var i=this.doc,x=nt(i,r.line).text,N=r.ch,H=r.ch;if(x){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||H==x.length)&&N?--N:++H;for(var X=x.charAt(N),re=Re(X,z)?function(se){return Re(se,z)}:/\s/.test(X)?function(se){return/\s/.test(se)}:function(se){return!/\s/.test(se)&&!Re(se)};N>0&&re(x.charAt(N-1));)--N;for(;H<x.length&&re(x.charAt(H));)++H}return new At(Ne(r.line,N),Ne(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),Le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Qt(function(r,i){oi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Dr(this)-this.display.barHeight,width:r.scrollWidth-Dr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:nn(this)}},scrollIntoView:Qt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ne(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):xo(this,r.from,r.to,r.margin)}),setSize:Qt(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&&ao(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(z){if(z.widgets){for(var X=0;X<z.widgets.length;X++)if(z.widgets[X].noHScroll){Kr(x,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,Le(this,"refresh",this)}),operation:function(r){return sr(this,r)},startOperation:function(){return dn(this)},endOperation:function(){return cn(this)},refresh:Qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ii(this),oi(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-An(this.display))>.5||this.options.lineWrapping)&&Ea(this),Le(this,"refresh",this)}),swapDoc:Qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),_o(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Gt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},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 za(e,t,n,r,i){var x=t,N=n,H=nt(e,t.line),z=i&&e.direction=="rtl"?-n:n;function X(){var Je=t.line+z;return Je<e.first||Je>=e.first+e.size?!1:(t=new Ne(Je,t.ch,t.sticky),H=nt(e,Je))}function re(Je){var Ke;if(r=="codepoint"){var et=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(et)?Ke=null:Ke=new Ne(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(et>=55296&&et<56320?2:1))),-n)}else i?Ke=_l(e.cm,H,t,n):Ke=Ua(H,t,n);if(Ke==null)if(!Je&&X())t=Ba(i,e.cm,H,t.line,z);else return!1;else t=Ke;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var se=null,xe=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),De=!0;!(n<0&&!re(!De));De=!1){var Me=H.text.charAt(t.ch)||`
|
|
`,Be=Re(Me,ye)?"w":xe&&Me==`
|
|
`?"n":!xe||/\s/.test(Me)?null:"p";if(xe&&!De&&!Be&&(Be="s"),se&&se!=Be){n<0&&(n=1,re(),t.sticky="after");break}if(Be&&(se=Be),n>0&&!re(!De))break}var He=$i(e,t,x,N,!0);return Gn(x,He)&&(He.hitSide=!0),He}function Ds(e,t,n,r){var i=e.doc,x=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(H-.5*An(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,x,N),!X.outside);){if(n<0?N<=0:N>=i.height){X.hitSide=!0;break}N+=n*5}return X}var Lt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Lt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(H){for(var z=H.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Ce(i,"paste",function(H){if(!x(H)||_e(r,H)||Ss(H,r))return;U<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Ce(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Ce(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Ce(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(i,"touchstart",function(){return n.forceCompositionEnd()}),Ce(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(H){if(!x(H)||_e(r,H))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=Cs(r);ta({lineWise:!0,text:z.text}),H.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var X=Cr.text.join(`
|
|
`);if(H.clipboardData.setData("Text",X),H.clipboardData.getData("Text")==X){H.preventDefault();return}}var re=Ls(),se=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),se.value=Cr.text.join(`
|
|
`);var xe=document.activeElement;W(se),setTimeout(function(){r.display.lineSpace.removeChild(re),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Ce(i,"copy",N),Ce(i,"cut",N)},Lt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Lt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Lt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Lt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Lt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var x=ra(t,e.anchorNode,e.anchorOffset),N=ra(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&N&&!N.bad&&dt(Jr(x,N),r)==0&&dt(vn(x,N),i)==0)return;var H=t.display.view,z=r.line>=t.display.viewFrom&&Os(t,r)||{node:H[0].measure.map[2],offset:0},X=i.line<t.display.viewTo&&Os(t,i);if(!X){var re=H[H.length-1].measure,se=re.maps?re.maps[re.maps.length-1]:re.map;X={node:se[se.length-1],offset:se[se.length-2]-se[se.length-3]}}if(!z||!X){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),ye;try{ye=m(z.node,z.offset,X.offset,X.node)}catch(De){}ye&&(!L&&t.state.focused?(e.collapse(z.node,z.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},Lt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Lt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Lt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Lt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},Lt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Lt.prototype.blur=function(){this.div.blur()},Lt.prototype.getField=function(){return this.div},Lt.prototype.supportsTouch=function(){return!0},Lt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():sr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Lt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Lt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=ra(t,e.anchorNode,e.anchorOffset),r=ra(t,e.focusNode,e.focusOffset);n&&r&&sr(t,function(){Xt(t.doc,zr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Lt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ne(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,N,H;r.line==t.viewFrom||(x=sn(e,r.line))==0?(N=wt(t.view[0].line),H=t.view[0].node):(N=wt(t.view[x].line),H=t.view[x-1].node.nextSibling);var z=sn(e,i.line),X,re;if(z==t.view.length-1?(X=t.viewTo-1,re=t.lineDiv.lastChild):(X=wt(t.view[z+1].line)-1,re=t.view[z+1].node.previousSibling),!H)return!1;for(var se=e.doc.splitLines(tu(e,H,re,N,X)),xe=Pr(e.doc,Ne(N,0),Ne(X,nt(e.doc,X).text.length));se.length>1&&xe.length>1;)if(Q(se)==Q(xe))se.pop(),xe.pop(),X--;else if(se[0]==xe[0])se.shift(),xe.shift(),N++;else break;for(var ye=0,De=0,Me=se[0],Be=xe[0],He=Math.min(Me.length,Be.length);ye<He&&Me.charCodeAt(ye)==Be.charCodeAt(ye);)++ye;for(var Je=Q(se),Ke=Q(xe),et=Math.min(Je.length-(se.length==1?ye:0),Ke.length-(xe.length==1?ye:0));De<et&&Je.charCodeAt(Je.length-De-1)==Ke.charCodeAt(Ke.length-De-1);)++De;if(se.length==1&&xe.length==1&&N==r.line)for(;ye&&ye>r.ch&&Je.charCodeAt(Je.length-De-1)==Ke.charCodeAt(Ke.length-De-1);)ye--,De++;se[se.length-1]=Je.slice(0,Je.length-De).replace(/^\u200b+/,""),se[0]=se[0].slice(ye).replace(/\u200b+$/,"");var lt=Ne(N,ye),ot=Ne(X,xe.length?Q(xe).length-De:0);if(se.length>1||se[0]||dt(lt,ot))return _n(e.doc,se,lt,ot,"+input"),!0},Lt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Lt.prototype.reset=function(){this.forceCompositionEnd()},Lt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Lt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Lt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&sr(this.cm,function(){return tr(e.cm)})},Lt.prototype.setUneditable=function(e){e.contentEditable="false"},Lt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Lt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Lt.prototype.onContextMenu=function(){},Lt.prototype.resetPosition=function(){},Lt.prototype.needsContentAttribute=!0;function Os(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),x=Qe(r,e.doc.direction),N="left";if(x){var H=Ge(x,t.ch);N=H%2?"right":"left"}var z=no(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",N=!1,H=e.doc.lineSeparator(),z=!1;function X(ye){return function(De){return De.id==ye}}function re(){N&&(x+=H,z&&(x+=H),N=z=!1)}function se(ye){ye&&(re(),x+=ye)}function xe(ye){if(ye.nodeType==1){var De=ye.getAttribute("cm-text");if(De){se(De);return}var Me=ye.getAttribute("cm-marker"),Be;if(Me){var He=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Me));He.length&&(Be=He[0].find(0))&&se(Pr(e.doc,Be.from,Be.to).join(H));return}if(ye.getAttribute("contenteditable")=="false")return;var Je=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;Je&&re();for(var Ke=0;Ke<ye.childNodes.length;Ke++)xe(ye.childNodes[Ke]);/^(pre|p)$/i.test(ye.nodeName)&&(z=!0),Je&&(N=!0)}else ye.nodeType==3&&se(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,z=!1;return x}function ra(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Bn(e.clipPos(Ne(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var 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||!b(r,t))return Bn(Ne(wt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?Q(e.rest):e.line;return Bn(Ne(wt(x),x.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var z=e.measure,X=z.maps;function re(Be,He,Je){for(var Ke=-1;Ke<(X?X.length:0);Ke++)for(var et=Ke<0?z.map:X[Ke],lt=0;lt<et.length;lt+=3){var ot=et[lt+2];if(ot==Be||ot==He){var pt=wt(Ke<0?e.line:e.rest[Ke]),Rt=et[lt]+Je;return(Je<0||ot!=Be)&&(Rt=et[lt+(Je?1:0)]),Ne(pt,Rt)}}}var se=re(N,H,n);if(se)return Bn(se,i);for(var xe=H.nextSibling,ye=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(se=re(xe,xe.firstChild,0),se)return Bn(Ne(se.line,se.ch-ye),i);ye+=xe.textContent.length}for(var De=H.previousSibling,Me=n;De;De=De.previousSibling){if(se=re(De,De.firstChild,-1),se)return Bn(Ne(se.line,se.ch+Me),i);Me+=De.textContent.length}}var It=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};It.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),E&&(i.style.width="0px"),Ce(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ce(i,"paste",function(N){if(_e(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(N){if(_e(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Cs(r);ta({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,ve):(n.prevInput="",i.value=H.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ce(i,"cut",x),Ce(i,"copy",x),Ce(e.scroller,"paste",function(N){if(Ur(e,N)||_e(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),Ce(e.lineSpace,"selectstart",function(N){Ur(e,N)||$(N)}),Ce(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"})}}),Ce(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},It.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},It.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},It.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var i=Sr(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},It.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},It.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},It.prototype.getField=function(){return this.textarea},It.prototype.supportsTouch=function(){return!1},It.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},It.prototype.blur=function(){this.textarea.blur()},It.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},It.prototype.receivedFocus=function(){this.slowPoll()},It.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()})},It.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)},It.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||at(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&U>=9&&this.hasSelection===i||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,H=Math.min(r.length,i.length);N<H&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return sr(t,function(){Ga(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},It.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},It.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},It.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=on(n,e),N=r.scroller.scrollTop;if(!x||T)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(x)==-1&&jt(n,Xt)(n.doc,zr(x),ve);var z=i.style.cssText,X=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var se;_&&(se=window.scrollY),r.input.focus(),_&&window.scrollTo(null,se),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Me=n.somethingSelected(),Be="\u200B"+(Me?i.value:"");i.value="\u21DA",i.value=Be,t.prevInput=Me?"":"\u200B",i.selectionStart=1,i.selectionEnd=Be.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=z,B&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&U<9)&&xe();var Me=0,Be=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Me++<10?r.detectingSelectAll=setTimeout(Be,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Be,200)}}if(B&&U>=9&&xe(),A){oe(e);var De=function(){Xe(window,"mouseup",De),setTimeout(ye,20)};Ce(window,"mouseup",De)}else setTimeout(ye,50)},It.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},It.prototype.setUneditable=function(){},It.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?O(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=H.getValue()}var i;if(e.form&&(Ce(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&&(Xe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=kt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return H}function iu(e){e.off=Xe,e.on=Ce,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=ut,e.countColumn=K,e.findColumn=ce,e.isWordChar=Se,e.Pass=Te,e.signal=Le,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Ne,e.cmpPos=dt,e.modes=Dt,e.mimeModes=yt,e.resolveMode=ur,e.getMode=gr,e.modeExtensions=hr,e.extendMode=ia,e.copyState=Ar,e.startState=Kn,e.innerMode=Hn,e.commands=Ei,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Fn,e.normalizeKeyMap=Ml,e.StringStream=Mt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=$,e.e_stopPropagation=J,e.e_stop=oe,e.addClass=F,e.contains=b,e.rmClass=c,e.keyNames=$r}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&q(au,na)<0&&(kt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return ue(rr),kt.inputStyles={textarea:It,contenteditable:Lt},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),or.apply(this,arguments)},kt.defineMIME=kr,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){rr.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},Y1PL:function(ft,tt,de){"use strict";de.r(tt),de.d(tt,"ResizableTextArea",function(){return q});var te=de("wx14"),G=de("1OyB"),L=de("vuIU"),V=de("Ji7U"),I=de("LK+K"),P=de("cDcd"),B=de("VTBJ"),U=de("rePB"),_=de("Zm9Q"),D=de("Kwbf"),g=de("c+Xe"),T=de("m+aA"),R=de("bdgK"),C=new Map;function w(ve){ve.forEach(function(ge){var he,ce=ge.target;(he=C.get(ce))===null||he===void 0||he.forEach(function(ae){return ae(ce)})})}var E=new R.default(w),l=null,o=null;function s(ve,ge){C.has(ve)||(C.set(ve,new Set),E.observe(ve)),C.get(ve).add(ge)}function u(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(E.unobserve(ve),C.delete(ve)))}var S=function(ve){Object(V.a)(he,ve);var ge=Object(I.a)(he);function he(){return Object(G.a)(this,he),ge.apply(this,arguments)}return Object(L.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(P.Component),p=P.createContext(null);function h(ve){var ge=ve.children,he=ve.onBatchResize,ce=P.useRef(0),ae=P.useRef([]),me=P.useContext(p),Q=P.useCallback(function(ne,Z,Ee){ce.current+=1;var Ae=ce.current;ae.current.push({size:ne,element:Z,data:Ee}),Promise.resolve().then(function(){Ae===ce.current&&(he==null||he(ae.current),ae.current=[])}),me==null||me(ne,Z,Ee)},[he,me]);return P.createElement(p.Provider,{value:Q},ge)}function A(ve){var ge=ve.children,he=ve.disabled,ce=P.useRef(null),ae=P.useRef(null),me=P.useContext(p),Q=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=P.isValidElement(ge)&&Object(g.c)(ge),Z=ne?ge.ref:null,Ee=P.useMemo(function(){return Object(g.a)(Z,ce)},[Z,ce]),Ae=P.useRef(ve);Ae.current=ve;var be=P.useCallback(function(Se){var Re=Ae.current,Fe=Re.onResize,Ie=Re.data,ke=Se.getBoundingClientRect(),Oe=ke.width,$e=ke.height,ze=Se.offsetWidth,Ve=Se.offsetHeight,Ge=Math.floor(Oe),rt=Math.floor($e);if(Q.current.width!==Ge||Q.current.height!==rt||Q.current.offsetWidth!==ze||Q.current.offsetHeight!==Ve){var Qe={width:Ge,height:rt,offsetWidth:ze,offsetHeight:Ve};Q.current=Qe;var Ye=ze===Math.round(Oe)?Oe:ze,Ce=Ve===Math.round($e)?$e:Ve,qe=Object(B.a)(Object(B.a)({},Qe),{},{offsetWidth:Ye,offsetHeight:Ce});me==null||me(qe,Se,Ie),Fe&&Promise.resolve().then(function(){Fe(qe,Se)})}},[]);return P.useEffect(function(){var Se=Object(T.a)(ce.current)||Object(T.a)(ae.current);return Se&&!he&&s(Se,be),function(){return u(Se,be)}},[ce.current,he]),P.createElement(S,{ref:ae},ne?P.cloneElement(ge,{ref:Ee}):ge)}var y="rc-observer-key";function c(ve){var ge=ve.children,he=Object(_.a)(ge);return he.map(function(ce,ae){var me=(ce==null?void 0:ce.key)||"".concat(y,"-").concat(ae);return P.createElement(A,Object(te.a)({},ve,{key:me}),ce)})}c.Collection=h;var f=c,d=de("bT9E"),a=de("TSYQ"),v=de.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&M[he])return M[he];var ce=window.getComputedStyle(ve),ae=ce.getPropertyValue("box-sizing")||ce.getPropertyValue("-moz-box-sizing")||ce.getPropertyValue("-webkit-box-sizing"),me=parseFloat(ce.getPropertyValue("padding-bottom"))+parseFloat(ce.getPropertyValue("padding-top")),Q=parseFloat(ce.getPropertyValue("border-bottom-width"))+parseFloat(ce.getPropertyValue("border-top-width")),ne=b.map(function(Ee){return"".concat(Ee,":").concat(ce.getPropertyValue(Ee))}).join(";"),Z={sizingStyle:ne,paddingSize:me,borderSize:Q,boxSizing:ae};return ge&&he&&(M[he]=Z),Z}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ve.getAttribute("wrap")?F.setAttribute("wrap",ve.getAttribute("wrap")):F.removeAttribute("wrap");var ae=j(ve,ge),me=ae.paddingSize,Q=ae.borderSize,ne=ae.boxSizing,Z=ae.sizingStyle;F.setAttribute("style","".concat(Z,";").concat(m)),F.value=ve.value||ve.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,be=F.scrollHeight,Se;if(ne==="border-box"?be+=Q:ne==="content-box"&&(be-=me),he!==null||ce!==null){F.value=" ";var Re=F.scrollHeight-me;he!==null&&(Ee=Re*he,ne==="border-box"&&(Ee=Ee+me+Q),be=Math.max(Ee,be)),ce!==null&&(Ae=Re*ce,ne==="border-box"&&(Ae=Ae+me+Q),Se=be>Ae?"":"hidden",be=Math.min(Ae,be))}return{height:be,minHeight:Ee,maxHeight:Ae,overflowY:Se,resize:"none"}}var k=de("Gytx"),O=de.n(k),K;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(K||(K={}));var Y=function(ve){Object(V.a)(he,ve);var ge=Object(I.a)(he);function he(ce){var ae;return Object(G.a)(this,he),ae=ge.call(this,ce),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(me){ae.textArea=me},ae.handleResize=function(me){var Q=ae.state.resizeStatus,ne=ae.props,Z=ne.autoSize,Ee=ne.onResize;if(Q!==K.NONE)return;typeof Ee=="function"&&Ee(me),Z&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var me=ae.props.autoSize;if(!me||!ae.textArea)return;var Q=me.minRows,ne=me.maxRows,Z=W(ae.textArea,!1,Q,ne);ae.setState({textareaStyles:Z,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:K.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:K.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var me=ae.props,Q=me.prefixCls,ne=Q===void 0?"rc-textarea":Q,Z=me.autoSize,Ee=me.onResize,Ae=me.className,be=me.disabled,Se=ae.state,Re=Se.textareaStyles,Fe=Se.resizeStatus,Ie=Object(d.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),ke=v()(ne,Ae,Object(U.a)({},"".concat(ne,"-disabled"),be));"value"in Ie&&(Ie.value=Ie.value||"");var Oe=Object(B.a)(Object(B.a)(Object(B.a)({},ae.props.style),Re),Fe===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(f,{onResize:ae.handleResize,disabled:!(Z||Ee)},P.createElement("textarea",Object(te.a)({},Ie,{className:ke,style:Oe,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:K.NONE},ae}return Object(L.a)(he,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!O()(ae.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ae=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,me)}}catch(Q){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(P.Component),q=Y,ie=function(ve){Object(V.a)(he,ve);var ge=Object(I.a)(he);function he(ce){var ae;Object(G.a)(this,he),ae=ge.call(this,ce),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(Q){ae.resizableTextArea=Q},ae.handleChange=function(Q){var ne=ae.props.onChange;ae.setValue(Q.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ne&&ne(Q)},ae.handleKeyDown=function(Q){var ne=ae.props,Z=ne.onPressEnter,Ee=ne.onKeyDown;Q.keyCode===13&&Z&&Z(Q),Ee&&Ee(Q)};var me=typeof ce.value=="undefined"||ce.value===null?ce.defaultValue:ce.value;return ae.state={value:me},ae}return Object(L.a)(he,[{key:"setValue",value:function(ae,me){"value"in this.props||this.setState({value:ae},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(q,Object(te.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),he}(P.Component),Te=tt.default=ie},ZpRC:function(ft,tt,de){"use strict";function te(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function G(g,T){return(!T||g!=="hidden")&&g!=="visible"&&g!=="clip"}function L(g,T){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var R=getComputedStyle(g,null);return G(R.overflowY,T)||G(R.overflowX,T)||function(C){var w=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(l){return null}}(C);return!!w&&(w.clientHeight<C.scrollHeight||w.clientWidth<C.scrollWidth)}(g)}return!1}function V(g,T,R,C,w,E,l,o){return E<g&&l>T||E>g&&l<T?0:E<=g&&o<=R||l>=T&&o>=R?E-g-C:l>T&&o<R||E<g&&o>R?l-T+w:0}var I=function(g,T){var R=window,C=T.scrollMode,w=T.block,E=T.inline,l=T.boundary,o=T.skipOverflowHiddenElements,s=typeof l=="function"?l:function(Re){return Re!==l};if(!te(g))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,S=[],p=g;te(p)&&s(p);){if((p=p.parentElement)===u){S.push(p);break}p!=null&&p===document.body&&L(p)&&!L(document.documentElement)||p!=null&&L(p,o)&&S.push(p)}for(var h=R.visualViewport?R.visualViewport.width:innerWidth,A=R.visualViewport?R.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,c=window.scrollY||pageYOffset,f=g.getBoundingClientRect(),d=f.height,a=f.width,v=f.top,m=f.right,b=f.bottom,M=f.left,F=w==="start"||w==="nearest"?v:w==="end"?b:v+d/2,j=E==="center"?M+a/2:E==="end"?m:M,W=[],k=0;k<S.length;k++){var O=S[k],K=O.getBoundingClientRect(),Y=K.height,q=K.width,ie=K.top,Te=K.right,ve=K.bottom,ge=K.left;if(C==="if-needed"&&v>=0&&M>=0&&b<=A&&m<=h&&v>=ie&&b<=ve&&M>=ge&&m<=Te)return W;var he=getComputedStyle(O),ce=parseInt(he.borderLeftWidth,10),ae=parseInt(he.borderTopWidth,10),me=parseInt(he.borderRightWidth,10),Q=parseInt(he.borderBottomWidth,10),ne=0,Z=0,Ee="offsetWidth"in O?O.offsetWidth-O.clientWidth-ce-me:0,Ae="offsetHeight"in O?O.offsetHeight-O.clientHeight-ae-Q:0;if(u===O)ne=w==="start"?F:w==="end"?F-A:w==="nearest"?V(c,c+A,A,ae,Q,c+F,c+F+d,d):F-A/2,Z=E==="start"?j:E==="center"?j-h/2:E==="end"?j-h:V(y,y+h,h,ce,me,y+j,y+j+a,a),ne=Math.max(0,ne+c),Z=Math.max(0,Z+y);else{ne=w==="start"?F-ie-ae:w==="end"?F-ve+Q+Ae:w==="nearest"?V(ie,ve,Y,ae,Q+Ae,F,F+d,d):F-(ie+Y/2)+Ae/2,Z=E==="start"?j-ge-ce:E==="center"?j-(ge+q/2)+Ee/2:E==="end"?j-Te+me+Ee:V(ge,Te,q,ce,me+Ee,j,j+a,a);var be=O.scrollLeft,Se=O.scrollTop;F+=Se-(ne=Math.max(0,Math.min(Se+ne,O.scrollHeight-Y+Ae))),j+=be-(Z=Math.max(0,Math.min(be+Z,O.scrollWidth-q+Ee)))}W.push({el:O,top:ne,left:Z})}return W};function P(g){return g===Object(g)&&Object.keys(g).length!==0}function B(g,T){T===void 0&&(T="auto");var R="scrollBehavior"in document.body.style;g.forEach(function(C){var w=C.el,E=C.top,l=C.left;w.scroll&&R?w.scroll({top:E,left:l,behavior:T}):(w.scrollTop=E,w.scrollLeft=l)})}function U(g){return g===!1?{block:"end",inline:"nearest"}:P(g)?g:{block:"start",inline:"nearest"}}function _(g,T){var R=!g.ownerDocument.documentElement.contains(g);if(P(T)&&typeof T.behavior=="function")return T.behavior(R?[]:I(g,T));if(R)return;var C=U(T);return B(I(g,C),C.behavior)}var D=tt.a=_},Zss7:function(ft,tt,de){var te;(function(G){var L=/^\s+/,V=/\s+$/,I=0,P=G.round,B=G.min,U=G.max,_=G.random;function D(Q,ne){if(Q=Q||"",ne=ne||{},Q instanceof D)return Q;if(!(this instanceof D))return new D(Q,ne);var Z=g(Q);this._originalInput=Q,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=P(100*this._a)/100,this._format=ne.format||Z.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=Z.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 Q=this.toRgb();return(Q.r*299+Q.g*587+Q.b*114)/1e3},getLuminance:function(){var Q=this.toRgb(),ne,Z,Ee,Ae,be,Se;return ne=Q.r/255,Z=Q.g/255,Ee=Q.b/255,ne<=.03928?Ae=ne/12.92:Ae=G.pow((ne+.055)/1.055,2.4),Z<=.03928?be=Z/12.92:be=G.pow((Z+.055)/1.055,2.4),Ee<=.03928?Se=Ee/12.92:Se=G.pow((Ee+.055)/1.055,2.4),.2126*Ae+.7152*be+.0722*Se},setAlpha:function(Q){return this._a=W(Q),this._roundA=P(100*this._a)/100,this},toHsv:function(){var Q=w(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,v:Q.v,a:this._a}},toHsvString:function(){var Q=w(this._r,this._g,this._b),ne=P(Q.h*360),Z=P(Q.s*100),Ee=P(Q.v*100);return this._a==1?"hsv("+ne+", "+Z+"%, "+Ee+"%)":"hsva("+ne+", "+Z+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var Q=R(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,l:Q.l,a:this._a}},toHslString:function(){var Q=R(this._r,this._g,this._b),ne=P(Q.h*360),Z=P(Q.s*100),Ee=P(Q.l*100);return this._a==1?"hsl("+ne+", "+Z+"%, "+Ee+"%)":"hsla("+ne+", "+Z+"%, "+Ee+"%, "+this._roundA+")"},toHex:function(Q){return l(this._r,this._g,this._b,Q)},toHexString:function(Q){return"#"+this.toHex(Q)},toHex8:function(Q){return o(this._r,this._g,this._b,this._a,Q)},toHex8String:function(Q){return"#"+this.toHex8(Q)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(k(this._r,255)*100)+"%",g:P(k(this._g,255)*100)+"%",b:P(k(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(k(this._r,255)*100)+"%, "+P(k(this._g,255)*100)+"%, "+P(k(this._b,255)*100)+"%)":"rgba("+P(k(this._r,255)*100)+"%, "+P(k(this._g,255)*100)+"%, "+P(k(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[l(this._r,this._g,this._b,!0)]||!1},toFilter:function(Q){var ne="#"+s(this._r,this._g,this._b,this._a),Z=ne,Ee=this._gradientType?"GradientType = 1, ":"";if(Q){var Ae=D(Q);Z="#"+s(Ae._r,Ae._g,Ae._b,Ae._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ne+",endColorstr="+Z+")"},toString:function(Q){var ne=!!Q;Q=Q||this._format;var Z=!1,Ee=this._a<1&&this._a>=0,Ae=!ne&&Ee&&(Q==="hex"||Q==="hex6"||Q==="hex3"||Q==="hex4"||Q==="hex8"||Q==="name");return Ae?Q==="name"&&this._a===0?this.toName():this.toRgbString():(Q==="rgb"&&(Z=this.toRgbString()),Q==="prgb"&&(Z=this.toPercentageRgbString()),(Q==="hex"||Q==="hex6")&&(Z=this.toHexString()),Q==="hex3"&&(Z=this.toHexString(!0)),Q==="hex4"&&(Z=this.toHex8String(!0)),Q==="hex8"&&(Z=this.toHex8String()),Q==="name"&&(Z=this.toName()),Q==="hsl"&&(Z=this.toHslString()),Q==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(Q,ne){var Z=Q.apply(null,[this].concat([].slice.call(ne)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(h,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function(Q,ne){return Q.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},D.fromRatio=function(Q,ne){if(typeof Q=="object"){var Z={};for(var Ee in Q)Q.hasOwnProperty(Ee)&&(Ee==="a"?Z[Ee]=Q[Ee]:Z[Ee]=Te(Q[Ee]));Q=Z}return D(Q,ne)};function g(Q){var ne={r:0,g:0,b:0},Z=1,Ee=null,Ae=null,be=null,Se=!1,Re=!1;return typeof Q=="string"&&(Q=ae(Q)),typeof Q=="object"&&(ce(Q.r)&&ce(Q.g)&&ce(Q.b)?(ne=T(Q.r,Q.g,Q.b),Se=!0,Re=String(Q.r).substr(-1)==="%"?"prgb":"rgb"):ce(Q.h)&&ce(Q.s)&&ce(Q.v)?(Ee=Te(Q.s),Ae=Te(Q.v),ne=E(Q.h,Ee,Ae),Se=!0,Re="hsv"):ce(Q.h)&&ce(Q.s)&&ce(Q.l)&&(Ee=Te(Q.s),be=Te(Q.l),ne=C(Q.h,Ee,be),Se=!0,Re="hsl"),Q.hasOwnProperty("a")&&(Z=Q.a)),Z=W(Z),{ok:Se,format:Q.format||Re,r:B(255,U(ne.r,0)),g:B(255,U(ne.g,0)),b:B(255,U(ne.b,0)),a:Z}}function T(Q,ne,Z){return{r:k(Q,255)*255,g:k(ne,255)*255,b:k(Z,255)*255}}function R(Q,ne,Z){Q=k(Q,255),ne=k(ne,255),Z=k(Z,255);var Ee=U(Q,ne,Z),Ae=B(Q,ne,Z),be,Se,Re=(Ee+Ae)/2;if(Ee==Ae)be=Se=0;else{var Fe=Ee-Ae;Se=Re>.5?Fe/(2-Ee-Ae):Fe/(Ee+Ae);switch(Ee){case Q:be=(ne-Z)/Fe+(ne<Z?6:0);break;case ne:be=(Z-Q)/Fe+2;break;case Z:be=(Q-ne)/Fe+4;break}be/=6}return{h:be,s:Se,l:Re}}function C(Q,ne,Z){var Ee,Ae,be;Q=k(Q,360),ne=k(ne,100),Z=k(Z,100);function Se(Ie,ke,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?Ie+(ke-Ie)*6*Oe:Oe<1/2?ke:Oe<2/3?Ie+(ke-Ie)*(2/3-Oe)*6:Ie}if(ne===0)Ee=Ae=be=Z;else{var Re=Z<.5?Z*(1+ne):Z+ne-Z*ne,Fe=2*Z-Re;Ee=Se(Fe,Re,Q+1/3),Ae=Se(Fe,Re,Q),be=Se(Fe,Re,Q-1/3)}return{r:Ee*255,g:Ae*255,b:be*255}}function w(Q,ne,Z){Q=k(Q,255),ne=k(ne,255),Z=k(Z,255);var Ee=U(Q,ne,Z),Ae=B(Q,ne,Z),be,Se,Re=Ee,Fe=Ee-Ae;if(Se=Ee===0?0:Fe/Ee,Ee==Ae)be=0;else{switch(Ee){case Q:be=(ne-Z)/Fe+(ne<Z?6:0);break;case ne:be=(Z-Q)/Fe+2;break;case Z:be=(Q-ne)/Fe+4;break}be/=6}return{h:be,s:Se,v:Re}}function E(Q,ne,Z){Q=k(Q,360)*6,ne=k(ne,100),Z=k(Z,100);var Ee=G.floor(Q),Ae=Q-Ee,be=Z*(1-ne),Se=Z*(1-Ae*ne),Re=Z*(1-(1-Ae)*ne),Fe=Ee%6,Ie=[Z,Se,be,be,Re,Z][Fe],ke=[Re,Z,Z,Se,be,be][Fe],Oe=[be,be,Re,Z,Z,Se][Fe];return{r:Ie*255,g:ke*255,b:Oe*255}}function l(Q,ne,Z,Ee){var Ae=[ie(P(Q).toString(16)),ie(P(ne).toString(16)),ie(P(Z).toString(16))];return Ee&&Ae[0].charAt(0)==Ae[0].charAt(1)&&Ae[1].charAt(0)==Ae[1].charAt(1)&&Ae[2].charAt(0)==Ae[2].charAt(1)?Ae[0].charAt(0)+Ae[1].charAt(0)+Ae[2].charAt(0):Ae.join("")}function o(Q,ne,Z,Ee,Ae){var be=[ie(P(Q).toString(16)),ie(P(ne).toString(16)),ie(P(Z).toString(16)),ie(ve(Ee))];return Ae&&be[0].charAt(0)==be[0].charAt(1)&&be[1].charAt(0)==be[1].charAt(1)&&be[2].charAt(0)==be[2].charAt(1)&&be[3].charAt(0)==be[3].charAt(1)?be[0].charAt(0)+be[1].charAt(0)+be[2].charAt(0)+be[3].charAt(0):be.join("")}function s(Q,ne,Z,Ee){var Ae=[ie(ve(Ee)),ie(P(Q).toString(16)),ie(P(ne).toString(16)),ie(P(Z).toString(16))];return Ae.join("")}D.equals=function(Q,ne){return!Q||!ne?!1:D(Q).toRgbString()==D(ne).toRgbString()},D.random=function(){return D.fromRatio({r:_(),g:_(),b:_()})};function u(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toHsl();return Z.s-=ne/100,Z.s=O(Z.s),D(Z)}function S(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toHsl();return Z.s+=ne/100,Z.s=O(Z.s),D(Z)}function p(Q){return D(Q).desaturate(100)}function h(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toHsl();return Z.l+=ne/100,Z.l=O(Z.l),D(Z)}function A(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toRgb();return Z.r=U(0,B(255,Z.r-P(255*-(ne/100)))),Z.g=U(0,B(255,Z.g-P(255*-(ne/100)))),Z.b=U(0,B(255,Z.b-P(255*-(ne/100)))),D(Z)}function y(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toHsl();return Z.l-=ne/100,Z.l=O(Z.l),D(Z)}function c(Q,ne){var Z=D(Q).toHsl(),Ee=(Z.h+ne)%360;return Z.h=Ee<0?360+Ee:Ee,D(Z)}function f(Q){var ne=D(Q).toHsl();return ne.h=(ne.h+180)%360,D(ne)}function d(Q){var ne=D(Q).toHsl(),Z=ne.h;return[D(Q),D({h:(Z+120)%360,s:ne.s,l:ne.l}),D({h:(Z+240)%360,s:ne.s,l:ne.l})]}function a(Q){var ne=D(Q).toHsl(),Z=ne.h;return[D(Q),D({h:(Z+90)%360,s:ne.s,l:ne.l}),D({h:(Z+180)%360,s:ne.s,l:ne.l}),D({h:(Z+270)%360,s:ne.s,l:ne.l})]}function v(Q){var ne=D(Q).toHsl(),Z=ne.h;return[D(Q),D({h:(Z+72)%360,s:ne.s,l:ne.l}),D({h:(Z+216)%360,s:ne.s,l:ne.l})]}function m(Q,ne,Z){ne=ne||6,Z=Z||30;var Ee=D(Q).toHsl(),Ae=360/Z,be=[D(Q)];for(Ee.h=(Ee.h-(Ae*ne>>1)+720)%360;--ne;)Ee.h=(Ee.h+Ae)%360,be.push(D(Ee));return be}function b(Q,ne){ne=ne||6;for(var Z=D(Q).toHsv(),Ee=Z.h,Ae=Z.s,be=Z.v,Se=[],Re=1/ne;ne--;)Se.push(D({h:Ee,s:Ae,v:be})),be=(be+Re)%1;return Se}D.mix=function(Q,ne,Z){Z=Z===0?0:Z||50;var Ee=D(Q).toRgb(),Ae=D(ne).toRgb(),be=Z/100,Se={r:(Ae.r-Ee.r)*be+Ee.r,g:(Ae.g-Ee.g)*be+Ee.g,b:(Ae.b-Ee.b)*be+Ee.b,a:(Ae.a-Ee.a)*be+Ee.a};return D(Se)},D.readability=function(Q,ne){var Z=D(Q),Ee=D(ne);return(G.max(Z.getLuminance(),Ee.getLuminance())+.05)/(G.min(Z.getLuminance(),Ee.getLuminance())+.05)},D.isReadable=function(Q,ne,Z){var Ee=D.readability(Q,ne),Ae,be;be=!1,Ae=me(Z);switch(Ae.level+Ae.size){case"AAsmall":case"AAAlarge":be=Ee>=4.5;break;case"AAlarge":be=Ee>=3;break;case"AAAsmall":be=Ee>=7;break}return be},D.mostReadable=function(Q,ne,Z){var Ee=null,Ae=0,be,Se,Re,Fe;Z=Z||{},Se=Z.includeFallbackColors,Re=Z.level,Fe=Z.size;for(var Ie=0;Ie<ne.length;Ie++)be=D.readability(Q,ne[Ie]),be>Ae&&(Ae=be,Ee=D(ne[Ie]));return D.isReadable(Q,Ee,{level:Re,size:Fe})||!Se?Ee:(Z.includeFallbackColors=!1,D.mostReadable(Q,["#fff","#000"],Z))};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"},F=D.hexNames=j(M);function j(Q){var ne={};for(var Z in Q)Q.hasOwnProperty(Z)&&(ne[Q[Z]]=Z);return ne}function W(Q){return Q=parseFloat(Q),(isNaN(Q)||Q<0||Q>1)&&(Q=1),Q}function k(Q,ne){Y(Q)&&(Q="100%");var Z=q(Q);return Q=B(ne,U(0,parseFloat(Q))),Z&&(Q=parseInt(Q*ne,10)/100),G.abs(Q-ne)<1e-6?1:Q%ne/parseFloat(ne)}function O(Q){return B(1,U(0,Q))}function K(Q){return parseInt(Q,16)}function Y(Q){return typeof Q=="string"&&Q.indexOf(".")!=-1&&parseFloat(Q)===1}function q(Q){return typeof Q=="string"&&Q.indexOf("%")!=-1}function ie(Q){return Q.length==1?"0"+Q:""+Q}function Te(Q){return Q<=1&&(Q=Q*100+"%"),Q}function ve(Q){return G.round(parseFloat(Q)*255).toString(16)}function ge(Q){return K(Q)/255}var he=function(){var Q="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ne+")|(?:"+Q+")",Ee="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Ae="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ae),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ae),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ae),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 ce(Q){return!!he.CSS_UNIT.exec(Q)}function ae(Q){Q=Q.replace(L,"").replace(V,"").toLowerCase();var ne=!1;if(M[Q])Q=M[Q],ne=!0;else if(Q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=he.rgb.exec(Q))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=he.rgba.exec(Q))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=he.hsl.exec(Q))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=he.hsla.exec(Q))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=he.hsv.exec(Q))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=he.hsva.exec(Q))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=he.hex8.exec(Q))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),a:ge(Z[4]),format:ne?"name":"hex8"}:(Z=he.hex6.exec(Q))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),format:ne?"name":"hex"}:(Z=he.hex4.exec(Q))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),a:ge(Z[4]+""+Z[4]),format:ne?"name":"hex8"}:(Z=he.hex3.exec(Q))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),format:ne?"name":"hex"}:!1}function me(Q){var ne,Z;return Q=Q||{level:"AA",size:"small"},ne=(Q.level||"AA").toUpperCase(),Z=(Q.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ne,size:Z}}ft.exports?ft.exports=D:!(te=function(){return D}.call(tt,de,tt,ft),te!==void 0&&(ft.exports=te))})(Math)},bT9E:function(ft,tt,de){"use strict";de.d(tt,"a",function(){return G});var te=de("VTBJ");function G(L,V){var I=Object(te.a)({},L);return Array.isArray(V)&&V.forEach(function(P){delete I[P]}),I}},c5Ni:function(ft,tt,de){},dejd:function(ft,tt,de){},dmUQ:function(ft,tt,de){"use strict";var te=de("Ff2n"),G=de("rePB"),L=de("1OyB"),V=de("vuIU"),I=de("Ji7U"),P=de("md7G"),B=de("foSv"),U=de("cDcd"),_=de.n(U),D=de("TSYQ"),g=de.n(D),T=de("4IlW");function R(d,a){var v=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),v.push.apply(v,m)}return v}function C(d){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?R(Object(v),!0).forEach(function(m){Object(G.a)(d,m,v[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(v)):R(Object(v)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(v,m))})}return d}function w(d){var a=E();return function(){var m=Object(B.a)(d),b;if(a){var M=Object(B.a)(this).constructor;b=Reflect.construct(m,arguments,M)}else b=m.apply(this,arguments);return Object(P.a)(this,b)}}function E(){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(d){return!1}}function l(){}function o(d){d.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,S=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(a){return a!=null},A=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},y=function(d){Object(I.a)(v,d);var a=w(v);function v(m){var b;Object(L.a)(this,v),b=a.call(this,m),b.onKeyDown=function(j){var W=b.props,k=W.onKeyDown,O=W.onPressEnter;if(j.keyCode===T.a.UP){var K=b.getRatio(j);b.up(j,K,null),b.stop()}else if(j.keyCode===T.a.DOWN){var Y=b.getRatio(j);b.down(j,Y,null),b.stop()}else j.keyCode===T.a.ENTER&&O&&O(j);if(b.recordCursorPosition(),b.lastKeyCode=j.keyCode,k){for(var q=arguments.length,ie=new Array(q>1?q-1:0),Te=1;Te<q;Te++)ie[Te-1]=arguments[Te];k.apply(void 0,[j].concat(ie))}},b.onKeyUp=function(j){var W=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),W){for(var k=arguments.length,O=new Array(k>1?k-1:0),K=1;K<k;K++)O[K-1]=arguments[K];W.apply(void 0,[j].concat(O))}},b.onChange=function(j){var W=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(j)),b.setState({inputValue:b.rawInput}),W(b.toNumber(b.rawInput))},b.onMouseUp=function(){var j=b.props.onMouseUp;b.recordCursorPosition(),j&&j.apply(void 0,arguments)},b.onFocus=function(){var j;b.setState({focused:!0}),(j=b.props).onFocus.apply(j,arguments)},b.onBlur=function(){var j=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var W=b.getCurrentValidValue(b.state.inputValue),k=b.setValue(W,l);if(j){var O=b.input.value,K=b.getInputDisplayValue({focus:!1,value:k});b.input.value=K&&Number(K),j.apply(void 0,arguments),b.input.value=O}},b.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},b.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},b.getPrecision=function(j){if(h(b.props.precision))return b.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var k=0;return W.indexOf(".")>=0&&(k=W.length-W.indexOf(".")-1),k},b.getInputDisplayValue=function(j){var W=j||b.state,k=W.focused,O=W.inputValue,K=W.value,Y;k?Y=O:Y=b.toPrecisionAsStep(K),Y==null&&(Y="");var q=b.formatWrapper(Y);return h(b.props.decimalSeparator)&&(q=q.toString().replace(".",b.props.decimalSeparator)),q},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(j){}},b.restoreByAfter=function(j){if(j===void 0)return!1;var W=b.input.value,k=W.lastIndexOf(j);if(k===-1)return!1;var O=b.cursorBefore.length;return b.lastKeyCode===T.a.DELETE&&b.cursorBefore.charAt(O-1)===j[0]?(b.fixCaret(O,O),!0):k+j.length===W.length?(b.fixCaret(k,k),!0):!1},b.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,k){var O=j.substring(k);return b.restoreByAfter(O)})},b.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(j,W,k){b.pressingUpOrDown=!0,b.step("down",j,W,k)},b.up=function(j,W,k){b.pressingUpOrDown=!0,b.step("up",j,W,k)},b.saveInput=function(j){b.input=j};var M=m.value;M===void 0&&(M=m.defaultValue),b.state={focused:m.autoFocus};var F=b.getValidValue(b.toNumber(M));return b.state=C(C({},b.state),{},{inputValue:b.toPrecisionAsStep(F),value:F}),b}return Object(V.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var M=this.props,F=M.value,j=M.onChange,W=M.max,k=M.min,O=this.state.focused;if(b){if(!A(b.value,F)||!A(b.max,W)||!A(b.min,k)){var K=O?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=K:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:Y})}var q="value"in this.props?F:this.state.value;"max"in this.props&&b.max!==W&&typeof q=="number"&&q>W&&j&&j(W),"min"in this.props&&b.min!==k&&typeof q=="number"&&q<k&&j&&j(k)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ie=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?ie=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(ie=this.cursorStart):ie=this.input.value.length,this.fixCaret(ie,ie)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(b){var M=b;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(b){var M=b.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(b);return isNaN(j)?b:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(b,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),W=this.state.value,k=W===void 0?null:W,O=this.state.inputValue,K=O===void 0?null:O,Y=typeof j=="number"?j.toFixed(F):"".concat(j),q=j!==k||Y!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(b)},M),q&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(h(j))return j;var k=this.getPrecision(M),O=this.getPrecision(W),K=this.getPrecision(b);return b?Math.max(K,k+O):k+O}},{key:"getPrecisionFactor",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(b,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var M=Math.abs(this.getMaxPrecision(b));return isNaN(M)?b.toString():Number(b).toFixed(M)}},{key:"toNumber",value:function(b){var M=this.props.precision,F=this.state.focused,j=b&&b.length>16&&F;return this.isNotCompleteNumber(b)||j?b:h(M)?Math.round(b*Math.pow(10,M))/Math.pow(10,M):Number(b)}},{key:"upStep",value:function(b,M){var F=this.props.step,j=this.getPrecisionFactor(b,M),W=Math.abs(this.getMaxPrecision(b,M)),k=((j*b+j*F*M)/j).toFixed(W);return this.toNumber(k)}},{key:"downStep",value:function(b,M){var F=this.props.step,j=this.getPrecisionFactor(b,M),W=Math.abs(this.getMaxPrecision(b,M)),k=((j*b-j*F*M)/j).toFixed(W);return this.toNumber(k)}},{key:"step",value:function(b,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var k=this.props;if(k.disabled)return;var O=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(O))return;var K=this["".concat(b,"Step")](O,j),Y=K>k.max||K<k.min;if(K>k.max?K=k.max:K<k.min&&(K=k.min),this.setValue(K,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[b](M,j,!0)},W?u:S)}},{key:"fixCaret",value:function(b,M){if(b===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(b!==F||M!==j)&&this.input.setSelectionRange(b,M)}catch(W){}}},{key:"render",value:function(){var b,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,k=M.useTouch,O=M.autoComplete,K=M.upHandler,Y=M.downHandler,q=M.className,ie=M.max,Te=M.min,ve=M.style,ge=M.title,he=M.onMouseEnter,ce=M.onMouseLeave,ae=M.onMouseOver,me=M.onMouseOut,Q=M.required,ne=M.onClick,Z=M.tabIndex,Ee=M.type,Ae=M.placeholder,be=M.id,Se=M.inputMode,Re=M.pattern,Fe=M.step,Ie=M.maxLength,ke=M.autoFocus,Oe=M.name,$e=M.onPaste,ze=M.onInput,Ve=Object(te.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"]),Ge=this.state,rt=Ge.value,Qe=Ge.focused,Ye=g()(F,(b={},Object(G.a)(b,q,!!q),Object(G.a)(b,"".concat(F,"-disabled"),j),Object(G.a)(b,"".concat(F,"-focused"),Qe),b)),Ce={};Object.keys(Ve).forEach(function(oe){(oe.substr(0,5)==="data-"||oe.substr(0,5)==="aria-"||oe==="role")&&(Ce[oe]=Ve[oe])});var qe=!W&&!j,Xe=this.getInputDisplayValue(null),Le=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=ie),_e=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Te),pe=Le||j||W,le=_e||j||W,ue=g()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(G.a)({},"".concat(F,"-handler-up-disabled"),pe)),$=g()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(G.a)({},"".concat(F,"-handler-down-disabled"),le)),J=k?{onTouchStart:pe?l:this.up,onTouchEnd:this.stop}:{onMouseDown:pe?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=k?{onTouchStart:le?l:this.down,onTouchEnd:this.stop}:{onMouseDown:le?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:Ye,style:ve,title:ge,onMouseEnter:he,onMouseLeave:ce,onMouseOver:ae,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(F,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":pe,className:ue}),K||_.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),_.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:$}),Y||_.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),_.a.createElement("div",{className:"".concat(F,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ie,"aria-valuenow":rt,required:Q,type:Ee,placeholder:Ae,onPaste:$e,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Z,autoComplete:O,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:l,onKeyUp:qe?this.onKeyUp:l,autoFocus:ke,maxLength:Ie,readOnly:W,disabled:j,max:ie,min:Te,step:Fe,name:Oe,title:ge,id:be,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Xe),pattern:Re,inputMode:Se,onInput:ze},Ce))))}}]),v}(_.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var c=y,f=tt.a=c},gkVt:function(ft,tt,de){"use strict";de.r(tt);var te=de("DZo9"),G=de("8z0m"),L=de("+L6B"),V=de("2/Rp"),I=de("miYZ"),P=de("tsqr"),B=de("9og8"),U=de("tJVT"),_=de("WmNS"),D=de.n(_),g=de("cDcd"),T=de.n(g),R=de("5NDa"),C=de("5rEg"),w=de("Ot1p"),E=de("ErOA");function l(d){var a=d.setIscreate,v=d.init,m=d.UpdateItem,b=Object(g.useState)(""),M=Object(U.a)(b,2),F=M[0],j=M[1],W=Object(g.useState)(""),k=Object(U.a)(W,2),O=k[0],K=k[1];Object(g.useEffect)(function(){if(!m)return;j(m&&m.name),K(m&&m.description)},[m]);function Y(){return q.apply(this,arguments)}function q(){return q=Object(B.a)(D.a.mark(function ve(){var ge;return D.a.wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:if(F){ce.next=3;break}return P.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),ce.abrupt("return");case 3:if(O){ce.next=6;break}return P.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),ce.abrupt("return");case 6:if(!m){ce.next=9;break}return ie(),ce.abrupt("return");case 9:return ce.next=11,Object(E.a)("/api/hpc_courses.json",{method:"post",body:{name:F,description:O,container_type:window.location.pathname.split("/")[1]}});case 11:ge=ce.sent,ge&&(P.b.info("\u521B\u5EFA\u6210\u529F"),a(!1),v("add"));case 13:case"end":return ce.stop()}},ve)})),q.apply(this,arguments)}function ie(){return Te.apply(this,arguments)}function Te(){return Te=Object(B.a)(D.a.mark(function ve(){var ge;return D.a.wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:return ce.next=2,Object(E.a)("/api/hpc_courses/".concat(m.id,".json"),{method:"put",body:{name:F,description:O,container_type:window.location.pathname.split("/")[1]}});case 2:ge=ce.sent,ge&&(P.b.info("\u7F16\u8F91\u6210\u529F"),a(!1),v(""));case 4:case"end":return ce.stop()}},ve)})),Te.apply(this,arguments)}return T.a.createElement("div",null,T.a.createElement(C.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:F,maxLength:60,addonAfter:String(F.length)+"/60",onChange:function(ge){return j(ge.target.value)}}),T.a.createElement(w.a,{id:"courseContentMD",defaultValue:O,onChange:function(ge){return K(ge)}}),T.a.createElement("div",{className:"clearfix mt30 mb30"},T.a.createElement(V.a,{type:"primary",onClick:function(){return Y()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),T.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return a(!1)}},"\u53D6\u6D88")))}var o=l,s=de("9Bee");function u(d){var a=d.CourseItem,v=d.userId,m=d.init,b=d.ItemUpdate,M=d.setSee,F=d.UserInfo;function j(){return W.apply(this,arguments)}function W(){return W=Object(B.a)(D.a.mark(function O(){var K;return D.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:return q.next=2,Object(E.a)("/api/hpc_courses/".concat(a.id,".json"),{method:"delete"});case 2:K=q.sent,K&&(P.b.info("\u5220\u9664\u6210\u529F"),m("delete"),M(!1));case 4:case"end":return q.stop()}},O)})),W.apply(this,arguments)}function k(){b(a)}return T.a.createElement("div",null,v===299635||v===301458||F!=null&&F.admin||F!=null&&F.business?T.a.createElement("div",{style:{textAlign:"right"}},T.a.createElement(V.a,{onClick:function(){return k()}},"\u7F16\u8F91"),T.a.createElement(V.a,{onClick:function(){return j()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,T.a.createElement("h1",null,a==null?void 0:a.name),T.a.createElement(s.a,{value:a==null?void 0:a.description}))}var S=u,p=de("9ivq"),h=de("m3rI"),A=de("Ty5D"),y=de("9kvl");function c(d){var a,v,m,b,M,F,j,W,k,O=d.user,K=d.dispatch,Y=Object(g.useState)(1),q=Object(U.a)(Y,2),ie=q[0],Te=q[1],ve=Object(g.useState)(100),ge=Object(U.a)(ve,2),he=ge[0],ce=ge[1],ae=Object(g.useState)([]),me=Object(U.a)(ae,2),Q=me[0],ne=me[1],Z=Object(g.useState)(!1),Ee=Object(U.a)(Z,2),Ae=Ee[0],be=Ee[1],Se=Object(g.useState)(!1),Re=Object(U.a)(Se,2),Fe=Re[0],Ie=Re[1],ke=Object(g.useState)(""),Oe=Object(U.a)(ke,2),$e=Oe[0],ze=Oe[1],Ve=Object(g.useState)(""),Ge=Object(U.a)(Ve,2),rt=Ge[0],Qe=Ge[1],Ye=Object(g.useState)(""),Ce=Object(U.a)(Ye,2),qe=Ce[0],Xe=Ce[1],Le=Object(A.i)(),_e=Le.itemname,pe=Object(g.useState)(""),le=Object(U.a)(pe,2),ue=le[0],$=le[1];Object(g.useEffect)(function(){K({type:"globalSetting/headerToggle",payload:!1}),ie&&J("")},[ie]);function J(je){return ee.apply(this,arguments)}function ee(){return ee=Object(B.a)(D.a.mark(function je(Ze){var We,mt,ut,at,Et;return D.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:return St.next=2,Object(E.a)("/api/hpc_courses.json",{method:"get",params:{page:ie,per_page:he,container_type:window.location.pathname.split("/")[1]}});case 2:if(We=St.sent,!We){St.next=24;break}if(mt=We.data.hpc_courses.length,ne(We.data.hpc_courses),Xe(We.data.file_url),Qe(""),mt){St.next=10;break}return St.abrupt("return");case 10:if(ue){St.next=14;break}_e?(Et=0,We==null||((ut=We.data)===null||ut===void 0||((at=ut.hpc_courses)===null||at===void 0))||at.map(function(Dt,yt){var or;(_e==null?void 0:_e.toLocaleLowerCase())===(Dt==null||((or=Dt.name)===null||or===void 0)?void 0:or.toLocaleLowerCase())&&(Et=yt)}),ze(We.data.hpc_courses[Et]),Ie(!0),$(We.data.hpc_courses[Et].id),(_e==null?void 0:_e.toLocaleLowerCase())==="resources"&&(ze(We.data.hpc_courses.filter(function(Dt){return Dt.id===15})[0]),Ie(!0),$(15))):(ze(We.data.hpc_courses[0]),Ie(!0),$(We.data.hpc_courses[0].id)),St.next=24;break;case 14:if(!(Ze==="delete")){St.next=23;break}if(!(mt===0)){St.next=18;break}return Ie(!1),St.abrupt("return");case 18:ze(We.data.hpc_courses[0]),Ie(!0),$(We.data.hpc_courses[0].id),St.next=24;break;case 23:Ze==="add"?(ze(We.data.hpc_courses[mt-1]),Ie(!0),$(We.data.hpc_courses[mt-1].id)):(ze(We.data.hpc_courses.filter(function(Dt){return Dt.id===ue})[0]),Ie(!0),$(ue));case 24:case"end":return St.stop()}},je)})),ee.apply(this,arguments)}function oe(je){be(!1),Ie(!0),ze(je),$(je.id)}function fe(je){Qe(je),be(!0),Ie(!1)}function we(){Qe(""),be(!0),Ie(!1)}var Pe={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(Ze){var We=Ze.file.status;We!=="uploading",We==="done"?(P.b.success("".concat(Ze.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),J("")):We==="error"&&P.b.error("".concat(Ze.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Ze){var We=Ze.size/1024/1024<150;return We||P.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),We}};return T.a.createElement("div",{style:{marginBottom:"40px"}},T.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(h.a.IMG_SERVER+"/".concat(qe),")")}}),T.a.createElement("img",{style:{width:"100%"},src:h.a.IMG_SERVER+"/".concat(qe)}),T.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},T.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},Q&&Q.map(function(je,Ze){return T.a.createElement("p",{key:Ze,onClick:function(){return oe(je)},className:ue===je.id?"menuitemselect":"menuitem task-hide"},je.name)}),(O==null||((a=O.userInfo)===null||a===void 0)?void 0:a.user_id)===299635||(O==null||((v=O.userInfo)===null||v===void 0)?void 0:v.user_id)===301458||O!=null&&(m=O.userInfo)!==null&&m!==void 0&&m.admin||O!=null&&(b=O.userInfo)!==null&&b!==void 0&&b.business?T.a.createElement("p",{onClick:function(){return we()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},T.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),T.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},Ae?T.a.createElement(o,{UpdateItem:rt,setIscreate:be,init:J}):null,Fe?T.a.createElement(S,{UserInfo:O==null?void 0:O.userInfo,setSee:Ie,userId:O==null||((M=O.userInfo)===null||M===void 0)?void 0:M.user_id,ItemUpdate:fe,CourseItem:$e,init:J}):null)),(O==null||((F=O.userInfo)===null||F===void 0)?void 0:F.user_id)===299635||(O==null||((j=O.userInfo)===null||j===void 0)?void 0:j.user_id)===301458||O!=null&&(W=O.userInfo)!==null&&W!==void 0&&W.admin||O!=null&&(k=O.userInfo)!==null&&k!==void 0&&k.business?T.a.createElement(G.a,Pe,T.a.createElement(V.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var f=tt.default=Object(y.a)(function(d){var a=d.user;return{user:a}})(c)},h78n:function(ft,tt,de){"use strict";de.d(tt,"a",function(){return b});var te=de("cDcd"),G=de.n(te),L=de("TSYQ"),V=de.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(j){var W=j.map(function(){return Object(te.useRef)()}),k=Object(te.useRef)();return Object(te.useEffect)(function(){var O=Date.now(),K=!1;Object.keys(W).forEach(function(Y){var q=W[Y].current;if(!q)return;K=!0;var ie=q.style;ie.transitionDuration=".3s, .3s, .3s, .06s",k.current&&O-k.current<100&&(ie.transitionDuration="0s, 0s")}),K&&(k.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(F[k]=W[k])}return F},B.apply(this,arguments)}function U(F,j){return R(F)||T(F,j)||D(F,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(F,j){if(!F)return;if(typeof F=="string")return g(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return g(F,j)}function g(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,k=new Array(j);W<j;W++)k[W]=F[W];return k}function T(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],k=!0,O=!1,K=void 0;try{for(var Y=F[Symbol.iterator](),q;!(k=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);k=!0);}catch(ie){O=!0,K=ie}finally{try{!k&&Y.return!=null&&Y.return()}finally{if(O)throw K}}return W}function R(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=w(F,j),k,O;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(F);for(O=0;O<K.length;O++){if(k=K[O],j.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,k))continue;W[k]=F[k]}}return W}function w(F,j){if(F==null)return{};var W={},k=Object.keys(F),O,K;for(K=0;K<k.length;K++){if(O=k[K],j.indexOf(O)>=0)continue;W[O]=F[O]}return W}var E=function(j){var W=j.className,k=j.percent,O=j.prefixCls,K=j.strokeColor,Y=j.strokeLinecap,q=j.strokeWidth,ie=j.style,Te=j.trailColor,ve=j.trailWidth,ge=j.transition,he=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete he.gapPosition;var ce=Array.isArray(k)?k:[k],ae=Array.isArray(K)?K:[K],me=P(ce),Q=U(me,1),ne=Q[0],Z=q/2,Ee=100-q/2,Ae="M ".concat(Y==="round"?Z:0,",").concat(Z,`
|
|
L `).concat(Y==="round"?Ee:100,",").concat(Z),be="0 0 100 ".concat(q),Se=0;return G.a.createElement("svg",B({className:V()("".concat(O,"-line"),W),viewBox:be,preserveAspectRatio:"none",style:ie},he),G.a.createElement("path",{className:"".concat(O,"-line-trail"),d:Ae,strokeLinecap:Y,stroke:Te,strokeWidth:ve||q,fillOpacity:"0"}),ce.map(function(Re,Fe){var Ie={strokeDasharray:"".concat(Re,"px, 100px"),strokeDashoffset:"-".concat(Se,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},ke=ae[Fe]||ae[ae.length-1];return Se+=Re,G.a.createElement("path",{key:Fe,className:"".concat(O,"-line-path"),d:Ae,strokeLinecap:Y,stroke:ke,strokeWidth:q,fillOpacity:"0",ref:ne[Fe],style:Ie})}))};E.defaultProps=I;var l=E;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(F[k]=W[k])}return F},o.apply(this,arguments)}function s(F,j){return A(F)||h(F,j)||S(F,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 S(F,j){if(!F)return;if(typeof F=="string")return p(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(F,j)}function p(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,k=new Array(j);W<j;W++)k[W]=F[W];return k}function h(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],k=!0,O=!1,K=void 0;try{for(var Y=F[Symbol.iterator](),q;!(k=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);k=!0);}catch(ie){O=!0,K=ie}finally{try{!k&&Y.return!=null&&Y.return()}finally{if(O)throw K}}return W}function A(F){if(Array.isArray(F))return F}function y(F,j){if(F==null)return{};var W=c(F,j),k,O;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(F);for(O=0;O<K.length;O++){if(k=K[O],j.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,k))continue;W[k]=F[k]}}return W}function c(F,j){if(F==null)return{};var W={},k=Object.keys(F),O,K;for(K=0;K<k.length;K++){if(O=k[K],j.indexOf(O)>=0)continue;W[O]=F[O]}return W}var f=0;function d(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function v(F,j,W,k){var O=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,Y=50-k/2,q=0,ie=-Y,Te=0,ve=-2*Y;switch(K){case"left":q=-Y,ie=0,Te=2*Y,ve=0;break;case"right":q=Y,ie=0,Te=-2*Y,ve=0;break;case"bottom":ie=Y,ve=2*Y;break;default:}var ge="M 50,50 m ".concat(q,",").concat(ie,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Te,",").concat(-ve,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Te,",").concat(ve),he=Math.PI*2*Y,ce={stroke:W,strokeDasharray:"".concat(j/100*(he-O),"px ").concat(he,"px"),strokeDashoffset:"-".concat(O/2+F/100*(he-O),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:ce}}var m=function(j){var W=j.prefixCls,k=j.strokeWidth,O=j.trailWidth,K=j.gapDegree,Y=j.gapPosition,q=j.trailColor,ie=j.strokeLinecap,Te=j.style,ve=j.className,ge=j.strokeColor,he=j.percent,ce=y(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(te.useMemo)(function(){return f+=1,f},[]),me=v(0,100,q,k,K,Y),Q=me.pathString,ne=me.pathStyle,Z=a(he),Ee=a(ge),Ae=Ee.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),be=P(Z),Se=s(be,1),Re=Se[0],Fe=function(){var ke=0;return Z.map(function(Oe,$e){var ze=Ee[$e]||Ee[Ee.length-1],Ve=Object.prototype.toString.call(ze)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ae,")"):"",Ge=v(ke,Oe,ze,k,K,Y);return ke+=Oe,G.a.createElement("path",{key:$e,className:"".concat(W,"-circle-path"),d:Ge.pathString,stroke:Ve,strokeLinecap:ie,strokeWidth:k,opacity:Oe===0?0:1,fillOpacity:"0",style:Ge.pathStyle,ref:Re[$e]})})};return G.a.createElement("svg",o({className:V()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Te},ce),Ae&&G.a.createElement("defs",null,G.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ae).sort(function(Ie,ke){return d(Ie)-d(ke)}).map(function(Ie,ke){return G.a.createElement("stop",{key:ke,offset:Ie,stopColor:Ae[Ie]})}))),G.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:Q,stroke:q,strokeLinecap:ie,strokeWidth:O||k,fillOpacity:"0",style:ne}),Fe().reverse())};m.defaultProps=I;var b=m,M={Line:l,Circle:b}},kSUc:function(ft,tt,de){},lZu9:function(ft,tt,de){(function(te){te(de("VrN/"),de("1eCo"),de("8EBN"))})(function(te){"use strict";te.defineMode("markdown",function(G,L){var V=te.getMode(G,"text/html"),I=V.name=="null";function P(k){if(te.findModeByName){var O=te.findModeByName(k);O&&(k=O.mime||O.mimes[0])}var K=te.getMode(G,k);return K.name=="null"?null:K}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 U in B)B.hasOwnProperty(U)&&L.tokenTypeOverrides[U]&&(B[U]=L.tokenTypeOverrides[U]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,T=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(k,O,K){return O.f=O.inline=K,K(k,O)}function u(k,O,K){return O.f=O.block=K,K(k,O)}function S(k){return!k||!/\S/.test(k.string)}function p(k){if(k.linkTitle=!1,k.linkHref=!1,k.linkText=!1,k.em=!1,k.strong=!1,k.strikethrough=!1,k.quote=0,k.indentedCode=!1,k.f==A){var O=I;if(!O){var K=te.innerMode(V,k.htmlState);O=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}O&&(k.f=d,k.block=h,k.htmlState=null)}return k.trailingSpace=0,k.trailingSpaceNewLine=!1,k.prevLine=k.thisLine,k.thisLine={stream:null},null}function h(k,O){var K=k.column()===O.indentation,Y=S(O.prevLine.stream),q=O.indentedCode,ie=O.prevLine.hr,Te=O.list!==!1,ve=(O.listStack[O.listStack.length-1]||0)+3;O.indentedCode=!1;var ge=O.indentation;if(O.indentationDiff===null&&(O.indentationDiff=O.indentation,Te)){for(O.list=null;ge<O.listStack[O.listStack.length-1];)O.listStack.pop(),O.listStack.length?O.indentation=O.listStack[O.listStack.length-1]:O.list=!1;O.list!==!1&&(O.indentationDiff=ge-O.listStack[O.listStack.length-1])}var he=!Y&&!ie&&!O.prevLine.header&&(!Te||!q)&&!O.prevLine.fencedCodeEnd,ce=(O.list===!1||ie||Y)&&O.indentation<=ve&&k.match(_),ae=null;if(O.indentationDiff>=4&&(q||O.prevLine.fencedCodeEnd||O.prevLine.header||Y))return k.skipToEnd(),O.indentedCode=!0,B.code;if(k.eatSpace())return null;if(K&&O.indentation<=ve&&(ae=k.match(T))&&ae[1].length<=6)return O.quote=0,O.header=ae[1].length,O.thisLine.header=!0,L.highlightFormatting&&(O.formatting="header"),O.f=O.inline,c(O);if(O.indentation<=ve&&k.eat(">"))return O.quote=K?1:O.quote+1,L.highlightFormatting&&(O.formatting="quote"),k.eatSpace(),c(O);if(!ce&&!O.setext&&K&&O.indentation<=ve&&(ae=k.match(D))){var me=ae[1]?"ol":"ul";return O.indentation=ge+k.current().length,O.list=!0,O.quote=0,O.listStack.push(O.indentation),O.em=!1,O.strong=!1,O.code=!1,O.strikethrough=!1,L.taskLists&&k.match(g,!1)&&(O.taskList=!0),O.f=O.inline,L.highlightFormatting&&(O.formatting=["list","list-"+me]),c(O)}else{if(K&&O.indentation<=ve&&(ae=k.match(w,!0)))return O.quote=0,O.fencedEndRE=new RegExp(ae[1]+"+ *$"),O.localMode=L.fencedCodeBlockHighlighting&&P(ae[2]||L.fencedCodeBlockDefaultMode),O.localMode&&(O.localState=te.startState(O.localMode)),O.f=O.block=y,L.highlightFormatting&&(O.formatting="code-block"),O.code=-1,c(O);if(O.setext||(!he||!Te)&&!O.quote&&O.list===!1&&!O.code&&!ce&&!E.test(k.string)&&(ae=k.lookAhead(1))&&(ae=ae.match(R)))return O.setext?(O.header=O.setext,O.setext=0,k.skipToEnd(),L.highlightFormatting&&(O.formatting="header")):(O.header=ae[0].charAt(0)=="="?1:2,O.setext=O.header),O.thisLine.header=!0,O.f=O.inline,c(O);if(ce)return k.skipToEnd(),O.hr=!0,O.thisLine.hr=!0,B.hr;if(k.peek()==="[")return s(k,O,M)}return s(k,O,O.inline)}function A(k,O){var K=V.token(k,O.htmlState);if(!I){var Y=te.innerMode(V,O.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||O.md_inside&&k.current().indexOf(">")>-1)&&(O.f=d,O.block=h,O.htmlState=null)}return K}function y(k,O){var K=O.listStack[O.listStack.length-1]||0,Y=O.indentation<K,q=K+3;if(O.fencedEndRE&&O.indentation<=q&&(Y||k.match(O.fencedEndRE))){L.highlightFormatting&&(O.formatting="code-block");var ie;return Y||(ie=c(O)),O.localMode=O.localState=null,O.block=h,O.f=d,O.fencedEndRE=null,O.code=0,O.thisLine.fencedCodeEnd=!0,Y?u(k,O,O.block):ie}else return O.localMode?O.localMode.token(k,O.localState):(k.skipToEnd(),B.code)}function c(k){var O=[];if(k.formatting){O.push(B.formatting),typeof k.formatting=="string"&&(k.formatting=[k.formatting]);for(var K=0;K<k.formatting.length;K++)O.push(B.formatting+"-"+k.formatting[K]),k.formatting[K]==="header"&&O.push(B.formatting+"-"+k.formatting[K]+"-"+k.header),k.formatting[K]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=k.quote?O.push(B.formatting+"-"+k.formatting[K]+"-"+k.quote):O.push("error"))}if(k.taskOpen)return O.push("meta"),O.length?O.join(" "):null;if(k.taskClosed)return O.push("property"),O.length?O.join(" "):null;if(k.linkHref?O.push(B.linkHref,"url"):(k.strong&&O.push(B.strong),k.em&&O.push(B.em),k.strikethrough&&O.push(B.strikethrough),k.emoji&&O.push(B.emoji),k.linkText&&O.push(B.linkText),k.code&&O.push(B.code),k.image&&O.push(B.image),k.imageAltText&&O.push(B.imageAltText,"link"),k.imageMarker&&O.push(B.imageMarker)),k.header&&O.push(B.header,B.header+"-"+k.header),k.quote&&(O.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=k.quote?O.push(B.quote+"-"+k.quote):O.push(B.quote+"-"+L.maxBlockquoteDepth)),k.list!==!1){var Y=(k.listStack.length-1)%3;Y?Y===1?O.push(B.list2):O.push(B.list3):O.push(B.list1)}return k.trailingSpaceNewLine?O.push("trailing-space-new-line"):k.trailingSpace&&O.push("trailing-space-"+(k.trailingSpace%2?"a":"b")),O.length?O.join(" "):null}function f(k,O){return k.match(C,!0)?c(O):void 0}function d(k,O){var K=O.text(k,O);if(typeof K!="undefined")return K;if(O.list)return O.list=null,c(O);if(O.taskList){var Y=k.match(g,!0)[1]===" ";return Y?O.taskOpen=!0:O.taskClosed=!0,L.highlightFormatting&&(O.formatting="task"),O.taskList=!1,c(O)}if(O.taskOpen=!1,O.taskClosed=!1,O.header&&k.match(/^#+$/,!0))return L.highlightFormatting&&(O.formatting="header"),c(O);var q=k.next();if(O.linkTitle){O.linkTitle=!1;var ie=q;q==="("&&(ie=")"),ie=(ie+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ie+"\\\\]+|\\\\\\\\|\\\\.)"+ie;if(k.match(new RegExp(Te),!0))return B.linkHref}if(q==="`"){var ve=O.formatting;L.highlightFormatting&&(O.formatting="code"),k.eatWhile("`");var ge=k.current().length;if(O.code==0&&(!O.quote||ge==1))return O.code=ge,c(O);if(ge==O.code){var he=c(O);return O.code=0,he}else return O.formatting=ve,c(O)}else if(O.code)return c(O);if(q==="\\"&&(k.next(),L.highlightFormatting)){var ce=c(O),ae=B.formatting+"-escape";return ce?ce+" "+ae:ae}if(q==="!"&&k.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return O.imageMarker=!0,O.image=!0,L.highlightFormatting&&(O.formatting="image"),c(O);if(q==="["&&O.imageMarker&&k.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return O.imageMarker=!1,O.imageAltText=!0,L.highlightFormatting&&(O.formatting="image"),c(O);if(q==="]"&&O.imageAltText){L.highlightFormatting&&(O.formatting="image");var ce=c(O);return O.imageAltText=!1,O.image=!1,O.inline=O.f=v,ce}if(q==="["&&!O.image)return O.linkText&&k.match(/^.*?\]/)||(O.linkText=!0,L.highlightFormatting&&(O.formatting="link")),c(O);if(q==="]"&&O.linkText){L.highlightFormatting&&(O.formatting="link");var ce=c(O);return O.linkText=!1,O.inline=O.f=k.match(/\(.*?\)| ?\[.*?\]/,!1)?v:d,ce}if(q==="<"&&k.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){O.f=O.inline=a,L.highlightFormatting&&(O.formatting="link");var ce=c(O);return ce?ce+=" ":ce="",ce+B.linkInline}if(q==="<"&&k.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){O.f=O.inline=a,L.highlightFormatting&&(O.formatting="link");var ce=c(O);return ce?ce+=" ":ce="",ce+B.linkEmail}if(L.xml&&q==="<"&&k.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=k.string.indexOf(">",k.pos);if(me!=-1){var Q=k.string.substring(k.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Q)&&(O.md_inside=!0)}return k.backUp(1),O.htmlState=te.startState(V),u(k,O,A)}if(L.xml&&q==="<"&&k.match(/^\/\w*?>/))return O.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ne=1,Z=k.pos==1?" ":k.string.charAt(k.pos-2);ne<3&&k.eat(q);)ne++;var Ee=k.peek()||" ",Ae=!/\s/.test(Ee)&&(!l.test(Ee)||/\s/.test(Z)||l.test(Z)),be=!/\s/.test(Z)&&(!l.test(Z)||/\s/.test(Ee)||l.test(Ee)),Se=null,Re=null;if(ne%2&&(!O.em&&Ae&&(q==="*"||!be||l.test(Z))?Se=!0:O.em==q&&be&&(q==="*"||!Ae||l.test(Ee))&&(Se=!1)),ne>1&&(!O.strong&&Ae&&(q==="*"||!be||l.test(Z))?Re=!0:O.strong==q&&be&&(q==="*"||!Ae||l.test(Ee))&&(Re=!1)),Re!=null||Se!=null){L.highlightFormatting&&(O.formatting=Se==null?"strong":Re==null?"em":"strong em"),Se===!0&&(O.em=q),Re===!0&&(O.strong=q);var he=c(O);return Se===!1&&(O.em=!1),Re===!1&&(O.strong=!1),he}}else if(q===" "&&(k.eat("*")||k.eat("_"))){if(k.peek()===" ")return c(O);k.backUp(1)}if(L.strikethrough){if(q==="~"&&k.eatWhile(q)){if(O.strikethrough){L.highlightFormatting&&(O.formatting="strikethrough");var he=c(O);return O.strikethrough=!1,he}else if(k.match(/^[^\s]/,!1))return O.strikethrough=!0,L.highlightFormatting&&(O.formatting="strikethrough"),c(O)}else if(q===" "&&k.match(/^~~/,!0)){if(k.peek()===" ")return c(O);k.backUp(2)}}if(L.emoji&&q===":"&&k.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){O.emoji=!0,L.highlightFormatting&&(O.formatting="emoji");var Fe=c(O);return O.emoji=!1,Fe}return q===" "&&(k.match(/^ +$/,!1)?O.trailingSpace++:O.trailingSpace&&(O.trailingSpaceNewLine=!0)),c(O)}function a(k,O){var K=k.next();if(K===">"){O.f=O.inline=d,L.highlightFormatting&&(O.formatting="link");var Y=c(O);return Y?Y+=" ":Y="",Y+B.linkInline}return k.match(/^[^>]+/,!0),B.linkInline}function v(k,O){if(k.eatSpace())return null;var K=k.next();return K==="("||K==="["?(O.f=O.inline=b(K==="("?")":"]"),L.highlightFormatting&&(O.formatting="link-string"),O.linkHref=!0,c(O)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(k){return function(O,K){var Y=O.next();if(Y===k){K.f=K.inline=d,L.highlightFormatting&&(K.formatting="link-string");var q=c(K);return K.linkHref=!1,q}return O.match(m[k]),K.linkHref=!0,c(K)}}function M(k,O){return k.match(/^([^\]\\]|\\.)*\]:/,!1)?(O.f=F,k.next(),L.highlightFormatting&&(O.formatting="link"),O.linkText=!0,c(O)):s(k,O,d)}function F(k,O){if(k.match(/^\]:/,!0)){O.f=O.inline=j,L.highlightFormatting&&(O.formatting="link");var K=c(O);return O.linkText=!1,K}return k.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(k,O){return k.eatSpace()?null:(k.match(/^[^\s]+/,!0),k.peek()===void 0?O.linkTitle=!0:k.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),O.f=O.inline=d,B.linkHref+" url")}var W={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(k){return{f:k.f,prevLine:k.prevLine,thisLine:k.thisLine,block:k.block,htmlState:k.htmlState&&te.copyState(V,k.htmlState),indentation:k.indentation,localMode:k.localMode,localState:k.localMode?te.copyState(k.localMode,k.localState):null,inline:k.inline,text:k.text,formatting:!1,linkText:k.linkText,linkTitle:k.linkTitle,linkHref:k.linkHref,code:k.code,em:k.em,strong:k.strong,strikethrough:k.strikethrough,emoji:k.emoji,header:k.header,setext:k.setext,hr:k.hr,taskList:k.taskList,list:k.list,listStack:k.listStack.slice(0),quote:k.quote,indentedCode:k.indentedCode,trailingSpace:k.trailingSpace,trailingSpaceNewLine:k.trailingSpaceNewLine,md_inside:k.md_inside,fencedEndRE:k.fencedEndRE}},token:function(k,O){if(O.formatting=!1,k!=O.thisLine.stream){if(O.header=0,O.hr=!1,k.match(/^\s*$/,!0))return p(O),null;if(O.prevLine=O.thisLine,O.thisLine={stream:k},O.taskList=!1,O.trailingSpace=0,O.trailingSpaceNewLine=!1,!O.localState&&(O.f=O.block,O.f!=A)){var K=k.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(O.indentation=K,O.indentationDiff=null,K>0)return null}}return O.f(k,O)},innerMode:function(k){return k.block==A?{state:k.htmlState,mode:V}:k.localState?{state:k.localState,mode:k.localMode}:{state:k,mode:W}},indent:function(k,O,K){return k.block==A&&V.indent?V.indent(k.htmlState,O,K):k.localState&&k.localMode.indent?k.localMode.indent(k.localState,O,K):te.Pass},blankLine:p,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),te.defineMIME("text/markdown","markdown"),te.defineMIME("text/x-markdown","markdown")})},osHv:function(ft,tt,de){(function(te){te(de("VrN/"))})(function(te){"use strict";var G=te.Pos;function L(l,o){return l.line-o.line||l.ch-o.ch}var V="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=V+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+V+"]["+I+"]*)","g");function B(l,o,s,u){this.line=o,this.ch=s,this.cm=l,this.text=l.getLine(o),this.min=u?Math.max(u.from,l.firstLine()):l.firstLine(),this.max=u?Math.min(u.to-1,l.lastLine()):l.lastLine()}function U(l,o){var s=l.cm.getTokenTypeAt(G(l.line,o));return s&&/\btag\b/.test(s)}function _(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function D(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function g(l){for(;;){var o=l.text.indexOf(">",l.ch);if(o==-1){if(_(l))continue;return}if(!U(l,o+1)){l.ch=o+1;continue}var s=l.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,u?"selfClose":"regular"}}function T(l){for(;;){var o=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(o==-1){if(D(l))continue;return}if(!U(l,o+1)){l.ch=o;continue}P.lastIndex=o,l.ch=o;var s=P.exec(l.text);if(s&&s.index==o)return s}}function R(l){for(;;){P.lastIndex=l.ch;var o=P.exec(l.text);if(!o){if(_(l))continue;return}if(!U(l,o.index+1)){l.ch=o.index+1;continue}return l.ch=o.index+o[0].length,o}}function C(l){for(;;){var o=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(o==-1){if(D(l))continue;return}if(!U(l,o+1)){l.ch=o;continue}var s=l.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(l.text.slice(s+1,o));return l.ch=o+1,u?"selfClose":"regular"}}function w(l,o){for(var s=[];;){var u=R(l),S,p=l.line,h=l.ch-(u?u[0].length:0);if(!u||!(S=g(l)))return;if(S=="selfClose")continue;if(u[1]){for(var A=s.length-1;A>=0;--A)if(s[A]==u[2]){s.length=A;break}if(A<0&&(!o||o==u[2]))return{tag:u[2],from:G(p,h),to:G(l.line,l.ch)}}else s.push(u[2])}}function E(l,o){for(var s=[];;){var u=C(l);if(!u)return;if(u=="selfClose"){T(l);continue}var S=l.line,p=l.ch,h=T(l);if(!h)return;if(h[1])s.push(h[2]);else{for(var A=s.length-1;A>=0;--A)if(s[A]==h[2]){s.length=A;break}if(A<0&&(!o||o==h[2]))return{tag:h[2],from:G(l.line,l.ch),to:G(S,p)}}}}te.registerHelper("fold","xml",function(l,o){for(var s=new B(l,o.line,0);;){var u=R(s);if(!u||s.line!=o.line)return;var S=g(s);if(!S)return;if(!u[1]&&S!="selfClose"){var p=G(s.line,s.ch),h=w(s,u[2]);return h&&L(h.from,p)>0?{from:p,to:h.from}:null}}}),te.findMatchingTag=function(l,o,s){var u=new B(l,o.line,o.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var S=g(u),p=S&&G(u.line,u.ch),h=S&&T(u);if(!S||!h||L(u,o)>0)return;var A={from:G(u.line,u.ch),to:p,tag:h[2]};return S=="selfClose"?{open:A,close:null,at:"open"}:h[1]?{open:E(u,h[2]),close:A,at:"close"}:(u=new B(l,p.line,p.ch,s),{open:A,close:w(u,h[2]),at:"open"})},te.findEnclosingTag=function(l,o,s,u){for(var S=new B(l,o.line,o.ch,s);;){var p=E(S,u);if(!p)break;var h=new B(l,o.line,o.ch,s),A=w(h,p.tag);if(A)return{open:p,close:A}}},te.scanForClosingTag=function(l,o,s,u){var S=new B(l,o.line,o.ch,u?{from:0,to:u}:null);return w(S,s)}})},"p77/":function(ft,tt,de){},rUJ1:function(ft,tt){const de=/[&<>"']/,te=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,V={"&":"&","<":"<",">":">",'"':""","'":"'"},I=y=>V[y];function P(y,c){if(c){if(de.test(y))return y.replace(te,I)}else if(G.test(y))return y.replace(L,I);return y}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(y){return y.replace(B,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const _=/(^|[^\[])\^/g;function D(y,c){y=y.source||y,c=c||"";const f={replace:(d,a)=>(a=a.source||a,a=a.replace(_,"$1"),y=y.replace(d,a),f),getRegex:()=>new RegExp(y,c)};return f}const g=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(y,c,f){if(y){let d;try{d=decodeURIComponent(U(f)).replace(g,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!T.test(f)&&(f=o(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const C={},w=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,c){C[" "+y]||(w.test(y)?C[" "+y]=y+"/":C[" "+y]=p(y,"/",!0)),y=C[" "+y];const f=y.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:y.replace(E,"$1")+c:c.charAt(0)==="/"?f?c:y.replace(l,"$1")+c:y+c}const s={exec:function(){}};function u(y){let c=1,f,d;for(;c<arguments.length;c++){f=arguments[c];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(y[d]=f[d])}return y}function S(y,c){const f=y.replace(/\|/g,(v,m,b)=>{let M=!1,F=m;for(;--F>=0&&b[F]==="\\";)M=!M;return M?"|":" |"}),d=f.split(/ \|/);let a=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function p(y,c,f){const d=y.length;if(d===0)return"";let a=0;for(;a<d;){const v=y.charAt(d-a-1);if(v===c&&!f)a++;else if(v!==c&&f)a++;else break}return y.substr(0,d-a)}function h(y,c){if(y.indexOf(c[1])===-1)return-1;const f=y.length;let d=0,a=0;for(;a<f;a++)if(y[a]==="\\")a++;else if(y[a]===c[0])d++;else if(y[a]===c[1]&&(d--,d<0))return a;return-1}function A(y){y&&y.sanitize&&!y.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ft.exports={escape:P,unescape:U,edit:D,cleanUrl:R,resolveUrl:o,noopTest:s,merge:u,splitCells:S,rtrim:p,findClosingBracket:h,checkSanitizeDeprecation:A}},ulZh:function(ft,tt,de){typeof window!="undefined"&&function(G,L){ft.exports=L()}(this,function(){return function(te){var G={};function L(V){if(G[V])return G[V].exports;var I=G[V]={i:V,l:!1,exports:{}};return te[V].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=te,L.c=G,L.d=function(V,I,P){L.o(V,I)||Object.defineProperty(V,I,{enumerable:!0,get:P})},L.r=function(V){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(V,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(V,"__esModule",{value:!0})},L.t=function(V,I){if(I&1&&(V=L(V)),I&8)return V;if(I&4&&typeof V=="object"&&V&&V.__esModule)return V;var P=Object.create(null);if(L.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:V}),I&2&&typeof V!="string")for(var B in V)L.d(P,B,function(U){return V[U]}.bind(null,B));return P},L.n=function(V){var I=V&&V.__esModule?function(){return V.default}:function(){return V};return L.d(I,"a",I),I},L.o=function(V,I){return Object.prototype.hasOwnProperty.call(V,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(te,G,L){"use strict";var V=Object.prototype.hasOwnProperty,I="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(I=!1));function B(g,T,R){this.fn=g,this.context=T,this.once=R||!1}function U(g,T,R,C,w){if(typeof R!="function")throw new TypeError("The listener must be a function");var E=new B(R,C||g,w),l=I?I+T:T;return g._events[l]?g._events[l].fn?g._events[l]=[g._events[l],E]:g._events[l].push(E):(g._events[l]=E,g._eventsCount++),g}function _(g,T){--g._eventsCount===0?g._events=new P:delete g._events[T]}function D(){this._events=new P,this._eventsCount=0}D.prototype.eventNames=function(){var T=[],R,C;if(this._eventsCount===0)return T;for(C in R=this._events)V.call(R,C)&&T.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(R)):T},D.prototype.listeners=function(T){var R=I?I+T:T,C=this._events[R];if(!C)return[];if(C.fn)return[C.fn];for(var w=0,E=C.length,l=new Array(E);w<E;w++)l[w]=C[w].fn;return l},D.prototype.listenerCount=function(T){var R=I?I+T:T,C=this._events[R];return C?C.fn?1:C.length:0},D.prototype.emit=function(T,R,C,w,E,l){var o=I?I+T:T;if(!this._events[o])return!1;var s=this._events[o],u=arguments.length,S,p;if(s.fn){s.once&&this.removeListener(T,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,R),!0;case 3:return s.fn.call(s.context,R,C),!0;case 4:return s.fn.call(s.context,R,C,w),!0;case 5:return s.fn.call(s.context,R,C,w,E),!0;case 6:return s.fn.call(s.context,R,C,w,E,l),!0}for(p=1,S=new Array(u-1);p<u;p++)S[p-1]=arguments[p];s.fn.apply(s.context,S)}else{var h=s.length,A;for(p=0;p<h;p++){s[p].once&&this.removeListener(T,s[p].fn,void 0,!0);switch(u){case 1:s[p].fn.call(s[p].context);break;case 2:s[p].fn.call(s[p].context,R);break;case 3:s[p].fn.call(s[p].context,R,C);break;case 4:s[p].fn.call(s[p].context,R,C,w);break;default:if(!S)for(A=1,S=new Array(u-1);A<u;A++)S[A-1]=arguments[A];s[p].fn.apply(s[p].context,S)}}}return!0},D.prototype.on=function(T,R,C){return U(this,T,R,C,!1)},D.prototype.once=function(T,R,C){return U(this,T,R,C,!0)},D.prototype.removeListener=function(T,R,C,w){var E=I?I+T:T;if(!this._events[E])return this;if(!R)return _(this,E),this;var l=this._events[E];if(l.fn)l.fn===R&&(!w||l.once)&&(!C||l.context===C)&&_(this,E);else{for(var o=0,s=[],u=l.length;o<u;o++)(l[o].fn!==R||w&&!l[o].once||C&&l[o].context!==C)&&s.push(l[o]);s.length?this._events[E]=s.length===1?s[0]:s:_(this,E)}return this},D.prototype.removeAllListeners=function(T){var R;return T?(R=I?I+T:T,this._events[R]&&_(this,R)):(this._events=new P,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,te.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(te,G,L){(function(V){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(D,g,T){if(T=T||{},D=D.trim(),g=g.trim(),!g){if(!T.alwaysNormalize)return D;var R=_.parseURL(D);if(!R)throw new Error("Error trying to parse base URL.");return R.path=_.normalizePath(R.path),_.buildURLFromParts(R)}var C=_.parseURL(g);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return T.alwaysNormalize?(C.path=_.normalizePath(C.path),_.buildURLFromParts(C)):g;var w=_.parseURL(D);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var E=P.exec(w.path);w.netLoc=E[1],w.path=E[2]}w.netLoc&&!w.path&&(w.path="/");var l={scheme:w.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(l.netLoc=w.netLoc,C.path[0]!=="/"))if(!C.path)l.path=w.path,C.params||(l.params=w.params,C.query||(l.query=w.query));else{var o=w.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;l.path=_.normalizePath(s)}return l.path===null&&(l.path=T.alwaysNormalize?_.normalizePath(C.path):C.path),_.buildURLFromParts(l)},parseURL:function(D){var g=I.exec(D);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(U,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};te.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(te,G,L){function V(T){var R={};function C(E){if(R[E])return R[E].exports;var l=R[E]={i:E,l:!1,exports:{}};return T[E].call(l.exports,l,l.exports,C),l.l=!0,l.exports}C.m=T,C.c=R,C.i=function(E){return E},C.d=function(E,l,o){C.o(E,l)||Object.defineProperty(E,l,{configurable:!1,enumerable:!0,get:o})},C.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},C.n=function(E){var l=E&&E.__esModule?function(){return E.default}:function(){return E};return C.d(l,"a",l),l},C.o=function(E,l){return Object.prototype.hasOwnProperty.call(E,l)},C.p="/",C.oe=function(E){throw console.error(E),E};var w=C(C.s=ENTRY_MODULE);return w.default||w}var I="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(T){return!isNaN(1*T)}function _(T,R,C){var w={};w[C]=[];var E=R.toString(),l=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return w;for(var o=l[1],s=new RegExp("(\\\\n|\\W)"+B(o)+P,"g"),u;u=s.exec(E);){if(u[3]==="dll-reference")continue;w[C].push(u[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+P,"g");u=s.exec(E);)T[u[2]]||(w[C].push(u[1]),T[u[2]]=L(u[1]).m),w[u[2]]=w[u[2]]||[],w[u[2]].push(u[4]);for(var S=Object.keys(w),p=0;p<S.length;p++)for(var h=0;h<w[S[p]].length;h++)U(w[S[p]][h])&&(w[S[p]][h]=1*w[S[p]][h]);return w}function D(T){var R=Object.keys(T);return R.reduce(function(C,w){return C||T[w].length>0},!1)}function g(T,R){for(var C={main:[R]},w={main:[]},E={main:{}};D(C);)for(var l=Object.keys(C),o=0;o<l.length;o++){var s=l[o],u=C[s],S=u.pop();if(E[s]=E[s]||{},E[s][S]||!T[s][S])continue;E[s][S]=!0,w[s]=w[s]||[],w[s].push(S);for(var p=_(T,T[s][S],s),h=Object.keys(p),A=0;A<h.length;A++)C[h[A]]=C[h[A]]||[],C[h[A]]=C[h[A]].concat(p[h[A]])}return w}te.exports=function(T,R){R=R||{};var C={main:L.m},w=R.all?{main:Object.keys(C.main)}:g(C,T),E="";Object.keys(w).filter(function(S){return S!=="main"}).forEach(function(S){for(var p=0;w[S][p];)p++;w[S].push(p),C[S][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+S+" = ("+V.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+w[S].map(function(h){return""+JSON.stringify(h)+": "+C[S][h].toString()}).join(",")+`});
|
|
`}),E=E+"new (("+V.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+w.main.map(function(S){return""+JSON.stringify(S)+": "+C.main[S].toString()}).join(",")+"}))(self);";var l=new window.Blob([E],{type:"text/javascript"});if(R.bare)return l;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(l),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"hlsDefaultConfig",function(){return A}),L.d(G,"mergeConfig",function(){return c}),L.d(G,"enableStreamingMode",function(){return f});var V=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),P=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),U=L("./src/controller/subtitle-track-controller.ts"),_=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),g=L("./src/controller/cap-level-controller.ts"),T=L("./src/controller/fps-controller.ts"),R=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),w=L("./src/utils/xhr-loader.ts"),E=L("./src/utils/fetch-loader.ts"),l=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(d){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(d[m]=v[m])}return d},u.apply(this,arguments)}function S(d,a){var v=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),v.push.apply(v,m)}return v}function p(d){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?S(Object(v),!0).forEach(function(m){h(d,m,v[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(v)):S(Object(v)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(v,m))})}return d}function h(d,a,v){return a in d?Object.defineProperty(d,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):d[a]=v,d}var A=p(p({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:V.default,bufferController:_.default,capLevelController:g.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:P.default,emeController:R.default,cmcdController:C.default});function y(){return{cueHandler:l.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 c(d,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({},d,a)}function f(d){var a=d.loader;if(a!==E.default&&a!==w.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var v=Object(E.fetchSupported)();v&&(d.loader=E.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),P=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/errors.ts"),_=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function g(C,w){for(var E=0;E<w.length;E++){var l=w[E];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function T(C,w,E){return w&&g(C.prototype,w),E&&g(C,E),C}var R=function(){function C(E){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=E;var l=E.config;this.bwEstimator=new I.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var w=C.prototype;return w.registerListeners=function(){var l=this.hls;l.on(P.Events.FRAG_LOADING,this.onFragLoading,this),l.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var l=this.hls;l.off(P.Events.FRAG_LOADING,this.onFragLoading,this),l.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(l,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)}},w.onLevelLoaded=function(l,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,S=s.config,p=s.media;if(!l||!p)return;var h=o?o.stats:l.stats,A=o?o.duration:l.duration;if(h.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||p.paused||!p.playbackRate||!p.readyState)return;var y=performance.now()-h.loading.start,c=Math.abs(p.playbackRate);if(y<=500*A/c)return;var f=s.levels,d=s.minAutoLevel,a=f[l.level],v=h.total||Math.max(h.loaded,Math.round(A*a.maxBitrate/8)),m=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/y),b=(v-h.loaded)/m,M=p.currentTime,F=(B.BufferHelper.bufferInfo(p,M,S.maxBufferHole).end-M)/c;if(F>=2*A/c||b<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=l.level-1;W>d;W--){var k=f[W].maxBitrate;if(j=A*k/(8*.8*m),j<F)break}if(j>=b)return;var O=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+l.sn+(o?" part "+o.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(V.isFiniteNumber)(O)?(O/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(y,h.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:o,stats:h})},w.onFragLoaded=function(l,o){var s=o.frag,u=o.part;if(s.type===_.PlaylistLevelType.MAIN&&Object(V.isFiniteNumber)(s.sn)){var S=u?u.stats:s.stats,p=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],A=(h.loaded?h.loaded.bytes:0)+S.loaded,y=(h.loaded?h.loaded.duration:0)+p;h.loaded={bytes:A,duration:y},h.realBitrate=Math.round(8*A/y)}if(s.bitrateTest){var c={stats:S,frag:s,part:u,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},w.onFragBuffered=function(l,o){var s=o.frag,u=o.part,S=u?u.stats:s.stats;if(S.aborted)return;if(s.type!==_.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var p=S.parsing.end-S.loading.start;this.bwEstimator.sample(p,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},w.onError=function(l,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var l=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.maxAutoLevel,S=s.config,p=s.minAutoLevel,h=s.media,A=o?o.duration:l?l.duration:0,y=h?h.currentTime:0,c=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,d=(B.BufferHelper.bufferInfo(h,y,S.maxBufferHole).end-y)/c,a=this.findBestLevel(f,p,u,d,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=A?Math.min(A,S.maxStarvationDelay):S.maxStarvationDelay,m=S.abrBandWidthFactor,b=S.abrBandWidthUpFactor;if(!d){var M=this.bitrateTestDelay;if(M){var F=A?Math.min(A,S.maxLoadingDelay):S.maxLoadingDelay;v=F-M,D.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),m=b=1}}return a=this.findBestLevel(f,p,u,d+v,m,b),Math.max(a,0)},w.findBestLevel=function(l,o,s,u,S,p){for(var h,A=this.fragCurrent,y=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],a=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),v=d==null?void 0:d.codecSet,m=y?y.duration:A?A.duration:0,b=s;b>=o;b--){var M=f[b];if(!M||v&&M.codecSet!==v)continue;var F=M.details,j=(y?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||m,W=void 0;b<=c?W=S*l:W=p*l;var k=f[b].maxBitrate,O=k*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(W)+"/"+k+"/"+j+"/"+u+"/"+O),W>k&&(!O||a&&!this.bitrateTestDelay||O<u))return b}return-1},T(C,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,o=this.bwEstimator;if(l!==-1&&(!o||!o.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),C}();G.default=R},"./src/controller/audio-stream-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),P=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/controller/fragment-tracker.ts"),_=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),g=L("./src/loader/fragment.ts"),T=L("./src/demux/chunk-cache.ts"),R=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),w=L("./src/controller/fragment-finders.ts"),E=L("./src/utils/discontinuities.ts"),l=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(A){for(var y=1;y<arguments.length;y++){var c=arguments[y];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(A[f]=c[f])}return A},s.apply(this,arguments)}function u(A,y){A.prototype=Object.create(y.prototype),A.prototype.constructor=A,S(A,y)}function S(A,y){return S=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},S(A,y)}var p=100,h=function(A){u(y,A);function y(f,d){var a;return a=A.call(this,f,d,"[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 c=y.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(P.Events.ERROR,this.onError,this),d.on(P.Events.BUFFER_RESET,this.onBufferReset,this),d.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(P.Events.ERROR,this.onError,this),d.off(P.Events.BUFFER_RESET,this.onBufferReset,this),d.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,a){var v=a.frag,m=a.id,b=a.initPTS;if(m==="main"){var M=v.cc;this.initPTS[v.cc]=b,this.log("InitPTS for cc: "+M+" found from main: "+b),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&d===-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=d,this.tick()},c.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var d,a=this.levels,v=this.trackId,m=a==null||((d=a[v])===null||d===void 0)?void 0:d.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var b,M=performance.now(),F=this.retryDate;(!F||M>=F||(b=this.media)!==null&&b!==void 0&&b.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,k=j.part,O=j.cache,K=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=O.flush(),q={frag:W,part:k,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(q),K&&A.prototype._handleFragmentLoadComplete.call(this,q)}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 ie=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,ie,this.config.maxBufferHole),ve=Object(w.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},c.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},c.doTickIdle=function(){var d,a,v=this.hls,m=this.levels,b=this.media,M=this.trackId,F=v.config;if(!m||!m[M])return;if(!b&&(this.startFragRequested||!F.startFragPrefetch))return;var j=m[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(k===null)return;var O=k.len,K=this.getMaxBufferLength(),Y=this.audioSwitch;if(O>=K&&!Y)return;if(!Y&&this._streamEnded(k,W)){v.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var q=W.fragments,ie=q[0].start,Te=k.end;if(Y){var ve=this.getLoadPosition();Te=ve,W.PTSKnown&&ve<ie&&((k.end>ie||k.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=ie+.05))}var ge=this.getNextFragment(Te,W);if(!ge){this.bufferFlushed=!0;return}((d=ge.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Te)},c.getMaxBufferLength=function(){var d=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},c.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(m){return new _.Level(m)})},c.onAudioTrackSwitching=function(d,a){var v=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(p):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,a){this.mainDetails=a.details},c.onAudioTrackLoaded=function(d,a){var v,m=this.levels,b=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var F=m[M],j=0;if(b.live||(v=F.details)!==null&&v!==void 0&&v.live){var W=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!W)return;!F.details&&b.hasProgramDateTime&&W.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(b,W),j=b.fragments[0].start):j=this.alignPlaylists(b,F.details)}F.details=b,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=I.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var a,v=d.frag,m=d.part,b=d.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var k=W.details;console.assert(k,"Audio track details are defined on fragment load progress");var O=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new R.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[v.cc],q=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var ie=!1,Te=m?m.index:-1,ve=Te!==-1,ge=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,b.byteLength,Te,ve);K.push(b,q,O,"",v,m,k.totalduration,ie,ge,Y)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+k.startSN+" ,"+k.endSN+"],track "+F);var he=this.waitingData=this.waitingData||{frag:v,part:m,cache:new T.default,complete:!1},ce=he.cache;ce.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},c.onFragBuffered=function(d,a){var v=a.frag,m=a.part;if(v.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(m?" p: "+m.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,m)},c.onError=function(d,a){switch(a.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.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 l.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var v=!0,m=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);m&&m.len>.5&&(v=!this.reduceMaxBufferLength(m.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(d,a){var v=a.type;v===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var a,v="audio",m=this.hls,b=d.remuxResult,M=d.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,k=b.audio,O=b.text,K=b.id3,Y=b.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&k&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,M),m.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:Y.tracks})),k){var q=k.startPTS,ie=k.endPTS,Te=k.startDTS,ve=k.endDTS;W&&(W.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ie,startDTS:Te,endDTS:ve}),j.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,q,ie,Te,ve),this.bufferFragmentData(k,j,W,M)}if(K!=null&&(a=K.samples)!==null&&a!==void 0&&a.length){var ge=s({frag:j,id:v},K);m.trigger(P.Events.FRAG_PARSING_METADATA,ge)}if(O){var he=s({frag:j,id:v},O);m.trigger(P.Events.FRAG_PARSING_USERDATA,he)}},c._bufferInitSegment=function(d,a,v){if(this.state!==I.State.PARSING)return;d.video&&delete d.video;var m=d.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,d);var b=m.initSegment;if(b!=null&&b.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:b};this.hls.trigger(P.Events.BUFFER_APPENDING,M)}this.tick()},c.loadFragment=function(d,a,v){var m=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||m===U.FragmentState.NOT_LOADED||m===U.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(V.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,d,a,v)))},c.completeAudioSwitch=function(){var d=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:v})},y}(I.default);G.default=h},"./src/controller/audio-track-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(R,C){for(var w=0;w<C.length;w++){var E=C[w];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(R,E.key,E)}}function _(R,C,w){return C&&U(R.prototype,C),w&&U(R,w),R}function D(R,C){R.prototype=Object.create(C.prototype),R.prototype.constructor=R,g(R,C)}function g(R,C){return g=Object.setPrototypeOf||function(E,l){return E.__proto__=l,E},g(R,C)}var T=function(R){D(C,R);function C(E){var l;return l=R.call(this,E,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var w=C.prototype;return w.registerListeners=function(){var l=this.hls;l.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(V.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(V.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(V.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var l=this.hls;l.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(V.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(V.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(V.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(l,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(l,o){var s=o.id,u=o.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var p=S.details;S.details=o.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,p))},w.onLevelLoading=function(l,o){this.switchLevel(o.level)},w.onLevelSwitching=function(l,o){this.switchLevel(o.level)},w.switchLevel=function(l){var o=this.hls.levels[l];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(p){return!s||p.groupId===s});this.selectDefaultTrack&&!u.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var S={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(V.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},w.onError=function(l,o){if(R.prototype.onError.call(this,l,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)},w.setAudioTrack=function(l){var o=this.tracksInGroup;if(l<0||l>=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 "+l);var u=o[l],S=u.id,p=u.groupId,h=p===void 0?"":p,A=u.name,y=u.type,c=u.url;if(this.trackId=l,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(V.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:h,name:A,type:y,url:c}),u.details&&!u.details.live)return;var f=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(f)},w.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.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(V.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(l){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var u=o[s];if((!this.selectDefaultTrack||u.default)&&(!l||l===u.name))return u.id}return-1},w.loadPlaylist=function(l){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,u=o.groupId,S=o.url;if(l)try{S=l.addDirectives(S)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(V.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:u,deliveryDirectives:l||null})}},_(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),C}(P.default);G.default=T},"./src/controller/base-playlist-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _});var V=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),P=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),U=L("./src/errors.ts"),_=function(){function D(T,R){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,R+":"),this.warn=B.logger.warn.bind(B.logger,R+":"),this.hls=T}var g=D.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(R,C){C.fatal&&C.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(R,C){var w=C==null?void 0:C.renditionReports;if(w)for(var E=0;E<w.length;E++){var l=w[E],o=""+l.URI;if(o===R.substr(-o.length)){var s=parseInt(l["LAST-MSN"]),u=parseInt(l["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);u!==void 0&&S>C.partTarget&&(u+=1)}if(Object(V.isFiniteNumber)(s))return new I.HlsUrlParameters(s,Object(V.isFiniteNumber)(u)?u:void 0,I.HlsSkip.No)}}},g.loadPlaylist=function(R){},g.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},g.playlistLoaded=function(R,C,w){var E=this,l=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||w!=null&&w.live){if(l.reloaded(w),w&&this.log("live playlist "+R+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),w&&l.fragments.length>0&&Object(P.mergeDetails)(w,l),!this.canLoad||!l.live)return;var u,S=void 0,p=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var h=this.hls.config.lowLatencyMode,A=l.lastPartSn,y=l.endSN,c=l.lastPartIndex,f=c!==-1,d=A===y,a=h?0:c;f?(S=d?y+1:A,p=d?a:c+1):S=y+1;var v=l.age,m=v+l.ageHeader,b=Math.min(m-l.partTarget,l.targetduration*1.5);if(b>0){if(w&&b>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+b+" with playlist age: "+l.age),b=0;else{var M=Math.floor(b/l.targetduration);if(S+=M,p!==void 0){var F=Math.round(b%l.targetduration/l.partTarget);p+=F}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+b+" skip sn "+M+" to part "+p)}l.tuneInGoal=b}if(u=this.getDeliveryDirectives(l,C.deliveryDirectives,S,p),h||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(l,C.deliveryDirectives,S,p);var j=Object(P.computeReloadInterval)(l,o);S!==void 0&&l.canBlockReload&&(j-=l.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(u)},j)}else this.clearTimer()},g.getDeliveryDirectives=function(R,C,w,E){var l=Object(I.getSkipValue)(R,w);return C!=null&&C.skip&&R.deltaUpdateFailed&&(w=C.msn,E=C.part,l=I.HlsSkip.No),new I.HlsUrlParameters(w,E,l)},g.retryLoadingOrFail=function(R){var C=this,w=this.hls.config,E=this.retryCount<w.levelLoadingMaxRetry;if(E){var l;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(l=R.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return E},D}()},"./src/controller/base-stream-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"State",function(){return y}),L.d(G,"default",function(){return c});var V=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),P=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/utils/logger.ts"),_=L("./src/events.ts"),D=L("./src/errors.ts"),g=L("./src/types/transmuxer.ts"),T=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),w=L("./src/controller/level-helper.ts"),E=L("./src/loader/fragment-loader.ts"),l=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function u(f,d){for(var a=0;a<d.length;a++){var v=d[a];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}function S(f,d,a){return d&&u(f.prototype,d),a&&u(f,a),f}function p(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,A(f,d)}function A(f,d){return A=Object.setPrototypeOf||function(v,m){return v.__proto__=m,v},A(f,d)}var y={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},c=function(f){h(d,f);function d(v,m,b){var M;return M=f.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=y.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=b,M.log=U.logger.log.bind(U.logger,b+":"),M.warn=U.logger.warn.bind(U.logger,b+":"),M.hls=v,M.fragmentLoader=new E.default(v.config),M.fragmentTracker=m,M.config=v.config,M.decrypter=new l.default(v,v.config),v.on(_.Events.KEY_LOADED,M.onKeyLoaded,p(M)),M}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(m,b){var M=this.fragCurrent,F=this.fragmentTracker;if(!b.live&&M&&M.sn===b.endSN&&!m.nextStart){var j=F.getState(M);return j===P.FragmentState.PARTIAL||j===P.FragmentState.OK}return!1},a.onMediaAttached=function(m,b){var M=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,b=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,k=B.BufferHelper.bufferInfo(F||M,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(V.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===y.ENDED)this.resetLoadingState();else if(b&&!k.len){var O=m.maxFragLookUpTolerance,K=b.start-O,Y=b.start+b.duration+O,q=W>Y;(W<K||q)&&(q&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!k.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,b){if(this.state!==y.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var M=this.levels[b.frag.level].details;M&&this.loadFragment(b.frag,M,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.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,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,b){this.log("Loading key for "+m.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=y.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(_.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,b,M){this._loadFragForPlayback(m,b,M)},a._loadFragForPlayback=function(m,b,M){var F=this,j=function(k){if(F.fragContextChanged(m)){F.warn("Fragment "+m.sn+(k.part?" p: "+k.part.index:"")+" of level "+m.level+" was dropped during download."),F.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,F._handleFragmentLoadProgress(k)};this._doFragLoad(m,b,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var k=F.state;if(F.fragContextChanged(m)){(k===y.FRAG_LOADING||k===y.BACKTRACKING||!F.fragCurrent&&k===y.PARSING)&&(F.fragmentTracker.removeFragment(m),F.state=y.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+m.sn+" of level "+m.level),F.hls.trigger(_.Events.FRAG_LOADED,W),F.state===y.BACKTRACKING)){F.fragmentTracker.backtrack(m,W),F.resetFragmentLoading(m);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,b,M){if(M===void 0&&(M=null),!(m-b))return;var F={startOffset:m,endOffset:b,type:M};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(m){var b=this;this._doFragLoad(m).then(function(M){if(!M||b.fragContextChanged(m)||!b.levels)throw new Error("init load aborted");return M}).then(function(M){var F=b.hls,j=M.payload,W=m.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var k=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(O){var K=self.performance.now();return F.trigger(_.Events.FRAG_DECRYPTED,{frag:m,payload:O,stats:{tstart:k,tdecrypt:K}}),M.payload=O,M})}return M}).then(function(M){var F=b.fragCurrent,j=b.hls,W=b.levels;if(!W)throw new Error("init load aborted, missing levels");var k=W[m.level].details;console.assert(k,"Level details are defined when init segment is loaded");var O=m.stats;b.state=y.IDLE,b.fragLoadError=0,m.data=new Uint8Array(M.payload),O.parsing.start=O.buffering.start=self.performance.now(),O.parsing.end=O.buffering.end=self.performance.now(),M.frag===F&&j.trigger(_.Events.FRAG_BUFFERED,{stats:O,frag:F,part:null,id:m.type}),b.tick()}).catch(function(M){b.warn(M),b.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var b=this.fragCurrent;return!m||!b||m.level!==b.level||m.sn!==b.sn||m.urlId!==b.urlId},a.fragBufferedComplete=function(m,b){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var b=this.transmuxer;if(!b)return;var M=m.frag,F=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(O){return!O}),k=new g.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);b.flush(k)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,b,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&b){var W=b.partList;if(W&&F){M>m.end&&b.fragmentHint&&(m=b.fragmentHint);var k=this.getNextPart(W,m,M);if(k>-1){var O=W[k];return this.log("Loading part sn: "+m.sn+" p: "+O.index+" cc: "+m.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+k+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=O.start+O.duration,this.state=y.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:m,part:W[k],targetBufferTime:M}),this.doFragPartsLoad(m,W,k,F).catch(function(K){return j.handleFragLoadError(K)})}else if(!m.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(V.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=y.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,F).catch(function(K){return j.handleFragLoadError(K)})},a.doFragPartsLoad=function(m,b,M,F){var j=this;return new Promise(function(W,k){var O=[],K=function Y(q){var ie=b[q];j.fragmentLoader.loadPart(m,ie,F).then(function(Te){O[ie.index]=Te;var ve=Te.part;j.hls.trigger(_.Events.FRAG_LOADED,Te);var ge=b[q+1];if(ge&&ge.fragment===m)Y(q+1);else return W({frag:m,part:ve,partsLoaded:O})}).catch(k)};K(M)})},a.handleFragLoadError=function(m){var b=m.data;return b&&b.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(_.Events.ERROR,b),null},a._handleTransmuxerFlush=function(m){var b=this.getCurrentContext(m);if(!b||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var M=b.frag,F=b.part,j=b.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,m.partial)},a.getCurrentContext=function(m){var b=this.levels,M=m.level,F=m.sn,j=m.part;if(!b||!b[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=b[M],k=j>-1?Object(w.getPartWith)(W,F,j):null,O=k?k.fragment:Object(w.getFragmentWithSN)(W,F,this.fragCurrent);return O?{frag:O,part:k,level:W}:null},a.bufferFragmentData=function(m,b,M,F){if(!m||this.state!==y.PARSING)return;var j=m.data1,W=m.data2,k=j;if(j&&W&&(k=Object(T.appendUint8Array)(j,W)),!k||!k.length)return;var O={type:m.type,frag:b,part:M,chunkMeta:F,parent:b.type,data:k};this.hls.trigger(_.Events.BUFFER_APPENDING,O),m.dropped&&m.independent&&!M&&this.flushBufferGap(b)},a.flushBufferGap=function(m){var b=this.media;if(!b)return;if(!B.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,m.start);return}var M=b.currentTime,F=B.BufferHelper.bufferInfo(b,M,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),k=Math.max(Math.min(m.start-W,F.end-W),M+W);m.start-k>W&&this.flushMainBuffer(k,m.start)},a.getFwdBufferInfo=function(m,b){var M=this.config,F=this.getLoadPosition();if(!Object(V.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(m,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,b);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(m,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(m){var b=this.config,M;return m?M=Math.max(8*b.maxBufferSize/m,b.maxBufferLength):M=b.maxBufferLength,Math.min(M,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var b=this.config,M=m||b.maxBufferLength;return b.maxMaxBufferLength>=M?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,b){var M,F,j=b.fragments,W=j.length;if(!W)return null;var k=this.config,O=j[0].start,K;if(b.live){var Y=k.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(b,j),this.startPosition=K?this.hls.liveSyncPosition||K.start:m)}else m<=O&&(K=j[0]);if(!K){var q=k.lowLatencyMode?b.partEnd:b.fragmentEnd;K=this.getFragmentAtPosition(m,q,b)}return(M=K)!==null&&M!==void 0&&M.initSegment&&!((F=K)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},a.getNextPart=function(m,b,M){for(var F=-1,j=!1,W=!0,k=0,O=m.length;k<O;k++){var K=m[k];if(W=W&&!K.independent,F>-1&&M<K.start)break;var Y=K.loaded;!Y&&(j||K.independent||W)&&K.fragment===b&&(F=k),j=Y}return F},a.loadedEndOfParts=function(m,b){var M=m[m.length-1];return M&&b>M.start&&M.loaded},a.getInitialLiveFragment=function(m,b){var M=this.fragPrevious,F=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(b,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=b[j-m.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(b,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var k=this.hls.liveSyncPosition;k!==null&&(F=this.getFragmentAtPosition(k,this.bitrateTest?m.fragmentEnd:m.edge,m))}return F},a.getFragmentAtPosition=function(m,b,M){var F=this.config,j=this.fragPrevious,W=M.fragments,k=M.endSN,O=M.fragmentHint,K=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&O);Y&&O&&!this.bitrateTest&&(W=W.concat(O),k=O.sn);var q;if(m<b){var ie=m>b-K?0:K;q=Object(C.findFragmentByPTS)(j,W,m,ie)}else q=W[W.length-1];if(q){var Te=q.sn-M.startSN,ve=j&&q.level===j.level,ge=W[Te+1],he=this.fragmentTracker.getState(q);if(he===P.FragmentState.BACKTRACKED){q=null;for(var ce=Te;W[ce]&&this.fragmentTracker.getState(W[ce])===P.FragmentState.BACKTRACKED;)j?q=W[ce--]:q=W[--ce];q||(q=ge)}else j&&q.sn===j.sn&&!Y&&(ve&&(q.sn<k&&this.fragmentTracker.getState(ge)!==P.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+ge.sn),q=ge):q=null))}return q},a.synchronizeToLiveEdge=function(m){var b=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=m.fragments[0].start,k=m.edge,O=j>=W-b.maxFragLookUpTolerance&&j<=k;if(F!==null&&M.duration>F&&(j<F||!O)){var K=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*m.targetduration;(!O&&M.readyState<4||j<k-K)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+k+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(m,b){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,k=m.fragments.length;if(!k)return this.warn("No fragments in live playlist"),0;var O=m.fragments[0].start,K=!b,Y=m.alignedSliding&&Object(V.isFiniteNumber)(O);if(K||!Y&&!O){Object(R.alignStream)(j,W,m);var q=m.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+k),q}return O},a.waitForCdnTuneIn=function(m){var b=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*b)},a.setStartPosition=function(m,b){var M=this.startPosition;if(M<b&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=m.startTimeOffset;Object(V.isFiniteNumber)(F)?(M=b+F,F<0&&(M+=m.totalduration),M=Math.min(Math.max(b,M),b+m.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||b:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,b=0;return this.loadedmetadata&&m?b=m.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(m,b){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(b?" part"+b.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(m,b){if(b.fatal)return;var M=b.frag;if(!M||M.type!==m)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(m===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(U.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(m,b,M){if(!m)return;var F=B.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(b,F,M),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[m].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,b,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var k=Object.keys(m.elementaryStreams).reduce(function(O,K){var Y=m.elementaryStreams[K];if(Y){var q=Y.endPTS-Y.startPTS;if(q<=0)return j.warn("Could not parse fragment "+m.sn+" "+K+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),O||!1;var ie=F?0:Object(w.updateFragPTSDTS)(W,m,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:ie,type:K,frag:m,start:Y.startPTS,end:Y.endPTS}),!0}return O},!1);k?(this.state=y.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:m,part:b})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(d,[{key:"state",get:function(){return this._state},set:function(m){var b=this._state;b!==m&&(this._state=m,this.log(b+"->"+m))}}]),d}(I.default)},"./src/controller/buffer-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C});var V=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),U=L("./src/utils/buffer-helper.ts"),_=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),g=L("./src/controller/buffer-operation-queue.ts"),T=Object(_.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function w(l){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,S=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),s.trigger(I.Events.MEDIA_ATTACHED,{media:u})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var E=w.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.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)},E.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)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,s){var u=this.media=s.media;if(u&&T){var S=this.mediaSource=new T;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(S),this._objectUrl=u.src}},E.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){P.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},E.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(S){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,s){var u=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(p){if(S){var h=u.tracks[p];if(h&&typeof h.buffer.changeType=="function"){var A=s[p],y=A.codec,c=A.levelCodec,f=A.container,d=(h.levelCodec||h.codec).replace(R,"$1"),a=(c||y).replace(R,"$1");if(d!==a){var v=f+";codecs="+(c||y);u.appendChangeType(p,v)}}}else u.pendingTracks[p]=s[p]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,s){var u=this,S=this.operationQueue,p={execute:function(){var A=u.sourceBuffer[o];A&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),A.changeType(s)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};S.append(p,o)},E.onBufferAppending=function(o,s){var u=this,S=this.hls,p=this.operationQueue,h=this.tracks,A=s.data,y=s.type,c=s.frag,f=s.part,d=s.chunkMeta,a=d.buffering[y],v=self.performance.now();a.start=v;var m=c.stats.buffering,b=f?f.stats.buffering:null;m.start===0&&(m.start=v),b&&b.start===0&&(b.start=v);var M=h.audio,F=y==="audio"&&d.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var k=u.sourceBuffer[y];if(k){var O=c.start-k.timestampOffset;Math.abs(O)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+O+") sn: "+c.sn+")"),k.timestampOffset=c.start)}}u.appendExecutor(A,y)},onStart:function(){},onComplete:function(){var k=self.performance.now();a.executeEnd=a.end=k,m.first===0&&(m.first=k),b&&b.first===0&&(b.first=k);var O=u.sourceBuffer,K={};for(var Y in O)K[Y]=U.BufferHelper.getBuffered(O[Y]);u.appendError=0,u.hls.trigger(I.Events.BUFFER_APPENDED,{type:y,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:K})},onError:function(k){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",k);var O={type:B.ErrorTypes.MEDIA_ERROR,parent:c.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:k,fatal:!1};k.code===DOMException.QUOTA_EXCEEDED_ERR?O.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,O.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>S.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),O.fatal=!0)),S.trigger(I.Events.ERROR,O)}};p.append(j,y)},E.onBufferFlushing=function(o,s){var u=this,S=this.operationQueue,p=function(A){return{execute:u.removeExecutor.bind(u,A,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(I.Events.BUFFER_FLUSHED,{type:A})},onError:function(c){P.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",c)}}};s.type?S.append(p(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){S.append(p(h),h)})},E.onFragParsed=function(o,s){var u=this,S=s.frag,p=s.part,h=[],A=p?p.elementaryStreams:S.elementaryStreams;A[D.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(A[D.ElementaryStreamTypes.AUDIO]&&h.push("audio"),A[D.ElementaryStreamTypes.VIDEO]&&h.push("video"));var y=function(){var f=self.performance.now();S.stats.buffering.end=f,p&&(p.stats.buffering.end=f);var d=p?p.stats:S.stats;u.hls.trigger(I.Events.FRAG_BUFFERED,{frag:S,part:p,stats:d,id:S.type})};h.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(y,h)},E.onFragChanged=function(o,s){this.flushBackBuffer()},E.onBufferEos=function(o,s){var u=this,S=this.getSourceBufferTypes().reduce(function(p,h){var A=u.sourceBuffer[h];return(!s.type||s.type===h)&&(A&&!A.ended&&(A.ended=!0,P.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),p&&!!(!A||A.ended)},!0);S&&this.blockBuffers(function(){var p=u.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},E.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()},E.flushBackBuffer=function(){var o=this.hls,s=this.details,u=this.media,S=this.sourceBuffer;if(!u||s===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var h=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(V.isFiniteNumber)(h)||h<0)return;var A=u.currentTime,y=s.levelTargetDuration,c=Math.max(h,y),f=Math.floor(A/y)*y-c;p.forEach(function(d){var a=S[d];if(a){var v=U.BufferHelper.getBuffered(a);v.length>0&&f>v.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),s.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,u=this.media,S=this.mediaSource,p=o.fragments[0].start+o.totalduration,h=u.duration,A=Object(V.isFiniteNumber)(S.duration)?S.duration:0;o.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(p>A&&p>h||!Object(V.isFiniteNumber)(h))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),S.duration=p)},E.updateSeekableRange=function(o){var s=this.mediaSource,u=o.fragments,S=u.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var p=Math.max(0,u[0].start),h=Math.max(p,p+o.totalduration);s.setLiveSeekableRange(p,h)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,S=Object.keys(u).length;if(S&&!o||S===2){this.createSourceBuffers(u),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(h){s.executeNext(h)})}},E.createSourceBuffers=function(o){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var p in o)if(!s[p]){var h=o[p];if(!h)throw Error("source buffer exists for track "+p+", however track does not");var A=h.levelCodec||h.codec,y=h.container+";codecs="+A;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var c=s[p]=u.addSourceBuffer(y),f=p;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[p]={buffer:c,codec:A,container:h.container,levelCodec:h.levelCodec,id:h.id},S++}catch(d){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:y})}}S&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var s=this.operationQueue,u=s.current(o);u.onStart()},E._onSBUpdateEnd=function(o){var s=this.operationQueue,u=s.current(o);u.onComplete(),s.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,s){P.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)},E.removeExecutor=function(o,s,u){var S=this.media,p=this.mediaSource,h=this.operationQueue,A=this.sourceBuffer,y=A[o];if(!S||!p||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}var c=Object(V.isFiniteNumber)(S.duration)?S.duration:Infinity,f=Object(V.isFiniteNumber)(p.duration)?p.duration:Infinity,d=Math.max(0,s),a=Math.min(u,c,f);a>d?(P.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(d,a)):h.shiftAndExecuteNext(o)},E.appendExecutor=function(o,s){var u=this.operationQueue,S=this.sourceBuffer,p=S[s];if(!p){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}p.ended=!1,console.assert(!p.updating,s+" sourceBuffer must not be updating"),p.appendBuffer(o)},E.blockBuffers=function(o,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,p=s.map(function(h){return S.appendBlocker(h)});Promise.all(p).then(function(){o(),s.forEach(function(h){var A=u.sourceBuffer[h];(!A||!A.updating)&&S.shiftAndExecuteNext(h)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,s,u){var S=this.sourceBuffer[o];if(!S)return;var p=u.bind(this,o);this.listeners[o].push({event:s,listener:p}),S.addEventListener(s,p)},E.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(u){s.removeEventListener(u.event,u.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return I});var V=L("./src/utils/logger.ts"),I=function(){function P(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=P.prototype;return B.append=function(_,D){var g=this.queues[D];g.push(_),g.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(_,D){var g=this.queues[D];g.unshift(_),this.executeNext(D)},B.appendBlocker=function(_){var D,g=new Promise(function(R){D=R}),T={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,_),g},B.executeNext=function(_){var D=this.buffers,g=this.queues,T=D[_],R=g[_];if(R.length){var C=R[0];try{C.execute()}catch(w){V.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(w),(!T||!T.updating)&&(R.shift(),this.executeNext(_))}}},B.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},B.current=function(_){return this.queues[_][0]},P}()},"./src/controller/cap-level-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/events.ts");function I(U,_){for(var D=0;D<_.length;D++){var g=_[D];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(U,g.key,g)}}function P(U,_,D){return _&&I(U.prototype,_),D&&I(U,D),U}var B=function(){function U(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 _=U.prototype;return _.setStreamController=function(g){this.streamController=g},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var g=this.hls;g.on(V.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(V.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var g=this.hls;g.off(V.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(V.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(g,T){U.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},_.onMediaAttaching=function(g,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},_.onManifestParsed=function(g,T){var R=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,R.config.capLevelToPlayerSize&&T.video&&this.startCapping()},_.onBufferCodecs=function(g,T){var R=this.hls;R.config.capLevelToPlayerSize&&T.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(g.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},_.getMaxLevel=function(g){var T=this,R=this.hls.levels;if(!R.length)return-1;var C=R.filter(function(w,E){return U.isLevelAllowed(E,T.restrictedLevels)&&E<=g});return this.clientRect=null,U.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 g=this.media,T={width:0,height:0};if(g){var R=g.getBoundingClientRect();T.width=R.width,T.height=R.height,!T.width&&!T.height&&(T.width=R.right-R.left||g.width||0,T.height=R.bottom-R.top||g.height||0)}return this.clientRect=T,T},U.isLevelAllowed=function(g,T){return T===void 0&&(T=[]),T.indexOf(g)===-1},U.getMaxLevelByMediaSize=function(g,T,R){if(!g||!g.length)return-1;for(var C=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},w=g.length-1,E=0;E<g.length;E+=1){var l=g[E];if((l.width>=T||l.height>=R)&&C(l,g[E+1])){w=E;break}}return w},P(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(T){}return g}}]),U}();G.default=B},"./src/controller/cmcd-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C});var V=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),P=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function U(w,E){for(var l=0;l<E.length;l++){var o=E[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function _(w,E,l){return E&&U(w.prototype,E),l&&U(w,l),w}function D(w,E){var l=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(l)return(l=l.call(w)).next.bind(l);if(Array.isArray(w)||(l=g(w))||E&&w&&typeof w.length=="number"){l&&(w=l);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[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 g(w,E){if(!w)return;if(typeof w=="string")return T(w,E);var l=Object.prototype.toString.call(w).slice(8,-1);if(l==="Object"&&w.constructor&&(l=w.constructor.name),l==="Map"||l==="Set")return Array.from(w);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return T(w,E)}function T(w,E){(E==null||E>w.length)&&(E=w.length);for(var l=0,o=new Array(E);l<E;l++)o[l]=w[l];return o}function R(){return R=Object.assign||function(w){for(var E=1;E<arguments.length;E++){var l=arguments[E];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(w[o]=l[o])}return w},R.apply(this,arguments)}var C=function(){function w(l){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(S){try{o.apply(S,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(S){try{var p=S.frag,h=o.hls.levels[p.level],A=o.getObjectType(p),y={d:p.duration*1e3,ot:A};(A===I.CMCDObjectType.VIDEO||A===I.CMCDObjectType.AUDIO||A==I.CMCDObjectType.MUXED)&&(y.br=h.bitrate/1e3,y.tb=o.getTopBandwidth(A),y.bl=o.getBufferLength(A)),o.apply(S,y)}catch(c){B.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=l;var s=this.config=l.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||w.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var E=w.prototype;return E.registerListeners=function(){var o=this.hls;o.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(V.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var o=this.hls;o.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(V.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(o,s){var u,S;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},E.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}},E.apply=function(o,s){s===void 0&&(s={}),R(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 S=w.toHeaders(s);if(!Object.keys(S).length)return;o.headers||(o.headers={}),R(o.headers,S)}else{var p=w.toQuery(s);if(!p)return;o.url=w.appendQueryToUri(o.url,p)}},E.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},E.getTopBandwidth=function(o){for(var s=0,u=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=D(u),p;!(p=S()).done;){var h=p.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},E.getBufferLength=function(o){var s=this.hls.media,u=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var S=P.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return S.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,u=o||this.config.loader;return function(){function S(h){this.loader=void 0,this.loader=new u(h)}var p=S.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,y,c){s(A),this.loader.load(A,y,c)},_(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},E.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,u=o||this.config.loader;return function(){function S(h){this.loader=void 0,this.loader=new u(h)}var p=S.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,y,c){s(A),this.loader.load(A,y,c)},_(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},w.serialize=function(o){for(var s=[],u=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},S=function(F){return Math.round(F)},p=function(F){return S(F/100)*100},h=function(F){return encodeURIComponent(F)},A={br:S,d:S,bl:p,dl:p,mtp:p,nor:h,rtp:p,tb:S},y=Object.keys(o||{}).sort(),c=D(y),f;!(f=c()).done;){var d=f.value,a=o[d];if(!u(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var v=A[d];v&&(a=v(a));var m=typeof a,b=void 0;d==="ot"||d==="sf"||d==="st"?b=d+"="+a:m==="boolean"?b=d:m==="number"?b=d+"="+a:b=d+"="+JSON.stringify(a),s.push(b)}return s.join(",")},w.toHeaders=function(o){for(var s=Object.keys(o),u={},S=["Object","Request","Session","Status"],p=[{},{},{},{}],h={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,y=s;A<y.length;A++){var c=y[A],f=h[c]!=null?h[c]:1;p[f][c]=o[c]}for(var d=0;d<p.length;d++){var a=w.serialize(p[d]);a&&(u["CMCD-"+S[d]]=a)}return u},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,s){if(!s)return o;var u=o.includes("?")?"&":"?";return""+o+u+s},w}()},"./src/controller/eme-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function U(C,w){for(var E=0;E<w.length;E++){var l=w[E];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function _(C,w,E){return w&&U(C.prototype,w),E&&U(C,E),C}var D=3,g=function(w,E,l){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),E.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[o]},T=function(w,E,l,o){switch(w){case B.KeySystems.WIDEVINE:return g(E,l,o);default:throw new Error("Unknown key-system: "+w)}},R=function(){function C(E){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=E,this._config=E.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 w=C.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(V.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(l){switch(l){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},w._attemptKeySystemAccess=function(l,o,s){var u=this,S=T(l,o,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(l,S);this.mediaKeysPromise=p.then(function(h){return u._onMediaKeySystemAccessObtained(l,h)}),p.catch(function(h){P.logger.error('Failed to obtain key-system "'+l+'" access:',h)})},w._onMediaKeySystemAccessObtained=function(l,o){var s=this;P.logger.log('Access for key-system "'+l+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:l};this._mediaKeysList.push(u);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return u.mediaKeys=p,P.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),p});return S.catch(function(p){P.logger.error("Failed to create media-keys:",p)}),S},w._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),l._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(l){var o=this;P.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){o._onKeySessionMessage(l,s.message)},!1)},w._onKeySessionMessage=function(l,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},w.onMediaEncrypted=function(l){var o=this;if(P.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},w._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(l,o){var s=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var S=u.mediaKeysSession;if(!S){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+l+'" init data type'),u.mediaKeysSessionInitialized=!0,S.generateRequest(l,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(p){P.logger.error("Error generating key-session request:",p),s.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(l,o,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,l,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,u,l),S=void 0}catch(p){P.logger.error(p)}try{u.readyState||u.open("POST",l,!0),S&&S.call(this.hls,u,l)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return u},w._onLicenseRequestReadyStageChange=function(l,o,s,u){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var S=l.response,p=this._licenseResponseCallback;if(p)try{S=p.call(this.hls,l,o)}catch(A){P.logger.error(A)}u(S)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=D-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,u)}break}},w._generateLicenseRequestChallenge=function(l,o){switch(l.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},w._requestLicense=function(l,o){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(V.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),S=this._createLicenseXhr(u,l,o);P.logger.log("Sending license request to URL: "+u);var p=this._generateLicenseRequestChallenge(s,l);S.send(p)}catch(h){P.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(l,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var l=this._media,o=this._mediaKeysList;if(!l)return;l.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 l.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(l,o){if(!this._emeEnabled)return;var s=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),u=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});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}();G.default=R},"./src/controller/fps-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/events.ts"),I=L("./src/utils/logger.ts"),P=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 U=B.prototype;return U.setStreamController=function(D){this.streamController=D},U.registerListeners=function(){this.hls.on(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(V.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(D,g){var T=this.hls.config;if(T.capLevelOnFPSDrop){var R=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(D,g,T){var R=performance.now();if(g){if(this.lastTime){var C=R-this.lastTime,w=T-this.lastDroppedFrames,E=g-this.lastDecodedFrames,l=1e3*w/C,o=this.hls;if(o.trigger(V.Events.FPS_DROP,{currentDropped:w,currentDecoded:E,totalDroppedFrames:T}),l>0&&w>o.config.fpsDroppedMonitoringThreshold*E){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(V.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=T,this.lastDecodedFrames=g}},U.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var g=D.getVideoPlaybackQuality();this.checkFPS(D,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();G.default=P},"./src/controller/fragment-finders.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"findFragmentByPDT",function(){return P}),L.d(G,"findFragmentByPTS",function(){return B}),L.d(G,"fragmentWithinToleranceTest",function(){return U}),L.d(G,"pdtWithinToleranceTest",function(){return _}),L.d(G,"findFragWithCC",function(){return D});var V=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function P(g,T,R){if(T===null||!Array.isArray(g)||!g.length||!Object(V.isFiniteNumber)(T))return null;var C=g[0].programDateTime;if(T<(C||0))return null;var w=g[g.length-1].endProgramDateTime;if(T>=(w||0))return null;R=R||0;for(var E=0;E<g.length;++E){var l=g[E];if(_(T,R,l))return l}return null}function B(g,T,R,C){R===void 0&&(R=0),C===void 0&&(C=0);var w=null;if(g?w=T[g.sn-T[0].sn+1]||null:R===0&&T[0].start===0&&(w=T[0]),w&&U(R,C,w)===0)return w;var E=I.default.search(T,U.bind(null,R,C));return E||w}function U(g,T,R){g===void 0&&(g=0),T===void 0&&(T=0);var C=Math.min(T,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-C<=g?1:R.start-C>g&&R.start?-1:0}function _(g,T,R){var C=Math.min(T,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,w=R.endProgramDateTime||0;return w-C>g}function D(g,T){return I.default.search(g,function(R){return R.cc<T?1:R.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"FragmentState",function(){return P}),L.d(G,"FragmentTracker",function(){return B});var V=L("./src/events.ts"),I=L("./src/types/loader.ts"),P;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(P||(P={}));var B=function(){function D(T){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=T,this._registerListeners()}var g=D.prototype;return g._registerListeners=function(){var R=this.hls;R.on(V.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(V.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(V.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var R=this.hls;R.off(V.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(V.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(V.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(R,C){if(C===I.PlaylistLevelType.MAIN){var w=this.activeFragment,E=this.activeParts;if(!w)return null;if(E)for(var l=E.length;l--;){var o=E[l],s=o?o.end:w.appendedPTS;if(o.start<=R&&s!==void 0&&R<=s)return l>9&&(this.activeParts=E.slice(l-9)),o}else if(w.start<=R&&w.appendedPTS!==void 0&&R<=w.appendedPTS)return w}return this.getBufferedFrag(R,C)},g.getBufferedFrag=function(R,C){for(var w=this.fragments,E=Object.keys(w),l=E.length;l--;){var o=w[E[l]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=R&&R<=s.end)return s}}return null},g.detectEvictedFragments=function(R,C,w){var E=this;Object.keys(this.fragments).forEach(function(l){var o=E.fragments[l];if(!o)return;if(!o.buffered){o.body.type===w&&E.removeFragment(o.body);return}var s=o.range[R];if(!s)return;s.time.some(function(u){var S=!E.isTimeBuffered(u.startPTS,u.endPTS,C);return S&&E.removeFragment(o.body),S})})},g.detectPartialFragments=function(R){var C=this,w=this.timeRanges,E=R.frag,l=R.part;if(!w||E.sn==="initSegment")return;var o=_(E),s=this.fragments[o];if(!s)return;Object.keys(w).forEach(function(u){var S=E.elementaryStreams[u];if(!S)return;var p=w[u],h=l!==null||S.partial===!0;s.range[u]=C.getBufferedTimes(E,l,h,p)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},g.fragBuffered=function(R){var C=_(R),w=this.fragments[C];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},g.getBufferedTimes=function(R,C,w,E){for(var l={time:[],partial:w},o=C?C.start:R.start,s=C?C.end:R.end,u=R.minEndPTS||s,S=R.maxStartPTS||o,p=0;p<E.length;p++){var h=E.start(p)-this.bufferPadding,A=E.end(p)+this.bufferPadding;if(S>=h&&u<=A){l.time.push({startPTS:Math.max(o,E.start(p)),endPTS:Math.min(s,E.end(p))});break}else if(o<A&&s>h)l.partial=!0,l.time.push({startPTS:Math.max(o,E.start(p)),endPTS:Math.min(s,E.end(p))});else if(s<=h)break}return l},g.getPartialFragment=function(R){var C=null,w,E,l,o=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(S){var p=u[S];if(!p)return;U(p)&&(E=p.body.start-s,l=p.body.end+s,R>=E&&R<=l&&(w=Math.min(R-E,l-R),o<=w&&(C=p.body,o=w)))}),C},g.getState=function(R){var C=_(R),w=this.fragments[C];return w?w.buffered?U(w)?P.PARTIAL:P.OK:w.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},g.backtrack=function(R,C){var w=_(R),E=this.fragments[w];if(!E||E.backtrack)return null;var l=E.backtrack=C||E.loaded;return E.loaded=null,l},g.getBacktrackData=function(R){var C=_(R),w=this.fragments[C];if(w){var E,l=w.backtrack;if(l!=null&&(E=l.payload)!==null&&E!==void 0&&E.byteLength)return l;this.removeFragment(R)}return null},g.isTimeBuffered=function(R,C,w){for(var E,l,o=0;o<w.length;o++){if(E=w.start(o)-this.bufferPadding,l=w.end(o)+this.bufferPadding,R>=E&&C<=l)return!0;if(C<=E)return!1}return!1},g.onFragLoaded=function(R,C){var w=C.frag,E=C.part;if(w.sn==="initSegment"||w.bitrateTest||E)return;var l=_(w);this.fragments[l]={body:w,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(R,C){var w=this,E=C.frag,l=C.part,o=C.timeRanges;if(E.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=E,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var S=o[u];if(w.detectEvictedFragments(u,S),!l)for(var p=0;p<S.length;p++)E.appendedPTS=Math.max(S.end(p),E.appendedPTS||0)})},g.onFragBuffered=function(R,C){this.detectPartialFragments(C)},g.hasFragment=function(R){var C=_(R);return!!this.fragments[C]},g.removeFragmentsInRange=function(R,C,w){var E=this;Object.keys(this.fragments).forEach(function(l){var o=E.fragments[l];if(!o)return;if(o.buffered){var s=o.body;s.type===w&&s.start<C&&s.end>R&&E.removeFragment(s)}})},g.removeFragment=function(R){var C=_(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[C]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function U(D){var g,T;return D.buffered&&(((g=D.range.video)===null||g===void 0?void 0:g.partial)||((T=D.range.audio)===null||T===void 0?void 0:T.partial))}function _(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"STALL_MINIMUM_DURATION_MS",function(){return U}),L.d(G,"MAX_START_GAP_JUMP",function(){return _}),L.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(G,"SKIP_BUFFER_RANGE_START",function(){return g}),L.d(G,"default",function(){return T});var V=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),P=L("./src/events.ts"),B=L("./src/utils/logger.ts"),U=250,_=2,D=.1,g=.05,T=function(){function R(w,E,l,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=w,this.media=E,this.fragmentTracker=l,this.hls=o}var C=R.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(E){var l=this.config,o=this.media,s=this.stalled,u=o.currentTime,S=o.seeking,p=this.seeking&&!S,h=!this.seeking&&S;if(this.seeking=S,u!==E){if(this.moved=!0,s!==null){if(this.stallReported){var A=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!V.BufferHelper.getBuffered(o).length)return;var y=V.BufferHelper.bufferInfo(o,u,0),c=y.len>0,f=y.nextStart||0;if(!c&&!f)return;if(S){var d=y.len>_,a=!f||f-u>_&&!this.fragmentTracker.getPartialFragment(u);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,m=Math.max(f,y.start||0)-u,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=b==null||((v=b.details)===null||v===void 0)?void 0:v.live,F=M?b.details.targetduration*2:_;if(m>0&&m<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!S&&W>=U&&this._reportStall(y.len);var k=V.BufferHelper.bufferInfo(o,u,l.maxBufferHole);this._tryFixBufferStall(k,W)},C._tryFixBufferStall=function(E,l){var o=this.config,s=this.fragmentTracker,u=this.media,S=u.currentTime,p=s.getPartialFragment(S);if(p){var h=this._trySkipBufferHole(p);if(h)return}E.len>o.maxBufferHole&&l>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(E){var l=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="+E+")"),l.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},C._trySkipBufferHole=function(E){for(var l=this.config,o=this.hls,s=this.media,u=s.currentTime,S=0,p=V.BufferHelper.getBuffered(s),h=0;h<p.length;h++){var A=p.start(h);if(u+l.maxBufferHole>=S&&u<A){var y=Math.max(A+g,s.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+y),this.moved=!0,this.stalled=null,s.currentTime=y,E&&o.trigger(P.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 "+y,frag:E}),y}S=p.end(h)}return 0},C._tryNudgeBuffer=function(){var E=this.config,l=this.hls,o=this.media,s=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<E.nudgeMaxRetry){var S=s+u*E.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+S),o.currentTime=S,l.trigger(P.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 "+E.nudgeMaxRetry+" nudges"),l.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),P=L("./src/demux/id3.ts"),B=.25,U=function(){function _(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var D=_.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var T=this.hls;T.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(V.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var T=this.hls;T.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(V.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(T,R){this.media=R.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(T){if(!this.media)return;for(var R=0;R<T.length;R++){var C=T[R];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(T,R){if(!this.media)return;var C=R.frag,w=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<w.length;l++){var o=P.getID3Frames(w[l].data);if(o){var s=w[l].pts,u=l<w.length-1?w[l+1].pts:C.end,S=u-s;S<=0&&(u=s+B);for(var p=0;p<o.length;p++){var h=o[p];if(!P.isTimeStampFrame(h)){var A=new E(s,u,"");A.value=h,this.id3Track.addCue(A)}}}}},D.onBufferFlushing=function(T,R){var C=R.startOffset,w=R.endOffset,E=R.type;if(!E||E==="audio"){var l=this.id3Track;l&&Object(I.removeCuesInRange)(l,C,w)}},_}();G.default=U},"./src/controller/latency-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _});var V=L("./src/errors.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts");function B(D,g){for(var T=0;T<g.length;T++){var R=g[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function U(D,g,T){return g&&B(D.prototype,g),T&&B(D,T),D}var _=function(){function D(T){var R=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return R.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var g=D.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.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)},g.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)},g.onMediaAttached=function(R,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(R,C){var w=C.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(R,C){if(C.details!==V.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var R=this.media,C=this.levelDetails;if(!R||!C)return;this.currentTime=R.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var E=this.config,l=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!l||o===1)return;var s=this.targetLatency;if(s===null)return;var u=w-s,S=Math.min(this.maxLatency,s+C.targetduration),p=u<S;if(C.live&&p&&u>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;R.playbackRate=Math.min(h,Math.max(1,A))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},g.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},g.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},U(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,C=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:C?R.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var C=R.holdBack,w=R.partHoldBack,E=R.targetduration,l=this.config,o=l.liveSyncDuration,s=l.liveSyncDurationCount,u=l.lowLatencyMode,S=this.hls.userConfig,p=u&&w||C;(S.liveSyncDuration||S.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:s*E);var h=E,A=1;return p+Math.min(this.stallCount*A,h)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),C=this.targetLatency,w=this.levelDetails;if(R===null||C===null||w===null)return null;var E=w.edge,l=R-C-this.edgeStalled,o=E-w.totalduration,s=E-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,l),s)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var C=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-C,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,C=this.levelDetails;if(!R||!C)return 0;var w=R.buffered.length;return w?R.buffered.end(w-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return l});var V=L("./src/types/level.ts"),I=L("./src/events.ts"),P=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),U=L("./src/controller/level-helper.ts"),_=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function g(){return g=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var S in u)Object.prototype.hasOwnProperty.call(u,S)&&(o[S]=u[S])}return o},g.apply(this,arguments)}function T(o,s){for(var u=0;u<s.length;u++){var S=s[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,s,u){return s&&T(o.prototype,s),u&&T(o,u),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,w(o,s)}function w(o,s){return w=Object.setPrototypeOf||function(S,p){return S.__proto__=p,S},w(o,s)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(o){C(s,o);function s(S){var p;return p=o.call(this,S,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var u=s.prototype;return u._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var p=this._levels;p.forEach(function(h){h.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(p,h){var A=[],y=[],c=[],f,d={},a,v=!1,m=!1,b=!1;if(h.levels.forEach(function(W){var k=W.attrs;v=v||!!(W.width&&W.height),m=m||!!W.videoCodec,b=b||!!W.audioCodec,E&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var O=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=d[O],a?a.url.push(W.url):(a=new V.Level(W),d[O]=a,A.push(a)),k&&(k.AUDIO&&Object(U.addGroupId)(a,"audio",k.AUDIO),k.SUBTITLES&&Object(U.addGroupId)(a,"text",k.SUBTITLES))}),(v||m)&&b&&(A=A.filter(function(W){var k=W.videoCodec,O=W.width,K=W.height;return!!k||!!(O&&K)})),A=A.filter(function(W){var k=W.audioCodec,O=W.videoCodec;return(!k||Object(B.isCodecSupportedInMp4)(k,"audio"))&&(!O||Object(B.isCodecSupportedInMp4)(O,"video"))}),h.audioTracks&&(y=h.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(y)),h.subtitles&&(c=h.subtitles,Object(U.assignTrackIdsByGroup)(c)),A.length>0){f=A[0].bitrate,A.sort(function(W,k){return W.bitrate-k.bitrate}),this._levels=A;for(var M=0;M<A.length;M++)if(A[M].bitrate===f){this._firstLevel=M,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+f);break}var F=b&&!m,j={levels:A,audioTracks:y,subtitleTracks:c,firstLevel:this._firstLevel,stats:h.stats,audio:b,video:m,altAudio:!F&&y.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:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(p,h){if(o.prototype.onError.call(this,p,h),h.fatal)return;var A=h.context,y=this._levels[this.currentLevelIndex];if(A&&(A.type===D.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&A.groupId===y.audioGroupIds[y.urlId]||A.type===D.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&A.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,d;switch(h.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var a=this._levels[h.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(f=!1),d=A.level),c=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,c=!0;break}d!==void 0&&this.recoverLevel(h,d,c,f)},u.recoverLevel=function(p,h,A,y){var c=p.details,f=this._levels[h];if(f.loadError++,A){var d=this.retryLoadingOrFail(p);if(d)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=f.url.length;if(a>1&&f.loadError<a)p.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var v=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(c+": switch to "+v),p.levelRetry=!0,this.hls.nextAutoLevel=v)}}},u.redundantFailover=function(p){var h=this._levels[p],A=h.url.length;if(A>1){var y=(h.urlId+1)%A;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(c){c.urlId=y}),this.level=p}},u.onFragLoaded=function(p,h){var A=h.frag;if(A!==void 0&&A.type===D.PlaylistLevelType.MAIN){var y=this._levels[A.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},u.onLevelLoaded=function(p,h){var A,y=h.level,c=h.details,f=this._levels[y];if(!f){var d;this.warn("Invalid level index "+y),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(y,h,f.details)):(A=h.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(c.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(p,h){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var y=-1,c=this.hls.audioTracks[h.id].groupId,f=0;f<A.audioGroupIds.length;f++)if(A.audioGroupIds[f]===c){y=f;break}y!==A.urlId&&(A.urlId=y,this.startLoad())}},u.loadPlaylist=function(p){var h=this.currentLevelIndex,A=this._levels[h];if(this.canLoad&&A&&A.url.length>0){var y=A.urlId,c=A.url[y];if(p)try{c=p.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+y+" "+c),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:c,level:h,id:y,deliveryDirectives:p||null})}},u.removeLevel=function(p,h){var A=function(f,d){return d!==h},y=this._levels.filter(function(c,f){return f!==p?!0:c.url.length>1&&h!==void 0?(c.url=c.url.filter(A),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(A)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(A)),c.urlId=0,!0):!1}).map(function(c,f){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=f}),c});this._levels=y,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:y})},R(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var h,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===p&&(h=A[p])!==null&&h!==void 0&&h.details)return;if(p<0||p>=A.length){var y=p<0;if(this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:y,reason:"invalid level idx"}),y)return;p=Math.min(p,A.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=A[c],d=A[p];this.log("switching to level "+p+" from "+c),this.currentLevelIndex=p;var a=g({},d,{level:p,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var v=d.details;if(!v||v.live){var m=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),s}(_.default)},"./src/controller/level-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"addGroupId",function(){return P}),L.d(G,"assignTrackIdsByGroup",function(){return B}),L.d(G,"updatePTS",function(){return U}),L.d(G,"updateFragPTSDTS",function(){return D}),L.d(G,"mergeDetails",function(){return g}),L.d(G,"mapPartIntersection",function(){return T}),L.d(G,"mapFragmentIntersection",function(){return R}),L.d(G,"adjustSliding",function(){return C}),L.d(G,"addSliding",function(){return w}),L.d(G,"computeReloadInterval",function(){return E}),L.d(G,"getFragmentWithSN",function(){return l}),L.d(G,"getPartWith",function(){return o});var V=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function P(s,u,S){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function B(s){var u={};s.forEach(function(S){var p=S.groupId||"";S.id=u[p]=u[p]||0,u[p]++})}function U(s,u,S){var p=s[u],h=s[S];_(p,h)}function _(s,u){var S=u.startPTS;if(Object(V.isFiniteNumber)(S)){var p=0,h;u.sn>s.sn?(p=S-s.start,h=s):(p=s.start-S,h=u),h.duration!==p&&(h.duration=p)}else if(u.sn>s.sn){var A=s.cc===u.cc;A&&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,S,p,h,A){var y=p-S;y<=0&&(I.logger.warn("Fragment should have a positive duration",u),p=S+u.duration,A=h+u.duration);var c=S,f=p,d=u.startPTS,a=u.endPTS;if(Object(V.isFiniteNumber)(d)){var v=Math.abs(d-S);Object(V.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(v,u.deltaPTS):u.deltaPTS=v,c=Math.max(S,d),S=Math.min(S,d),h=Math.min(h,u.startDTS),f=Math.min(p,a),p=Math.max(p,a),A=Math.max(A,u.endDTS)}u.duration=p-S;var m=S-u.start;u.appendedPTS=p,u.start=u.startPTS=S,u.maxStartPTS=c,u.startDTS=h,u.endPTS=p,u.minEndPTS=f,u.endDTS=A;var b=u.sn;if(!s||b<s.startSN||b>s.endSN)return 0;var M,F=b-s.startSN,j=s.fragments;for(j[F]=u,M=F;M>0;M--)_(j[M],j[M-1]);for(M=F;M<j.length-1;M++)_(j[M],j[M+1]);return s.fragmentHint&&_(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,m}function g(s,u){for(var S=null,p=s.fragments,h=p.length-1;h>=0;h--){var A=p[h].initSegment;if(A){S=A;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var y=0,c;if(R(s,u,function(M,F){M.relurl&&(y=M.cc-F.cc),Object(V.isFiniteNumber)(M.startPTS)&&Object(V.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(c=F),u.PTSKnown=u.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,S=M.initSegment)}),S){var f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;f.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=S)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=S)})}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 d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(y){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=y}u.skippedSegments&&(u.startCC=u.fragments[0].cc),T(s.partList,u.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),c?D(u,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):C(s,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var m=u.advancedDateTime;if(u.advanced&&m){var b=u.edge;u.driftStart||(u.driftStartTime=m,u.driftStart=b),u.driftEndTime=m,u.driftEnd=b}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function T(s,u,S){if(s&&u)for(var p=0,h=0,A=s.length;h<=A;h++){var y=s[h],c=u[h+p];y&&c&&y.index===c.index&&y.fragment.sn===c.fragment.sn?S(y,c):p--}}function R(s,u,S){for(var p=u.skippedSegments,h=Math.max(s.startSN,u.startSN)-u.startSN,A=(s.fragmentHint?1:0)+(p?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,y=u.startSN-s.startSN,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=h;d<=A;d++){var a=f[y+d],v=c[d];p&&!v&&d<p&&(v=u.fragments[d]=a),a&&v&&S(a,v)}}function C(s,u){var S=u.startSN+u.skippedSegments-s.startSN,p=s.fragments;if(S<0||S>=p.length)return;w(u,p[S].start)}function w(s,u){if(u){for(var S=s.fragments,p=s.skippedSegments;p<S.length;p++)S[p].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function E(s,u){var S=1e3*s.levelTargetDuration,p=S/2,h=s.age,A=h>0&&h<S*3,y=u.loading.end-u.loading.start,c,f=s.availabilityDelay;if(s.updated===!1)if(A){var d=333*s.misses;c=Math.max(Math.min(p,y*2),d),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=p;else A?(f=Math.min(f||S/2,h),s.availabilityDelay=f,c=f+S-h):c=S-y;return Math.round(c)}function l(s,u,S){if(!s||!s.details)return null;var p=s.details,h=p.fragments[u-p.startSN];return h||(h=p.fragmentHint,h&&h.sn===u?h:u<p.startSN&&S&&S.sn===u?S:null)}function o(s,u,S){if(!s||!s.details)return null;var p=s.details.partList;if(p)for(var h=p.length;h--;){var A=p[h];if(A.index===S&&A.fragment.sn===u)return A}return null}},"./src/controller/stream-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return p});var V=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),P=L("./src/is-supported.ts"),B=L("./src/events.ts"),U=L("./src/utils/buffer-helper.ts"),_=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),g=L("./src/loader/fragment.ts"),T=L("./src/demux/transmuxer-interface.ts"),R=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),w=L("./src/errors.ts"),E=L("./src/utils/logger.ts");function l(h,A){for(var y=0;y<A.length;y++){var c=A[y];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function o(h,A,y){return A&&l(h.prototype,A),y&&l(h,y),h}function s(h,A){h.prototype=Object.create(A.prototype),h.prototype.constructor=h,u(h,A)}function u(h,A){return u=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},u(h,A)}var S=100,p=function(h){s(A,h);function A(c,f){var d;return d=h.call(this,c,f,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var y=A.prototype;return y._registerListeners=function(){var f=this.hls;f.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(B.Events.ERROR,this.onError,this),f.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var f=this.hls;f.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(B.Events.ERROR,this.onError,this),f.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=a.startLevel;v===-1&&(a.config.testBandwidth?(v=0,this.bitrateTest=!0):v=a.nextAutoLevel),this.level=a.nextLoadLevel=v,this.loadedmetadata=!1}d>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var f,d=this.levels,a=this.level,v=d==null||((f=d[a])===null||f===void 0)?void 0:f.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,b=self.performance.now(),M=this.retryDate;(!M||b>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var f,d,a=this.hls,v=this.levelLastLoaded,m=this.levels,b=this.media,M=a.config,F=a.nextLoadLevel;if(v===null||!b&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[F])return;var j=m[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,D.PlaylistLevelType.MAIN);if(k===null)return;var O=k.len,K=this.getMaxBufferLength(j.maxBitrate);if(O>=K)return;if(this._streamEnded(k,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var q=k.end,ie=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&ie&&ie.sn!=="initSegment"){var Te=ie.sn-W.startSN;Te>1&&(ie=W.fragments[Te-1],this.fragmentTracker.removeFragment(ie))}if(ie&&this.fragmentTracker.getState(ie)===_.FragmentState.OK&&this.nextLoadPosition>q){var ve=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,ve,D.PlaylistLevelType.MAIN),ie=this.getNextFragment(this.nextLoadPosition,W)}if(!ie)return;ie.initSegment&&!ie.initSegment.data&&!this.bitrateTest&&(ie=ie.initSegment),((f=ie.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=ie.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ie,W):this.loadFragment(ie,W,q)},y.loadFragment=function(f,d,a){var v,m=this.fragmentTracker.getState(f);if(this.fragCurrent=f,m===_.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(f);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else m=_.FragmentState.NOT_LOADED}m===_.FragmentState.NOT_LOADED||m===_.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,d,a)):m===_.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},y.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,D.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var f=this.levels,d=this.media;if(d!=null&&d.readyState){var a,v=this.getAppendedFrag(d.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!d.paused&&f){var m=this.hls.nextLoadLevel,b=f[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(d.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,k=j.duration,O=Math.max(F.end,W+Math.min(Math.max(k-this.config.maxFragLookUpTolerance,k*.5),k*.75));this.flushMainBuffer(O,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(f,d){h.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},y.onMediaAttached=function(f,d){h.prototype.onMediaAttached.call(this,f,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(V.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},y.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},y.onManifestParsed=function(f,d){var a=!1,v=!1,m;d.levels.forEach(function(b){m=b.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},y.onLevelLoading=function(f,d){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var v=a[d.level];(!v.details||v.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(v.details))&&(this.state=I.State.WAITING_LEVEL)},y.onLevelLoaded=function(f,d){var a,v=this.levels,m=d.level,b=d.details,M=b.totalduration;if(!v){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==d.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=v[m],W=0;if(b.live||(a=j.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;W=this.alignPlaylists(b,j.details)}if(j.details=b,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:b,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=I.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,W),this.tick()},y._handleFragmentLoadProgress=function(f){var d,a=f.frag,v=f.part,m=f.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=b[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,k=(d=a.initSegment)===null||d===void 0?void 0:d.data,O=this._getAudioCodec(M),K=this.transmuxer=this.transmuxer||new T.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=v?v.index:-1,q=Y!==-1,ie=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,q),Te=this.initPTS[a.cc];K.push(m,k,O,j,a,v,F.totalduration,W,ie,Te)},y.onAudioTrackSwitching=function(f,d){var a=this.altAudio,v=!!d.url,m=d.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},y.onAudioTrackSwitched=function(f,d){var a=d.id,v=!!this.hls.audioTracks[a].url;if(v){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=v,this.tick()},y.onBufferCreated=function(f,d){var a=d.tracks,v,m,b=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(m=M,v=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else b=!0}b&&v?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(f,d){var a=d.frag,v=d.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},y.onError=function(f,d){switch(d.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,d);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=I.State.ERROR):!d.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var a=U.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(f,d){var a=d.type;if(a!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,D.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(f,d){this.levels=d.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var f=this.media,d=f.currentTime,a=this.startPosition;if(a>=0&&d<a){if(f.seeking){E.logger.log("could not seek to "+a+", already seeking at "+d);return}var v=U.BufferHelper.getBuffered(f),m=v.length?v.start(0):0,b=m-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+b+" to match buffer start"),a+=b,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),f.currentTime=a}},y._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},y._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(a){var v=d.hls;if(!a||v.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=I.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var m=f.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),v.trigger(B.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(f){var d,a="main",v=this.hls,m=f.remuxResult,b=f.chunkMeta,M=this.getCurrentContext(b);if(!M){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var F=M.frag,j=M.part,W=M.level,k=m.video,O=m.text,K=m.id3,Y=m.initSegment,q=this.altAudio?void 0:m.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,b),v.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var ie=Y.initPTS,Te=Y.timescale;Object(V.isFiniteNumber)(ie)&&(this.initPTS[F.cc]=ie,v.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:ie,timescale:Te}))}if(k&&m.independent!==!1){if(W.details){var ve=k.startPTS,ge=k.endPTS,he=k.startDTS,ce=k.endDTS;if(j)j.elementaryStreams[k.type]={startPTS:ve,endPTS:ge,startDTS:he,endDTS:ce};else if(k.firstKeyFrame&&k.independent&&(this.couldBacktrack=!0),k.dropped&&k.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<ve){this.backtrack(F);return}F.setElementaryStreamInfo(k.type,F.start,ge,F.start,ce,!0)}F.setElementaryStreamInfo(k.type,ve,ge,he,ce),this.bufferFragmentData(k,F,j,b)}}else if(m.independent===!1){this.backtrack(F);return}if(q){var me=q.startPTS,Q=q.endPTS,ne=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:Q,startDTS:ne,endDTS:Z}),F.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,me,Q,ne,Z),this.bufferFragmentData(q,F,j,b)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var Ee={frag:F,id:a,samples:K.samples};v.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(O){var Ae={frag:F,id:a,samples:O.samples};v.trigger(B.Events.FRAG_PARSING_USERDATA,Ae)}},y._bufferInitSegment=function(f,d,a,v){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var b=d.audio,M=d.video,F=d.audiovideo;if(b){var j=f.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),b.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),f.audioCodec&&f.audioCodec!==j&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+j+'"'),b.levelCodec=j,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(f.audioCodec||"")+"/"+b.codec+"]")}M&&(M.levelCodec=f.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(k){var O=d[k],K=O.initSegment;K!=null&&K.byteLength&&m.hls.trigger(B.Events.BUFFER_APPENDING,{type:k,data:K,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},y.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=I.State.BACKTRACKING},y.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(U.BufferHelper.isBuffered(f,a)?d=this.getAppendedFrag(a):U.BufferHelper.isBuffered(f,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var v=this.fragPlaying,m=d.level;(!v||d.sn!==v.sn||v.level!==m||d.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:d}),(!v||v.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=d)}}},o(A,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"SubtitleStreamController",function(){return s});var V=L("./src/events.ts"),I=L("./src/utils/logger.ts"),P=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),U=L("./src/utils/discontinuities.ts"),_=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),g=L("./src/controller/base-stream-controller.ts"),T=L("./src/types/loader.ts"),R=L("./src/types/level.ts");function C(u,S){for(var p=0;p<S.length;p++){var h=S[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(u,h.key,h)}}function w(u,S,p){return S&&C(u.prototype,S),p&&C(u,p),u}function E(u,S){u.prototype=Object.create(S.prototype),u.prototype.constructor=u,l(u,S)}function l(u,S){return l=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},l(u,S)}var o=500,s=function(u){E(S,u);function S(h,A){var y;return y=u.call(this,h,A,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var p=S.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var A=this.hls;A.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(V.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(V.Events.ERROR,this.onError,this),A.on(V.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(V.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(V.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var A=this.hls;A.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(V.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(V.Events.ERROR,this.onError,this),A.off(V.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(V.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(V.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(V.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(A,y){this.mainDetails=y.details},p.onSubtitleFragProcessed=function(A,y){var c=y.frag,f=y.success;if(this.fragPrevious=c,this.state=g.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,v=c.start,m=0;m<d.length;m++)if(v>=d[m].start&&v<=d[m].end){a=d[m];break}var b=c.start+c.duration;a?a.end=b:(a={start:v,end:b},d.push(a)),this.fragmentTracker.fragBuffered(c)},p.onBufferFlushing=function(A,y){var c=y.startOffset,f=y.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var v=a[d].details,m=v.targetduration,b=f-m;if(b<=0)return;y.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=b){M.shift();continue}else if(M[F].start<b)M[F].start=b;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(c,b,T.PlaylistLevelType.SUBTITLE)}},p.onError=function(A,y){var c,f=y.frag;if(!f||f.type!==T.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},p.onSubtitleTracksUpdated=function(A,y){var c=this,f=y.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new R.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(A,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(A,y){var c,f=y.details,d=y.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var m=v[a];if(d>=v.length||d!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=m.details)!==null&&c!==void 0&&c.live){var b=this.mainDetails;if(f.deltaUpdateFailed||!b)return;var M=b.fragments[0];if(!m.details)f.hasProgramDateTime&&b.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(f,b):M&&Object(_.addSliding)(f,M.start);else{var F=this.alignPlaylists(f,m.details);F===0&&M&&Object(_.addSliding)(f,M.start)}}if(m.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var j=Object(B.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(A){var y=A.frag,c=A.payload,f=y.decryptdata,d=this.hls;if(this.fragContextChanged(y))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(v){var m=performance.now();d.trigger(V.Events.FRAG_DECRYPTED,{frag:y,payload:v,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var A,y=this.currentTrackId,c=this.levels;if(!c.length||!c[y]||!c[y].details)return;var f=c[y].details,d=f.targetduration,a=this.config,v=this.media,m=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-d,a.maxBufferHole),b=m.end,M=m.len,F=this.getMaxBufferLength()+d;if(M>F)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var j=f.fragments,W=j.length,k=f.edge,O,K=this.fragPrevious;if(b<k){var Y=a.maxFragLookUpTolerance;K&&f.hasProgramDateTime&&(O=Object(B.findFragmentByPDT)(j,K.endProgramDateTime,Y)),O||(O=Object(B.findFragmentByPTS)(K,j,b,Y),!O&&K&&K.start<j[0].start&&(O=j[0]))}else O=j[W-1];(A=O)!==null&&A!==void 0&&A.encrypted?(I.logger.log("Loading key for "+O.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(V.Events.KEY_LOADING,{frag:O})):O&&this.fragmentTracker.getState(O)===D.FragmentState.NOT_LOADED&&this.loadFragment(O,f,b)}},p.loadFragment=function(A,y,c){this.fragCurrent=A,u.prototype.loadFragment.call(this,A,y,c)},w(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(g.default)},"./src/controller/subtitle-track-controller.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),P=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(C,w){for(var E=0;E<w.length;E++){var l=w[E];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function _(C,w,E){return w&&U(C.prototype,w),E&&U(C,E),C}function D(C,w){C.prototype=Object.create(w.prototype),C.prototype.constructor=C,g(C,w)}function g(C,w){return g=Object.setPrototypeOf||function(l,o){return l.__proto__=o,l},g(C,w)}var T=function(C){D(w,C);function w(l){var o;return o=C.call(this,l,"[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 E=w.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},E.registerListeners=function(){var o=this.hls;o.on(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(V.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(V.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var o=this.hls;o.off(V.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(V.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(V.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(V.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(V.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(V.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(V.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(V.Events.ERROR,this.onError,this)},E.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)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.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=R(this.media.textTracks);o.forEach(function(s){Object(I.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},E.onSubtitleTrackLoaded=function(o,s){var u=s.id,S=s.details,p=this.trackId,h=this.tracksInGroup[p];if(!h){this.warn("Invalid subtitle track id "+u);return}var A=h.details;h.details=s.details,this.log("subtitle track "+u+" loaded ["+S.startSN+"-"+S.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,A))},E.onLevelLoading=function(o,s){this.switchLevel(s.level)},E.onLevelSwitching=function(o,s){this.switchLevel(s.level)},E.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 S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(y){return!u||y.groupId===u});this.tracksInGroup=p;var h=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=u;var A={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(V.Events.SUBTITLE_TRACKS_UPDATED,A),h!==-1&&this.setSubtitleTrack(h,S)}},E.findTrackId=function(o){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var S=s[u];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},E.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)},E.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,S=s.groupId,p=s.url;if(o)try{p=o.addDirectives(p)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(V.Events.SUBTITLE_TRACK_LOADING,{url:p,id:u,groupId:S,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var s=this,u=this.media,S=this.subtitleDisplay,p=this.trackId;if(!u)return;var h=R(u.textTracks),A=h.filter(function(f){return f.groupId===s.groupId});if(o===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var y=A[p];y&&(y.mode="disabled")}var c=A[o];c&&(c.mode=S?"showing":"hidden")},E.setSubtitleTrack=function(o,s){var u,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=S[o])!==null&&u!==void 0&&u.details)||o<-1||o>=S.length)return;this.clearTimer();var p=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var h=p.id,A=p.groupId,y=A===void 0?"":A,c=p.name,f=p.type,d=p.url;this.hls.trigger(V.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:y,name:c,type:f,url:d});var a=this.switchParams(p.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(V.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=R(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)},_(w,[{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)}}]),w}(P.default);function R(C){for(var w=[],E=0;E<C.length;E++){var l=C[E];l.kind==="subtitles"&&l.label&&w.push(C[E])}return w}G.default=T},"./src/controller/timeline-controller.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"TimelineController",function(){return R});var V=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),U=L("./src/utils/webvtt-parser.ts"),_=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),g=L("./src/types/loader.ts"),T=L("./src/utils/logger.ts"),R=function(){function l(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=E(),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"),S=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),h=new B.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,S),this.cea608Parser2=new P.default(3,p,h)}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=l.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,S,p,h,A){for(var y=!1,c=A.length;c--;){var f=A[c],d=w(f[0],f[1],S,p);if(d>=0&&(f[0]=Math.min(f[0],S),f[1]=Math.max(f[1],p),y=!0,d/(p-S)>.5))return}if(y||A.push([S,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,S,p,h)}else{var v=this.Cues.newCue(null,S,p,h);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:v,track:u})}},o.onInitPtsFound=function(u,S){var p=this,h=S.frag,A=S.id,y=S.initPTS,c=S.timescale,f=this.unparsedVttFrags;A==="main"&&(this.initPTS[h.cc]=y,this.timescale[h.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){p.onFragLoaded(I.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(u){var S=this.media;if(S)for(var p=0;p<S.textTracks.length;p++){var h=S.textTracks[p];if(h[u])return h}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 S=this.captionsProperties,p=this.captionsTracks,h=this.media,A=S[u],y=A.label,c=A.languageCode,f=this.getExistingTrack(u);if(f)p[u]=f,Object(_.clearCurrentCues)(p[u]),Object(_.sendAddTrackEvent)(p[u],h);else{var d=this.createTextTrack("captions",y,c);d&&(d[u]=!0,p[u]=d)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var S=this.captionsProperties[u];if(!S)return;var p=S.label,h={_id:u,label:p,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[u]=h,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},o.createTextTrack=function(u,S,p){var h=this.media;return h?h.addTextTrack(u,S,p):void 0},o.onMediaAttaching=function(u,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(S){Object(_.clearCurrentCues)(u[S]),delete u[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),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 S=u.textTracks;if(S)for(var p=0;p<S.length;p++)Object(_.clearCurrentCues)(S[p])},o.onSubtitleTracksUpdated=function(u,S){var p=this;this.textTracks=[];var h=S.subtitleTracks||[],A=h.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var y=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var v;if(a<c.length){for(var m=null,b=0;b<c.length;b++)if(C(c[b],d)){m=c[b];break}m&&(v=m)}v?Object(_.clearCurrentCues)(v):(v=p.createTextTrack("subtitles",d.name,d.lang),v&&(v.mode="disabled")),v&&(v.groupId=d.groupId,p.textTracks.push(v))})}else if(!y&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(u,S){var p=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(h){var A=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!A)return;var y="textTrack"+A[1],c=p.captionsProperties[y];if(!c)return;c.label=h.name,h.lang&&(c.languageCode=h.lang),c.media=h})},o.onFragLoading=function(u,S){var p=this.cea608Parser1,h=this.cea608Parser2,A=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(p&&h))return;if(S.frag.type===g.PlaylistLevelType.MAIN){var c,f,d=S.frag.sn,a=(c=S==null||((f=S.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;d===A+1||d===A&&a===y+1||(p.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(u,S){var p=S.frag,h=S.payload,A=this.initPTS,y=this.unparsedVttFrags;if(p.type===g.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(V.isFiniteNumber)(A[p.cc])){y.push(S),A.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var c=p.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[p.level],d=this.vttCCs;d[p.cc]||(d[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),f&&f.textCodec===D.IMSC1_CODEC?this._parseIMSC1(p,h):this._parseVTTs(p,h,d)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,S){var p=this,h=this.hls;Object(D.parseIMSC1)(S,this.initPTS[u.cc],this.timescale[u.cc],function(A){p._appendCues(A,u.level),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(A){T.logger.log("Failed to parse IMSC1: "+A),h.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:A})})},o._parseVTTs=function(u,S,p){var h=this,A=this.hls;Object(U.parseWebVTT)(S,this.initPTS[u.cc],this.timescale[u.cc],p,u.cc,u.start,function(y){h._appendCues(y,u.level),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(y){h._fallbackToIMSC1(u,S),T.logger.log("Failed to parse VTT cue: "+y),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:y})})},o._fallbackToIMSC1=function(u,S){var p=this,h=this.tracks[u.level];h.textCodec||Object(D.parseIMSC1)(S,this.initPTS[u.cc],this.timescale[u.cc],function(){h.textCodec=D.IMSC1_CODEC,p._parseIMSC1(u,S)},function(){h.textCodec="wvtt"})},o._appendCues=function(u,S){var p=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[S];if(h.mode==="disabled")return;u.forEach(function(c){return Object(_.addCueToTrack)(h,c)})}else{var A=this.tracks[S],y=A.default?"default":"subtitles"+S;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:u,track:y})}},o.onFragDecrypted=function(u,S){var p=S.frag;if(p.type===g.PlaylistLevelType.SUBTITLE){if(!Object(V.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(I.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,S){var p=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(p&&h))return;for(var A=0;A<S.samples.length;A++){var y=S.samples[A].bytes;if(y){var c=this.extractCea608Data(y);p.addData(S.samples[A].pts,c[0]),h.addData(S.samples[A].pts,c[1])}}},o.onBufferFlushing=function(u,S){var p=S.startOffset,h=S.endOffset,A=S.endOffsetSubtitles,y=S.type,c=this.media;if(!c||c.currentTime<h)return;if(!y||y==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(_.removeCuesInRange)(f[a],p,h)})}if(this.config.renderTextTracksNatively&&(p===0&&A!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(_.removeCuesInRange)(d[a],p,A)})}},o.extractCea608Data=function(u){for(var S=u[0]&31,p=2,h=[[],[]],A=0;A<S;A++){var y=u[p++],c=127&u[p++],f=127&u[p++],d=(4&y)!==0,a=3&y;if(c===0&&f===0)continue;d&&((a===0||a===1)&&(h[a].push(c),h[a].push(f)))}return h},l}();function C(l,o){return l&&l.label===o.name&&!(l.textTrack1||l.textTrack2)}function w(l,o,s,u){return Math.min(o,u)-Math.max(l,s)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return V});var V=function(){function I(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var P=I.prototype;return P.decrypt=function(U,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,U)},I}()},"./src/crypt/aes-decryptor.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"removePadding",function(){return I}),L.d(G,"default",function(){return P});var V=L("./src/utils/typed-array.ts");function I(B){var U=B.byteLength,_=U&&new DataView(B.buffer).getUint8(U-1);return _?Object(V.sliceUint8)(B,0,U-_):B}var P=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=B.prototype;return U.uint8ArrayToUint32Array_=function(D){for(var g=new DataView(D),T=new Uint32Array(4),R=0;R<4;R++)T[R]=g.getUint32(R*4);return T},U.initTable=function(){var D=this.sBox,g=this.invSBox,T=this.subMix,R=T[0],C=T[1],w=T[2],E=T[3],l=this.invSubMix,o=l[0],s=l[1],u=l[2],S=l[3],p=new Uint32Array(256),h=0,A=0,y=0;for(y=0;y<256;y++)y<128?p[y]=y<<1:p[y]=y<<1^283;for(y=0;y<256;y++){var c=A^A<<1^A<<2^A<<3^A<<4;c=c>>>8^c&255^99,D[h]=c,g[c]=h;var f=p[h],d=p[f],a=p[d],v=p[c]*257^c*16843008;R[h]=v<<24|v>>>8,C[h]=v<<16|v>>>16,w[h]=v<<8|v>>>24,E[h]=v,v=a*16843009^d*65537^f*257^h*16843008,o[c]=v<<24|v>>>8,s[c]=v<<16|v>>>16,u[c]=v<<8|v>>>24,S[c]=v,h?(h=f^p[p[p[a^f]]],A^=p[p[A]]):h=A=1}},U.expandKey=function(D){for(var g=this.uint8ArrayToUint32Array_(D),T=!0,R=0;R<g.length&&T;)T=g[R]===this.key[R],R++;if(T)return;this.key=g;var C=this.keySize=g.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var w=this.ksRows=(C+6+1)*4,E,l,o=this.keySchedule=new Uint32Array(w),s=this.invKeySchedule=new Uint32Array(w),u=this.sBox,S=this.rcon,p=this.invSubMix,h=p[0],A=p[1],y=p[2],c=p[3],f,d;for(E=0;E<w;E++){if(E<C){f=o[E]=g[E];continue}d=f,E%C===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=S[E/C|0]<<24):C>6&&E%C===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),o[E]=f=(o[E-C]^d)>>>0}for(l=0;l<w;l++)E=w-l,l&3?d=o[E]:d=o[E-4],l<4||E<=4?s[l]=d:s[l]=h[u[d>>>24]]^A[u[d>>>16&255]]^y[u[d>>>8&255]]^c[u[d&255]],s[l]=s[l]>>>0},U.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},U.decrypt=function(D,g,T){for(var R=this.keySize+6,C=this.invKeySchedule,w=this.invSBox,E=this.invSubMix,l=E[0],o=E[1],s=E[2],u=E[3],S=this.uint8ArrayToUint32Array_(T),p=S[0],h=S[1],A=S[2],y=S[3],c=new Int32Array(D),f=new Int32Array(c.length),d,a,v,m,b,M,F,j,W,k,O,K,Y,q,ie=this.networkToHostOrderSwap;g<c.length;){for(W=ie(c[g]),k=ie(c[g+1]),O=ie(c[g+2]),K=ie(c[g+3]),b=W^C[0],M=K^C[1],F=O^C[2],j=k^C[3],Y=4,q=1;q<R;q++)d=l[b>>>24]^o[M>>16&255]^s[F>>8&255]^u[j&255]^C[Y],a=l[M>>>24]^o[F>>16&255]^s[j>>8&255]^u[b&255]^C[Y+1],v=l[F>>>24]^o[j>>16&255]^s[b>>8&255]^u[M&255]^C[Y+2],m=l[j>>>24]^o[b>>16&255]^s[M>>8&255]^u[F&255]^C[Y+3],b=d,M=a,F=v,j=m,Y=Y+4;d=w[b>>>24]<<24^w[M>>16&255]<<16^w[F>>8&255]<<8^w[j&255]^C[Y],a=w[M>>>24]<<24^w[F>>16&255]<<16^w[j>>8&255]<<8^w[b&255]^C[Y+1],v=w[F>>>24]<<24^w[j>>16&255]<<16^w[b>>8&255]<<8^w[M&255]^C[Y+2],m=w[j>>>24]<<24^w[b>>16&255]<<16^w[M>>8&255]<<8^w[F&255]^C[Y+3],f[g]=ie(d^p),f[g+1]=ie(m^h),f[g+2]=ie(v^A),f[g+3]=ie(a^y),p=W,h=k,A=O,y=K,g=g+4}return f.buffer},B}()},"./src/crypt/decrypter.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return g});var V=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),P=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),U=L("./src/utils/mp4-tools.ts"),_=L("./src/utils/typed-array.ts"),D=16,g=function(){function T(C,w,E){var l=E===void 0?{}:E,o=l.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=w,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=T.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var E=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(E):E},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(w,E,l,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),E,l);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),E,l).then(o)},R.softwareDecrypt=function(w,E,l){var o=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(w=Object(U.appendUint8Array)(u,w),this.remainderData=null);var S=this.getValidChunk(w);if(!S.length)return null;o&&(l=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new P.default),p.expandKey(E);var h=s;return this.currentResult=p.decrypt(S.buffer,0,l),this.currentIV=Object(_.sliceUint8)(S,-16).buffer,h||null},R.webCryptoDecrypt=function(w,E,l){var o=this,s=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new I.default(s,E)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new V.default(s,l);return S.decrypt(w.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,w,E,l)})},R.onWebCryptoError=function(w,E,l,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,l,o)},R.getValidChunk=function(w){var E=w,l=w.length-w.length%D;return l!==w.length&&(E=Object(_.sliceUint8)(w,0,l),this.remainderData=Object(_.sliceUint8)(w,l)),E},R.logOnce=function(w){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return V});var V=function(){function I(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var P=I.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),P=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function U(g,T){g.prototype=Object.create(T.prototype),g.prototype.constructor=g,_(g,T)}function _(g,T){return _=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},_(g,T)}var D=function(g){U(T,g);function T(C,w){var E;return E=g.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=C,E.config=w,E}var R=T.prototype;return R.resetInitSegment=function(w,E,l){g.prototype.resetInitSegment.call(this,w,E,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:l,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var E=B.getID3Data(w,0)||[],l=E.length,o=w.length;l<o;l++)if(I.probe(w,l))return P.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(w,E){return I.canParse(w,E)},R.appendFrame=function(w,E,l){I.initTrackConfig(w,this.observer,E,l,w.manifestCodec);var o=I.appendFrame(w,E,l,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(V.default);D.minProbeByteLength=9,G.default=D},"./src/demux/adts.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"getAudioConfig",function(){return B}),L.d(G,"isHeaderPattern",function(){return U}),L.d(G,"getHeaderLength",function(){return _}),L.d(G,"getFullFrameLength",function(){return D}),L.d(G,"canGetFrameLength",function(){return g}),L.d(G,"isHeader",function(){return T}),L.d(G,"canParse",function(){return R}),L.d(G,"probe",function(){return C}),L.d(G,"initTrackConfig",function(){return w}),L.d(G,"getFrameDuration",function(){return E}),L.d(G,"parseFrameHeader",function(){return l}),L.d(G,"appendFrame",function(){return o});var V=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),P=L("./src/events.ts");function B(s,u,S,p){var h,A,y,c,f=navigator.userAgent.toLowerCase(),d=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((u[S+2]&192)>>>6)+1;var v=(u[S+2]&60)>>>2;if(v>a.length-1){s.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return y=(u[S+2]&1)<<2,y|=(u[S+3]&192)>>>6,V.logger.log("manifest codec:"+p+", ADTS type:"+h+", samplingIndex:"+v),/firefox/i.test(f)?v>=6?(h=5,c=new Array(4),A=v-3):(h=2,c=new Array(2),A=v):f.indexOf("android")!==-1?(h=2,c=new Array(2),A=v):(h=5,c=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&v>=6?A=v-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(v>=6&&y===1||/vivaldi/i.test(f))||!p&&y===1)&&(h=2,c=new Array(2)),A=v)),c[0]=h<<3,c[0]|=(v&14)>>1,c[1]|=(v&1)<<7,c[1]|=y<<3,h===5&&(c[1]|=(A&14)>>1,c[2]=(A&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:a[v],channelCount:y,codec:"mp4a.40."+h,manifestCodec:d}}function U(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 g(s,u){return u+5<s.length}function T(s,u){return u+1<s.length&&U(s,u)}function R(s,u){return g(s,u)&&U(s,u)&&D(s,u)<=s.length-u}function C(s,u){if(T(s,u)){var S=_(s,u);if(u+S>=s.length)return!1;var p=D(s,u);if(p<=S)return!1;var h=u+p;return h===s.length||T(s,h)}return!1}function w(s,u,S,p,h){if(!s.samplerate){var A=B(u,S,p,h);if(!A)return;s.config=A.config,s.samplerate=A.samplerate,s.channelCount=A.channelCount,s.codec=A.codec,s.manifestCodec=A.manifestCodec,V.logger.log("parsed codec:"+s.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function E(s){return 1024*9e4/s}function l(s,u,S,p,h){var A=_(s,u),y=D(s,u);if(y-=A,y>0){var c=S+p*h;return{headerLength:A,frameLength:y,stamp:c}}}function o(s,u,S,p,h){var A=E(s.samplerate),y=l(u,S,p,h,A);if(y){var c=y.frameLength,f=y.headerLength,d=y.stamp,a=f+c,v=Math.max(0,S+a-u.length),m;v?(m=new Uint8Array(a-f),m.set(u.subarray(S+f,u.length),0)):m=u.subarray(S+f,S+a);var b={unit:m,pts:d};return v||s.samples.push(b),{sample:b,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"initPTSFn",function(){return D});var V=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),P=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),U=L("./src/utils/typed-array.ts"),_=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=g.prototype;return T.resetInitSegment=function(C,w,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(C,w){return!1},T.appendFrame=function(C,w,E){},T.demux=function(C,w){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var E=I.getID3Data(C,0),l=E?E.length:0,o,s,u=this._audioTrack,S=this._id3Track,p=E?I.getTimeStamp(E):void 0,h=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(p,w)),E&&E.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),s=this.initPTS;l<h;){if(this.canParse(C,l)){var A=this.appendFrame(u,C,l);A?(this.frameIndex++,s=A.sample.pts,l+=A.length,o=l):l=h}else I.canParse(C,l)?(E=I.getID3Data(C,l),S.samples.push({pts:s,dts:s,data:E}),l+=E.length,o=l):l++;if(l===h&&o!==h){var y=Object(U.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:S,textTrack:Object(P.dummyTrack)()}},T.demuxSampleAes=function(C,w,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(C){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},T.destroy=function(){},g}(),D=function(T,R){return Object(V.isFiniteNumber)(T)?T*90:R*9e4};G.default=_},"./src/demux/chunk-cache.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return V});var V=function(){function P(){this.chunks=[],this.dataLength=0}var B=P.prototype;return B.push=function(_){this.chunks.push(_),this.dataLength+=_.length},B.flush=function(){var _=this.chunks,D=this.dataLength,g;if(_.length)_.length===1?g=_[0]:g=I(_,D);else return new Uint8Array(0);return this.reset(),g},B.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function I(P,B){for(var U=new Uint8Array(B),_=0,D=0;D<P.length;D++){var g=P[D];U.set(g,_),_+=g.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"dummyTrack",function(){return V});function V(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/utils/logger.ts"),I=function(){function P(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var B=P.prototype;return B.loadWord=function(){var _=this.data,D=this.bytesAvailable,g=_.byteLength-D,T=new Uint8Array(4),R=Math.min(4,D);if(R===0)throw new Error("no bytes available");T.set(_.subarray(g,g+R)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},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,_),g=this.word>>>32-D;return _>32&&V.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?g<<D|this.readBits(D):g},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,g=8,T,R=0;R<_;R++)g!==0&&(T=this.readEG(),g=(D+T+256)%256),D=g===0?D:g},B.readSPS=function(){var _=0,D=0,g=0,T=0,R,C,w,E=this.readUByte.bind(this),l=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),S=this.skipEG.bind(this),p=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);E();var A=E();if(l(5),u(3),E(),p(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var y=o();if(y===3&&u(1),p(),p(),u(1),s())for(C=y!==3?8:12,w=0;w<C;w++)s()&&(w<6?h(16):h(64))}p();var c=o();if(c===0)o();else if(c===1)for(u(1),S(),S(),R=o(),w=0;w<R;w++)S();p(),u(1);var f=o(),d=o(),a=l(1);a===0&&u(1),u(1),s()&&(_=o(),D=o(),g=o(),T=o());var v=[1,1];if(s()&&s()){var m=E();switch(m){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((f+1)*16-_*2-D*2),height:(2-a)*(d+1)*16-(a?2:4)*(g+T),pixelRatio:v}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();G.default=I},"./src/demux/id3.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isHeader",function(){return V}),L.d(G,"isFooter",function(){return I}),L.d(G,"getID3Data",function(){return P}),L.d(G,"canParse",function(){return U}),L.d(G,"getTimeStamp",function(){return _}),L.d(G,"isTimeStampFrame",function(){return D}),L.d(G,"getID3Frames",function(){return T}),L.d(G,"decodeFrame",function(){return R}),L.d(G,"utf8ArrayToStr",function(){return o}),L.d(G,"testables",function(){return s});var V=function(h,A){return A+10<=h.length&&(h[A]===73&&h[A+1]===68&&h[A+2]===51&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},I=function(h,A){return A+10<=h.length&&(h[A]===51&&h[A+1]===68&&h[A+2]===73&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},P=function(h,A){for(var y=A,c=0;V(h,A);){c+=10;var f=B(h,A+6);c+=f,I(h,A+10)&&(c+=10),A+=c}return c>0?h.subarray(y,y+c):void 0},B=function(h,A){var y=0;return y=(h[A]&127)<<21,y|=(h[A+1]&127)<<14,y|=(h[A+2]&127)<<7,y|=h[A+3]&127,y},U=function(h,A){return V(h,A)&&B(h,A+6)+10<=h.length-A},_=function(h){for(var A=T(h),y=0;y<A.length;y++){var c=A[y];if(D(c))return l(c)}return},D=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},g=function(h){var A=String.fromCharCode(h[0],h[1],h[2],h[3]),y=B(h,4),c=10;return{type:A,size:y,data:h.subarray(c,c+y)}},T=function(h){for(var A=0,y=[];V(h,A);){var c=B(h,A+6);A+=10;for(var f=A+c;A+8<f;){var d=g(h.subarray(A)),a=R(d);a&&y.push(a),A+=d.size+10}I(h,A)&&(A+=10)}return y},R=function(h){return h.type==="PRIV"?C(h):h.type[0]==="W"?E(h):w(h)},C=function(h){if(h.size<2)return;var A=o(h.data,!0),y=new Uint8Array(h.data.subarray(A.length+1));return{key:h.type,info:A,data:y.buffer}},w=function(h){if(h.size<2)return;if(h.type==="TXXX"){var A=1,y=o(h.data.subarray(A),!0);A+=y.length+1;var c=o(h.data.subarray(A));return{key:h.type,info:y,data:c}}var f=o(h.data.subarray(1));return{key:h.type,data:f}},E=function(h){if(h.type==="WXXX"){if(h.size<2)return;var A=1,y=o(h.data.subarray(A),!0);A+=y.length+1;var c=o(h.data.subarray(A));return{key:h.type,info:y,data:c}}var f=o(h.data);return{key:h.type,data:f}},l=function(h){if(h.data.byteLength===8){var A=new Uint8Array(h.data),y=A[3]&1,c=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return c/=45,y&&(c+=4772185884e-2),Math.round(c)}return},o=function(h,A){A===void 0&&(A=!1);var y=S();if(y){var c=y.decode(h);if(A){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var d=h.length,a,v,m,b="",M=0;M<d;){if(a=h[M++],a===0&&A)return b;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(a);break;case 12:case 13:v=h[M++],b+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=h[M++],m=h[M++],b+=String.fromCharCode((a&15)<<12|(v&63)<<6|(m&63)<<0);break;default:}}return b},s={decodeTextFrame:w},u;function S(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),P=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function U(g,T){g.prototype=Object.create(T.prototype),g.prototype.constructor=g,_(g,T)}function _(g,T){return _=Object.setPrototypeOf||function(C,w){return C.__proto__=w,C},_(g,T)}var D=function(g){U(T,g);function T(){return g.apply(this,arguments)||this}var R=T.prototype;return R.resetInitSegment=function(w,E,l){g.prototype.resetInitSegment.call(this,w,E,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:l,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var E=I.getID3Data(w,0)||[],l=E.length,o=w.length;l<o;l++)if(B.probe(w,l))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(w,E){return B.canParse(w,E)},R.appendFrame=function(w,E,l){return this.initPTS===null?void 0:B.appendFrame(w,E,l,this.initPTS,this.frameIndex)},T}(V.default);D.minProbeByteLength=4,G.default=D},"./src/demux/mp4demuxer.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),P=function(){function B(_,D){this.remainderData=null,this.config=void 0,this.config=D}var U=B.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},B.probe=function(D){return Object(V.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},U.demux=function(D){var g=D,T=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(V.appendUint8Array)(this.remainderData,D));var R=Object(V.segmentValidRange)(g);this.remainderData=R.remainder,T.samples=R.valid||new Uint8Array}else T.samples=g;return{audioTrack:Object(I.dummyTrack)(),avcTrack:T,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.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)()}},U.demuxSampleAes=function(D,g,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();P.minProbeByteLength=1024,G.default=P},"./src/demux/mpegaudio.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"appendFrame",function(){return _}),L.d(G,"parseHeader",function(){return D}),L.d(G,"isHeaderPattern",function(){return g}),L.d(G,"isHeader",function(){return T}),L.d(G,"canParse",function(){return R}),L.d(G,"probe",function(){return C});var V=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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function _(w,E,l,o,s){if(l+24>E.length)return;var u=D(E,l);if(u&&l+u.frameLength<=E.length){var S=u.samplesPerFrame*9e4/u.sampleRate,p=o+s*S,h={unit:E.subarray(l,l+u.frameLength),pts:p,dts:p};return w.config=[],w.channelCount=u.channelCount,w.samplerate=u.sampleRate,w.samples.push(h),{sample:h,length:u.frameLength,missing:0}}}function D(w,E){var l=w[E+1]>>3&3,o=w[E+1]>>1&3,s=w[E+2]>>4&15,u=w[E+2]>>2&3;if(l!==1&&s!==0&&s!==15&&u!==3){var S=w[E+2]>>1&1,p=w[E+3]>>6,h=l===3?3-o:o===3?3:4,A=I[h*14+s-1]*1e3,y=l===3?0:l===2?1:2,c=P[y*3+u],f=p===3?1:2,d=B[l][o],a=U[o],v=d*8*a,m=Math.floor(d*A/c+S)*a;if(V===null){var b=navigator.userAgent||"",M=b.match(/Chrome\/(\d+)/i);V=M?parseInt(M[1]):0}var F=!!V&&V<=87;return F&&o===2&&A>=224e3&&p===0&&(w[E+3]=w[E+3]|128),{sampleRate:c,channelCount:f,frameLength:m,samplesPerFrame:v}}}function g(w,E){return w[E]===255&&(w[E+1]&224)===224&&(w[E+1]&6)!==0}function T(w,E){return E+1<w.length&&g(w,E)}function R(w,E){var l=4;return g(w,E)&&l<=w.length-E}function C(w,E){if(E+1<w.length&&g(w,E)){var l=4,o=D(w,E),s=l;o!=null&&o.frameLength&&(s=o.frameLength);var u=E+s;return u===w.length||T(w,u)}return!1}},"./src/demux/sample-aes.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),P=function(){function B(_,D,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new V.default(_,D,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(D,g){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,g)},U.decryptAacSample=function(D,g,T,R){var C=D[g].unit,w=C.subarray(16,C.length-C.length%16),E=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),l=this;this.decryptBuffer(E,function(o){var s=new Uint8Array(o);C.set(s,16),R||l.decryptAacSamples(D,g+1,T)})},U.decryptAacSamples=function(D,g,T){for(;;g++){if(g>=D.length){T();return}if(D[g].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(D,g,T,R),!R)return}},U.getAvcEncryptedData=function(D){for(var g=Math.floor((D.length-48)/160)*16+16,T=new Int8Array(g),R=0,C=32;C<=D.length-16;C+=160,R+=16)T.set(D.subarray(C,C+16),R);return T},U.getAvcDecryptedUnit=function(D,g){for(var T=new Uint8Array(g),R=0,C=32;C<=D.length-16;C+=160,R+=16)D.set(T.subarray(R,R+16),C);return D},U.decryptAvcSample=function(D,g,T,R,C,w){var E=Object(I.discardEPB)(C.data),l=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(l.buffer,function(s){C.data=o.getAvcDecryptedUnit(E,s),w||o.decryptAvcSamples(D,g,T+1,R)})},U.decryptAvcSamples=function(D,g,T,R){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,T=0){if(g>=D.length){R();return}for(var C=D[g].units;!(T>=C.length);T++){var w=C[T];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(D,g,T,R,w,E),!E)return}}},B}();G.default=P},"./src/demux/transmuxer-interface.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C});var V=L("./node_modules/webworkify-webpack/index.js"),I=L.n(V),P=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),U=L("./src/utils/logger.ts"),_=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),g=L("./node_modules/eventemitter3/index.js"),T=L.n(g),R=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function w(l,o,s,u){var S=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=l,this.id=o,this.onTransmuxComplete=s,this.onFlush=u;var p=l.config,h=function(d,a){a=a||{},a.frag=S.frag,a.id=S.id,l.trigger(d,a)};this.observer=new g.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,h),this.observer.on(P.Events.ERROR,h);var A={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var c;try{c=this.worker=V("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){l.trigger(P.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:A,vendor:y,id:o,config:JSON.stringify(p)})}catch(f){U.logger.warn("Error in worker:",f),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new B.default(this.observer,A,p,y,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,p,y,o)}var E=w.prototype;return E.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},E.push=function(o,s,u,S,p,h,A,y,c,f){var d=this;c.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,m=h?h.start:p.start,b=p.decryptdata,M=this.frag,F=!(M&&p.cc===M.cc),j=!(M&&c.level===M.level),W=M?c.sn-M.sn:-1,k=this.part?c.part-this.part.index:1,O=!j&&(W===1||W===0&&k===1),K=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=K),h&&(k||!O)&&(h.stats.parsing.start=K);var Y=new B.TransmuxState(F,O,y,j,m);if(!O||F){U.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+O+`
|
|
accurateTimeOffset: `+y+`
|
|
timeOffset: `+m);var q=new B.TransmuxConfig(u,S,s,A,f);this.configureTransmuxer(q)}if(this.frag=p,this.part=h,v)v.postMessage({cmd:"demux",data:o,decryptdata:b,chunkMeta:c,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var ie=a.push(o,b,c,Y);Object(B.isPromise)(ie)?ie.then(function(Te){d.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ie)}},E.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(u){var p=u.flush(o);Object(B.isPromise)(p)?p.then(function(h){s.handleFlushResult(h,o)}):this.handleFlushResult(p,o)}},E.handleFlushResult=function(o,s){var u=this;o.forEach(function(S){u.handleTransmuxComplete(S)}),this.onFlush(s)},E.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}}},E.configureTransmuxer=function(o){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return _});var V=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),P=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),U=L.n(B);function _(C){var w=new B.EventEmitter,E=function(o,s){C.postMessage({event:o,data:s})};w.on(I.Events.FRAG_DECRYPTED,E),w.on(I.Events.ERROR,E),C.addEventListener("message",function(l){var o=l.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new V.default(w,o.typeSupported,s,o.vendor,o.id),Object(P.enableLogs)(s.debug),E("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(V.isPromise)(u)?u.then(function(h){D(C,h)}):D(C,u);break}case"flush":{var S=o.chunkMeta,p=C.transmuxer.flush(S);Object(V.isPromise)(p)?p.then(function(h){T(C,h,S)}):T(C,p,S);break}default:break}})}function D(C,w){if(R(w.remuxResult))return;var E=[],l=w.remuxResult,o=l.audio,s=l.video;o&&g(E,o),s&&g(E,s),C.postMessage({event:"transmuxComplete",data:w},E)}function g(C,w){w.data1&&C.push(w.data1.buffer),w.data2&&C.push(w.data2.buffer)}function T(C,w,E){w.forEach(function(l){D(C,l)}),C.postMessage({event:"flush",data:E})}function R(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return s}),L.d(G,"isPromise",function(){return p}),L.d(G,"TransmuxConfig",function(){return h}),L.d(G,"TransmuxState",function(){return A});var V=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),U=L("./src/demux/mp4demuxer.ts"),_=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),g=L("./src/remux/mp4-remuxer.ts"),T=L("./src/remux/passthrough-remuxer.ts"),R=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),w=L("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(y){w.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var l=[{demux:_.default,remux:g.default},{demux:U.default,remux:T.default},{demux:B.default,remux:g.default},{demux:D.default,remux:g.default}],o=1024;l.forEach(function(y){var c=y.demux;o=Math.max(o,c.minProbeByteLength)});var s=function(){function y(f,d,a,v,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new R.default,this.observer=f,this.typeSupported=d,this.config=a,this.vendor=v,this.id=m}var c=y.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,a,v,m){var b=this,M=v.transmuxing;M.executeStart=E();var F=new Uint8Array(d),j=this.cache,W=this.config,k=this.currentTransmuxState,O=this.transmuxConfig;m&&(this.currentTransmuxState=m);var K=u(F,a);if(K&&K.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var q=Y.softwareDecrypt(F,K.key.buffer,K.iv.buffer);if(!q)return M.executeEnd=E(),S(v);F=new Uint8Array(q)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,K.key.buffer,K.iv.buffer).then(function(Se){var Re=b.push(Se,null,v);return b.decryptionPromise=null,Re}),this.decryptionPromise}var ie=m||k,Te=ie.contiguous,ve=ie.discontinuity,ge=ie.trackSwitch,he=ie.accurateTimeOffset,ce=ie.timeOffset,ae=O.audioCodec,me=O.videoCodec,Q=O.defaultInitPts,ne=O.duration,Z=O.initSegmentData;if((ve||ge)&&this.resetInitSegment(Z,ae,me,ne),ve&&this.resetInitialTimestamp(Q),Te||this.resetContiguity(),this.needsProbing(F,ve,ge)){if(j.dataLength){var Ee=j.flush();F=Object(C.appendUint8Array)(Ee,F)}this.configureTransmuxer(F,O)}var Ae=this.transmux(F,K,ce,he,v),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,M.executeEnd=E(),Ae},c.flush=function(d){var a=this,v=d.transmuxing;v.executeStart=E();var m=this.decrypter,b=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(d)});var j=[],W=M.timeOffset;if(m){var k=m.flush();k&&j.push(this.push(k,null,d))}var O=b.dataLength;b.reset();var K=this.demuxer,Y=this.remuxer;if(!K||!Y)return O>=o&&this.observer.emit(V.Events.ERROR,V.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=E(),[S(d)];var q=K.flush(W);return p(q)?q.then(function(ie){return a.flushRemux(j,ie,d),j}):(this.flushRemux(j,q,d),j)},c.flushRemux=function(d,a,v){var m=a.audioTrack,b=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,k=j.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var O=this.remuxer.remux(m,b,M,F,k,W,!0,this.id);d.push({remuxResult:O,chunkMeta:v}),v.transmuxing.executeEnd=E()},c.resetInitialTimestamp=function(d){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(d),v.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},c.resetInitSegment=function(d,a,v,m){var b=this.demuxer,M=this.remuxer;if(!b||!M)return;b.resetInitSegment(a,v,m),M.resetInitSegment(d,a,v)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,a,v,m,b){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(d,a,v,m,b):M=this.transmuxUnencrypted(d,v,m,b),M},c.transmuxUnencrypted=function(d,a,v,m){var b=this.demuxer.demux(d,a,!1,!this.config.progressive),M=b.audioTrack,F=b.avcTrack,j=b.id3Track,W=b.textTrack,k=this.remuxer.remux(M,F,j,W,a,v,!1,this.id);return{remuxResult:k,chunkMeta:m}},c.transmuxSampleAes=function(d,a,v,m,b){var M=this;return this.demuxer.demuxSampleAes(d,a,v).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,m,!1,M.id);return{remuxResult:j,chunkMeta:b}})},c.configureTransmuxer=function(d,a){for(var v=this.config,m=this.observer,b=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,k=a.initSegmentData,O=a.videoCodec,K,Y=0,q=l.length;Y<q;Y++)if(l[Y].demux.probe(d)){K=l[Y];break}K||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:U.default,remux:T.default});var ie=this.demuxer,Te=this.remuxer,ve=K.remux,ge=K.demux;(!Te||!(Te instanceof ve))&&(this.remuxer=new ve(m,v,b,M)),(!ie||!(ie instanceof ge))&&(this.demuxer=new ge(m,v,b),this.probe=ge.probe),this.resetInitSegment(k,F,O,W),this.resetInitialTimestamp(j)},c.needsProbing=function(d,a,v){return!this.demuxer||!this.remuxer||a||v},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new P.default(this.observer,this.config)),d},y}();function u(y,c){var f=null;return y.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var S=function(c){return{remuxResult:{},chunkMeta:c}};function p(y){return"then"in y&&y.then instanceof Function}var h=function(c,f,d,a,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=f,this.initSegmentData=d,this.duration=a,this.defaultInitPts=v},A=function(c,f,d,a,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=f,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"discardEPB",function(){return S});var V=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),P=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),U=L("./src/demux/sample-aes.ts"),_=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),g=L("./src/utils/logger.ts"),T=L("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},C=function(){function p(A,y,c){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=A,this.config=y,this.typeSupported=c}p.probe=function(y){var c=p.syncOffset(y);return c<0?!1:(c&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},p.syncOffset=function(y){for(var c=Math.min(1e3,y.length-3*188),f=0;f<c;){if(y[f]===71&&y[f+188]===71&&y[f+2*188]===71)return f;f++}return-1},p.createTrack=function(y,c){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:R[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?c:void 0}};var h=p.prototype;return h.resetInitSegment=function(y,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",f),this._audioTrack=p.createTrack("audio",f),this._id3Track=p.createTrack("id3",f),this._txtTrack=p.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=c,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var y=this._audioTrack,c=this._avcTrack,f=this._id3Track;y&&(y.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(y,c,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var a,v=this._avcTrack,m=this._audioTrack,b=this._id3Track,M=v.pid,F=v.pesData,j=m.pid,W=b.pid,k=m.pesData,O=b.pesData,K=!1,Y=this.pmtParsed,q=this._pmtId,ie=y.length;if(this.remainderData&&(y=Object(D.appendUint8Array)(this.remainderData,y),ie=y.length,this.remainderData=null),ie<188&&!d)return this.remainderData=y,{audioTrack:m,avcTrack:v,id3Track:b,textTrack:this._txtTrack};var Te=Math.max(0,p.syncOffset(y));ie-=(ie+Te)%188,ie<y.byteLength&&!d&&(this.remainderData=new Uint8Array(y.buffer,ie,y.buffer.byteLength-ie));for(var ve=Te;ve<ie;ve+=188)if(y[ve]===71){var ge=!!(y[ve+1]&64),he=((y[ve+1]&31)<<8)+y[ve+2],ce=(y[ve+3]&48)>>4,ae=void 0;if(ce>1){if(ae=ve+5+y[ve+4],ae===ve+188)continue}else ae=ve+4;switch(he){case M:ge&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(y.subarray(ae,ve+188)),F.size+=ve+188-ae);break;case j:ge&&(k&&(a=o(k))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),k={data:[],size:0}),k&&(k.data.push(y.subarray(ae,ve+188)),k.size+=ve+188-ae);break;case W:ge&&(O&&(a=o(O))&&this.parseID3PES(a),O={data:[],size:0}),O&&(O.data.push(y.subarray(ae,ve+188)),O.size+=ve+188-ae);break;case 0:ge&&(ae+=y[ae]+1),q=this._pmtId=E(y,ae);break;case q:{ge&&(ae+=y[ae]+1);var me=l(y,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);M=me.avc,M>0&&(v.pid=M),j=me.audio,j>0&&(m.pid=j,m.isAAC=me.isAAC),W=me.id3,W>0&&(b.pid=W),K&&!Y&&(g.logger.log("reparse from beginning"),K=!1,ve=Te-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,m.pesData=k,b.pesData=O;var Q={audioTrack:m,avcTrack:v,id3Track:b,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(Q),Q},h.flush=function(){var y=this.remainderData;this.remainderData=null;var c;return y?c=this.demux(y,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},h.extractRemainingSamples=function(y){var c=y.audioTrack,f=y.avcTrack,d=y.id3Track,a=f.pesData,v=c.pesData,m=d.pesData,b;a&&(b=o(a))?(this.parseAVCPES(b,!0),f.pesData=null):f.pesData=a,v&&(b=o(v))?(c.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),c.pesData=null):(v!=null&&v.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=v),m&&(b=o(m))?(this.parseID3PES(b),d.pesData=null):d.pesData=m},h.demuxSampleAes=function(y,c,f){var d=this.demux(y,f,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,c);return this.decrypt(d,a)},h.decrypt=function(y,c){return new Promise(function(f){var d=y.audioTrack,a=y.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){a.samples?c.decryptAvcSamples(a.samples,0,0,function(){f(y)}):f(y)}):a.samples&&c.decryptAvcSamples(a.samples,0,0,function(){f(y)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(y,c){var f=this,d=this._avcTrack,a=this.parseAVCNALu(y.data),v=!1,m=this.avcSample,b,M=!1;y.data=null,m&&a.length&&!d.audFound&&(s(m,d),m=this.avcSample=w(!1,y.pts,y.dts,"")),a.forEach(function(F){switch(F.type){case 1:{b=!0,m||(m=f.avcSample=w(!0,y.pts,y.dts,"")),v&&(m.debug+="NDR "),m.frame=!0;var j=F.data;if(M&&j.length>4){var W=new P.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:b=!0,m||(m=f.avcSample=w(!0,y.pts,y.dts,"")),v&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{b=!0,v&&m&&(m.debug+="SEI ");var k=new P.default(S(F.data));k.readUByte();for(var O=0,K=0,Y=!1,q=0;!Y&&k.bytesAvailable>1;){O=0;do q=k.readUByte(),O+=q;while(q===255);K=0;do q=k.readUByte(),K+=q;while(q===255);if(O===4&&k.bytesAvailable!==0){Y=!0;var ie=k.readUByte();if(ie===181){var Te=k.readUShort();if(Te===49){var ve=k.readUInt();if(ve===1195456820){var ge=k.readUByte();if(ge===3){for(var he=k.readUByte(),ce=k.readUByte(),ae=31&he,me=[he,ce],Q=0;Q<ae;Q++)me.push(k.readUByte()),me.push(k.readUByte()),me.push(k.readUByte());u(f._txtTrack.samples,{type:3,pts:y.pts,bytes:me})}}}}}else if(O===5&&k.bytesAvailable!==0){if(Y=!0,K>16){for(var ne=[],Z=0;Z<16;Z++)ne.push(k.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ne.push("-");for(var Ee=K-16,Ae=new Uint8Array(Ee),be=0;be<Ee;be++)Ae[be]=k.readUByte();u(f._txtTrack.samples,{pts:y.pts,payloadType:O,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(K<k.bytesAvailable)for(var Se=0;Se<K;Se++)k.readUByte()}break}case 7:if(b=!0,M=!0,v&&m&&(m.debug+="SPS "),!d.sps){var Re=new P.default(F.data),Fe=Re.readSPS();d.width=Fe.width,d.height=Fe.height,d.pixelRatio=Fe.pixelRatio,d.sps=[F.data],d.duration=f._duration;for(var Ie=F.data.subarray(1,4),ke="avc1.",Oe=0;Oe<3;Oe++){var $e=Ie[Oe].toString(16);$e.length<2&&($e="0"+$e),ke+=$e}d.codec=ke}break;case 8:b=!0,v&&m&&(m.debug+="PPS "),d.pps||(d.pps=[F.data]);break;case 9:b=!1,d.audFound=!0,m&&s(m,d),m=f.avcSample=w(!1,y.pts,y.dts,v?"AUD ":"");break;case 12:b=!1;break;default:b=!1,m&&(m.debug+="unknown NAL "+F.type+" ");break}if(m&&b){var ze=m.units;ze.push(F)}}),c&&m&&(s(m,d),this.avcSample=null)},h.getLastNalUnit=function(){var y,c=this.avcSample,f;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((y=c)!==null&&y!==void 0&&y.units){var a=c.units;f=a[a.length-1]}return f},h.parseAVCNALu=function(y){var c=y.byteLength,f=this._avcTrack,d=f.naluState||0,a=d,v=[],m=0,b,M,F,j=-1,W=0;for(d===-1&&(j=0,W=y[0]&31,d=0,m=1);m<c;){if(b=y[m++],!d){d=b?0:1;continue}if(d===1){d=b?0:2;continue}if(!b)d=3;else if(b===1){if(j>=0){var k={data:y.subarray(j,m-d-1),type:W};v.push(k)}else{var O=this.getLastNalUnit();if(O&&(a&&m<=4-a&&(O.state&&(O.data=O.data.subarray(0,O.data.byteLength-a))),M=m-d-1,M>0)){var K=new Uint8Array(O.data.byteLength+M);K.set(O.data,0),K.set(y.subarray(0,M),O.data.byteLength),O.data=K,O.state=0}}m<c?(F=y[m]&31,j=m,W=F,d=0):d=-1}else d=0}if(j>=0&&d>=0){var Y={data:y.subarray(j,c),type:W,state:d};v.push(Y)}if(v.length===0){var q=this.getLastNalUnit();if(q){var ie=new Uint8Array(q.data.byteLength+y.byteLength);ie.set(q.data,0),ie.set(y,q.data.byteLength),q.data=ie}}return f.naluState=d,v},h.parseAACPES=function(y){var c=0,f=this._audioTrack,d=this.aacOverFlow,a=y.data;if(d){this.aacOverFlow=null;var v=d.sample.unit.byteLength,m=Math.min(d.missing,v),b=v-m;d.sample.unit.set(a.subarray(0,m),b),f.samples.push(d.sample),c=d.missing}var M,F;for(M=c,F=a.length;M<F-1&&!V.isHeader(a,M);M++);if(M!==c){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),g.logger.warn("parsing error:"+j),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}V.initTrackConfig(f,this.observer,a,M,this.audioCodec);var k;if(y.pts!==void 0)k=y.pts;else if(d){var O=V.getFrameDuration(f.samplerate);k=d.sample.pts+O}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;M<F;)if(V.isHeader(a,M)){if(M+5<F){var Y=V.appendFrame(f,a,M,k,K);if(Y)if(Y.missing)this.aacOverFlow=Y;else{M+=Y.length,K++;continue}}break}else M++},h.parseMPEGPES=function(y){var c=y.data,f=c.length,d=0,a=0,v=y.pts;if(v===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(I.isHeader(c,a)){var m=I.appendFrame(this._audioTrack,c,a,v,d);if(m)a+=m.length,d++;else break}else a++},h.parseID3PES=function(y){if(y.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},p}();C.minProbeByteLength=188;function w(p,h,A,y){return{key:p,frame:!1,pts:h,dts:A,units:[],debug:y,length:0}}function E(p,h){return(p[h+10]&31)<<8|p[h+11]}function l(p,h,A,y){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(p[h+1]&15)<<8|p[h+2],d=h+3+f-4,a=(p[h+10]&15)<<8|p[h+11];for(h+=12+a;h<d;){var v=(p[h+1]&31)<<8|p[h+2];switch(p[h]){case 207:if(!y){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=v);break;case 21:c.id3===-1&&(c.id3=v);break;case 219:if(!y){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=v);break;case 3:case 4:A?c.audio===-1&&(c.audio=v,c.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((p[h+3]&15)<<8|p[h+4])+5}return c}function o(p){var h=0,A,y,c,f,d,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}A=a[0];var m=(A[0]<<16)+(A[1]<<8)+A[2];if(m===1){if(y=(A[4]<<8)+A[5],y&&y>p.size-6)return null;var b=A[7];b&192&&(f=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,b&64?(d=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,f-d>60*9e4&&(g.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),c=A[8];var M=c+9;if(p.size<=M)return null;p.size-=M;for(var F=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){A=a[j];var k=A.byteLength;if(M)if(M>k){M-=k;continue}else A=A.subarray(M),k-=M,M=0;F.set(A,h),h+=k}return y&&(y-=c+3),{data:F,pts:f,dts:d,len:y}}return null}function s(p,h){if(p.units.length&&p.frame){if(p.pts===void 0){var A=h.samples,y=A.length;if(y){var c=A[y-1];p.pts=c.pts,p.dts=c.dts}else{h.dropped++;return}}h.samples.push(p)}p.debug.length&&g.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function u(p,h){var A=p.length;if(A>0){if(h.pts>=p[A-1].pts)p.push(h);else for(var y=A-1;y>=0;y--)if(h.pts<p[y].pts){p.splice(y,0,h);break}}else p.push(h)}function S(p){for(var h=p.byteLength,A=[],y=1;y<h-2;)p[y]===0&&p[y+1]===0&&p[y+2]===3?(A.push(y+2),y+=2):y++;if(A.length===0)return p;var c=h-A.length,f=new Uint8Array(c),d=0;for(y=0;y<c;d++,y++)d===A[0]&&(d++,A.shift()),f[y]=p[d];return f}G.default=C},"./src/errors.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"ErrorTypes",function(){return V}),L.d(G,"ErrorDetails",function(){return I});var V;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(V||(V={}));var I;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"Events",function(){return V});var V;(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"})(V||(V={}))},"./src/hls.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return p});var V=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(V),P=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),U=L("./src/controller/id3-track-controller.ts"),_=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),g=L("./src/controller/fragment-tracker.ts"),T=L("./src/controller/stream-controller.ts"),R=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),w=L("./src/config.ts"),E=L("./node_modules/eventemitter3/index.js"),l=L.n(E),o=L("./src/events.ts"),s=L("./src/errors.ts");function u(h,A){for(var y=0;y<A.length;y++){var c=A[y];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function S(h,A,y){return A&&u(h.prototype,A),y&&u(h,y),h}var p=function(){h.isSupported=function(){return Object(R.isSupported)()};function h(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.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 c=this.config=Object(w.mergeConfig)(h.DefaultConfig,y);this.userConfig=y,Object(C.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(w.enableStreamingMode)(c);var f=c.abrController,d=c.bufferController,a=c.capLevelController,v=c.fpsController,m=this.abrController=new f(this),b=this.bufferController=new d(this),M=this.capLevelController=new a(this),F=new v(this),j=new P.default(this),W=new B.default(this),k=new U.default(this),O=this.levelController=new D.default(this),K=new g.FragmentTracker(this),Y=this.streamController=new T.default(this,K);M.setStreamController(Y),F.setStreamController(Y);var q=[O,Y];this.networkControllers=q;var ie=[j,W,m,b,M,F,k,K];this.audioTrackController=this.createController(c.audioTrackController,null,q),this.createController(c.audioStreamController,K,q),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,q),this.createController(c.subtitleStreamController,K,q),this.createController(c.timelineController,null,ie),this.emeController=this.createController(c.emeController,null,ie),this.cmcdController=this.createController(c.cmcdController,null,ie),this.latencyController=this.createController(_.default,null,ie),this.coreComponents=ie}var A=h.prototype;return A.createController=function(c,f,d){if(c){var a=f?new c(this,f):new c(this);return d&&d.push(a),a}return null},A.on=function(c,f,d){d===void 0&&(d=this),this._emitter.on(c,f,d)},A.once=function(c,f,d){d===void 0&&(d=this),this._emitter.once(c,f,d)},A.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},A.off=function(c,f,d,a){d===void 0&&(d=this),this._emitter.off(c,f,d,a)},A.listeners=function(c){return this._emitter.listeners(c)},A.emit=function(c,f,d){return this._emitter.emit(c,f,d)},A.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(d){C.logger.error("An internal error happened while handling event "+c+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:d})}return!1},A.listenerCount=function(c){return this._emitter.listenerCount(c)},A.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(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},A.attachMedia=function(c){C.logger.log("attachMedia"),this._media=c,this.trigger(o.Events.MEDIA_ATTACHING,{media:c})},A.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(c){this.stopLoad();var f=this.media,d=this.url,a=this.url=V.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),f&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:c})},A.startLoad=function(c){c===void 0&&(c=-1),C.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},A.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},A.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){C.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},A.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},S(h,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){C.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){C.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){C.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){C.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){C.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(C.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,a=0;a<d;a++)if(c[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,d;return f===-1&&c&&c.length?d=c.length-1:d=f,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{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 h.defaultConfig?h.defaultConfig:w.hlsDefaultConfig},set:function(c){h.defaultConfig=c}}]),h}();p.defaultConfig=void 0},"./src/is-supported.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isSupported",function(){return P}),L.d(G,"changeTypeSupported",function(){return B});var V=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var U=Object(V.getMediaSource)();if(!U)return!1;var _=I(),D=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!D&&!!g}function B(){var U,_=I();return typeof(_==null||((U=_.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return C}),L.d(G,"LoadError",function(){return E});var V=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function P(l,o){l.prototype=Object.create(o.prototype),l.prototype.constructor=l,g(l,o)}function B(l){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,S)}function S(){return U(u,arguments,T(this).constructor)}return S.prototype=Object.create(u.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),g(S,u)},B(l)}function U(l,o,s){return _()?U=Reflect.construct:U=function(S,p,h){var A=[null];A.push.apply(A,p);var y=Function.bind.apply(S,A),c=new y;return h&&g(c,h.prototype),c},U.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(l){return!1}}function D(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function g(l,o){return g=Object.setPrototypeOf||function(u,S){return u.__proto__=S,u},g(l,o)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},T(l)}var R=Math.pow(2,17),C=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=l.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,S){var p=this,h=u.url;if(!h)return Promise.reject(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var A=this.config,y=A.fLoader,c=A.loader;return new Promise(function(f,d){p.loader&&p.loader.destroy();var a=p.loader=u.loader=y?new y(A):new c(A),v=w(u),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:R};u.stats=a.stats,a.load(v,m,{onSuccess:function(M,F,j,W){p.resetLoader(u,a),f({frag:u,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){p.resetLoader(u,a),d(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:M,networkDetails:j}))},onAbort:function(M,F,j){p.resetLoader(u,a),d(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(M,F,j){p.resetLoader(u,a),d(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(M,F,j,W){S&&S({frag:u,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(u,S,p){var h=this;this.abort();var A=this.config,y=A.fLoader,c=A.loader;return new Promise(function(f,d){h.loader&&h.loader.destroy();var a=h.loader=u.loader=y?new y(A):new c(A),v=w(u,S),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:R};S.stats=a.stats,a.load(v,m,{onSuccess:function(M,F,j,W){h.resetLoader(u,a),h.updateStatsFromPart(u,S);var k={frag:u,part:S,payload:M.data,networkDetails:W};p(k),f(k)},onError:function(M,F,j){h.resetLoader(u,a),d(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:S,response:M,networkDetails:j}))},onAbort:function(M,F,j){u.stats.aborted=S.stats.aborted,h.resetLoader(u,a),d(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:S,networkDetails:j}))},onTimeout:function(M,F,j){h.resetLoader(u,a),d(new E({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(u,S){var p=u.stats,h=S.stats,A=h.total;if(p.loaded+=h.loaded,A){var y=Math.round(u.duration/S.duration),c=Math.min(Math.round(p.loaded/A),y),f=y-c,d=f*Math.round(p.loaded/c);p.total=p.loaded+d}else p.total=Math.max(p.loaded,p.total);var a=p.loading,v=h.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(u,S){u.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},l}();function w(l,o){o===void 0&&(o=null);var s=o||l,u={frag:l,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,p=s.byteRangeEndOffset;return Object(V.isFiniteNumber)(S)&&Object(V.isFiniteNumber)(p)&&(u.rangeStart=S,u.rangeEnd=p),u}var E=function(l){P(o,l);function o(s){for(var u,S=arguments.length,p=new Array(S>1?S-1:0),h=1;h<S;h++)p[h-1]=arguments[h];return u=l.call.apply(l,[this].concat(p))||this,u.data=void 0,u.data=s,u}return o}(B(Error))},"./src/loader/fragment.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"ElementaryStreamTypes",function(){return C}),L.d(G,"BaseSegment",function(){return w}),L.d(G,"Fragment",function(){return E}),L.d(G,"Part",function(){return l});var V=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(I),B=L("./src/utils/logger.ts"),U=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,g(o,s)}function g(o,s){return g=Object.setPrototypeOf||function(S,p){return S.__proto__=p,S},g(o,s)}function T(o,s){for(var u=0;u<s.length;u++){var S=s[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function R(o,s,u){return s&&T(o.prototype,s),u&&T(o,u),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var w=function(){function o(u){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[C.AUDIO]=null,S[C.VIDEO]=null,S[C.AUDIOVIDEO]=null,S),this.baseurl=u}var s=o.prototype;return s.setByteRange=function(S,p){var h=S.split("@",2),A=[];h.length===1?A[0]=p?p.byteRangeEndOffset:0:A[0]=parseInt(h[1]),A[1]=parseInt(h[0])+A[0],this._byteRange=A},R(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(S){this._url=S}}]),o}(),E=function(o){D(s,o);function s(S,p){var h;return h=o.call(this,p)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new _.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=S,h}var u=s.prototype;return u.createInitializationVector=function(p){for(var h=new Uint8Array(16),A=12;A<16;A++)h[A]=p>>8*(15-A)&255;return h},u.setDecryptDataFromLevelKey=function(p,h){var A=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(A=U.LevelKey.fromURI(p.uri),A.method=p.method,A.iv=this.createInitializationVector(h),A.keyFormat="identity"),A},u.setElementaryStreamInfo=function(p,h,A,y,c,f){f===void 0&&(f=!1);var d=this.elementaryStreams,a=d[p];if(!a){d[p]={startPTS:h,endPTS:A,startDTS:y,endDTS:c,partial:f};return}a.startPTS=Math.min(a.startPTS,h),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,c)},u.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},R(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(V.isFiniteNumber)(this.programDateTime))return null;var p=Object(V.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),s}(w),l=function(o){D(s,o);function s(u,S,p,h,A){var y;y=o.call(this,p)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new _.LoadStats,y.duration=u.decimalFloatingPoint("DURATION"),y.gap=u.bool("GAP"),y.independent=u.bool("INDEPENDENT"),y.relurl=u.enumeratedString("URI"),y.fragment=S,y.index=h;var c=u.enumeratedString("BYTERANGE");return c&&y.setByteRange(c,A),A&&(y.fragOffset=A.fragOffset+A.duration),y}return R(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 S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(w)},"./src/loader/key-loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return B});var V=L("./src/events.ts"),I=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),B=function(){function U(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var _=U.prototype;return _._registerListeners=function(){this.hls.on(V.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(V.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var T=this.loaders[g];T&&T.destroy()}this.loaders={}},_.onKeyLoading=function(g,T){var R=T.frag,C=R.type,w=this.loaders[C];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=R.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(w&&(P.logger.warn("abort previous key loader for type:"+C),w.abort()),!E){P.logger.warn("key uri is falsy");return}var o=l.loader,s=R.loader=this.loaders[C]=new o(l);this.decrypturl=E,this.decryptkey=null;var u={url:E,frag:R,responseType:"arraybuffer"},S={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,S,p)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(V.Events.KEY_LOADED,{frag:R}))},_.loadsuccess=function(g,T,R){var C=R.frag;if(!C.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(g.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(V.Events.KEY_LOADED,{frag:C})},_.loaderror=function(g,T){var R=T.frag,C=R.loader;C&&C.abort(),delete this.loaders[R.type],this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:g})},_.loadtimeout=function(g,T){var R=T.frag,C=R.loader;C&&C.abort(),delete this.loaders[R.type],this.hls.trigger(V.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},U}()},"./src/loader/level-details.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"LevelDetails",function(){return U});var V=L("./src/polyfills/number.ts");function I(_,D){for(var g=0;g<D.length;g++){var T=D[g];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}function P(_,D,g){return D&&I(_.prototype,D),g&&I(_,g),_}var B=10,U=function(){function _(g){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=g}var D=_.prototype;return D.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-T.lastPartSn,C=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!C||!!R,this.advanced=this.endSN>T.endSN||R>0||R===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},P(_,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(V.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var R=this.driftEnd-this.driftStart;return R*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"LevelKey",function(){return U});var V=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(V);function P(_,D){for(var g=0;g<D.length;g++){var T=D[g];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}function B(_,D,g){return D&&P(_.prototype,D),g&&P(_,g),_}var U=function(){_.fromURL=function(g,T){return new _(g,T)},_.fromURI=function(g){return new _(g)};function _(D,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(V.buildAbsoluteURL)(D,g,{alwaysNormalize:!0}):this._uri=D}return B(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"LoadStats",function(){return V});var V=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return s});var V=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),P=L.n(I),B=L("./src/loader/fragment.ts"),U=L("./src/loader/level-details.ts"),_=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),g=L("./src/utils/logger.ts"),T=L("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function o(A){var y,c;return l.test((y=(c=I.parseURL(A))===null||c===void 0?void 0:c.path)!=null?y:"")}var s=function(){function A(){}return A.findGroup=function(c,f){for(var d=0;d<c.length;d++){var a=c[d];if(a.id===f)return a}},A.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return c},A.resolve=function(c,f){return I.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(c,f){var d=[],a={},v=!1;R.lastIndex=0;for(var m;(m=R.exec(c))!=null;)if(m[1]){var b=new D.AttrList(m[1]),M={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:A.resolve(m[2],f)},F=b.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),u((b.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=A.convertAVC1ToAVCOTI(M.videoCodec)),d.push(M)}else if(m[3]){var j=new D.AttrList(m[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:d,sessionData:v?a:null}},A.parseMasterPlaylistMedia=function(c,f,d,a){a===void 0&&(a=[]);var v,m=[],b=0;for(C.lastIndex=0;(v=C.exec(c))!==null;){var M=new D.AttrList(v[1]);if(M.TYPE===d){var F={attrs:M,bitrate:0,id:b++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:d,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?A.resolve(M.URI,f):""};if(a.length){var j=A.findGroup(a,F.groupId)||a[0];S(F,j,"audioCodec"),S(F,j,"textCodec")}m.push(F)}}return m},A.parseLevelPlaylist=function(c,f,d,a,v){var m=new U.LevelDetails(f),b=m.fragments,M=null,F=0,j=0,W=0,k=0,O=null,K=new B.Fragment(a,f),Y,q,ie,Te=-1,ve=!1;for(w.lastIndex=0,m.m3u8=c;(Y=w.exec(c))!==null;){ve&&(ve=!1,K=new B.Fragment(a,f),K.start=W,K.sn=F,K.cc=k,K.level=d,M&&(K.initSegment=M,K.rawProgramDateTime=M.rawProgramDateTime));var ge=Y[1];if(ge){K.duration=parseFloat(ge);var he=(" "+Y[2]).slice(1);K.title=he||null,K.tagList.push(he?["INF",ge,he]:["INF",ge])}else if(Y[3])Object(V.isFiniteNumber)(K.duration)&&(K.start=W,ie&&(K.levelkey=ie),K.sn=F,K.level=d,K.cc=k,K.urlId=v,b.push(K),K.relurl=(" "+Y[3]).slice(1),h(K,O),O=K,W+=K.duration,F++,j=0,ve=!0);else if(Y[4]){var ce=(" "+Y[4]).slice(1);O?K.setByteRange(ce,O):K.setByteRange(ce)}else if(Y[5])K.rawProgramDateTime=(" "+Y[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),Te===-1&&(Te=b.length);else{if(Y=Y[0].match(E),!Y){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<Y.length&&!(typeof Y[q]!="undefined");q++);var ae=(" "+Y[q]).slice(1),me=(" "+Y[q+1]).slice(1),Q=Y[q+2]?(" "+Y[q+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":m.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":F=m.startSN=parseInt(me);break;case"SKIP":{var ne=new D.AttrList(me),Z=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(V.isFiniteNumber)(Z)){m.skippedSegments=Z;for(var Ee=Z;Ee--;)b.unshift(null);F+=Z}var Ae=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(m.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(me);break;case"VERSION":m.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(me||Q)&&K.tagList.push(Q?[me,Q]:[me]);break;case"DIS":k++;case"GAP":K.tagList.push([ae]);break;case"BITRATE":K.tagList.push([ae,me]);break;case"DISCONTINUITY-SEQ":k=parseInt(me);break;case"KEY":{var be,Se=new D.AttrList(me),Re=Se.enumeratedString("METHOD"),Fe=Se.URI,Ie=Se.hexadecimalInteger("IV"),ke=Se.enumeratedString("KEYFORMATVERSIONS"),Oe=Se.enumeratedString("KEYID"),$e=(be=Se.enumeratedString("KEYFORMAT"))!=null?be:"identity",ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ze.indexOf($e)>-1){g.logger.warn("Keyformat "+$e+" is not supported from the manifest");continue}else if($e!=="identity")continue;Re&&(ie=_.LevelKey.fromURL(f,Fe),Fe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(ie.method=Re,ie.keyFormat=$e,Oe&&(ie.keyID=Oe),ke&&(ie.keyFormatVersions=ke),ie.iv=Ie));break}case"START":{var Ve=new D.AttrList(me),Ge=Ve.decimalFloatingPoint("TIME-OFFSET");Object(V.isFiniteNumber)(Ge)&&(m.startTimeOffset=Ge);break}case"MAP":{var rt=new D.AttrList(me);K.relurl=rt.URI,rt.BYTERANGE&&K.setByteRange(rt.BYTERANGE),K.level=d,K.sn="initSegment",ie&&(K.levelkey=ie),K.initSegment=null,M=K,ve=!0;break}case"SERVER-CONTROL":{var Qe=new D.AttrList(me);m.canBlockReload=Qe.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Qe.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Qe.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Qe.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new D.AttrList(me);m.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=m.partList;Ce||(Ce=m.partList=[]);var qe=j>0?Ce[Ce.length-1]:void 0,Xe=j++,Le=new B.Part(new D.AttrList(me),K,f,Xe,qe);Ce.push(Le),K.duration+=Le.duration;break}case"PRELOAD-HINT":{var _e=new D.AttrList(me);m.preloadHint=_e;break}case"RENDITION-REPORT":{var pe=new D.AttrList(me);m.renditionReports=m.renditionReports||[],m.renditionReports.push(pe);break}default:g.logger.warn("line parsed but not handled: "+Y);break}}}O&&!O.relurl?(b.pop(),W-=O.duration,m.partList&&(m.fragmentHint=O)):m.partList&&(h(K,O),K.cc=k,m.fragmentHint=K);var le=b.length,ue=b[0],$=b[le-1];if(W+=m.skippedSegments*m.targetduration,W>0&&le&&$){m.averagetargetduration=W/le;var J=$.sn;m.endSN=J!=="initSegment"?J:0,ue&&(m.startCC=ue.cc,ue.initSegment||m.fragments.every(function(ee){return ee.relurl&&o(ee.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(a,f),K.relurl=$.relurl,K.level=d,K.sn="initSegment",ue.initSegment=K,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=k,Te>0&&p(b,Te),m},A}();function u(A,y){["video","audio","text"].forEach(function(c){var f=A.filter(function(a){return Object(T.isCodecType)(a,c)});if(f.length){var d=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[c+"Codec"]=d.length>0?d[0]:f[0],A=A.filter(function(a){return f.indexOf(a)===-1})}}),y.unknownCodecs=A}function S(A,y,c){var f=y[c];f&&(A[c]=f)}function p(A,y){for(var c=A[y],f=y;f--;){var d=A[f];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function h(A,y){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):y!=null&&y.programDateTime&&(A.programDateTime=y.endProgramDateTime),Object(V.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),P=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),U=L("./src/utils/mp4-tools.ts"),_=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),g=L("./src/utils/attr-list.ts");function T(w){var E=w.type;switch(E){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function R(w,E){var l=w.url;return(l===void 0||l.indexOf("data:")===0)&&(l=E.url),l}var C=function(){function w(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var E=w.prototype;return E.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)},E.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)},E.createInternalLoader=function(o){var s=this.hls.config,u=s.pLoader,S=s.loader,p=u||S,h=new p(s);return o.loader=h,this.loaders[o.type]=h,h},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.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})},E.onLevelLoading=function(o,s){var u=s.id,S=s.level,p=s.url,h=s.deliveryDirectives;this.load({id:u,groupId:null,level:S,responseType:"text",type:D.PlaylistContextType.LEVEL,url:p,deliveryDirectives:h})},E.onAudioTrackLoading=function(o,s){var u=s.id,S=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:u,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:h})},E.onSubtitleTrackLoading=function(o,s){var u=s.id,S=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:u,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:h})},E.load=function(o){var s,u=this.hls.config,S=this.getInternalLoader(o);if(S){var p=S.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var h,A,y,c;switch(o.type){case D.PlaylistContextType.MANIFEST:h=u.manifestLoadingMaxRetry,A=u.manifestLoadingTimeOut,y=u.manifestLoadingRetryDelay,c=u.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:h=0,A=u.levelLoadingTimeOut;break;default:h=u.levelLoadingMaxRetry,A=u.levelLoadingTimeOut,y=u.levelLoadingRetryDelay,c=u.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var f;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var d=f.partTarget,a=f.targetduration;d&&a&&(A=Math.min(Math.max(d*3,a*.8)*1e3,A))}}var v={timeout:A,maxRetry:h,retryDelay:y,maxRetryDelay:c,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,v,m)},E.loadsuccess=function(o,s,u,S){if(S===void 0&&(S=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,s,u,S);return}this.resetInternalLoader(u.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,u,S):this.handleMasterPlaylist(o,s,u,S)},E.loaderror=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,o)},E.loadtimeout=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},E.handleMasterPlaylist=function(o,s,u,S){var p=this.hls,h=o.data,A=R(o,u),y=_.default.parseMasterPlaylist(h,A),c=y.levels,f=y.sessionData;if(!c.length){this.handleManifestParsingError(o,u,"no level found in manifest",S);return}var d=c.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=c.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),v=_.default.parseMasterPlaylistMedia(h,A,"AUDIO",d),m=_.default.parseMasterPlaylistMedia(h,A,"SUBTITLES",a),b=_.default.parseMasterPlaylistMedia(h,A,"CLOSED-CAPTIONS");if(v.length){var M=v.some(function(F){return!F.url});!M&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:c,audioTracks:v,subtitles:m,captions:b,url:A,stats:s,networkDetails:S,sessionData:f})},E.handleTrackOrLevelPlaylist=function(o,s,u,S){var p=this.hls,h=u.id,A=u.level,y=u.type,c=R(o,u),f=Object(V.isFiniteNumber)(h)?h:0,d=Object(V.isFiniteNumber)(A)?A:f,a=T(u),v=_.default.parseLevelPlaylist(o.data,c,d,a,f);if(!v.fragments.length){p.trigger(I.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(y===D.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:v,name:"",url:c};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:c,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),v.needSidxRanges){var b,M=(b=v.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:M,isSidxRequest:!0,type:y,level:A,levelDetails:v,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=v,this.handlePlaylistLoaded(o,s,u,S)},E.handleSidxRequest=function(o,s){var u=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var S=u.references,p=s.levelDetails;S.forEach(function(h,A){var y=h.info,c=p.fragments[A];c.byteRange.length===0&&c.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),c.initSegment&&c.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,s,u,S){this.hls.trigger(I.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:s,networkDetails:S})},E.handleNetworkError=function(o,s,u,S){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 p=P.ErrorDetails.UNKNOWN,h=!1,A=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:p=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case D.PlaylistContextType.LEVEL:p=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.AUDIO_TRACK:p=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:p=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}A&&this.resetInternalLoader(o.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:p,fatal:h,url:o.url,loader:A,context:o,networkDetails:s};S&&(y.response=S),this.hls.trigger(I.Events.ERROR,y)},E.handlePlaylistLoaded=function(o,s,u,S){var p=u.type,h=u.level,A=u.id,y=u.groupId,c=u.loader,f=u.levelDetails,d=u.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",S);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(p){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:f,level:h||0,id:A||0,stats:s,networkDetails:S,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:f,id:A||0,groupId:y||"",stats:s,networkDetails:S,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:f,id:A||0,groupId:y||"",stats:s,networkDetails:S,deliveryDirectives:d});break}},w}();G.default=C},"./src/polyfills/number.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isFiniteNumber",function(){return V}),L.d(G,"MAX_SAFE_INTEGER",function(){return I});var V=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(te,G,L){"use strict";L.r(G);var V=function(){function I(){}return I.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(U===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(U===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();G.default=V},"./src/remux/mp4-generator.ts":function(te,G,L){"use strict";L.r(G);var V=Math.pow(2,32)-1,I=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in P.types)P.types.hasOwnProperty(U)&&(P.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.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]);P.HDLR_TYPES={video:_,audio:D};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=T,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,w,R,C),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,g))},P.box=function(U){for(var _=8,D=arguments.length,g=new Array(D>1?D-1:0),T=1;T<D;T++)g[T-1]=arguments[T];for(var R=g.length,C=R;R--;)_+=g[R].byteLength;var w=new Uint8Array(_);for(w[0]=_>>24&255,w[1]=_>>16&255,w[2]=_>>8&255,w[3]=_&255,w.set(U,4),R=0,_=8;R<C;R++)w.set(g[R],_),_+=g[R].byteLength;return w},P.hdlr=function(U){return P.box(P.types.hdlr,P.HDLR_TYPES[U])},P.mdat=function(U){return P.box(P.types.mdat,U)},P.mdhd=function(U,_){_*=U;var D=Math.floor(_/(V+1)),g=Math.floor(_%(V+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,D>>24,D>>16&255,D>>8&255,D&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},P.mdia=function(U){return P.box(P.types.mdia,P.mdhd(U.timescale,U.duration),P.hdlr(U.type),P.minf(U))},P.mfhd=function(U){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},P.minf=function(U){return U.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(U)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(U))},P.moof=function(U,_,D){return P.box(P.types.moof,P.mfhd(U),P.traf(D,_))},P.moov=function(U){for(var _=U.length,D=[];_--;)D[_]=P.trak(U[_]);return P.box.apply(null,[P.types.moov,P.mvhd(U[0].timescale,U[0].duration)].concat(D).concat(P.mvex(U)))},P.mvex=function(U){for(var _=U.length,D=[];_--;)D[_]=P.trex(U[_]);return P.box.apply(null,[P.types.mvex].concat(D))},P.mvhd=function(U,_){_*=U;var D=Math.floor(_/(V+1)),g=Math.floor(_%(V+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,D>>24,D>>16&255,D>>8&255,D&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,T)},P.sdtp=function(U){var _=U.samples||[],D=new Uint8Array(4+_.length),g,T;for(g=0;g<_.length;g++)T=_[g].flags,D[g+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return P.box(P.types.sdtp,D)},P.stbl=function(U){return P.box(P.types.stbl,P.stsd(U),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(U){var _=[],D=[],g,T,R;for(g=0;g<U.sps.length;g++)T=U.sps[g],R=T.byteLength,_.push(R>>>8&255),_.push(R&255),_=_.concat(Array.prototype.slice.call(T));for(g=0;g<U.pps.length;g++)T=U.pps[g],R=T.byteLength,D.push(R>>>8&255),D.push(R&255),D=D.concat(Array.prototype.slice.call(T));var C=P.box(P.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|U.sps.length].concat(_).concat([U.pps.length]).concat(D))),w=U.width,E=U.height,l=U.pixelRatio[0],o=U.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,w>>8&255,w&255,E>>8&255,E&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(U){var _=U.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(U.config).concat([6,1,2]))},P.mp4a=function(U){var _=U.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),P.box(P.types.esds,P.esds(U)))},P.mp3=function(U){var _=U.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},P.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(U)):P.box(P.types.stsd,P.STSD,P.mp4a(U)):P.box(P.types.stsd,P.STSD,P.avc1(U))},P.tkhd=function(U){var _=U.id,D=U.duration*U.timescale,g=U.width,T=U.height,R=Math.floor(D/(V+1)),C=Math.floor(D%(V+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&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,g>>8&255,g&255,0,0,T>>8&255,T&255,0,0]))},P.traf=function(U,_){var D=P.sdtp(U),g=U.id,T=Math.floor(_/(V+1)),R=Math.floor(_%(V+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(U,D.length+16+20+8+16+8+8),D)},P.trak=function(U){return U.duration=U.duration||4294967295,P.box(P.types.trak,P.tkhd(U),P.mdia(U))},P.trex=function(U){var _=U.id;return P.box(P.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]))},P.trun=function(U,_){var D=U.samples||[],g=D.length,T=12+16*g,R=new Uint8Array(T),C,w,E,l,o,s;for(_+=8+T,R.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),C=0;C<g;C++)w=D[C],E=w.duration,l=w.size,o=w.flags,s=w.cts,R.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return P.box(P.types.trun,R)},P.initSegment=function(U){P.types||P.init();var _=P.moov(U),D=new Uint8Array(P.FTYP.byteLength+_.byteLength);return D.set(P.FTYP),D.set(_,P.FTYP.byteLength),D},P}();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,G.default=I},"./src/remux/mp4-remuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return s}),L.d(G,"normalizePts",function(){return u});var V=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),P=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),U=L("./src/errors.ts"),_=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),g=L("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(A){for(var y=1;y<arguments.length;y++){var c=arguments[y];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(A[f]=c[f])}return A},T.apply(this,arguments)}var R=10*1e3,C=1024,w=1152,E=null,l=null,o=!1,s=function(){function A(c,f,d,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=c,this.config=f,this.typeSupported=d,this.ISGenerated=!1,E===null){var v=navigator.userAgent||"",m=v.match(/Chrome\/(\d+)/i);E=m?parseInt(m[1]):0}if(l===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);l=b?parseInt(b[1]):0}o=!!E&&E<75||!!l&&l<600}var y=A.prototype;return y.destroy=function(){},y.resetTimeStamp=function(f){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},y.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(f){var d=!1,a=f.reduce(function(v,m){var b=m.pts-v;return b<-4294967296?(d=!0,u(v,m.pts)):b>0?v:m.pts},f[0].pts);return d&&_.logger.debug("PTS rollover detected"),a},y.remux=function(f,d,a,v,m,b,M,F){var j,W,k,O,K,Y,q=m,ie=m,Te=f.pid>-1,ve=d.pid>-1,ge=d.samples.length,he=f.samples.length>0,ce=ge>1,ae=(!Te||he)&&(!ve||ce)||this.ISGenerated||M;if(ae){this.ISGenerated||(k=this.generateIS(f,d,m));var me=this.isVideoContiguous,Q=-1;if(ce&&(Q=S(d.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,Q>0){_.logger.warn("[mp4-remuxer]: Dropped "+Q+" out of "+ge+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(Q),d.dropped+=Q,ie+=(d.samples[0].pts-ne)/(d.timescale||9e4)}else Q===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(he&&ce){var Z=this.getVideoStartPts(d.samples),Ee=u(f.samples[0].pts,Z)-Z,Ae=Ee/d.inputTimeScale;q+=Math.max(0,Ae),ie+=Math.max(0,-Ae)}if(he){if(f.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),k=this.generateIS(f,d,m)),W=this.remuxAudio(f,q,this.isAudioContiguous,b,ve||ce||F===D.PlaylistLevelType.AUDIO?ie:void 0),ce){var be=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),k=this.generateIS(f,d,m)),j=this.remuxVideo(d,ie,me,be)}}else ce&&(j=this.remuxVideo(d,ie,me,0));j&&(j.firstKeyFrame=Q,j.independent=Q!==-1)}}return this.ISGenerated&&(a.samples.length&&(K=this.remuxID3(a,m)),v.samples.length&&(O=this.remuxText(v,m))),{audio:W,video:j,initSegment:k,independent:Y,text:O,id3:K}},y.generateIS=function(f,d,a){var v=f.samples,m=d.samples,b=this.typeSupported,M={},F=!Object(V.isFiniteNumber)(this._initPTS),j="audio/mp4",W,k,O;if(F&&(W=k=Infinity),f.config&&v.length&&(f.timescale=f.samplerate,f.isAAC||(b.mpeg?(j="audio/mpeg",f.codec=""):b.mp3&&(f.codec="mp3")),M.audio={id:"audio",container:j,codec:f.codec,initSegment:!f.isAAC&&b.mpeg?new Uint8Array(0):P.default.initSegment([f]),metadata:{channelCount:f.channelCount}},F&&(O=f.inputTimeScale,W=k=v[0].pts-Math.round(O*a))),d.sps&&d.pps&&m.length&&(d.timescale=d.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:P.default.initSegment([d]),metadata:{width:d.width,height:d.height}},F)){O=d.inputTimeScale;var K=this.getVideoStartPts(m),Y=Math.round(O*a);k=Math.min(k,u(m[0].dts,K)-Y),W=Math.min(W,K-Y)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=k),{tracks:M,initPTS:W,timescale:O}},y.remuxVideo=function(f,d,a,v){var m=f.inputTimeScale,b=f.samples,M=[],F=b.length,j=this._initPTS,W=this.nextAvcDts,k=8,O,K,Y,q=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,Te=0,ve=!1;if(!a||W===null){var ge=d*m,he=b[0].pts-u(b[0].dts,b[0].pts);W=ge-he}for(var ce=0;ce<F;ce++){var ae=b[ce];if(ae.pts=u(ae.pts-j,W),ae.dts=u(ae.dts-j,W),ae.dts>ae.pts){var me=9e4*.2;Te=Math.max(Math.min(Te,ae.pts-ae.dts),-1*me)}ae.dts<b[ce>0?ce-1:ce].dts&&(ve=!0)}ve&&b.sort(function(mt,ut){var at=mt.dts-ut.dts,Et=mt.pts-ut.pts;return at||Et}),K=b[0].dts,Y=b[b.length-1].dts;var Q=Math.round((Y-K)/(F-1));if(Te<0){if(Te<Q*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-Q,!0)+" ms");for(var ne=Te,Z=0;Z<F;Z++)b[Z].dts=ne=Math.max(ne,b[Z].pts-Q),b[Z].pts=Math.max(ne,b[Z].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var Ee=0;Ee<F;Ee++)b[Ee].dts=b[Ee].dts+Te}K=b[0].dts}if(a){var Ae=K-W,be=Ae>Q,Se=Ae<-1;if(be||Se){be?_.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),K=W;var Re=b[0].pts-Ae;b[0].dts=K,b[0].pts=Re,_.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Re,!0)+"/"+Object(g.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms")}}o&&(K=Math.max(0,K));for(var Fe=0,Ie=0,ke=0;ke<F;ke++){for(var Oe=b[ke],$e=Oe.units,ze=$e.length,Ve=0,Ge=0;Ge<ze;Ge++)Ve+=$e[Ge].data.length;Ie+=Ve,Fe+=ze,Oe.length=Ve,Oe.dts=Math.max(Oe.dts,K),Oe.pts=Math.max(Oe.pts,Oe.dts,0),q=Math.min(Oe.pts,q),ie=Math.max(Oe.pts,ie)}Y=b[F-1].dts;var rt=Ie+4*Fe+8,Qe;try{Qe=new Uint8Array(rt)}catch(mt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var Ye=new DataView(Qe.buffer);Ye.setUint32(0,rt),Qe.set(P.default.types.mdat,4);for(var Ce=0;Ce<F;Ce++){for(var qe=b[Ce],Xe=qe.units,Le=0,_e=0,pe=Xe.length;_e<pe;_e++){var le=Xe[_e],ue=le.data,$=le.data.byteLength;Ye.setUint32(k,$),k+=4,Qe.set(ue,k),k+=$,Le+=4+$}if(Ce<F-1)O=b[Ce+1].dts-qe.dts;else{var J=this.config,ee=qe.dts-b[Ce>0?Ce-1:Ce].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var oe=Math.floor(J.maxBufferHole*m),fe=(v?q+v*m:this.nextAudioPts)-qe.pts;fe>oe?(O=fe-ee,O<0&&(O=ee),_.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+O/90+" ms for the last video frame.")):O=ee}else O=ee}var we=Math.round(qe.pts-qe.dts);M.push(new p(qe.key,O,Le,we))}if(M.length&&E&&E<70){var Pe=M[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(O!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+O,this.isVideoContiguous=!0;var je=P.default.moof(f.sequenceNumber++,K,T({},f,{samples:M})),Ze="video",We={data1:je,data2:Qe,startPTS:q/m,endPTS:(ie+O)/m,startDTS:K/m,endDTS:W/m,type:Ze,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Qe.length,"MDAT length must not be zero"),We},y.remuxAudio=function(f,d,a,v,m){var b=f.inputTimeScale,M=f.samplerate?f.samplerate:b,F=b/M,j=f.isAAC?C:w,W=j*F,k=this._initPTS,O=!f.isAAC&&this.typeSupported.mpeg,K=[],Y=f.samples,q=O?0:8,ie=this.nextAudioPts||-1,Te=d*b;if(this.isAudioContiguous=a=a||Y.length&&ie>0&&(v&&Math.abs(Te-ie)<9e3||Math.abs(u(Y[0].pts-k,Te)-ie)<20*W),Y.forEach(function(ue){ue.pts=u(ue.pts-k,Te)}),!a||ie<0){if(Y=Y.filter(function(ue){return ue.pts>=0}),!Y.length)return;m===0?ie=0:v?ie=Math.max(0,Te):ie=Y[0].pts}if(f.isAAC)for(var ve=m!==void 0,ge=this.config.maxAudioFramesDrift,he=0,ce=ie;he<Y.length;he++){var ae=Y[he],me=ae.pts,Q=me-ce,ne=Math.abs(1e3*Q/b);if(Q<=-ge*W&&ve)he===0&&(_.logger.warn("Audio frame @ "+(me/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/b)+" ms."),this.nextAudioPts=ie=ce=me);else if(Q>=ge*W&&ne<R&&ve){var Z=Math.round(Q/W);ce=me-Z*W,ce<0&&(Z--,ce+=W),he===0&&(this.nextAudioPts=ie=ce),_.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(ce/b).toFixed(3)+"s due to "+Math.round(1e3*Q/b)+" ms gap.");for(var Ee=0;Ee<Z;Ee++){var Ae=Math.max(ce,0),be=I.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);be||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),be=ae.unit.subarray()),Y.splice(he,0,{unit:be,pts:Ae}),ce+=W,he++}}ae.pts=ce,ce+=W}for(var Se=null,Re=null,Fe,Ie=0,ke=Y.length;ke--;)Ie+=Y[ke].unit.byteLength;for(var Oe=0,$e=Y.length;Oe<$e;Oe++){var ze=Y[Oe],Ve=ze.unit,Ge=ze.pts;if(Re!==null){var rt=K[Oe-1];rt.duration=Math.round((Ge-Re)/F)}else if(a&&f.isAAC&&(Ge=ie),Se=Ge,Ie>0){Ie+=q;try{Fe=new Uint8Array(Ie)}catch(ue){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!O){var Qe=new DataView(Fe.buffer);Qe.setUint32(0,Ie),Fe.set(P.default.types.mdat,4)}}else return;Fe.set(Ve,q);var Ye=Ve.byteLength;q+=Ye,K.push(new p(!0,j,Ye,0)),Re=Ge}var Ce=K.length;if(!Ce)return;var qe=K[K.length-1];this.nextAudioPts=ie=Re+F*qe.duration;var Xe=O?new Uint8Array(0):P.default.moof(f.sequenceNumber++,Se/F,T({},f,{samples:K}));f.samples=[];var Le=Se/b,_e=ie/b,pe="audio",le={data1:Xe,data2:Fe,startPTS:Le,endPTS:_e,startDTS:Le,endDTS:_e,type:pe,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(Fe.length,"MDAT length must not be zero"),le},y.remuxEmptyAudio=function(f,d,a,v){var m=f.inputTimeScale,b=f.samplerate?f.samplerate:m,M=m/b,F=this.nextAudioPts,j=(F!==null?F:v.startDTS*m)+this._initDTS,W=v.endDTS*m+this._initDTS,k=M*C,O=Math.ceil((W-j)/k),K=I.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],q=0;q<O;q++){var ie=j+q*k;Y.push({unit:K,pts:ie,dts:ie})}return f.samples=Y,this.remuxAudio(f,d,a,!1)},y.remuxID3=function(f,d){var a=f.samples.length;if(!a)return;for(var v=f.inputTimeScale,m=this._initPTS,b=this._initDTS,M=0;M<a;M++){var F=f.samples[M];F.pts=u(F.pts-m,d*v)/v,F.dts=u(F.dts-b,d*v)/v}var j=f.samples;return f.samples=[],{samples:j}},y.remuxText=function(f,d){var a=f.samples.length;if(!a)return;for(var v=f.inputTimeScale,m=this._initPTS,b=0;b<a;b++){var M=f.samples[b];M.pts=u(M.pts-m,d*v)/v}f.samples.sort(function(j,W){return j.pts-W.pts});var F=f.samples;return f.samples=[],{samples:F}},A}();function u(A,y){var c;if(y===null)return A;for(y<A?c=-8589934592:c=8589934592;Math.abs(A-y)>4294967296;)A+=c;return A}function S(A){for(var y=0;y<A.length;y++)if(A[y].key)return y;return-1}var p=function(y,c,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,this.cts=d,this.flags=new h(y)},h=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),U=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var T=g.prototype;return T.destroy=function(){},T.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(C,w,E){this.audioCodec=w,this.videoCodec=E,this.generateInitSegment(C),this.emitInitSegment=!0},T.generateInitSegment=function(C){var w=this.audioCodec,E=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(I.parseInitSegment)(C);w||(w=D(l.audio,P.ElementaryStreamTypes.AUDIO)),E||(E=D(l.video,P.ElementaryStreamTypes.VIDEO));var o={};l.audio&&l.video?o.audiovideo={container:"video/mp4",codec:w+","+E,initSegment:C,id:"main"}:l.audio?o.audio={container:"audio/mp4",codec:w,initSegment:C,id:"audio"}:l.video?o.video={container:"video/mp4",codec:E,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(C,w,E,l,o){var s=this.initPTS,u=this.lastEndDTS,S={audio:void 0,video:void 0,text:l,id3:E,initSegment:void 0};Object(V.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var p=w.samples;if(!p||!p.length)return S;var h={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(p),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(V.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=_(A,p,u));var y=Object(I.getDuration)(p,A),c=u,f=y+c;Object(I.offsetStartDTS)(A,p,s),y>0?this.lastEndDTS=f:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!A.audio,a=!!A.video,v="";d&&(v+="audio"),a&&(v+="video");var m={data1:p,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:v,hasAudio:d,hasVideo:a,nb:1,dropped:0};return S.audio=m.type==="audio"?m:void 0,S.video=m.type!=="audio"?m:void 0,S.text=l,S.id3=E,S.initSegment=h,S},g}(),_=function(T,R,C){return Object(I.getStartDTS)(T,R)-C};function D(g,T){var R=g==null?void 0:g.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||T===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=U},"./src/task-loop.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return V});var V=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=I.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},I}()},"./src/types/cmcd.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"CMCDVersion",function(){return V}),L.d(G,"CMCDObjectType",function(){return I}),L.d(G,"CMCDStreamingFormat",function(){return P}),L.d(G,"CMCDStreamType",function(){return B});var V=1,I;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(I||(I={}));var P;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(P||(P={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"HlsSkip",function(){return P}),L.d(G,"getSkipValue",function(){return B}),L.d(G,"HlsUrlParameters",function(){return U}),L.d(G,"Level",function(){return _});function V(D,g){for(var T=0;T<g.length;T++){var R=g[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(D,R.key,R)}}function I(D,g,T){return g&&V(D.prototype,g),T&&V(D,T),D}var P;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(P||(P={}));function B(D,g){var T=D.canSkipUntil,R=D.canSkipDateRanges,C=D.endSN,w=g!==void 0?g-C:0;return T&&w<T?R?P.v2:P.Yes:P.No}var U=function(){function D(T,R,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=R,this.skip=C}var g=D.prototype;return g.addDirectives=function(R){var C=new self.URL(R);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(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(T){return T}).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(T){var R=T%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),D}()},"./src/types/loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"PlaylistContextType",function(){return V}),L.d(G,"PlaylistLevelType",function(){return I});var V;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(V||(V={}));var I;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"ChunkMetadata",function(){return V});var V=function(B,U,_,D,g,T){D===void 0&&(D=0),g===void 0&&(g=-1),T===void 0&&(T=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=U,this.id=_,this.size=D,this.part=g,this.partial=T};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"AttrList",function(){return P});var V=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function B(_){typeof _=="string"&&(_=B.parseAttrList(_));for(var D in _)_.hasOwnProperty(D)&&(this[D]=_[D])}var U=B.prototype;return U.decimalInteger=function(D){var g=parseInt(this[D],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},U.hexadecimalInteger=function(D){if(this[D]){var g=(this[D]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var T=new Uint8Array(g.length/2),R=0;R<g.length/2;R++)T[R]=parseInt(g.slice(R*2,R*2+2),16);return T}else return null},U.hexadecimalIntegerAsNumber=function(D){var g=parseInt(this[D],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},U.decimalFloatingPoint=function(D){return parseFloat(this[D])},U.optionalFloat=function(D,g){var T=this[D];return T?parseFloat(T):g},U.enumeratedString=function(D){return this[D]},U.bool=function(D){return this[D]==="YES"},U.decimalResolution=function(D){var g=V.exec(this[D]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},B.parseAttrList=function(D){var g,T={},R='"';for(I.lastIndex=0;(g=I.exec(D))!==null;){var C=g[2];C.indexOf(R)===0&&C.lastIndexOf(R)===C.length-1&&(C=C.slice(1,-1)),T[g[1]]=C}return T},B}()},"./src/utils/binary-search.ts":function(te,G,L){"use strict";L.r(G);var V={search:function(P,B){for(var U=0,_=P.length-1,D=null,g=null;U<=_;){D=(U+_)/2|0,g=P[D];var T=B(g);if(T>0)U=D+1;else if(T<0)_=D-1;else return g}return null}};G.default=V},"./src/utils/buffer-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"BufferHelper",function(){return P});var V=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function B(){}return B.isBuffered=function(_,D){try{if(_){for(var g=B.getBuffered(_),T=0;T<g.length;T++)if(D>=g.start(T)&&D<=g.end(T))return!0}}catch(R){}return!1},B.bufferInfo=function(_,D,g){try{if(_){var T=B.getBuffered(_),R=[],C;for(C=0;C<T.length;C++)R.push({start:T.start(C),end:T.end(C)});return this.bufferedInfo(R,D,g)}}catch(w){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(_,D,g){D=Math.max(0,D),_.sort(function(h,A){var y=h.start-A.start;return y||A.end-h.end});var T=[];if(g)for(var R=0;R<_.length;R++){var C=T.length;if(C){var w=T[C-1].end;_[R].start-w<g?_[R].end>w&&(T[C-1].end=_[R].end):T.push(_[R])}else T.push(_[R])}else T=_;for(var E=0,l,o=D,s=D,u=0;u<T.length;u++){var S=T[u].start,p=T[u].end;if(D+g>=S&&D<p)o=S,s=p,E=s-D;else if(D+g<S){l=S;break}}return{len:E,start:o||0,end:s||0,nextStart:l}},B.getBuffered=function(_){try{return _.buffered}catch(D){return V.logger.log("failed to get media.buffered",D),I}},B}()},"./src/utils/cea-608-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"Row",function(){return s}),L.d(G,"CaptionScreen",function(){return u});var V=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},P=function(f){var d=f;return I.hasOwnProperty(f)&&(d=I[f]),String.fromCharCode(d)},B=15,U=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},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(C||(C={}));var w=function(){function c(){this.time=null,this.verboseLevel=C.ERROR}var f=c.prototype;return f.log=function(a,v){this.verboseLevel>=a&&V.logger.log(this.time+" ["+a+"] "+v)},c}(),E=function(f){for(var d=[],a=0;a<f.length;a++)d.push(f[a].toString(16));return d},l=function(){function c(d,a,v,m,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=v||!1,this.background=m||"black",this.flash=b||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],m=0;m<v.length;m++){var b=v[m];a.hasOwnProperty(b)&&(this[b]=a[b])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),o=function(){function c(d,a,v,m,b,M){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new l(a,v,m,b,M)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<U;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new l}var f=c.prototype;return f.equals=function(a){for(var v=!0,m=0;m<U;m++)if(!this.chars[m].equals(a.chars[m])){v=!1;break}return v},f.copy=function(a){for(var v=0;v<U;v++)this.chars[v].copy(a.chars[v])},f.isEmpty=function(){for(var a=!0,v=0;v<U;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},f.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var m=this.pos+1;m<v+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(v)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var v=P(a);if(this.pos>=U){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var v;for(v=a;v<U;v++)this.chars[v].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],v=!0,m=0;m<U;m++){var b=this.chars[m].uchar;b!==" "&&(v=!1),a.push(b)}return v?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},c}(),u=function(){function c(d){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(d));this.logger=d,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=c.prototype;return f.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},f.equals=function(a){for(var v=!0,m=0;m<B;m++)if(!this.rows[m].equals(a.rows[m])){v=!1;break}return v},f.copy=function(a){for(var v=0;v<B;v++)this.rows[v].copy(a.rows[v])},f.isEmpty=function(){for(var a=!0,v=0;v<B;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},f.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},f.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},f.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},f.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var m=0;m<B;m++)this.rows[m].clear();var b=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[b].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[v-this.nrRollUpRows+W+1].copy(M.rows[b+W])}}this.currRow=v;var k=this.rows[this.currRow];if(a.indent!==null){var O=a.indent,K=Math.max(O-1,0);k.setCursor(a.indent),a.color=k.chars[K].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},f.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(a,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var v=[],m="",b=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(b=M+1,a?v.push("Row "+b+": '"+F+"'"):v.push(F.trim()))}return v.length>0&&(a?m="["+v.join(" | ")+"]":m=v.join(`
|
|
`)),m},f.getTextAndFormat=function(){return this.rows},c}(),S=function(){function c(d,a,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(v),this.nonDisplayedMemory=new u(v),this.lastOutputScreen=new u(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var f=c.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.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},f.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.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)},f.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.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)},f.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var m=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=b[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},c}(),p=function(){function c(d,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new w;this.channels=[null,new S(d,a,m),new S(d+1,v,m)],this.cmdHistory=y(),this.logger=m}var f=c.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,v){this.channels[a].setHandler(v)},f.addData=function(a,v){var m,b,M,F=!1;this.logger.time=a;for(var j=0;j<v.length;j+=2){if(b=v[j]&127,M=v[j+1]&127,b===0&&M===0)continue;if(this.logger.log(C.DATA,"["+E([v[j],v[j+1]])+"] -> ("+E([b,M])+")"),m=this.parseCmd(b,M),m||(m=this.parseMidrow(b,M)),m||(m=this.parsePAC(b,M)),m||(m=this.parseBackgroundAttributes(b,M)),!m&&(F=this.parseChars(b,M),F)){var W=this.currentChannel;if(W&&W>0){var k=this.channels[W];k.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+E([b,M])+" orig: "+E([v[j],v[j+1]]))}},f.parseCmd=function(a,v){var m=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,M=(a===23||a===31)&&v>=33&&v<=35;if(!(b||M))return!1;if(A(a,v,m))return h(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+E([a,v])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?v===32?j.ccRCL():v===33?j.ccBS():v===34?j.ccAOF():v===35?j.ccAON():v===36?j.ccDER():v===37?j.ccRU(2):v===38?j.ccRU(3):v===39?j.ccRU(4):v===40?j.ccFON():v===41?j.ccRDC():v===42?j.ccTR():v===43?j.ccRTD():v===44?j.ccEDM():v===45?j.ccCR():v===46?j.ccENM():v===47&&j.ccEOC():j.ccTO(v-32),h(a,v,m),this.currentChannel=F,!0},f.parseMidrow=function(a,v){var m=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[m];return b?(b.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+E([a,v])+")"),!0):!1}return!1},f.parsePAC=function(a,v){var m,b=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(M||F))return!1;if(A(a,v,b))return h(null,null,b),!0;var j=a<=23?1:2;v>=64&&v<=95?m=j===1?_[a]:g[a]:m=j===1?D[a]:T[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,v)),h(a,v,b),this.currentChannel=j,!0):!1},f.interpretPAC=function(a,v){var m,b={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?m=v-96:m=v-64,b.underline=(m&1)===1,m<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((m-16)/2)*4,b},f.parseChars=function(a,v){var m,b=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var F;M===17?F=v+80:M===18?F=v+112:F=v+144,this.logger.log(C.INFO,"Special char '"+P(F)+"' in channel "+m),b=[F]}else a>=32&&a<=127&&(b=v===0?[a]:[a,v]);if(b){var j=E(b);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),h(a,v,this.cmdHistory)}return b},f.parseBackgroundAttributes=function(a,v){var m=(a===16||a===24)&&v>=32&&v<=47,b=(a===23||a===31)&&v>=45&&v<=47;if(!(m||b))return!1;var M,F={};a===16||a===24?(M=Math.floor((v-32)/2),F.background=R[M],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),h(a,v,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=y()},f.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var m=this.channels[v];m&&m.cueSplitAtTime(a)}},c}();function h(c,f,d){d.a=c,d.b=f}function A(c,f,d){return d.a===c&&d.b===f}function y(){return{a:null,b:null}}G.default=p},"./src/utils/codecs.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"isCodecType",function(){return I}),L.d(G,"isCodecSupportedInMp4",function(){return P});var V={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function I(B,U){var _=V[U];return!!_&&_[B.slice(0,4)]===!0}function P(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(D,g,T,R){for(var C=[],w,E,l,o,s,u=self.VTTCue||self.TextTrackCue,S=0;S<R.rows.length;S++)if(w=R.rows[S],l=!0,o=0,s="",!w.isEmpty()){for(var p=0;p<w.chars.length;p++)B.test(w.chars[p].uchar)&&l?o++:(s+=w.chars[p].uchar,l=!1);w.cueStartTime=g,g===T&&(T+=1e-4),o>=16?o--:o++;var h=Object(V.fixLineBreaks)(s.trim()),A=Object(I.generateCueId)(g,T,h);(!D||!D.cues||!D.cues.getCueById(A))&&(E=new u(g,T,h),E.id=A,E.line=S+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(E))}return D&&C.length&&(C.sort(function(y,c){return y.line==="auto"||c.line==="auto"?0:y.line>8&&c.line>8?c.line-y.line:y.line-c.line}),C.forEach(function(y){return Object(P.addCueToTrack)(D,y)})),C}};G.default=U},"./src/utils/discontinuities.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"findFirstFragWithCC",function(){return B}),L.d(G,"shouldAlignOnDiscontinuities",function(){return U}),L.d(G,"findDiscontinuousReferenceFrag",function(){return _}),L.d(G,"adjustSlidingStart",function(){return g}),L.d(G,"alignStream",function(){return T}),L.d(G,"alignPDT",function(){return C}),L.d(G,"alignFragmentByPDTDelta",function(){return w}),L.d(G,"alignMediaPlaylistByPDT",function(){return E});var V=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),P=L("./src/controller/level-helper.ts");function B(l,o){for(var s=null,u=0,S=l.length;u<S;u++){var p=l[u];if(p&&p.cc===o){s=p;break}}return s}function U(l,o,s){return!!(o.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function _(l,o){var s=l.fragments,u=o.fragments;if(!u.length||!s.length){I.logger.log("No fragments to align");return}var S=B(s,u[0].cc);if(!S||S&&!S.startPTS){I.logger.log("No frag in previous level to align on");return}return S}function D(l,o){if(l){var s=l.start+o;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function g(l,o){for(var s=o.fragments,u=0,S=s.length;u<S;u++)D(s[u],l);o.fragmentHint&&D(o.fragmentHint,l),o.alignedSliding=!0}function T(l,o,s){if(!o)return;R(l,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(P.adjustSliding)(o.details,s)}function R(l,o,s){if(U(l,s,o)){var u=_(s.details,o);u&&Object(V.isFiniteNumber)(u.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),g(u.start,o))}}function C(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=l.fragments[0].programDateTime,S=(u-s)/1e3+o.fragments[0].start;S&&Object(V.isFiniteNumber)(S)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+S.toFixed(3)+" "+l.url+" "),g(S,l))}function w(l,o){var s=l.programDateTime;if(!s)return;var u=(s-o)/1e3;l.start=l.startPTS=u,l.endPTS=u+l.duration}function E(l,o){if(!o.fragments.length||!l.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=o.fragments[0].start,S=s-u*1e3;l.fragments.forEach(function(p){w(p,S)}),l.fragmentHint&&w(l.fragmentHint,S),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/utils/ewma.ts"),I=function(){function P(U,_,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 V.default(U),this.fast_=new V.default(_)}var B=P.prototype;return B.update=function(_,D){var g=this.slow_,T=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new V.default(_,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new V.default(D,T.getEstimate(),T.getTotalWeight()))},B.sample=function(_,D){_=Math.max(_,this.minDelayMs_);var g=8*D,T=_/1e3,R=g/T;this.fast_.sample(T,R),this.slow_.sample(T,R)},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(){},P}();G.default=I},"./src/utils/ewma.ts":function(te,G,L){"use strict";L.r(G);var V=function(){function I(B,U,_){U===void 0&&(U=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_=U,this.totalWeight_=_}var P=I.prototype;return P.sample=function(U,_){var D=Math.pow(this.alpha_,U);this.estimate_=_*(1-D)+D*this.estimate_,this.totalWeight_+=U},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();G.default=V},"./src/utils/fetch-loader.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"fetchSupported",function(){return w});var V=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),P=L("./src/demux/chunk-cache.ts");function B(u,S){u.prototype=Object.create(S.prototype),u.prototype.constructor=u,T(u,S)}function U(u){var S=typeof Map=="function"?new Map:void 0;return U=function(h){if(h===null||!g(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(h))return S.get(h);S.set(h,A)}function A(){return _(h,arguments,R(this).constructor)}return A.prototype=Object.create(h.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),T(A,h)},U(u)}function _(u,S,p){return D()?_=Reflect.construct:_=function(A,y,c){var f=[null];f.push.apply(f,y);var d=Function.bind.apply(A,f),a=new d;return c&&T(a,c.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 g(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function T(u,S){return T=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},T(u,S)}function R(u){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},R(u)}function C(){return C=Object.assign||function(u){for(var S=1;S<arguments.length;S++){var p=arguments[S];for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&(u[h]=p[h])}return u},C.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var E=function(){function u(p){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var S=u.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(h,A,y){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=l(h,this.controller.signal),a=y.onProgress,v=h.responseType==="arraybuffer",m=v?"byteLength":"length";this.context=h,this.config=A,this.callbacks=y,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),y.onTimeout(f,h,c.response)},A.timeout),self.fetch(this.request).then(function(b){if(c.response=c.loader=b,!b.ok){var M=b.status,F=b.statusText;throw new s(F||"fetch, bad network response",M,b)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object(V.isFiniteNumber)(A.highWaterMark)?c.loadProgressively(b,f,h,A.highWaterMark,a):v?b.arrayBuffer():b.text()}).then(function(b){var M=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=b[m];var F={url:M.url,data:b};a&&!Object(V.isFiniteNumber)(A.highWaterMark)&&a(f,h,b,M),y.onSuccess(F,f,h,M)}).catch(function(b){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var M=b.code||0;y.onError({code:M,text:b.message},h,b.details)})},S.getCacheAge=function(){var h=null;if(this.response){var A=this.response.headers.get("age");h=A?parseFloat(A):null}return h},S.loadProgressively=function(h,A,y,c,f){c===void 0&&(c=0);var d=new P.default,a=h.body.getReader(),v=function m(){return a.read().then(function(b){if(b.done)return d.dataLength&&f(A,y,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var M=b.value,F=M.length;return A.loaded+=F,F<c||d.dataLength?(d.push(M),d.dataLength>=c&&f(A,y,d.flush(),h)):f(A,y,M,h),m()}).catch(function(){return Promise.reject()})};return v()},u}();function l(u,S){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},u.headers))};return u.rangeEnd&&p.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),p}function o(u,S){return new self.Request(u.url,S)}var s=function(u){B(S,u);function S(p,h,A){var y;return y=u.call(this,p)||this,y.code=void 0,y.details=void 0,y.code=h,y.details=A,y}return S}(U(Error));G.default=E},"./src/utils/imsc1-ttml-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"IMSC1_CODEC",function(){return g}),L.d(G,"parseIMSC1",function(){return w});var V=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),P=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),U=L("./src/utils/timescale-conversion.ts"),_=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(c[a]=d[a])}return c},D.apply(this,arguments)}var g="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(c,f,d,a,v){var m=Object(V.findBox)(new Uint8Array(c),["mdat"]);if(m.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var b=m[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(c,b.start,b.end-b.start)),F=Object(U.toTimescaleFromScale)(f,1,d);try{a(E(M,F))}catch(j){v(j)}}function E(c,f){var d=new DOMParser,a=d.parseFromString(c,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(m).reduce(function(k,O){return k[O]=v.getAttribute("ttp:"+O)||m[O],k},{}),M=v.getAttribute("xml:space")!=="preserve",F=o(l(v,"styling","style")),j=o(l(v,"layout","region")),W=l(v,"body","[begin]");return[].map.call(W,function(k){var O=s(k,M);if(!O||!k.hasAttribute("begin"))return null;var K=h(k.getAttribute("begin"),b),Y=h(k.getAttribute("dur"),b),q=h(k.getAttribute("end"),b);if(K===null)throw p(k);if(q===null){if(Y===null)throw p(k);q=K+Y}var ie=new P.default(K-f,q-f,O);ie.id=Object(_.generateCueId)(ie.startTime,ie.endTime,ie.text);var Te=j[k.getAttribute("region")],ve=F[k.getAttribute("style")];ie.position=10,ie.size=80;var ge=u(Te,ve),he=ge.textAlign;if(he){var ce=C[he];ce&&(ie.lineAlign=ce),ie.align=he}return D(ie,ge),ie}).filter(function(k){return k!==null})}function l(c,f,d){var a=c.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(c){return c.reduce(function(f,d){var a=d.getAttribute("xml:id");return a&&(f[a]=d),f},{})}function s(c,f){return[].slice.call(c.childNodes).reduce(function(d,a,v){var m;return a.nodeName==="br"&&v?d+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?s(a,f):f?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function u(c,f){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,m){var b=S(f,d,m)||S(c,d,m);return b&&(v[m]=b),v},{})}function S(c,f,d){return c.hasAttributeNS(f,d)?c.getAttributeNS(f,d):null}function p(c){return new Error("Could not parse ttml timestamp "+c)}function h(c,f){if(!c)return null;var d=Object(I.parseTimeStamp)(c);return d===null&&(T.test(c)?d=A(c,f):R.test(c)&&(d=y(c,f))),d}function A(c,f){var d=T.exec(c),a=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/f.frameRate}function y(c,f){var d=R.exec(c),a=Number(d[1]),v=d[2];switch(v){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"enableLogs",function(){return _}),L.d(G,"logger",function(){return D});var V=function(){},I={trace:V,debug:V,log:V,warn:V,info:V,error:V},P=I;function B(g){var T=self.console[g];return T?T.bind(self.console,"["+g+"] >"):V}function U(g){for(var T=arguments.length,R=new Array(T>1?T-1:0),C=1;C<T;C++)R[C-1]=arguments[C];R.forEach(function(w){P[w]=g[w]?g[w].bind(g):B(w)})}function _(g){if(self.console&&g===!0||typeof g=="object"){U(g,"debug","log","info","warn","error");try{P.log()}catch(T){P=I}}else P=I}var D=P},"./src/utils/mediakeys-helper.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"KeySystems",function(){return V}),L.d(G,"requestMediaKeySystemAccess",function(){return I});var V;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(V||(V={}));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(te,G,L){"use strict";L.r(G),L.d(G,"getMediaSource",function(){return V});function V(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"bin2str",function(){return U}),L.d(G,"readUint16",function(){return _}),L.d(G,"readUint32",function(){return D}),L.d(G,"writeUint32",function(){return g}),L.d(G,"findBox",function(){return T}),L.d(G,"parseSegmentIndex",function(){return R}),L.d(G,"parseInitSegment",function(){return C}),L.d(G,"getStartDTS",function(){return w}),L.d(G,"getDuration",function(){return E}),L.d(G,"computeRawDurationFromSamples",function(){return l}),L.d(G,"offsetStartDTS",function(){return o}),L.d(G,"segmentValidRange",function(){return s}),L.d(G,"appendUint8Array",function(){return u});var V=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,B=[].push;function U(S){return String.fromCharCode.apply(null,S)}function _(S,p){"data"in S&&(p+=S.start,S=S.data);var h=S[p]<<8|S[p+1];return h<0?65536+h:h}function D(S,p){"data"in S&&(p+=S.start,S=S.data);var h=S[p]<<24|S[p+1]<<16|S[p+2]<<8|S[p+3];return h<0?4294967296+h:h}function g(S,p,h){"data"in S&&(p+=S.start,S=S.data),S[p]=h>>24,S[p+1]=h>>16&255,S[p+2]=h>>8&255,S[p+3]=h&255}function T(S,p){var h=[];if(!p.length)return h;var A,y,c;"data"in S?(A=S.data,y=S.start,c=S.end):(A=S,y=0,c=A.byteLength);for(var f=y;f<c;){var d=D(A,f),a=U(A.subarray(f+4,f+8)),v=d>1?f+d:c;if(a===p[0])if(p.length===1)h.push({data:A,start:f+8,end:v});else{var m=T({data:A,start:f+8,end:v},p.slice(1));m.length&&B.apply(h,m)}f=v}return h}function R(S){var p=T(S,["moov"]),h=p[0],A=h?h.end:null,y=T(S,["sidx"]);if(!y||!y[0])return null;var c=[],f=y[0],d=f.data[0],a=d===0?8:16,v=D(f,a);a+=4;var m=0,b=0;d===0?a+=8:a+=16,a+=2;var M=f.end+b,F=_(f,a);a+=2;for(var j=0;j<F;j++){var W=a,k=D(f,W);W+=4;var O=k&2147483647,K=(k&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=D(f,W);W+=4,c.push({referenceSize:O,subsegmentDuration:Y,info:{duration:Y/v,start:M,end:M+O-1}}),M+=O,W+=4,a=W}return{earliestPresentationTime:m,timescale:v,version:d,referencesCount:F,references:c,moovEndOffset:A}}function C(S){for(var p=[],h=T(S,["moov","trak"]),A=0;A<h.length;A++){var y=h[A],c=T(y,["tkhd"])[0];if(c){var f=c.data[c.start],d=f===0?12:20,a=D(c,d),v=T(y,["mdia","mdhd"])[0];if(v){f=v.data[v.start],d=f===0?12:20;var m=D(v,d),b=T(y,["mdia","hdlr"])[0];if(b){var M=U(b.data.subarray(b.start+8,b.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(F){var j=T(y,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:m,type:F},p[F]={timescale:m,id:a,codec:W}}}}}}var k=T(S,["moov","mvex","trex"]);return k.forEach(function(O){var K=D(O,4),Y=p[K];Y&&(Y.default={duration:D(O,12),flags:D(O,20)})}),p}function w(S,p){return T(p,["moof","traf"]).reduce(function(h,A){var y=T(A,["tfdt"])[0],c=y.data[y.start],f=T(A,["tfhd"]).reduce(function(d,a){var v=D(a,4),m=S[v];if(m){var b=D(y,4);c===1&&(b*=Math.pow(2,32),b+=D(y,8));var M=m.timescale||9e4,F=b/M;if(isFinite(F)&&(d===null||F<d))return F}return d},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function E(S,p){for(var h=0,A=0,y=0,c=T(S,["moof","traf"]),f=0;f<c.length;f++){var d=c[f],a=T(d,["tfhd"])[0],v=D(a,4),m=p[v];if(!m)continue;var b=m.default,M=D(a,0)|(b==null?void 0:b.flags),F=b==null?void 0:b.duration;M&8&&(M&2?F=D(a,12):F=D(a,8));for(var j=m.timescale||9e4,W=T(d,["trun"]),k=0;k<W.length;k++){if(F){var O=D(W[k],4);h=F*O}else h=l(W[k]);m.type===I.ElementaryStreamTypes.VIDEO?A+=h/j:m.type===I.ElementaryStreamTypes.AUDIO&&(y+=h/j)}}if(A===0&&y===0){var K=R(S);if(K!=null&&K.references)return K.references.reduce(function(Y,q){return Y+q.info.duration||0},0)}return A||y}function l(S){var p=D(S,0),h=8;p&1&&(h+=4),p&4&&(h+=4);for(var A=0,y=D(S,4),c=0;c<y;c++){if(p&256){var f=D(S,h);A+=f,h+=4}p&512&&(h+=4),p&1024&&(h+=4),p&2048&&(h+=4)}return A}function o(S,p,h){T(p,["moof","traf"]).forEach(function(A){T(A,["tfhd"]).forEach(function(y){var c=D(y,4),f=S[c];if(!f)return;var d=f.timescale||9e4;T(A,["tfdt"]).forEach(function(a){var v=a.data[a.start],m=D(a,4);if(v===0)g(a,4,m-h*d);else{m*=Math.pow(2,32),m+=D(a,8),m-=h*d,m=Math.max(m,0);var b=Math.floor(m/(P+1)),M=Math.floor(m%(P+1));g(a,4,b),g(a,8,M)}})})})}function s(S){var p={valid:null,remainder:null},h=T(S,["moof"]);if(h){if(h.length<2)return p.remainder=S,p}else return p;var A=h[h.length-1];return p.valid=Object(V.sliceUint8)(S,0,A.start-8),p.remainder=Object(V.sliceUint8)(S,A.start-8),p}function u(S,p){var h=new Uint8Array(S.length+p.length);return h.set(S),h.set(p,S.length),h}},"./src/utils/output-filter.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"default",function(){return V});var V=function(){function I(B,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=U}var P=I.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(U,_,D){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=_,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"sendAddTrackEvent",function(){return I}),L.d(G,"addCueToTrack",function(){return P}),L.d(G,"clearCurrentCues",function(){return B}),L.d(G,"removeCuesInRange",function(){return U}),L.d(G,"getCuesInRange",function(){return D});var V=L("./src/utils/logger.ts");function I(g,T){var R;try{R=new Event("addtrack")}catch(C){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=g,T.dispatchEvent(R)}function P(g,T){var R=g.mode;if(R==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(T.id))try{if(g.addCue(T),!g.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(w){V.logger.debug("[texttrack-utils]: "+w);var C=new self.TextTrackCue(T.startTime,T.endTime,T.text);C.id=T.id,g.addCue(C)}R==="disabled"&&(g.mode=R)}function B(g){var T=g.mode;if(T==="disabled"&&(g.mode="hidden"),g.cues)for(var R=g.cues.length;R--;)g.removeCue(g.cues[R]);T==="disabled"&&(g.mode=T)}function U(g,T,R){var C=g.mode;if(C==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var w=D(g.cues,T,R),E=0;E<w.length;E++)g.removeCue(w[E]);C==="disabled"&&(g.mode=C)}function _(g,T){if(T<g[0].startTime)return 0;var R=g.length-1;if(T>g[R].endTime)return-1;for(var C=0,w=R;C<=w;){var E=Math.floor((w+C)/2);if(T<g[E].startTime)w=E-1;else if(T>g[E].startTime&&C<R)C=E+1;else return E}return g[C].startTime-T<T-g[w].startTime?C:w}function D(g,T,R){var C=[],w=_(g,T);if(w>-1)for(var E=w,l=g.length;E<l;E++){var o=g[E];if(o.startTime>=T&&o.endTime<=R)C.push(o);else if(o.startTime>R)return C}return C}},"./src/utils/time-ranges.ts":function(te,G,L){"use strict";L.r(G);var V={toString:function(P){for(var B="",U=P.length,_=0;_<U;_++)B+="["+P.start(_).toFixed(3)+","+P.end(_).toFixed(3)+"]";return B}};G.default=V},"./src/utils/timescale-conversion.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"toTimescaleFromBase",function(){return I}),L.d(G,"toTimescaleFromScale",function(){return P}),L.d(G,"toMsFromMpegTsClock",function(){return B}),L.d(G,"toMpegTsClockFromTimescale",function(){return U});var V=9e4;function I(_,D,g,T){g===void 0&&(g=1),T===void 0&&(T=!1);var R=_*D*g;return T?Math.round(R):R}function P(_,D,g,T){return g===void 0&&(g=1),T===void 0&&(T=!1),I(_,D,1/g,T)}function B(_,D){return D===void 0&&(D=!1),I(_,1e3,1/V,D)}function U(_,D){return D===void 0&&(D=1),I(_,V,1/D)}},"./src/utils/typed-array.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"sliceUint8",function(){return V});function V(I,P,B){return Uint8Array.prototype.slice?I.slice(P,B):new Uint8Array(Array.prototype.slice.call(I,P,B))}},"./src/utils/vttcue.ts":function(te,G,L){"use strict";L.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var V=["","lr","rl"],I=["start","middle","end","left","right"];function P(g,T){if(typeof T!="string")return!1;if(!Array.isArray(g))return!1;var R=T.toLowerCase();return~g.indexOf(R)?R:!1}function B(g){return P(V,g)}function U(g){return P(I,g)}function _(g){for(var T=arguments.length,R=new Array(T>1?T-1:0),C=1;C<T;C++)R[C-1]=arguments[C];for(var w=1;w<arguments.length;w++){var E=arguments[w];for(var l in E)g[l]=E[l]}return g}function D(g,T,R){var C=this,w={enumerable:!0};C.hasBeenReset=!1;var E="",l=!1,o=g,s=T,u=R,S=null,p="",h=!0,A="auto",y="start",c=50,f="middle",d=50,a="middle";Object.defineProperty(C,"id",_({},w,{get:function(){return E},set:function(m){E=""+m}})),Object.defineProperty(C,"pauseOnExit",_({},w,{get:function(){return l},set:function(m){l=!!m}})),Object.defineProperty(C,"startTime",_({},w,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",_({},w,{get:function(){return s},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",_({},w,{get:function(){return u},set:function(m){u=""+m,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",_({},w,{get:function(){return S},set:function(m){S=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",_({},w,{get:function(){return p},set:function(m){var b=B(m);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",_({},w,{get:function(){return h},set:function(m){h=!!m,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",_({},w,{get:function(){return A},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",_({},w,{get:function(){return y},set:function(m){var b=U(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");y=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",_({},w,{get:function(){return c},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",_({},w,{get:function(){return f},set:function(m){var b=U(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");f=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",_({},w,{get:function(){return d},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",_({},w,{get:function(){return a},set:function(m){var b=U(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),C.displayState=void 0}return D.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"parseTimeStamp",function(){return P}),L.d(G,"fixLineBreaks",function(){return T}),L.d(G,"VTTParser",function(){return R});var V=L("./src/utils/vttcue.ts"),I=function(){function C(){}var w=C.prototype;return w.decode=function(l,o){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},C}();function P(C){function w(l,o,s,u){return(l|0)*3600+(o|0)*60+(s|0)+parseFloat(u||0)}var E=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?w(E[2],E[3],0,E[4]):w(E[1],E[2],E[3],E[4]):null}var B=function(){function C(){this.values=Object.create(null)}var w=C.prototype;return w.set=function(l,o){!this.get(l)&&o!==""&&(this.values[l]=o)},w.get=function(l,o,s){return s?this.has(l)?this.values[l]:o[s]:this.has(l)?this.values[l]:o},w.has=function(l){return l in this.values},w.alt=function(l,o,s){for(var u=0;u<s.length;++u)if(o===s[u]){this.set(l,o);break}},w.integer=function(l,o){/^-?\d+$/.test(o)&&this.set(l,parseInt(o,10))},w.percent=function(l,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},C}();function U(C,w,E,l){var o=l?C.split(l):[C];for(var s in o){if(typeof o[s]!="string")continue;var u=o[s].split(E);if(u.length!==2)continue;var S=u[0],p=u[1];w(S,p)}}var _=new V.default(0,0,""),D=_.align==="middle"?"middle":"center";function g(C,w,E){var l=C;function o(){var S=P(C);if(S===null)throw new Error("Malformed timestamp: "+l);return C=C.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,p){var h=new B;U(S,function(c,f){var d;switch(c){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===f){h.set(c,E[a].region);break}break;case"vertical":h.alt(c,f,["rl","lr"]);break;case"line":d=f.split(","),h.integer(c,d[0]),h.percent(c,d[0])&&h.set("snapToLines",!1),h.alt(c,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=f.split(","),h.percent(c,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":h.percent(c,f);break;case"align":h.alt(c,f,["start",D,"end","left","right"]);break}},/:/,/\s/),p.region=h.get("region",null),p.vertical=h.get("vertical","");var A=h.get("line","auto");A==="auto"&&_.line===-1&&(A=-1),p.line=A,p.lineAlign=h.get("lineAlign","start"),p.snapToLines=h.get("snapToLines",!0),p.size=h.get("size",100),p.align=h.get("align",D);var y=h.get("position","auto");y==="auto"&&_.position===50&&(y=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=y}function u(){C=C.replace(/^\s+/,"")}if(u(),w.startTime=o(),u(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);C=C.substr(3),u(),w.endTime=o(),u(),s(C,w)}function T(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=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 w=C.prototype;return w.parse=function(l){var o=this;l&&(o.buffer+=o.decoder.decode(l,{stream:!0}));function s(){var y=o.buffer,c=0;for(y=T(y);c<y.length&&y[c]!=="\r"&&y[c]!==`
|
|
`;)++c;var f=y.substr(0,c);return y[c]==="\r"&&++c,y[c]===`
|
|
`&&++c,o.buffer=y.substr(c),f}function u(y){U(y,function(c,f){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=s();var p=S.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var h=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;h?h=!1:S=s();switch(o.state){case"HEADER":/:/.test(S)?u(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new V.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{g(S,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=S.indexOf("-->")!==-1;if(!S||A&&(h=!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+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(y){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){l.onparsingerror&&l.onparsingerror(o)}return l.onflush&&l.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(te,G,L){"use strict";L.r(G),L.d(G,"generateCueId",function(){return R}),L.d(G,"parseWebVTT",function(){return w});var V=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),P=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),U=L("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,D=function(l,o,s){return s===void 0&&(s=0),l.substr(s,o.length)===o},g=function(l){var o=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),u=parseInt(l.substr(-9,2)),S=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(V.isFiniteNumber)(o)||!Object(V.isFiniteNumber)(s)||!Object(V.isFiniteNumber)(u)||!Object(V.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return o+=1e3*s,o+=60*1e3*u,o+=60*60*1e3*S,o},T=function(l){for(var o=5381,s=l.length;s;)o=o*33^l.charCodeAt(--s);return(o>>>0).toString()};function R(E,l,o){return T(E.toString())+T(l.toString())+T(o)}var C=function(l,o,s){var u=l[o],S=l[u.prevCC];if(!S||!S.new&&u.new){l.ccOffset=l.presentationOffset=u.start,u.new=!1;return}for(;(p=S)!==null&&p!==void 0&&p.new;){var p;l.ccOffset+=u.start-S.start,u.new=!1,u=S,S=l[u.prevCC]}l.presentationOffset=s};function w(E,l,o,s,u,S,p,h){var A=new I.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(_,`
|
|
`).split(`
|
|
`),c=[],f=Object(B.toMpegTsClockFromTimescale)(l,o),d="00:00.000",a=0,v=0,m,b=!0,M=!1;A.oncue=function(F){var j=s[u],W=s.ccOffset,k=(a-f)/9e4;if(j!=null&&j.new&&(v!==void 0?W=s.ccOffset=j.start:C(s,u,k)),k&&(W=k-s.presentationOffset),M){var O=F.endTime-F.startTime,K=Object(U.normalizePts)((F.startTime+W-v)*9e4,S*9e4)/9e4;F.startTime=K,F.endTime=K+O}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=R(F.startTime,F.endTime,Y)),F.endTime>0&&c.push(F)},A.onparsingerror=function(F){m=F},A.onflush=function(){if(m){h(m);return}p(c)},y.forEach(function(F){if(b)if(D(F,"X-TIMESTAMP-MAP=")){b=!1,M=!0,F.substr(16).split(",").forEach(function(j){D(j,"LOCAL:")?d=j.substr(6):D(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{v=g(d)/1e3}catch(j){M=!1,m=j}return}else F===""&&(b=!1);A.parse(F+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(te,G,L){"use strict";L.r(G);var V=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,B=function(){function U(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 _=U.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},_.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(g,T,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=T,this.callbacks=R,this.retryDelay=T.retryDelay,this.loadInternal()},_.loadInternal=function(){var g=this.config,T=this.context;if(!g)return;var R=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var w=this.xhrSetup;try{if(w)try{w(R,T.url)}catch(o){R.open("GET",T.url,!0),w(R,T.url)}R.readyState||R.open("GET",T.url,!0);var E=this.context.headers;if(E)for(var l in E)R.setRequestHeader(l,E[l])}catch(o){this.callbacks.onError({code:R.status,text:o.message},T,R);return}T.rangeEnd&&R.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),R.send()},_.readystatechange=function(){var g=this.context,T=this.loader,R=this.stats;if(!g||!T)return;var C=T.readyState,w=this.config;if(R.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),C===4){T.onreadystatechange=null,T.onprogress=null;var E=T.status;if(E>=200&&E<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var l,o;if(g.responseType==="arraybuffer"?(l=T.response,o=l.byteLength):(l=T.responseText,o=l.length),R.loaded=R.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(R,g,l,T),!this.callbacks)return;var u={url:T.responseURL,data:l};this.callbacks.onSuccess(u,R,g,T)}else R.retry>=w.maxRetry||E>=400&&E<499?(V.logger.error(E+" while loading "+g.url),this.callbacks.onError({code:E,text:T.statusText},g,T)):(V.logger.warn(E+" while loading "+g.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,w.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},_.loadtimeout=function(){V.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(g){var T=this.stats;T.loaded=g.loaded,g.lengthComputable&&(T.total=g.total)},_.getCacheAge=function(){var g=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");g=T?parseFloat(T):null}return g},U}();G.default=B}}).default})}}]);
|