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

144 lines
742 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[226,5,6,7],{"+NIl":function(ct,et,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";ie.defineMode("stex",function(V,L){"use strict";function z(C,T){C.cmdState.push(T)}function U(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var T=C.cmdState.pop();T&&T.closeBracket()}function B(C){for(var T=C.cmdState,p=T.length-1;p>=0;p--){var u=T[p];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function I(C,T,p){return function(){this.name=C,this.bracketNo=0,this.style=T,this.styles=p,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=I("importmodule","tag",["string","builtin"]),O.documentclass=I("documentclass","tag",["","atom"]),O.usepackage=I("usepackage","tag",["atom"]),O.begin=I("begin","tag",["atom"]),O.end=I("end","tag",["atom"]),O.label=I("label","tag",["atom"]),O.ref=I("ref","tag",["atom"]),O.eqref=I("eqref","tag",["atom"]),O.cite=I("cite","tag",["atom"]),O.bibitem=I("bibitem","tag",["atom"]),O.Bibitem=I("Bibitem","tag",["atom"]),O.RBibitem=I("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,T){C.f=T}function x(C,T){var p;if(C.match(/^\\[a-zA-Z@]+/)){var u=C.current().slice(1);return p=O.hasOwnProperty(u)?O[u]:O.DEFAULT,p=new p,z(T,p),D(T,P),p.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(T,function(s,l){return A(s,l,"\\]")}),"keyword";if(C.match("\\("))return D(T,function(s,l){return A(s,l,"\\)")}),"keyword";if(C.match("$$"))return D(T,function(s,l){return A(s,l,"$$")}),"keyword";if(C.match("$"))return D(T,function(s,l){return A(s,l,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(p=U(T),p)p.closeBracket(o),D(T,P);else return"error";return"bracket"}else return o=="{"||o=="["?(p=O.DEFAULT,p=new p,z(T,p),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),p=B(T),p.name=="begin"&&(p.argument=C.current()),p.styleIdentifier())}function A(C,T,p){if(C.eatSpace())return null;if(p&&C.match(p))return D(T,x),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=C.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(C.skipToEnd(),"comment"):"error"}function P(C,T){var p=C.peek(),u;return p=="{"||p=="["?(u=U(T),u.openBracket(p),C.eat(p),D(T,x),"bracket"):/[ \t\r]/.test(p)?(C.eat(p),null):(D(T,x),R(T),x(C,T))}return{startState:function(){var C=L.inMathMode?function(T,p){return A(T,p)}:x;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,T){return T.f(C,T)},blankLine:function(C){C.f=x,C.cmdState.length=0},lineComment:"%"}}),ie.defineMIME("text/x-stex","stex"),ie.defineMIME("text/x-latex","stex")})},"19Vz":function(ct,et,se){(function(ie){ie(se("VrN/"))})(function(ie){ie.defineOption("placeholder","",function(I,O,D){var x=D&&D!=ie.Init;if(O&&!x)I.on("blur",U),I.on("change",R),I.on("swapDoc",R),ie.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){z(I)}),R(I);else if(!O&&x){I.off("blur",U),I.off("change",R),I.off("swapDoc",R),ie.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),V(I);var A=I.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}O&&!I.hasFocus()&&U(I)});function V(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function L(I){V(I);var O=I.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=I.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var D=I.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),O.appendChild(D),I.display.lineSpace.insertBefore(O,I.display.lineSpace.firstChild)}function z(I){setTimeout(function(){var O=!1,D=I.getInputField();D.nodeName=="TEXTAREA"?O=!D.value:I.lineCount()==1&&(O=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),O?L(I):V(I)},20)}function U(I){B(I)&&L(I)}function R(I){var O=I.getWrapperElement(),D=B(I);O.className=O.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(I):V(I)}function B(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(ct,et,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ie.defineMode("xml",function(z,U){var R=z.indentUnit,B={},I=U.htmlMode?V:L;for(var O in I)B[O]=I[O];for(var O in U)B[O]=U[O];var D,x;function A(a,v){function g(F){return v.tokenize=F,F(a,v)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(T("atom","]]>")):null:a.match("--")?g(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(p(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=T("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",v.tokenize=P,"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}A.isInText=!0;function P(a,v){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return v.tokenize=A,D=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return D="equals",null;if(g=="<"){v.tokenize=A,v.state=l,v.tagName=v.tagStart=null;var b=v.tokenize(a,v);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(g)?(v.tokenize=C(g),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(g,b){for(;!g.eol();)if(g.next()==a){b.tokenize=P;break}return"string"};return v.isInAttribute=!0,v}function T(a,v){return function(g,b){for(;!g.eol();){if(g.match(v)){b.tokenize=A;break}g.next()}return a}}function p(a){return function(v,g){for(var b;(b=v.next())!=null;){if(b=="<")return g.tokenize=p(a+1),g.tokenize(v,g);if(b==">")if(a==1){g.tokenize=A;break}else return g.tokenize=p(a-1),g.tokenize(v,g)}return"meta"}}function u(a,v,g){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=g,(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 g;;){if(!a.context)return;if(g=a.context.tagName,!B.contextGrabbers.hasOwnProperty(g)||!B.contextGrabbers[g].hasOwnProperty(v))return;o(a)}}function l(a,v,g){return a=="openTag"?(g.tagStart=v.column(),S):a=="closeTag"?c:l}function S(a,v,g){return a=="word"?(g.tagName=v.current(),x="tag",y):B.allowMissingTagName&&a=="endTag"?(x="tag bracket",y(a,v,g)):(x="error",S)}function c(a,v,g){if(a=="word"){var b=v.current();return g.context&&g.context.tagName!=b&&B.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==b||B.matchClosing===!1?(x="tag",m):(x="tag error",w)}else return B.allowMissingTagName&&a=="endTag"?(x="tag bracket",m(a,v,g)):(x="error",w)}function m(a,v,g){return a!="endTag"?(x="error",m):(o(g),l)}function w(a,v,g){return x="error",m(a,v,g)}function y(a,v,g){if(a=="word")return x="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var b=g.tagName,M=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(b)?s(g,b):(s(g,b),g.context=new u(g,b,M==g.indented)),l}return x="error",y}function f(a,v,g){return a=="equals"?h:(B.allowMissing||(x="error"),y(a,v,g))}function h(a,v,g){return a=="string"?d:a=="word"&&B.allowUnquoted?(x="string",y):(x="error",y(a,v,g))}function d(a,v,g){return a=="string"?d:y(a,v,g)}return{startState:function(a){var v={tokenize:A,state:l,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 g=v.tokenize(a,v);return(g||D)&&g!="comment"&&(x=null,v.state=v.state(D||g,a,v),x&&(g=x=="error"?g+" error":x)),g},indent:function(a,v,g){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(b&&b.noIndent)return ie.Pass;if(a.tokenize!=P&&a.tokenize!=A)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(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+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==h&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],g=a.context;g;g=g.prev)g.tagName&&v.push(g.tagName);return v.reverse()}}}),ie.defineMIME("text/xml","xml"),ie.defineMIME("application/xml","xml"),ie.mimeModes.hasOwnProperty("text/html")||ie.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7ahc":function(ct,et,se){"use strict";se.d(et,"a",function(){return S});var ie=se("k1fw"),V=se("0Owb"),L=se("+L6B"),z=se("2/Rp"),U=se("y8nQ"),R=se("Vl3Y"),B=se("tJVT"),I=se("OaEy"),O=se("2fM7"),D=se("q1tI"),x=se.n(D),A=se("VrN/"),P=se.n(A),C=se("p77/"),T=se.n(C),p=se("c5Ni"),u=se.n(p),o=O.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};et.b=function(c){var m=c.callback,w=c.onCancel,y=Object(D.useState)("python"),f=Object(B.a)(y,2),h=f[0],d=f[1];function a(g){d(l[g][1])}function v(g){m(g)}return x.a.createElement(R.a,Object(V.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),x.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(O.a,{onChange:a},Object.keys(l).map(function(g){return x.a.createElement(o,{key:g,value:g},l[g][0])}))),x.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(S,{mode:h})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(z.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(c){var m=c.value,w=c.onChange,y=c.mode,f=c.options,h=f===void 0?{}:f,d=Object(D.useRef)(),a=Object(D.useState)(),v=Object(B.a)(a,2),g=v[0],b=v[1];return Object(D.useEffect)(function(){if(g){function M(F){var j=F.getValue();w&&w(j)}return g.on("change",M),function(){g.off("change",M)}}},[g,w]),Object(D.useEffect)(function(){g&&g.setOption("mode",y)},[g,y]),Object(D.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(D.useEffect)(function(){if(d.current&&!g){var M=P.a.fromTextArea(d.current,Object(ie.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));b(M)}},[d.current,g]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:d}))}},"8EBN":function(ct,et,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";ie.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<ie.modeInfo.length;V++){var L=ie.modeInfo[V];L.mimes&&(L.mime=L.mimes[0])}ie.findModeByMIME=function(z){z=z.toLowerCase();for(var U=0;U<ie.modeInfo.length;U++){var R=ie.modeInfo[U];if(R.mime==z)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==z)return R}}if(/\+xml$/.test(z))return ie.findModeByMIME("application/xml");if(/\+json$/.test(z))return ie.findModeByMIME("application/json")},ie.findModeByExtension=function(z){z=z.toLowerCase();for(var U=0;U<ie.modeInfo.length;U++){var R=ie.modeInfo[U];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==z)return R}}},ie.findModeByFileName=function(z){for(var U=0;U<ie.modeInfo.length;U++){var R=ie.modeInfo[U];if(R.file&&R.file.test(z))return R}var B=z.lastIndexOf("."),I=B>-1&&z.substring(B+1,z.length);if(I)return ie.findModeByExtension(I)},ie.findModeByName=function(z){z=z.toLowerCase();for(var U=0;U<ie.modeInfo.length;U++){var R=ie.modeInfo[U];if(R.name.toLowerCase()==z)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==z)return R}}}})},"9Bee":function(ct,et,se){"use strict";var ie=se("k1fw"),V=se("tJVT"),L=se("q1tI"),z=se.n(L),U=se("vg9a"),R=se("DlQD"),B=se.n(R),I=se("rUJ1");function O(H,X){var q=H.match(/^(\s+)(?:```)/);if(q===null)return X;var re=q[1];return X.split(`
`).map(function(Ee){var me=Ee.match(/^\s+/);if(me===null)return Ee;var Se=Object(V.a)(me,1),ve=Se[0];return ve.length>=re.length?Ee.slice(re.length):Ee}).join(`
`)}var D=[],x=["<ul>"],A=new B.a.Renderer,P=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){D.length=0,x=["<ul>"]}var T={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(H,X,q,re){if(X>=H.length||H[X].level<=q)return X;var Ee=H[X];re.push("<li><a href='#"+Ee.anchor+"'>"+Ee.text+"</a>"),X++;var me=[];return X=p(H,X,Ee.level,me),me.length>0&&(re.push("<ul>"),me.forEach(function(Se){re.push(Se)}),re.push("</ul>")),re.push("</li>"),X=p(H,X,q,re),X}function u(){return p(D,0,0,x),x.push("</ul>"),x.join("")}var o={heading:function(X){var q=P.exec(X);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},fences:function(X){var q=this.rules.block.fences.exec(X);if(q){var re=q[0],Ee=O(re,q[3]||""),me=q[2]?q[2].trim():q[2];if(["latex","katex","math"].indexOf(me)>=0){var Se=S(),ve=Ee;Ee=Se,c[Se]={type:"block",expression:ve}}return{type:"code",raw:re,lang:me,text:Ee}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,S=function(){return"__special_katext_id_".concat(l++,"__")},c={};function m(){return c}function w(){l=0,c={}}function y(H){return H=H.replace(s,function(X,q){var re=S();return c[re]={type:"inline",expression:q},re}),H}var f=A.listitem;A.listitem=function(H){return f(y(H))};var h=A.paragraph;A.paragraph=function(H){return h(y(H))};var d=A.tablecell;A.tablecell=function(H,X){return d(y(H),X)},A.code=function(H,X,q){var re=(X||"").match(/\S*/)[0];return re?["latex","katex","math"].indexOf(re)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(X,'">').concat(q?H:Object(I.escape)(H,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(q?H:Object(I.escape)(H,!0))+"</code></pre>"},A.heading=function(H,X,q){var re=this.options.headerPrefix+q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return D.push({anchor:re,level:X,text:H}),"<h"+X+' id="'+re+'">'+H+"</h"+X+">"},B.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),B.a.use({tokenizer:o,renderer:A});var a=B.a,v=se("SJMd"),g=se("ulZh"),b=se.n(g),M=se("m3rI"),F=se("Oy/b"),j=se("p5ED"),W=/<pre[^>]*>/g;function _(H){var X=document.createElement("div");return X.innerHTML=H,X.childNodes.length===0?"":X.childNodes[0].nodeValue}var k=et.a=function(H){var X=H.value,q=X===void 0?"":X,re=H.className,Ee=H.showTextOnly,me=H.showLines,Se=H.style,ve=Se===void 0?{}:Se,fe=H.stylesPrev,ue=fe===void 0?{}:fe,he=String(q),Q=Object(L.useState)(""),ne=Object(V.a)(Q,2),Z=ne[0],ge=ne[1],Te=Object(L.useMemo)(function(){try{var ke=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Pe=/\"\/api\/attachments\/|\"\/attachments\/download\//g,De=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;he=he.replace(ke,"("+M.a.API_SERVER+"/api/attachments/").replace(Pe,'"'+M.a.API_SERVER+"/api/attachments/").replace(De,'"'+M.a.API_SERVER+"/files/uploads/").replace(/\r\n/g,`
`),he=he.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(Xe){}var Le=a(he),We=m();if(he.match(/\[TOC\]/)&&(Le=Le.replace("<p>[TOC]</p>",u()),C()),Le=Le.replace(/(__special_katext_id_\d+__)/g,function(Xe,Ke){var Ze=We[Ke],je=Ze.type,Be=Ze.expression;return Object(F.renderToString)(_(Be)||"",{displayMode:je==="block",throwOnError:!1,output:"html"})}),Le=Le.replace(/▁/g,"\u2581\u2581\u2581"),w(),Ee){var Ye=document.createElement("div");return Ye.innerHTML=Le,Ye.innerText}return setTimeout(function(){return Oe()},500),Le},[he]),pe=Object(L.useRef)();T.WebkitLineClamp=me,me&&(ve=Object(ie.a)(Object(ie.a)({},ve),T));function we(ke){var Pe=ke.target;if(Pe.tagName.toUpperCase()==="A"){var De=Pe.getAttribute("href");if(De.indexOf("office")>-1)ke.preventDefault(),ge(De);else if(De.startsWith("#")){ke.preventDefault();var Le=document.getElementById(De.replace("#",""));Le&&Le.scrollIntoView(!0)}}}var Oe=function(){var Pe,De=(Pe=pe.current)===null||Pe===void 0?void 0:Pe.querySelectorAll("video");De==null||De.forEach(function(Le){if(Le.oncontextmenu=function(){return!1},Le.src.indexOf(".m3u8")>-1&&!Le.canPlayType("application/vnd.apple.mpegurl")){if(b.a.isSupported()){var We=new b.a;We.loadSource(Le.src),We.attachMedia(Le)}}})};return Object(L.useEffect)(function(){if(pe.current&&Te&&(Te.match(W)&&window.PR.prettyPrint()),pe.current)return pe.current.addEventListener("click",we),function(){pe.current.removeEventListener("click",we),w(),C()}},[Te,pe.current,we]),z.a.createElement(z.a.Fragment,null,z.a.createElement("div",{ref:pe,style:Object(ie.a)({},ve),className:"".concat(re||""," markdown-body "),dangerouslySetInnerHTML:{__html:Te}}),z.a.createElement(j.a,{close:!0,data:Z,type:Z!=null&&Z.length?"office":"",style:Object(ie.a)({},ue),onClose:function(){return ge("")}}))}},"9VGf":function(ct,et,se){"use strict";se.d(et,"a",function(){return L});var ie=se("q1tI"),V=se.n(ie);function L(z,U){var R=Object(ie.useRef)();Object(ie.useEffect)(function(){R.current=z}),Object(ie.useEffect)(function(){function B(){R.current()}if(U!==null){var I=setInterval(B,U);return function(){return clearInterval(I)}}},[U])}},BU3w:function(ct,et,se){"use strict";se.d(et,"a",function(){return R});var ie=se("MNnm"),V="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var I=document.querySelector("head");return I||document.body}function z(B){var I,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ie.a)())return null;var D=document.createElement("style");if((I=O.csp)===null||I===void 0?void 0:I.nonce){var x;D.nonce=(x=O.csp)===null||x===void 0?void 0:x.nonce}D.innerHTML=B;var A=L(O),P=A.firstChild;return O.prepend&&A.prepend?A.prepend(D):O.prepend&&P?A.insertBefore(D,P):A.appendChild(D),D}var U=new Map;function R(B,I){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=L(O);if(!U.has(D)){var x=z("",O),A=x.parentNode;U.set(D,A),A.removeChild(x)}var P=Array.from(U.get(D).children).find(function(o){return o.tagName==="STYLE"&&o[V]===I});if(P){var C,T;if(((C=O.csp)===null||C===void 0?void 0:C.nonce)&&P.nonce!==((T=O.csp)===null||T===void 0?void 0:T.nonce)){var p;P.nonce=(p=O.csp)===null||p===void 0?void 0:p.nonce}return P.innerHTML!==B&&(P.innerHTML=B),P}var u=z(B,O);return u[V]=I,u}},Bd2K:function(ct,et,se){(function(ie){ie(se("VrN/"),se("osHv"))})(function(ie){ie.defineOption("autoCloseTags",!1,function(O,D,x){if(x!=ie.Init&&x&&O.removeKeyMap("autoCloseTags"),!D)return;var A={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(A["'/'"]=function(P){return R(P)}),(typeof D!="object"||D.whenOpening!==!1)&&(A["'>'"]=function(P){return z(P)}),O.addKeyMap(A)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(O){if(O.getOption("disableInput"))return ie.Pass;for(var D=O.listSelections(),x=[],A=O.getOption("autoCloseTags"),P=0;P<D.length;P++){if(!D[P].empty())return ie.Pass;var C=D[P].head,T=O.getTokenAt(C),p=ie.innerMode(O.getMode(),T.state),u=p.state,o=p.mode.xmlCurrentTag&&p.mode.xmlCurrentTag(u),s=o&&o.name;if(!s)return ie.Pass;var l=p.mode.configuration=="html",S=typeof A=="object"&&A.dontCloseTags||l&&V,c=typeof A=="object"&&A.indentTags||l&&L;T.end>C.ch&&(s=s.slice(0,s.length-T.end+C.ch));var m=s.toLowerCase();if(!s||T.type=="string"&&(T.end!=C.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&o.close||T.string.indexOf("/")==C.ch-T.start-1||S&&B(S,m)>-1||I(O,p.mode.xmlCurrentContext&&p.mode.xmlCurrentContext(u)||[],s,C,!0))return ie.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&B(w,s)>-1){x[P]={text:"/>",newPos:ie.Pos(C.line,C.ch+2)};continue}var y=c&&B(c,m)>-1;x[P]={indent:y,text:">"+(y?`
`:"")+"</"+s+">",newPos:y?ie.Pos(C.line+1,0):ie.Pos(C.line,C.ch+1)}}for(var f=typeof A=="object"&&A.dontIndentOnAutoClose,P=D.length-1;P>=0;P--){var h=x[P];O.replaceRange(h.text,D[P].head,D[P].anchor,"+insert");var d=O.listSelections().slice(0);d[P]={head:h.newPos,anchor:h.newPos},O.setSelections(d),!f&&h.indent&&(O.indentLine(h.newPos.line,null,!0),O.indentLine(h.newPos.line+1,null,!0))}}function U(O,D){for(var x=O.listSelections(),A=[],P=D?"/":"</",C=O.getOption("autoCloseTags"),T=typeof C=="object"&&C.dontIndentOnSlash,p=0;p<x.length;p++){if(!x[p].empty())return ie.Pass;var u=x[p].head,o=O.getTokenAt(u),s=ie.innerMode(O.getMode(),o.state),l=s.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return ie.Pass;var S,c=s.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(c&&s.mode.name=="javascript")S=P+"script";else if(c&&s.mode.name=="css")S=P+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!m||m.length&&I(O,m,m[m.length-1],u))return ie.Pass;S=P+m[m.length-1]}O.getLine(u.line).charAt(o.end)!=">"&&(S+=">"),A[p]=S}if(O.replaceSelections(A),x=O.listSelections(),!T)for(var p=0;p<x.length;p++)(p==x.length-1||x[p].head.line<x[p+1].head.line)&&O.indentLine(x[p].head.line)}function R(O){return O.getOption("disableInput")?ie.Pass:U(O,!0)}ie.commands.closeTag=function(O){return U(O)};function B(O,D){if(O.indexOf)return O.indexOf(D);for(var x=0,A=O.length;x<A;++x)if(O[x]==D)return x;return-1}function I(O,D,x,A,P){if(!ie.scanForClosingTag)return!1;var C=Math.min(O.lastLine()+1,A.line+500),T=ie.scanForClosingTag(O,A,null,C);if(!T||T.tag!=x)return!1;for(var p=P?1:0,u=D.length-1;u>=0&&D[u]==x;u--)++p;A=T.to;for(var u=1;u<p;u++){var o=ie.scanForClosingTag(O,A,null,C);if(!o||o.tag!=x)return!1;A=o.to}return!0}})},BjJ7:function(ct,et,se){"use strict";se.d(et,"d",function(){return V}),se.d(et,"c",function(){return L}),se.d(et,"e",function(){return z}),se.d(et,"b",function(){return U}),se.d(et,"a",function(){return B});var ie=se("m3rI");function V(I){var O=!0;if(I.length>0){for(var D=0;D<I.length;D++)if(I[D].compile_success==0||!I[D].compile_success){O=!1;break}}else O=!1;return O}function L(I){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],x=0;x<I.length;x++){var A=I[x],P=O?"".concat(O,"/").concat(A.name):"".concat(A.name);D.push({title:A.name,isLeaf:!(A.type==="tree"),key:P})}return D}function z(I,O,D){for(var x=0;x<I.length;x++){var A=I[x];if(A.key===O){A.children=D;break}A.children&&z(A.children,O,D)}return I}function U(I,O,D){var x;return function(){var A=this,P=arguments,C=function(){x=null,D||I.apply(A,P)},T=D&&!x;clearTimeout(x),x=setTimeout(C,O),T&&I.apply(A,P)}}var R=!0,B=ie.a.API_SERVER},"C+DQ":function(ct,et,se){},DlQD:function(ct,et,se){(function(ie,V){ct.exports=V()})(this,function(){"use strict";function ie(oe,le){for(var de=0;de<le.length;de++){var $=le[de];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(oe,$.key,$)}}function V(oe,le,de){return le&&ie(oe.prototype,le),de&&ie(oe,de),oe}function L(oe,le){if(!oe)return;if(typeof oe=="string")return z(oe,le);var de=Object.prototype.toString.call(oe).slice(8,-1);if(de==="Object"&&oe.constructor&&(de=oe.constructor.name),de==="Map"||de==="Set")return Array.from(oe);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return z(oe,le)}function z(oe,le){(le==null||le>oe.length)&&(le=oe.length);for(var de=0,$=new Array(le);de<le;de++)$[de]=oe[de];return $}function U(oe,le){var de;if(typeof Symbol=="undefined"||oe[Symbol.iterator]==null){if(Array.isArray(oe)||(de=L(oe))||le&&oe&&typeof oe.length=="number"){de&&(oe=de);var $=0;return function(){return $>=oe.length?{done:!0}:{done:!1,value:oe[$++]}}}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 de=oe[Symbol.iterator](),de.next.bind(de)}function R(oe,le){return le={exports:{}},oe(le,le.exports),le.exports}var B=R(function(oe){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 de($){oe.exports.defaults=$}oe.exports={defaults:le(),getDefaults:le,changeDefaults:de}}),I=B.defaults,O=B.getDefaults,D=B.changeDefaults,x=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},p=function(le){return T[le]};function u(oe,le){if(le){if(x.test(oe))return oe.replace(A,p)}else if(P.test(oe))return oe.replace(C,p);return oe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(oe){return oe.replace(o,function(le,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var l=/(^|[^\[])\^/g;function S(oe,le){oe=oe.source||oe,le=le||"";var de={replace:function(J,ee){return ee=ee.source||ee,ee=ee.replace(l,"$1"),oe=oe.replace(J,ee),de},getRegex:function(){return new RegExp(oe,le)}};return de}var c=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(oe,le,de){if(oe){var $;try{$=decodeURIComponent(s(de)).replace(c,"").toLowerCase()}catch(J){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}le&&!m.test(de)&&(de=a(le,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(J){return null}return de}var y={},f=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(oe,le){y[" "+oe]||(f.test(oe)?y[" "+oe]=oe+"/":y[" "+oe]=M(oe,"/",!0)),oe=y[" "+oe];var de=oe.indexOf(":")===-1;return le.substring(0,2)==="//"?de?le:oe.replace(h,"$1")+le:le.charAt(0)==="/"?de?le:oe.replace(d,"$1")+le:oe+le}var v={exec:function(){}};function g(oe){for(var le=1,de,$;le<arguments.length;le++){de=arguments[le];for($ in de)Object.prototype.hasOwnProperty.call(de,$)&&(oe[$]=de[$])}return oe}function b(oe,le){var de=oe.replace(/\|/g,function(ee,te,ye){for(var Ae=!1,Me=te;--Me>=0&&ye[Me]==="\\";)Ae=!Ae;return Ae?"|":" |"}),$=de.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(oe,le,de){var $=oe.length;if($===0)return"";for(var J=0;J<$;){var ee=oe.charAt($-J-1);if(ee===le&&!de)J++;else if(ee!==le&&de)J++;else break}return oe.substr(0,$-J)}function F(oe,le){if(oe.indexOf(le[1])===-1)return-1;for(var de=oe.length,$=0,J=0;J<de;J++)if(oe[J]==="\\")J++;else if(oe[J]===le[0])$++;else if(oe[J]===le[1]&&($--,$<0))return J;return-1}function j(oe){oe&&oe.sanitize&&!oe.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:u,unescape:s,edit:S,cleanUrl:w,resolveUrl:a,noopTest:v,merge:g,splitCells:b,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},_=B.defaults,k=W.rtrim,H=W.splitCells,X=W.escape,q=W.findClosingBracket;function re(oe,le,de){var $=le.href,J=le.title?X(le.title):null,ee=oe[1].replace(/\\([\[\]])/g,"$1");return oe[0].charAt(0)!=="!"?{type:"link",raw:de,href:$,title:J,text:ee}:{type:"image",raw:de,href:$,title:J,text:X(ee)}}function Ee(oe,le){var de=oe.match(/^(\s+)(?:```)/);if(de===null)return le;var $=de[1];return le.split(`
`).map(function(J){var ee=J.match(/^\s+/);if(ee===null)return J;var te=ee[0];return te.length>=$.length?J.slice($.length):J}).join(`
`)}var me=function(){function oe(de){this.options=de||_}var le=oe.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 te=J[J.length-1];if(te&&te.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var ye=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?ye:k(ye,`
`)}}},le.fences=function($){var J=this.rules.block.fences.exec($);if(J){var ee=J[0],te=Ee(ee,J[3]||"");return{type:"code",raw:ee,lang:J[2]?J[2].trim():J[2],text:te}}},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:H(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 te=ee.align.length,ye;for(ye=0;ye<te;ye++)/^ *-+: *$/.test(ee.align[ye])?ee.align[ye]="right":/^ *:-+: *$/.test(ee.align[ye])?ee.align[ye]="center":/^ *:-+ *$/.test(ee.align[ye])?ee.align[ye]="left":ee.align[ye]=null;for(te=ee.cells.length,ye=0;ye<te;ye++)ee.cells[ye]=H(ee.cells[ye],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],te=J[2],ye=te.length>1,Ae=te[te.length-1]===")",Me={type:"list",raw:ee,ordered:ye,start:ye?+te.slice(0,-1):"",loose:!1,items:[]},tt=J[0].match(this.rules.block.item),ft=!1,nt,Ct,pt,st,kt,ot,vt,yt=tt.length,He=0;He<yt;He++)nt=tt[He],ee=nt,Ct=nt.length,nt=nt.replace(/^ *([*+-]|\d+[.)]) */,""),~nt.indexOf(`
`)&&(Ct-=nt.length,nt=this.options.pedantic?nt.replace(/^ {1,4}/gm,""):nt.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),He!==yt-1&&(pt=this.rules.block.bullet.exec(tt[He+1])[0],(ye?pt.length===1||!Ae&&pt[pt.length-1]===")":pt.length>1||this.options.smartLists&&pt!==te)&&(st=tt.slice(He+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-st.length),He=yt-1)),kt=ft||/\n\n(?!\s*$)/.test(nt),He!==yt-1&&(ft=nt.charAt(nt.length-1)===`
`,kt||(kt=ft)),kt&&(Me.loose=!0),ot=/^\[[ xX]\] /.test(nt),vt=void 0,ot&&(vt=nt[1]!==" ",nt=nt.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:ee,task:ot,checked:vt,loose:kt,text:nt});return Me}},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]):X(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:H(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 te=ee.align.length,ye;for(ye=0;ye<te;ye++)/^ *-+: *$/.test(ee.align[ye])?ee.align[ye]="right":/^ *:-+: *$/.test(ee.align[ye])?ee.align[ye]="center":/^ *:-+ *$/.test(ee.align[ye])?ee.align[ye]="left":ee.align[ye]=null;for(te=ee.cells.length,ye=0;ye<te;ye++)ee.cells[ye]=H(ee.cells[ye].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 te=J[J.length-1];return te&&te.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:X(J[1])}},le.tag=function($,J,ee){var te=this.rules.inline.tag.exec($);if(te)return!J&&/^<a /i.test(te[0])?J=!0:J&&/^<\/a>/i.test(te[0])&&(J=!1),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(te[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(te[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:te[0],inLink:J,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):X(te[0]):te[0]}},le.link=function($){var J=this.rules.inline.link.exec($);if(J){var ee=q(J[2],"()");if(ee>-1){var te=J[0].indexOf("!")===0?5:4,ye=te+J[1].length+ee;J[2]=J[2].substring(0,ee),J[0]=J[0].substring(0,ye).trim(),J[3]=""}var Ae=J[2],Me="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);tt?(Ae=tt[1],Me=tt[3]):Me=""}else Me=J[3]?J[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=re(J,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},J[0]);return ft}},le.reflink=function($,J){var ee;if((ee=this.rules.inline.reflink.exec($))||(ee=this.rules.inline.nolink.exec($))){var te=(ee[2]||ee[1]).replace(/\s+/g," ");if(te=J[te.toLowerCase()],!te||!te.href){var ye=ee[0].charAt(0);return{type:"text",raw:ye,text:ye}}var Ae=re(ee,te,ee[0]);return Ae}},le.strong=function($,J,ee){ee===void 0&&(ee="");var te=this.rules.inline.strong.start.exec($);if(te&&(!te[1]||te[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){J=J.slice(-1*$.length);var ye=te[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ye.lastIndex=0;for(var Ae;(te=ye.exec(J))!=null;)if(Ae=this.rules.inline.strong.middle.exec(J.slice(0,te.index+3)),Ae)return{type:"strong",raw:$.slice(0,Ae[0].length),text:$.slice(2,Ae[0].length-2)}}},le.em=function($,J,ee){ee===void 0&&(ee="");var te=this.rules.inline.em.start.exec($);if(te&&(!te[1]||te[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){J=J.slice(-1*$.length);var ye=te[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ye.lastIndex=0;for(var Ae;(te=ye.exec(J))!=null;)if(Ae=this.rules.inline.em.middle.exec(J.slice(0,te.index+2)),Ae)return{type:"em",raw:$.slice(0,Ae[0].length),text:$.slice(1,Ae[0].length-1)}}},le.codespan=function($){var J=this.rules.inline.code.exec($);if(J){var ee=J[2].replace(/\n/g," "),te=/[^ ]/.test(ee),ye=ee.startsWith(" ")&&ee.endsWith(" ");return te&&ye&&(ee=ee.substring(1,ee.length-1)),ee=X(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 te,ye;return ee[2]==="@"?(te=X(this.options.mangle?J(ee[1]):ee[1]),ye="mailto:"+te):(te=X(ee[1]),ye=te),{type:"link",raw:ee[0],text:te,href:ye,tokens:[{type:"text",raw:te,text:te}]}}},le.url=function($,J){var ee;if(ee=this.rules.inline.url.exec($)){var te,ye;if(ee[2]==="@")te=X(this.options.mangle?J(ee[0]):ee[0]),ye="mailto:"+te;else{var Ae;do Ae=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(Ae!==ee[0]);te=X(ee[0]),ee[1]==="www."?ye="http://"+te:ye=te}return{type:"link",raw:ee[0],text:te,href:ye,tokens:[{type:"text",raw:te,text:te}]}}},le.inlineText=function($,J,ee){var te=this.rules.inline.text.exec($);if(te){var ye;return J?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):X(te[0]):te[0]:ye=X(this.options.smartypants?ee(te[0]):te[0]),{type:"text",raw:te[0],text:ye}}},oe}(),Se=W.noopTest,ve=W.edit,fe=W.merge,ue={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:Se,table:Se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ue._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ue._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ue.def=ve(ue.def).replace("label",ue._label).replace("title",ue._title).getRegex(),ue.bullet=/(?:[*+-]|\d{1,9}[.)])/,ue.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ue.item=ve(ue.item,"gm").replace(/bull/g,ue.bullet).getRegex(),ue.list=ve(ue.list).replace(/bull/g,ue.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ue.def.source+")").getRegex(),ue._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",ue._comment=/<!--(?!-?>)[\s\S]*?-->/,ue.html=ve(ue.html,"i").replace("comment",ue._comment).replace("tag",ue._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ue.paragraph=ve(ue._paragraph).replace("hr",ue.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",ue._tag).getRegex(),ue.blockquote=ve(ue.blockquote).replace("paragraph",ue.paragraph).getRegex(),ue.normal=fe({},ue),ue.gfm=fe({},ue.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*|$)"}),ue.gfm.nptable=ve(ue.gfm.nptable).replace("hr",ue.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",ue._tag).getRegex(),ue.gfm.table=ve(ue.gfm.table).replace("hr",ue.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",ue._tag).getRegex(),ue.pedantic=fe({},ue.normal,{html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ue._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:Se,paragraph:ve(ue.normal._paragraph).replace("hr",ue.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ue.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Se,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:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=ve(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=ve(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=ve(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=ve(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=ve(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=ve(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=ve(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=ve(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=ve(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=ve(he._blockSkip,"g").getRegex(),he.overlapSkip=ve(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,he.autolink=ve(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=ve(he.tag).replace("comment",ue._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=ve(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=ve(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=ve(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=fe({},he),he.pedantic=fe({},he.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ve(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=fe({},he.normal,{escape:ve(he.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=ve(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=fe({},he.gfm,{br:ve(he.br).replace("{2,}","*").getRegex(),text:ve(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Q={block:ue,inline:he},ne=B.defaults,Z=Q.block,ge=Q.inline;function Te(oe){return oe.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 pe(oe){var le="",de,$,J=oe.length;for(de=0;de<J;de++)$=oe.charCodeAt(de),Math.random()>.5&&($="x"+$.toString(16)),le+="&#"+$+";";return le}var we=function(){function oe(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ne,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Z.normal,inline:ge.normal};this.options.pedantic?($.block=Z.pedantic,$.inline=ge.pedantic):this.options.gfm&&($.block=Z.gfm,this.options.breaks?$.inline=ge.breaks:$.inline=ge.gfm),this.tokenizer.rules=$}oe.lex=function($,J){var ee=new oe(J);return ee.lex($)};var le=oe.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 te,ye,Ae,Me;$;){if(te=this.tokenizer.space($)){$=$.substring(te.raw.length),te.type&&J.push(te);continue}if(te=this.tokenizer.code($,J)){$=$.substring(te.raw.length),te.type?J.push(te):(Me=J[J.length-1],Me.raw+=`
`+te.raw,Me.text+=`
`+te.text);continue}if(te=this.tokenizer.fences($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.heading($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.nptable($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.hr($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.blockquote($)){$=$.substring(te.raw.length),te.tokens=this.blockTokens(te.text,[],ee),J.push(te);continue}if(te=this.tokenizer.list($)){for($=$.substring(te.raw.length),Ae=te.items.length,ye=0;ye<Ae;ye++)te.items[ye].tokens=this.blockTokens(te.items[ye].text,[],!1);J.push(te);continue}if(te=this.tokenizer.html($)){$=$.substring(te.raw.length),J.push(te);continue}if(ee&&(te=this.tokenizer.def($))){$=$.substring(te.raw.length),this.tokens.links[te.tag]||(this.tokens.links[te.tag]={href:te.href,title:te.title});continue}if(te=this.tokenizer.table($)){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.lheading($)){$=$.substring(te.raw.length),J.push(te);continue}if(ee&&(te=this.tokenizer.paragraph($))){$=$.substring(te.raw.length),J.push(te);continue}if(te=this.tokenizer.text($,J)){$=$.substring(te.raw.length),te.type?J.push(te):(Me=J[J.length-1],Me.raw+=`
`+te.raw,Me.text+=`
`+te.text);continue}if($){var tt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return J},le.inline=function($){var J,ee,te,ye,Ae,Me,tt=$.length;for(J=0;J<tt;J++){Me=$[J];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},ye=Me.header.length,ee=0;ee<ye;ee++)Me.tokens.header[ee]=[],this.inlineTokens(Me.header[ee],Me.tokens.header[ee]);for(ye=Me.cells.length,ee=0;ee<ye;ee++)for(Ae=Me.cells[ee],Me.tokens.cells[ee]=[],te=0;te<Ae.length;te++)Me.tokens.cells[ee][te]=[],this.inlineTokens(Ae[te],Me.tokens.cells[ee][te]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(ye=Me.items.length,ee=0;ee<ye;ee++)this.inline(Me.items[ee].tokens);break}}}return $},le.inlineTokens=function($,J,ee,te,ye){J===void 0&&(J=[]),ee===void 0&&(ee=!1),te===void 0&&(te=!1),ye===void 0&&(ye="");var Ae,Me=$,tt;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)ft.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Ae=this.tokenizer.escape($)){$=$.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.tag($,ee,te)){$=$.substring(Ae.raw.length),ee=Ae.inLink,te=Ae.inRawBlock,J.push(Ae);continue}if(Ae=this.tokenizer.link($)){$=$.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,te)),J.push(Ae);continue}if(Ae=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,te)),J.push(Ae);continue}if(Ae=this.tokenizer.strong($,Me,ye)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],ee,te),J.push(Ae);continue}if(Ae=this.tokenizer.em($,Me,ye)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],ee,te),J.push(Ae);continue}if(Ae=this.tokenizer.codespan($)){$=$.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.br($)){$=$.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.del($)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],ee,te),J.push(Ae);continue}if(Ae=this.tokenizer.autolink($,pe)){$=$.substring(Ae.raw.length),J.push(Ae);continue}if(!ee&&(Ae=this.tokenizer.url($,pe))){$=$.substring(Ae.raw.length),J.push(Ae);continue}if(Ae=this.tokenizer.inlineText($,te,Te)){$=$.substring(Ae.raw.length),ye=Ae.raw.slice(-1),J.push(Ae);continue}if($){var nt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(nt);break}else throw new Error(nt)}}return J},V(oe,null,[{key:"rules",get:function(){return{block:Z,inline:ge}}}]),oe}(),Oe=B.defaults,ke=W.cleanUrl,Pe=W.escape,De=function(){function oe(de){this.options=de||Oe}var le=oe.prototype;return le.code=function($,J,ee){var te=(J||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight($,te);ye!=null&&ye!==$&&(ee=!0,$=ye)}return te?'<pre><code class="'+this.options.langPrefix+Pe(te,!0)+'">'+(ee?$:Pe($,!0))+`</code></pre>
`:"<pre><code>"+(ee?$:Pe($,!0))+`</code></pre>
`},le.blockquote=function($){return`<blockquote>
`+$+`</blockquote>
`},le.html=function($){return $},le.heading=function($,J,ee,te){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+te.slug(ee)+'">'+$+"</h"+J+`>
`:"<h"+J+">"+$+"</h"+J+`>
`},le.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},le.list=function($,J,ee){var te=J?"ol":"ul",ye=J&&ee!==1?' start="'+ee+'"':"";return"<"+te+ye+`>
`+$+"</"+te+`>
`},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",te=J.align?"<"+ee+' align="'+J.align+'">':"<"+ee+">";return te+$+"</"+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($=ke(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var te='<a href="'+Pe($)+'"';return J&&(te+=' title="'+J+'"'),te+=">"+ee+"</a>",te},le.image=function($,J,ee){if($=ke(this.options.sanitize,this.options.baseUrl,$),$===null)return ee;var te='<img src="'+$+'" alt="'+ee+'"';return J&&(te+=' title="'+J+'"'),te+=this.options.xhtml?"/>":">",te},le.text=function($){return $},oe}(),Le=function(){function oe(){}var le=oe.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""},oe}(),We=function(){function oe(){this.seen={}}var le=oe.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},oe}(),Ye=B.defaults,Xe=W.unescape,Ke=function(){function oe(de){this.options=de||Ye,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Le,this.slugger=new We}oe.parse=function($,J){var ee=new oe(J);return ee.parse($)};var le=oe.prototype;return le.parse=function($,J){J===void 0&&(J=!0);var ee="",te,ye,Ae,Me,tt,ft,nt,Ct,pt,st,kt,ot,vt,yt,He,hr,mr,or,Dt=$.length;for(te=0;te<Dt;te++){st=$[te];switch(st.type){case"space":continue;case"hr":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Xe(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Ct="",nt="",Me=st.header.length,ye=0;ye<Me;ye++)nt+=this.renderer.tablecell(this.parseInline(st.tokens.header[ye]),{header:!0,align:st.align[ye]});for(Ct+=this.renderer.tablerow(nt),pt="",Me=st.cells.length,ye=0;ye<Me;ye++){for(ft=st.tokens.cells[ye],nt="",tt=ft.length,Ae=0;Ae<tt;Ae++)nt+=this.renderer.tablecell(this.parseInline(ft[Ae]),{header:!1,align:st.align[Ae]});pt+=this.renderer.tablerow(nt)}ee+=this.renderer.table(Ct,pt);continue}case"blockquote":{pt=this.parse(st.tokens),ee+=this.renderer.blockquote(pt);continue}case"list":{for(kt=st.ordered,ot=st.start,vt=st.loose,Me=st.items.length,pt="",ye=0;ye<Me;ye++)He=st.items[ye],hr=He.checked,mr=He.task,yt="",He.task&&(or=this.renderer.checkbox(hr),vt?He.tokens.length>0&&He.tokens[0].type==="text"?(He.tokens[0].text=or+" "+He.tokens[0].text,He.tokens[0].tokens&&He.tokens[0].tokens.length>0&&He.tokens[0].tokens[0].type==="text"&&(He.tokens[0].tokens[0].text=or+" "+He.tokens[0].tokens[0].text)):He.tokens.unshift({type:"text",text:or}):yt+=or),yt+=this.parse(He.tokens,vt),pt+=this.renderer.listitem(yt,mr,hr);ee+=this.renderer.list(pt,kt,ot);continue}case"html":{ee+=this.renderer.html(st.text);continue}case"paragraph":{ee+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(pt=st.tokens?this.parseInline(st.tokens):st.text;te+1<Dt&&$[te+1].type==="text";)st=$[++te],pt+=`
`+(st.tokens?this.parseInline(st.tokens):st.text);ee+=J?this.renderer.paragraph(pt):pt;continue}default:{var sr='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(sr);return}else throw new Error(sr)}}}return ee},le.parseInline=function($,J){J=J||this.renderer;var ee="",te,ye,Ae=$.length;for(te=0;te<Ae;te++){ye=$[te];switch(ye.type){case"escape":{ee+=J.text(ye.text);break}case"html":{ee+=J.html(ye.text);break}case"link":{ee+=J.link(ye.href,ye.title,this.parseInline(ye.tokens,J));break}case"image":{ee+=J.image(ye.href,ye.title,ye.text);break}case"strong":{ee+=J.strong(this.parseInline(ye.tokens,J));break}case"em":{ee+=J.em(this.parseInline(ye.tokens,J));break}case"codespan":{ee+=J.codespan(ye.text);break}case"br":{ee+=J.br();break}case"del":{ee+=J.del(this.parseInline(ye.tokens,J));break}case"text":{ee+=J.text(ye.text);break}default:{var Me='Token with "'+ye.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return ee},oe}(),Ze=W.merge,je=W.checkSanitizeDeprecation,Be=W.escape,Ce=B.getDefaults,$e=B.changeDefaults,Qe=B.defaults;function Re(oe,le,de){if(typeof oe=="undefined"||oe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof oe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(oe)+", string expected");if(typeof le=="function"&&(de=le,le=null),le=Ze({},Re.defaults,le||{}),je(le),de){var $=le.highlight,J;try{J=we.lex(oe,le)}catch(Ae){return de(Ae)}var ee=function(Me){var tt;if(!Me)try{tt=Ke.parse(J,le)}catch(ft){Me=ft}return le.highlight=$,Me?de(Me):de(null,tt)};if(!$||$.length<3)return ee();if(delete le.highlight,!J.length)return ee();var te=0;Re.walkTokens(J,function(Ae){Ae.type==="code"&&(te++,setTimeout(function(){$(Ae.text,Ae.lang,function(Me,tt){if(Me)return ee(Me);tt!=null&&tt!==Ae.text&&(Ae.text=tt,Ae.escaped=!0),te--,te===0&&ee()})},0))}),te===0&&ee();return}try{var ye=we.lex(oe,le);return le.walkTokens&&Re.walkTokens(ye,le.walkTokens),Ke.parse(ye,le)}catch(Ae){if(Ae.message+=`
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+Be(Ae.message+"",!0)+"</pre>";throw Ae}}Re.options=Re.setOptions=function(oe){return Ze(Re.defaults,oe),$e(Re.defaults),Re},Re.getDefaults=Ce,Re.defaults=Qe,Re.use=function(oe){var le=Ze({},oe);if(oe.renderer&&function(){var $=Re.defaults.renderer||new De,J=function(ye){var Ae=$[ye];$[ye]=function(){for(var Me=arguments.length,tt=new Array(Me),ft=0;ft<Me;ft++)tt[ft]=arguments[ft];var nt=oe.renderer[ye].apply($,tt);return nt===!1&&(nt=Ae.apply($,tt)),nt}};for(var ee in oe.renderer)J(ee);le.renderer=$}(),oe.tokenizer&&function(){var $=Re.defaults.tokenizer||new me,J=function(ye){var Ae=$[ye];$[ye]=function(){for(var Me=arguments.length,tt=new Array(Me),ft=0;ft<Me;ft++)tt[ft]=arguments[ft];var nt=oe.tokenizer[ye].apply($,tt);return nt===!1&&(nt=Ae.apply($,tt)),nt}};for(var ee in oe.tokenizer)J(ee);le.tokenizer=$}(),oe.walkTokens){var de=Re.defaults.walkTokens;le.walkTokens=function($){oe.walkTokens($),de&&de($)}}Re.setOptions(le)},Re.walkTokens=function(oe,le){for(var de=U(oe),$;!($=de()).done;){var J=$.value;le(J);switch(J.type){case"table":{for(var ee=U(J.tokens.header),te;!(te=ee()).done;){var ye=te.value;Re.walkTokens(ye,le)}for(var Ae=U(J.tokens.cells),Me;!(Me=Ae()).done;)for(var tt=Me.value,ft=U(tt),nt;!(nt=ft()).done;){var Ct=nt.value;Re.walkTokens(Ct,le)}break}case"list":{Re.walkTokens(J.items,le);break}default:J.tokens&&Re.walkTokens(J.tokens,le)}}},Re.Parser=Ke,Re.parser=Ke.parse,Re.Renderer=De,Re.TextRenderer=Le,Re.Lexer=we,Re.lexer=we.lex,Re.Tokenizer=me,Re.Slugger=We,Re.parse=Re;var Ue=Re;return Ue})},ELLl:function(ct,et,se){(function(ie){ie(se("VrN/"))})(function(ie){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=ie.Pos;ie.defineOption("autoCloseBrackets",!1,function(T,p,u){u&&u!=ie.Init&&(T.removeKeyMap(U),T.state.closeBrackets=null),p&&(R(z(p,"pairs")),T.state.closeBrackets=p,T.addKeyMap(U))});function z(T,p){return p=="pairs"&&typeof T=="string"?T:typeof T=="object"&&T[p]!=null?T[p]:V[p]}var U={Backspace:O,Enter:D};function R(T){for(var p=0;p<T.length;p++){var u=T.charAt(p),o="'"+u+"'";U[o]||(U[o]=B(u))}}R(V.pairs+"`");function B(T){return function(p){return A(p,T)}}function I(T){var p=T.state.closeBrackets;if(!p||p.override)return p;var u=T.getModeAt(T.getCursor());return u.closeBrackets||p}function O(T){var p=I(T);if(!p||T.getOption("disableInput"))return ie.Pass;for(var u=z(p,"pairs"),o=T.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ie.Pass;var l=P(T,o[s].head);if(!l||u.indexOf(l)%2!=0)return ie.Pass}for(var s=o.length-1;s>=0;s--){var S=o[s].head;T.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function D(T){var p=I(T),u=p&&z(p,"explode");if(!u||T.getOption("disableInput"))return ie.Pass;for(var o=T.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ie.Pass;var l=P(T,o[s].head);if(!l||u.indexOf(l)%2!=0)return ie.Pass}T.operation(function(){var S=T.lineSeparator()||`
`;T.replaceSelection(S+S,null),T.execCommand("goCharLeft"),o=T.listSelections();for(var c=0;c<o.length;c++){var m=o[c].head.line;T.indentLine(m,null,!0),T.indentLine(m+1,null,!0)}})}function x(T){var p=ie.cmpPos(T.anchor,T.head)>0;return{anchor:new L(T.anchor.line,T.anchor.ch+(p?-1:1)),head:new L(T.head.line,T.head.ch+(p?1:-1))}}function A(T,p){var u=I(T);if(!u||T.getOption("disableInput"))return ie.Pass;var o=z(u,"pairs"),s=o.indexOf(p);if(s==-1)return ie.Pass;for(var l=z(u,"closeBefore"),S=z(u,"triples"),c=o.charAt(s+1)==p,m=T.listSelections(),w=s%2==0,y,f=0;f<m.length;f++){var h=m[f],d=h.head,a,v=T.getRange(d,L(d.line,d.ch+1));if(w&&!h.empty())a="surround";else if((c||!w)&&v==p)c&&C(T,d)?a="both":S.indexOf(p)>=0&&T.getRange(d,L(d.line,d.ch+3))==p+p+p?a="skipThree":a="skip";else if(c&&d.ch>1&&S.indexOf(p)>=0&&T.getRange(L(d.line,d.ch-2),d)==p+p){if(d.ch>2&&/\bstring/.test(T.getTokenTypeAt(L(d.line,d.ch-2))))return ie.Pass;a="addFour"}else if(c){var g=d.ch==0?" ":T.getRange(L(d.line,d.ch-1),d);if(!ie.isWordChar(v)&&g!=p&&!ie.isWordChar(g))a="both";else return ie.Pass}else if(w&&(v.length===0||/\s/.test(v)||l.indexOf(v)>-1))a="both";else return ie.Pass;if(!y)y=a;else if(y!=a)return ie.Pass}var b=s%2?o.charAt(s-1):p,M=s%2?p:o.charAt(s+1);T.operation(function(){if(y=="skip")T.execCommand("goCharRight");else if(y=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(y=="surround"){for(var j=T.getSelections(),F=0;F<j.length;F++)j[F]=b+j[F]+M;T.replaceSelections(j,"around"),j=T.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=x(j[F]);T.setSelections(j)}else y=="both"?(T.replaceSelection(b+M,null),T.triggerElectric(b+M),T.execCommand("goCharLeft")):y=="addFour"&&(T.replaceSelection(b+b+b+b,"before"),T.execCommand("goCharRight"))})}function P(T,p){var u=T.getRange(L(p.line,p.ch-1),L(p.line,p.ch+1));return u.length==2?u:null}function C(T,p){var u=T.getTokenAt(L(p.line,p.ch+1));return/\bstring/.test(u.type)&&u.start==p.ch&&(p.ch==0||!/\bstring/.test(T.getTokenTypeAt(p)))}})},GfqC:function(ct,et,se){"use strict";var ie=se("q1tI"),V=se.n(ie),L=se("TSYQ"),z=se.n(L);function U(W,_){var k="cannot "+W.method+" "+W.action+" "+_.status+"'",H=new Error(k);return H.status=_.status,H.method=W.method,H.url=W.action,H}function R(W){var _=W.responseText||W.response;if(!_)return _;try{return JSON.parse(_)}catch(k){return _}}function B(W){var _=new XMLHttpRequest;W.onProgress&&_.upload&&(_.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var k=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var q=W.data[X];if(Array.isArray(q)){q.forEach(function(re){k.append(X+"[]",re)});return}k.append(X,W.data[X])}),W.file instanceof Blob?k.append(W.filename,W.file,W.file.name):k.append(W.filename,W.file),_.onerror=function(q){W.onError(q)},_.onload=function(){return _.status<200||_.status>=300?W.onError(U(W,_),R(_)):W.onSuccess(R(_),_)},_.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in _&&(_.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&_.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&_.setRequestHeader(X,H[X])}),_.send(k),{abort:function(){_.abort()}}}var I=+new Date,O=0;function D(){return"rc-upload-"+I+"-"+ ++O}function x(W,_){return W.indexOf(_,W.length-_.length)!==-1}var A=function(W,_){if(W&&_){var k=Array.isArray(_)?_:_.split(","),H=W.name||"",X=W.type||"",q=X.replace(/\/.*$/,"");return k.some(function(re){var Ee=re.trim();return Ee.charAt(0)==="."?x(H.toLowerCase(),Ee.toLowerCase()):/\/\*$/.test(Ee)?q===Ee.replace(/\/.*$/,""):X===Ee})}return!0};function P(W,_){var k=W.createReader(),H=[];function X(){k.readEntries(function(q){var re=Array.prototype.slice.apply(q);H=H.concat(re);var Ee=!re.length;Ee?_(H):X()})}X()}var C=function(_,k,H){var X=function q(re,Ee){Ee=Ee||"",re.isFile?re.file(function(me){H(me)&&(re.fullPath&&!me.webkitRelativePath&&(Object.defineProperties(me,{webkitRelativePath:{writable:!0}}),me.webkitRelativePath=re.fullPath.replace(/^\//,""),Object.defineProperties(me,{webkitRelativePath:{writable:!1}})),k([me]))}):re.isDirectory&&P(re,function(me){me.forEach(function(Se){q(Se,""+Ee+re.name+"/")})})};_.forEach(function(q){X(q.webkitGetAsEntry())})},T=C,p=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var k=arguments[_];for(var H in k)Object.prototype.hasOwnProperty.call(k,H)&&(W[H]=k[H])}return W},u=function(){function W(_,k){var H=[],X=!0,q=!1,re=void 0;try{for(var Ee=_[Symbol.iterator](),me;!(X=(me=Ee.next()).done)&&!(H.push(me.value),k&&H.length===k);X=!0);}catch(Se){q=!0,re=Se}finally{try{!X&&Ee.return&&Ee.return()}finally{if(q)throw re}}return H}return function(_,k){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return W(_,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(_,k){for(var H=0;H<k.length;H++){var X=k[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(_,X.key,X)}}return function(_,k,H){return k&&W(_.prototype,k),H&&W(_,H),_}}();function s(W,_,k){return _ in W?Object.defineProperty(W,_,{value:k,enumerable:!0,configurable:!0,writable:!0}):W[_]=k,W}function l(W,_){var k={};for(var H in W){if(_.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;k[H]=W[H]}return k}function S(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function c(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function m(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}var w=function(_){return Object.keys(_).reduce(function(k,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(k[H]=_[H]),k},{})},y=function(W){m(_,W);function _(){var k,H,X,q;S(this,_);for(var re=arguments.length,Ee=Array(re),me=0;me<re;me++)Ee[me]=arguments[me];return q=(H=(X=c(this,(k=_.__proto__||Object.getPrototypeOf(_)).call.apply(k,[this].concat(Ee))),X),X.state={uid:D()},X.reqs={},X.onChange=function(Se){var ve=Se.target.files;X.uploadFiles(ve),X.reset()},X.onClick=function(Se){var ve=X.fileInput;if(!ve)return;var fe=X.props,ue=fe.children,he=fe.onClick;ue&&ue.type==="button"&&(ve.parentNode.focus(),ve.parentNode.querySelector("button").blur()),ve.click(),he&&he(Se)},X.onKeyDown=function(Se){Se.key==="Enter"&&X.onClick()},X.onFileDrop=function(Se){var ve=X.props.multiple;if(Se.preventDefault(),Se.type==="dragover")return;if(X.props.directory)T(Array.prototype.slice.call(Se.dataTransfer.items),X.uploadFiles,function(ue){return A(ue,X.props.accept)});else{var fe=Array.prototype.slice.call(Se.dataTransfer.files).filter(function(ue){return A(ue,X.props.accept)});ve===!1&&(fe=fe.slice(0,1)),X.uploadFiles(fe)}},X.uploadFiles=function(Se){var ve=Array.prototype.slice.call(Se);ve.map(function(fe){return fe.uid=D(),fe}).forEach(function(fe){X.upload(fe,ve)})},X.saveFileInput=function(Se){X.fileInput=Se},H),c(X,q)}return o(_,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var q=this,re=this.props;if(!re.beforeUpload)return setTimeout(function(){return q.post(H)},0);var Ee=re.beforeUpload(H,X);Ee&&Ee.then?Ee.then(function(me){var Se=Object.prototype.toString.call(me);return Se==="[object File]"||Se==="[object Blob]"?q.post(me):q.post(H)}).catch(function(me){console.log(me)}):Ee!==!1&&setTimeout(function(){return q.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var q=this.props,re=q.onStart,Ee=q.onProgress,me=q.transformFile,Se=me===void 0?function(ve){return ve}:me;new Promise(function(ve){var fe=q.action;return typeof fe=="function"&&(fe=fe(H)),ve(fe)}).then(function(ve){var fe=H.uid,ue=q.customRequest||B,he=Promise.resolve(Se(H)).then(function(Q){var ne=q.data;return typeof ne=="function"&&(ne=ne(Q)),Promise.all([Q,ne])}).catch(function(Q){console.error(Q)});he.then(function(Q){var ne=u(Q,2),Z=ne[0],ge=ne[1],Te={action:ve,filename:q.name,data:ge,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Ee?function(pe){Ee(pe,H)}:null,onSuccess:function(we,Oe){delete X.reqs[fe],q.onSuccess(we,H,Oe)},onError:function(we,Oe){delete X.reqs[fe],q.onError(we,Oe,H)}};re(H),X.reqs[fe]=ue(Te)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var q=H;H&&H.uid&&(q=H.uid),X[q]&&X[q].abort&&X[q].abort(),delete X[q]}else Object.keys(X).forEach(function(re){X[re]&&X[re].abort&&X[re].abort(),delete X[re]})}},{key:"render",value:function(){var H,X=this.props,q=X.component,re=X.prefixCls,Ee=X.className,me=X.disabled,Se=X.id,ve=X.style,fe=X.multiple,ue=X.accept,he=X.children,Q=X.directory,ne=X.openFileDialogOnClick,Z=X.onMouseEnter,ge=X.onMouseLeave,Te=l(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),pe=z()((H={},s(H,re,!0),s(H,re+"-disabled",me),s(H,Ee,Ee),H)),we=me?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:ge,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(q,p({},we,{className:pe,role:"button",style:ve}),V.a.createElement("input",p({},w(Te),{id:Se,type:"file",ref:this.saveFileInput,onClick:function(ke){return ke.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ue,directory:Q?"directory":null,webkitdirectory:Q?"webkitdirectory":null,multiple:fe,onChange:this.onChange})),he)}}]),_}(ie.Component),f=y,h=Object.assign||function(W){for(var _=1;_<arguments.length;_++){var k=arguments[_];for(var H in k)Object.prototype.hasOwnProperty.call(k,H)&&(W[H]=k[H])}return W},d=function(){function W(_,k){for(var H=0;H<k.length;H++){var X=k[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(_,X.key,X)}}return function(_,k,H){return k&&W(_.prototype,k),H&&W(_,H),_}}();function a(W,_){if(!(W instanceof _))throw new TypeError("Cannot call a class as a function")}function v(W,_){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:W}function g(W,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);W.prototype=Object.create(_&&_.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(W,_):W.__proto__=_)}function b(){}var M=function(W){g(_,W);function _(){var k,H,X,q;a(this,_);for(var re=arguments.length,Ee=Array(re),me=0;me<re;me++)Ee[me]=arguments[me];return q=(H=(X=v(this,(k=_.__proto__||Object.getPrototypeOf(_)).call.apply(k,[this].concat(Ee))),X),X.saveUploader=function(Se){X.uploader=Se},H),v(X,q)}return d(_,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return V.a.createElement(f,h({},this.props,{ref:this.saveUploader}))}}]),_}(ie.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=et.a=F},HmJG:function(ct,et,se){},LdHM:function(ct,et,se){"use strict";se.d(et,"b",function(){return l}),se.d(et,"a",function(){return c});var ie=se("1OyB"),V=se("vuIU"),L=se("Ji7U"),z=se("LK+K"),U=se("q1tI"),R=se("rePB"),B=se("Ff2n"),I=se("ODXe"),O=se("4IlW"),D=se("bX4T"),x=se("YrtM"),A=se("TSYQ"),P=se.n(A),C=se("+nKL"),T=se("8OUc"),p=function(H,X){var q=H.prefixCls,re=H.id,Ee=H.flattenOptions,me=H.childrenAsData,Se=H.values,ve=H.searchValue,fe=H.multiple,ue=H.defaultActiveFirstOption,he=H.height,Q=H.itemHeight,ne=H.notFoundContent,Z=H.open,ge=H.menuItemSelectedIcon,Te=H.virtual,pe=H.onSelect,we=H.onToggleOpen,Oe=H.onActiveValue,ke=H.onScroll,Pe=H.onMouseEnter,De="".concat(q,"-item"),Le=Object(x.a)(function(){return Ee},[Z,Ee],function(Ue,oe){return oe[0]&&Ue[1]!==oe[1]}),We=U.useRef(null),Ye=function(oe){oe.preventDefault()},Xe=function(oe){We.current&&We.current.scrollTo({index:oe})},Ke=function(oe){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Le.length,$=0;$<de;$+=1){var J=(oe+$*le+de)%de,ee=Le[J],te=ee.group,ye=ee.data;if(!te&&!ye.disabled)return J}return-1},Ze=U.useState(function(){return Ke(0)}),je=Object(I.a)(Ze,2),Be=je[0],Ce=je[1],$e=function(oe){Ce(oe);var le=Le[oe];if(!le){Oe(null,-1);return}Oe(le.data.value,oe)};U.useEffect(function(){$e(ue!==!1?Ke(0):-1)},[Le.length,ve]),U.useEffect(function(){var Ue=setTimeout(function(){if(!fe&&Z&&Se.size===1){var oe=Array.from(Se)[0],le=Le.findIndex(function(de){var $=de.data;return $.value===oe});$e(le),Xe(le)}});return function(){return clearTimeout(Ue)}},[Z]);var Qe=function(oe){oe!==void 0&&pe(oe,{selected:!Se.has(oe)}),fe||we(!1)};if(U.useImperativeHandle(X,function(){return{onKeyDown:function(oe){var le=oe.which;switch(le){case O.a.UP:case O.a.DOWN:{var de=0;if(le===O.a.UP?de=-1:le===O.a.DOWN&&(de=1),de!==0){var $=Ke(Be+de,de);Xe($),$e($)}break}case O.a.ENTER:{var J=Le[Be];J&&!J.data.disabled?Qe(J.data.value):Qe(void 0),Z&&oe.preventDefault();break}case O.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(oe){Xe(oe)}}}),Le.length===0)return U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),className:"".concat(De,"-empty"),onMouseDown:Ye},ne);function Re(Ue){var oe=Le[Ue];if(!oe)return null;var le=oe.data||{},de=le.value,$=le.label,J=le.children,ee=Object(D.a)(le,!0),te=me?J:$;return oe?U.createElement("div",Object.assign({"aria-label":typeof te=="string"?te:null},ee,{key:Ue,role:"option",id:"".concat(re,"_list_").concat(Ue),"aria-selected":Se.has(de)}),de):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(Be-1),Re(Be),Re(Be+1)),U.createElement(C.a,{itemKey:"key",ref:We,data:Le,height:he,itemHeight:Q,fullHeight:!1,onMouseDown:Ye,onScroll:ke,virtual:Te,onMouseEnter:Pe},function(Ue,oe){var le,de=Ue.group,$=Ue.groupOption,J=Ue.data,ee=J.label,te=J.key;if(de)return U.createElement("div",{className:P()(De,"".concat(De,"-group"))},ee!==void 0?ee:te);var ye=J.disabled,Ae=J.value,Me=J.title,tt=J.children,ft=J.style,nt=J.className,Ct=Object(B.a)(J,["disabled","value","title","children","style","className"]),pt=Se.has(Ae),st="".concat(De,"-option"),kt=P()(De,st,nt,(le={},Object(R.a)(le,"".concat(st,"-grouped"),$),Object(R.a)(le,"".concat(st,"-active"),Be===oe&&!ye),Object(R.a)(le,"".concat(st,"-disabled"),ye),Object(R.a)(le,"".concat(st,"-selected"),pt),le)),ot=me?tt:ee,vt=!ge||typeof ge=="function"||pt;return U.createElement("div",Object.assign({},Ct,{"aria-selected":pt,className:kt,title:Me,onMouseMove:function(){if(Be===oe||ye)return;$e(oe)},onClick:function(){ye||Qe(Ae)},style:ft}),U.createElement("div",{className:"".concat(st,"-content")},ot||Ae),U.isValidElement(ge)||pt,vt&&U.createElement(T.a,{className:"".concat(De,"-option-state"),customizeIcon:ge,customizeIconProps:{isSelected:pt}},pt?"\u2713":null))}))},u=U.forwardRef(p);u.displayName="OptionList";var o=u,s=function(){return null};s.isSelectOption=!0;var l=s,S=function(){return null};S.isSelectOptGroup=!0;var c=S,m=se("VTBJ"),w=se("Zm9Q");function y(k){var H=k.key,X=k.props,q=X.children,re=X.value,Ee=Object(B.a)(X,["children","value"]);return Object(m.a)({key:H,value:re!==void 0?re:H,children:q},Ee)}function f(k){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(k).map(function(X,q){if(!U.isValidElement(X)||!X.type)return null;var re=X.type.isSelectOptGroup,Ee=X.key,me=X.props,Se=me.children,ve=Object(B.a)(me,["children"]);return H||!re?y(X):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?q:Ee,"__"),label:Ee},ve),{},{options:f(Se)})}).filter(function(X){return X})}var h=se("2Qr1"),d=se("qNPg"),a=se("U8pU"),v=se("Kwbf"),g=se("WKfj");function b(k){var H=k.mode,X=k.options,q=k.children,re=k.backfill,Ee=k.allowClear,me=k.placeholder,Se=k.getInputElement,ve=k.showSearch,fe=k.onSearch,ue=k.defaultOpen,he=k.autoFocus,Q=k.labelInValue,ne=k.value,Z=k.inputValue,ge=k.optionLabelProp,Te=H==="multiple"||H==="tags",pe=ve!==void 0?ve:Te||H==="combobox",we=X||f(q);if(Object(v.a)(H!=="tags"||we.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Oe=we.some(function(De){return De.options?De.options.some(function(Le){return typeof("value"in Le?Le.value:Le.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(v.a)(!Oe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!ge,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!re,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!Se,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!Se||!Ee||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!pe&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ue||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var ke=Object(g.d)(ne);Object(v.a)(!Q||ke.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Te||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var Pe=null;Object(w.a)(q).some(function(De){if(!U.isValidElement(De)||!De.type)return!1;var Le=De.type;if(Le.isSelectOption)return!1;if(Le.isSelectOptGroup){var We=Object(w.a)(De.props.children).every(function(Ye){return!U.isValidElement(Ye)||!De.type||Ye.type.isSelectOption?!0:(Pe=Ye.type,!1)});return!We}return Pe=Le,!0}),Pe&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Pe.displayName||Pe.name||Pe,"`.")),Object(v.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=b,F=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:M,fillOptionsWithMissingValue:h.a}),j=function(k){Object(L.a)(X,k);var H=Object(z.a)(X);function X(){var q;return Object(ie.a)(this,X),q=H.apply(this,arguments),q.selectRef=U.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(V.a)(X,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),X}(U.Component);j.Option=l,j.OptGroup=c;var W=j,_=et.c=W},M8RZ:function(ct,et,se){"use strict";se.d(et,"a",function(){return O});var ie=se("fWQN"),V=se("mtLc"),L=se("yKVA"),z=se("879j"),U=se("q1tI"),R=se.n(U),B=se("i8i4"),I=se.n(B),O=function(D){Object(L.a)(A,D);var x=Object(z.a)(A);function A(P){var C;Object(ie.a)(this,A),C=x.call(this,P);var T=window.document;return C.node=T.createElement("div"),T.body.appendChild(C.node),C}return Object(V.a)(A,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(R.a.Component)},Ot1p:function(ct,et,se){"use strict";var ie=se("2qtc"),V=se("kLXV"),L=se("rAM+"),z=se("miYZ"),U=se("tsqr"),R=se("tJVT"),B=se("jrin"),I=se("q1tI"),O=se.n(I),D=se("VrN/"),x=se.n(D),A=se("bdgK"),P=se("p77/"),C=se("Bd2K"),T=se("ELLl"),p=se("19Vz"),u=se("lZu9"),o=se("+NIl"),s=se("kSUc"),l=se("9Bee"),S=function(oe){var le=oe.value,de=le===void 0?"":le,$=oe.className,J=oe.showTextOnly,ee=oe.showLines,te=oe.style,ye=te===void 0?{}:te,Ae=Object(I.useMemo)(function(){return""},[de]);return O.a.createElement(O.a.Fragment,null,O.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ae}}))},c=se("0Owb"),m=se("dejd"),w=se("C+DQ"),y=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function f(oe){var le=oe.onActionCallback,de=oe.title,$=oe.icon,J=oe.actionName,ee=oe.className,te=ee===void 0?"":ee,ye=oe.children;function Ae(){le(J)}return O.a.createElement("a",{title:de,className:te,onClick:Ae},O.a.createElement("i",{className:"md-iconfont ".concat($)}),ye)}var h=function(oe){var le=oe.watch,de=oe.showNullButton,$=oe.onActionCallback,J=oe.fullScreen,ee=oe.insertTemp,te=oe.hidetoolBar,ye=[].concat(y,[{title:"".concat(le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return O.a.createElement("ul",{className:"markdown-toolbar-container"},!te&&ye.map(function(Ae,Me){return O.a.createElement("li",{key:Me},Ae.actionName?O.a.createElement(f,Object(c.a)({},Ae,{onActionCallback:$})):O.a.createElement("span",{className:"v-line"}))}),de?O.a.createElement("li",null,O.a.createElement(f,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$},O.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ee&&O.a.createElement("li",null,O.a.createElement(f,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ee),onActionCallback:$},O.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),O.a.createElement("li",{className:"btn-full-screen"},O.a.createElement(f,{icon:"".concat(J?"icon-shrink":"icon-enlarge"),title:J?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$})))},d=se("M8RZ"),a=se("+L6B"),v=se("2/Rp"),g=se("y8nQ"),b=se("Vl3Y"),M=se("5NDa"),F=se("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},W=function(oe){var le=oe.callback,de=oe.onCancel;function $(J){le(J)}return O.a.createElement(b.a,Object(c.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$}),O.a.createElement(b.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},O.a.createElement(F.a,null)),O.a.createElement(b.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},O.a.createElement(F.a,null)),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(v.a,{type:"ghost",onClick:de},"\u53D6\u6D88")))},_=se("7ahc"),k=se("HmJG"),H=se("BjJ7"),X=b.a.useForm,q={width:280,marginRight:10},re={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(oe){var le=oe.callback,de=oe.onCancel,$=X(),J=Object(R.a)($,1),ee=J[0];function te(Me){le(Me)}function ye(Me,tt){ee.setFieldsValue({src:"/api/attachments/".concat(Me.id),type:tt.type})}function Ae(Me){var tt=Me.target.files[0];Se(tt,ye)}return O.a.createElement(b.a,Object(c.a)({form:ee},re,{className:"upload-image-panel",onFinish:te}),O.a.createElement(b.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},O.a.createElement("div",{className:"flex-container"},O.a.createElement(b.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},O.a.createElement(F.a,{style:q})),O.a.createElement(me,{onFileChange:Ae}))),O.a.createElement(b.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},O.a.createElement(F.a,{style:{width:264}})),O.a.createElement(b.a.Item,{style:{textAlign:"right"}},O.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(v.a,{type:"ghost",onClick:de},"\u53D6\u6D88")))};function me(oe){var le=oe.onFileChange;return O.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",O.a.createElement("input",{type:"file",onChange:le}))}function Se(oe,le){if(!oe)throw new String("\u6CA1\u6709\u6587\u4EF6");var de=new FormData;de.append("editormd-image-file",oe),de.append("file_param_name","editormd-image-file"),de.append("byxhr","true");var $=new window.XMLHttpRequest;$.withCredentials=!0,$.addEventListener("load",function(J){le(JSON.parse(J.target.responseText),oe)},!1),$.addEventListener("error",function(J){console.error(J)},!1),$.open("POST","".concat(H.a,"/api/attachments.json")),$.send(de)}var ve=se("giR+"),fe=se("fyUT"),ue=se("7Kak"),he=se("9yH6"),Q=he.a.Group,ne={margin:"0 8px"},Z=function(oe){var le=oe.callback,de=oe.onCancel;function $(J){le(J)}return O.a.createElement(b.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$},O.a.createElement("div",{className:"flex-container"},O.a.createElement("span",{style:ne},"\u5355\u5143\u683C\u6570\uFF1A"),O.a.createElement("span",{style:ne},"\u884C\u6570"),O.a.createElement(b.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},O.a.createElement(fe.a,null)),O.a.createElement("span",{style:ne},"\u5217\u6570"),O.a.createElement(b.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},O.a.createElement(fe.a,null))),O.a.createElement("div",{className:"flex-container",style:{marginTop:12}},O.a.createElement("span",{style:ne},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),O.a.createElement(b.a.Item,{name:"align"},O.a.createElement(Q,null,O.a.createElement(he.a,{value:"default"},O.a.createElement("i",{className:"fa fa-align-justify"})),O.a.createElement(he.a,{value:"left"},O.a.createElement("i",{className:"fa fa-align-left"})),O.a.createElement(he.a,{value:"center"},O.a.createElement("i",{className:"fa fa-align-center"})),O.a.createElement(he.a,{value:"right"},O.a.createElement("i",{className:"fa fa-align-right"}))))),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(v.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(v.a,{type:"ghost",onClick:de},"\u53D6\u6D88")))},ge=se("m3rI"),Te="link",pe="upload-image",we="code-block",Oe="add-table",ke="------------",Pe={default:ke,left:":".concat(ke),center:":".concat(ke,":"),right:"".concat(ke,":")},De=se("9VGf"),Le,We;function Ye(){}var Xe=0,Ke=1e4,Ze="\u2581",je=`
**\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 Be(oe){return/^\d+$/.test(oe)?"".concat(oe,"px"):oe}var Ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,$e=Ce?"Cmd":"Ctrl",Qe=(Le={},Object(B.a)(Le,$e+"-B","bold"),Object(B.a)(Le,$e+"-I","italic"),Le),Re=(We={},Object(B.a)(We,Te,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(We,we,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(We,pe,"\u6DFB\u52A0\u56FE\u7247"),Object(B.a)(We,Oe,"\u6DFB\u52A0\u8868\u683C"),We),Ue=et.a=function(oe){var le=oe.defaultValue,de=le===void 0?"":le,$=oe.onChange,J=oe.width,ee=J===void 0?"100%":J,te=oe.height,ye=te===void 0?400:te,Ae=oe.miniToolbar,Me=Ae===void 0?!1:Ae,tt=oe.isFocus,ft=tt===void 0?!1:tt,nt=oe.watch,Ct=oe.insertTemp,pt=oe.mode,st=pt===void 0?"markdown":pt,kt=oe.id,ot=kt===void 0?"markdown-editor-id":kt,vt=oe.showResizeBar,yt=vt===void 0?!1:vt,He=oe.noStorage,hr=He===void 0?!1:He,mr=oe.showNullButton,or=mr===void 0?!1:mr,Dt=oe.hidetoolBar,sr=Dt===void 0?!1:Dt,Xr=oe.fullScreen,lr=Xr===void 0?!1:Xr,ur=oe.onBlur,fn=oe.onCMBeforeChange,Ot=oe.onFullScreen,rt=oe.className,Ar=rt===void 0?"":rt,hn=oe.disablePaste,pr=hn===void 0?!1:hn,bt=oe.placeholder,Lr=bt===void 0?"":bt,Pr=oe.values,Yr=Pr===void 0?"":Pr,Fe=Object(I.useState)(null),dt=Object(R.a)(Fe,2),Ge=dt[0],Nn=dt[1],mn=Object(I.useState)(de),$r=Object(R.a)(mn,2),Qr=$r[0],ut=$r[1],Ji=Object(I.useState)(nt),Bn=Object(R.a)(Ji,2),gr=Bn[0],dr=Bn[1],bi=Object(I.useState)(lr),jn=Object(R.a)(bi,2),nr=jn[0],pn=jn[1],Ei=Object(I.useState)(""),gn=Object(R.a)(Ei,2),Dr=gn[0],Or=gn[1],xi=Object(I.useState)(0),Wn=Object(R.a)(xi,2),Jr=Wn[0],Hn=Wn[1],Ti=Object(I.useState)(ye),vr=Object(R.a)(Ti,2),Si=vr[0],wi=vr[1],vn=Object(I.useState)(!1),Mr=Object(R.a)(vn,2),Fa=Mr[0],Kn=Mr[1],Zr=Object(I.useRef)(),Gn=Object(I.useRef)(),Ir=Object(I.useRef)(),qr=Object(I.useRef)();Object(I.useEffect)(function(){ut(Yr),Ge==null||Ge.setValue(Yr)},[Yr]),Object(I.useEffect)(function(){Ot==null||Ot(nr)},[nr]),Object(I.useEffect)(function(){if(Zr.current){var it=x.a.fromTextArea(Zr.current,{mode:st,lineNumbers:!Me,lineWrapping:!0,value:de,autoCloseTags:!0,autoCloseBrackets:!0});ft&&it.focus();function ht(mt,Tt){if(pr){Tt.preventDefault();return}var St=Tt.clipboardData;if(St){var At=St.types.toString(),It=St.items,Rt=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(At==="Files"||St.types.indexOf("Files")>-1){if(Tt.preventDefault(),st=="stex")return;try{var Vt,yr=It[1];((Vt=It[0])===null||Vt===void 0?void 0:Vt.kind)==="file"&&(yr=It[0]);var Lt=yr.getAsFile(),Ur=Lt.name.split(".").pop();Se(Lt,function(Xt){if(Xt.id){var Fr,Nr,bn;(Lt==null||((Fr=Lt.type)===null||Fr===void 0)?void 0:Fr.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(Xt.id,"?type=").concat(Xt.content_type,")")):(Lt==null||((Nr=Lt.type)===null||Nr===void 0)?void 0:Nr.indexOf("video"))>-1?it.replaceSelection('<video width="100%" controls src="'.concat(ge.a.API_SERVER,"/api/attachments/").concat(Xt.id,'"></video>')):(Lt==null||((bn=Lt.type)===null||bn===void 0)?void 0:bn.indexOf("pdf"))>-1?it.replaceSelection('<a href="'.concat(ge.a.API_SERVER,"/api/attachments/").concat(Xt.id,"?type=").concat(Lt.type,'&disposition=inline" target="_blank">').concat(Lt.name,"</a>")):Rt.includes(Ur)?it.replaceSelection('<a href="'.concat(ge.a.API_SERVER,"/api/attachments/").concat(Xt.id,'?type=office&disposition=inline" target="_blank">').concat(Lt.name,"</a>")):it.replaceSelection("[".concat(Lt.name,"](").concat(ge.a.API_SERVER,"/api/attachments/").concat(Xt.id,"?type=").concat(Xt.content_type,")"))}else(Xt==null?void 0:Xt.status)===401&&(document.location.href="/user/login")})}catch(Xt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ht),Nn(it),function(){it.off("paste",ht)}}},[]);var Ci=Object(I.useCallback)(function(){if(Gn.current)try{}catch(it){console.log(it,"---- to set md editor body height")}},[Si,Gn,nr]);Object(I.useEffect)(function(){function it(){var mt=new A.default(function(Tt){var St=Object(L.a)(Tt),At;try{for(St.s();!(At=St.n()).done;){var It=At.value;(It.target.offsetHeight>0||It.target.offsetWidth>0)&&(Ci(),Ge.setSize("100%","100%"),Ge.refresh())}}catch(Rt){St.e(Rt)}finally{St.f()}});return mt.observe(Zr.current.parentElement),mt}if(Ge){var ht=it();return function(){ht.unobserve(Zr.current.parentElement)}}},[Ge,Ci]),Object(I.useEffect)(function(){if(Ge){for(var it=[],ht=function(){var It=Tt[mt];St=Object(R.a)(It,2);var Rt=St[0],Vt=St[1],yr=Object(B.a)({},Rt,function(){zn(Vt)});it.push(yr),Ge.addKeyMap(yr)},mt=0,Tt=Object.entries(Qe);mt<Tt.length;mt++){var St;ht()}return function(){var At=Object(L.a)(it),It;try{for(At.s();!(It=At.n()).done;){var Rt=It.value;Ge.removeKeyMap(Rt)}}catch(Vt){At.e(Vt)}finally{At.f()}}}},[Ge]),Object(I.useEffect)(function(){lr!==nr&&pn(lr)},[lr]),Object(De.a)(function(){if(!hr&&Jr>0){var it=new Date().getTime(),ht=window.sessionStorage.getItem(ot);it>=Jr+Ke&&(!ht||ht!==Qr)&&(window.sessionStorage.setItem(ot,Qr),Kn(!0))}},Ke),Object(I.useEffect)(function(){dr(nt)},[Ge,nt]),Object(I.useEffect)(function(){Ge&&(ft&&Ge.focus())},[Ge,ft]),Object(I.useEffect)(function(){if(gr&&Ge){var it=Ge.getScrollerElement();function ht(mt){var Tt=mt.target;if(qr.current){var St=Tt.scrollTop/Tt.scrollHeight;qr.current.scrollTop=qr.current.scrollHeight*St}}return it.addEventListener("scroll",ht),function(){it.removeEventListener("scroll",ht)}}},[Ge,gr]),Object(I.useEffect)(function(){if(Ge&&fn){function it(ht,mt){fn(ht,mt)}return Ge.on("beforeChange",it),function(){Ge.off("beforeChange",it)}}},[Ge,fn]),Object(I.useEffect)(function(){if(Ge&&ur){function it(){ur(Ge.getValue())}return Ge.on("blur",it),function(){Ge.off("blur",it)}}},[Ge,ur]),Object(I.useEffect)(function(){if(Ge){function it(ht){var mt=ht.getValue();ut(mt),Hn(new Date().getTime()),ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$&&$(mt)}return Ge.on("change",it),function(){Ge.off("change",it)}}},[Ge,$]),Object(I.useEffect)(function(){Ge&&(de==null?(Ge.setValue(""),ut("")):de!==Ge.getValue()&&(Ge.setValue(de),ut(de),Ge.setCursor(Ge.lineCount(),0)))},[Ge,de]);var zn=Object(I.useCallback)(function(it){var ht=Ge.getCursor(),mt=Ge.getSelection(),Tt=mt.split(`
`);switch(it){case"bold":return Ge.replaceSelection("**"+mt+"**"),mt===""&&Ge.setCursor(ht.line,ht.ch+2),Ge.focus();case"italic":return Ge.replaceSelection("*"+mt+"*"),mt===""&&Ge.setCursor(ht.line,ht.ch+1),Ge.focus();case"code":return Ge.replaceSelection("`"+mt+"`"),mt===""&&Ge.setCursor(ht.line,ht.ch+1),Ge.focus();case"inline-latex":return Ge.replaceSelection("`$$"+mt+"$$`"),mt===""&&Ge.setCursor(ht.line,ht.ch+3),Ge.focus();case"latex":return Ge.replaceSelection("```latex\n"+mt+"\n```"),Ge.setCursor(ht.line+1,mt.length+1),Ge.focus();case"line-break":return Ge.replaceSelection(`<br/>
`),Ge.focus();case"list-ul":return mt===""?Ge.replaceSelection("- "+mt):Ge.replaceSelection(Tt.map(function(St){return St===""?"":"- ".concat(St)}).join(`
`)),Ge.focus();case"list-ol":return mt===""?Ge.replaceSelection("1. "+mt):Ge.replaceSelection(Tt.map(function(St,At){return St===""?"":"".concat(At+1,". ").concat(St)}).join(`
`)),Ge.focus();case"add-null-ch":return mt===""&&Ge.setCursor(ht.line,ht.ch+1),Ge.replaceSelection(Ze),Ge.focus();case"inster-template-1":return mt===""&&Ge.setCursor(ht.line,ht.ch),Ge.replaceSelection(je),Ge.focus();case"eraser":return Ge.setValue(""),Ge.focus();case"trigger-watch":return dr(!gr),Ge.focus();case"trigger-full-screen":return pn(!nr),Ge.focus();case Te:Or(Te);return;case we:Or(we);return;case pe:Or(pe);return;case Oe:Or(Oe);return;default:throw new Error}},[Ge,gr,nr]),en=Object(I.useCallback)(function(it){Or("");switch(Dr){case Te:var ht=it.title,mt=it.link;return Ge.replaceSelection("[".concat(ht,"](").concat(mt,")")),Ge.focus();case we:var Tt=it.language,St=it.content;return Ge.replaceSelection(["```"+Tt,St,"```"].join(`
`)),Ge.focus();case pe:var At=it.src,It=it.alt;return Ge.replaceSelection("![ ".concat(It," ]( ").concat(At,' "').concat(It,'" )')),Ge.focus();case Oe:for(var Rt=it.row,Vt=it.col,yr=it.align,Lt=`
`,Ur=0;Ur<Rt;Ur++){for(var Xt=[],Fr=[],Nr=0;Nr<Vt;Nr++)Ur===1&&Fr.push(Pe[yr]),Xt.push(" ");Ur===1&&(Lt+="| ".concat(Fr.join(" | "),` |
`)),Lt+="| ".concat(Xt.join(Vt===1?"":" | "),` |
`)}return Ge.replaceSelection(Lt+`
`),Ge.focus();default:throw new Error}},[Ge,Dr]),yn=Object(I.useMemo)(function(){switch(Dr){case Te:return O.a.createElement(W,{callback:en,onCancel:Tr});case we:return O.a.createElement(_.b,{callback:en,onCancel:Tr});case pe:return O.a.createElement(Ee,{callback:en,onCancel:Tr});case Oe:return O.a.createElement(Z,{callback:en,onCancel:Tr});default:return null}},[Dr]);function Tr(){Or("")}Object(I.useEffect)(function(){if(Ir.current){var it=Ir.current,ht=!1,mt=0;function Tt(It){ht=!0,mt=It.pageY}function St(){ht=!1}function At(It){if(ht){var Rt=It.pageY-mt;Rt<0&&(Rt=0),Rt>300&&(Rt=300);var Vt=ye+Rt+"px";wi(Vt)}}return it.addEventListener("mousedown",Tt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",St),function(){it.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",St)}}},[Ge,Ir]),Object(I.useEffect)(function(){wi(ye)},[ye]);var Vn=Be(ee),Ai=Be(Si),Li={width:Vn,height:Ai},Xn=Object(I.useMemo)(function(){if(Jr){var it=new Date(Jr),ht=it.getHours(),mt=it.getMinutes(),Tt=it.getSeconds();return ht=ht<10?"0"+ht:ht,mt=mt<10?"0"+mt:mt,Tt=Tt<10?"0"+Tt:Tt,"".concat(ht,":").concat(mt,":").concat(Tt)}return 0},[Jr]);function Na(){window.sessionStorage.removeItem(ot),Kn(!1),Hn(0)}function Zi(){Kn(!1),Hn(0),Ge.setValue(window.sessionStorage.getItem(ot))}return O.a.createElement(I.Fragment,null,O.a.createElement("div",{className:"markdown-editor-wrapper",ref:Gn},O.a.createElement("div",{className:"markdown-editor-container ".concat(Ar," ").concat(gr?"on-preview":""," ").concat(Me?"mini":""," ").concat(nr?"full-screen":""),style:Li},O.a.createElement(h,{insertTemp:Ct,watch:gr,fullScreen:nr,showNullButton:or,onActionCallback:zn,hidetoolBar:sr}),O.a.createElement("div",{className:"markdown-editor-body"},O.a.createElement("div",{className:"codemirror-container"},O.a.createElement("textarea",{ref:Zr,placeholder:Lr})),gr?O.a.createElement("div",{ref:qr,className:"preview-container"},st==="stex"&&O.a.createElement(S,{value:Qr}),st!=="stex"&&O.a.createElement(l.a,{value:Qr})):null))),yt?O.a.createElement("a",{ref:Ir,className:"editor-resize"}):null,O.a.createElement(d.a,null,Re[Dr]?O.a.createElement(V.a,{centered:!0,title:Re[Dr],visible:!0,onCancel:Tr,footer:null},yn):null))}},SJMd:function(ct,et){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var se,ie,V,L=!1,z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var I=window,O=["break,continue,do,else,for,if,return,while"],D=[O,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],x=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[x,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[x,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],T="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",p=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[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=[O,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[A,C,P,p,u,o,s,l],c=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",w="kwd",y="com",f="typ",h="lit",d="pun",a="pln",v="tag",g="dec",b="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function _(pe){for(var we=0,Oe=!1,ke=!1,Pe=0,De=pe.length;Pe<De;++Pe){var Le=pe[Pe];if(Le.ignoreCase)ke=!0;else if(/[a-z]/i.test(Le.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Oe=!0,ke=!1;break}}var We={b:8,t:9,n:10,v:11,f:12,r:13};function Ye(Be){var Ce=Be.charCodeAt(0);if(Ce!==92)return Ce;var $e=Be.charAt(1);return Ce=We[$e],Ce||("0"<=$e&&$e<="7"?parseInt(Be.substring(1),8):$e==="u"||$e==="x"?parseInt(Be.substring(2),16):Be.charCodeAt(1))}function Xe(Be){if(Be<32)return(Be<16?"\\x0":"\\x")+Be.toString(16);var Ce=String.fromCharCode(Be);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Ke(Be){var Ce=Be.substring(1,Be.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),$e=[],Qe=Ce[0]==="^",Re=["["];Qe&&Re.push("^");for(var Ue=Qe?1:0,oe=Ce.length;Ue<oe;++Ue){var le=Ce[Ue];if(/\\[bdsw]/i.test(le))Re.push(le);else{var de=Ye(le),$;Ue+2<oe&&Ce[Ue+1]==="-"?($=Ye(Ce[Ue+2]),Ue+=2):$=de,$e.push([de,$]),$<65||de>122||($<65||de>90||$e.push([Math.max(65,de)|32,Math.min($,90)|32]),$<97||de>122||$e.push([Math.max(97,de)&~32,Math.min($,122)&~32]))}}$e.sort(function(ye,Ae){return ye[0]-Ae[0]||Ae[1]-ye[1]});for(var J=[],ee=[],Ue=0;Ue<$e.length;++Ue){var te=$e[Ue];te[0]<=ee[1]+1?ee[1]=Math.max(ee[1],te[1]):J.push(ee=te)}for(var Ue=0;Ue<J.length;++Ue){var te=J[Ue];Re.push(Xe(te[0])),te[1]>te[0]&&(te[1]+1>te[0]&&Re.push("-"),Re.push(Xe(te[1])))}return Re.push("]"),Re.join("")}function Ze(Be){for(var Ce=Be.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),$e=Ce.length,Qe=[],Re=0,Ue=0;Re<$e;++Re){var oe=Ce[Re];if(oe==="(")++Ue;else if(oe.charAt(0)==="\\"){var le=+oe.substring(1);le&&(le<=Ue?Qe[le]=-1:Ce[Re]=Xe(le))}}for(var Re=1;Re<Qe.length;++Re)Qe[Re]===-1&&(Qe[Re]=++we);for(var Re=0,Ue=0;Re<$e;++Re){var oe=Ce[Re];if(oe==="(")++Ue,Qe[Ue]||(Ce[Re]="(?:");else if(oe.charAt(0)==="\\"){var le=+oe.substring(1);le&&le<=Ue&&(Ce[Re]="\\"+Qe[le])}}for(var Re=0;Re<$e;++Re)Ce[Re]==="^"&&Ce[Re+1]!=="^"&&(Ce[Re]="");if(Be.ignoreCase&&Oe)for(var Re=0;Re<$e;++Re){var oe=Ce[Re],de=oe.charAt(0);oe.length>=2&&de==="["?Ce[Re]=Ke(oe):de!=="\\"&&(Ce[Re]=oe.replace(/[a-zA-Z]/g,function(ee){var te=ee.charCodeAt(0);return"["+String.fromCharCode(te&~32,te|32)+"]"}))}return Ce.join("")}for(var je=[],Pe=0,De=pe.length;Pe<De;++Pe){var Le=pe[Pe];if(Le.global||Le.multiline)throw new Error(""+Le);je.push("(?:"+Ze(Le)+")")}return new RegExp(je.join("|"),ke?"gi":"g")}function k(pe,we){var Oe=/(?:^|\s)nocode(?:\s|$)/,ke=[],Pe=0,De=[],Le=0;function We(Ye){var Xe=Ye.nodeType;if(Xe==1){if(Oe.test(Ye.className))return;for(var Ke=Ye.firstChild;Ke;Ke=Ke.nextSibling)We(Ke);var Ze=Ye.nodeName.toLowerCase();(Ze==="br"||Ze==="li")&&(ke[Le]=`
`,De[Le<<1]=Pe++,De[Le++<<1|1]=Ye)}else if(Xe==3||Xe==4){var je=Ye.nodeValue;je.length&&(we?je=je.replace(/\r\n?/g,`
`):je=je.replace(/[ \t\r\n]+/g," "),ke[Le]=je,De[Le<<1]=Pe,Pe+=je.length,De[Le++<<1|1]=Ye)}}return We(pe),{sourceCode:ke.join("").replace(/\n$/,""),spans:De}}function H(pe,we,Oe,ke,Pe){if(!Oe)return;var De={sourceNode:pe,pre:1,langExtension:null,numberLines:null,sourceCode:Oe,spans:null,basePos:we,decorations:null};ke(De),Pe.push.apply(Pe,De.decorations)}var X=/\S/;function q(pe){for(var we=void 0,Oe=pe.firstChild;Oe;Oe=Oe.nextSibling){var ke=Oe.nodeType;we=ke===1?we?pe:Oe:ke===3&&X.test(Oe.nodeValue)?pe:we}return we===pe?void 0:we}function re(pe,we){var Oe={},ke;(function(){for(var Le=pe.concat(we),We=[],Ye={},Xe=0,Ke=Le.length;Xe<Ke;++Xe){var Ze=Le[Xe],je=Ze[3];if(je)for(var Be=je.length;--Be>=0;)Oe[je.charAt(Be)]=Ze;var Ce=Ze[1],$e=""+Ce;Ye.hasOwnProperty($e)||(We.push(Ce),Ye[$e]=null)}We.push(/[\0-\uffff]/),ke=_(We)})();var Pe=we.length,De=function(Le){for(var We=Le.sourceCode,Ye=Le.basePos,Xe=Le.sourceNode,Ke=[Ye,a],Ze=0,je=We.match(ke)||[],Be={},Ce=0,$e=je.length;Ce<$e;++Ce){var Qe=je[Ce],Re=Be[Qe],Ue=void 0,oe;if(typeof Re=="string")oe=!1;else{var le=Oe[Qe.charAt(0)];if(le)Ue=Qe.match(le[1]),Re=le[0];else{for(var de=0;de<Pe;++de)if(le=we[de],Ue=Qe.match(le[1]),Ue){Re=le[0];break}Ue||(Re=a)}oe=Re.length>=5&&Re.substring(0,5)==="lang-",oe&&!(Ue&&typeof Ue[1]=="string")&&(oe=!1,Re=b),oe||(Be[Qe]=Re)}var $=Ze;if(Ze+=Qe.length,!oe)Ke.push(Ye+$,Re);else{var J=Ue[1],ee=Qe.indexOf(J),te=ee+J.length;Ue[2]&&(te=Qe.length-Ue[2].length,ee=te-J.length);var ye=Re.substring(5);H(Xe,Ye+$,Qe.substring(0,ee),De,Ke),H(Xe,Ye+$+ee,J,he(ye,J),Ke),H(Xe,Ye+$+te,Qe.substring(te),De,Ke)}}Le.decorations=Ke};return De}function Ee(pe){var we=[],Oe=[];pe.tripleQuotedStrings?we.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):pe.multiLineStrings?we.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),pe.verbatimStrings&&Oe.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=pe.hashComments;ke&&(pe.cStyleComments?(ke>1?we.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Oe.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([y,/^#[^\r\n]*/,null,"#"])),pe.cStyleComments&&(Oe.push([y,/^\/\/[^\r\n]*/,null]),Oe.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Pe=pe.regexLiterals;if(Pe){var De=Pe>1?"":`
\r`,Le=De?".":"[\\S\\s]",We="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Le+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Le+")*(?:\\x5D|$))+/";Oe.push(["lang-regex",RegExp("^"+W+"("+We+")")])}var Ye=pe.types;Ye&&Oe.push([f,Ye]);var Xe=(""+pe.keywords).replace(/^ | $/g,"");Xe.length&&Oe.push([w,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
\xA0`]);var Ke="^.[^\\s\\w.$@'\"`/\\\\]*";return pe.regexLiterals&&(Ke+="(?!s*/)"),Oe.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[h,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(Ke),null]),re(we,Oe)}var me=Ee({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Se(pe,we,Oe){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Pe=/\r\n?|\n/,De=pe.ownerDocument,Le=De.createElement("li");pe.firstChild;)Le.appendChild(pe.firstChild);var We=[Le];function Ye(Ce){var $e=Ce.nodeType;if($e==1&&!ke.test(Ce.className))if(Ce.nodeName==="br")Xe(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var Qe=Ce.firstChild;Qe;Qe=Qe.nextSibling)Ye(Qe);else if(($e==3||$e==4)&&Oe){var Re=Ce.nodeValue,Ue=Re.match(Pe);if(Ue){var oe=Re.substring(0,Ue.index);Ce.nodeValue=oe;var le=Re.substring(Ue.index+Ue[0].length);if(le){var de=Ce.parentNode;de.insertBefore(De.createTextNode(le),Ce.nextSibling)}Xe(Ce),oe||Ce.parentNode.removeChild(Ce)}}}function Xe(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function $e(Ue,oe){var le=oe?Ue.cloneNode(!1):Ue,de=Ue.parentNode;if(de){var $=$e(de,1),J=Ue.nextSibling;$.appendChild(le);for(var ee=J;ee;ee=J)J=ee.nextSibling,$.appendChild(ee)}return le}for(var Qe=$e(Ce.nextSibling,0),Re;(Re=Qe.parentNode)&&Re.nodeType===1;)Qe=Re;We.push(Qe)}for(var Ke=0;Ke<We.length;++Ke)Ye(We[Ke]);we===(we|0)&&We[0].setAttribute("value",we);var Ze=De.createElement("ol");Ze.className="linenums";for(var je=Math.max(0,we-1|0)||0,Ke=0,Be=We.length;Ke<Be;++Ke)Le=We[Ke],Le.className="L"+(Ke+je)%10,Le.firstChild||Le.appendChild(De.createTextNode("\xA0")),Ze.appendChild(Le);pe.appendChild(Ze)}function ve(pe){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Oe=/\n/g,ke=pe.sourceCode,Pe=ke.length,De=0,Le=pe.spans,We=Le.length,Ye=0,Xe=pe.decorations,Ke=Xe.length,Ze=0;Xe[Ke]=Pe;var je,Be;for(Be=je=0;Be<Ke;)Xe[Be]!==Xe[Be+2]?(Xe[je++]=Xe[Be++],Xe[je++]=Xe[Be++]):Be+=2;for(Ke=je,Be=je=0;Be<Ke;){for(var Ce=Xe[Be],$e=Xe[Be+1],Qe=Be+2;Qe+2<=Ke&&Xe[Qe+1]===$e;)Qe+=2;Xe[je++]=Ce,Xe[je++]=$e,Be=Qe}Ke=Xe.length=je;var Re=pe.sourceNode,Ue="";Re&&(Ue=Re.style.display,Re.style.display="none");try{for(var oe=null;Ye<We;){var le=Le[Ye],de=Le[Ye+2]||Pe,$=Xe[Ze+2]||Pe,Qe=Math.min(de,$),J=Le[Ye+1],ee;if(J.nodeType!==1&&(ee=ke.substring(De,Qe))){we&&(ee=ee.replace(Oe,"\r")),J.nodeValue=ee;var te=J.ownerDocument,ye=te.createElement("span");ye.className=Xe[Ze+1];var Ae=J.parentNode;Ae.replaceChild(ye,J),ye.appendChild(J),De<de&&(Le[Ye+1]=J=te.createTextNode(ke.substring(Qe,de)),Ae.insertBefore(J,ye.nextSibling))}De=Qe,De>=de&&(Ye+=2),De>=$&&(Ze+=2)}}finally{Re&&(Re.style.display=Ue)}}var fe={};function ue(pe,we){for(var Oe=we.length;--Oe>=0;){var ke=we[Oe];fe.hasOwnProperty(ke)?I.console&&console.warn("cannot override language handler %s",ke):fe[ke]=pe}}function he(pe,we){return pe&&fe.hasOwnProperty(pe)||(pe=/^\s*</.test(we)?"default-markup":"default-code"),fe[pe]}ue(me,["default-code"]),ue(re([],[[a,/^[^<?]+/],[g,/^<!\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"]),ue(re([[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"]),ue(re([],[[F,/^[\s\S]+/]]),["uq.val"]),ue(Ee({keywords:A,hashComments:!0,cStyleComments:!0,types:c}),["c","cc","cpp","cxx","cyc","m"]),ue(Ee({keywords:"null,true,false"}),["json"]),ue(Ee({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:c}),["cs"]),ue(Ee({keywords:P,cStyleComments:!0}),["java"]),ue(Ee({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ue(Ee({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ue(Ee({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ue(Ee({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ue(Ee({keywords:p,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ue(Ee({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ue(re([],[[m,/^[\s\S]+/]]),["regex"]);function Q(pe){var we=pe.langExtension;try{var Oe=k(pe.sourceNode,pe.pre),ke=Oe.sourceCode;pe.sourceCode=ke,pe.spans=Oe.spans,pe.basePos=0,he(we,ke)(pe),ve(pe)}catch(Pe){I.console&&console.log(Pe&&Pe.stack||Pe)}}function ne(pe,we,Oe){var ke=Oe||!1,Pe=we||null,De=document.createElement("div");De.innerHTML="<pre>"+pe+"</pre>",De=De.firstChild,ke&&Se(De,ke,!0);var Le={langExtension:Pe,numberLines:ke,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Q(Le),De.innerHTML}function Z(pe,we){var Oe=we||document.body,ke=Oe.ownerDocument||document;function Pe(le){return Oe.getElementsByTagName(le)}for(var De=[Pe("pre"),Pe("code"),Pe("xmp")],Le=[],We=0;We<De.length;++We)for(var Ye=0,Xe=De[We].length;Ye<Xe;++Ye)Le.push(De[We][Ye]);De=null;var Ke=Date;Ke.now||(Ke={now:function(){return+new Date}});var Ze=0,je=/\blang(?:uage)?-([\w.]+)(?!\S)/,Be=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,$e=/pre|xmp/i,Qe=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Ue={};function oe(){for(var le=I.PR_SHOULD_USE_CONTINUATION?Ke.now()+250:Infinity;Ze<Le.length&&Ke.now()<le;Ze++){for(var de=Le[Ze],$=Ue,J=de;J=J.previousSibling;){var ee=J.nodeType,te=(ee===7||ee===8)&&J.nodeValue;if(te?!/^\??prettify\b/.test(te):ee!==3||/\S/.test(J.nodeValue))break;if(te){$={},te.replace(/\b(\w+)=([\w:.%+-]+)/g,function(yt,He,hr){$[He]=hr});break}}var ye=de.className;if(($!==Ue||Be.test(ye))&&!Ce.test(ye)){for(var Ae=!1,Me=de.parentNode;Me;Me=Me.parentNode){var tt=Me.tagName;if(Re.test(tt)&&Me.className&&Be.test(Me.className)){Ae=!0;break}}if(!Ae){de.className+=" prettyprinted";var ft=$.lang;if(!ft){ft=ye.match(je);var nt;!ft&&(nt=q(de))&&Qe.test(nt.tagName)&&(ft=nt.className.match(je)),ft&&(ft=ft[1])}var Ct;if($e.test(de.tagName))Ct=1;else{var pt=de.currentStyle,st=ke.defaultView,kt=pt?pt.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(de,null).getPropertyValue("white-space"):0;Ct=kt&&kt.substring(0,3)==="pre"}var ot=$.linenums;(ot=ot==="true"||+ot)||(ot=ye.match(/\blinenums\b(?::(\d+))?/),ot=ot?ot[1]&&ot[1].length?+ot[1]:!0:!1),ot&&Se(de,ot,Ct);var vt={langExtension:ft,sourceNode:de,numberLines:ot,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};Q(vt)}}}Ze<Le.length?I.setTimeout(oe,250):typeof pe=="function"&&pe()}oe()}var ge=I.PR={createSimpleLexer:re,registerLangHandler:ue,sourceDecorator:Ee,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:y,PR_DECLARATION:g,PR_KEYWORD:w,PR_LITERAL:h,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:b,PR_STRING:m,PR_TAG:v,PR_TYPE:f,prettyPrintOne:L?I.prettyPrintOne=ne:R=ne,prettyPrint:B=L?I.prettyPrint=Z:B=Z},Te=I.define;typeof Te=="function"&&Te.amd&&Te("google-code-prettify",[],function(){return ge})})()},"T+//":function(ct,et,se){"use strict";se.r(et);var ie=se("Q9mQ"),V=se("diRs"),L=se("2qtc"),z=se("kLXV"),U=se("miYZ"),R=se("tsqr"),B=se("9og8"),I=se("tJVT"),O=se("B9cy"),D=se("Ol7k"),x=se("lUTK"),A=se("BvKs"),P=se("WmNS"),C=se.n(P),T=se("q1tI"),p=se.n(T),u=se("m3rI"),o=se("p0QG"),s=se.n(o),l=se("ErOA"),S=se("9kvl"),c=se("RCxd"),m=se("xGfz"),w=se("xKgJ"),y=se("5NDa"),f=se("5rEg");function h(fe){var ue=fe.user,he=fe.CategoryId,Q=fe.IsShow,ne=fe.setIsShow,Z=fe.dispatch,ge=fe.init,Te=Object(T.useState)(),pe=Object(I.a)(Te,2),we=pe[0],Oe=pe[1];return p.a.createElement(z.a,{title:he?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){ne(!1)},onOk:Object(B.a)(C.a.mark(function ke(){var Pe;return C.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:if(we){Le.next=3;break}return R.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Le.abrupt("return");case 3:return Le.next=5,Object(l.a)("/api/programas.json",{method:"post",body:{name:we,parent_id:he}});case 5:Pe=Le.sent,Pe.status===0&&(R.b.info("\u521B\u5EFA\u6210\u529F"),ne(!1),Oe(""),ge());case 7:case"end":return Le.stop()}},ke)})),visible:Q},p.a.createElement(f.a,{value:we,onChange:function(Pe){return Oe(Pe.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var d=Object(S.a)(function(fe){var ue=fe.user;return{user:ue}})(h);function a(fe){var ue=fe.user,he=fe.CategoryId,Q=fe.name,ne=fe.IsShow,Z=fe.setIsShow,ge=fe.dispatch,Te=fe.init,pe=Object(T.useState)(),we=Object(I.a)(pe,2),Oe=we[0],ke=we[1];return Object(T.useEffect)(function(){ke(Q)},[Q]),p.a.createElement(z.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){Z(!1)},onOk:Object(B.a)(C.a.mark(function Pe(){var De;return C.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(Oe){We.next=3;break}return R.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),We.abrupt("return");case 3:return We.next=5,Object(l.a)("/api/programas/".concat(he,"/rename.json"),{method:"put",body:{name:Oe,id:he}});case 5:De=We.sent,De.status===0&&(R.b.info("\u4FEE\u6539\u6210\u529F"),Z(!1),ke(""),Te());case 7:case"end":return We.stop()}},Pe)})),visible:ne},p.a.createElement(f.a,{value:Oe,onChange:function(De){return ke(De.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var v=Object(S.a)(function(fe){var ue=fe.user;return{user:ue}})(a),g=se("+L6B"),b=se("2/Rp"),M=se("9Bee");function F(fe){var ue,he,Q,ne,Z=fe.user,ge=fe.ItemData,Te=fe.setIssee,pe=fe.dispatch,we=fe.init;return p.a.createElement("div",null,p.a.createElement("div",{style:{textAlign:"right"}},Object(w.v)()&&p.a.createElement(b.a,{onClick:function(){return Te(!1)}},"\u7F16\u8F91")),p.a.createElement(M.a,{value:ge.content}),(ge==null||((ue=ge.attachment)===null||ue===void 0)?void 0:ue.id)&&p.a.createElement("div",null,p.a.createElement("a",{href:ge==null||((he=ge.attachment)===null||he===void 0)?void 0:he.url,target:"_self",download:ge==null||((Q=ge.attachment)===null||Q===void 0)?void 0:Q.title},p.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),p.a.createElement("span",{style:{color:"#000000"}},ge==null||((ne=ge.attachment)===null||ne===void 0)?void 0:ne.title))))}var j=Object(S.a)(function(fe){var ue=fe.user;return{user:ue}})(F),W=se("DZo9"),_=se("8z0m"),k=se("Ot1p"),H=se("hJwl");function X(fe){var ue=fe.user,he=fe.ItemData,Q=fe.setIssee,ne=fe.CategoryId,Z=fe.dispatch,ge=fe.init,Te=Object(T.useState)([]),pe=Object(I.a)(Te,2),we=pe[0],Oe=pe[1],ke=Object(T.useState)(he.content),Pe=Object(I.a)(ke,2),De=Pe[0],Le=Pe[1];function We(){var je,Be=[];return he==null||((je=he.attachments)===null||je===void 0)||je.map(function(Ce){var $e={uid:Ce==null?void 0:Ce.id,name:Ce.title,response:{id:Ce.id}};Be.push($e)}),Be}var Ye={name:"file",multiple:!0,action:u.a.API_SERVER+"/api/attachments.json",defaultFileList:We(),onRemove:function(Be){Object(H.t)({id:Be.uid})},onChange:function(Be){console.log("info",Be);var Ce=Be.file.status;Ce!=="uploading",Ce==="removed"&&Oe(Be.fileList),Ce==="done"?(Oe(Be.fileList),R.b.success("".concat(Be.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):Ce==="error"&&R.b.error("".concat(Be.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Be){var Ce=Be.size/1024/1024<150;return Ce||R.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Ce}};function Xe(){return Ke.apply(this,arguments)}function Ke(){return Ke=Object(B.a)(C.a.mark(function je(){var Be;return C.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:return $e.next=2,Object(l.a)("/api/programas/".concat(ne,"/update_content.json"),{method:"put",body:{id:ne,content:De,attachment_id:Ze(we)}});case 2:Be=$e.sent,Be&&(R.b.info("\u63D0\u4EA4\u6210\u529F"),Q(!0));case 4:case"end":return $e.stop()}},je)})),Ke.apply(this,arguments)}function Ze(je){var Be;return je&&je.map(function(Ce){Be=Ce.response.id}),Be}return p.a.createElement("div",null,p.a.createElement(k.a,{defaultValue:De,onChange:function(Be){return Le(Be)}}),p.a.createElement(_.a,Ye,p.a.createElement(b.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),p.a.createElement("p",{style:{marginTop:"10px"}},p.a.createElement(b.a,{style:{width:"90px"},onClick:function(){return Xe()}},"\u63D0\u4EA4"),p.a.createElement(b.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return Q(!0)}},"\u53D6\u6D88")))}var q=Object(S.a)(function(fe){var ue=fe.user;return{user:ue}})(X),re=A.a.SubMenu,Ee=D.a.Content,me=D.a.Sider;function Se(fe){var ue,he=fe.user,Q=fe.dispatch,ne=fe.globalSetting,Z=Object(T.useState)(),ge=Object(I.a)(Z,2),Te=ge[0],pe=ge[1],we=Object(T.useState)(!1),Oe=Object(I.a)(we,2),ke=Oe[0],Pe=Oe[1],De=Object(T.useState)(),Le=Object(I.a)(De,2),We=Le[0],Ye=Le[1],Xe=Object(T.useState)(),Ke=Object(I.a)(Xe,2),Ze=Ke[0],je=Ke[1],Be=Object(T.useState)(!1),Ce=Object(I.a)(Be,2),$e=Ce[0],Qe=Ce[1],Re=Object(T.useState)(""),Ue=Object(I.a)(Re,2),oe=Ue[0],le=Ue[1],de=Object(T.useState)(""),$=Object(I.a)(de,2),J=$[0],ee=$[1],te=Object(T.useState)(!0),ye=Object(I.a)(te,2),Ae=ye[0],Me=ye[1];Object(T.useEffect)(function(){tt()},[]),console.log("globalSetting",ne);function tt(){return ft.apply(this,arguments)}function ft(){return ft=Object(B.a)(C.a.mark(function ot(){var vt;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Object(l.a)("/api/programas.json",{method:"get"});case 2:vt=He.sent,vt&&Ye(vt==null?void 0:vt.programas);case 4:case"end":return He.stop()}},ot)})),ft.apply(this,arguments)}var nt=function(){var ot=Object(B.a)(C.a.mark(function vt(yt,He,hr){var mr;return C.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:Dt.t0=yt,Dt.next=Dt.t0===1?3:Dt.t0===2?6:Dt.t0===3?10:Dt.t0===4?15:17;break;case 3:return je(He==null?void 0:He.id),Pe(!0),Dt.abrupt("break",17);case 6:return je(He==null?void 0:He.id),Qe(!0),le(He==null?void 0:He.name),Dt.abrupt("break",17);case 10:return Dt.next=12,Object(l.a)("/api/programas/".concat(He==null?void 0:He.id,"/top.json"),{method:"post",body:{id:He==null?void 0:He.id}});case 12:return mr=Dt.sent,mr.status===0&&tt(),Dt.abrupt("break",17);case 15:return Ct(p.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",p.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(B.a)(C.a.mark(function sr(){var Xr;return C.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:return ur.next=2,Object(l.a)("/api/programas/".concat(He==null?void 0:He.id,".json"),{method:"delete",body:{id:He==null?void 0:He.id}});case 2:Xr=ur.sent,Xr.status===0&&(R.b.info("\u5220\u9664\u6210\u529F"),tt());case 4:case"end":return ur.stop()}},sr)}))),Dt.abrupt("break",17);case 17:case"end":return Dt.stop()}},vt)}));return function(yt,He,hr){return ot.apply(this,arguments)}}(),Ct=function(vt,yt){z.a.confirm({centered:!0,title:"\u63D0\u793A",icon:p.a.createElement(c.a,null),content:vt,okText:"\u786E\u8BA4",onOk:function(){return yt()},cancelText:"\u53D6\u6D88"})},pt=function(vt,yt){return p.a.createElement("div",{className:s.a.leftMenuActions},yt===1&&p.a.createElement("p",{className:"current",onClick:function(){return nt(1,vt,yt)}},"\u65B0\u5EFA"),p.a.createElement("p",{className:"current",onClick:function(){return nt(2,vt,yt)}},"\u91CD\u547D\u540D"),p.a.createElement("p",{className:"current",onClick:function(){return nt(3,vt,yt)}},"\u7F6E\u9876"),p.a.createElement("p",{className:"current",onClick:function(){return nt(4,vt,yt)}},"\u5220\u9664"))};function st(){return kt.apply(this,arguments)}function kt(){return kt=Object(B.a)(C.a.mark(function ot(){var vt;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Object(l.a)("/api/programas/".concat(Ze,"/content.json"),{method:"get",params:{id:Ze}});case 2:vt=He.sent,vt&&ee(vt);case 4:case"end":return He.stop()}},ot)})),kt.apply(this,arguments)}return p.a.createElement("div",{style:{marginBottom:"40px"}},p.a.createElement("img",{style:{width:"100%"},src:u.a.IMG_SERVER+"/".concat(ne==null||((ue=ne.setting)===null||ue===void 0)?void 0:ue.shixun_banner_url)}),p.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},p.a.createElement(me,{width:244,className:s.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},p.a.createElement(A.a,{mode:"inline"},We==null?void 0:We.map(function(ot,vt){if((ot==null?void 0:ot.children.length)>0){var yt;return p.a.createElement(re,{title:p.a.createElement("span",{className:"font16"},p.a.createElement("span",null,ot.name),!Object(w.v)()&&p.a.createElement("span",null),Object(w.v)()&&p.a.createElement(V.a,{placement:"right",content:function(){return pt(ot,1)},trigger:"hover"},p.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))},ot==null||((yt=ot.children)===null||yt===void 0)?void 0:yt.map(function(He,hr){return p.a.createElement(A.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){je(He==null?void 0:He.id),Ze=He==null?void 0:He.id,st()}},p.a.createElement("span",{style:{flex:"1"}},He==null?void 0:He.name),Object(w.v)()&&p.a.createElement(V.a,{placement:"right",content:function(){return pt(He,2)},trigger:"hover"},p.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}))}else return p.a.createElement(A.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){je(ot==null?void 0:ot.id),Ze=ot==null?void 0:ot.id,st()}},p.a.createElement("span",{style:{flex:"1"}},ot==null?void 0:ot.name),Object(w.v)()&&p.a.createElement(V.a,{placement:"right",content:function(){return pt(ot,1)},trigger:"hover"},p.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}),p.a.createElement(A.a.Item,{onClick:function(){je(""),Ze="",Pe(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:p.a.createElement(m.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),p.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Ae&&p.a.createElement(j,{ItemData:J,setIssee:Me}),Ae===!1&&p.a.createElement(q,{ItemData:J,setIssee:Me,CategoryId:Ze}))),p.a.createElement(d,{CategoryId:Ze,IsShow:ke,setIsShow:Pe,init:tt}),p.a.createElement(v,{CategoryId:Ze,name:oe,IsShow:$e,setIsShow:Qe,init:tt}))}var ve=et.default=Object(S.a)(function(fe){var ue=fe.user,he=fe.globalSetting;return{user:ue,globalSetting:he}})(Se)},"VrN/":function(ct,et,se){(function(ie,V){ct.exports=V()})(this,function(){"use strict";var ie=navigator.userAgent,V=navigator.platform,L=/gecko\/\d/i.test(ie),z=/MSIE \d/.test(ie),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ie),R=/Edge\/(\d+)/.exec(ie),B=z||U||R,I=B&&(z?document.documentMode||6:+(R||U)[1]),O=!R&&/WebKit\//.test(ie),D=O&&/Qt\/\d+\.\d+/.test(ie),x=!R&&/Chrome\//.test(ie),A=/Opera\//.test(ie),P=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ie),T=/PhantomJS/.test(ie),p=!R&&/AppleWebKit/.test(ie)&&/Mobile\/\w+/.test(ie),u=/Android/.test(ie),o=p||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ie),s=p||/Mac/.test(V),l=/\bCrOS\b/.test(ie),S=/win/i.test(V),c=A&&ie.match(/Version\/(\d*\.\d*)/);c&&(c=Number(c[1])),c&&c>=15&&(A=!1,O=!0);var m=s&&(D||A&&(c==null||c<12.11)),w=L||B&&I>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=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 h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return h(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var E=0;E<t.length;++E)i.appendChild(t[E]);return i}function v(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var g;document.createRange?g=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:g=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function 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()};p?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function _(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function k(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var E=r||0,N=i||0;;){var K=e.indexOf(" ",E);if(K<0||K>=t)return N+(t-E);N+=K-E,N+=n-N%n,E=K+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=_(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var re=50,Ee={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},Se={origin:"*mouse"},ve={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var E=e.indexOf(" ",r);E==-1&&(E=e.length);var N=E-r;if(E==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=E-r,i+=n-i%n,r=E+1,i>=t)return r}}var ue=[""];function he(e){for(;ue.length<=e;)ue.push(Q(ue)+" ");return ue[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 ge(){}function Te(e,t){var n;return Object.create?n=Object.create(e):(ge.prototype=e,n=new ge),t&&k(t,n),n}var pe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||pe.test(e))}function Oe(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Pe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&Pe.test(e)}function Le(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function We(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,E=r<0?Math.ceil(i):Math.floor(i);if(E==t)return e(E)?t:n;e(E)?n=E:t=E+r}}function Ye(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,E=0;E<e.length;++E){var N=e[E];(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",E),i=!0)}i||r(t,n,"ltr")}var Xe=null;function Ke(e,t,n){var r;Xe=null;for(var i=0;i<e.length;++i){var E=e[i];if(E.from<t&&E.to>t)return i;E.to==t&&(E.from!=E.to&&n=="before"?r=i:Xe=i),E.from==t&&(E.from!=E.to&&n!="before"?r=i:Xe=i)}return r!=null?r:Xe}var Ze=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(Y){return Y<=247?e.charAt(Y):1424<=Y&&Y<=1524?"R":1536<=Y&&Y<=1785?t.charAt(Y-1536):1774<=Y&&Y<=2220?"r":8192<=Y&&Y<=8203?"w":Y==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,E=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function G(Y,ae,ce){this.level=Y,this.from=ae,this.to=ce}return function(Y,ae){var ce=ae=="ltr"?"L":"R";if(Y.length==0||ae=="ltr"&&!r.test(Y))return!1;for(var xe=Y.length,be=[],_e=0;_e<xe;++_e)be.push(n(Y.charCodeAt(_e)));for(var Ie=0,Ne=ce;Ie<xe;++Ie){var ze=be[Ie];ze=="m"?be[Ie]=Ne:Ne=ze}for(var Je=0,Ve=ce;Je<xe;++Je){var qe=be[Je];qe=="1"&&Ve=="r"?be[Je]="n":E.test(qe)&&(Ve=qe,qe=="r"&&(be[Je]="R"))}for(var lt=1,at=be[0];lt<xe-1;++lt){var gt=be[lt];gt=="+"&&at=="1"&&be[lt+1]=="1"?be[lt]="1":gt==","&&at==be[lt+1]&&(at=="1"||at=="n")&&(be[lt]=at),at=gt}for(var wt=0;wt<xe;++wt){var Ht=be[wt];if(Ht==",")be[wt]="N";else if(Ht=="%"){var Pt=void 0;for(Pt=wt+1;Pt<xe&&be[Pt]=="%";++Pt);for(var ar=wt&&be[wt-1]=="!"||Pt<xe&&be[Pt]=="1"?"1":"N",er=wt;er<Pt;++er)be[er]=ar;wt=Pt-1}}for(var Ft=0,tr=ce;Ft<xe;++Ft){var zt=be[Ft];tr=="L"&&zt=="1"?be[Ft]="L":E.test(zt)&&(tr=zt)}for(var Bt=0;Bt<xe;++Bt)if(i.test(be[Bt])){var Nt=void 0;for(Nt=Bt+1;Nt<xe&&i.test(be[Nt]);++Nt);for(var Mt=(Bt?be[Bt-1]:ce)=="L",rr=(Nt<xe?be[Nt]:ce)=="L",Un=Mt==rr?Mt?"L":"R":ce,Vr=Bt;Vr<Nt;++Vr)be[Vr]=Un;Bt=Nt-1}for(var $t=[],Cr,Kt=0;Kt<xe;)if(N.test(be[Kt])){var Ia=Kt;for(++Kt;Kt<xe&&N.test(be[Kt]);++Kt);$t.push(new G(0,Ia,Kt))}else{var kr=Kt,dn=$t.length,cn=ae=="rtl"?1:0;for(++Kt;Kt<xe&&be[Kt]!="L";++Kt);for(var Jt=kr;Jt<Kt;)if(K.test(be[Jt])){kr<Jt&&($t.splice(dn,0,new G(1,kr,Jt)),dn+=cn);var Fn=Jt;for(++Jt;Jt<Kt&&K.test(be[Jt]);++Jt);$t.splice(dn,0,new G(2,Fn,Jt)),dn+=cn,kr=Jt}else++Jt;kr<Kt&&$t.splice(dn,0,new G(1,kr,Kt))}return ae=="ltr"&&($t[0].level==1&&(Cr=Y.match(/^\s+/))&&($t[0].from=Cr[0].length,$t.unshift(new G(0,0,Cr[0].length))),Q($t).level==1&&(Cr=Y.match(/\s+$/))&&(Q($t).to-=Cr[0].length,$t.push(new G(0,xe-Cr[0].length,xe)))),ae=="rtl"?$t.reverse():$t}}();function je(e,t){var n=e.order;return n==null&&(n=e.order=Ze(e.text,t)),n}var Be=[],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]||Be).concat(n)}};function $e(e,t){return e._handlers&&e._handlers[t]||Be}function Qe(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var E=q(i,n);E>-1&&(r[t]=i.slice(0,E).concat(i.slice(E+1)))}}}function Re(e,t){var n=$e(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ue(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function oe(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 $e(e,t).length>0}function de(e){e.prototype.on=function(t,n){Ce(this,t,n)},e.prototype.off=function(t,n){Qe(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 te(e){$(e),J(e)}function ye(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(B&&I<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function ft(e){if(tt==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&I<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var nt;function Ct(e){if(nt!=null)return nt;var t=d(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:nt=r.right-n.right<3}var pt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var E=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=E.indexOf("\r");N!=-1?(n.push(E.slice(0,N)),t+=N+1):(n.push(E),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=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},kt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ot=null;function vt(e){if(ot!=null)return ot;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return ot=Math.abs(n.left-r.left)>1}var yt={},He={};function hr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),yt[e]=t}function mr(e,t){He[e]=t}function or(e){if(typeof e=="string"&&He.hasOwnProperty(e))e=He[e];else if(e&&typeof e.name=="string"&&He.hasOwnProperty(e.name)){var t=He[e.name];typeof t=="string"&&(t={name:t}),e=Te(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return or("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return or("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Dt(e,t){t=or(t);var n=yt[t.name];if(!n)return Dt(e,"text/plain");var r=n(e,t);if(sr.hasOwnProperty(t.name)){var i=sr[t.name];for(var E in i){if(!i.hasOwnProperty(E))continue;r.hasOwnProperty(E)&&(r["_"+E]=r[E]),r[E]=i[E]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var sr={};function Xr(e,t){var n=sr.hasOwnProperty(e)?sr[e]:sr[e]={};k(t,n)}function lr(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 ur(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 fn(e,t,n){return e.startState?e.startState(t,n):!0}var Ot=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};Ot.prototype.eol=function(){return this.pos>=this.string.length},Ot.prototype.sol=function(){return this.pos==this.lineStart},Ot.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ot.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ot.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},Ot.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ot.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ot.prototype.skipToEnd=function(){this.pos=this.string.length},Ot.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ot.prototype.backUp=function(e){this.pos-=e},Ot.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ot.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 E=this.string.slice(this.pos).match(e);return E&&E.index>0?null:(E&&t!==!1&&(this.pos+=E[0].length),E)}},Ot.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ot.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ot.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ot.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function rt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],E=i.chunkSize();if(t<E){n=i;break}t-=E}return n.lines[t]}function Ar(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(E){var N=E.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function hn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function pr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function bt(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 Lr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],E=i.height;if(t<E){e=i;continue e}t-=E,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],G=K.height;if(t<G)break;t-=G}return n+N}function Pr(e,t){return t>=e.first&&t<e.first+e.size}function Yr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function Ge(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function Nn(e){return Fe(e.line,e.ch)}function mn(e,t){return dt(e,t)<0?t:e}function $r(e,t){return dt(e,t)<0?e:t}function Qr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ut(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,rt(e,n).text.length):Ji(t,rt(e,t.line).text.length)}function Ji(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Bn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ut(e,t[r]);return n}var gr=function(e,t){this.state=e,this.lookAhead=t},dr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};dr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},dr.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}},dr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},dr.fromSaved=function(e,t,n){return t instanceof gr?new dr(e,lr(e.mode,t.state),n,t.lookAhead):new dr(e,lr(e.mode,t),n)},dr.prototype.save=function(e){var t=e!==!1?lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new gr(t,this.maxLookAhead):t};function bi(e,t,n,r){var i=[e.state.modeGen],E={};Wn(e,t.text,e.doc.mode,n,function(Y,ae){return i.push(Y,ae)},E,r);for(var N=n.state,K=function(Y){n.baseTokens=i;var ae=e.state.overlays[Y],ce=1,xe=0;n.state=!0,Wn(e,t.text,ae.mode,n,function(be,_e){for(var Ie=ce;xe<be;){var Ne=i[ce];Ne>be&&i.splice(ce,1,be,i[ce+1],Ne),ce+=2,xe=Math.min(be,Ne)}if(!_e)return;if(ae.opaque)i.splice(Ie,ce-Ie,be,"overlay "+_e),ce=Ie+2;else for(;Ie<ce;Ie+=2){var ze=i[Ie+1];i[Ie+1]=(ze?ze+" ":"")+"overlay "+_e}},E),n.state=N,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)K(G);return{styles:i,classes:E.bgClass||E.textClass?E:null}}function jn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=nr(e,bt(t)),i=t.text.length>e.options.maxHighlightLength&&lr(e.doc.mode,r.state),E=bi(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=E.styles,E.classes?t.styleClasses=E.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function nr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new dr(r,!0,t);var E=Jr(e,t,n),N=E>r.first&&rt(r,E-1).stateAfter,K=N?dr.fromSaved(r,N,E):new dr(r,fn(r.mode),E);return r.iter(E,t,function(G){pn(e,G.text,K);var Y=K.line;G.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function pn(e,t,n,r){var i=e.doc.mode,E=new Ot(t,e.options.tabSize,n);for(E.start=E.pos=r||0,t==""&&Ei(i,n.state);!E.eol();)gn(i,E,n.state),E.start=E.pos}function Ei(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=ur(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function gn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=ur(e,n).mode);var E=e.token(t,n);if(t.pos>t.start)return E}throw new Error("Mode "+e.name+" failed to advance stream.")}var Dr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Or(e,t,n,r){var i=e.doc,E=i.mode,N;t=ut(i,t);var K=rt(i,t.line),G=nr(e,t.line,n),Y=new Ot(K.text,e.options.tabSize,G),ae;for(r&&(ae=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,N=gn(E,Y,G.state),r&&ae.push(new Dr(Y,N,lr(i.mode,G.state)));return r?ae:new Dr(Y,N,G.state)}function xi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Wn(e,t,n,r,i,E,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var G=0,Y=null,ae=new Ot(t,e.options.tabSize,r),ce,xe=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),E);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(K=!1,N&&pn(e,t,r,ae.pos),ae.pos=t.length,ce=null):ce=xi(gn(n,ae,r.state,xe),E),xe){var be=xe[0].name;be&&(ce="m-"+(ce?be+" "+ce:be))}if(!K||Y!=ce){for(;G<ae.start;)G=Math.min(ae.start,G+5e3),i(G,Y);Y=ce}ae.start=ae.pos}for(;G<ae.pos;){var _e=Math.min(ae.pos,G+5e3);i(_e,Y),G=_e}}function Jr(e,t,n){for(var r,i,E=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=E.first)return E.first;var G=rt(E,K-1),Y=G.stateAfter;if(Y&&(!n||K+(Y instanceof gr?Y.lookAhead:0)<=E.modeFrontier))return K;var ae=H(G.text,null,e.options.tabSize);(i==null||r>ae)&&(i=K-1,r=ae)}return i}function Hn(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=rt(e,r).stateAfter;if(i&&(!(i instanceof gr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ti=!1,vr=!1;function Si(){Ti=!0}function wi(){vr=!0}function vn(e,t,n){this.marker=e,this.from=t,this.to=n}function Mr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Fa(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Kn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Zr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],N=E.marker,K=E.from==null||(N.inclusiveLeft?E.from<=t:E.from<t);if(K||E.from==t&&N.type=="bookmark"&&(!n||!E.marker.insertLeft)){var G=E.to==null||(N.inclusiveRight?E.to>=t:E.to>t);(r||(r=[])).push(new vn(N,E.from,G?null:E.to))}}return r}function Gn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],N=E.marker,K=E.to==null||(N.inclusiveRight?E.to>=t:E.to>t);if(K||E.from==t&&N.type=="bookmark"&&(!n||E.marker.insertLeft)){var G=E.from==null||(N.inclusiveLeft?E.from<=t:E.from<t);(r||(r=[])).push(new vn(N,G?null:E.from-t,E.to==null?null:E.to-t))}}return r}function Ir(e,t){if(t.full)return null;var n=Pr(e,t.from.line)&&rt(e,t.from.line).markedSpans,r=Pr(e,t.to.line)&&rt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,E=t.to.ch,N=dt(t.from,t.to)==0,K=Zr(n,i,N),G=Gn(r,E,N),Y=t.text.length==1,ae=Q(t.text).length+(Y?i:0);if(K)for(var ce=0;ce<K.length;++ce){var xe=K[ce];if(xe.to==null){var be=Mr(G,xe.marker);be?Y&&(xe.to=be.to==null?null:be.to+ae):xe.to=i}}if(G)for(var _e=0;_e<G.length;++_e){var Ie=G[_e];if(Ie.to!=null&&(Ie.to+=ae),Ie.from==null){var Ne=Mr(K,Ie.marker);Ne||(Ie.from=ae,Y&&(K||(K=[])).push(Ie))}else Ie.from+=ae,Y&&(K||(K=[])).push(Ie)}K&&(K=qr(K)),G&&G!=K&&(G=qr(G));var ze=[K];if(!Y){var Je=t.text.length-2,Ve;if(Je>0&&K)for(var qe=0;qe<K.length;++qe)K[qe].to==null&&(Ve||(Ve=[])).push(new vn(K[qe].marker,null,null));for(var lt=0;lt<Je;++lt)ze.push(Ve);ze.push(G)}return ze}function qr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(be){if(be.markedSpans)for(var _e=0;_e<be.markedSpans.length;++_e){var Ie=be.markedSpans[_e].marker;Ie.readOnly&&(!r||q(r,Ie)==-1)&&(r||(r=[])).push(Ie)}}),!r)return null;for(var i=[{from:t,to:n}],E=0;E<r.length;++E)for(var N=r[E],K=N.find(0),G=0;G<i.length;++G){var Y=i[G];if(dt(Y.to,K.from)<0||dt(Y.from,K.to)>0)continue;var ae=[G,1],ce=dt(Y.from,K.from),xe=dt(Y.to,K.to);(ce<0||!N.inclusiveLeft&&!ce)&&ae.push({from:Y.from,to:K.from}),(xe>0||!N.inclusiveRight&&!xe)&&ae.push({from:K.to,to:Y.to}),i.splice.apply(i,ae),G+=ae.length-3}return i}function zn(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 yn(e){return e.inclusiveLeft?-1:0}function Tr(e){return e.inclusiveRight?1:0}function Vn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),E=dt(r.from,i.from)||yn(e)-yn(t);if(E)return-E;var N=dt(r.to,i.to)||Tr(e)-Tr(t);return N||t.id-e.id}function Ai(e,t){var n=vr&&e.markedSpans,r;if(n)for(var i=void 0,E=0;E<n.length;++E)i=n[E],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Vn(r,i.marker)<0)&&(r=i.marker);return r}function Li(e){return Ai(e,!0)}function Xn(e){return Ai(e,!1)}function Na(e,t){var n=vr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var E=n[i];E.marker.collapsed&&(E.from==null||E.from<t)&&(E.to==null||E.to>t)&&(!r||Vn(r,E.marker)<0)&&(r=E.marker)}return r}function Zi(e,t,n,r,i){var E=rt(e,t),N=vr&&E.markedSpans;if(N)for(var K=0;K<N.length;++K){var G=N[K];if(!G.marker.collapsed)continue;var Y=G.marker.find(0),ae=dt(Y.from,n)||yn(G.marker)-yn(i),ce=dt(Y.to,r)||Tr(G.marker)-Tr(i);if(ae>=0&&ce<=0||ae<=0&&ce>=0)continue;if(ae<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?dt(Y.to,n)>=0:dt(Y.to,n)>0)||ae>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?dt(Y.from,r)<=0:dt(Y.from,r)<0))return!0}}function it(e){for(var t;t=Li(e);)e=t.find(-1,!0).line;return e}function ht(e){for(var t;t=Xn(e);)e=t.find(1,!0).line;return e}function mt(e){for(var t,n;t=Xn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Tt(e,t){var n=rt(e,t),r=it(n);return n==r?t:bt(r)}function St(e,t){if(t>e.lastLine())return t;var n=rt(e,t),r;if(!At(e,n))return t;for(;r=Xn(n);)n=r.find(1,!0).line;return bt(n)+1}function At(e,t){var n=vr&&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&&It(e,t,r))return!0}}function It(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return It(e,r.line,Mr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,E=0;E<t.markedSpans.length;++E)if(i=t.markedSpans[E],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&It(e,t,i))return!0}function Rt(e){e=it(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var E=n.parent;E;n=E,E=n.parent)for(var N=0;N<E.children.length;++N){var K=E.children[N];if(K==n)break;t+=K.height}return t}function Vt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Li(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Xn(r);){var E=n.find(0,!0);t-=r.text.length-E.from.ch,r=E.to.line,t+=r.text.length-E.to.ch}return t}function yr(e){var t=e.display,n=e.doc;t.maxLine=rt(n,n.first),t.maxLineLength=Vt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Vt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Lt=function(e,t,n){this.text=e,en(this,t),this.height=n?n(this):1};Lt.prototype.lineNo=function(){return bt(this)},de(Lt);function Ur(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),zn(e),en(e,n);var i=r?r(e):1;i!=e.height&&pr(e,i)}function Xt(e){e.parent=null,zn(e)}var Fr={},Nr={};function bn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Nr:Fr;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(e,t){var n=v("span",null,null,O?"padding-right: .1px":null),r={pre:v("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var E=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=Cs,Ct(e.display.measure)&&(N=je(E,e.doc.direction))&&(r.addToken=Ls(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&&bt(E);Ds(E,r,jn(e,E,K)),E.styleClasses&&(E.styleClasses.bgClass&&(r.bgClass=j(E.styleClasses.bgClass,r.bgClass||"")),E.styleClasses.textClass&&(r.textClass=j(E.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ft(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(O){var G=r.content.lastChild;(/\bcm-tab\b/.test(G.className)||G.querySelector&&G.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function ws(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,E,N){if(!t)return;var K=e.splitSpaces?As(t,e.trailingSpace):t,G=e.cm.state.specialChars,Y=!1,ae;if(!G.test(t))e.col+=t.length,ae=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ae),B&&I<9&&(Y=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var ce=0;;){G.lastIndex=ce;var xe=G.exec(t),be=xe?xe.index-ce:t.length-ce;if(be){var _e=document.createTextNode(K.slice(ce,ce+be));B&&I<9?ae.appendChild(a("span",[_e])):ae.appendChild(_e),e.map.push(e.pos,e.pos+be,_e),e.col+=be,e.pos+=be}if(!xe)break;ce+=be+1;var Ie=void 0;if(xe[0]==" "){var Ne=e.cm.options.tabSize,ze=Ne-e.col%Ne;Ie=ae.appendChild(a("span",he(ze),"cm-tab")),Ie.setAttribute("role","presentation"),Ie.setAttribute("cm-text"," "),e.col+=ze}else xe[0]=="\r"||xe[0]==`
`?(Ie=ae.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ie.setAttribute("cm-text",xe[0]),e.col+=1):(Ie=e.cm.options.specialCharPlaceholder(xe[0]),Ie.setAttribute("cm-text",xe[0]),B&&I<9?ae.appendChild(a("span",[Ie])):ae.appendChild(Ie),e.col+=1);e.map.push(e.pos,e.pos+1,Ie),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||Y||E||N){var Je=n||"";r&&(Je+=r),i&&(Je+=i);var Ve=a("span",[ae],Je,E);if(N)for(var qe in N)N.hasOwnProperty(qe)&&qe!="style"&&qe!="class"&&Ve.setAttribute(qe,N[qe]);return e.content.appendChild(Ve)}e.content.appendChild(ae)}function As(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var E=e.charAt(i);E==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(E="\xA0"),r+=E,n=E==" "}return r}function Ls(e,t){return function(n,r,i,E,N,K,G){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,ae=Y+r.length;;){for(var ce=void 0,xe=0;xe<t.length&&!(ce=t[xe],ce.to>Y&&ce.from<=Y);xe++);if(ce.to>=ae)return e(n,r,i,E,N,K,G);e(n,r.slice(0,ce.to-Y),i,E,null,K,G),E=null,r=r.slice(ce.to-Y),Y=ce.to}}}function ja(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ds(e,t,n){var r=e.markedSpans,i=e.text,E=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(E,E=n[N]),bn(n[N+1],t.cm.options));return}for(var K=i.length,G=0,Y=1,ae="",ce,xe,be=0,_e,Ie,Ne,ze,Je;;){if(be==G){_e=Ie=Ne=xe="",Je=null,ze=null,be=Infinity;for(var Ve=[],qe=void 0,lt=0;lt<r.length;++lt){var at=r[lt],gt=at.marker;if(gt.type=="bookmark"&&at.from==G&&gt.widgetNode)Ve.push(gt);else if(at.from<=G&&(at.to==null||at.to>G||gt.collapsed&&at.to==G&&at.from==G)){if(at.to!=null&&at.to!=G&&be>at.to&&(be=at.to,Ie=""),gt.className&&(_e+=" "+gt.className),gt.css&&(xe=(xe?xe+";":"")+gt.css),gt.startStyle&&at.from==G&&(Ne+=" "+gt.startStyle),gt.endStyle&&at.to==be&&(qe||(qe=[])).push(gt.endStyle,at.to),gt.title&&((Je||(Je={})).title=gt.title),gt.attributes)for(var wt in gt.attributes)(Je||(Je={}))[wt]=gt.attributes[wt];gt.collapsed&&(!ze||Vn(ze.marker,gt)<0)&&(ze=at)}else at.from>G&&be>at.from&&(be=at.from)}if(qe)for(var Ht=0;Ht<qe.length;Ht+=2)qe[Ht+1]==be&&(Ie+=" "+qe[Ht]);if(!ze||ze.from==G)for(var Pt=0;Pt<Ve.length;++Pt)ja(t,0,Ve[Pt]);if(ze&&(ze.from||0)==G){if(ja(t,(ze.to==null?K+1:ze.to)-G,ze.marker,ze.from==null),ze.to==null)return;ze.to==G&&(ze=!1)}}if(G>=K)break;for(var ar=Math.min(K,be);;){if(ae){var er=G+ae.length;if(!ze){var Ft=er>ar?ae.slice(0,ar-G):ae;t.addToken(t,Ft,ce?ce+_e:_e,Ne,G+Ft.length==be?Ie:"",xe,Je)}if(er>=ar){ae=ae.slice(ar-G),G=ar;break}G=er,Ne=""}ae=i.slice(E,E=n[Y++]),ce=bn(n[Y++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=mt(t),this.size=this.rest?bt(Q(this.rest))-n+1:1,this.node=this.text=null,this.hidden=At(e,t)}function Di(e,t,n){for(var r=[],i,E=t;E<n;E=i){var N=new Wa(e.doc,rt(e.doc,E),E);i=E+N.size,r.push(N)}return r}var En=null;function Os(e){En?En.ops.push(e):e.ownsGroup=En={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 _s(e,t){var n=e.ownsGroup;if(!n)return;try{Rs(n)}finally{En=null,t(n)}}var Yn=null;function Gt(e,t){var n=$e(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;En?i=En.delayedCallbacks:Yn?i=Yn:(i=Yn=[],setTimeout(ks,0));for(var E=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)E(N)}function ks(){var e=Yn;Yn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(e,t,n,r){for(var i=0;i<t.changes.length;i++){var E=t.changes[i];E=="text"?Ms(e,t):E=="gutter"?Ga(e,t,n,r):E=="class"?qi(e,t):E=="widget"&&Is(e,t,r)}t.changes=null}function $n(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&&I<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=$n(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ka(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function Ms(e,t){var n=t.text.className,r=Ka(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){Ps(e,t),t.line.wrapClass?$n(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ga(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=$n(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var E=t.line.gutterMarkers;if(e.options.lineNumbers||E){var N=$n(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!E||!E["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",Yr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),E)for(var G=0;G<e.display.gutterSpecs.length;++G){var Y=e.display.gutterSpecs[G].className,ae=E.hasOwnProperty(Y)&&E[Y];ae&&K.appendChild(a("div",[ae],"CodeMirror-gutter-elt","left: "+r.gutterLeft[Y]+"px; width: "+r.gutterWidth[Y]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=y("CodeMirror-linewidget"),i=t.node.firstChild,E=void 0;i;i=E)E=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Us(e,t,n,r){var i=Ka(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),Ga(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var E=$n(n),N=0,K=t.widgets;N<K.length;++N){var G=K[N],Y=a("div",[G.node],"CodeMirror-linewidget"+(G.className?" "+G.className:""));G.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Fs(G,Y,n,r),e.display.input.setUneditable(Y),i&&G.above?E.insertBefore(Y,n.gutter||n.text):E.appendChild(Y),Gt(G,"redraw")}}function Fs(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 Qn(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 Rr(e,t){for(var n=ye(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Oi(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(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 Sr(e){return re-e.display.nativeBarWidth}function tn(e){return e.display.scroller.clientWidth-Sr(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-Sr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&tn(e);if(!t.measure.heights||r&&t.measure.width!=i){var E=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var G=N[K],Y=N[K+1];Math.abs(G.bottom-Y.bottom)>2&&E.push((G.bottom+Y.top)/2-n.top)}}E.push(n.bottom-n.top)}}function Ya(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(bt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=it(t);var n=bt(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function $a(e,t,n,r){return wr(e,xn(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[an(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function xn(e,t){var n=bt(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ha(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function wr(e,t,n,r,i){t.before&&(n=-1);var E=n+(r||""),N;return t.cache.hasOwnProperty(E)?N=t.cache[E]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[E]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var Qa={left:0,right:0,top:0,bottom:0};function Ja(e,t,n){for(var r,i,E,N,K,G,Y=0;Y<e.length;Y+=3)if(K=e[Y],G=e[Y+1],t<K?(i=0,E=1,N="left"):t<G?(i=t-K,E=i+1):(Y==e.length-3||t==G&&e[Y+3]>t)&&(E=G-K,i=E-1,t>=G&&(N="right")),i!=null){if(r=e[Y+2],K==G&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],N="left";if(n=="right"&&i==G-K)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],N="right";break}return{node:r,start:i,end:E,collapse:N,coverStart:K,coverEnd:G}}function js(e,t){var n=Qa;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=Ja(t.map,n,r),E=i.node,N=i.start,K=i.end,G=i.collapse,Y;if(E.nodeType==3){for(var ae=0;ae<4;ae++){for(;N&&De(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&De(t.line.text.charAt(i.coverStart+K));)++K;if(B&&I<9&&N==0&&K==i.coverEnd-i.coverStart?Y=E.parentNode.getBoundingClientRect():Y=js(g(E,N,K).getClientRects(),r),Y.left||Y.right||N==0)break;K=N,N=N-1,G="right"}B&&I<11&&(Y=Hs(e.display.measure,Y))}else{N>0&&(G=r="right");var ce;e.options.lineWrapping&&(ce=E.getClientRects()).length>1?Y=ce[r=="right"?ce.length-1:0]:Y=E.getBoundingClientRect()}if(B&&I<9&&!N&&(!Y||!Y.left&&!Y.right)){var xe=E.parentNode.getClientRects()[0];xe?Y={left:xe.left,right:xe.left+Sn(e.display),top:xe.top,bottom:xe.bottom}:Y=Qa}for(var be=Y.top-t.rect.top,_e=Y.bottom-t.rect.top,Ie=(be+_e)/2,Ne=t.view.measure.heights,ze=0;ze<Ne.length-1&&!(Ie<Ne[ze]);ze++);var Je=ze?Ne[ze-1]:0,Ve=Ne[ze],qe={left:(G=="right"?Y.right:Y.left)-t.rect.left,right:(G=="left"?Y.left:Y.right)-t.rect.left,top:Je,bottom:Ve};return!Y.left&&!Y.right&&(qe.bogus=!0),e.options.singleCursorHeightPerLine||(qe.rtop=be,qe.rbottom=_e),qe}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!vt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Za(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function qa(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Za(e.display.view[t])}function Jn(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return x&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return x&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Qn(e.widgets[n]));return t}function Ri(e,t,n,r,i){if(!i){var E=na(t);n.top+=E,n.bottom+=E}if(r=="line")return n;r||(r="local");var N=Rt(t);if(r=="local"?N+=Oi(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:to());var G=K.left+(r=="window"?0:eo());n.left+=G,n.right+=G}return n.top+=N,n.bottom+=N,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();else if(n=="local"||!n){var E=e.display.sizer.getBoundingClientRect();r+=E.left,i+=E.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ia(e,t,n,r,i){return r||(r=rt(e.doc,t.line)),Ri(e,r,$a(e,r,t.ch,i),n)}function br(e,t,n,r,i,E){r=r||rt(e.doc,t.line),i||(i=xn(e,r));function N(_e,Ie){var Ne=wr(e,i,_e,Ie?"right":"left",E);return Ie?Ne.left=Ne.right:Ne.right=Ne.left,Ri(e,r,Ne,n)}var K=je(r,e.doc.direction),G=t.ch,Y=t.sticky;if(G>=r.text.length?(G=r.text.length,Y="before"):G<=0&&(G=0,Y="after"),!K)return N(Y=="before"?G-1:G,Y=="before");function ae(_e,Ie,Ne){var ze=K[Ie],Je=ze.level==1;return N(Ne?_e-1:_e,Je!=Ne)}var ce=Ke(K,G,Y),xe=Xe,be=ae(G,ce,Y=="before");return xe!=null&&(be.other=ae(G,xe,Y!="before")),be}function no(e,t){var n=0;t=ut(e.doc,t),e.options.lineWrapping||(n=Sn(e.display)*t.ch);var r=rt(e.doc,t.line),i=Rt(r)+Oi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var E=Fe(e,t,n);return E.xRel=i,r&&(E.outside=r),E}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=Lr(r,n),E=r.first+r.size-1;if(i>E)return aa(r.first+r.size-1,rt(r,E).text.length,null,1,1);t<0&&(t=0);for(var N=rt(r,i);;){var K=Ks(e,N,i,t,n),G=Na(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!G)return K;var Y=G.find(1);if(Y.line==i)return Y;N=rt(r,i=Y.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,E=We(function(N){return wr(e,n,N-1).bottom<=r},i,0);return i=We(function(N){return wr(e,n,N).top>r},E,i),{begin:E,end:i}}function ao(e,t,n,r){n||(n=xn(e,t));var i=Ri(e,t,wr(e,n,r),"line").top;return io(e,t,n,i)}function sa(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=Rt(t);var E=xn(e,t),N=na(t),K=0,G=t.text.length,Y=!0,ae=je(t,e.doc.direction);if(ae){var ce=(e.options.lineWrapping?zs:Gs)(e,t,n,E,ae,r,i);Y=ce.level!=1,K=Y?ce.from:ce.to-1,G=Y?ce.to:ce.from-1}var xe=null,be=null,_e=We(function(lt){var at=wr(e,E,lt);return at.top+=N,at.bottom+=N,sa(at,r,i,!1)?(at.top<=i&&at.left<=r&&(xe=lt,be=at),!0):!1},K,G),Ie,Ne,ze=!1;if(be){var Je=r-be.left<be.right-r,Ve=Je==Y;_e=xe+(Ve?0:1),Ne=Ve?"after":"before",Ie=Je?be.left:be.right}else{!Y&&(_e==G||_e==K)&&_e++,Ne=_e==0?"after":_e==t.text.length?"before":wr(e,E,_e-(Y?1:0)).bottom+N<=i==Y?"after":"before";var qe=br(e,Fe(n,_e,Ne),"line",t,E);Ie=qe.left,ze=i<qe.top?-1:i>=qe.bottom?1:0}return _e=Le(t.text,_e,1),aa(n,_e,Ne,ze,r-Ie)}function Gs(e,t,n,r,i,E,N){var K=We(function(ce){var xe=i[ce],be=xe.level!=1;return sa(br(e,Fe(n,be?xe.to:xe.from,be?"before":"after"),"line",t,r),E,N,!0)},0,i.length-1),G=i[K];if(K>0){var Y=G.level!=1,ae=br(e,Fe(n,Y?G.from:G.to,Y?"after":"before"),"line",t,r);sa(ae,E,N,!0)&&ae.top>N&&(G=i[K-1])}return G}function zs(e,t,n,r,i,E,N){var K=io(e,t,r,N),G=K.begin,Y=K.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var ae=null,ce=null,xe=0;xe<i.length;xe++){var be=i[xe];if(be.from>=Y||be.to<=G)continue;var _e=be.level!=1,Ie=wr(e,r,_e?Math.min(Y,be.to)-1:Math.max(G,be.from)).right,Ne=Ie<E?E-Ie+1e9:Ie-E;(!ae||ce>Ne)&&(ae=be,ce=Ne)}return ae||(ae=i[i.length-1]),ae.from<G&&(ae={from:G,to:ae.to,level:ae.level}),ae.to>Y&&(ae={from:ae.from,to:Y,level:ae.level}),ae}var rn;function Tn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rn==null){rn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rn.appendChild(document.createTextNode("x")),rn.appendChild(a("br"));rn.appendChild(document.createTextNode("x"))}d(e.measure,rn);var n=rn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function Sn(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 la(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,E=t.gutters.firstChild,N=0;E;E=E.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=E.offsetLeft+E.clientLeft+i,r[K]=E.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=Tn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Sn(e.display)-3);return function(i){if(At(e.doc,i))return 0;var E=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(E+=i.widgets[N].height);return n?E+(Math.ceil(i.text.length/r)||1)*t:E+t}}function da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&pr(r,i)})}function nn(e,t,n,r){var i=e.display;if(!n&&ye(t).getAttribute("cm-not-content")=="true")return null;var E,N,K=i.lineSpace.getBoundingClientRect();try{E=t.clientX-K.left,N=t.clientY-K.top}catch(ce){return null}var G=oa(e,E,N),Y;if(r&&G.xRel>0&&(Y=rt(e.doc,G.line).text).length==G.ch){var ae=H(Y,Y.length,e.options.tabSize)-Y.length;G=Fe(G.line,Math.max(0,Math.round((E-Xa(e.display).left)/Sn(e.display))-ae))}return G}function an(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 Zt(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)vr&&Tt(e.doc,t)<i.viewTo&&jr(e);else if(n<=i.viewFrom)vr&&St(e.doc,n+r)>i.viewFrom?jr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)jr(e);else if(t<=i.viewFrom){var E=_i(e,n,n+r,1);E?(i.view=i.view.slice(E.index),i.viewFrom=E.lineN,i.viewTo+=r):jr(e)}else if(n>=i.viewTo){var N=_i(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):jr(e)}else{var K=_i(e,t,t,-1),G=_i(e,n,n+r,1);K&&G?(i.view=i.view.slice(0,K.index).concat(Di(e,K.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):jr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Br(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var E=r.view[an(e,t)];if(E.node==null)return;var N=E.changes||(E.changes=[]);q(N,n)==-1&&N.push(n)}function jr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function _i(e,t,n,r){var i=an(e,t),E,N=e.display.view;if(!vr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,G=0;G<i;G++)K+=N[G].size;if(K!=t){if(r>0){if(i==N.length-1)return null;E=K+N[i].size-t,i++}else E=K-t;t+=E,n+=E}for(;Tt(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Di(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Di(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(an(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Di(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,an(e,n)))),r.viewTo=n}function so(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Zn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),E=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var G=K.empty();(G||e.options.showCursorWhenSelecting)&&uo(e,K.head,i),G||Xs(e,K,E)}return r}function uo(e,t,n){var r=br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var E=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));E.style.display="",E.style.left=r.other.left+"px",E.style.top=r.other.top+"px",E.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,E=document.createDocumentFragment(),N=Xa(e.display),K=N.left,G=Math.max(r.sizerWidth,tn(e)-r.sizer.offsetLeft)-N.right,Y=i.direction=="ltr";function ae(Ve,qe,lt,at){qe<0&&(qe=0),qe=Math.round(qe),at=Math.round(at),E.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ve+`px;
top: `+qe+"px; width: "+(lt==null?G-Ve:lt)+`px;
height: `+(at-qe)+"px"))}function ce(Ve,qe,lt){var at=rt(i,Ve),gt=at.text.length,wt,Ht;function Pt(Ft,tr){return ia(e,Fe(Ve,Ft),"div",at,tr)}function ar(Ft,tr,zt){var Bt=ao(e,at,null,Ft),Nt=tr=="ltr"==(zt=="after")?"left":"right",Mt=zt=="after"?Bt.begin:Bt.end-(/\s/.test(at.text.charAt(Bt.end-1))?2:1);return Pt(Mt,Nt)[Nt]}var er=je(at,i.direction);return Ye(er,qe||0,lt==null?gt:lt,function(Ft,tr,zt,Bt){var Nt=zt=="ltr",Mt=Pt(Ft,Nt?"left":"right"),rr=Pt(tr-1,Nt?"right":"left"),Un=qe==null&&Ft==0,Vr=lt==null&&tr==gt,$t=Bt==0,Cr=!er||Bt==er.length-1;if(rr.top-Mt.top<=3){var Kt=(Y?Un:Vr)&&$t,Ia=(Y?Vr:Un)&&Cr,kr=Kt?K:(Nt?Mt:rr).left,dn=Ia?G:(Nt?rr:Mt).right;ae(kr,Mt.top,dn-kr,Mt.bottom)}else{var cn,Jt,Fn,Ua;Nt?(cn=Y&&Un&&$t?K:Mt.left,Jt=Y?G:ar(Ft,zt,"before"),Fn=Y?K:ar(tr,zt,"after"),Ua=Y&&Vr&&Cr?G:rr.right):(cn=Y?ar(Ft,zt,"before"):K,Jt=!Y&&Un&&$t?G:Mt.right,Fn=!Y&&Vr&&Cr?K:rr.left,Ua=Y?ar(tr,zt,"after"):G),ae(cn,Mt.top,Jt-cn,Mt.bottom),Mt.bottom<rr.top&&ae(K,Mt.bottom,null,rr.top),ae(Fn,rr.top,Ua-Fn,rr.bottom)}(!wt||ki(Mt,wt)<0)&&(wt=Mt),ki(rr,wt)<0&&(wt=rr),(!Ht||ki(Mt,Ht)<0)&&(Ht=Mt),ki(rr,Ht)<0&&(Ht=rr)}),{start:wt,end:Ht}}var xe=t.from(),be=t.to();if(xe.line==be.line)ce(xe.line,xe.ch,be.ch);else{var _e=rt(i,xe.line),Ie=rt(i,be.line),Ne=it(_e)==it(Ie),ze=ce(xe.line,xe.ch,Ne?_e.text.length+1:null).end,Je=ce(be.line,Ne?0:null,be.ch).start;Ne&&(ze.top<Je.top-2?(ae(ze.right,ze.top,null,ze.bottom),ae(K,Je.top,Je.left,Je.bottom)):ae(ze.right,ze.top,Je.left-ze.right,ze.bottom)),ze.bottom<Je.top&&ae(K,ze.bottom,null,Je.top)}n.appendChild(E)}function ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||wn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,wn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(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(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ca(e)}function wn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Pi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],E=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&I<8){var G=i.node.offsetTop+i.node.offsetHeight;N=G-n,n=G}else{var Y=i.node.getBoundingClientRect();N=Y.bottom-Y.top,!E&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var ae=i.line.height-N;if((ae>.005||ae<-.005)&&(pr(i.line,N),ho(i.line),i.rest))for(var ce=0;ce<i.rest.length;ce++)ho(i.rest[ce]);if(K>e.display.sizerWidth){var xe=Math.ceil(K/Sn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Mi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Oi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,E=Lr(t,r),N=Lr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,G=n.ensure.to.line;K<E?(E=K,N=Lr(t,Rt(rt(t,K))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=N&&(E=Lr(t,Rt(rt(t,G))-e.wrapper.clientHeight),N=G)}return{from:E,to:Math.max(N,E+1)}}function Ys(e,t){if(Ue(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&&!T){var E=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Oi(e.display))+`px;
height: `+(t.bottom-t.top+Sr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(E),E.scrollIntoView(i),e.display.lineSpace.removeChild(E)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var E=0;E<5;E++){var N=!1,K=br(e,t),G=!n||n==t?K:br(e,n);i={left:Math.min(K.left,G.left),top:Math.min(K.top,G.top)-r,right:Math.max(K.left,G.left),bottom:Math.max(K.bottom,G.bottom)+r};var Y=ha(e,i),ae=e.doc.scrollTop,ce=e.doc.scrollLeft;if(Y.scrollTop!=null&&(ei(e,Y.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(N=!0)),Y.scrollLeft!=null&&(on(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-ce)>1&&(N=!0)),!N)break}return i}function Qs(e,t){var n=ha(e,t);n.scrollTop!=null&&ei(e,n.scrollTop),n.scrollLeft!=null&&on(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=Tn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,E=ta(e),N={};t.bottom-t.top>E&&(t.bottom=t.top+E);var K=e.doc.height+ea(n),G=t.top<r,Y=t.bottom>K-r;if(t.top<i)N.scrollTop=G?0:t.top;else if(t.bottom>i+E){var ae=Math.min(t.top,(Y?K:t.bottom)-E);ae!=i&&(N.scrollTop=ae)}var ce=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ce,be=tn(e)-n.gutters.offsetWidth,_e=t.right-t.left>be;return _e&&(t.right=t.left+be),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+ce-(_e?0:10)):t.right>be+xe-3&&(N.scrollLeft=t.right+(_e?0:10)-be),N}function ma(e,t){if(t==null)return;Ii(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Cn(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function qn(e,t,n){(t!=null||n!=null)&&Ii(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ii(e),e.curOp.scrollToPos=t}function Ii(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});qn(e,i.scrollLeft,i.scrollTop)}function ei(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||ga(e,{top:t}),po(e,t,!0),L&&ga(e),ni(e,100)}function po(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function on(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ti(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Sr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var sn=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&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};sn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var E=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+E)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},sn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},sn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},sn.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},sn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),E=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);E!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},sn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ri=function(){};ri.prototype.update=function(){return{bottom:0,right:0}},ri.prototype.setScrollLeft=function(){},ri.prototype.setScrollTop=function(){},ri.prototype.clear=function(){};function An(e,t){t||(t=ti(e));var n=e.display.barWidth,r=e.display.barHeight;go(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Pi(e),go(e,ti(e)),n=e.display.barWidth,r=e.display.barHeight}function go(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var vo={native:sn,null:ri};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),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"?on(e,t):ei(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function ln(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},Os(e.curOp)}function un(e){var t=e.curOp;t&&_s(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var E=0;E<t.length;E++)nl(t[E]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&yr(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 Ui(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Pi(t),e.barMeasure=ti(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$a(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Sr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-tn(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&&on(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)&&An(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&on(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ut(r,e.scrollToPos.from),ut(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var E=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(E)for(var K=0;K<E.length;++K)E[K].lines.length||Re(E[K],"hide");if(N)for(var G=0;G<N.length;++G)N[G].lines.length&&Re(N[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ir(e,t){if(e.curOp)return t();ln(e);try{return t()}finally{un(e)}}function jt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ln(e);try{return t.apply(e,arguments)}finally{un(e)}}}function Qt(e){return function(){if(this.curOp)return e.apply(this,arguments);ln(this);try{return e.apply(this,arguments)}finally{un(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ln(t);try{return e.apply(this,arguments)}finally{un(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,_(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(E){if(r.line>=e.display.viewFrom){var N=E.styles,K=E.text.length>e.options.maxHighlightLength?lr(t.mode,r.state):null,G=bi(e,E,r,!0);K&&(r.state=K),E.styles=G.styles;var Y=E.styleClasses,ae=G.classes;ae?E.styleClasses=ae:Y&&(E.styleClasses=null);for(var ce=!N||N.length!=E.styles.length||Y!=ae&&(!Y||!ae||Y.bgClass!=ae.bgClass||Y.textClass!=ae.textClass),xe=0;!ce&&xe<N.length;++xe)ce=N[xe]!=E.styles[xe];ce&&i.push(r.line),E.stateAfter=r.save(),r.nextLine()}else E.text.length<=e.options.maxHighlightLength&&pn(e,E.text,r),E.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ni(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ir(e,function(){for(var E=0;E<i.length;E++)Br(e,i[E],"text")})}var Ui=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Mi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=tn(e),this.force=n,this.dims=la(e),this.events=[]};Ui.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.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=Sr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Sr(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 pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return jr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&so(e)==0)return!1;xo(e)&&(jr(e),t.dims=la(e));var i=r.first+r.size,E=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<E&&E-n.viewFrom<20&&(E=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),vr&&(E=Tt(e.doc,E),N=St(e.doc,N));var K=E!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,E,N),n.viewOffset=Rt(rt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=so(e);if(!K&&G==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=sl(e);return G>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),G>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(Y),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ni(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==tn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(e),n.top)}),t.visible=Mi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Mi(e.display,e.doc,n));if(!pa(e,t))break;Pi(e);var i=ti(e);Zn(e),An(e,i),ya(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ga(e,t){var n=new Ui(e,t);if(pa(e,n)){Pi(e),bo(e,n);var r=ti(e);Zn(e),An(e,r),ya(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,E=r.lineDiv,N=E.firstChild;function K(_e){var Ie=_e.nextSibling;return O&&s&&e.display.currentWheelTarget==_e?_e.style.display="none":_e.parentNode.removeChild(_e),Ie}for(var G=r.view,Y=r.viewFrom,ae=0;ae<G.length;ae++){var ce=G[ae];if(!ce.hidden)if(!ce.node||ce.node.parentNode!=E){var xe=Us(e,ce,Y,n);E.insertBefore(xe,N)}else{for(;N!=ce.node;)N=K(N);var be=i&&t!=null&&t<=Y&&ce.lineNumber;ce.changes&&(q(ce.changes,"gutter")>-1&&(be=!1),Ha(e,ce,Y,n)),be&&(h(ce.lineNumber),ce.lineNumber.appendChild(document.createTextNode(Yr(e.options,Y)))),N=ce.node.nextSibling}Y+=ce.size}for(;N;)N=K(N)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sr(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,E=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=E),n[N].gutterBackground&&(n[N].gutterBackground.style.left=E));var K=n[N].alignable;if(K)for(var G=0;G<K.length;G++)K[G].style.left=E}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Yr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),E=i.firstChild.offsetWidth,N=i.offsetWidth-E;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(E,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",va(e.display),!0}return!1}function ba(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var E=e[i],N=null;if(typeof E!="string"&&(N=E.style,E=E.className),E=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:E,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function To(e){var t=e.gutters,n=e.gutterSpecs;h(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],E=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+E));N&&(K.style.cssText=N),E=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",va(e)}function ii(e){To(e.display),Zt(e),Eo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=v("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=v("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var E=v("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[E],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+re+"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&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!O&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Fi=0,cr=null;B?cr=-.53:L?cr=15:x?cr=-.7:P&&(cr=-1/3);function So(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=So(e);return t.x*=cr,t.y*=cr,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,E=e.display,N=E.scroller,K=N.scrollWidth>N.clientWidth,G=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&G))return;if(i&&s&&O){e:for(var Y=t.target,ae=E.view;Y!=N;Y=Y.parentNode)for(var ce=0;ce<ae.length;ce++)if(ae[ce].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!L&&!A&&cr!=null){i&&G&&ei(e,Math.max(0,N.scrollTop+i*cr)),on(e,Math.max(0,N.scrollLeft+r*cr)),(!i||i&&G)&&$(t),E.wheelStartX=null;return}if(i&&cr!=null){var xe=i*cr,be=e.doc.scrollTop,_e=be+E.wrapper.clientHeight;xe<0?be=Math.max(0,be+xe-50):_e=Math.min(e.doc.height,_e+xe+50),ga(e,{top:be,bottom:_e})}Fi<20&&(E.wheelStartX==null?(E.wheelStartX=N.scrollLeft,E.wheelStartY=N.scrollTop,E.wheelDX=r,E.wheelDY=i,setTimeout(function(){if(E.wheelStartX==null)return;var Ie=N.scrollLeft-E.wheelStartX,Ne=N.scrollTop-E.wheelStartY,ze=Ne&&E.wheelDY&&Ne/E.wheelDY||Ie&&E.wheelDX&&Ie/E.wheelDX;if(E.wheelStartX=E.wheelStartY=null,!ze)return;cr=(cr*Fi+ze)/(Fi+1),++Fi},200)):(E.wheelDX+=r,E.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(!Ge(n.anchor,r.anchor)||!Ge(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 Et(Nn(this.ranges[t].anchor),Nn(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 Et=function(e,t){this.anchor=e,this.head=t};Et.prototype.from=function(){return $r(this.anchor,this.head)},Et.prototype.to=function(){return mn(this.anchor,this.head)},Et.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,be){return dt(xe.from(),be.from())}),n=q(t,i);for(var E=1;E<t.length;E++){var N=t[E],K=t[E-1],G=dt(K.to(),N.from());if(r&&!N.empty()?G>0:G>=0){var Y=$r(K.from(),N.from()),ae=mn(K.to(),N.to()),ce=K.empty()?N.from()==N.head:K.from()==K.head;E<=n&&--n,t.splice(--E,2,new Et(ce?ae:Y,ce?Y:ae))}}return new fr(t,n)}function Wr(e,t){return new fr([new Et(e,t||e)],0)}function Hr(e){return e.text?Fe(e.from.line+e.text.length-1,Q(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Hr(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+=Hr(t).ch-t.to.ch),Fe(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Et(Co(i.anchor,t),Co(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Ao(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),E=i,N=0;N<t.length;N++){var K=t[N],G=Ao(K.from,i,E),Y=Ao(Hr(K),i,E);if(i=K.to,E=Y,n=="around"){var ae=e.sel.ranges[N],ce=dt(ae.head,ae.anchor)<0;r[N]=new Et(ce?Y:G,ce?G:Y)}else r[N]=new Et(G,G)}return new fr(r,e.sel.primIndex)}function xa(e){e.doc.mode=Dt(e.options,e.doc.modeOption),ai(e)}function ai(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,ni(e,100),e.state.modeGen++,e.curOp&&Zt(e)}function Lo(e,t){return t.from.ch==0&&t.to.ch==0&&Q(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i(Je){return n?n[Je]:null}function E(Je,Ve,qe){Ur(Je,Ve,qe,r),Gt(Je,"change",Je,t)}function N(Je,Ve){for(var qe=[],lt=Je;lt<Ve;++lt)qe.push(new Lt(Y[lt],i(lt),r));return qe}var K=t.from,G=t.to,Y=t.text,ae=rt(e,K.line),ce=rt(e,G.line),xe=Q(Y),be=i(Y.length-1),_e=G.line-K.line;if(t.full)e.insert(0,N(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Lo(e,t)){var Ie=N(0,Y.length-1);E(ce,ce.text,be),_e&&e.remove(K.line,_e),Ie.length&&e.insert(K.line,Ie)}else if(ae==ce)if(Y.length==1)E(ae,ae.text.slice(0,K.ch)+xe+ae.text.slice(G.ch),be);else{var Ne=N(1,Y.length-1);Ne.push(new Lt(xe+ae.text.slice(G.ch),be,r)),E(ae,ae.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,Ne)}else if(Y.length==1)E(ae,ae.text.slice(0,K.ch)+Y[0]+ce.text.slice(G.ch),i(0)),e.remove(K.line+1,_e);else{E(ae,ae.text.slice(0,K.ch)+Y[0],i(0)),E(ce,xe+ce.text.slice(G.ch),be);var ze=N(1,Y.length-1);_e>1&&e.remove(K.line+1,_e-1),e.insert(K.line+1,ze)}Gt(e,"change",e,t)}function Kr(e,t,n){function r(i,E,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var G=i.linked[K];if(G.doc==E)continue;var Y=N&&G.sharedHist;if(n&&!Y)continue;t(G.doc,Y),r(G.doc,i,Y)}}r(e,null,!0)}function Do(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),Oo(e),e.options.lineWrapping||yr(e),e.options.mode=t.modeOption,Zt(e)}function Oo(e){(e.doc.direction=="rtl"?F:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ir(e,function(){Oo(e),Zt(e)})}function Ni(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Sa(e,t){var n={from:Nn(t.from),to:Hr(t),text:Ar(e,t.from,t.to)};return ko(e,n,t.from.line,t.to.line+1),Kr(e,function(r){return ko(r,n,t.from.line,t.to.line+1)},!0),n}function Ro(e){for(;e.length;){var t=Q(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Ro(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 _o(e,t,n,r){var i=e.history;i.undone.length=0;var E=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>E-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=Q(N.changes),dt(t.from,t.to)==0&&dt(t.from,K.to)==0?K.to=Hr(t):N.changes.push(Sa(e,t));else{var G=Q(i.done);for((!G||!G.ranges)&&Bi(e.sel,i.done),N={changes:[Sa(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=E,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Re(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,E=r&&r.origin;n==i.lastSelOp||E&&i.lastSelOrigin==E&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==E||pl(e,E,Q(i.done),t))?i.done[i.done.length-1]=t:Bi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=E,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ro(i.undone)}function Bi(e,t){var n=Q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ko(e,t,n,r){var i=t["spans_"+e.id],E=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[E]=N.markedSpans),++E})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Po(e,t){var n=yl(e,t),r=Ir(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var E=n[i],N=r[i];if(E&&N){e:for(var K=0;K<N.length;++K){for(var G=N[K],Y=0;Y<E.length;++Y)if(E[Y].marker==G.marker)continue e;E.push(G)}}else N&&(n[i]=N)}return n}function Ln(e,t,n){for(var r=[],i=0;i<e.length;++i){var E=e[i];if(E.ranges){r.push(n?fr.prototype.deepCopy.call(E):E);continue}var N=E.changes,K=[];r.push({changes:K});for(var G=0;G<N.length;++G){var Y=N[G],ae=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var ce in Y)(ae=ce.match(/^spans_(\d+)$/))&&(q(t,Number(ae[1]))>-1&&(Q(K)[ce]=Y[ce],delete Y[ce]))}}return r}function wa(e,t,n,r){if(r){var i=e.anchor;if(n){var E=dt(t,i)<0;E!=dt(n,i)<0?(i=t,t=n):E!=dt(t,n)<0&&(t=n)}return new Et(i,t)}else return new Et(n||t,t)}function ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Yt(e,new fr([wa(e.sel.primary(),t,n,i)],0),r)}function Mo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),E=0;E<e.sel.ranges.length;E++)r[E]=wa(e.sel.ranges[E],t[E],null,i);var N=Er(e.cm,r,e.sel.primIndex);Yt(e,N,n)}function Ca(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Yt(e,Er(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){Yt(e,Wr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var E=0;E<i.length;E++)this.ranges[E]=new Et(ut(e,i[E].anchor),ut(e,i[E].head))},origin:n&&n.origin};return Re(e,"beforeSelectionChange",e,r),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(e.cm,r.ranges,r.ranges.length-1):t}function Uo(e,t,n){var r=e.history.done,i=Q(r);i&&i.ranges?(r[r.length-1]=t,Wi(e,t,n)):Yt(e,t,n)}function Yt(e,t,n){Wi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Wi(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Fo(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Cn(e.cm)}function Fo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,oe(e.cm)),Gt(e,"cursorActivity",e)}function No(e){Fo(e,Bo(e,e.sel,null,!1))}function Bo(e,t,n,r){for(var i,E=0;E<t.ranges.length;E++){var N=t.ranges[E],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[E],G=Hi(e,N.anchor,K&&K.anchor,n,r),Y=Hi(e,N.head,K&&K.head,n,r);(i||G!=N.anchor||Y!=N.head)&&(i||(i=t.ranges.slice(0,E)),i[E]=new Et(G,Y))}return i?Er(e.cm,i,t.primIndex):t}function Dn(e,t,n,r,i){var E=rt(e,t.line);if(E.markedSpans)for(var N=0;N<E.markedSpans.length;++N){var K=E.markedSpans[N],G=K.marker,Y="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,ae="selectRight"in G?!G.selectRight:G.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ae?K.to>=t.ch:K.to>t.ch))){if(i&&(Re(G,"beforeCursorEnter"),G.explicitlyCleared))if(E.markedSpans){--N;continue}else break;if(!G.atomic)continue;if(n){var ce=G.find(r<0?1:-1),xe=void 0;if((r<0?ae:Y)&&(ce=jo(e,ce,-r,ce&&ce.line==t.line?E:null)),ce&&ce.line==t.line&&(xe=dt(ce,n))&&(r<0?xe<0:xe>0))return Dn(e,ce,t,r,i)}var be=G.find(r<0?-1:1);return(r<0?Y:ae)&&(be=jo(e,be,r,be.line==t.line?E:null)),be?Dn(e,be,t,r,i):null}}return t}function Hi(e,t,n,r,i){var E=r||1,N=Dn(e,t,n,E,i)||!i&&Dn(e,t,n,E,!0)||Dn(e,t,n,-E,i)||!i&&Dn(e,t,n,-E,!0);return N||(e.cantEdit=!0,Fe(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ut(e,Fe(t.line-1)):null:n>0&&t.ch==(r||rt(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Wo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),me)}function Ho(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,E,N,K){i&&(r.from=ut(e,i)),E&&(r.to=ut(e,E)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Re(e,"beforeChange",e,r),e.cm&&Re(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 On(e,t,n){if(e.cm){if(!e.cm.curOp)return jt(e.cm,On)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var r=Ti&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ko(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ko(e,t)}function Ko(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=Ea(e,t);_o(e,t,n,e.cm?e.cm.curOp.id:NaN),oi(e,t,n,Ir(e,t));var r=[];Kr(e,function(i,E){!E&&q(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),oi(i,t,null,Ir(i,t))})}function Ki(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,E,N=e.sel,K=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,Y=0;Y<K.length&&!(E=K[Y],n?E.ranges&&!E.equals(e.sel):!E.ranges);Y++);if(Y==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(E=K.pop(),E.ranges){if(Bi(E,G),n&&!E.equals(e.sel)){Yt(e,E,{clearRedo:!1});return}N=E}else if(r){K.push(E);return}else break;var ae=[];Bi(N,G),G.push({changes:ae,generation:i.generation}),i.generation=E.generation||++i.maxGeneration;for(var ce=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),xe=function(Ie){var Ne=E.changes[Ie];if(Ne.origin=t,ce&&!Ho(e,Ne,!1))return K.length=0,{};ae.push(Sa(e,Ne));var ze=Ie?Ea(e,Ne):Q(K);oi(e,Ne,ze,Po(e,Ne)),!Ie&&e.cm&&e.cm.scrollIntoView({from:Ne.from,to:Hr(Ne)});var Je=[];Kr(e,function(Ve,qe){!qe&&q(Je,Ve.history)==-1&&(Xo(Ve.history,Ne),Je.push(Ve.history)),oi(Ve,Ne,null,Po(Ve,Ne))})},be=E.changes.length-1;be>=0;--be){var _e=xe(be);if(_e)return _e.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new fr(ne(e.sel.ranges,function(i){return new Et(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Zt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Br(e.cm,r,"gutter")}}function oi(e,t,n,r){if(e.cm&&!e.cm.curOp)return jt(e.cm,oi)(e,t,n,r);if(t.to.line<e.first){Go(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Go(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[Q(t.text)],origin:t.origin}}var E=e.lastLine();t.to.line>E&&(t={from:t.from,to:Fe(E,rt(e,E).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ar(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Wi(e,n,me),e.cantEdit&&Hi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,E=t.from,N=t.to,K=!1,G=E.line;e.options.lineWrapping||(G=bt(it(rt(r,E.line))),r.iter(G,N.line+1,function(be){if(be==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&oe(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(G,E.line+t.text.length,function(be){var _e=Vt(be);_e>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=_e,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Hn(r,E.line),ni(e,400);var Y=t.text.length-(N.line-E.line)-1;t.full?Zt(e):E.line==N.line&&t.text.length==1&&!Lo(e.doc,t)?Br(e,E.line,"text"):Zt(e,E.line,N.line+1,Y);var ae=le(e,"changes"),ce=le(e,"change");if(ce||ae){var xe={from:E,to:N,text:t.text,removed:t.removed,origin:t.origin};ce&&Gt(e,"change",e,xe),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Rn(e,t,n,r,i){var E;r||(r=n),dt(r,n)<0&&(E=[r,n],n=E[0],r=E[1]),typeof t=="string"&&(t=e.splitLines(t)),On(e,{from:n,to:r,text:t,origin:i})}function zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(e,t,n,r){for(var i=0;i<e.length;++i){var E=e[i],N=!0;if(E.ranges){E.copied||(E=e[i]=E.deepCopy(),E.copied=!0);for(var K=0;K<E.ranges.length;K++)zo(E.ranges[K].anchor,t,n,r),zo(E.ranges[K].head,t,n,r);continue}for(var G=0;G<E.changes.length;++G){var Y=E.changes[G];if(n<Y.from.line)Y.from=Fe(Y.from.line+r,Y.from.ch),Y.to=Fe(Y.to.line+r,Y.to.ch);else if(t<=Y.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function si(e,t,n,r){var i=t,E=t;return typeof t=="number"?E=rt(e,Qr(e,t)):i=bt(t),i==null?null:(r(E,i)&&e.cm&&Br(e.cm,i,n),E)}function li(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}li.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,Xt(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 ui(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}ui.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var E=Math.min(t,i-e),N=r.height;if(r.removeInner(e,E),this.height-=N-r.height,i==E&&(this.children.splice(n--,1),r.parent=null),(t-=E)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof li))){var K=[];this.collapse(K),this.children=[new li(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<=E){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var G=new li(i.lines.slice(K,K+=25));i.height-=G.height,this.children.splice(++r,0,G),G.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=E}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ui(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 ui(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<E){var N=Math.min(t,E-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=E}}};var di=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};di.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=bt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var E=Qn(this);pr(n,Math.max(0,n.height-E)),e&&(ir(e,function(){Yo(e,n,-E),Br(e,r,"widget")}),Gt(e,"lineWidgetCleared",e,this,r))},di.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Qn(this)-t;if(!i)return;At(this.doc,r)||pr(r,r.height+i),n&&ir(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Gt(n,"lineWidgetChanged",n,e,bt(r))})},de(di);function Yo(e,t,n){Rt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new di(e,n,r),E=e.cm;return E&&i.noHScroll&&(E.display.alignWidgets=!0),si(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,E&&!At(e,N)){var G=Rt(N)<e.scrollTop;pr(N,N.height+Qn(i)),G&&ma(E,i.height),E.curOp.forceUpdate=!0}return!0}),E&&Gt(E,"lineWidgetAdded",E,i,typeof t=="number"?t:bt(t)),i}var $o=0,Gr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++$o};Gr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ln(e),le(this,"clear")){var n=this.find();n&&Gt(this,"clear",n.from,n.to)}for(var r=null,i=null,E=0;E<this.lines.length;++E){var N=this.lines[E],K=Mr(N.markedSpans,this);e&&!this.collapsed?Br(e,bt(N),"text"):e&&(K.to!=null&&(i=bt(N)),K.from!=null&&(r=bt(N))),N.markedSpans=Fa(N.markedSpans,K),K.from==null&&this.collapsed&&!At(this.doc,N)&&e&&pr(N,Tn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var Y=it(this.lines[G]),ae=Vt(Y);ae>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Zt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&No(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&un(e),this.parent&&this.parent.clear()},Gr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var E=this.lines[i],N=Mr(E.markedSpans,this);if(N.from!=null&&(n=Fe(t?E:bt(E),N.from),e==-1))return n;if(N.to!=null&&(r=Fe(t?E:bt(E),N.to),e==1))return r}return n&&{from:n,to:r}},Gr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ir(r,function(){var i=t.line,E=bt(t.line),N=ra(r,E);if(N&&(Za(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!At(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var G=Qn(n)-K;G&&pr(i,i.height+G)}Gt(r,"markerChanged",r,e)})},Gr.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)},Gr.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)}},de(Gr);function _n(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,_n)(e,t,n,r,i);var E=new Gr(e,i),N=dt(t,n);if(r&&k(r,E,!1),N>0||N==0&&E.clearWhenEmpty!==!1)return E;if(E.replacedWith&&(E.collapsed=!0,E.widgetNode=v("span",[E.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||E.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(E.widgetNode.insertLeft=!0)),E.collapsed){if(Zi(e,t.line,t,n,E)||t.line!=n.line&&Zi(e,n.line,t,n,E))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}E.addToHistory&&_o(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,G=e.cm,Y;if(e.iter(K,n.line+1,function(ce){G&&E.collapsed&&!G.options.lineWrapping&&it(ce)==G.display.maxLine&&(Y=!0),E.collapsed&&K!=t.line&&pr(ce,0),Kn(ce,new vn(E,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),E.collapsed&&e.iter(t.line,n.line+1,function(ce){At(e,ce)&&pr(ce,0)}),E.clearOnEnter&&Ce(E,"beforeCursorEnter",function(){return E.clear()}),E.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),E.collapsed&&(E.id=++$o,E.atomic=!0),G){if(Y&&(G.curOp.updateMaxLine=!0),E.collapsed)Zt(G,t.line,n.line+1);else if(E.className||E.startStyle||E.endStyle||E.css||E.attributes||E.title)for(var ae=t.line;ae<=n.line;ae++)Br(G,ae,"text");E.atomic&&No(G.doc),Gt(G,"markerAdded",G,E)}return E}var ci=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};ci.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")},ci.prototype.find=function(e,t){return this.primary.find(e,t)},de(ci);function Tl(e,t,n,r,i){r=k(r),r.shared=!1;var E=[_n(e,t,n,r,i)],N=E[0],K=r.widgetNode;return Kr(e,function(G){K&&(r.widgetNode=K.cloneNode(!0)),E.push(_n(G,ut(G,t),ut(G,n),r,i));for(var Y=0;Y<G.linked.length;++Y)if(G.linked[Y].isParent)return;N=Q(E)}),new ci(E,N)}function Qo(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),E=e.clipPos(i.from),N=e.clipPos(i.to);if(dt(E,N)){var K=_n(e,E,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],E=[i.primary.doc];Kr(i.primary.doc,function(G){return E.push(G)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];q(E,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,qt=function(e,t,n,r,i){if(!(this instanceof qt))return new qt(e,t,n,r,i);n==null&&(n=0),ui.call(this,[new li([new Lt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var E=Fe(n,0);this.sel=Wr(E),this.history=new Ni(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ta(this,{from:E,to:E,text:e}),Yt(this,Wr(E),me)};qt.prototype=Te(ui.prototype,{constructor:qt,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=hn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;On(this,{from:t,to:Fe(n,rt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&qn(this.cm,0,0),Yt(this,Wr(t),me)}),replaceRange:function(e,t,n,r){t=ut(this,t),n=n?ut(this,n):t,Rn(this,e,t,n,r)},getRange:function(e,t,n){var r=Ar(this,ut(this,e),ut(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(Pr(this,e))return rt(this,e)},getLineNumber:function(e){return bt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=rt(this,e)),it(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ut(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){Io(this,ut(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:Wt(function(e,t,n){Io(this,ut(this,e),ut(this,t||e),n)}),extendSelection:Wt(function(e,t,n){ji(this,ut(this,e),t&&ut(this,t),n)}),extendSelections:Wt(function(e,t){Mo(this,Bn(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var n=ne(this.sel.ranges,e);Mo(this,Bn(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 Et(ut(this,e[i].anchor),ut(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Yt(this,Er(this.cm,r,t),n)}),addSelection:Wt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Et(ut(this,e),ut(this,t||e))),Yt(this,Er(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Ar(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=Ar(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,E=0;E<i.ranges.length;E++){var N=i.ranges[E];r[E]={from:N.from(),to:N.to(),text:this.splitLines(e[E]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),G=r.length-1;G>=0;G--)On(this,r[G]);K?Uo(this,K):this.cm&&Cn(this.cm)}),undo:Wt(function(){Ki(this,"undo")}),redo:Wt(function(){Ki(this,"redo")}),undoSelection:Wt(function(){Ki(this,"undo",!0)}),redoSelection:Wt(function(){Ki(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Ni(this.history.maxGeneration),Kr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ln(this.history.done),undone:Ln(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=Ln(e.done.slice(0),null,!0),t.undone=Ln(e.undone.slice(0),null,!0)},setGutterMarker:Wt(function(e,t,n){return si(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ke(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Wt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&si(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ke(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Pr(this,e))return null;if(t=e,e=rt(this,e),!e)return null}else if(t=bt(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 si(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 si(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",E=r[i];if(E)if(n==null)r[i]=null;else{var N=E.match(y(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=E.slice(0,N.index)+(!N.index||K==E.length?"":" ")+E.slice(K)||null}else return!1;return!0})}),addLineWidget:Wt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return _n(this,ut(this,e),ut(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=ut(this,e),_n(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ut(this,e);var t=[],n=rt(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=ut(this,e),t=ut(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(E){var N=E.markedSpans;if(N)for(var K=0;K<N.length;K++){var G=N[K];!(G.to!=null&&i==e.line&&e.ch>=G.to||G.from==null&&i!=e.line||G.from!=null&&i==t.line&&G.from>=t.ch)&&(!n||n(G.marker))&&r.push(G.marker.parent||G.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var E=i.text.length+r;if(E>e)return t=e,!0;e-=E,++n}),ut(this,Fe(n,t))},indexFromPos:function(e){e=ut(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 qt(hn(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 qt(hn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,Qo(this)),r},unlinkDoc:function(e){if(e instanceof _t&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(Qo(this));break}if(e.history==this.history){var r=[e.id];Kr(e,function(i){return r.push(i.id)},!0),e.history=new Ni(null),e.history.done=Ln(this.history.done,r),e.history.undone=Ln(this.history.undone,r)}},iterLinkedDocs:function(e){Kr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):pt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection: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)})}),qt.prototype.eachLine=qt.prototype.iter;var Jo=0;function Al(e){var t=this;if(Zo(t),Ue(t,e)||Rr(t.display,e))return;$(e),B&&(Jo=+new Date);var n=nn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,E=Array(i),N=0,K=function(){++N==i&&jt(t,function(){n=ut(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(E.filter(function(_e){return _e!=null}).join(t.doc.lineSeparator())),origin:"paste"};On(t.doc,be),Uo(t.doc,Wr(ut(t.doc,n),ut(t.doc,Hr(be))))})()},G=function(be,_e){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,be.type)==-1){K();return}var Ie=new FileReader;Ie.onerror=function(){return K()},Ie.onload=function(){var Ne=Ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ne)){K();return}E[_e]=Ne,K()},Ie.readAsText(be)},Y=0;Y<r.length;Y++)G(r[Y],Y);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ae=e.dataTransfer.getData("Text");if(ae){var ce;if(t.state.draggingText&&!t.state.draggingText.copy&&(ce=t.listSelections()),Wi(t.doc,Wr(n,n)),ce)for(var xe=0;xe<ce.length;++xe)Rn(t.doc,"",ce[xe].anchor,ce[xe].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(be){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-Jo<100)){te(t);return}if(Ue(e,t)||Rr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=nn(e,t);if(!n)return;var r=document.createDocumentFragment();uo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function Zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var E=0;E<n.length;E++)e(n[E])})}var es=!1;function Ol(){if(es)return;Rl(),es=!0}function Rl(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(_l)},100))}),Ce(window,"blur",function(){return qo(wn)})}function _l(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var zr={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"},fi=0;fi<10;fi++)zr[fi+48]=zr[fi+96]=String(fi);for(var Gi=65;Gi<=90;Gi++)zr[Gi]=String.fromCharCode(Gi);for(var hi=1;hi<=12;hi++)zr[hi+111]=zr[hi+63235]="F"+hi;var _r={};_r.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},_r.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},_r.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},_r.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},_r.default=s?_r.macDefault:_r.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,E,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))E=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),E&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ne(n.split(" "),kl),E=0;E<i.length;E++){var N=void 0,K=void 0;E==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,E+1).join(" "),N="...");var G=t[K];if(!G)t[K]=N;else if(G!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function kn(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 kn(e,t.fallthrough,n,r);for(var E=0;E<t.fallthrough.length;E++){var N=kn(e,t.fallthrough[E],n,r);if(N)return N}}}function ts(e){var t=typeof e=="string"?e:zr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ns(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=zr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function zi(e){return typeof e=="string"?_r[e]:e}function Pn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var E=t(n[i]);r.length&&dt(E.from,Q(r).to)<=0;){var N=r.pop();if(dt(N.from,E.from)<0){E.from=N.from;break}}r.push(E)}ir(e,function(){for(var K=r.length-1;K>=0;K--)Rn(e.doc,"",r[K].from,r[K].to,"+delete");Cn(e)})}function Aa(e,t,n){var r=Le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function La(e,t,n){var r=Aa(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function Da(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var E=je(n,t.doc.direction);if(E){var N=i<0?Q(E):E[0],K=i<0==(N.level==1),G=K?"after":"before",Y;if(N.level>0||t.doc.direction=="rtl"){var ae=xn(t,n);Y=i<0?n.text.length-1:0;var ce=wr(t,ae,Y).top;Y=We(function(xe){return wr(t,ae,xe).top==ce},i<0==(N.level==1)?N.from:N.to-1,Y),G=="before"&&(Y=Aa(n,Y,1))}else Y=i<0?N.to:N.from;return new Fe(r,Y,G)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=je(t,e.doc.direction);if(!i)return La(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var E=Ke(i,n.ch,n.sticky),N=i[E];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return La(t,n,r);var K=function(ze,Je){return Aa(t,ze instanceof Fe?ze.ch:ze,Je)},G,Y=function(ze){return e.options.lineWrapping?(G=G||xn(e,t),ao(e,t,G,ze)):{begin:0,end:t.text.length}},ae=Y(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var ce=N.level==1==r<0,xe=K(n,ce?1:-1);if(xe!=null&&(ce?xe<=N.to&&xe<=ae.end:xe>=N.from&&xe>=ae.begin)){var be=ce?"before":"after";return new Fe(n.line,xe,be)}}var _e=function(ze,Je,Ve){for(var qe=function(wt,Ht){return Ht?new Fe(n.line,K(wt,1),"before"):new Fe(n.line,wt,"after")};ze>=0&&ze<i.length;ze+=Je){var lt=i[ze],at=Je>0==(lt.level!=1),gt=at?Ve.begin:K(Ve.end,-1);if(lt.from<=gt&&gt<lt.to)return qe(gt,at);if(gt=at?lt.from:K(lt.to,-1),Ve.begin<=gt&&gt<Ve.end)return qe(gt,at)}},Ie=_e(E+r,r,ae);if(Ie)return Ie;var Ne=r>0?ae.end:K(ae.begin,-1);return Ne!=null&&!(r>0&&Ne==t.text.length)&&(Ie=_e(r>0?0:i.length-1,r,Y(Ne)),Ie)?Ie:null}var mi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return Pn(e,function(t){if(t.empty()){var n=rt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Pn(e,function(t){return{from:Fe(t.from().line,0),to:ut(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Pn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},ve)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},ve)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?as(e,t.head):r},ve)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var E=n[i].from(),N=H(e.getLine(E.line),E.ch,r);t.push(he(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ir(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,E=rt(e.doc,i.line).text;if(E){if(i.ch==E.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(E.charAt(i.ch-1)+E.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=rt(e.doc,i.line-1).text;N&&(i=new Fe(i.line,1),e.replaceRange(E.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Fe(i.line-1,N.length-1),i,"+transpose"))}}n.push(new Et(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ir(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);Cn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=rt(e.doc,t),r=it(n);return r!=n&&(t=bt(r)),Da(!0,e,r,t,1)}function Il(e,t){var n=rt(e.doc,t),r=ht(n);return r!=n&&(t=bt(r)),Da(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=rt(e.doc,n.line),i=je(r,e.doc.direction);if(!i||i[0].level==0){var E=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=E&&t.ch;return Fe(n.line,N?0:E,n.sticky)}return n}function Vi(e,t,n){if(typeof t=="string"&&(t=mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ee}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=kn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&kn(t,e.options.extraKeys,n,e)||kn(t,e.options.keyMap,n,e)}var Fl=new X;function pi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Gt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&($(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?pi(e,"Shift-"+n,t,function(r){return Vi(e,r,!0)})||pi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vi(e,r)}):pi(e,n,t,function(r){return Vi(e,r)}):!1}function Nl(e,t,n){return pi(e,"'"+n+"'",t,function(r){return Vi(e,r,!0)})}var Oa=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Ue(t,e))return;B&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);A&&(Oa=r?n:null,!r&&n==88&&!kt&&(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)&&(f(t,"CodeMirror-crosshair"),Qe(document,"keyup",n),Qe(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ue(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Rr(t.display,e)||Ue(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==Oa){Oa=null,$(e);return}if(A&&(!e.which||e.which<10)&&ss(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ra=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ra.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var gi,vi;function Wl(e,t){var n=+new Date;return vi&&vi.compare(n,e,t)?(gi=vi=null,"triple"):gi&&gi.compare(n,e,t)?(vi=new Ra(n,e,t),gi=null,"double"):(gi=new Ra(n,e,t),vi=null,"single")}function cs(e){var t=this,n=t.display;if(Ue(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Rr(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(_a(t,e))return;var r=nn(t,e),i=Ae(e),E=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,E,e))return;i==1?r?Gl(t,r,E,e):ye(e)==n.scroller&&$(e):i==2?(r&&ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):fo(t))}function Hl(e,t,n,r,i){var E="Click";return r=="double"?E="Double"+E:r=="triple"&&(E="Triple"+E),E=(t==1?"Left":t==2?"Middle":"Right")+E,pi(e,rs(E,i),i,function(N){if(typeof N=="string"&&(N=mi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=Ee}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var E=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=E?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(_(co,e),0):e.curOp.focus=M();var i=Kl(e,n,r),E=e.doc.sel,N;e.options.dragDrop&&Me&&!e.isReadOnly()&&n=="single"&&(N=E.contains(t))>-1&&(dt((N=E.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,E=!1,N=jt(e,function(Y){O&&(i.scroller.draggable=!1),e.state.draggingText=!1,Qe(i.wrapper.ownerDocument,"mouseup",N),Qe(i.wrapper.ownerDocument,"mousemove",K),Qe(i.scroller,"dragstart",G),Qe(i.scroller,"drop",N),E||($(Y),r.addNew||ji(e.doc,n,null,null,r.extend),O&&!P||B&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Y){E=E||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},G=function(){return E=!0};O&&(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",K),Ce(i.scroller,"dragstart",G),Ce(i.scroller,"drop",N),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new Et(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Et(Fe(t.line,0),ut(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new Et(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,E=e.doc;$(t);var N,K,G=E.sel,Y=G.ranges;if(r.addNew&&!r.extend?(K=E.sel.contains(n),K>-1?N=Y[K]:N=new Et(n,n)):(N=E.sel.primary(),K=E.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new Et(n,n)),n=nn(e,t,!0,!0),K=-1;else{var ae=fs(e,n,r.unit);r.extend?N=wa(N,ae.anchor,ae.head,r.extend):N=ae}r.addNew?K==-1?(K=Y.length,Yt(E,Er(e,Y.concat([N]),K),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[K].empty()&&r.unit=="char"&&!r.extend?(Yt(E,Er(e,Y.slice(0,K).concat(Y.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),G=E.sel):Ca(E,K,N,Se):(K=0,Yt(E,new fr([N],0),Se),G=E.sel);var ce=n;function xe(Ve){if(dt(ce,Ve)==0)return;if(ce=Ve,r.unit=="rectangle"){for(var qe=[],lt=e.options.tabSize,at=H(rt(E,n.line).text,n.ch,lt),gt=H(rt(E,Ve.line).text,Ve.ch,lt),wt=Math.min(at,gt),Ht=Math.max(at,gt),Pt=Math.min(n.line,Ve.line),ar=Math.min(e.lastLine(),Math.max(n.line,Ve.line));Pt<=ar;Pt++){var er=rt(E,Pt).text,Ft=fe(er,wt,lt);wt==Ht?qe.push(new Et(Fe(Pt,Ft),Fe(Pt,Ft))):er.length>Ft&&qe.push(new Et(Fe(Pt,Ft),Fe(Pt,fe(er,Ht,lt))))}qe.length||qe.push(new Et(n,n)),Yt(E,Er(e,G.ranges.slice(0,K).concat(qe),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ve)}else{var tr=N,zt=fs(e,Ve,r.unit),Bt=tr.anchor,Nt;dt(zt.anchor,Bt)>0?(Nt=zt.head,Bt=$r(tr.from(),zt.anchor)):(Nt=zt.anchor,Bt=mn(tr.to(),zt.head));var Mt=G.ranges.slice(0);Mt[K]=Xl(e,new Et(ut(E,Bt),Nt)),Yt(E,Er(e,Mt,K),Se)}}var be=i.wrapper.getBoundingClientRect(),_e=0;function Ie(Ve){var qe=++_e,lt=nn(e,Ve,!0,r.unit=="rectangle");if(!lt)return;if(dt(lt,ce)!=0){e.curOp.focus=M(),xe(lt);var at=Mi(i,E);(lt.line>=at.to||lt.line<at.from)&&setTimeout(jt(e,function(){_e==qe&&Ie(Ve)}),150)}else{var gt=Ve.clientY<be.top?-20:Ve.clientY>be.bottom?20:0;gt&&setTimeout(jt(e,function(){if(_e!=qe)return;i.scroller.scrollTop+=gt,Ie(Ve)}),50)}}function Ne(Ve){e.state.selectingText=!1,_e=Infinity,Ve&&($(Ve),i.input.focus()),Qe(i.wrapper.ownerDocument,"mousemove",ze),Qe(i.wrapper.ownerDocument,"mouseup",Je),E.history.lastSelOrigin=null}var ze=jt(e,function(Ve){Ve.buttons===0||!Ae(Ve)?Ne(Ve):Ie(Ve)}),Je=jt(e,Ne);e.state.selectingText=Je,Ce(i.wrapper.ownerDocument,"mousemove",ze),Ce(i.wrapper.ownerDocument,"mouseup",Je)}function Xl(e,t){var n=t.anchor,r=t.head,i=rt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var E=je(i);if(!E)return t;var N=Ke(E,n.ch,n.sticky),K=E[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var G=N+(K.from==n.ch==(K.level!=1)?0:1);if(G==0||G==E.length)return t;var Y;if(r.line!=n.line)Y=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=Ke(E,r.ch,r.sticky),ce=ae-N||(r.ch-n.ch)*(K.level==1?-1:1);ae==G-1||ae==G?Y=ce<0:Y=ce>0}var xe=E[G+(Y?-1:0)],be=Y==(xe.level==1),_e=be?xe.from:xe.to,Ie=be?"after":"before";return n.ch==_e&&n.sticky==Ie?t:new Et(new Fe(n.line,_e,Ie),r)}function hs(e,t,n,r){var i,E;if(t.touches)i=t.touches[0].clientX,E=t.touches[0].clientY;else try{i=t.clientX,E=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(E>K.bottom||!le(e,n))return ee(t);E-=K.top-N.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var Y=N.gutters.childNodes[G];if(Y&&Y.getBoundingClientRect().right>=i){var ae=Lr(e.doc,E),ce=e.display.gutterSpecs[G];return Re(e,n,e,ae,ce.className,t),ee(t)}}}function _a(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Rr(e.display,t)||Yl(e,t))return;if(Ue(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Jn(e)}var Mn={toString:function(){return"CodeMirror.Init"}},gs={},Xi={};function $l(e){var t=e.optionHandlers;function n(r,i,E,N){e.defaults[r]=i,E&&(t[r]=N?function(K,G,Y){Y!=Mn&&E(K,G,Y)}:E)}e.defineOption=n,e.Init=Mn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ai(r),Jn(r),Zt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var E=[],N=r.doc.first;r.doc.iter(function(G){for(var Y=0;;){var ae=G.text.indexOf(i,Y);if(ae==-1)break;Y=ae+i.length,E.push(Fe(N,ae))}N++});for(var K=E.length-1;K>=0;K--)Rn(r.doc,i,E[K],Fe(E[K].line,E[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,E){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),E!=Mn&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),ii(r)},!0),n("keyMap","default",function(r,i,E){var N=zi(i),K=E!=Mn&&zi(E);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ba(i,r.options.lineNumbers),ii(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return An(r)},!0),n("scrollbarStyle","native",function(r){yo(r),An(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ba(r.options.gutters,i),ii(r)},!0),n("firstLineNumber",1,ii,!0),n("lineNumberFormatter",function(r){return r},ii,!0),n("showCursorWhenSelecting",!1,Zn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(wn(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,Zn,!0),n("singleCursorHeightPerLine",!0,Zn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ai,!0),n("addModeClass",!1,ai,!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,ai,!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!=Mn;if(!t!=!r){var i=e.display.dragFunctions,E=t?Ce:Qe;E(e.display.scroller,"dragstart",i.start),E(e.display.scroller,"dragenter",i.enter),E(e.display.scroller,"dragover",i.over),E(e.display.scroller,"dragleave",i.leave),E(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),yr(e)),da(e),Zt(e),Jn(e),setTimeout(function(){return An(e)},100)}function _t(e,t){var n=this;if(!(this instanceof _t))return new _t(e,t);this.options=t=t?k(t):{},k(gs,t,!1);var r=t.value;typeof r=="string"?r=new qt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new _t.inputStyles[t.inputStyle](this),E=this.display=new dl(e,r,i,t);E.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new X,keySeq:null,specialChars:null},t.autofocus&&!o&&E.input.focus(),B&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),ln(this),this.curOp.forceUpdate=!0,Do(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):wn(this);for(var N in Xi)Xi.hasOwnProperty(N)&&Xi[N](this,t[N],Mn);xo(this),t.finishInit&&t.finishInit(this);for(var K=0;K<ka.length;++K)ka[K](this);un(this),O&&t.lineWrapping&&getComputedStyle(E.lineDiv).textRendering=="optimizelegibility"&&(E.lineDiv.style.textRendering="auto")}_t.defaults=gs,_t.optionHandlers=Xi;function Zl(e){var t=e.display;Ce(t.scroller,"mousedown",jt(e,cs)),B&&I<11?Ce(t.scroller,"dblclick",jt(e,function(G){if(Ue(e,G))return;var Y=nn(e,G);if(!Y||_a(e,G)||Rr(e.display,G))return;$(G);var ae=e.findWordAt(Y);ji(e.doc,ae.anchor,ae.head)})):Ce(t.scroller,"dblclick",function(G){return Ue(e,G)||$(G)}),Ce(t.scroller,"contextmenu",function(G){return ms(e,G)}),Ce(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||ms(e,G)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function E(G){if(G.touches.length!=1)return!1;var Y=G.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function N(G,Y){if(Y.left==null)return!0;var ae=Y.left-G.left,ce=Y.top-G.top;return ae*ae+ce*ce>20*20}Ce(t.scroller,"touchstart",function(G){if(!Ue(e,G)&&!E(G)&&!_a(e,G)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},G.touches.length==1&&(t.activeTouch.left=G.touches[0].pageX,t.activeTouch.top=G.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(G){var Y=t.activeTouch;if(Y&&!Rr(t,G)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var ae=e.coordsChar(t.activeTouch,"page"),ce;!Y.prev||N(Y,Y.prev)?ce=new Et(ae,ae):!Y.prev.prev||N(Y,Y.prev.prev)?ce=e.findWordAt(ae):ce=new Et(Fe(ae.line,0),ut(e.doc,Fe(ae.line+1,0))),e.setSelection(ce.anchor,ce.head),e.focus(),$(G)}i()}),Ce(t.scroller,"touchcancel",i),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ei(e,t.scroller.scrollTop),on(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(G){return wo(e,G)}),Ce(t.scroller,"DOMMouseScroll",function(G){return wo(e,G)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){Ue(e,G)||te(G)},over:function(G){Ue(e,G)||(Dl(e,G),te(G))},start:function(G){return Ll(e,G)},drop:jt(e,Al),leave:function(G){Ue(e,G)||Zo(e)}};var K=t.input.getField();Ce(K,"keyup",function(G){return us.call(e,G)}),Ce(K,"keydown",jt(e,ls)),Ce(K,"keypress",jt(e,ds)),Ce(K,"focus",function(G){return fa(e,G)}),Ce(K,"blur",function(G){return wn(e,G)})}var ka=[];_t.defineInitHook=function(e){return ka.push(e)};function yi(e,t,n,r){var i=e.doc,E;n==null&&(n="add"),n=="smart"&&(i.mode.indent?E=nr(e,t).state:n="prev");var N=e.options.tabSize,K=rt(i,t),G=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var Y=K.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(K.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(E,K.text.slice(Y.length),K.text),ae==Ee||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=H(rt(i,t-1).text,null,N):ae=0:n=="add"?ae=G+e.options.indentUnit:n=="subtract"?ae=G-e.options.indentUnit:typeof n=="number"&&(ae=G+n),ae=Math.max(0,ae);var ce="",xe=0;if(e.options.indentWithTabs)for(var be=Math.floor(ae/N);be;--be)xe+=N,ce+=" ";if(xe<ae&&(ce+=he(ae-xe)),ce!=Y)return Rn(i,ce,Fe(t,0),Fe(t,Y.length),"+input"),K.stateAfter=null,!0;for(var _e=0;_e<i.sel.ranges.length;_e++){var Ie=i.sel.ranges[_e];if(Ie.head.line==t&&Ie.head.ch<Y.length){var Ne=Fe(t,Y.length);Ca(i,_e,new Et(Ne,Ne));break}}}var xr=null;function Yi(e){xr=e}function Pa(e,t,n,r,i){var E=e.doc;e.display.shift=!1,r||(r=E.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,G=pt(t),Y=null;if(K&&r.ranges.length>1)if(xr&&xr.text.join(`
`)==t){if(r.ranges.length%xr.text.length==0){Y=[];for(var ae=0;ae<xr.text.length;ae++)Y.push(E.splitLines(xr.text[ae]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=ne(G,function(ze){return[ze]}));for(var ce=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var be=r.ranges[xe],_e=be.from(),Ie=be.to();be.empty()&&(n&&n>0?_e=Fe(_e.line,_e.ch-n):e.state.overwrite&&!K?Ie=Fe(Ie.line,Math.min(rt(E,Ie.line).text.length,Ie.ch+Q(G).length)):K&&xr&&xr.lineWise&&xr.text.join(`
`)==G.join(`
`)&&(_e=Ie=Fe(_e.line,0)));var Ne={from:_e,to:Ie,text:Y?Y[xe%Y.length]:G,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};On(e.doc,Ne),Gt(e,"inputRead",e,Ne)}t&&!K&&ys(e,t),Cn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ce),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ir(t,function(){return Pa(t,n,0,null,"paste")}),!0}function ys(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var E=e.getModeAt(i.head),N=!1;if(E.electricChars){for(var K=0;K<E.electricChars.length;K++)if(t.indexOf(E.electricChars.charAt(K))>-1){N=yi(e,i.head.line,"smart");break}}else E.electricInput&&(E.electricInput.test(rt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=yi(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function bs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,E={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(E),t.push(e.getRange(E.anchor,E.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),p&&(e.style.border="1px solid black"),Es(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var E=this.options,N=E[r];if(E[r]==i&&r!="mode")return;E[r]=i,t.hasOwnProperty(r)&&jt(this,t[r])(this,i,N),Re(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,E=0;E<i.length;++E)if(i[E]==r||i[E].name==r)return i.splice(E,1),!0},addOverlay:Qt(function(r,i){var E=r.token?r:e.getMode(this.options,r);if(E.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:E,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,Zt(this)}),removeOverlay:Qt(function(r){for(var i=this.state.overlays,E=0;E<i.length;++E){var N=i[E].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(E,1),this.state.modeGen++,Zt(this);return}}}),indentLine:Qt(function(r,i,E){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Pr(this.doc,r)&&yi(this,r,i,E)}),indentSelection:Qt(function(r){for(var i=this.doc.sel.ranges,E=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>E&&(yi(this,K.head.line,r,!0),E=K.head.line,N==this.doc.sel.primIndex&&Cn(this));else{var G=K.from(),Y=K.to(),ae=Math.max(E,G.line);E=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var ce=ae;ce<E;++ce)yi(this,ce,r);var xe=this.doc.sel.ranges;G.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Ca(this.doc,N,new Et(G,xe[N].to()),me)}}}),getTokenAt:function(r,i){return Or(this,r,i)},getLineTokens:function(r,i){return Or(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=ut(this.doc,r);var i=jn(this,rt(this.doc,r.line)),E=0,N=(i.length-1)/2,K=r.ch,G;if(K==0)G=i[2];else for(;;){var Y=E+N>>1;if((Y?i[Y*2-1]:0)>=K)N=Y;else if(i[Y*2+1]<K)E=Y+1;else{G=i[Y*2+2];break}}var ae=G?G.indexOf("overlay "):-1;return ae<0?G:ae==0?null:G.slice(0,ae-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var E=[];if(!n.hasOwnProperty(i))return E;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&E.push(N[K[i]]);else if(K[i])for(var G=0;G<K[i].length;G++){var Y=N[K[i][G]];Y&&E.push(Y)}else K.helperType&&N[K.helperType]?E.push(N[K.helperType]):N[K.name]&&E.push(N[K.name]);for(var ae=0;ae<N._global.length;ae++){var ce=N._global[ae];ce.pred(K,this)&&q(E,ce.val)==-1&&E.push(ce.val)}return E},getStateAfter:function(r,i){var E=this.doc;return r=Qr(E,r==null?E.first+E.size-1:r),nr(this,r+1,i).state},cursorCoords:function(r,i){var E,N=this.doc.sel.primary();return r==null?E=N.head:typeof r=="object"?E=ut(this.doc,r):E=r?N.from():N.to(),br(this,E,i||"page")},charCoords:function(r,i){return ia(this,ut(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,Lr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,E){var N=!1,K;if(typeof r=="number"){var G=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>G&&(r=G,N=!0),K=rt(this.doc,r)}else K=r;return Ri(this,K,{top:0,left:0},i||"page",E||N).top+(N?this.doc.height-Rt(K):0)},defaultTextHeight:function(){return Tn(this.display)},defaultCharWidth:function(){return Sn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,E,N,K){var G=this.display;r=br(this,ut(this.doc,r));var Y=r.bottom,ae=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),N=="over")Y=r.top;else if(N=="above"||N=="near"){var ce=Math.max(G.wrapper.clientHeight,this.doc.height),xe=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ce)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ce&&(Y=r.bottom),ae+i.offsetWidth>xe&&(ae=xe-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(ae=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ae=0:K=="middle"&&(ae=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),E&&Qs(this,{left:ae,top:Y,right:ae+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:Qt(ls),triggerOnKeyPress:Qt(ds),triggerOnKeyUp:us,triggerOnMouseDown:Qt(cs),execCommand:function(r){if(mi.hasOwnProperty(r))return mi[r].call(null,this)},triggerElectric:Qt(function(r){ys(this,r)}),findPosH:function(r,i,E,N){var K=1;i<0&&(K=-1,i=-i);for(var G=ut(this.doc,r),Y=0;Y<i&&!(G=Ma(this.doc,G,K,E,N),G.hitSide);++Y);return G},moveH:Qt(function(r,i){var E=this;this.extendSelectionsBy(function(N){return E.display.shift||E.doc.extend||N.empty()?Ma(E.doc,N.head,r,i,E.options.rtlMoveVisually):r<0?N.from():N.to()},ve)}),deleteH:Qt(function(r,i){var E=this.doc.sel,N=this.doc;E.somethingSelected()?N.replaceSelection("",null,"+delete"):Pn(this,function(K){var G=Ma(N,K.head,r,i,!1);return r<0?{from:G,to:K.head}:{from:K.head,to:G}})}),findPosV:function(r,i,E,N){var K=1,G=N;i<0&&(K=-1,i=-i);for(var Y=ut(this.doc,r),ae=0;ae<i;++ae){var ce=br(this,Y,"div");if(G==null?G=ce.left:ce.left=G,Y=Ts(this,ce,K,E),Y.hitSide)break}return Y},moveV:Qt(function(r,i){var E=this,N=this.doc,K=[],G=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ae){if(G)return r<0?ae.from():ae.to();var ce=br(E,ae.head,"div");ae.goalColumn!=null&&(ce.left=ae.goalColumn),K.push(ce.left);var xe=Ts(E,ce,r,i);return i=="page"&&ae==N.sel.primary()&&ma(E,ia(E,xe,"div").top-ce.top),xe},ve),K.length)for(var Y=0;Y<N.sel.ranges.length;Y++)N.sel.ranges[Y].goalColumn=K[Y]}),findWordAt:function(r){var i=this.doc,E=rt(i,r.line).text,N=r.ch,K=r.ch;if(E){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||K==E.length)&&N?--N:++K;for(var Y=E.charAt(N),ae=Oe(Y,G)?function(ce){return Oe(ce,G)}:/\s/.test(Y)?function(ce){return/\s/.test(ce)}:function(ce){return!/\s/.test(ce)&&!Oe(ce)};N>0&&ae(E.charAt(N-1));)--N;for(;K<E.length&&ae(E.charAt(K));)++K}return new Et(Fe(r.line,N),Fe(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),Re(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){qn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Sr(this)-this.display.barHeight,width:r.scrollWidth-Sr(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:tn(this)}},scrollIntoView:Qt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):mo(this,r.from,r.to,r.margin)}),setSize:Qt(function(r,i){var E=this,N=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&qa(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(G){if(G.widgets){for(var Y=0;Y<G.widgets.length;Y++)if(G.widgets[Y].noHScroll){Br(E,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(r){return ir(this,r)},startOperation:function(){return ln(this)},endOperation:function(){return un(this)},refresh:Qt(function(){var r=this.display.cachedTextHeight;Zt(this),this.curOp.forceUpdate=!0,Jn(this),qn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-Tn(this.display))>.5||this.options.lineWrapping)&&da(this),Re(this,"refresh",this)}),swapDoc:Qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Do(this,r),Jn(this),this.display.input.reset(),qn(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}},de(e),e.registerHelper=function(r,i,E){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=E},e.registerGlobalHelper=function(r,i,E,N){e.registerHelper(r,i,N),n[r]._global.push({pred:E,val:N})}}function Ma(e,t,n,r,i){var E=t,N=n,K=rt(e,t.line),G=i&&e.direction=="rtl"?-n:n;function Y(){var Je=t.line+G;return Je<e.first||Je>=e.first+e.size?!1:(t=new Fe(Je,t.ch,t.sticky),K=rt(e,Je))}function ae(Je){var Ve;if(r=="codepoint"){var qe=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(qe)?Ve=null:Ve=new Fe(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(qe>=55296&&qe<56320?2:1))),-n)}else i?Ve=Ml(e.cm,K,t,n):Ve=La(K,t,n);if(Ve==null)if(!Je&&Y())t=Da(i,e.cm,K,t.line,G);else return!1;else t=Ve;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var ce=null,xe=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),_e=!0;!(n<0&&!ae(!_e));_e=!1){var Ie=K.text.charAt(t.ch)||`
`,Ne=Oe(Ie,be)?"w":xe&&Ie==`
`?"n":!xe||/\s/.test(Ie)?null:"p";if(xe&&!_e&&!Ne&&(Ne="s"),ce&&ce!=Ne){n<0&&(n=1,ae(),t.sticky="after");break}if(Ne&&(ce=Ne),n>0&&!ae(!_e))break}var ze=Hi(e,t,E,N,!0);return Ge(E,ze)&&(ze.hitSide=!0),ze}function Ts(e,t,n,r){var i=e.doc,E=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(K-.5*Tn(e.display),3);N=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var Y;!(Y=oa(e,E,N),!Y.outside);){if(n<0?N<=0:N>=i.height){Y.hitSide=!0;break}N+=n*5}return Y}var xt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};xt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function E(K){for(var G=K.target;G;G=G.parentNode){if(G==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(G.className))break}return!1}Ce(i,"paste",function(K){if(!E(K)||Ue(r,K)||vs(K,r))return;I<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Ce(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Ce(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Ce(i,"compositionend",function(K){t.composing&&(K.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(K){if(!E(K)||Ue(r,K))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=bs(r);Yi({lineWise:!0,text:G.text}),K.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Y=xr.text.join(`
`);if(K.clipboardData.setData("Text",Y),K.clipboardData.getData("Text")==Y){K.preventDefault();return}}var ae=xs(),ce=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),ce.value=xr.text.join(`
`);var xe=document.activeElement;W(ce),setTimeout(function(){r.display.lineSpace.removeChild(ae),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Ce(i,"copy",N),Ce(i,"cut",N)},xt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},xt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},xt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},xt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},xt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var E=$i(t,e.anchorNode,e.anchorOffset),N=$i(t,e.focusNode,e.focusOffset);if(E&&!E.bad&&N&&!N.bad&&dt($r(E,N),r)==0&&dt(mn(E,N),i)==0)return;var K=t.display.view,G=r.line>=t.display.viewFrom&&Ss(t,r)||{node:K[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Ss(t,i);if(!Y){var ae=K[K.length-1].measure,ce=ae.maps?ae.maps[ae.maps.length-1]:ae.map;Y={node:ce[ce.length-1],offset:ce[ce.length-2]-ce[ce.length-3]}}if(!G||!Y){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),be;try{be=g(G.node,G.offset,Y.offset,Y.node)}catch(_e){}be&&(!L&&t.state.focused?(e.collapse(G.node,G.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},xt.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)},xt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},xt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},xt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},xt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},xt.prototype.blur=function(){this.div.blur()},xt.prototype.getField=function(){return this.div},xt.prototype.supportsTouch=function(){return!0},xt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ir(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)},xt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},xt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&x&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=$i(t,e.anchorNode,e.anchorOffset),r=$i(t,e.focusNode,e.focusOffset);n&&r&&ir(t,function(){Yt(t.doc,Wr(n,r),me),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},xt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Fe(r.line-1,rt(e.doc,r.line-1).length)),i.ch==rt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var E,N,K;r.line==t.viewFrom||(E=an(e,r.line))==0?(N=bt(t.view[0].line),K=t.view[0].node):(N=bt(t.view[E].line),K=t.view[E-1].node.nextSibling);var G=an(e,i.line),Y,ae;if(G==t.view.length-1?(Y=t.viewTo-1,ae=t.lineDiv.lastChild):(Y=bt(t.view[G+1].line)-1,ae=t.view[G+1].node.previousSibling),!K)return!1;for(var ce=e.doc.splitLines(tu(e,K,ae,N,Y)),xe=Ar(e.doc,Fe(N,0),Fe(Y,rt(e.doc,Y).text.length));ce.length>1&&xe.length>1;)if(Q(ce)==Q(xe))ce.pop(),xe.pop(),Y--;else if(ce[0]==xe[0])ce.shift(),xe.shift(),N++;else break;for(var be=0,_e=0,Ie=ce[0],Ne=xe[0],ze=Math.min(Ie.length,Ne.length);be<ze&&Ie.charCodeAt(be)==Ne.charCodeAt(be);)++be;for(var Je=Q(ce),Ve=Q(xe),qe=Math.min(Je.length-(ce.length==1?be:0),Ve.length-(xe.length==1?be:0));_e<qe&&Je.charCodeAt(Je.length-_e-1)==Ve.charCodeAt(Ve.length-_e-1);)++_e;if(ce.length==1&&xe.length==1&&N==r.line)for(;be&&be>r.ch&&Je.charCodeAt(Je.length-_e-1)==Ve.charCodeAt(Ve.length-_e-1);)be--,_e++;ce[ce.length-1]=Je.slice(0,Je.length-_e).replace(/^\u200b+/,""),ce[0]=ce[0].slice(be).replace(/\u200b+$/,"");var lt=Fe(N,be),at=Fe(Y,xe.length?Q(xe).length-_e:0);if(ce.length>1||ce[0]||dt(lt,at))return Rn(e.doc,ce,lt,at,"+input"),!0},xt.prototype.ensurePolled=function(){this.forceCompositionEnd()},xt.prototype.reset=function(){this.forceCompositionEnd()},xt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},xt.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)},xt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ir(this.cm,function(){return Zt(e.cm)})},xt.prototype.setUneditable=function(e){e.contentEditable="false"},xt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Pa)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},xt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},xt.prototype.onContextMenu=function(){},xt.prototype.resetPosition=function(){},xt.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=rt(e.doc,t.line),i=Ya(n,r,t.line),E=je(r,e.doc.direction),N="left";if(E){var K=Ke(E,t.ch);N=K%2?"right":"left"}var G=Ja(i.map,t.ch,N);return G.offset=G.collapse=="right"?G.end:G.start,G}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function In(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var E="",N=!1,K=e.doc.lineSeparator(),G=!1;function Y(be){return function(_e){return _e.id==be}}function ae(){N&&(E+=K,G&&(E+=K),N=G=!1)}function ce(be){be&&(ae(),E+=be)}function xe(be){if(be.nodeType==1){var _e=be.getAttribute("cm-text");if(_e){ce(_e);return}var Ie=be.getAttribute("cm-marker"),Ne;if(Ie){var ze=e.findMarks(Fe(r,0),Fe(i+1,0),Y(+Ie));ze.length&&(Ne=ze[0].find(0))&&ce(Ar(e.doc,Ne.from,Ne.to).join(K));return}if(be.getAttribute("contenteditable")=="false")return;var Je=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;Je&&ae();for(var Ve=0;Ve<be.childNodes.length;Ve++)xe(be.childNodes[Ve]);/^(pre|p)$/i.test(be.nodeName)&&(G=!0),Je&&(N=!0)}else be.nodeType==3&&ce(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,G=!1;return E}function $i(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return In(e.clipPos(Fe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var E=e.display.view[i];if(E.node==r)return ru(E,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!b(r,t))return In(Fe(bt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var E=e.rest?Q(e.rest):e.line;return In(Fe(bt(E),E.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var G=e.measure,Y=G.maps;function ae(Ne,ze,Je){for(var Ve=-1;Ve<(Y?Y.length:0);Ve++)for(var qe=Ve<0?G.map:Y[Ve],lt=0;lt<qe.length;lt+=3){var at=qe[lt+2];if(at==Ne||at==ze){var gt=bt(Ve<0?e.line:e.rest[Ve]),wt=qe[lt]+Je;return(Je<0||at!=Ne)&&(wt=qe[lt+(Je?1:0)]),Fe(gt,wt)}}}var ce=ae(N,K,n);if(ce)return In(ce,i);for(var xe=K.nextSibling,be=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(ce=ae(xe,xe.firstChild,0),ce)return In(Fe(ce.line,ce.ch-be),i);be+=xe.textContent.length}for(var _e=K.previousSibling,Ie=n;_e;_e=_e.previousSibling){if(ce=ae(_e,_e.firstChild,-1),ce)return In(Fe(ce.line,ce.ch+Ie),i);Ie+=_e.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Ut.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),p&&(i.style.width="0px"),Ce(i,"input",function(){B&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ce(i,"paste",function(N){if(Ue(r,N)||vs(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function E(N){if(Ue(r,N))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=bs(r);Yi({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,me):(n.prevInput="",i.value=K.text.join(`
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ce(i,"cut",E),Ce(i,"copy",E),Ce(e.scroller,"paste",function(N){if(Rr(e,N)||Ue(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Ce(e.lineSpace,"selectstart",function(N){Rr(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)})},Ut.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),E=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-E.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-E.left))}return r},Ut.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")},Ut.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&I>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ut.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Ut.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(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&&I>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var E=i.charCodeAt(0);if(E==8203&&!r&&(r="\u200B"),E==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return ir(t,function(){Pa(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){B&&I>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var E=nn(n,e),N=r.scroller.scrollTop;if(!E||A)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(E)==-1&&jt(n,Yt)(n.doc,Wr(E),me);var G=i.style.cssText,Y=t.wrapper.style.cssText,ae=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ae.top-5)+"px; left: "+(e.clientX-ae.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 ce;O&&(ce=window.scrollY),r.input.focus(),O&&window.scrollTo(null,ce),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ie=n.somethingSelected(),Ne="\u200B"+(Ie?i.value:"");i.value="\u21DA",i.value=Ne,t.prevInput=Ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ne.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=G,B&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&I<9)&&xe();var Ie=0,Ne=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Wo)(n):Ie++<10?r.detectingSelectAll=setTimeout(Ne,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ne,200)}}if(B&&I>=9&&xe(),w){te(e);var _e=function(){Qe(window,"mouseup",_e),setTimeout(be,20)};Ce(window,"mouseup",_e)}else setTimeout(be,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?k(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Ce(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var E=e.form;i=E.submit;try{var N=E.submit=function(){r(),E.submit=i,E.submit(),E.submit=N}}catch(G){}}t.finishInit=function(G){G.save=r,G.getTextArea=function(){return e},G.toTextArea=function(){G.toTextArea=isNaN,r(),e.parentNode.removeChild(G.getWrapperElement()),e.style.display="",e.form&&(Qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=_t(function(G){return e.parentNode.insertBefore(G,e.nextSibling)},t);return K}function iu(e){e.off=Qe,e.on=Ce,e.wheelEventPixels=cl,e.Doc=qt,e.splitLines=pt,e.countColumn=H,e.findColumn=fe,e.isWordChar=we,e.Pass=Ee,e.signal=Re,e.Line=Lt,e.changeEnd=Hr,e.scrollbarModel=vo,e.Pos=Fe,e.cmpPos=dt,e.modes=yt,e.mimeModes=He,e.resolveMode=or,e.getMode=Dt,e.modeExtensions=sr,e.extendMode=Xr,e.copyState=lr,e.startState=fn,e.innerMode=ur,e.commands=mi,e.keyMap=_r,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=kn,e.normalizeKeyMap=Pl,e.StringStream=Ot,e.SharedTextMarker=ci,e.TextMarker=Gr,e.LineWidget=di,e.e_preventDefault=$,e.e_stopPropagation=J,e.e_stop=te,e.addClass=F,e.contains=b,e.rmClass=f,e.keyNames=zr}$l(_t),ql(_t);var au="iter insert remove copy getEditor constructor".split(" ");for(var Qi in qt.prototype)qt.prototype.hasOwnProperty(Qi)&&q(au,Qi)<0&&(_t.prototype[Qi]=function(e){return function(){return e.apply(this.doc,arguments)}}(qt.prototype[Qi]));return de(qt),_t.inputStyles={textarea:Ut,contenteditable:xt},_t.defineMode=function(e){!_t.defaults.mode&&e!="null"&&(_t.defaults.mode=e),hr.apply(this,arguments)},_t.defineMIME=mr,_t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),_t.defineMIME("text/plain","null"),_t.defineExtension=function(e,t){_t.prototype[e]=t},_t.defineDocExtension=function(e,t){qt.prototype[e]=t},_t.fromTextArea=nu,iu(_t),_t.version="5.58.2",_t})},Y1PL:function(ct,et,se){"use strict";se.r(et),se.d(et,"ResizableTextArea",function(){return q});var ie=se("wx14"),V=se("1OyB"),L=se("vuIU"),z=se("Ji7U"),U=se("LK+K"),R=se("q1tI"),B=se("VTBJ"),I=se("rePB"),O=se("Zm9Q"),D=se("Kwbf"),x=se("c+Xe"),A=se("m+aA"),P=se("bdgK"),C=new Map;function T(me){me.forEach(function(Se){var ve,fe=Se.target;(ve=C.get(fe))===null||ve===void 0||ve.forEach(function(ue){return ue(fe)})})}var p=new P.default(T),u=null,o=null;function s(me,Se){C.has(me)||(C.set(me,new Set),p.observe(me)),C.get(me).add(Se)}function l(me,Se){C.has(me)&&(C.get(me).delete(Se),C.get(me).size||(p.unobserve(me),C.delete(me)))}var S=function(me){Object(z.a)(ve,me);var Se=Object(U.a)(ve);function ve(){return Object(V.a)(this,ve),Se.apply(this,arguments)}return Object(L.a)(ve,[{key:"render",value:function(){return this.props.children}}]),ve}(R.Component),c=R.createContext(null);function m(me){var Se=me.children,ve=me.onBatchResize,fe=R.useRef(0),ue=R.useRef([]),he=R.useContext(c),Q=R.useCallback(function(ne,Z,ge){fe.current+=1;var Te=fe.current;ue.current.push({size:ne,element:Z,data:ge}),Promise.resolve().then(function(){Te===fe.current&&(ve==null||ve(ue.current),ue.current=[])}),he==null||he(ne,Z,ge)},[ve,he]);return R.createElement(c.Provider,{value:Q},Se)}function w(me){var Se=me.children,ve=me.disabled,fe=R.useRef(null),ue=R.useRef(null),he=R.useContext(c),Q=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=R.isValidElement(Se)&&Object(x.c)(Se),Z=ne?Se.ref:null,ge=R.useMemo(function(){return Object(x.a)(Z,fe)},[Z,fe]),Te=R.useRef(me);Te.current=me;var pe=R.useCallback(function(we){var Oe=Te.current,ke=Oe.onResize,Pe=Oe.data,De=we.getBoundingClientRect(),Le=De.width,We=De.height,Ye=we.offsetWidth,Xe=we.offsetHeight,Ke=Math.floor(Le),Ze=Math.floor(We);if(Q.current.width!==Ke||Q.current.height!==Ze||Q.current.offsetWidth!==Ye||Q.current.offsetHeight!==Xe){var je={width:Ke,height:Ze,offsetWidth:Ye,offsetHeight:Xe};Q.current=je;var Be=Ye===Math.round(Le)?Le:Ye,Ce=Xe===Math.round(We)?We:Xe,$e=Object(B.a)(Object(B.a)({},je),{},{offsetWidth:Be,offsetHeight:Ce});he==null||he($e,we,Pe),ke&&Promise.resolve().then(function(){ke($e,we)})}},[]);return R.useEffect(function(){var we=Object(A.a)(fe.current)||Object(A.a)(ue.current);return we&&!ve&&s(we,pe),function(){return l(we,pe)}},[fe.current,ve]),R.createElement(S,{ref:ue},ne?R.cloneElement(Se,{ref:ge}):Se)}var y="rc-observer-key";function f(me){var Se=me.children,ve=Object(O.a)(Se);return ve.map(function(fe,ue){var he=(fe==null?void 0:fe.key)||"".concat(y,"-").concat(ue);return R.createElement(w,Object(ie.a)({},me,{key:he}),fe)})}f.Collection=m;var h=f,d=se("bT9E"),a=se("TSYQ"),v=se.n(a),g=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,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(me){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ve=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(Se&&M[ve])return M[ve];var fe=window.getComputedStyle(me),ue=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),he=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),Q=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ne=b.map(function(ge){return"".concat(ge,":").concat(fe.getPropertyValue(ge))}).join(";"),Z={sizingStyle:ne,paddingSize:he,borderSize:Q,boxSizing:ue};return Se&&ve&&(M[ve]=Z),Z}function W(me){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=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)),me.getAttribute("wrap")?F.setAttribute("wrap",me.getAttribute("wrap")):F.removeAttribute("wrap");var ue=j(me,Se),he=ue.paddingSize,Q=ue.borderSize,ne=ue.boxSizing,Z=ue.sizingStyle;F.setAttribute("style","".concat(Z,";").concat(g)),F.value=me.value||me.placeholder||"";var ge=Number.MIN_SAFE_INTEGER,Te=Number.MAX_SAFE_INTEGER,pe=F.scrollHeight,we;if(ne==="border-box"?pe+=Q:ne==="content-box"&&(pe-=he),ve!==null||fe!==null){F.value=" ";var Oe=F.scrollHeight-he;ve!==null&&(ge=Oe*ve,ne==="border-box"&&(ge=ge+he+Q),pe=Math.max(ge,pe)),fe!==null&&(Te=Oe*fe,ne==="border-box"&&(Te=Te+he+Q),we=pe>Te?"":"hidden",pe=Math.min(Te,pe))}return{height:pe,minHeight:ge,maxHeight:Te,overflowY:we,resize:"none"}}var _=se("Gytx"),k=se.n(_),H;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(me){Object(z.a)(ve,me);var Se=Object(U.a)(ve);function ve(fe){var ue;return Object(V.a)(this,ve),ue=Se.call(this,fe),ue.nextFrameActionId=void 0,ue.resizeFrameId=void 0,ue.textArea=void 0,ue.saveTextArea=function(he){ue.textArea=he},ue.handleResize=function(he){var Q=ue.state.resizeStatus,ne=ue.props,Z=ne.autoSize,ge=ne.onResize;if(Q!==H.NONE)return;typeof ge=="function"&&ge(he),Z&&ue.resizeOnNextFrame()},ue.resizeOnNextFrame=function(){cancelAnimationFrame(ue.nextFrameActionId),ue.nextFrameActionId=requestAnimationFrame(ue.resizeTextarea)},ue.resizeTextarea=function(){var he=ue.props.autoSize;if(!he||!ue.textArea)return;var Q=he.minRows,ne=he.maxRows,Z=W(ue.textArea,!1,Q,ne);ue.setState({textareaStyles:Z,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ue.resizeFrameId),ue.resizeFrameId=requestAnimationFrame(function(){ue.setState({resizeStatus:H.RESIZED},function(){ue.resizeFrameId=requestAnimationFrame(function(){ue.setState({resizeStatus:H.NONE}),ue.fixFirefoxAutoScroll()})})})})},ue.renderTextArea=function(){var he=ue.props,Q=he.prefixCls,ne=Q===void 0?"rc-textarea":Q,Z=he.autoSize,ge=he.onResize,Te=he.className,pe=he.disabled,we=ue.state,Oe=we.textareaStyles,ke=we.resizeStatus,Pe=Object(d.a)(ue.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=v()(ne,Te,Object(I.a)({},"".concat(ne,"-disabled"),pe));"value"in Pe&&(Pe.value=Pe.value||"");var Le=Object(B.a)(Object(B.a)(Object(B.a)({},ue.props.style),Oe),ke===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(h,{onResize:ue.handleResize,disabled:!(Z||ge)},R.createElement("textarea",Object(ie.a)({},Pe,{className:De,style:Le,ref:ue.saveTextArea})))},ue.state={textareaStyles:{},resizeStatus:H.NONE},ue}return Object(L.a)(ve,[{key:"componentDidUpdate",value:function(ue){(ue.value!==this.props.value||!k()(ue.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 ue=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ue,he)}}catch(Q){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ve}(R.Component),q=X,re=function(me){Object(z.a)(ve,me);var Se=Object(U.a)(ve);function ve(fe){var ue;Object(V.a)(this,ve),ue=Se.call(this,fe),ue.resizableTextArea=void 0,ue.focus=function(){ue.resizableTextArea.textArea.focus()},ue.saveTextArea=function(Q){ue.resizableTextArea=Q},ue.handleChange=function(Q){var ne=ue.props.onChange;ue.setValue(Q.target.value,function(){ue.resizableTextArea.resizeTextarea()}),ne&&ne(Q)},ue.handleKeyDown=function(Q){var ne=ue.props,Z=ne.onPressEnter,ge=ne.onKeyDown;Q.keyCode===13&&Z&&Z(Q),ge&&ge(Q)};var he=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ue.state={value:he},ue}return Object(L.a)(ve,[{key:"setValue",value:function(ue,he){"value"in this.props||this.setState({value:ue},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(q,Object(ie.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ue){return"value"in ue?{value:ue.value}:null}}]),ve}(R.Component),Ee=et.default=re},ZW9T:function(ct,et,se){"use strict";se.d(et,"a",function(){return S});var ie=se("k1fw"),V=se("miYZ"),L=se("tsqr"),z=se("rAM+"),U=se("tJVT"),R=se("PpiC"),B=se("q1tI"),I=se.n(B),O=se("bdgK");function D(c,m,w,y,f){var h=m.getWordUntilPosition(w),d={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:h.startColumn,endColumn:h.endColumn},a=y.map(function(v){return{label:v,kind:c.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:d}});return f.map(function(v){a.push(Object(ie.a)(Object(ie.a)({},v),{},{range:d}))}),a}var x=function(c){var m={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];c.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(d,a){var v=D(c,d,a,w,[m]);return{suggestions:v}}});var y=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];c.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(d,a){var v=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=D(c,d,a,y,v);return{suggestions:g}}});var f=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];c.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(d,a){var v=[m,{label:"main",kind:c.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:c.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=D(c,d,a,f,v);return{suggestions:g}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=se("LvDl");function C(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function T(){}var p=!1,u={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=c;if(Array.isArray(c)){for(var w=0;w<c.length;w++){var y=u[c[w]];if(y)return y}return m[0]}return u[m]||m}var s=null,l=et.b=function(c){var m=c.width,w=m===void 0?"100%":m,y=c.height,f=y===void 0?"100%":y,h=c.value,d=c.language,a=d===void 0?"javascript":d,v=c.style,g=v===void 0?{}:v,b=c.options,M=b===void 0?{}:b,F=c.overrideServices,j=F===void 0?{}:F,W=c.theme,_=W===void 0?"vs-dark":W,k=c.onEditBlur,H=c.onSave,X=c.autoHeight,q=X===void 0?!1:X,re=c.forbidCopy,Ee=re===void 0?!1:re,me=c.onChange,Se=me===void 0?T:me,ve=c.editorDidMount,fe=ve===void 0?T:ve,ue=c.onFocus,he=ue===void 0?T:ue,Q=c.filename,ne=Q===void 0?"educoder.txt":Q,Z=Object(R.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ge=Object(B.useRef)(),Te=Object(B.useRef)({}),pe=Object(B.useRef)(),we=Object(B.useRef)(!1),Oe=Object(B.useRef)(),ke=Object(B.useState)(!1),Pe=Object(U.a)(ke,2),De=Pe[0],Le=Pe[1];function We(){var ee;return ge.current&&(ee=new O.default(function(te){var ye=Object(z.a)(te),Ae;try{for(ye.s();!(Ae=ye.n()).done;){var Me=Ae.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&Te.current.instance.layout()}}catch(tt){ye.e(tt)}finally{ye.f()}}),ee.observe(ge.current)),ee}function Ye(){L.b.warn(decodeURIComponent(A))}var Xe=function(){var te=Te.current.instance;if(h!=null&&te&&De){var ye=te.getModel();ye&&h!==ye.getValue()&&(p=!0,ye.setValue(h),te.layout(),p=!1)}};Object(B.useEffect)(function(){pe.current&&clearTimeout(pe.current),pe.current=setTimeout(function(){Xe()},500)},[h,De,Te.current]);function Ke(){var ee=Te.current.instance;if(ee){var te=ee.getSelection(),ye=Te.current.pastePos||{},Ae=new s.Range(ye.startLineNumber||te.endLineNumber,ye.startColumn||te.endColumn,ye.endLineNumber||te.endLineNumber,ye.endColumn||te.endColumn);setTimeout(function(){ee.executeEdits("",[{range:Ae,text:""}])},300)}}function Ze(ee){(window.navigator.platform.match("Mac")?ee.metaKey:ee.ctrlKey)&&ee.keyCode==83&&(ee.preventDefault(),H())}var je=function(){if(q&&Te.current.instance){var te=Te.current.instance.getContentHeight();$(te<f?f:te)}else $(f)};function Be(ee){var te=document.createEvent("MouseEvents");te.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ee.dispatchEvent(te)}function Ce(ee,te){var ye=window.URL||window.webkitURL||window,Ae=new Blob([te]),Me=document.createElementNS("http://www.w3.org/1999/xhtml","a");Me.href=ye.createObjectURL(Ae),Me.download=ee,Be(Me)}Object(B.useEffect)(function(){je()},[je]),Object(B.useEffect)(function(){ge.current&&!De&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(ee){try{s=ee,Te.current.instance=s.editor.create(ge.current,{value:h,language:o(a),theme:_,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var te=Te.current.instance;if(fe(te,s),setTimeout(function(){je(),Te.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ce(ne||"educoder.txt",te.getValue())}})},500),Te.current.subscription=te.onDidChangeModelContent(function(Ae){we.current?clearTimeout(Oe.current):(je(),Se(te.getValue(),Ae)),Oe.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||x(s),Ee&&(te.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Ye(),null}),te.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Ye(),null})),window.Monaco=s,k&&te.onDidBlurEditorWidget(function(){k(te.getValue())}),he&&te.onDidFocusEditorText(function(){he(te.getValue())}),Ee){te.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Ye(),null}),te.onDidPaste(function(Ae){Te.current.pastePos=Ae});try{window.addEventListener("paste",Ke)}catch(Ae){}}var ye=We();return Le(!0),function(){var Ae=Te.current.instance;Ae.dispose();var Me=Ae.getModel();Me&&Me.dispose(),Te.current.subscription&&Te.current.subscription.dispose(),Ee&&window.removeEventListener("paste",Ke),ye.unobserve(ge.current)}}catch(Ae){}})},[]),Object(B.useEffect)(function(){var ee=Te.current.instance;if(ee&&De)return document.addEventListener("keydown",Ze,!1),function(){document.removeEventListener("keydown",Ze)}},[H,De]),Object(B.useEffect)(function(){var ee=Te.current.instance;if(ee&&De){var te=o(a);s.editor.setModelLanguage(ee.getModel(),te),console.log("language:",a,ee.getModel(),te)}},[a,De]),Object(B.useEffect)(function(){var ee=Te.current.instance;ee&&De&&s.editor.setTheme(_)},[_,De]),Object(B.useEffect)(function(){var ee=Te.current.instance;ee&&De&&(ee.updateOptions(Object(ie.a)({},M)),setTimeout(function(){ee.getModel().updateOptions(Object(ie.a)({},M))},200))},[JSON.stringify(M),De]),Object(B.useEffect)(function(){var ee=Te.current.instance;ee&&De&&ee.layout()},[w,f,De]);var $e=Object(B.useState)(C(w)),Qe=Object(U.a)($e,2),Re=Qe[0],Ue=Qe[1],oe=Object(B.useState)(C(f)),le=Object(U.a)(oe,2),de=le[0],$=le[1],J=Object(ie.a)(Object(ie.a)({},g),{},{width:Re,height:de});return I.a.createElement("div",{className:"my-monaco-editor",ref:ge,style:J})};function S(c){var m=c.width,w=m===void 0?"100%":m,y=c.height,f=y===void 0?"100%":y,h=c.original,d=c.modified,a=c.language,v=c.options,g=v===void 0?{}:v,b=Object(B.useRef)(),M=Object(B.useState)(null),F=Object(U.a)(M,2),j=F[0],W=F[1];function _(q){var re;return b.current&&(re=new O.default(function(Ee){var me=Object(z.a)(Ee),Se;try{for(me.s();!(Se=me.n()).done;){var ve=Se.value;(ve.target.offsetHeight>0||ve.target.offsetWidth>0)&&q.layout()}}catch(fe){me.e(fe)}finally{me.f()}}),re.observe(b.current)),re}Object(B.useEffect)(function(){b.current&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(q){s=q;var re=s.editor.createDiffEditor(b.current,Object(ie.a)(Object(ie.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},g),{},{wordWrap:!0}));W(re);var Ee=_(re);return function(){re.dispose();var me=re.getModel();me&&me.dispose(),Ee.unobserve(b.current)}})},[]),Object(B.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(h,a),modified:s.editor.createModel(d,a)})},[h,d,a,j]);var k=C(w),H=C(f),X={width:k,height:H};return I.a.createElement("div",{className:"my-diff-editor",ref:b,style:X})}},ZpRC:function(ct,et,se){"use strict";function ie(x){return typeof x=="object"&&x!=null&&x.nodeType===1}function V(x,A){return(!A||x!=="hidden")&&x!=="visible"&&x!=="clip"}function L(x,A){if(x.clientHeight<x.scrollHeight||x.clientWidth<x.scrollWidth){var P=getComputedStyle(x,null);return V(P.overflowY,A)||V(P.overflowX,A)||function(C){var T=function(p){if(!p.ownerDocument||!p.ownerDocument.defaultView)return null;try{return p.ownerDocument.defaultView.frameElement}catch(u){return null}}(C);return!!T&&(T.clientHeight<C.scrollHeight||T.clientWidth<C.scrollWidth)}(x)}return!1}function z(x,A,P,C,T,p,u,o){return p<x&&u>A||p>x&&u<A?0:p<=x&&o<=P||u>=A&&o>=P?p-x-C:u>A&&o<P||p<x&&o>P?u-A+T:0}var U=function(x,A){var P=window,C=A.scrollMode,T=A.block,p=A.inline,u=A.boundary,o=A.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Oe){return Oe!==u};if(!ie(x))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,S=[],c=x;ie(c)&&s(c);){if((c=c.parentElement)===l){S.push(c);break}c!=null&&c===document.body&&L(c)&&!L(document.documentElement)||c!=null&&L(c,o)&&S.push(c)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,w=P.visualViewport?P.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,h=x.getBoundingClientRect(),d=h.height,a=h.width,v=h.top,g=h.right,b=h.bottom,M=h.left,F=T==="start"||T==="nearest"?v:T==="end"?b:v+d/2,j=p==="center"?M+a/2:p==="end"?g:M,W=[],_=0;_<S.length;_++){var k=S[_],H=k.getBoundingClientRect(),X=H.height,q=H.width,re=H.top,Ee=H.right,me=H.bottom,Se=H.left;if(C==="if-needed"&&v>=0&&M>=0&&b<=w&&g<=m&&v>=re&&b<=me&&M>=Se&&g<=Ee)return W;var ve=getComputedStyle(k),fe=parseInt(ve.borderLeftWidth,10),ue=parseInt(ve.borderTopWidth,10),he=parseInt(ve.borderRightWidth,10),Q=parseInt(ve.borderBottomWidth,10),ne=0,Z=0,ge="offsetWidth"in k?k.offsetWidth-k.clientWidth-fe-he:0,Te="offsetHeight"in k?k.offsetHeight-k.clientHeight-ue-Q:0;if(l===k)ne=T==="start"?F:T==="end"?F-w:T==="nearest"?z(f,f+w,w,ue,Q,f+F,f+F+d,d):F-w/2,Z=p==="start"?j:p==="center"?j-m/2:p==="end"?j-m:z(y,y+m,m,fe,he,y+j,y+j+a,a),ne=Math.max(0,ne+f),Z=Math.max(0,Z+y);else{ne=T==="start"?F-re-ue:T==="end"?F-me+Q+Te:T==="nearest"?z(re,me,X,ue,Q+Te,F,F+d,d):F-(re+X/2)+Te/2,Z=p==="start"?j-Se-fe:p==="center"?j-(Se+q/2)+ge/2:p==="end"?j-Ee+he+ge:z(Se,Ee,q,fe,he+ge,j,j+a,a);var pe=k.scrollLeft,we=k.scrollTop;F+=we-(ne=Math.max(0,Math.min(we+ne,k.scrollHeight-X+Te))),j+=pe-(Z=Math.max(0,Math.min(pe+Z,k.scrollWidth-q+ge)))}W.push({el:k,top:ne,left:Z})}return W};function R(x){return x===Object(x)&&Object.keys(x).length!==0}function B(x,A){A===void 0&&(A="auto");var P="scrollBehavior"in document.body.style;x.forEach(function(C){var T=C.el,p=C.top,u=C.left;T.scroll&&P?T.scroll({top:p,left:u,behavior:A}):(T.scrollTop=p,T.scrollLeft=u)})}function I(x){return x===!1?{block:"end",inline:"nearest"}:R(x)?x:{block:"start",inline:"nearest"}}function O(x,A){var P=!x.ownerDocument.documentElement.contains(x);if(R(A)&&typeof A.behavior=="function")return A.behavior(P?[]:U(x,A));if(P)return;var C=I(A);return B(U(x,C),C.behavior)}var D=et.a=O},Zss7:function(ct,et,se){var ie;(function(V){var L=/^\s+/,z=/\s+$/,U=0,R=V.round,B=V.min,I=V.max,O=V.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=x(Q);this._originalInput=Q,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=R(100*this._a)/100,this._format=ne.format||Z.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Z.ok,this._tc_id=U++}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,ge,Te,pe,we;return ne=Q.r/255,Z=Q.g/255,ge=Q.b/255,ne<=.03928?Te=ne/12.92:Te=V.pow((ne+.055)/1.055,2.4),Z<=.03928?pe=Z/12.92:pe=V.pow((Z+.055)/1.055,2.4),ge<=.03928?we=ge/12.92:we=V.pow((ge+.055)/1.055,2.4),.2126*Te+.7152*pe+.0722*we},setAlpha:function(Q){return this._a=W(Q),this._roundA=R(100*this._a)/100,this},toHsv:function(){var Q=T(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,v:Q.v,a:this._a}},toHsvString:function(){var Q=T(this._r,this._g,this._b),ne=R(Q.h*360),Z=R(Q.s*100),ge=R(Q.v*100);return this._a==1?"hsv("+ne+", "+Z+"%, "+ge+"%)":"hsva("+ne+", "+Z+"%, "+ge+"%, "+this._roundA+")"},toHsl:function(){var Q=P(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,l:Q.l,a:this._a}},toHslString:function(){var Q=P(this._r,this._g,this._b),ne=R(Q.h*360),Z=R(Q.s*100),ge=R(Q.l*100);return this._a==1?"hsl("+ne+", "+Z+"%, "+ge+"%)":"hsla("+ne+", "+Z+"%, "+ge+"%, "+this._roundA+")"},toHex:function(Q){return u(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:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(_(this._r,255)*100)+"%",g:R(_(this._g,255)*100)+"%",b:R(_(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(_(this._r,255)*100)+"%, "+R(_(this._g,255)*100)+"%, "+R(_(this._b,255)*100)+"%)":"rgba("+R(_(this._r,255)*100)+"%, "+R(_(this._g,255)*100)+"%, "+R(_(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(Q){var ne="#"+s(this._r,this._g,this._b,this._a),Z=ne,ge=this._gradientType?"GradientType = 1, ":"";if(Q){var Te=D(Q);Z="#"+s(Te._r,Te._g,Te._b,Te._a)}return"progid:DXImageTransform.Microsoft.gradient("+ge+"startColorstr="+ne+",endColorstr="+Z+")"},toString:function(Q){var ne=!!Q;Q=Q||this._format;var Z=!1,ge=this._a<1&&this._a>=0,Te=!ne&&ge&&(Q==="hex"||Q==="hex6"||Q==="hex3"||Q==="hex4"||Q==="hex8"||Q==="name");return Te?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(m,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function(Q,ne){return Q.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(h,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 ge in Q)Q.hasOwnProperty(ge)&&(ge==="a"?Z[ge]=Q[ge]:Z[ge]=Ee(Q[ge]));Q=Z}return D(Q,ne)};function x(Q){var ne={r:0,g:0,b:0},Z=1,ge=null,Te=null,pe=null,we=!1,Oe=!1;return typeof Q=="string"&&(Q=ue(Q)),typeof Q=="object"&&(fe(Q.r)&&fe(Q.g)&&fe(Q.b)?(ne=A(Q.r,Q.g,Q.b),we=!0,Oe=String(Q.r).substr(-1)==="%"?"prgb":"rgb"):fe(Q.h)&&fe(Q.s)&&fe(Q.v)?(ge=Ee(Q.s),Te=Ee(Q.v),ne=p(Q.h,ge,Te),we=!0,Oe="hsv"):fe(Q.h)&&fe(Q.s)&&fe(Q.l)&&(ge=Ee(Q.s),pe=Ee(Q.l),ne=C(Q.h,ge,pe),we=!0,Oe="hsl"),Q.hasOwnProperty("a")&&(Z=Q.a)),Z=W(Z),{ok:we,format:Q.format||Oe,r:B(255,I(ne.r,0)),g:B(255,I(ne.g,0)),b:B(255,I(ne.b,0)),a:Z}}function A(Q,ne,Z){return{r:_(Q,255)*255,g:_(ne,255)*255,b:_(Z,255)*255}}function P(Q,ne,Z){Q=_(Q,255),ne=_(ne,255),Z=_(Z,255);var ge=I(Q,ne,Z),Te=B(Q,ne,Z),pe,we,Oe=(ge+Te)/2;if(ge==Te)pe=we=0;else{var ke=ge-Te;we=Oe>.5?ke/(2-ge-Te):ke/(ge+Te);switch(ge){case Q:pe=(ne-Z)/ke+(ne<Z?6:0);break;case ne:pe=(Z-Q)/ke+2;break;case Z:pe=(Q-ne)/ke+4;break}pe/=6}return{h:pe,s:we,l:Oe}}function C(Q,ne,Z){var ge,Te,pe;Q=_(Q,360),ne=_(ne,100),Z=_(Z,100);function we(Pe,De,Le){return Le<0&&(Le+=1),Le>1&&(Le-=1),Le<1/6?Pe+(De-Pe)*6*Le:Le<1/2?De:Le<2/3?Pe+(De-Pe)*(2/3-Le)*6:Pe}if(ne===0)ge=Te=pe=Z;else{var Oe=Z<.5?Z*(1+ne):Z+ne-Z*ne,ke=2*Z-Oe;ge=we(ke,Oe,Q+1/3),Te=we(ke,Oe,Q),pe=we(ke,Oe,Q-1/3)}return{r:ge*255,g:Te*255,b:pe*255}}function T(Q,ne,Z){Q=_(Q,255),ne=_(ne,255),Z=_(Z,255);var ge=I(Q,ne,Z),Te=B(Q,ne,Z),pe,we,Oe=ge,ke=ge-Te;if(we=ge===0?0:ke/ge,ge==Te)pe=0;else{switch(ge){case Q:pe=(ne-Z)/ke+(ne<Z?6:0);break;case ne:pe=(Z-Q)/ke+2;break;case Z:pe=(Q-ne)/ke+4;break}pe/=6}return{h:pe,s:we,v:Oe}}function p(Q,ne,Z){Q=_(Q,360)*6,ne=_(ne,100),Z=_(Z,100);var ge=V.floor(Q),Te=Q-ge,pe=Z*(1-ne),we=Z*(1-Te*ne),Oe=Z*(1-(1-Te)*ne),ke=ge%6,Pe=[Z,we,pe,pe,Oe,Z][ke],De=[Oe,Z,Z,we,pe,pe][ke],Le=[pe,pe,Oe,Z,Z,we][ke];return{r:Pe*255,g:De*255,b:Le*255}}function u(Q,ne,Z,ge){var Te=[re(R(Q).toString(16)),re(R(ne).toString(16)),re(R(Z).toString(16))];return ge&&Te[0].charAt(0)==Te[0].charAt(1)&&Te[1].charAt(0)==Te[1].charAt(1)&&Te[2].charAt(0)==Te[2].charAt(1)?Te[0].charAt(0)+Te[1].charAt(0)+Te[2].charAt(0):Te.join("")}function o(Q,ne,Z,ge,Te){var pe=[re(R(Q).toString(16)),re(R(ne).toString(16)),re(R(Z).toString(16)),re(me(ge))];return Te&&pe[0].charAt(0)==pe[0].charAt(1)&&pe[1].charAt(0)==pe[1].charAt(1)&&pe[2].charAt(0)==pe[2].charAt(1)&&pe[3].charAt(0)==pe[3].charAt(1)?pe[0].charAt(0)+pe[1].charAt(0)+pe[2].charAt(0)+pe[3].charAt(0):pe.join("")}function s(Q,ne,Z,ge){var Te=[re(me(ge)),re(R(Q).toString(16)),re(R(ne).toString(16)),re(R(Z).toString(16))];return Te.join("")}D.equals=function(Q,ne){return!Q||!ne?!1:D(Q).toRgbString()==D(ne).toRgbString()},D.random=function(){return D.fromRatio({r:O(),g:O(),b:O()})};function l(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toHsl();return Z.s-=ne/100,Z.s=k(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=k(Z.s),D(Z)}function c(Q){return D(Q).desaturate(100)}function m(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toHsl();return Z.l+=ne/100,Z.l=k(Z.l),D(Z)}function w(Q,ne){ne=ne===0?0:ne||10;var Z=D(Q).toRgb();return Z.r=I(0,B(255,Z.r-R(255*-(ne/100)))),Z.g=I(0,B(255,Z.g-R(255*-(ne/100)))),Z.b=I(0,B(255,Z.b-R(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=k(Z.l),D(Z)}function f(Q,ne){var Z=D(Q).toHsl(),ge=(Z.h+ne)%360;return Z.h=ge<0?360+ge:ge,D(Z)}function h(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 g(Q,ne,Z){ne=ne||6,Z=Z||30;var ge=D(Q).toHsl(),Te=360/Z,pe=[D(Q)];for(ge.h=(ge.h-(Te*ne>>1)+720)%360;--ne;)ge.h=(ge.h+Te)%360,pe.push(D(ge));return pe}function b(Q,ne){ne=ne||6;for(var Z=D(Q).toHsv(),ge=Z.h,Te=Z.s,pe=Z.v,we=[],Oe=1/ne;ne--;)we.push(D({h:ge,s:Te,v:pe})),pe=(pe+Oe)%1;return we}D.mix=function(Q,ne,Z){Z=Z===0?0:Z||50;var ge=D(Q).toRgb(),Te=D(ne).toRgb(),pe=Z/100,we={r:(Te.r-ge.r)*pe+ge.r,g:(Te.g-ge.g)*pe+ge.g,b:(Te.b-ge.b)*pe+ge.b,a:(Te.a-ge.a)*pe+ge.a};return D(we)},D.readability=function(Q,ne){var Z=D(Q),ge=D(ne);return(V.max(Z.getLuminance(),ge.getLuminance())+.05)/(V.min(Z.getLuminance(),ge.getLuminance())+.05)},D.isReadable=function(Q,ne,Z){var ge=D.readability(Q,ne),Te,pe;pe=!1,Te=he(Z);switch(Te.level+Te.size){case"AAsmall":case"AAAlarge":pe=ge>=4.5;break;case"AAlarge":pe=ge>=3;break;case"AAAsmall":pe=ge>=7;break}return pe},D.mostReadable=function(Q,ne,Z){var ge=null,Te=0,pe,we,Oe,ke;Z=Z||{},we=Z.includeFallbackColors,Oe=Z.level,ke=Z.size;for(var Pe=0;Pe<ne.length;Pe++)pe=D.readability(Q,ne[Pe]),pe>Te&&(Te=pe,ge=D(ne[Pe]));return D.isReadable(Q,ge,{level:Oe,size:ke})||!we?ge:(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 _(Q,ne){X(Q)&&(Q="100%");var Z=q(Q);return Q=B(ne,I(0,parseFloat(Q))),Z&&(Q=parseInt(Q*ne,10)/100),V.abs(Q-ne)<1e-6?1:Q%ne/parseFloat(ne)}function k(Q){return B(1,I(0,Q))}function H(Q){return parseInt(Q,16)}function X(Q){return typeof Q=="string"&&Q.indexOf(".")!=-1&&parseFloat(Q)===1}function q(Q){return typeof Q=="string"&&Q.indexOf("%")!=-1}function re(Q){return Q.length==1?"0"+Q:""+Q}function Ee(Q){return Q<=1&&(Q=Q*100+"%"),Q}function me(Q){return V.round(parseFloat(Q)*255).toString(16)}function Se(Q){return H(Q)/255}var ve=function(){var Q="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ne+")|(?:"+Q+")",ge="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Te="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+ge),rgba:new RegExp("rgba"+Te),hsl:new RegExp("hsl"+ge),hsla:new RegExp("hsla"+Te),hsv:new RegExp("hsv"+ge),hsva:new RegExp("hsva"+Te),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 fe(Q){return!!ve.CSS_UNIT.exec(Q)}function ue(Q){Q=Q.replace(L,"").replace(z,"").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=ve.rgb.exec(Q))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=ve.rgba.exec(Q))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=ve.hsl.exec(Q))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=ve.hsla.exec(Q))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=ve.hsv.exec(Q))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=ve.hsva.exec(Q))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=ve.hex8.exec(Q))?{r:H(Z[1]),g:H(Z[2]),b:H(Z[3]),a:Se(Z[4]),format:ne?"name":"hex8"}:(Z=ve.hex6.exec(Q))?{r:H(Z[1]),g:H(Z[2]),b:H(Z[3]),format:ne?"name":"hex"}:(Z=ve.hex4.exec(Q))?{r:H(Z[1]+""+Z[1]),g:H(Z[2]+""+Z[2]),b:H(Z[3]+""+Z[3]),a:Se(Z[4]+""+Z[4]),format:ne?"name":"hex8"}:(Z=ve.hex3.exec(Q))?{r:H(Z[1]+""+Z[1]),g:H(Z[2]+""+Z[2]),b:H(Z[3]+""+Z[3]),format:ne?"name":"hex"}:!1}function he(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}}ct.exports?ct.exports=D:!(ie=function(){return D}.call(et,se,et,ct),ie!==void 0&&(ct.exports=ie))})(Math)},bT9E:function(ct,et,se){"use strict";se.d(et,"a",function(){return V});var ie=se("VTBJ");function V(L,z){var U=Object(ie.a)({},L);return Array.isArray(z)&&z.forEach(function(R){delete U[R]}),U}},c5Ni:function(ct,et,se){},dejd:function(ct,et,se){},dmUQ:function(ct,et,se){"use strict";var ie=se("Ff2n"),V=se("rePB"),L=se("1OyB"),z=se("vuIU"),U=se("Ji7U"),R=se("md7G"),B=se("foSv"),I=se("q1tI"),O=se.n(I),D=se("TSYQ"),x=se.n(D),A=se("4IlW");function P(d,a){var v=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);a&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),v.push.apply(v,g)}return v}function C(d){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?P(Object(v),!0).forEach(function(g){Object(V.a)(d,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(v)):P(Object(v)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(v,g))})}return d}function T(d){var a=p();return function(){var g=Object(B.a)(d),b;if(a){var M=Object(B.a)(this).constructor;b=Reflect.construct(g,arguments,M)}else b=g.apply(this,arguments);return Object(R.a)(this,b)}}function p(){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 u(){}function o(d){d.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,S=600,c=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},w=function(a,v){return v===a||typeof v=="number"&&typeof a=="number"&&isNaN(v)&&isNaN(a)},y=function(d){Object(U.a)(v,d);var a=T(v);function v(g){var b;Object(L.a)(this,v),b=a.call(this,g),b.onKeyDown=function(j){var W=b.props,_=W.onKeyDown,k=W.onPressEnter;if(j.keyCode===A.a.UP){var H=b.getRatio(j);b.up(j,H,null),b.stop()}else if(j.keyCode===A.a.DOWN){var X=b.getRatio(j);b.down(j,X,null),b.stop()}else j.keyCode===A.a.ENTER&&k&&k(j);if(b.recordCursorPosition(),b.lastKeyCode=j.keyCode,_){for(var q=arguments.length,re=new Array(q>1?q-1:0),Ee=1;Ee<q;Ee++)re[Ee-1]=arguments[Ee];_.apply(void 0,[j].concat(re))}},b.onKeyUp=function(j){var W=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),W){for(var _=arguments.length,k=new Array(_>1?_-1:0),H=1;H<_;H++)k[H-1]=arguments[H];W.apply(void 0,[j].concat(k))}},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),_=b.setValue(W,u);if(j){var k=b.input.value,H=b.getInputDisplayValue({focus:!1,value:_});b.input.value=H&&Number(H),j.apply(void 0,arguments),b.input.value=k}},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(m(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 _=0;return W.indexOf(".")>=0&&(_=W.length-W.indexOf(".")-1),_},b.getInputDisplayValue=function(j){var W=j||b.state,_=W.focused,k=W.inputValue,H=W.value,X;_?X=k:X=b.toPrecisionAsStep(H),X==null&&(X="");var q=b.formatWrapper(X);return m(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,_=W.lastIndexOf(j);if(_===-1)return!1;var k=b.cursorBefore.length;return b.lastKeyCode===A.a.DELETE&&b.cursorBefore.charAt(k-1)===j[0]?(b.fixCaret(k,k),!0):_+j.length===W.length?(b.fixCaret(_,_),!0):!1},b.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,_){var k=j.substring(_);return b.restoreByAfter(k)})},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,_){b.pressingUpOrDown=!0,b.step("down",j,W,_)},b.up=function(j,W,_){b.pressingUpOrDown=!0,b.step("up",j,W,_)},b.saveInput=function(j){b.input=j};var M=g.value;M===void 0&&(M=g.defaultValue),b.state={focused:g.autoFocus};var F=b.getValidValue(b.toNumber(M));return b.state=C(C({},b.state),{},{inputValue:b.toPrecisionAsStep(F),value:F}),b}return Object(z.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,_=M.min,k=this.state.focused;if(b){if(!w(b.value,F)||!w(b.max,W)||!w(b.min,_)){var H=k?F:this.getValidValue(F),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}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!==_&&typeof q=="number"&&q<_&&j&&j(_)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var re=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?re=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(re=this.cursorStart):re=this.input.value.length,this.fixCaret(re,re)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ee){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(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 m(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,_=W===void 0?null:W,k=this.state.inputValue,H=k===void 0?null:k,X=typeof j=="number"?j.toFixed(F):"".concat(j),q=j!==_||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(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(m(j))return j;var _=this.getPrecision(M),k=this.getPrecision(W),H=this.getPrecision(b);return b?Math.max(H,_+k):_+k}},{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:m(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)),_=((j*b+j*F*M)/j).toFixed(W);return this.toNumber(_)}},{key:"downStep",value:function(b,M){var F=this.props.step,j=this.getPrecisionFactor(b,M),W=Math.abs(this.getMaxPrecision(b,M)),_=((j*b-j*F*M)/j).toFixed(W);return this.toNumber(_)}},{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 _=this.props;if(_.disabled)return;var k=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(k))return;var H=this["".concat(b,"Step")](k,j),X=H>_.max||H<_.min;if(H>_.max?H=_.max:H<_.min&&(H=_.min),this.setValue(H,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){F[b](M,j,!0)},W?l: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,_=M.useTouch,k=M.autoComplete,H=M.upHandler,X=M.downHandler,q=M.className,re=M.max,Ee=M.min,me=M.style,Se=M.title,ve=M.onMouseEnter,fe=M.onMouseLeave,ue=M.onMouseOver,he=M.onMouseOut,Q=M.required,ne=M.onClick,Z=M.tabIndex,ge=M.type,Te=M.placeholder,pe=M.id,we=M.inputMode,Oe=M.pattern,ke=M.step,Pe=M.maxLength,De=M.autoFocus,Le=M.name,We=M.onPaste,Ye=M.onInput,Xe=Object(ie.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"]),Ke=this.state,Ze=Ke.value,je=Ke.focused,Be=x()(F,(b={},Object(V.a)(b,q,!!q),Object(V.a)(b,"".concat(F,"-disabled"),j),Object(V.a)(b,"".concat(F,"-focused"),je),b)),Ce={};Object.keys(Xe).forEach(function(te){(te.substr(0,5)==="data-"||te.substr(0,5)==="aria-"||te==="role")&&(Ce[te]=Xe[te])});var $e=!W&&!j,Qe=this.getInputDisplayValue(null),Re=(Ze||Ze===0)&&(isNaN(Ze)||Number(Ze)>=re),Ue=(Ze||Ze===0)&&(isNaN(Ze)||Number(Ze)<=Ee),oe=Re||j||W,le=Ue||j||W,de=x()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),oe)),$=x()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),le)),J=_?{onTouchStart:oe?u:this.up,onTouchEnd:this.stop}:{onMouseDown:oe?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=_?{onTouchStart:le?u:this.down,onTouchEnd:this.stop}:{onMouseDown:le?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:Be,style:me,title:Se,onMouseEnter:ve,onMouseLeave:fe,onMouseOver:ue,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(F,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":oe,className:de}),H||O.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),O.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:$}),X||O.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),O.a.createElement("div",{className:"".concat(F,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ee,"aria-valuemax":re,"aria-valuenow":Ze,required:Q,type:ge,placeholder:Te,onPaste:We,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Z,autoComplete:k,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:$e?this.onKeyDown:u,onKeyUp:$e?this.onKeyUp:u,autoFocus:De,maxLength:Pe,readOnly:W,disabled:j,max:re,min:Ee,step:ke,name:Le,title:Se,id:pe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Qe),pattern:Oe,inputMode:we,onInput:Ye},Ce))))}}]),v}(O.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:c,min:-c,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var f=y,h=et.a=f},h78n:function(ct,et,se){"use strict";se.d(et,"a",function(){return b});var ie=se("q1tI"),V=se.n(ie),L=se("TSYQ"),z=se.n(L),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(ie.useRef)()}),_=Object(ie.useRef)();return Object(ie.useEffect)(function(){var k=Date.now(),H=!1;Object.keys(W).forEach(function(X){var q=W[X].current;if(!q)return;H=!0;var re=q.style;re.transitionDuration=".3s, .3s, .3s, .06s",_.current&&k-_.current<100&&(re.transitionDuration="0s, 0s")}),H&&(_.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 _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(F[_]=W[_])}return F},B.apply(this,arguments)}function I(F,j){return P(F)||A(F,j)||D(F,j)||O()}function O(){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 x(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 x(F,j)}function x(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,_=new Array(j);W<j;W++)_[W]=F[W];return _}function A(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],_=!0,k=!1,H=void 0;try{for(var X=F[Symbol.iterator](),q;!(_=(q=X.next()).done)&&!(W.push(q.value),j&&W.length===j);_=!0);}catch(re){k=!0,H=re}finally{try{!_&&X.return!=null&&X.return()}finally{if(k)throw H}}return W}function P(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=T(F,j),_,k;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(k=0;k<H.length;k++){if(_=H[k],j.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,_))continue;W[_]=F[_]}}return W}function T(F,j){if(F==null)return{};var W={},_=Object.keys(F),k,H;for(H=0;H<_.length;H++){if(k=_[H],j.indexOf(k)>=0)continue;W[k]=F[k]}return W}var p=function(j){var W=j.className,_=j.percent,k=j.prefixCls,H=j.strokeColor,X=j.strokeLinecap,q=j.strokeWidth,re=j.style,Ee=j.trailColor,me=j.trailWidth,Se=j.transition,ve=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ve.gapPosition;var fe=Array.isArray(_)?_:[_],ue=Array.isArray(H)?H:[H],he=R(fe),Q=I(he,1),ne=Q[0],Z=q/2,ge=100-q/2,Te="M ".concat(X==="round"?Z:0,",").concat(Z,`
L `).concat(X==="round"?ge:100,",").concat(Z),pe="0 0 100 ".concat(q),we=0;return V.a.createElement("svg",B({className:z()("".concat(k,"-line"),W),viewBox:pe,preserveAspectRatio:"none",style:re},ve),V.a.createElement("path",{className:"".concat(k,"-line-trail"),d:Te,strokeLinecap:X,stroke:Ee,strokeWidth:me||q,fillOpacity:"0"}),fe.map(function(Oe,ke){var Pe={strokeDasharray:"".concat(Oe,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:Se||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},De=ue[ke]||ue[ue.length-1];return we+=Oe,V.a.createElement("path",{key:ke,className:"".concat(k,"-line-path"),d:Te,strokeLinecap:X,stroke:De,strokeWidth:q,fillOpacity:"0",ref:ne[ke],style:Pe})}))};p.defaultProps=U;var u=p;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var _ in W)Object.prototype.hasOwnProperty.call(W,_)&&(F[_]=W[_])}return F},o.apply(this,arguments)}function s(F,j){return w(F)||m(F,j)||S(F,j)||l()}function l(){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 c(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 c(F,j)}function c(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,_=new Array(j);W<j;W++)_[W]=F[W];return _}function m(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],_=!0,k=!1,H=void 0;try{for(var X=F[Symbol.iterator](),q;!(_=(q=X.next()).done)&&!(W.push(q.value),j&&W.length===j);_=!0);}catch(re){k=!0,H=re}finally{try{!_&&X.return!=null&&X.return()}finally{if(k)throw H}}return W}function w(F){if(Array.isArray(F))return F}function y(F,j){if(F==null)return{};var W=f(F,j),_,k;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(k=0;k<H.length;k++){if(_=H[k],j.indexOf(_)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,_))continue;W[_]=F[_]}}return W}function f(F,j){if(F==null)return{};var W={},_=Object.keys(F),k,H;for(H=0;H<_.length;H++){if(k=_[H],j.indexOf(k)>=0)continue;W[k]=F[k]}return W}var h=0;function d(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function v(F,j,W,_){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-_/2,q=0,re=-X,Ee=0,me=-2*X;switch(H){case"left":q=-X,re=0,Ee=2*X,me=0;break;case"right":q=X,re=0,Ee=-2*X,me=0;break;case"bottom":re=X,me=2*X;break;default:}var Se="M 50,50 m ".concat(q,",").concat(re,`
a `).concat(X,",").concat(X," 0 1 1 ").concat(Ee,",").concat(-me,`
a `).concat(X,",").concat(X," 0 1 1 ").concat(-Ee,",").concat(me),ve=Math.PI*2*X,fe={stroke:W,strokeDasharray:"".concat(j/100*(ve-k),"px ").concat(ve,"px"),strokeDashoffset:"-".concat(k/2+F/100*(ve-k),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Se,pathStyle:fe}}var g=function(j){var W=j.prefixCls,_=j.strokeWidth,k=j.trailWidth,H=j.gapDegree,X=j.gapPosition,q=j.trailColor,re=j.strokeLinecap,Ee=j.style,me=j.className,Se=j.strokeColor,ve=j.percent,fe=y(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ue=Object(ie.useMemo)(function(){return h+=1,h},[]),he=v(0,100,q,_,H,X),Q=he.pathString,ne=he.pathStyle,Z=a(ve),ge=a(Se),Te=ge.find(function(Pe){return Object.prototype.toString.call(Pe)==="[object Object]"}),pe=R(Z),we=s(pe,1),Oe=we[0],ke=function(){var De=0;return Z.map(function(Le,We){var Ye=ge[We]||ge[ge.length-1],Xe=Object.prototype.toString.call(Ye)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ue,")"):"",Ke=v(De,Le,Ye,_,H,X);return De+=Le,V.a.createElement("path",{key:We,className:"".concat(W,"-circle-path"),d:Ke.pathString,stroke:Xe,strokeLinecap:re,strokeWidth:_,opacity:Le===0?0:1,fillOpacity:"0",style:Ke.pathStyle,ref:Oe[We]})})};return V.a.createElement("svg",o({className:z()("".concat(W,"-circle"),me),viewBox:"0 0 100 100",style:Ee},fe),Te&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ue),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Te).sort(function(Pe,De){return d(Pe)-d(De)}).map(function(Pe,De){return V.a.createElement("stop",{key:De,offset:Pe,stopColor:Te[Pe]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:Q,stroke:q,strokeLinecap:re,strokeWidth:k||_,fillOpacity:"0",style:ne}),ke().reverse())};g.defaultProps=U;var b=g,M={Line:u,Circle:b}},kSUc:function(ct,et,se){},lZu9:function(ct,et,se){(function(ie){ie(se("VrN/"),se("1eCo"),se("8EBN"))})(function(ie){"use strict";ie.defineMode("markdown",function(V,L){var z=ie.getMode(V,"text/html"),U=z.name=="null";function R(_){if(ie.findModeByName){var k=ie.findModeByName(_);k&&(_=k.mime||k.mimes[0])}var H=ie.getMode(V,_);return H.name=="null"?null:H}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var I in B)B.hasOwnProperty(I)&&L.tokenTypeOverrides[I]&&(B[I]=L.tokenTypeOverrides[I]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,A=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(_,k,H){return k.f=k.inline=H,H(_,k)}function l(_,k,H){return k.f=k.block=H,H(_,k)}function S(_){return!_||!/\S/.test(_.string)}function c(_){if(_.linkTitle=!1,_.linkHref=!1,_.linkText=!1,_.em=!1,_.strong=!1,_.strikethrough=!1,_.quote=0,_.indentedCode=!1,_.f==w){var k=U;if(!k){var H=ie.innerMode(z,_.htmlState);k=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}k&&(_.f=d,_.block=m,_.htmlState=null)}return _.trailingSpace=0,_.trailingSpaceNewLine=!1,_.prevLine=_.thisLine,_.thisLine={stream:null},null}function m(_,k){var H=_.column()===k.indentation,X=S(k.prevLine.stream),q=k.indentedCode,re=k.prevLine.hr,Ee=k.list!==!1,me=(k.listStack[k.listStack.length-1]||0)+3;k.indentedCode=!1;var Se=k.indentation;if(k.indentationDiff===null&&(k.indentationDiff=k.indentation,Ee)){for(k.list=null;Se<k.listStack[k.listStack.length-1];)k.listStack.pop(),k.listStack.length?k.indentation=k.listStack[k.listStack.length-1]:k.list=!1;k.list!==!1&&(k.indentationDiff=Se-k.listStack[k.listStack.length-1])}var ve=!X&&!re&&!k.prevLine.header&&(!Ee||!q)&&!k.prevLine.fencedCodeEnd,fe=(k.list===!1||re||X)&&k.indentation<=me&&_.match(O),ue=null;if(k.indentationDiff>=4&&(q||k.prevLine.fencedCodeEnd||k.prevLine.header||X))return _.skipToEnd(),k.indentedCode=!0,B.code;if(_.eatSpace())return null;if(H&&k.indentation<=me&&(ue=_.match(A))&&ue[1].length<=6)return k.quote=0,k.header=ue[1].length,k.thisLine.header=!0,L.highlightFormatting&&(k.formatting="header"),k.f=k.inline,f(k);if(k.indentation<=me&&_.eat(">"))return k.quote=H?1:k.quote+1,L.highlightFormatting&&(k.formatting="quote"),_.eatSpace(),f(k);if(!fe&&!k.setext&&H&&k.indentation<=me&&(ue=_.match(D))){var he=ue[1]?"ol":"ul";return k.indentation=Se+_.current().length,k.list=!0,k.quote=0,k.listStack.push(k.indentation),k.em=!1,k.strong=!1,k.code=!1,k.strikethrough=!1,L.taskLists&&_.match(x,!1)&&(k.taskList=!0),k.f=k.inline,L.highlightFormatting&&(k.formatting=["list","list-"+he]),f(k)}else{if(H&&k.indentation<=me&&(ue=_.match(T,!0)))return k.quote=0,k.fencedEndRE=new RegExp(ue[1]+"+ *$"),k.localMode=L.fencedCodeBlockHighlighting&&R(ue[2]||L.fencedCodeBlockDefaultMode),k.localMode&&(k.localState=ie.startState(k.localMode)),k.f=k.block=y,L.highlightFormatting&&(k.formatting="code-block"),k.code=-1,f(k);if(k.setext||(!ve||!Ee)&&!k.quote&&k.list===!1&&!k.code&&!fe&&!p.test(_.string)&&(ue=_.lookAhead(1))&&(ue=ue.match(P)))return k.setext?(k.header=k.setext,k.setext=0,_.skipToEnd(),L.highlightFormatting&&(k.formatting="header")):(k.header=ue[0].charAt(0)=="="?1:2,k.setext=k.header),k.thisLine.header=!0,k.f=k.inline,f(k);if(fe)return _.skipToEnd(),k.hr=!0,k.thisLine.hr=!0,B.hr;if(_.peek()==="[")return s(_,k,M)}return s(_,k,k.inline)}function w(_,k){var H=z.token(_,k.htmlState);if(!U){var X=ie.innerMode(z,k.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||k.md_inside&&_.current().indexOf(">")>-1)&&(k.f=d,k.block=m,k.htmlState=null)}return H}function y(_,k){var H=k.listStack[k.listStack.length-1]||0,X=k.indentation<H,q=H+3;if(k.fencedEndRE&&k.indentation<=q&&(X||_.match(k.fencedEndRE))){L.highlightFormatting&&(k.formatting="code-block");var re;return X||(re=f(k)),k.localMode=k.localState=null,k.block=m,k.f=d,k.fencedEndRE=null,k.code=0,k.thisLine.fencedCodeEnd=!0,X?l(_,k,k.block):re}else return k.localMode?k.localMode.token(_,k.localState):(_.skipToEnd(),B.code)}function f(_){var k=[];if(_.formatting){k.push(B.formatting),typeof _.formatting=="string"&&(_.formatting=[_.formatting]);for(var H=0;H<_.formatting.length;H++)k.push(B.formatting+"-"+_.formatting[H]),_.formatting[H]==="header"&&k.push(B.formatting+"-"+_.formatting[H]+"-"+_.header),_.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?k.push(B.formatting+"-"+_.formatting[H]+"-"+_.quote):k.push("error"))}if(_.taskOpen)return k.push("meta"),k.length?k.join(" "):null;if(_.taskClosed)return k.push("property"),k.length?k.join(" "):null;if(_.linkHref?k.push(B.linkHref,"url"):(_.strong&&k.push(B.strong),_.em&&k.push(B.em),_.strikethrough&&k.push(B.strikethrough),_.emoji&&k.push(B.emoji),_.linkText&&k.push(B.linkText),_.code&&k.push(B.code),_.image&&k.push(B.image),_.imageAltText&&k.push(B.imageAltText,"link"),_.imageMarker&&k.push(B.imageMarker)),_.header&&k.push(B.header,B.header+"-"+_.header),_.quote&&(k.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=_.quote?k.push(B.quote+"-"+_.quote):k.push(B.quote+"-"+L.maxBlockquoteDepth)),_.list!==!1){var X=(_.listStack.length-1)%3;X?X===1?k.push(B.list2):k.push(B.list3):k.push(B.list1)}return _.trailingSpaceNewLine?k.push("trailing-space-new-line"):_.trailingSpace&&k.push("trailing-space-"+(_.trailingSpace%2?"a":"b")),k.length?k.join(" "):null}function h(_,k){return _.match(C,!0)?f(k):void 0}function d(_,k){var H=k.text(_,k);if(typeof H!="undefined")return H;if(k.list)return k.list=null,f(k);if(k.taskList){var X=_.match(x,!0)[1]===" ";return X?k.taskOpen=!0:k.taskClosed=!0,L.highlightFormatting&&(k.formatting="task"),k.taskList=!1,f(k)}if(k.taskOpen=!1,k.taskClosed=!1,k.header&&_.match(/^#+$/,!0))return L.highlightFormatting&&(k.formatting="header"),f(k);var q=_.next();if(k.linkTitle){k.linkTitle=!1;var re=q;q==="("&&(re=")"),re=(re+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ee="^\\s*(?:[^"+re+"\\\\]+|\\\\\\\\|\\\\.)"+re;if(_.match(new RegExp(Ee),!0))return B.linkHref}if(q==="`"){var me=k.formatting;L.highlightFormatting&&(k.formatting="code"),_.eatWhile("`");var Se=_.current().length;if(k.code==0&&(!k.quote||Se==1))return k.code=Se,f(k);if(Se==k.code){var ve=f(k);return k.code=0,ve}else return k.formatting=me,f(k)}else if(k.code)return f(k);if(q==="\\"&&(_.next(),L.highlightFormatting)){var fe=f(k),ue=B.formatting+"-escape";return fe?fe+" "+ue:ue}if(q==="!"&&_.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return k.imageMarker=!0,k.image=!0,L.highlightFormatting&&(k.formatting="image"),f(k);if(q==="["&&k.imageMarker&&_.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return k.imageMarker=!1,k.imageAltText=!0,L.highlightFormatting&&(k.formatting="image"),f(k);if(q==="]"&&k.imageAltText){L.highlightFormatting&&(k.formatting="image");var fe=f(k);return k.imageAltText=!1,k.image=!1,k.inline=k.f=v,fe}if(q==="["&&!k.image)return k.linkText&&_.match(/^.*?\]/)||(k.linkText=!0,L.highlightFormatting&&(k.formatting="link")),f(k);if(q==="]"&&k.linkText){L.highlightFormatting&&(k.formatting="link");var fe=f(k);return k.linkText=!1,k.inline=k.f=_.match(/\(.*?\)| ?\[.*?\]/,!1)?v:d,fe}if(q==="<"&&_.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var fe=f(k);return fe?fe+=" ":fe="",fe+B.linkInline}if(q==="<"&&_.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var fe=f(k);return fe?fe+=" ":fe="",fe+B.linkEmail}if(L.xml&&q==="<"&&_.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=_.string.indexOf(">",_.pos);if(he!=-1){var Q=_.string.substring(_.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Q)&&(k.md_inside=!0)}return _.backUp(1),k.htmlState=ie.startState(z),l(_,k,w)}if(L.xml&&q==="<"&&_.match(/^\/\w*?>/))return k.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ne=1,Z=_.pos==1?" ":_.string.charAt(_.pos-2);ne<3&&_.eat(q);)ne++;var ge=_.peek()||" ",Te=!/\s/.test(ge)&&(!u.test(ge)||/\s/.test(Z)||u.test(Z)),pe=!/\s/.test(Z)&&(!u.test(Z)||/\s/.test(ge)||u.test(ge)),we=null,Oe=null;if(ne%2&&(!k.em&&Te&&(q==="*"||!pe||u.test(Z))?we=!0:k.em==q&&pe&&(q==="*"||!Te||u.test(ge))&&(we=!1)),ne>1&&(!k.strong&&Te&&(q==="*"||!pe||u.test(Z))?Oe=!0:k.strong==q&&pe&&(q==="*"||!Te||u.test(ge))&&(Oe=!1)),Oe!=null||we!=null){L.highlightFormatting&&(k.formatting=we==null?"strong":Oe==null?"em":"strong em"),we===!0&&(k.em=q),Oe===!0&&(k.strong=q);var ve=f(k);return we===!1&&(k.em=!1),Oe===!1&&(k.strong=!1),ve}}else if(q===" "&&(_.eat("*")||_.eat("_"))){if(_.peek()===" ")return f(k);_.backUp(1)}if(L.strikethrough){if(q==="~"&&_.eatWhile(q)){if(k.strikethrough){L.highlightFormatting&&(k.formatting="strikethrough");var ve=f(k);return k.strikethrough=!1,ve}else if(_.match(/^[^\s]/,!1))return k.strikethrough=!0,L.highlightFormatting&&(k.formatting="strikethrough"),f(k)}else if(q===" "&&_.match(/^~~/,!0)){if(_.peek()===" ")return f(k);_.backUp(2)}}if(L.emoji&&q===":"&&_.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){k.emoji=!0,L.highlightFormatting&&(k.formatting="emoji");var ke=f(k);return k.emoji=!1,ke}return q===" "&&(_.match(/^ +$/,!1)?k.trailingSpace++:k.trailingSpace&&(k.trailingSpaceNewLine=!0)),f(k)}function a(_,k){var H=_.next();if(H===">"){k.f=k.inline=d,L.highlightFormatting&&(k.formatting="link");var X=f(k);return X?X+=" ":X="",X+B.linkInline}return _.match(/^[^>]+/,!0),B.linkInline}function v(_,k){if(_.eatSpace())return null;var H=_.next();return H==="("||H==="["?(k.f=k.inline=b(H==="("?")":"]"),L.highlightFormatting&&(k.formatting="link-string"),k.linkHref=!0,f(k)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(_){return function(k,H){var X=k.next();if(X===_){H.f=H.inline=d,L.highlightFormatting&&(H.formatting="link-string");var q=f(H);return H.linkHref=!1,q}return k.match(g[_]),H.linkHref=!0,f(H)}}function M(_,k){return _.match(/^([^\]\\]|\\.)*\]:/,!1)?(k.f=F,_.next(),L.highlightFormatting&&(k.formatting="link"),k.linkText=!0,f(k)):s(_,k,d)}function F(_,k){if(_.match(/^\]:/,!0)){k.f=k.inline=j,L.highlightFormatting&&(k.formatting="link");var H=f(k);return k.linkText=!1,H}return _.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(_,k){return _.eatSpace()?null:(_.match(/^[^\s]+/,!0),_.peek()===void 0?k.linkTitle=!0:_.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),k.f=k.inline=d,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:d,text:h,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(_){return{f:_.f,prevLine:_.prevLine,thisLine:_.thisLine,block:_.block,htmlState:_.htmlState&&ie.copyState(z,_.htmlState),indentation:_.indentation,localMode:_.localMode,localState:_.localMode?ie.copyState(_.localMode,_.localState):null,inline:_.inline,text:_.text,formatting:!1,linkText:_.linkText,linkTitle:_.linkTitle,linkHref:_.linkHref,code:_.code,em:_.em,strong:_.strong,strikethrough:_.strikethrough,emoji:_.emoji,header:_.header,setext:_.setext,hr:_.hr,taskList:_.taskList,list:_.list,listStack:_.listStack.slice(0),quote:_.quote,indentedCode:_.indentedCode,trailingSpace:_.trailingSpace,trailingSpaceNewLine:_.trailingSpaceNewLine,md_inside:_.md_inside,fencedEndRE:_.fencedEndRE}},token:function(_,k){if(k.formatting=!1,_!=k.thisLine.stream){if(k.header=0,k.hr=!1,_.match(/^\s*$/,!0))return c(k),null;if(k.prevLine=k.thisLine,k.thisLine={stream:_},k.taskList=!1,k.trailingSpace=0,k.trailingSpaceNewLine=!1,!k.localState&&(k.f=k.block,k.f!=w)){var H=_.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(k.indentation=H,k.indentationDiff=null,H>0)return null}}return k.f(_,k)},innerMode:function(_){return _.block==w?{state:_.htmlState,mode:z}:_.localState?{state:_.localState,mode:_.localMode}:{state:_,mode:W}},indent:function(_,k,H){return _.block==w&&z.indent?z.indent(_.htmlState,k,H):_.localState&&_.localMode.indent?_.localMode.indent(_.localState,k,H):ie.Pass},blankLine:c,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),ie.defineMIME("text/markdown","markdown"),ie.defineMIME("text/x-markdown","markdown")})},osHv:function(ct,et,se){(function(ie){ie(se("VrN/"))})(function(ie){"use strict";var V=ie.Pos;function L(u,o){return u.line-o.line||u.ch-o.ch}var z="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",U=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+z+"]["+U+"]*)","g");function B(u,o,s,l){this.line=o,this.ch=s,this.cm=u,this.text=u.getLine(o),this.min=l?Math.max(l.from,u.firstLine()):u.firstLine(),this.max=l?Math.min(l.to-1,u.lastLine()):u.lastLine()}function I(u,o){var s=u.cm.getTokenTypeAt(V(u.line,o));return s&&/\btag\b/.test(s)}function O(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function D(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function x(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(O(u))continue;return}if(!I(u,o+1)){u.ch=o+1;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function A(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!I(u,o+1)){u.ch=o;continue}R.lastIndex=o,u.ch=o;var s=R.exec(u.text);if(s&&s.index==o)return s}}function P(u){for(;;){R.lastIndex=u.ch;var o=R.exec(u.text);if(!o){if(O(u))continue;return}if(!I(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function C(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!I(u,o+1)){u.ch=o;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function T(u,o){for(var s=[];;){var l=P(u),S,c=u.line,m=u.ch-(l?l[0].length:0);if(!l||!(S=x(u)))return;if(S=="selfClose")continue;if(l[1]){for(var w=s.length-1;w>=0;--w)if(s[w]==l[2]){s.length=w;break}if(w<0&&(!o||o==l[2]))return{tag:l[2],from:V(c,m),to:V(u.line,u.ch)}}else s.push(l[2])}}function p(u,o){for(var s=[];;){var l=C(u);if(!l)return;if(l=="selfClose"){A(u);continue}var S=u.line,c=u.ch,m=A(u);if(!m)return;if(m[1])s.push(m[2]);else{for(var w=s.length-1;w>=0;--w)if(s[w]==m[2]){s.length=w;break}if(w<0&&(!o||o==m[2]))return{tag:m[2],from:V(u.line,u.ch),to:V(S,c)}}}}ie.registerHelper("fold","xml",function(u,o){for(var s=new B(u,o.line,0);;){var l=P(s);if(!l||s.line!=o.line)return;var S=x(s);if(!S)return;if(!l[1]&&S!="selfClose"){var c=V(s.line,s.ch),m=T(s,l[2]);return m&&L(m.from,c)>0?{from:c,to:m.from}:null}}}),ie.findMatchingTag=function(u,o,s){var l=new B(u,o.line,o.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var S=x(l),c=S&&V(l.line,l.ch),m=S&&A(l);if(!S||!m||L(l,o)>0)return;var w={from:V(l.line,l.ch),to:c,tag:m[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:m[1]?{open:p(l,m[2]),close:w,at:"close"}:(l=new B(u,c.line,c.ch,s),{open:w,close:T(l,m[2]),at:"open"})},ie.findEnclosingTag=function(u,o,s,l){for(var S=new B(u,o.line,o.ch,s);;){var c=p(S,l);if(!c)break;var m=new B(u,o.line,o.ch,s),w=T(m,c.tag);if(w)return{open:c,close:w}}},ie.scanForClosingTag=function(u,o,s,l){var S=new B(u,o.line,o.ch,l?{from:0,to:l}:null);return T(S,s)}})},p0QG:function(ct,et,se){ct.exports={flex_box_center:"flex_box_center___2axlI",flex_space_between:"flex_space_between___F6m1U",flex_box_vertical_center:"flex_box_vertical_center___2GovZ",flex_box_center_end:"flex_box_center_end___2h9j0",flex_box_column:"flex_box_column___1kuIs",SubMentItem:"SubMentItem___34z-Y",MenuItem:"MenuItem___1bbPM",wrp:"wrp___3LRhb",classroomInfo:"classroomInfo___Ohxoq",title:"title___22ZLP",titleLeft:"titleLeft___1MP-h",titleRight:"titleRight___3zsz9",classroomUser:"classroomUser___1ePAN",headPic:"headPic___2lEg_",teacherInfo:"teacherInfo___3C0Dn",classroomDesc:"classroomDesc____QVZX",classroomDescBg:"classroomDescBg___1e7L7",joinCouses:"joinCouses___2G4vP",bg:"bg___2QojS",leftMenus:"leftMenus___34tjX",titleSelected:"titleSelected___K6QwW",menuText:"menuText___3qMqH",totalCount:"totalCount___R2q38",actions:"actions___26Ww0",task_count:"task_count___3UQ1V",container:"container___2EGM4",leftMenuActions:"leftMenuActions___3_J-1"}},p5ED:function(ct,et,se){"use strict";var ie=se("+L6B"),V=se("2/Rp"),L=se("5Dmo"),z=se("3S7+"),U=se("k1fw"),R=se("tJVT"),B=se("q1tI"),I=se.n(B),O=se("vHTk"),D=se.n(O),x=se("yEEn"),A=se("ZW9T"),P=se("1vsH");et.a=function(C){var T=C.name,p=C.data,u=C.theme,o=C.type,s=C.filename,l=C.monacoEditor,S=C.className,c=C.style,m=C.close,w=C.onClose,y=C.hasMask,f=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),h=Object(R.a)(f,2),d=h[0],a=h[1],v=Object(B.useState)(""),g=Object(R.a)(v,2),b=g[0],M=g[1],F=Object(B.useRef)();s&&(l.filename=s),Object(B.useEffect)(function(){var _,k,H=(_=document.cookie)===null||_===void 0||((k=_.replace(/\s/g,""))===null||k===void 0)?void 0:k.split(";");H==null||H.map(function(X){var q=X.split("=");q[0]==="_educoder_session"&&M(q[1])})},[]);var j=function(){if(p.startsWith("http")||p.startsWith("/")){W();return}Object(P.x)(s||"educoder",p,s)},W=function(){Object(P.v)(s||T,p)};return console.log("data:",p,"fileanme:",s," name:",T),I.a.createElement("div",{style:Object(U.a)({},c||{}),className:"".concat(y&&D.a.bgBlack," ").concat(o?D.a.wrp:"hide")},m&&I.a.createElement("div",{className:D.a.close,ref:F},I.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.current}},I.a.createElement("span",{onClick:W},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return F.current}},I.a.createElement("span",{className:"",onClick:w},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(D.a[S]," ").concat(S," ").concat(D.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&I.a.createElement(A.b,l)),o==="audio"&&I.a.createElement("audio",{src:"".concat(p!=null&&p.startsWith("/")||(p==null?void 0:p.indexOf("https://"))>-1?p:"data:audio/mp3;base64,").concat(p),autoPlay:!0}),o==="video"&&I.a.createElement(I.a.Fragment,null,p!=null&&p.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),o==="pdf"&&I.a.createElement("embed",{className:D.a.embed,src:p}),o==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(p!=null&&p.startsWith("/")||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)})),o==="other"&&I.a.createElement("div",null,I.a.createElement(V.a,{type:"primary",size:"large",onClick:j},I.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&I.a.createElement(V.a,{type:"primary",size:"large",onClick:j},I.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ct,et,se){},"rAM+":function(ct,et,se){"use strict";se.d(et,"a",function(){return V});var ie=se("Qw5x");function V(L,z){var U;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(U=Object(ie.a)(L))||z&&L&&typeof L.length=="number"){U&&(L=U);var R=0,B=function(){};return{s:B,n:function(){return R>=L.length?{done:!0}:{done:!1,value:L[R++]}},e:function(A){throw A},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var I=!0,O=!1,D;return{s:function(){U=L[Symbol.iterator]()},n:function(){var A=U.next();return I=A.done,A},e:function(A){O=!0,D=A},f:function(){try{!I&&U.return!=null&&U.return()}finally{if(O)throw D}}}}},rUJ1:function(ct,et){const se=/[&<>"']/,ie=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=y=>z[y];function R(y,f){if(f){if(se.test(y))return y.replace(ie,U)}else if(V.test(y))return y.replace(L,U);return y}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(y){return y.replace(B,(f,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const O=/(^|[^\[])\^/g;function D(y,f){y=y.source||y,f=f||"";const h={replace:(d,a)=>(a=a.source||a,a=a.replace(O,"$1"),y=y.replace(d,a),h),getRegex:()=>new RegExp(y,f)};return h}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(y,f,h){if(y){let d;try{d=decodeURIComponent(I(h)).replace(x,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!A.test(h)&&(h=o(f,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(d){return null}return h}const C={},T=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,f){C[" "+y]||(T.test(y)?C[" "+y]=y+"/":C[" "+y]=c(y,"/",!0)),y=C[" "+y];const h=y.indexOf(":")===-1;return f.substring(0,2)==="//"?h?f:y.replace(p,"$1")+f:f.charAt(0)==="/"?h?f:y.replace(u,"$1")+f:y+f}const s={exec:function(){}};function l(y){let f=1,h,d;for(;f<arguments.length;f++){h=arguments[f];for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(y[d]=h[d])}return y}function S(y,f){const h=y.replace(/\|/g,(v,g,b)=>{let M=!1,F=g;for(;--F>=0&&b[F]==="\\";)M=!M;return M?"|":" |"}),d=h.split(/ \|/);let a=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function c(y,f,h){const d=y.length;if(d===0)return"";let a=0;for(;a<d;){const v=y.charAt(d-a-1);if(v===f&&!h)a++;else if(v!==f&&h)a++;else break}return y.substr(0,d-a)}function m(y,f){if(y.indexOf(f[1])===-1)return-1;const h=y.length;let d=0,a=0;for(;a<h;a++)if(y[a]==="\\")a++;else if(y[a]===f[0])d++;else if(y[a]===f[1]&&(d--,d<0))return a;return-1}function w(y){y&&y.sanitize&&!y.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ct.exports={escape:R,unescape:I,edit:D,cleanUrl:P,resolveUrl:o,noopTest:s,merge:l,splitCells:S,rtrim:c,findClosingBracket:m,checkSanitizeDeprecation:w}},ulZh:function(ct,et,se){typeof window!="undefined"&&function(V,L){ct.exports=L()}(this,function(){return function(ie){var V={};function L(z){if(V[z])return V[z].exports;var U=V[z]={i:z,l:!1,exports:{}};return ie[z].call(U.exports,U,U.exports,L),U.l=!0,U.exports}return L.m=ie,L.c=V,L.d=function(z,U,R){L.o(z,U)||Object.defineProperty(z,U,{enumerable:!0,get:R})},L.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},L.t=function(z,U){if(U&1&&(z=L(z)),U&8)return z;if(U&4&&typeof z=="object"&&z&&z.__esModule)return z;var R=Object.create(null);if(L.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:z}),U&2&&typeof z!="string")for(var B in z)L.d(R,B,function(I){return z[I]}.bind(null,B));return R},L.n=function(z){var U=z&&z.__esModule?function(){return z.default}:function(){return z};return L.d(U,"a",U),U},L.o=function(z,U){return Object.prototype.hasOwnProperty.call(z,U)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ie,V,L){"use strict";var z=Object.prototype.hasOwnProperty,U="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(U=!1));function B(x,A,P){this.fn=x,this.context=A,this.once=P||!1}function I(x,A,P,C,T){if(typeof P!="function")throw new TypeError("The listener must be a function");var p=new B(P,C||x,T),u=U?U+A:A;return x._events[u]?x._events[u].fn?x._events[u]=[x._events[u],p]:x._events[u].push(p):(x._events[u]=p,x._eventsCount++),x}function O(x,A){--x._eventsCount===0?x._events=new R:delete x._events[A]}function D(){this._events=new R,this._eventsCount=0}D.prototype.eventNames=function(){var A=[],P,C;if(this._eventsCount===0)return A;for(C in P=this._events)z.call(P,C)&&A.push(U?C.slice(1):C);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(P)):A},D.prototype.listeners=function(A){var P=U?U+A:A,C=this._events[P];if(!C)return[];if(C.fn)return[C.fn];for(var T=0,p=C.length,u=new Array(p);T<p;T++)u[T]=C[T].fn;return u},D.prototype.listenerCount=function(A){var P=U?U+A:A,C=this._events[P];return C?C.fn?1:C.length:0},D.prototype.emit=function(A,P,C,T,p,u){var o=U?U+A:A;if(!this._events[o])return!1;var s=this._events[o],l=arguments.length,S,c;if(s.fn){s.once&&this.removeListener(A,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,P),!0;case 3:return s.fn.call(s.context,P,C),!0;case 4:return s.fn.call(s.context,P,C,T),!0;case 5:return s.fn.call(s.context,P,C,T,p),!0;case 6:return s.fn.call(s.context,P,C,T,p,u),!0}for(c=1,S=new Array(l-1);c<l;c++)S[c-1]=arguments[c];s.fn.apply(s.context,S)}else{var m=s.length,w;for(c=0;c<m;c++){s[c].once&&this.removeListener(A,s[c].fn,void 0,!0);switch(l){case 1:s[c].fn.call(s[c].context);break;case 2:s[c].fn.call(s[c].context,P);break;case 3:s[c].fn.call(s[c].context,P,C);break;case 4:s[c].fn.call(s[c].context,P,C,T);break;default:if(!S)for(w=1,S=new Array(l-1);w<l;w++)S[w-1]=arguments[w];s[c].fn.apply(s[c].context,S)}}}return!0},D.prototype.on=function(A,P,C){return I(this,A,P,C,!1)},D.prototype.once=function(A,P,C){return I(this,A,P,C,!0)},D.prototype.removeListener=function(A,P,C,T){var p=U?U+A:A;if(!this._events[p])return this;if(!P)return O(this,p),this;var u=this._events[p];if(u.fn)u.fn===P&&(!T||u.once)&&(!C||u.context===C)&&O(this,p);else{for(var o=0,s=[],l=u.length;o<l;o++)(u[o].fn!==P||T&&!u[o].once||C&&u[o].context!==C)&&s.push(u[o]);s.length?this._events[p]=s.length===1?s[0]:s:O(this,p)}return this},D.prototype.removeAllListeners=function(A){var P;return A?(P=U?U+A:A,this._events[P]&&O(this,P)):(this._events=new R,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=U,D.EventEmitter=D,ie.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(ie,V,L){(function(z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(D,x,A){if(A=A||{},D=D.trim(),x=x.trim(),!x){if(!A.alwaysNormalize)return D;var P=O.parseURL(D);if(!P)throw new Error("Error trying to parse base URL.");return P.path=O.normalizePath(P.path),O.buildURLFromParts(P)}var C=O.parseURL(x);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return A.alwaysNormalize?(C.path=O.normalizePath(C.path),O.buildURLFromParts(C)):x;var T=O.parseURL(D);if(!T)throw new Error("Error trying to parse base URL.");if(!T.netLoc&&T.path&&T.path[0]!=="/"){var p=R.exec(T.path);T.netLoc=p[1],T.path=p[2]}T.netLoc&&!T.path&&(T.path="/");var u={scheme:T.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(u.netLoc=T.netLoc,C.path[0]!=="/"))if(!C.path)u.path=T.path,C.params||(u.params=T.params,C.query||(u.query=T.query));else{var o=T.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;u.path=O.normalizePath(s)}return u.path===null&&(u.path=A.alwaysNormalize?O.normalizePath(C.path):C.path),O.buildURLFromParts(u)},parseURL:function(D){var x=U.exec(D);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(I,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};ie.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(ie,V,L){function z(A){var P={};function C(p){if(P[p])return P[p].exports;var u=P[p]={i:p,l:!1,exports:{}};return A[p].call(u.exports,u,u.exports,C),u.l=!0,u.exports}C.m=A,C.c=P,C.i=function(p){return p},C.d=function(p,u,o){C.o(p,u)||Object.defineProperty(p,u,{configurable:!1,enumerable:!0,get:o})},C.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},C.n=function(p){var u=p&&p.__esModule?function(){return p.default}:function(){return p};return C.d(u,"a",u),u},C.o=function(p,u){return Object.prototype.hasOwnProperty.call(p,u)},C.p="/",C.oe=function(p){throw console.error(p),p};var T=C(C.s=ENTRY_MODULE);return T.default||T}var U="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function B(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(A){return!isNaN(1*A)}function O(A,P,C){var T={};T[C]=[];var p=P.toString(),u=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return T;for(var o=u[1],s=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),l;l=s.exec(p);){if(l[3]==="dll-reference")continue;T[C].push(l[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+R,"g");l=s.exec(p);)A[l[2]]||(T[C].push(l[1]),A[l[2]]=L(l[1]).m),T[l[2]]=T[l[2]]||[],T[l[2]].push(l[4]);for(var S=Object.keys(T),c=0;c<S.length;c++)for(var m=0;m<T[S[c]].length;m++)I(T[S[c]][m])&&(T[S[c]][m]=1*T[S[c]][m]);return T}function D(A){var P=Object.keys(A);return P.reduce(function(C,T){return C||A[T].length>0},!1)}function x(A,P){for(var C={main:[P]},T={main:[]},p={main:{}};D(C);)for(var u=Object.keys(C),o=0;o<u.length;o++){var s=u[o],l=C[s],S=l.pop();if(p[s]=p[s]||{},p[s][S]||!A[s][S])continue;p[s][S]=!0,T[s]=T[s]||[],T[s].push(S);for(var c=O(A,A[s][S],s),m=Object.keys(c),w=0;w<m.length;w++)C[m[w]]=C[m[w]]||[],C[m[w]]=C[m[w]].concat(c[m[w]])}return T}ie.exports=function(A,P){P=P||{};var C={main:L.m},T=P.all?{main:Object.keys(C.main)}:x(C,A),p="";Object.keys(T).filter(function(S){return S!=="main"}).forEach(function(S){for(var c=0;T[S][c];)c++;T[S].push(c),C[S][c]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+S+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+T[S].map(function(m){return""+JSON.stringify(m)+": "+C[S][m].toString()}).join(",")+`});
`}),p=p+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+T.main.map(function(S){return""+JSON.stringify(S)+": "+C.main[S].toString()}).join(",")+"}))(self);";var u=new window.Blob([p],{type:"text/javascript"});if(P.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(u),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"hlsDefaultConfig",function(){return w}),L.d(V,"mergeConfig",function(){return f}),L.d(V,"enableStreamingMode",function(){return h});var z=L("./src/controller/abr-controller.ts"),U=L("./src/controller/audio-stream-controller.ts"),R=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),I=L("./src/controller/subtitle-track-controller.ts"),O=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),x=L("./src/controller/cap-level-controller.ts"),A=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),T=L("./src/utils/xhr-loader.ts"),p=L("./src/utils/fetch-loader.ts"),u=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),s=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var v=arguments[a];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(d[g]=v[g])}return d},l.apply(this,arguments)}function S(d,a){var v=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);a&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),v.push.apply(v,g)}return v}function c(d){for(var a=1;a<arguments.length;a++){var v=arguments[a]!=null?arguments[a]:{};a%2?S(Object(v),!0).forEach(function(g){m(d,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(v)):S(Object(v)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(v,g))})}return d}function m(d,a,v){return a in d?Object.defineProperty(d,a,{value:v,enumerable:!0,configurable:!0,writable:!0}):d[a]=v,d}var w=c(c({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:T.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:O.default,capLevelController:x.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:I.default,timelineController:D.TimelineController,audioStreamController:U.default,audioTrackController:R.default,emeController:P.default,cmcdController:C.default});function y(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(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 l({},d,a)}function h(d){var a=d.loader;if(a!==p.default&&a!==T.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var v=Object(p.fetchSupported)();v&&(d.loader=p.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/polyfills/number.ts"),U=L("./src/utils/ewma-bandwidth-estimator.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),O=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function x(C,T){for(var p=0;p<T.length;p++){var u=T[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function A(C,T,p){return T&&x(C.prototype,T),p&&x(C,p),C}var P=function(){function C(p){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=p;var u=p.config;this.bwEstimator=new U.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var T=C.prototype;return T.registerListeners=function(){var u=this.hls;u.on(R.Events.FRAG_LOADING,this.onFragLoading,this),u.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var u=this.hls;u.off(R.Events.FRAG_LOADING,this.onFragLoading,this),u.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},T.onFragLoading=function(u,o){var s=o.frag;if(s.type===O.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},T.onLevelLoaded=function(u,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},T._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,S=s.config,c=s.media;if(!u||!c)return;var m=o?o.stats:u.stats,w=o?o.duration:u.duration;if(m.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||c.paused||!c.playbackRate||!c.readyState)return;var y=performance.now()-m.loading.start,f=Math.abs(c.playbackRate);if(y<=500*w/f)return;var h=s.levels,d=s.minAutoLevel,a=h[u.level],v=m.total||Math.max(m.loaded,Math.round(w*a.maxBitrate/8)),g=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/y),b=(v-m.loaded)/g,M=c.currentTime,F=(B.BufferHelper.bufferInfo(c,M,S.maxBufferHole).end-M)/f;if(F>=2*w/f||b<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=u.level-1;W>d;W--){var _=h[W].maxBitrate;if(j=w*_/(8*.8*g),j<F)break}if(j>=b)return;var k=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
Current BW estimate: `+(Object(z.isFiniteNumber)(k)?(k/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,m.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:m})},T.onFragLoaded=function(u,o){var s=o.frag,l=o.part;if(s.type===O.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(s.sn)){var S=l?l.stats:s.stats,c=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],w=(m.loaded?m.loaded.bytes:0)+S.loaded,y=(m.loaded?m.loaded.duration:0)+c;m.loaded={bytes:w,duration:y},m.realBitrate=Math.round(8*w/y)}if(s.bitrateTest){var f={stats:S,frag:s,part:l,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,f),s.bitrateTest=!1}}},T.onFragBuffered=function(u,o){var s=o.frag,l=o.part,S=l?l.stats:s.stats;if(S.aborted)return;if(s.type!==O.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var c=S.parsing.end-S.loading.start;this.bwEstimator.sample(c,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=c/1e3:this.bitrateTestDelay=0},T.onError=function(u,o){switch(o.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},T.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},T.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.maxAutoLevel,S=s.config,c=s.minAutoLevel,m=s.media,w=o?o.duration:u?u.duration:0,y=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,d=(B.BufferHelper.bufferInfo(m,y,S.maxBufferHole).end-y)/f,a=this.findBestLevel(h,c,l,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=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,g=S.abrBandWidthFactor,b=S.abrBandWidthUpFactor;if(!d){var M=this.bitrateTestDelay;if(M){var F=w?Math.min(w,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"),g=b=1}}return a=this.findBestLevel(h,c,l,d+v,g,b),Math.max(a,0)},T.findBestLevel=function(u,o,s,l,S,c){for(var m,w=this.fragCurrent,y=this.partCurrent,f=this.lastLoadedFragLevel,h=this.hls.levels,d=h[f],a=!!(d!=null&&(m=d.details)!==null&&m!==void 0&&m.live),v=d==null?void 0:d.codecSet,g=y?y.duration:w?w.duration:0,b=s;b>=o;b--){var M=h[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)||g,W=void 0;b<=f?W=S*u:W=c*u;var _=h[b].maxBitrate,k=_*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(W)+"/"+_+"/"+j+"/"+l+"/"+k),W>_&&(!k||a&&!this.bitrateTestDelay||k<l))return b}return-1},A(C,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),C}();V.default=P},"./src/controller/audio-stream-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/polyfills/number.ts"),U=L("./src/controller/base-stream-controller.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),I=L("./src/controller/fragment-tracker.ts"),O=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),x=L("./src/loader/fragment.ts"),A=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),T=L("./src/controller/fragment-finders.ts"),p=L("./src/utils/discontinuities.ts"),u=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(w[h]=f[h])}return w},s.apply(this,arguments)}function l(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,S(w,y)}function S(w,y){return S=Object.setPrototypeOf||function(h,d){return h.__proto__=d,h},S(w,y)}var c=100,m=function(w){l(y,w);function y(h,d){var a;return a=w.call(this,h,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 f=y.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(R.Events.ERROR,this.onError,this),d.on(R.Events.BUFFER_RESET,this.onBufferReset,this),d.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(R.Events.ERROR,this.onError,this),d.off(R.Events.BUFFER_RESET,this.onBufferReset,this),d.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,a){var v=a.frag,g=a.id,b=a.initPTS;if(g==="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===U.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(c),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},f.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var d,a=this.levels,v=this.trackId,g=a==null||((d=a[v])===null||d===void 0)?void 0:d.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.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=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,_=j.part,k=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var X=k.flush(),q={frag:W,part:_,payload:X,networkDetails:null};this._handleFragmentLoadProgress(q),H&&w.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 re=this.getLoadPosition(),Ee=B.BufferHelper.bufferInfo(this.mediaBuffer,re,this.config.maxBufferHole),me=Object(T.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,W);me<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},f.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},f.doTickIdle=function(){var d,a,v=this.hls,g=this.levels,b=this.media,M=this.trackId,F=v.config;if(!g||!g[M])return;if(!b&&(this.startFragRequested||!F.startFragPrefetch))return;var j=g[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(_===null)return;var k=_.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(k>=H&&!X)return;if(!X&&this._streamEnded(_,W)){v.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var q=W.fragments,re=q[0].start,Ee=_.end;if(X){var me=this.getLoadPosition();Ee=me,W.PTSKnown&&me<re&&((_.end>re||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=re+.05))}var Se=this.getNextFragment(Ee,W);if(!Se){this.bufferFlushed=!0;return}((d=Se.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Se.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Se,W):this.loadFragment(Se,W,Ee)},f.getMaxBufferLength=function(){var d=w.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)},f.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(g){return new O.Level(g)})},f.onAudioTrackSwitching=function(d,a){var v=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(c):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(d,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(d,a){var v,g=this.levels,b=a.details,M=a.id;if(!g){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=g[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(p.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===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=U.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var a,v=d.frag,g=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 _=W.details;console.assert(_,"Audio track details are defined on fragment load progress");var k=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new P.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[v.cc],q=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var re=!1,Ee=g?g.index:-1,me=Ee!==-1,Se=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,b.byteLength,Ee,me);H.push(b,q,k,"",v,g,_.totalduration,re,Se,X)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+_.startSN+" ,"+_.endSN+"],track "+F);var ve=this.waitingData=this.waitingData||{frag:v,part:g,cache:new A.default,complete:!1},fe=ve.cache;fe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(d,a){var v=a.frag,g=a.part;if(v.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(g?" p: "+g.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,g)},f.onError=function(d,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var v=!0,g=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);g&&g.len>.5&&(v=!this.reduceMaxBufferLength(g.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,a){var v=a.type;v===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var a,v="audio",g=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,_=b.audio,k=b.text,H=b.id3,X=b.initSegment;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,this.audioSwitch&&_&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,j,M),g.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:X.tracks})),_){var q=_.startPTS,re=_.endPTS,Ee=_.startDTS,me=_.endDTS;W&&(W.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:re,startDTS:Ee,endDTS:me}),j.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,q,re,Ee,me),this.bufferFragmentData(_,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var Se=s({frag:j,id:v},H);g.trigger(R.Events.FRAG_PARSING_METADATA,Se)}if(k){var ve=s({frag:j,id:v},k);g.trigger(R.Events.FRAG_PARSING_USERDATA,ve)}},f._bufferInitSegment=function(d,a,v){if(this.state!==U.State.PARSING)return;d.video&&delete d.video;var g=d.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,d);var b=g.initSegment;if(b!=null&&b.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:b};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},f.loadFragment=function(d,a,v){var g=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||g===I.FragmentState.NOT_LOADED||g===I.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(z.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=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,d,a,v)))},f.completeAudioSwitch=function(){var d=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:v})},y}(U.default);V.default=m},"./src/controller/audio-track-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/events.ts"),U=L("./src/errors.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function I(P,C){for(var T=0;T<C.length;T++){var p=C[T];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function O(P,C,T){return C&&I(P.prototype,C),T&&I(P,T),P}function D(P,C){P.prototype=Object.create(C.prototype),P.prototype.constructor=P,x(P,C)}function x(P,C){return x=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},x(P,C)}var A=function(P){D(C,P);function C(p){var u;return u=P.call(this,p,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var T=C.prototype;return T.registerListeners=function(){var u=this.hls;u.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(z.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var u=this.hls;u.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(z.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},T.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},T.onAudioTrackLoaded=function(u,o){var s=o.id,l=o.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var c=S.details;S.details=o.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,c))},T.onLevelLoading=function(u,o){this.switchLevel(o.level)},T.onLevelSwitching=function(u,o){this.switchLevel(o.level)},T.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(c){return!s||c.groupId===s});this.selectDefaultTrack&&!l.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var S={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},T.onError=function(u,o){if(P.prototype.onError.call(this,u,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)},T.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+u);var l=o[u],S=l.id,c=l.groupId,m=c===void 0?"":c,w=l.name,y=l.type,f=l.url;if(this.trackId=u,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:m,name:w,type:y,url:f}),l.details&&!l.details.live)return;var h=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(h)},T.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.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(z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},T.findTrackId=function(u){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var l=o[s];if((!this.selectDefaultTrack||l.default)&&(!u||u===l.name))return l.id}return-1},T.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,l=o.groupId,S=o.url;if(u)try{S=u.addDirectives(S)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:l,deliveryDirectives:u||null})}},O(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),C}(R.default);V.default=A},"./src/controller/base-playlist-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return O});var z=L("./src/polyfills/number.ts"),U=L("./src/types/level.ts"),R=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),O=function(){function D(A,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,P+":"),this.warn=B.logger.warn.bind(B.logger,P+":"),this.hls=A}var x=D.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(P,C){C.fatal&&C.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(P,C){var T=C==null?void 0:C.renditionReports;if(T)for(var p=0;p<T.length;p++){var u=T[p],o=""+u.URI;if(o===P.substr(-o.length)){var s=parseInt(u["LAST-MSN"]),l=parseInt(u["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);l!==void 0&&S>C.partTarget&&(l+=1)}if(Object(z.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(z.isFiniteNumber)(l)?l:void 0,U.HlsSkip.No)}}},x.loadPlaylist=function(P){},x.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},x.playlistLoaded=function(P,C,T){var p=this,u=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||T!=null&&T.live){if(u.reloaded(T),T&&this.log("live playlist "+P+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),T&&u.fragments.length>0&&Object(R.mergeDetails)(T,u),!this.canLoad||!u.live)return;var l,S=void 0,c=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var m=this.hls.config.lowLatencyMode,w=u.lastPartSn,y=u.endSN,f=u.lastPartIndex,h=f!==-1,d=w===y,a=m?0:f;h?(S=d?y+1:w,c=d?a:f+1):S=y+1;var v=u.age,g=v+u.ageHeader,b=Math.min(g-u.partTarget,u.targetduration*1.5);if(b>0){if(T&&b>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+b+" with playlist age: "+u.age),b=0;else{var M=Math.floor(b/u.targetduration);if(S+=M,c!==void 0){var F=Math.round(b%u.targetduration/u.partTarget);c+=F}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+b+" skip sn "+M+" to part "+c)}u.tuneInGoal=b}if(l=this.getDeliveryDirectives(u,C.deliveryDirectives,S,c),m||!d){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(u,C.deliveryDirectives,S,c);var j=Object(R.computeReloadInterval)(u,o);S!==void 0&&u.canBlockReload&&(j-=u.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return p.loadPlaylist(l)},j)}else this.clearTimer()},x.getDeliveryDirectives=function(P,C,T,p){var u=Object(U.getSkipValue)(P,T);return C!=null&&C.skip&&P.deltaUpdateFailed&&(T=C.msn,p=C.part,u=U.HlsSkip.No),new U.HlsUrlParameters(T,p,u)},x.retryLoadingOrFail=function(P){var C=this,T=this.hls.config,p=this.retryCount<T.levelLoadingMaxRetry;if(p){var u;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(u=P.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*T.levelLoadingRetryDelay,T.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return p},D}()},"./src/controller/base-stream-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"State",function(){return y}),L.d(V,"default",function(){return f});var z=L("./src/polyfills/number.ts"),U=L("./src/task-loop.ts"),R=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),I=L("./src/utils/logger.ts"),O=L("./src/events.ts"),D=L("./src/errors.ts"),x=L("./src/types/transmuxer.ts"),A=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),T=L("./src/controller/level-helper.ts"),p=L("./src/loader/fragment-loader.ts"),u=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),s=L("./src/types/loader.ts");function l(h,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(h,v.key,v)}}function S(h,d,a){return d&&l(h.prototype,d),a&&l(h,a),h}function c(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function m(h,d){h.prototype=Object.create(d.prototype),h.prototype.constructor=h,w(h,d)}function w(h,d){return w=Object.setPrototypeOf||function(v,g){return v.__proto__=g,v},w(h,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"},f=function(h){m(d,h);function d(v,g,b){var M;return M=h.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=I.logger.log.bind(I.logger,b+":"),M.warn=I.logger.warn.bind(I.logger,b+":"),M.hls=v,M.fragmentLoader=new p.default(v.config),M.fragmentTracker=g,M.config=v.config,M.decrypter=new u.default(v,v.config),v.on(O.Events.KEY_LOADED,M.onKeyLoaded,c(M)),M}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(g,b){var M=this.fragCurrent,F=this.fragmentTracker;if(!b.live&&M&&M.sn===b.endSN&&!g.nextStart){var j=F.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(g,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 g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var g=this.config,b=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,_=B.BufferHelper.bufferInfo(F||M,W,g.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===y.ENDED)this.resetLoadingState();else if(b&&!_.len){var k=g.maxFragLookUpTolerance,H=b.start-k,X=b.start+b.duration+k,q=W>X;(W<H||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&&!_.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,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(),h.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(O.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,h.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,b){this.log("Loading key for "+g.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=y.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(O.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,b,M){this._loadFragForPlayback(g,b,M)},a._loadFragForPlayback=function(g,b,M){var F=this,j=function(_){if(F.fragContextChanged(g)){F.warn("Fragment "+g.sn+(_.part?" p: "+_.part.index:"")+" of level "+g.level+" was dropped during download."),F.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,F._handleFragmentLoadProgress(_)};this._doFragLoad(g,b,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var _=F.state;if(F.fragContextChanged(g)){(_===y.FRAG_LOADING||_===y.BACKTRACKING||!F.fragCurrent&&_===y.PARSING)&&(F.fragmentTracker.removeFragment(g),F.state=y.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+g.sn+" of level "+g.level),F.hls.trigger(O.Events.FRAG_LOADED,W),F.state===y.BACKTRACKING)){F.fragmentTracker.backtrack(g,W),F.resetFragmentLoading(g);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,b,M){if(M===void 0&&(M=null),!(g-b))return;var F={startOffset:g,endOffset:b,type:M};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(g){var b=this;this._doFragLoad(g).then(function(M){if(!M||b.fragContextChanged(g)||!b.levels)throw new Error("init load aborted");return M}).then(function(M){var F=b.hls,j=M.payload,W=g.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var _=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(k){var H=self.performance.now();return F.trigger(O.Events.FRAG_DECRYPTED,{frag:g,payload:k,stats:{tstart:_,tdecrypt:H}}),M.payload=k,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 _=W[g.level].details;console.assert(_,"Level details are defined when init segment is loaded");var k=g.stats;b.state=y.IDLE,b.fragLoadError=0,g.data=new Uint8Array(M.payload),k.parsing.start=k.buffering.start=self.performance.now(),k.parsing.end=k.buffering.end=self.performance.now(),M.frag===F&&j.trigger(O.Events.FRAG_BUFFERED,{stats:k,frag:F,part:null,id:g.type}),b.tick()}).catch(function(M){b.warn(M),b.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var b=this.fragCurrent;return!g||!b||g.level!==b.level||g.sn!==b.sn||g.urlId!==b.urlId},a.fragBufferedComplete=function(g,b){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var b=this.transmuxer;if(!b)return;var M=g.frag,F=g.part,j=g.partsLoaded,W=!j||j.length===0||j.some(function(k){return!k}),_=new x.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);b.flush(_)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,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(g.start,M||0),this.config.lowLatencyMode&&b){var W=b.partList;if(W&&F){M>g.end&&b.fragmentHint&&(g=b.fragmentHint);var _=this.getNextPart(W,g,M);if(_>-1){var k=W[_];return this.log("Loading part sn: "+g.sn+" p: "+k.index+" cc: "+g.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+_+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=k.start+k.duration,this.state=y.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:g,part:W[_],targetBufferTime:M}),this.doFragPartsLoad(g,W,_,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!g.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),Object(z.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=y.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:g,targetBufferTime:M}),this.fragmentLoader.load(g,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(g,b,M,F){var j=this;return new Promise(function(W,_){var k=[],H=function X(q){var re=b[q];j.fragmentLoader.loadPart(g,re,F).then(function(Ee){k[re.index]=Ee;var me=Ee.part;j.hls.trigger(O.Events.FRAG_LOADED,Ee);var Se=b[q+1];if(Se&&Se.fragment===g)X(q+1);else return W({frag:g,part:me,partsLoaded:k})}).catch(_)};H(M)})},a.handleFragLoadError=function(g){var b=g.data;return b&&b.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(O.Events.ERROR,b),null},a._handleTransmuxerFlush=function(g){var b=this.getCurrentContext(g);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,g.partial)},a.getCurrentContext=function(g){var b=this.levels,M=g.level,F=g.sn,j=g.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],_=j>-1?Object(T.getPartWith)(W,F,j):null,k=_?_.fragment:Object(T.getFragmentWithSN)(W,F,this.fragCurrent);return k?{frag:k,part:_,level:W}:null},a.bufferFragmentData=function(g,b,M,F){if(!g||this.state!==y.PARSING)return;var j=g.data1,W=g.data2,_=j;if(j&&W&&(_=Object(A.appendUint8Array)(j,W)),!_||!_.length)return;var k={type:g.type,frag:b,part:M,chunkMeta:F,parent:b.type,data:_};this.hls.trigger(O.Events.BUFFER_APPENDING,k),g.dropped&&g.independent&&!M&&this.flushBufferGap(b)},a.flushBufferGap=function(g){var b=this.media;if(!b)return;if(!B.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,g.start);return}var M=b.currentTime,F=B.BufferHelper.bufferInfo(b,M,0),j=g.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),_=Math.max(Math.min(g.start-W,F.end-W),M+W);g.start-_>W&&this.flushMainBuffer(_,g.start)},a.getFwdBufferInfo=function(g,b){var M=this.config,F=this.getLoadPosition();if(!Object(z.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(g,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(g,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(g){var b=this.config,M;return g?M=Math.max(8*b.maxBufferSize/g,b.maxBufferLength):M=b.maxBufferLength,Math.min(M,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var b=this.config,M=g||b.maxBufferLength;return b.maxMaxBufferLength>=M?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,b){var M,F,j=b.fragments,W=j.length;if(!W)return null;var _=this.config,k=j[0].start,H;if(b.live){var X=_.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(b,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:g)}else g<=k&&(H=j[0]);if(!H){var q=_.lowLatencyMode?b.partEnd:b.fragmentEnd;H=this.getFragmentAtPosition(g,q,b)}return(M=H)!==null&&M!==void 0&&M.initSegment&&!((F=H)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(g,b,M){for(var F=-1,j=!1,W=!0,_=0,k=g.length;_<k;_++){var H=g[_];if(W=W&&!H.independent,F>-1&&M<H.start)break;var X=H.loaded;!X&&(j||H.independent||W)&&H.fragment===b&&(F=_),j=X}return F},a.loadedEndOfParts=function(g,b){var M=g[g.length-1];return M&&b>M.start&&M.loaded},a.getInitialLiveFragment=function(g,b){var M=this.fragPrevious,F=null;if(M){if(g.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>=g.startSN&&j<=g.endSN){var W=b[j-g.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 _=this.hls.liveSyncPosition;_!==null&&(F=this.getFragmentAtPosition(_,this.bitrateTest?g.fragmentEnd:g.edge,g))}return F},a.getFragmentAtPosition=function(g,b,M){var F=this.config,j=this.fragPrevious,W=M.fragments,_=M.endSN,k=M.fragmentHint,H=F.maxFragLookUpTolerance,X=!!(F.lowLatencyMode&&M.partList&&k);X&&k&&!this.bitrateTest&&(W=W.concat(k),_=k.sn);var q;if(g<b){var re=g>b-H?0:H;q=Object(C.findFragmentByPTS)(j,W,g,re)}else q=W[W.length-1];if(q){var Ee=q.sn-M.startSN,me=j&&q.level===j.level,Se=W[Ee+1],ve=this.fragmentTracker.getState(q);if(ve===R.FragmentState.BACKTRACKED){q=null;for(var fe=Ee;W[fe]&&this.fragmentTracker.getState(W[fe])===R.FragmentState.BACKTRACKED;)j?q=W[fe--]:q=W[--fe];q||(q=Se)}else j&&q.sn===j.sn&&!X&&(me&&(q.sn<_&&this.fragmentTracker.getState(Se)!==R.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+Se.sn),q=Se):q=null))}return q},a.synchronizeToLiveEdge=function(g){var b=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=g.fragments[0].start,_=g.edge,k=j>=W-b.maxFragLookUpTolerance&&j<=_;if(F!==null&&M.duration>F&&(j<F||!k)){var H=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*g.targetduration;(!k&&M.readyState<4||j<_-H)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+_+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(g,b){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,_=g.fragments.length;if(!_)return this.warn("No fragments in live playlist"),0;var k=g.fragments[0].start,H=!b,X=g.alignedSliding&&Object(z.isFiniteNumber)(k);if(H||!X&&!k){Object(P.alignStream)(j,W,g);var q=g.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+g.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+_),q}return k},a.waitForCdnTuneIn=function(g){var b=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*b)},a.setStartPosition=function(g,b){var M=this.startPosition;if(M<b&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=g.startTimeOffset;Object(z.isFiniteNumber)(F)?(M=b+F,F<0&&(M+=g.totalduration),M=Math.min(Math.max(b,M),b+g.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):g.live?M=this.hls.liveSyncPosition||b:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var g=this.media,b=0;return this.loadedmetadata&&g?b=g.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(g,b){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(b?" part"+b.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(g,b){if(b.fatal)return;var M=b.frag;if(!M||M.type!==g)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 "+g+" "+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?(g===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(I.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(g,b,M){if(!g)return;var F=B.BufferHelper.getBuffered(g);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(g){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[g].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(g,b,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var _=Object.keys(g.elementaryStreams).reduce(function(k,H){var X=g.elementaryStreams[H];if(X){var q=X.endPTS-X.startPTS;if(q<=0)return j.warn("Could not parse fragment "+g.sn+" "+H+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),k||!1;var re=F?0:Object(T.updateFragPTSDTS)(W,g,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return j.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:re,type:H,frag:g,start:X.startPTS,end:X.endPTS}),!0}return k},!1);_?(this.state=y.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:g,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(g){var b=this._state;b!==g&&(this._state=g,this.log(b+"->"+g))}}]),d}(U.default)},"./src/controller/buffer-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var z=L("./src/polyfills/number.ts"),U=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),I=L("./src/utils/buffer-helper.ts"),O=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),x=L("./src/controller/buffer-operation-queue.ts"),A=Object(O.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function T(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,l=o.media,S=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:l})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var p=T.prototype;return p.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},p.destroy=function(){this.unregisterListeners(),this.details=null},p.registerListeners=function(){var o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},p.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},p._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},p.onManifestParsed=function(o,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},p.onMediaAttaching=function(o,s){var l=this.media=s.media;if(l&&A){var S=this.mediaSource=new A;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(S),this._objectUrl=l.src}},p.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){R.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&&(l&&self.URL.revokeObjectURL(l),o.src===l?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},p.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var l=o.sourceBuffer[s];try{l&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),o.sourceBuffer[s]=void 0)}catch(S){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},p.onBufferCodecs=function(o,s){var l=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(c){if(S){var m=l.tracks[c];if(m&&typeof m.buffer.changeType=="function"){var w=s[c],y=w.codec,f=w.levelCodec,h=w.container,d=(m.levelCodec||m.codec).replace(P,"$1"),a=(f||y).replace(P,"$1");if(d!==a){var v=h+";codecs="+(f||y);l.appendChangeType(c,v)}}}else l.pendingTracks[c]=s[c]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},p.appendChangeType=function(o,s){var l=this,S=this.operationQueue,c={execute:function(){var w=l.sourceBuffer[o];w&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),w.changeType(s)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};S.append(c,o)},p.onBufferAppending=function(o,s){var l=this,S=this.hls,c=this.operationQueue,m=this.tracks,w=s.data,y=s.type,f=s.frag,h=s.part,d=s.chunkMeta,a=d.buffering[y],v=self.performance.now();a.start=v;var g=f.stats.buffering,b=h?h.stats.buffering:null;g.start===0&&(g.start=v),b&&b.start===0&&(b.start=v);var M=m.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 _=l.sourceBuffer[y];if(_){var k=f.start-_.timestampOffset;Math.abs(k)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+k+") sn: "+f.sn+")"),_.timestampOffset=f.start)}}l.appendExecutor(w,y)},onStart:function(){},onComplete:function(){var _=self.performance.now();a.executeEnd=a.end=_,g.first===0&&(g.first=_),b&&b.first===0&&(b.first=_);var k=l.sourceBuffer,H={};for(var X in k)H[X]=I.BufferHelper.getBuffered(k[X]);l.appendError=0,l.hls.trigger(U.Events.BUFFER_APPENDED,{type:y,frag:f,part:h,chunkMeta:d,parent:f.type,timeRanges:H})},onError:function(_){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",_);var k={type:B.ErrorTypes.MEDIA_ERROR,parent:f.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:_,fatal:!1};_.code===DOMException.QUOTA_EXCEEDED_ERR?k.details=B.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,k.details=B.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>S.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),k.fatal=!0)),S.trigger(U.Events.ERROR,k)}};c.append(j,y)},p.onBufferFlushing=function(o,s){var l=this,S=this.operationQueue,c=function(w){return{execute:l.removeExecutor.bind(l,w,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(U.Events.BUFFER_FLUSHED,{type:w})},onError:function(f){R.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",f)}}};s.type?S.append(c(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){S.append(c(m),m)})},p.onFragParsed=function(o,s){var l=this,S=s.frag,c=s.part,m=[],w=c?c.elementaryStreams:S.elementaryStreams;w[D.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(w[D.ElementaryStreamTypes.AUDIO]&&m.push("audio"),w[D.ElementaryStreamTypes.VIDEO]&&m.push("video"));var y=function(){var h=self.performance.now();S.stats.buffering.end=h,c&&(c.stats.buffering.end=h);var d=c?c.stats:S.stats;l.hls.trigger(U.Events.FRAG_BUFFERED,{frag:S,part:c,stats:d,id:S.type})};m.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(y,m)},p.onFragChanged=function(o,s){this.flushBackBuffer()},p.onBufferEos=function(o,s){var l=this,S=this.getSourceBufferTypes().reduce(function(c,m){var w=l.sourceBuffer[m];return(!s.type||s.type===m)&&(w&&!w.ended&&(w.ended=!0,R.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),c&&!!(!w||w.ended)},!0);S&&this.blockBuffers(function(){var c=l.mediaSource;if(!c||c.readyState!=="open")return;c.endOfStream()})},p.onLevelUpdated=function(o,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},p.flushBackBuffer=function(){var o=this.hls,s=this.details,l=this.media,S=this.sourceBuffer;if(!l||s===null)return;var c=this.getSourceBufferTypes();if(!c.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(z.isFiniteNumber)(m)||m<0)return;var w=l.currentTime,y=s.levelTargetDuration,f=Math.max(m,y),h=Math.floor(w/y)*y-f;c.forEach(function(d){var a=S[d];if(a){var v=I.BufferHelper.getBuffered(a);v.length>0&&h>v.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),s.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:d}))}})},p.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,l=this.media,S=this.mediaSource,c=o.fragments[0].start+o.totalduration,m=l.duration,w=Object(z.isFiniteNumber)(S.duration)?S.duration:0;o.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(c>w&&c>m||!Object(z.isFiniteNumber)(m))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+c.toFixed(3)),S.duration=c)},p.updateSeekableRange=function(o){var s=this.mediaSource,l=o.fragments,S=l.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var c=Math.max(0,l[0].start),m=Math.max(c,c+o.totalduration);s.setLiveSeekableRange(c,m)}},p.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,S=Object.keys(l).length;if(S&&!o||S===2){this.createSourceBuffers(l),this.pendingTracks={};var c=this.getSourceBufferTypes();if(c.length===0){this.hls.trigger(U.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}c.forEach(function(m){s.executeNext(m)})}},p.createSourceBuffers=function(o){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var c in o)if(!s[c]){var m=o[c];if(!m)throw Error("source buffer exists for track "+c+", however track does not");var w=m.levelCodec||m.codec,y=m.container+";codecs="+w;R.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var f=s[c]=l.addSourceBuffer(y),h=c;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[c]={buffer:f,codec:w,container:m.container,levelCodec:m.levelCodec,id:m.id},S++}catch(d){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:y})}}S&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},p._onSBUpdateStart=function(o){var s=this.operationQueue,l=s.current(o);l.onStart()},p._onSBUpdateEnd=function(o){var s=this.operationQueue,l=s.current(o);l.onComplete(),s.shiftAndExecuteNext(o)},p._onSBUpdateError=function(o,s){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(o);l&&l.onError(s)},p.removeExecutor=function(o,s,l){var S=this.media,c=this.mediaSource,m=this.operationQueue,w=this.sourceBuffer,y=w[o];if(!S||!c||!y){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var f=Object(z.isFiniteNumber)(S.duration)?S.duration:Infinity,h=Object(z.isFiniteNumber)(c.duration)?c.duration:Infinity,d=Math.max(0,s),a=Math.min(l,f,h);a>d?(R.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)):m.shiftAndExecuteNext(o)},p.appendExecutor=function(o,s){var l=this.operationQueue,S=this.sourceBuffer,c=S[s];if(!c){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}c.ended=!1,console.assert(!c.updating,s+" sourceBuffer must not be updating"),c.appendBuffer(o)},p.blockBuffers=function(o,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,c=s.map(function(m){return S.appendBlocker(m)});Promise.all(c).then(function(){o(),s.forEach(function(m){var w=l.sourceBuffer[m];(!w||!w.updating)&&S.shiftAndExecuteNext(m)})})},p.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},p.addBufferListener=function(o,s,l){var S=this.sourceBuffer[o];if(!S)return;var c=l.bind(this,o);this.listeners[o].push({event:s,listener:c}),S.addEventListener(s,c)},p.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(l){s.removeEventListener(l.event,l.listener)})},T}()},"./src/controller/buffer-operation-queue.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return U});var z=L("./src/utils/logger.ts"),U=function(){function R(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var B=R.prototype;return B.append=function(O,D){var x=this.queues[D];x.push(O),x.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(O,D){var x=this.queues[D];x.unshift(O),this.executeNext(D)},B.appendBlocker=function(O){var D,x=new Promise(function(P){D=P}),A={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,O),x},B.executeNext=function(O){var D=this.buffers,x=this.queues,A=D[O],P=x[O];if(P.length){var C=P[0];try{C.execute()}catch(T){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(T),(!A||!A.updating)&&(P.shift(),this.executeNext(O))}}},B.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},B.current=function(O){return this.queues[O][0]},R}()},"./src/controller/cap-level-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/events.ts");function U(I,O){for(var D=0;D<O.length;D++){var x=O[D];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(I,x.key,x)}}function R(I,O,D){return O&&U(I.prototype,O),D&&U(I,D),I}var B=function(){function I(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=I.prototype;return O.setStreamController=function(x){this.streamController=x},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var x=this.hls;x.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var x=this.hls;x.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(x,A){I.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},O.onMediaAttaching=function(x,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},O.onManifestParsed=function(x,A){var P=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},O.onBufferCodecs=function(x,A){var P=this.hls;P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(x.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},O.getMaxLevel=function(x){var A=this,P=this.hls.levels;if(!P.length)return-1;var C=P.filter(function(T,p){return I.isLevelAllowed(p,A.restrictedLevels)&&p<=x});return this.clientRect=null,I.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},O.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,A={width:0,height:0};if(x){var P=x.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||x.width||0,A.height=P.bottom-P.top||x.height||0)}return this.clientRect=A,A},I.isLevelAllowed=function(x,A){return A===void 0&&(A=[]),A.indexOf(x)===-1},I.getMaxLevelByMediaSize=function(x,A,P){if(!x||!x.length)return-1;for(var C=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},T=x.length-1,p=0;p<x.length;p+=1){var u=x[p];if((u.width>=A||u.height>=P)&&C(u,x[p+1])){T=p;break}}return T},R(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(A){}return x}}]),I}();V.default=B},"./src/controller/cmcd-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var z=L("./src/events.ts"),U=L("./src/types/cmcd.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function I(T,p){for(var u=0;u<p.length;u++){var o=p[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(T,o.key,o)}}function O(T,p,u){return p&&I(T.prototype,p),u&&I(T,u),T}function D(T,p){var u=typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(u)return(u=u.call(T)).next.bind(u);if(Array.isArray(T)||(u=x(T))||p&&T&&typeof T.length=="number"){u&&(T=u);var o=0;return function(){return o>=T.length?{done:!0}:{done:!1,value:T[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(T,p){if(!T)return;if(typeof T=="string")return A(T,p);var u=Object.prototype.toString.call(T).slice(8,-1);if(u==="Object"&&T.constructor&&(u=T.constructor.name),u==="Map"||u==="Set")return Array.from(T);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return A(T,p)}function A(T,p){(p==null||p>T.length)&&(p=T.length);for(var u=0,o=new Array(p);u<p;u++)o[u]=T[u];return o}function P(){return P=Object.assign||function(T){for(var p=1;p<arguments.length;p++){var u=arguments[p];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(T[o]=u[o])}return T},P.apply(this,arguments)}var C=function(){function T(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(c){B.logger.warn("Could not generate manifest CMCD data.",c)}},this.applyFragmentData=function(S){try{var c=S.frag,m=o.hls.levels[c.level],w=o.getObjectType(c),y={d:c.duration*1e3,ot:w};(w===U.CMCDObjectType.VIDEO||w===U.CMCDObjectType.AUDIO||w==U.CMCDObjectType.MUXED)&&(y.br=m.bitrate/1e3,y.tb=o.getTopBandwidth(w),y.bl=o.getBufferLength(w)),o.apply(S,y)}catch(f){B.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=u;var s=this.config=u.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||T.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var p=T.prototype;return p.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},p.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},p.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},p.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},p.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},p.onBufferCreated=function(o,s){var l,S;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},p.createData=function(){var o;return{v:U.CMCDVersion,sf:U.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}},p.apply=function(o,s){s===void 0&&(s={}),P(s,this.createData());var l=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=T.toHeaders(s);if(!Object.keys(S).length)return;o.headers||(o.headers={}),P(o.headers,S)}else{var c=T.toQuery(s);if(!c)return;o.url=T.appendQueryToUri(o.url,c)}},p.getObjectType=function(o){var s=o.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:s==="audio"?U.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},p.getTopBandwidth=function(o){for(var s=0,l=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=D(l),c;!(c=S()).done;){var m=c.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},p.getBufferLength=function(o){var s=this.hls.media,l=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var S=R.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return S.len*1e3},p.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,l=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new l(m)}var c=S.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(w,y,f){s(w),this.loader.load(w,y,f)},O(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},p.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,l=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new l(m)}var c=S.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(w,y,f){s(w),this.loader.load(w,y,f)},O(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},T.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},T.serialize=function(o){for(var s=[],l=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},S=function(F){return Math.round(F)},c=function(F){return S(F/100)*100},m=function(F){return encodeURIComponent(F)},w={br:S,d:S,bl:c,dl:c,mtp:c,nor:m,rtp:c,tb:S},y=Object.keys(o||{}).sort(),f=D(y),h;!(h=f()).done;){var d=h.value,a=o[d];if(!l(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var v=w[d];v&&(a=v(a));var g=typeof a,b=void 0;d==="ot"||d==="sf"||d==="st"?b=d+"="+a:g==="boolean"?b=d:g==="number"?b=d+"="+a:b=d+"="+JSON.stringify(a),s.push(b)}return s.join(",")},T.toHeaders=function(o){for(var s=Object.keys(o),l={},S=["Object","Request","Session","Status"],c=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},w=0,y=s;w<y.length;w++){var f=y[w],h=m[f]!=null?m[f]:1;c[h][f]=o[f]}for(var d=0;d<c.length;d++){var a=T.serialize(c[d]);a&&(l["CMCD-"+S[d]]=a)}return l},T.toQuery=function(o){return"CMCD="+encodeURIComponent(T.serialize(o))},T.appendQueryToUri=function(o,s){if(!s)return o;var l=o.includes("?")?"&":"?";return""+o+l+s},T}()},"./src/controller/eme-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/events.ts"),U=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function I(C,T){for(var p=0;p<T.length;p++){var u=T[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function O(C,T,p){return T&&I(C.prototype,T),p&&I(C,p),C}var D=3,x=function(T,p,u){var o={audioCapabilities:[],videoCapabilities:[]};return T.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),p.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[o]},A=function(T,p,u,o){switch(T){case B.KeySystems.WIDEVINE:return x(p,u,o);default:throw new Error("Unknown key-system: "+T)}},P=function(){function C(p){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=p,this._config=p.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 T=C.prototype;return T.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},T._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T.getLicenseServerUrl=function(u){switch(u){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},T._attemptKeySystemAccess=function(u,o,s){var l=this,S=A(u,o,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var c=this.requestMediaKeySystemAccess(u,S);this.mediaKeysPromise=c.then(function(m){return l._onMediaKeySystemAccessObtained(u,m)}),c.catch(function(m){R.logger.error('Failed to obtain key-system "'+u+'" access:',m)})},T._onMediaKeySystemAccessObtained=function(u,o){var s=this;R.logger.log('Access for key-system "'+u+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(l);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(c){return l.mediaKeys=c,R.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),c});return S.catch(function(c){R.logger.error("Failed to create media-keys:",c)}),S},T._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},T._onNewMediaKeySession=function(u){var o=this;R.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){o._onKeySessionMessage(u,s.message)},!1)},T._onKeySessionMessage=function(u,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},T.onMediaEncrypted=function(u){var o=this;if(R.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},T._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},T._generateRequestWithPreferredKeySession=function(u,o){var s=this,l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var S=l.mediaKeysSession;if(!S){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+u+'" init data type'),l.mediaKeysSessionInitialized=!0,S.generateRequest(u,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(c){R.logger.error("Error generating key-session request:",c),s.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},T._createLicenseXhr=function(u,o,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,u,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,l,u),S=void 0}catch(c){R.logger.error(c)}try{l.readyState||l.open("POST",u,!0),S&&S.call(this.hls,l,u)}catch(c){throw new Error("issue setting up KeySystem license XHR "+c)}return l},T._onLicenseRequestReadyStageChange=function(u,o,s,l){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var S=u.response,c=this._licenseResponseCallback;if(c)try{S=c.call(this.hls,u,o)}catch(w){R.logger.error(w)}l(S)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=D-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,l)}break}},T._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},T._requestLicense=function(u,o){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(l,u,o);R.logger.log("Sending license request to URL: "+l);var c=this._generateLicenseRequestChallenge(s,u);S.send(c)}catch(m){R.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},T.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},T.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},T.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var s=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),l=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,l)},O(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=P},"./src/controller/fps-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/events.ts"),U=L("./src/utils/logger.ts"),R=function(){function B(O){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=O,this.registerListeners()}var I=B.prototype;return I.setStreamController=function(D){this.streamController=D},I.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(D,x){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=x.media instanceof self.HTMLVideoElement?x.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(D,x,A){var P=performance.now();if(x){if(this.lastTime){var C=P-this.lastTime,T=A-this.lastDroppedFrames,p=x-this.lastDecodedFrames,u=1e3*T/C,o=this.hls;if(o.trigger(z.Events.FPS_DROP,{currentDropped:T,currentDecoded:p,totalDroppedFrames:A}),u>0&&T>o.config.fpsDroppedMonitoringThreshold*p){var s=o.currentLevel;U.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(z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=x}},I.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var x=D.getVideoPlaybackQuality();this.checkFPS(D,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"findFragmentByPDT",function(){return R}),L.d(V,"findFragmentByPTS",function(){return B}),L.d(V,"fragmentWithinToleranceTest",function(){return I}),L.d(V,"pdtWithinToleranceTest",function(){return O}),L.d(V,"findFragWithCC",function(){return D});var z=L("./src/polyfills/number.ts"),U=L("./src/utils/binary-search.ts");function R(x,A,P){if(A===null||!Array.isArray(x)||!x.length||!Object(z.isFiniteNumber)(A))return null;var C=x[0].programDateTime;if(A<(C||0))return null;var T=x[x.length-1].endProgramDateTime;if(A>=(T||0))return null;P=P||0;for(var p=0;p<x.length;++p){var u=x[p];if(O(A,P,u))return u}return null}function B(x,A,P,C){P===void 0&&(P=0),C===void 0&&(C=0);var T=null;if(x?T=A[x.sn-A[0].sn+1]||null:P===0&&A[0].start===0&&(T=A[0]),T&&I(P,C,T)===0)return T;var p=U.default.search(A,I.bind(null,P,C));return p||T}function I(x,A,P){x===void 0&&(x=0),A===void 0&&(A=0);var C=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-C<=x?1:P.start-C>x&&P.start?-1:0}function O(x,A,P){var C=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,T=P.endProgramDateTime||0;return T-C>x}function D(x,A){return U.default.search(x,function(P){return P.cc<A?1:P.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"FragmentState",function(){return R}),L.d(V,"FragmentTracker",function(){return B});var z=L("./src/events.ts"),U=L("./src/types/loader.ts"),R;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(R||(R={}));var B=function(){function D(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var x=D.prototype;return x._registerListeners=function(){var P=this.hls;P.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var P=this.hls;P.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(P,C){if(C===U.PlaylistLevelType.MAIN){var T=this.activeFragment,p=this.activeParts;if(!T)return null;if(p)for(var u=p.length;u--;){var o=p[u],s=o?o.end:T.appendedPTS;if(o.start<=P&&s!==void 0&&P<=s)return u>9&&(this.activeParts=p.slice(u-9)),o}else if(T.start<=P&&T.appendedPTS!==void 0&&P<=T.appendedPTS)return T}return this.getBufferedFrag(P,C)},x.getBufferedFrag=function(P,C){for(var T=this.fragments,p=Object.keys(T),u=p.length;u--;){var o=T[p[u]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=P&&P<=s.end)return s}}return null},x.detectEvictedFragments=function(P,C,T){var p=this;Object.keys(this.fragments).forEach(function(u){var o=p.fragments[u];if(!o)return;if(!o.buffered){o.body.type===T&&p.removeFragment(o.body);return}var s=o.range[P];if(!s)return;s.time.some(function(l){var S=!p.isTimeBuffered(l.startPTS,l.endPTS,C);return S&&p.removeFragment(o.body),S})})},x.detectPartialFragments=function(P){var C=this,T=this.timeRanges,p=P.frag,u=P.part;if(!T||p.sn==="initSegment")return;var o=O(p),s=this.fragments[o];if(!s)return;Object.keys(T).forEach(function(l){var S=p.elementaryStreams[l];if(!S)return;var c=T[l],m=u!==null||S.partial===!0;s.range[l]=C.getBufferedTimes(p,u,m,c)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},x.fragBuffered=function(P){var C=O(P),T=this.fragments[C];T&&(T.backtrack=T.loaded=null,T.buffered=!0)},x.getBufferedTimes=function(P,C,T,p){for(var u={time:[],partial:T},o=C?C.start:P.start,s=C?C.end:P.end,l=P.minEndPTS||s,S=P.maxStartPTS||o,c=0;c<p.length;c++){var m=p.start(c)-this.bufferPadding,w=p.end(c)+this.bufferPadding;if(S>=m&&l<=w){u.time.push({startPTS:Math.max(o,p.start(c)),endPTS:Math.min(s,p.end(c))});break}else if(o<w&&s>m)u.partial=!0,u.time.push({startPTS:Math.max(o,p.start(c)),endPTS:Math.min(s,p.end(c))});else if(s<=m)break}return u},x.getPartialFragment=function(P){var C=null,T,p,u,o=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(S){var c=l[S];if(!c)return;I(c)&&(p=c.body.start-s,u=c.body.end+s,P>=p&&P<=u&&(T=Math.min(P-p,u-P),o<=T&&(C=c.body,o=T)))}),C},x.getState=function(P){var C=O(P),T=this.fragments[C];return T?T.buffered?I(T)?R.PARTIAL:R.OK:T.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},x.backtrack=function(P,C){var T=O(P),p=this.fragments[T];if(!p||p.backtrack)return null;var u=p.backtrack=C||p.loaded;return p.loaded=null,u},x.getBacktrackData=function(P){var C=O(P),T=this.fragments[C];if(T){var p,u=T.backtrack;if(u!=null&&(p=u.payload)!==null&&p!==void 0&&p.byteLength)return u;this.removeFragment(P)}return null},x.isTimeBuffered=function(P,C,T){for(var p,u,o=0;o<T.length;o++){if(p=T.start(o)-this.bufferPadding,u=T.end(o)+this.bufferPadding,P>=p&&C<=u)return!0;if(C<=p)return!1}return!1},x.onFragLoaded=function(P,C){var T=C.frag,p=C.part;if(T.sn==="initSegment"||T.bitrateTest||p)return;var u=O(T);this.fragments[u]={body:T,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(P,C){var T=this,p=C.frag,u=C.part,o=C.timeRanges;if(p.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=p,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(l){var S=o[l];if(T.detectEvictedFragments(l,S),!u)for(var c=0;c<S.length;c++)p.appendedPTS=Math.max(S.end(c),p.appendedPTS||0)})},x.onFragBuffered=function(P,C){this.detectPartialFragments(C)},x.hasFragment=function(P){var C=O(P);return!!this.fragments[C]},x.removeFragmentsInRange=function(P,C,T){var p=this;Object.keys(this.fragments).forEach(function(u){var o=p.fragments[u];if(!o)return;if(o.buffered){var s=o.body;s.type===T&&s.start<C&&s.end>P&&p.removeFragment(s)}})},x.removeFragment=function(P){var C=O(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[C]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function I(D){var x,A;return D.buffered&&(((x=D.range.video)===null||x===void 0?void 0:x.partial)||((A=D.range.audio)===null||A===void 0?void 0:A.partial))}function O(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"STALL_MINIMUM_DURATION_MS",function(){return I}),L.d(V,"MAX_START_GAP_JUMP",function(){return O}),L.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(V,"SKIP_BUFFER_RANGE_START",function(){return x}),L.d(V,"default",function(){return A});var z=L("./src/utils/buffer-helper.ts"),U=L("./src/errors.ts"),R=L("./src/events.ts"),B=L("./src/utils/logger.ts"),I=250,O=2,D=.1,x=.05,A=function(){function P(T,p,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=T,this.media=p,this.fragmentTracker=u,this.hls=o}var C=P.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(p){var u=this.config,o=this.media,s=this.stalled,l=o.currentTime,S=o.seeking,c=this.seeking&&!S,m=!this.seeking&&S;if(this.seeking=S,l!==p){if(this.moved=!0,s!==null){if(this.stallReported){var w=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||c)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!z.BufferHelper.getBuffered(o).length)return;var y=z.BufferHelper.bufferInfo(o,l,0),f=y.len>0,h=y.nextStart||0;if(!f&&!h)return;if(S){var d=y.len>O,a=!h||h-l>O&&!this.fragmentTracker.getPartialFragment(l);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,g=Math.max(h,y.start||0)-l,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:O;if(g>0&&g<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!S&&W>=I&&this._reportStall(y.len);var _=z.BufferHelper.bufferInfo(o,l,u.maxBufferHole);this._tryFixBufferStall(_,W)},C._tryFixBufferStall=function(p,u){var o=this.config,s=this.fragmentTracker,l=this.media,S=l.currentTime,c=s.getPartialFragment(S);if(c){var m=this._trySkipBufferHole(c);if(m)return}p.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(p){var u=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="+p+")"),u.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:p}))},C._trySkipBufferHole=function(p){for(var u=this.config,o=this.hls,s=this.media,l=s.currentTime,S=0,c=z.BufferHelper.getBuffered(s),m=0;m<c.length;m++){var w=c.start(m);if(l+u.maxBufferHole>=S&&l<w){var y=Math.max(w+x,s.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+y),this.moved=!0,this.stalled=null,s.currentTime=y,p&&o.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+y,frag:p}),y}S=c.end(m)}return 0},C._tryNudgeBuffer=function(){var p=this.config,u=this.hls,o=this.media,s=o.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<p.nudgeMaxRetry){var S=s+l*p.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+S),o.currentTime=S,u.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+p.nudgeMaxRetry+" nudges"),u.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/events.ts"),U=L("./src/utils/texttrack-utils.ts"),R=L("./src/demux/id3.ts"),B=.25,I=function(){function O(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var D=O.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var A=this.hls;A.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var A=this.hls;A.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(A,P){this.media=P.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(A){if(!this.media)return;for(var P=0;P<A.length;P++){var C=A[P];if(C.kind==="metadata"&&C.label==="id3")return Object(U.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(A,P){if(!this.media)return;var C=P.frag,T=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var p=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<T.length;u++){var o=R.getID3Frames(T[u].data);if(o){var s=T[u].pts,l=u<T.length-1?T[u+1].pts:C.end,S=l-s;S<=0&&(l=s+B);for(var c=0;c<o.length;c++){var m=o[c];if(!R.isTimeStampFrame(m)){var w=new p(s,l,"");w.value=m,this.id3Track.addCue(w)}}}}},D.onBufferFlushing=function(A,P){var C=P.startOffset,T=P.endOffset,p=P.type;if(!p||p==="audio"){var u=this.id3Track;u&&Object(U.removeCuesInRange)(u,C,T)}},O}();V.default=I},"./src/controller/latency-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return O});var z=L("./src/errors.ts"),U=L("./src/events.ts"),R=L("./src/utils/logger.ts");function B(D,x){for(var A=0;A<x.length;A++){var P=x[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function I(D,x,A){return x&&B(D.prototype,x),A&&B(D,A),D}var O=function(){function D(A){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var x=D.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},x.onMediaAttached=function(P,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(P,C){var T=C.details;this.levelDetails=T,T.advanced&&this.timeupdate(),!T.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(P,C){if(C.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var P=this.media,C=this.levelDetails;if(!P||!C)return;this.currentTime=P.currentTime;var T=this.computeLatency();if(T===null)return;this._latency=T;var p=this.config,u=p.lowLatencyMode,o=p.maxLiveSyncPlaybackRate;if(!u||o===1)return;var s=this.targetLatency;if(s===null)return;var l=T-s,S=Math.min(this.maxLatency,s+C.targetduration),c=l<S;if(C.live&&c&&l>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,w))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},x.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},x.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},I(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,C=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:C?P.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var C=P.holdBack,T=P.partHoldBack,p=P.targetduration,u=this.config,o=u.liveSyncDuration,s=u.liveSyncDurationCount,l=u.lowLatencyMode,S=this.hls.userConfig,c=l&&T||C;(S.liveSyncDuration||S.liveSyncDurationCount||c===0)&&(c=o!==void 0?o:s*p);var m=p,w=1;return c+Math.min(this.stallCount*w,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),C=this.targetLatency,T=this.levelDetails;if(P===null||C===null||T===null)return null;var p=T.edge,u=P-C-this.edgeStalled,o=p-T.totalduration,s=p-(this.config.lowLatencyMode&&T.partTarget||T.targetduration);return Math.min(Math.max(o,u),s)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var C=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-C,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,C=this.levelDetails;if(!P||!C)return 0;var T=P.buffered.length;return T?P.buffered.end(T-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return u});var z=L("./src/types/level.ts"),U=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),I=L("./src/controller/level-helper.ts"),O=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function x(){return x=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(o[S]=l[S])}return o},x.apply(this,arguments)}function A(o,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function P(o,s,l){return s&&A(o.prototype,s),l&&A(o,l),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,T(o,s)}function T(o,s){return T=Object.setPrototypeOf||function(S,c){return S.__proto__=c,S},T(o,s)}var p=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){C(s,o);function s(S){var c;return c=o.call(this,S,"[level-controller]")||this,c._levels=[],c._firstLevel=-1,c._startLevel=void 0,c.currentLevelIndex=-1,c.manualLevelIndex=-1,c.onParsedComplete=void 0,c._registerListeners(),c}var l=s.prototype;return l._registerListeners=function(){var c=this.hls;c.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(U.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var c=this.hls;c.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(U.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},l.startLoad=function(){var c=this._levels;c.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(c,m){var w=[],y=[],f=[],h,d={},a,v=!1,g=!1,b=!1;if(m.levels.forEach(function(W){var _=W.attrs;v=v||!!(W.width&&W.height),g=g||!!W.videoCodec,b=b||!!W.audioCodec,p&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var k=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=d[k],a?a.url.push(W.url):(a=new z.Level(W),d[k]=a,w.push(a)),_&&(_.AUDIO&&Object(I.addGroupId)(a,"audio",_.AUDIO),_.SUBTITLES&&Object(I.addGroupId)(a,"text",_.SUBTITLES))}),(v||g)&&b&&(w=w.filter(function(W){var _=W.videoCodec,k=W.width,H=W.height;return!!_||!!(k&&H)})),w=w.filter(function(W){var _=W.audioCodec,k=W.videoCodec;return(!_||Object(B.isCodecSupportedInMp4)(_,"audio"))&&(!k||Object(B.isCodecSupportedInMp4)(k,"video"))}),m.audioTracks&&(y=m.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(y)),m.subtitles&&(f=m.subtitles,Object(I.assignTrackIdsByGroup)(f)),w.length>0){h=w[0].bitrate,w.sort(function(W,_){return W.bitrate-_.bitrate}),this._levels=w;for(var M=0;M<w.length;M++)if(w[M].bitrate===h){this._firstLevel=M,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+h);break}var F=b&&!g,j={levels:w,audioTracks:y,subtitleTracks:f,firstLevel:this._firstLevel,stats:m.stats,audio:b,video:g,altAudio:!F&&y.some(function(W){return!!W.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(c,m){if(o.prototype.onError.call(this,c,m),m.fatal)return;var w=m.context,y=this._levels[this.currentLevelIndex];if(w&&(w.type===D.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&w.groupId===y.audioGroupIds[y.urlId]||w.type===D.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&w.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,h=!0,d;switch(m.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=m.frag.level)):d=m.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(h=!1),d=w.level),f=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:d=m.level,f=!0;break}d!==void 0&&this.recoverLevel(m,d,f,h)},l.recoverLevel=function(c,m,w,y){var f=c.details,h=this._levels[m];if(h.loadError++,w){var d=this.retryLoadingOrFail(c);if(d)c.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=h.url.length;if(a>1&&h.loadError<a)c.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var v=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(f+": switch to "+v),c.levelRetry=!0,this.hls.nextAutoLevel=v)}}},l.redundantFailover=function(c){var m=this._levels[c],w=m.url.length;if(w>1){var y=(m.urlId+1)%w;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(f){f.urlId=y}),this.level=c}},l.onFragLoaded=function(c,m){var w=m.frag;if(w!==void 0&&w.type===D.PlaylistLevelType.MAIN){var y=this._levels[w.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},l.onLevelLoaded=function(c,m){var w,y=m.level,f=m.details,h=this._levels[y];if(!h){var d;this.warn("Invalid level index "+y),(d=m.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,h.details)):(w=m.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(f.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(c,m){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var y=-1,f=this.hls.audioTracks[m.id].groupId,h=0;h<w.audioGroupIds.length;h++)if(w.audioGroupIds[h]===f){y=h;break}y!==w.urlId&&(w.urlId=y,this.startLoad())}},l.loadPlaylist=function(c){var m=this.currentLevelIndex,w=this._levels[m];if(this.canLoad&&w&&w.url.length>0){var y=w.urlId,f=w.url[y];if(c)try{f=c.addDirectives(f)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+m+(c?" at sn "+c.msn+" part "+c.part:"")+" with URL-id "+y+" "+f),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:f,level:m,id:y,deliveryDirectives:c||null})}},l.removeLevel=function(c,m){var w=function(h,d){return d!==m},y=this._levels.filter(function(f,h){return h!==c?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(w),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(w)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(w)),f.urlId=0,!0):!1}).map(function(f,h){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=h}),f});this._levels=y,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:y})},P(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(c){var m,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===c&&(m=w[c])!==null&&m!==void 0&&m.details)return;if(c<0||c>=w.length){var y=c<0;if(this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:c,fatal:y,reason:"invalid level idx"}),y)return;c=Math.min(c,w.length-1)}this.clearTimer();var f=this.currentLevelIndex,h=w[f],d=w[c];this.log("switching to level "+c+" from "+f),this.currentLevelIndex=c;var a=x({},d,{level:c,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var v=d.details;if(!v||v.live){var g=this.switchParams(d.uri,h==null?void 0:h.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(c){this.manualLevelIndex=c,this._startLevel===void 0&&(this._startLevel=c),c!==-1&&(this.level=c)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(c){this._firstLevel=c}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var c=this.hls.config.startLevel;return c!==void 0?c:this._firstLevel}else return this._startLevel},set:function(c){this._startLevel=c}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(c){this.level=c,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=c)}}]),s}(O.default)},"./src/controller/level-helper.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"addGroupId",function(){return R}),L.d(V,"assignTrackIdsByGroup",function(){return B}),L.d(V,"updatePTS",function(){return I}),L.d(V,"updateFragPTSDTS",function(){return D}),L.d(V,"mergeDetails",function(){return x}),L.d(V,"mapPartIntersection",function(){return A}),L.d(V,"mapFragmentIntersection",function(){return P}),L.d(V,"adjustSliding",function(){return C}),L.d(V,"addSliding",function(){return T}),L.d(V,"computeReloadInterval",function(){return p}),L.d(V,"getFragmentWithSN",function(){return u}),L.d(V,"getPartWith",function(){return o});var z=L("./src/polyfills/number.ts"),U=L("./src/utils/logger.ts");function R(s,l,S){switch(l){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 l={};s.forEach(function(S){var c=S.groupId||"";S.id=l[c]=l[c]||0,l[c]++})}function I(s,l,S){var c=s[l],m=s[S];O(c,m)}function O(s,l){var S=l.startPTS;if(Object(z.isFiniteNumber)(S)){var c=0,m;l.sn>s.sn?(c=S-s.start,m=s):(c=s.start-S,m=l),m.duration!==c&&(m.duration=c)}else if(l.sn>s.sn){var w=s.cc===l.cc;w&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function D(s,l,S,c,m,w){var y=c-S;y<=0&&(U.logger.warn("Fragment should have a positive duration",l),c=S+l.duration,w=m+l.duration);var f=S,h=c,d=l.startPTS,a=l.endPTS;if(Object(z.isFiniteNumber)(d)){var v=Math.abs(d-S);Object(z.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(v,l.deltaPTS):l.deltaPTS=v,f=Math.max(S,d),S=Math.min(S,d),m=Math.min(m,l.startDTS),h=Math.min(c,a),c=Math.max(c,a),w=Math.max(w,l.endDTS)}l.duration=c-S;var g=S-l.start;l.appendedPTS=c,l.start=l.startPTS=S,l.maxStartPTS=f,l.startDTS=m,l.endPTS=c,l.minEndPTS=h,l.endDTS=w;var b=l.sn;if(!s||b<s.startSN||b>s.endSN)return 0;var M,F=b-s.startSN,j=s.fragments;for(j[F]=l,M=F;M>0;M--)O(j[M],j[M-1]);for(M=F;M<j.length-1;M++)O(j[M],j[M+1]);return s.fragmentHint&&O(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function x(s,l){for(var S=null,c=s.fragments,m=c.length-1;m>=0;m--){var w=c[m].initSegment;if(w){S=w;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var y=0,f;if(P(s,l,function(M,F){M.relurl&&(y=M.cc-F.cc),Object(z.isFiniteNumber)(M.startPTS)&&Object(z.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&&(f=F),l.PTSKnown=l.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 h=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;h.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=S)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=S)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(M){return!M}),l.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=l.skippedSegments;d--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(y){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<a.length;v++)a[v].cc+=y}l.skippedSegments&&(l.startCC=l.fragments[0].cc),A(s.partList,l.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),f?D(l,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):C(s,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var g=l.advancedDateTime;if(l.advanced&&g){var b=l.edge;l.driftStart||(l.driftStartTime=g,l.driftStart=b),l.driftEndTime=g,l.driftEnd=b}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function A(s,l,S){if(s&&l)for(var c=0,m=0,w=s.length;m<=w;m++){var y=s[m],f=l[m+c];y&&f&&y.index===f.index&&y.fragment.sn===f.fragment.sn?S(y,f):c--}}function P(s,l,S){for(var c=l.skippedSegments,m=Math.max(s.startSN,l.startSN)-l.startSN,w=(s.fragmentHint?1:0)+(c?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,y=l.startSN-s.startSN,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=m;d<=w;d++){var a=h[y+d],v=f[d];c&&!v&&d<c&&(v=l.fragments[d]=a),a&&v&&S(a,v)}}function C(s,l){var S=l.startSN+l.skippedSegments-s.startSN,c=s.fragments;if(S<0||S>=c.length)return;T(l,c[S].start)}function T(s,l){if(l){for(var S=s.fragments,c=s.skippedSegments;c<S.length;c++)S[c].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function p(s,l){var S=1e3*s.levelTargetDuration,c=S/2,m=s.age,w=m>0&&m<S*3,y=l.loading.end-l.loading.start,f,h=s.availabilityDelay;if(s.updated===!1)if(w){var d=333*s.misses;f=Math.max(Math.min(c,y*2),d),s.availabilityDelay=(s.availabilityDelay||0)+f}else f=c;else w?(h=Math.min(h||S/2,m),s.availabilityDelay=h,f=h+S-m):f=S-y;return Math.round(f)}function u(s,l,S){if(!s||!s.details)return null;var c=s.details,m=c.fragments[l-c.startSN];return m||(m=c.fragmentHint,m&&m.sn===l?m:l<c.startSN&&S&&S.sn===l?S:null)}function o(s,l,S){if(!s||!s.details)return null;var c=s.details.partList;if(c)for(var m=c.length;m--;){var w=c[m];if(w.index===S&&w.fragment.sn===l)return w}return null}},"./src/controller/stream-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return c});var z=L("./src/polyfills/number.ts"),U=L("./src/controller/base-stream-controller.ts"),R=L("./src/is-supported.ts"),B=L("./src/events.ts"),I=L("./src/utils/buffer-helper.ts"),O=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),x=L("./src/loader/fragment.ts"),A=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),T=L("./src/errors.ts"),p=L("./src/utils/logger.ts");function u(m,w){for(var y=0;y<w.length;y++){var f=w[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function o(m,w,y){return w&&u(m.prototype,w),y&&u(m,y),m}function s(m,w){m.prototype=Object.create(w.prototype),m.prototype.constructor=m,l(m,w)}function l(m,w){return l=Object.setPrototypeOf||function(f,h){return f.__proto__=h,f},l(m,w)}var S=100,c=function(m){s(w,m);function w(f,h){var d;return d=m.call(this,f,h,"[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=w.prototype;return y._registerListeners=function(){var h=this.hls;h.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(B.Events.ERROR,this.onError,this),h.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var h=this.hls;h.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(B.Events.ERROR,this.onError,this),h.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(h){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&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),h=d),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var h,d=this.levels,a=this.level,v=d==null||((h=d[a])===null||h===void 0)?void 0:h.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,b=self.performance.now(),M=this.retryDate;(!M||b>=M||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var h,d,a=this.hls,v=this.levelLastLoaded,g=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(!g||!g[F])return;var j=g[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===U.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var _=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,D.PlaylistLevelType.MAIN);if(_===null)return;var k=_.len,H=this.getMaxBufferLength(j.maxBitrate);if(k>=H)return;if(this._streamEnded(_,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,X),this.state=U.State.ENDED;return}var q=_.end,re=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&re&&re.sn!=="initSegment"){var Ee=re.sn-W.startSN;Ee>1&&(re=W.fragments[Ee-1],this.fragmentTracker.removeFragment(re))}if(re&&this.fragmentTracker.getState(re)===O.FragmentState.OK&&this.nextLoadPosition>q){var me=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,me,D.PlaylistLevelType.MAIN),re=this.getNextFragment(this.nextLoadPosition,W)}if(!re)return;re.initSegment&&!re.initSegment.data&&!this.bitrateTest&&(re=re.initSegment),((h=re.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((d=re.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(re,W):this.loadFragment(re,W,q)},y.loadFragment=function(h,d,a){var v,g=this.fragmentTracker.getState(h);if(this.fragCurrent=h,g===O.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(h);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else g=O.FragmentState.NOT_LOADED}g===O.FragmentState.NOT_LOADED||g===O.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,h,d,a)):g===O.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(h){var d=this.fragmentTracker.getAppendedFrag(h,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},y.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,D.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var h=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&&h){var g=this.hls.nextLoadLevel,b=h[g],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,_=j.duration,k=Math.max(F.end,W+Math.min(Math.max(_-this.config.maxFragLookUpTolerance,_*.5),_*.75));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(h,d){m.prototype.flushMainBuffer.call(this,h,d,this.altAudio?"video":null)},y.onMediaAttached=function(h,d){m.prototype.onMediaAttached.call(this,h,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 h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var h=this.media,d=h?h.currentTime:null;Object(z.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(h,d){var a=!1,v=!1,g;d.levels.forEach(function(b){g=b.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},y.onLevelLoading=function(h,d){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var v=a[d.level];(!v.details||v.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(v.details))&&(this.state=U.State.WAITING_LEVEL)},y.onLevelLoaded=function(h,d){var a,v=this.levels,g=d.level,b=d.details,M=b.totalduration;if(!v){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==d.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var j=v[g],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=g,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:b,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=U.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,W),this.tick()},y._handleFragmentLoadProgress=function(h){var d,a=h.frag,v=h.part,g=h.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,_=(d=a.initSegment)===null||d===void 0?void 0:d.data,k=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new A.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=v?v.index:-1,q=X!==-1,re=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,X,q),Ee=this.initPTS[a.cc];H.push(g,_,k,j,a,v,F.totalduration,W,re,Ee)},y.onAudioTrackSwitching=function(h,d){var a=this.altAudio,v=!!d.url,g=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:g})}},y.onAudioTrackSwitched=function(h,d){var a=d.id,v=!!this.hls.audioTracks[a].url;if(v){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=v,this.tick()},y.onBufferCreated=function(h,d){var a=d.tracks,v,g,b=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(g=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 "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(h,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===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},y.onError=function(h,d){switch(d.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,d);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=U.State.ERROR):!d.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===U.State.PARSING||this.state===U.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 h=this.media,d=this.gapController;if(!h||!d||!h.readyState)return;var a=I.BufferHelper.getBuffered(h);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(h,d){var a=d.type;if(a!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,D.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(h,d){this.levels=d.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var h=this.media,d=h.currentTime,a=this.startPosition;if(a>=0&&d<a){if(h.seeking){p.logger.log("could not seek to "+a+", already seeking at "+d);return}var v=I.BufferHelper.getBuffered(h),g=v.length?v.start(0):0,b=g-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(p.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),h.currentTime=a}},y._getAudioCodec=function(h){var d=this.config.defaultAudioCodec||h.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(h){var d=this;this._doFragLoad(h).then(function(a){var v=d.hls;if(!a||v.nextLoadLevel||d.fragContextChanged(h))return;d.fragLoadError=0,d.state=U.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var g=h.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),v.trigger(B.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(h){var d,a="main",v=this.hls,g=h.remuxResult,b=h.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,_=g.video,k=g.text,H=g.id3,X=g.initSegment,q=this.altAudio?void 0:g.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,F,b),v.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:X.tracks}));var re=X.initPTS,Ee=X.timescale;Object(z.isFiniteNumber)(re)&&(this.initPTS[F.cc]=re,v.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:re,timescale:Ee}))}if(_&&g.independent!==!1){if(W.details){var me=_.startPTS,Se=_.endPTS,ve=_.startDTS,fe=_.endDTS;if(j)j.elementaryStreams[_.type]={startPTS:me,endPTS:Se,startDTS:ve,endDTS:fe};else if(_.firstKeyFrame&&_.independent&&(this.couldBacktrack=!0),_.dropped&&_.independent){var ue=this.getLoadPosition()+this.config.maxBufferHole;if(ue<me){this.backtrack(F);return}F.setElementaryStreamInfo(_.type,F.start,Se,F.start,fe,!0)}F.setElementaryStreamInfo(_.type,me,Se,ve,fe),this.bufferFragmentData(_,F,j,b)}}else if(g.independent===!1){this.backtrack(F);return}if(q){var he=q.startPTS,Q=q.endPTS,ne=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:Q,startDTS:ne,endDTS:Z}),F.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,he,Q,ne,Z),this.bufferFragmentData(q,F,j,b)}if(H!=null&&(d=H.samples)!==null&&d!==void 0&&d.length){var ge={frag:F,id:a,samples:H.samples};v.trigger(B.Events.FRAG_PARSING_METADATA,ge)}if(k){var Te={frag:F,id:a,samples:k.samples};v.trigger(B.Events.FRAG_PARSING_USERDATA,Te)}},y._bufferInitSegment=function(h,d,a,v){var g=this;if(this.state!==U.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=h.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)),h.audioCodec&&h.audioCodec!==j&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+j+'"'),b.levelCodec=j,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(h.audioCodec||"")+"/"+b.codec+"]")}M&&(M.levelCodec=h.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(_){var k=d[_],H=k.initSegment;H!=null&&H.byteLength&&g.hls.trigger(B.Events.BUFFER_APPENDING,{type:_,data:H,frag:a,part:null,chunkMeta:v,parent:a.type})}),this.tick()},y.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var d=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,d?this.resetFragmentLoading(h):this.state=U.State.BACKTRACKING},y.checkFragmentChanged=function(){var h=this.media,d=null;if(h&&h.readyState>1&&h.seeking===!1){var a=h.currentTime;if(I.BufferHelper.isBuffered(h,a)?d=this.getAppendedFrag(a):I.BufferHelper.isBuffered(h,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var v=this.fragPlaying,g=d.level;(!v||d.sn!==v.sn||v.level!==g||d.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:d}),(!v||v.level!==g)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=d)}}},o(w,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var d=this.getAppendedFrag(h.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var d=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"SubtitleStreamController",function(){return s});var z=L("./src/events.ts"),U=L("./src/utils/logger.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),I=L("./src/utils/discontinuities.ts"),O=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),x=L("./src/controller/base-stream-controller.ts"),A=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function C(l,S){for(var c=0;c<S.length;c++){var m=S[c];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(l,m.key,m)}}function T(l,S,c){return S&&C(l.prototype,S),c&&C(l,c),l}function p(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,u(l,S)}function u(l,S){return u=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},u(l,S)}var o=500,s=function(l){p(S,l);function S(m,w){var y;return y=l.call(this,m,w,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var c=S.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var w=this.hls;w.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(z.Events.ERROR,this.onError,this),w.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c._unregisterListeners=function(){var w=this.hls;w.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(z.Events.ERROR,this.onError,this),w.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(o),this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},c.onLevelLoaded=function(w,y){this.mainDetails=y.details},c.onSubtitleFragProcessed=function(w,y){var f=y.frag,h=y.success;if(this.fragPrevious=f,this.state=x.State.IDLE,!h)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,v=f.start,g=0;g<d.length;g++)if(v>=d[g].start&&v<=d[g].end){a=d[g];break}var b=f.start+f.duration;a?a.end=b:(a={start:v,end:b},d.push(a)),this.fragmentTracker.fragBuffered(f)},c.onBufferFlushing=function(w,y){var f=y.startOffset,h=y.endOffset;if(f===0&&h!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var v=a[d].details,g=v.targetduration,b=h-g;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(f,b,A.PlaylistLevelType.SUBTITLE)}},c.onError=function(w,y){var f,h=y.frag;if(!h||h.type!==A.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},c.onSubtitleTracksUpdated=function(w,y){var f=this,h=y.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(d){return new P.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},c.onSubtitleTrackSwitch=function(w,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(o)},c.onSubtitleTrackLoaded=function(w,y){var f,h=y.details,d=y.id,a=this.currentTrackId,v=this.levels;if(!v.length)return;var g=v[a];if(d>=v.length||d!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(f=g.details)!==null&&f!==void 0&&f.live){var b=this.mainDetails;if(h.deltaUpdateFailed||!b)return;var M=b.fragments[0];if(!g.details)h.hasProgramDateTime&&b.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(h,b):M&&Object(O.addSliding)(h,M.start);else{var F=this.alignPlaylists(h,g.details);F===0&&M&&Object(O.addSliding)(h,M.start)}}if(g.details=h,this.levelLastLoaded=d,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var j=Object(B.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},c._handleFragmentLoadComplete=function(w){var y=w.frag,f=w.payload,h=y.decryptdata,d=this.hls;if(this.fragContextChanged(y))return;if(f&&f.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),h.key.buffer,h.iv.buffer).then(function(v){var g=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:y,payload:v,stats:{tstart:a,tdecrypt:g}})})}},c.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var w,y=this.currentTrackId,f=this.levels;if(!f.length||!f[y]||!f[y].details)return;var h=f[y].details,d=h.targetduration,a=this.config,v=this.media,g=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-d,a.maxBufferHole),b=g.end,M=g.len,F=this.getMaxBufferLength()+d;if(M>F)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var j=h.fragments,W=j.length,_=h.edge,k,H=this.fragPrevious;if(b<_){var X=a.maxFragLookUpTolerance;H&&h.hasProgramDateTime&&(k=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,X)),k||(k=Object(B.findFragmentByPTS)(H,j,b,X),!k&&H&&H.start<j[0].start&&(k=j[0]))}else k=j[W-1];(w=k)!==null&&w!==void 0&&w.encrypted?(U.logger.log("Loading key for "+k.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:k})):k&&this.fragmentTracker.getState(k)===D.FragmentState.NOT_LOADED&&this.loadFragment(k,h,b)}},c.loadFragment=function(w,y,f){this.fragCurrent=w,l.prototype.loadFragment.call(this,w,y,f)},T(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(x.default)},"./src/controller/subtitle-track-controller.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/events.ts"),U=L("./src/utils/texttrack-utils.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function I(C,T){for(var p=0;p<T.length;p++){var u=T[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function O(C,T,p){return T&&I(C.prototype,T),p&&I(C,p),C}function D(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,x(C,T)}function x(C,T){return x=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},x(C,T)}var A=function(C){D(T,C);function T(u){var o;return o=C.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var p=T.prototype;return p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},p.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(z.Events.ERROR,this.onError,this)},p.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)},p.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},p.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=P(this.media.textTracks);o.forEach(function(s){Object(U.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},p.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},p.onSubtitleTrackLoaded=function(o,s){var l=s.id,S=s.details,c=this.trackId,m=this.tracksInGroup[c];if(!m){this.warn("Invalid subtitle track id "+l);return}var w=m.details;m.details=s.details,this.log("subtitle track "+l+" loaded ["+S.startSN+"-"+S.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,w))},p.onLevelLoading=function(o,s){this.switchLevel(s.level)},p.onLevelSwitching=function(o,s){this.switchLevel(s.level)},p.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,c=this.tracks.filter(function(y){return!l||y.groupId===l});this.tracksInGroup=c;var m=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=l;var w={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,w),m!==-1&&this.setSubtitleTrack(m,S)}},p.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var S=s[l];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},p.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)},p.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,S=s.groupId,c=s.url;if(o)try{c=o.addDirectives(c)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:c,id:l,groupId:S,deliveryDirectives:o||null})}},p.toggleTrackModes=function(o){var s=this,l=this.media,S=this.subtitleDisplay,c=this.trackId;if(!l)return;var m=P(l.textTracks),w=m.filter(function(h){return h.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(h){h.mode="disabled"});else{var y=w[c];y&&(y.mode="disabled")}var f=w[o];f&&(f.mode=S?"showing":"hidden")},p.setSubtitleTrack=function(o,s){var l,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=S[o])!==null&&l!==void 0&&l.details)||o<-1||o>=S.length)return;this.clearTimer();var c=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,c){var m=c.id,w=c.groupId,y=w===void 0?"":w,f=c.name,h=c.type,d=c.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:f,type:h,url:d});var a=this.switchParams(c.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},p.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=P(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")o=l;else if(s[l].mode==="showing"){o=l;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},O(T,[{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)}}]),T}(R.default);function P(C){for(var T=[],p=0;p<C.length;p++){var u=C[p];u.kind==="subtitles"&&u.label&&T.push(C[p])}return T}V.default=A},"./src/controller/timeline-controller.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"TimelineController",function(){return P});var z=L("./src/polyfills/number.ts"),U=L("./src/events.ts"),R=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),I=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),x=L("./src/types/loader.ts"),A=L("./src/utils/logger.ts"),P=function(){function u(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=p(),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 l=new B.default(this,"textTrack1"),S=new B.default(this,"textTrack2"),c=new B.default(this,"textTrack3"),m=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,l,S),this.cea608Parser2=new R.default(3,c,m)}s.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(U.Events.FRAG_LOADING,this.onFragLoading,this),s.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var l=this.hls;l.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(U.Events.FRAG_LOADING,this.onFragLoading,this),l.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(l,S,c,m,w){for(var y=!1,f=w.length;f--;){var h=w[f],d=T(h[0],h[1],S,c);if(d>=0&&(h[0]=Math.min(h[0],S),h[1]=Math.max(h[1],c),y=!0,d/(c-S)>.5))return}if(y||w.push([S,c]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,S,c,m)}else{var v=this.Cues.newCue(null,S,c,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:v,track:l})}},o.onInitPtsFound=function(l,S){var c=this,m=S.frag,w=S.id,y=S.initPTS,f=S.timescale,h=this.unparsedVttFrags;w==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=f),h.length&&(this.unparsedVttFrags=[],h.forEach(function(d){c.onFragLoaded(U.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(l){var S=this.media;if(S)for(var c=0;c<S.textTracks.length;c++){var m=S.textTracks[c];if(m[l])return m}return null},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.createNativeTrack=function(l){if(this.captionsTracks[l])return;var S=this.captionsProperties,c=this.captionsTracks,m=this.media,w=S[l],y=w.label,f=w.languageCode,h=this.getExistingTrack(l);if(h)c[l]=h,Object(O.clearCurrentCues)(c[l]),Object(O.sendAddTrackEvent)(c[l],m);else{var d=this.createTextTrack("captions",y,f);d&&(d[l]=!0,c[l]=d)}},o.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var S=this.captionsProperties[l];if(!S)return;var c=S.label,m={_id:l,label:c,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[l]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(l,S,c){var m=this.media;return m?m.addTextTrack(l,S,c):void 0},o.onMediaAttaching=function(l,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(S){Object(O.clearCurrentCues)(l[S]),delete l[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),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 l=this.media;if(!l)return;var S=l.textTracks;if(S)for(var c=0;c<S.length;c++)Object(O.clearCurrentCues)(S[c])},o.onSubtitleTracksUpdated=function(l,S){var c=this;this.textTracks=[];var m=S.subtitleTracks||[],w=m.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var y=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var v;if(a<f.length){for(var g=null,b=0;b<f.length;b++)if(C(f[b],d)){g=f[b];break}g&&(v=g)}v?Object(O.clearCurrentCues)(v):(v=c.createTextTrack("subtitles",d.name,d.lang),v&&(v.mode="disabled")),v&&(v.groupId=d.groupId,c.textTracks.push(v))})}else if(!y&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},o.onManifestLoaded=function(l,S){var c=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(m){var w=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!w)return;var y="textTrack"+w[1],f=c.captionsProperties[y];if(!f)return;f.label=m.name,m.lang&&(f.languageCode=m.lang),f.media=m})},o.onFragLoading=function(l,S){var c=this.cea608Parser1,m=this.cea608Parser2,w=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(c&&m))return;if(S.frag.type===x.PlaylistLevelType.MAIN){var f,h,d=S.frag.sn,a=(f=S==null||((h=S.part)===null||h===void 0)?void 0:h.index)!=null?f:-1;d===w+1||d===w&&a===y+1||(c.reset(),m.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(l,S){var c=S.frag,m=S.payload,w=this.initPTS,y=this.unparsedVttFrags;if(c.type===x.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(z.isFiniteNumber)(w[c.cc])){y.push(S),w.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Missing initial subtitle PTS")});return}var f=c.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var h=this.tracks[c.level],d=this.vttCCs;d[c.cc]||(d[c.cc]={start:c.start,prevCC:this.prevCC,new:!0},this.prevCC=c.cc),h&&h.textCodec===D.IMSC1_CODEC?this._parseIMSC1(c,m):this._parseVTTs(c,m,d)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,S){var c=this,m=this.hls;Object(D.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(w){c._appendCues(w,l.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(w){A.logger.log("Failed to parse IMSC1: "+w),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:w})})},o._parseVTTs=function(l,S,c){var m=this,w=this.hls;Object(I.parseWebVTT)(S,this.initPTS[l.cc],this.timescale[l.cc],c,l.cc,l.start,function(y){m._appendCues(y,l.level),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(y){m._fallbackToIMSC1(l,S),A.logger.log("Failed to parse VTT cue: "+y),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:y})})},o._fallbackToIMSC1=function(l,S){var c=this,m=this.tracks[l.level];m.textCodec||Object(D.parseIMSC1)(S,this.initPTS[l.cc],this.timescale[l.cc],function(){m.textCodec=D.IMSC1_CODEC,c._parseIMSC1(l,S)},function(){m.textCodec="wvtt"})},o._appendCues=function(l,S){var c=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[S];if(m.mode==="disabled")return;l.forEach(function(f){return Object(O.addCueToTrack)(m,f)})}else{var w=this.tracks[S],y=w.default?"default":"subtitles"+S;c.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:l,track:y})}},o.onFragDecrypted=function(l,S){var c=S.frag;if(c.type===x.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[c.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(U.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(l,S){var c=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(c&&m))return;for(var w=0;w<S.samples.length;w++){var y=S.samples[w].bytes;if(y){var f=this.extractCea608Data(y);c.addData(S.samples[w].pts,f[0]),m.addData(S.samples[w].pts,f[1])}}},o.onBufferFlushing=function(l,S){var c=S.startOffset,m=S.endOffset,w=S.endOffsetSubtitles,y=S.type,f=this.media;if(!f||f.currentTime<m)return;if(!y||y==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(a){return Object(O.removeCuesInRange)(h[a],c,m)})}if(this.config.renderTextTracksNatively&&(c===0&&w!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(O.removeCuesInRange)(d[a],c,w)})}},o.extractCea608Data=function(l){for(var S=l[0]&31,c=2,m=[[],[]],w=0;w<S;w++){var y=l[c++],f=127&l[c++],h=127&l[c++],d=(4&y)!==0,a=3&y;if(f===0&&h===0)continue;d&&((a===0||a===1)&&(m[a].push(f),m[a].push(h)))}return m},u}();function C(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function T(u,o,s,l){return Math.min(o,l)-Math.max(u,s)}function p(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return z});var z=function(){function U(B,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=I}var R=U.prototype;return R.decrypt=function(I,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,I)},U}()},"./src/crypt/aes-decryptor.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"removePadding",function(){return U}),L.d(V,"default",function(){return R});var z=L("./src/utils/typed-array.ts");function U(B){var I=B.byteLength,O=I&&new DataView(B.buffer).getUint8(I-1);return O?Object(z.sliceUint8)(B,0,I-O):B}var R=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var I=B.prototype;return I.uint8ArrayToUint32Array_=function(D){for(var x=new DataView(D),A=new Uint32Array(4),P=0;P<4;P++)A[P]=x.getUint32(P*4);return A},I.initTable=function(){var D=this.sBox,x=this.invSBox,A=this.subMix,P=A[0],C=A[1],T=A[2],p=A[3],u=this.invSubMix,o=u[0],s=u[1],l=u[2],S=u[3],c=new Uint32Array(256),m=0,w=0,y=0;for(y=0;y<256;y++)y<128?c[y]=y<<1:c[y]=y<<1^283;for(y=0;y<256;y++){var f=w^w<<1^w<<2^w<<3^w<<4;f=f>>>8^f&255^99,D[m]=f,x[f]=m;var h=c[m],d=c[h],a=c[d],v=c[f]*257^f*16843008;P[m]=v<<24|v>>>8,C[m]=v<<16|v>>>16,T[m]=v<<8|v>>>24,p[m]=v,v=a*16843009^d*65537^h*257^m*16843008,o[f]=v<<24|v>>>8,s[f]=v<<16|v>>>16,l[f]=v<<8|v>>>24,S[f]=v,m?(m=h^c[c[c[a^h]]],w^=c[c[w]]):m=w=1}},I.expandKey=function(D){for(var x=this.uint8ArrayToUint32Array_(D),A=!0,P=0;P<x.length&&A;)A=x[P]===this.key[P],P++;if(A)return;this.key=x;var C=this.keySize=x.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var T=this.ksRows=(C+6+1)*4,p,u,o=this.keySchedule=new Uint32Array(T),s=this.invKeySchedule=new Uint32Array(T),l=this.sBox,S=this.rcon,c=this.invSubMix,m=c[0],w=c[1],y=c[2],f=c[3],h,d;for(p=0;p<T;p++){if(p<C){h=o[p]=x[p];continue}d=h,p%C===0?(d=d<<8|d>>>24,d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255],d^=S[p/C|0]<<24):C>6&&p%C===4&&(d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255]),o[p]=h=(o[p-C]^d)>>>0}for(u=0;u<T;u++)p=T-u,u&3?d=o[p]:d=o[p-4],u<4||p<=4?s[u]=d:s[u]=m[l[d>>>24]]^w[l[d>>>16&255]]^y[l[d>>>8&255]]^f[l[d&255]],s[u]=s[u]>>>0},I.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},I.decrypt=function(D,x,A){for(var P=this.keySize+6,C=this.invKeySchedule,T=this.invSBox,p=this.invSubMix,u=p[0],o=p[1],s=p[2],l=p[3],S=this.uint8ArrayToUint32Array_(A),c=S[0],m=S[1],w=S[2],y=S[3],f=new Int32Array(D),h=new Int32Array(f.length),d,a,v,g,b,M,F,j,W,_,k,H,X,q,re=this.networkToHostOrderSwap;x<f.length;){for(W=re(f[x]),_=re(f[x+1]),k=re(f[x+2]),H=re(f[x+3]),b=W^C[0],M=H^C[1],F=k^C[2],j=_^C[3],X=4,q=1;q<P;q++)d=u[b>>>24]^o[M>>16&255]^s[F>>8&255]^l[j&255]^C[X],a=u[M>>>24]^o[F>>16&255]^s[j>>8&255]^l[b&255]^C[X+1],v=u[F>>>24]^o[j>>16&255]^s[b>>8&255]^l[M&255]^C[X+2],g=u[j>>>24]^o[b>>16&255]^s[M>>8&255]^l[F&255]^C[X+3],b=d,M=a,F=v,j=g,X=X+4;d=T[b>>>24]<<24^T[M>>16&255]<<16^T[F>>8&255]<<8^T[j&255]^C[X],a=T[M>>>24]<<24^T[F>>16&255]<<16^T[j>>8&255]<<8^T[b&255]^C[X+1],v=T[F>>>24]<<24^T[j>>16&255]<<16^T[b>>8&255]<<8^T[M&255]^C[X+2],g=T[j>>>24]<<24^T[b>>16&255]<<16^T[M>>8&255]<<8^T[F&255]^C[X+3],h[x]=re(d^c),h[x+1]=re(g^m),h[x+2]=re(v^w),h[x+3]=re(a^y),c=W,m=_,w=k,y=H,x=x+4}return h.buffer},B}()},"./src/crypt/decrypter.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return x});var z=L("./src/crypt/aes-crypto.ts"),U=L("./src/crypt/fast-aes-key.ts"),R=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),I=L("./src/utils/mp4-tools.ts"),O=L("./src/utils/typed-array.ts"),D=16,x=function(){function A(C,T,p){var u=p===void 0?{}:p,o=u.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=T,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=A.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var T=this.currentResult;if(!T){this.reset();return}var p=new Uint8Array(T);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(p):p},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(T,p,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(T),p,u);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(T),p,u).then(o)},P.softwareDecrypt=function(T,p,u){var o=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(T=Object(I.appendUint8Array)(l,T),this.remainderData=null);var S=this.getValidChunk(T);if(!S.length)return null;o&&(u=o);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new R.default),c.expandKey(p);var m=s;return this.currentResult=c.decrypt(S.buffer,0,u),this.currentIV=Object(O.sliceUint8)(S,-16).buffer,m||null},P.webCryptoDecrypt=function(T,p,u){var o=this,s=this.subtle;return(this.key!==p||!this.fastAesKey)&&(this.key=p,this.fastAesKey=new U.default(s,p)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new z.default(s,u);return S.decrypt(T.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,T,p,u)})},P.onWebCryptoError=function(T,p,u,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",T),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(p,u,o)},P.getValidChunk=function(T){var p=T,u=T.length-T.length%D;return u!==T.length&&(p=Object(O.sliceUint8)(T,0,u),this.remainderData=Object(O.sliceUint8)(T,u)),p},P.logOnce=function(T){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+T),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return z});var z=function(){function U(B,I){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=I}var R=U.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/demux/base-audio-demuxer.ts"),U=L("./src/demux/adts.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function I(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,O(x,A)}function O(x,A){return O=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},O(x,A)}var D=function(x){I(A,x);function A(C,T){var p;return p=x.call(this)||this,p.observer=void 0,p.config=void 0,p.observer=C,p.config=T,p}var P=A.prototype;return P.resetInitSegment=function(T,p,u){x.prototype.resetInitSegment.call(this,T,p,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:T,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(T){if(!T)return!1;for(var p=B.getID3Data(T,0)||[],u=p.length,o=T.length;u<o;u++)if(U.probe(T,u))return R.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(T,p){return U.canParse(T,p)},P.appendFrame=function(T,p,u){U.initTrackConfig(T,this.observer,p,u,T.manifestCodec);var o=U.appendFrame(T,p,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(z.default);D.minProbeByteLength=9,V.default=D},"./src/demux/adts.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"getAudioConfig",function(){return B}),L.d(V,"isHeaderPattern",function(){return I}),L.d(V,"getHeaderLength",function(){return O}),L.d(V,"getFullFrameLength",function(){return D}),L.d(V,"canGetFrameLength",function(){return x}),L.d(V,"isHeader",function(){return A}),L.d(V,"canParse",function(){return P}),L.d(V,"probe",function(){return C}),L.d(V,"initTrackConfig",function(){return T}),L.d(V,"getFrameDuration",function(){return p}),L.d(V,"parseFrameHeader",function(){return u}),L.d(V,"appendFrame",function(){return o});var z=L("./src/utils/logger.ts"),U=L("./src/errors.ts"),R=L("./src/events.ts");function B(s,l,S,c){var m,w,y,f,h=navigator.userAgent.toLowerCase(),d=c,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((l[S+2]&192)>>>6)+1;var v=(l[S+2]&60)>>>2;if(v>a.length-1){s.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return y=(l[S+2]&1)<<2,y|=(l[S+3]&192)>>>6,z.logger.log("manifest codec:"+c+", ADTS type:"+m+", samplingIndex:"+v),/firefox/i.test(h)?v>=6?(m=5,f=new Array(4),w=v-3):(m=2,f=new Array(2),w=v):h.indexOf("android")!==-1?(m=2,f=new Array(2),w=v):(m=5,f=new Array(4),c&&(c.indexOf("mp4a.40.29")!==-1||c.indexOf("mp4a.40.5")!==-1)||!c&&v>=6?w=v-3:((c&&c.indexOf("mp4a.40.2")!==-1&&(v>=6&&y===1||/vivaldi/i.test(h))||!c&&y===1)&&(m=2,f=new Array(2)),w=v)),f[0]=m<<3,f[0]|=(v&14)>>1,f[1]|=(v&1)<<7,f[1]|=y<<3,m===5&&(f[1]|=(w&14)>>1,f[2]=(w&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[v],channelCount:y,codec:"mp4a.40."+m,manifestCodec:d}}function I(s,l){return s[l]===255&&(s[l+1]&246)===240}function O(s,l){return s[l+1]&1?7:9}function D(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function x(s,l){return l+5<s.length}function A(s,l){return l+1<s.length&&I(s,l)}function P(s,l){return x(s,l)&&I(s,l)&&D(s,l)<=s.length-l}function C(s,l){if(A(s,l)){var S=O(s,l);if(l+S>=s.length)return!1;var c=D(s,l);if(c<=S)return!1;var m=l+c;return m===s.length||A(s,m)}return!1}function T(s,l,S,c,m){if(!s.samplerate){var w=B(l,S,c,m);if(!w)return;s.config=w.config,s.samplerate=w.samplerate,s.channelCount=w.channelCount,s.codec=w.codec,s.manifestCodec=w.manifestCodec,z.logger.log("parsed codec:"+s.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function p(s){return 1024*9e4/s}function u(s,l,S,c,m){var w=O(s,l),y=D(s,l);if(y-=w,y>0){var f=S+c*m;return{headerLength:w,frameLength:y,stamp:f}}}function o(s,l,S,c,m){var w=p(s.samplerate),y=u(l,S,c,m,w);if(y){var f=y.frameLength,h=y.headerLength,d=y.stamp,a=h+f,v=Math.max(0,S+a-l.length),g;v?(g=new Uint8Array(a-h),g.set(l.subarray(S+h,l.length),0)):g=l.subarray(S+h,S+a);var b={unit:g,pts:d};return v||s.samples.push(b),{sample:b,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"initPTSFn",function(){return D});var z=L("./src/polyfills/number.ts"),U=L("./src/demux/id3.ts"),R=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/typed-array.ts"),O=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=x.prototype;return A.resetInitSegment=function(C,T,p){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(C,T){return!1},A.appendFrame=function(C,T,p){},A.demux=function(C,T){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var p=U.getID3Data(C,0),u=p?p.length:0,o,s,l=this._audioTrack,S=this._id3Track,c=p?U.getTimeStamp(p):void 0,m=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(c,T)),p&&p.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:p}),s=this.initPTS;u<m;){if(this.canParse(C,u)){var w=this.appendFrame(l,C,u);w?(this.frameIndex++,s=w.sample.pts,u+=w.length,o=u):u=m}else U.canParse(C,u)?(p=U.getID3Data(C,u),S.samples.push({pts:s,dts:s,data:p}),u+=p.length,o=u):u++;if(u===m&&o!==m){var y=Object(I.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:l,avcTrack:Object(R.dummyTrack)(),id3Track:S,textTrack:Object(R.dummyTrack)()}},A.demuxSampleAes=function(C,T,p){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(C){var T=this.cachedData;return T&&(this.cachedData=null,this.demux(T,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},A.destroy=function(){},x}(),D=function(A,P){return Object(z.isFiniteNumber)(A)?A*90:P*9e4};V.default=O},"./src/demux/chunk-cache.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return z});var z=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(O){this.chunks.push(O),this.dataLength+=O.length},B.flush=function(){var O=this.chunks,D=this.dataLength,x;if(O.length)O.length===1?x=O[0]:x=U(O,D);else return new Uint8Array(0);return this.reset(),x},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function U(R,B){for(var I=new Uint8Array(B),O=0,D=0;D<R.length;D++){var x=R[D];I.set(x,O),O+=x.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/utils/logger.ts"),U=function(){function R(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var O=this.data,D=this.bytesAvailable,x=O.byteLength-D,A=new Uint8Array(4),P=Math.min(4,D);if(P===0)throw new Error("no bytes available");A.set(O.subarray(x,x+P)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},B.skipBits=function(O){var D;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,D=O>>3,O-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},B.readBits=function(O){var D=Math.min(this.bitsAvailable,O),x=this.word>>>32-D;return O>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=O-D,D>0&&this.bitsAvailable?x<<D|this.readBits(D):x},B.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},B.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>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(O){for(var D=8,x=8,A,P=0;P<O;P++)x!==0&&(A=this.readEG(),x=(D+A+256)%256),D=x===0?D:x},B.readSPS=function(){var O=0,D=0,x=0,A=0,P,C,T,p=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),S=this.skipEG.bind(this),c=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);p();var w=p();if(u(5),l(3),p(),c(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var y=o();if(y===3&&l(1),c(),c(),l(1),s())for(C=y!==3?8:12,T=0;T<C;T++)s()&&(T<6?m(16):m(64))}c();var f=o();if(f===0)o();else if(f===1)for(l(1),S(),S(),P=o(),T=0;T<P;T++)S();c(),l(1);var h=o(),d=o(),a=u(1);a===0&&l(1),l(1),s()&&(O=o(),D=o(),x=o(),A=o());var v=[1,1];if(s()&&s()){var g=p();switch(g){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[p()<<8|p(),p()<<8|p()];break}}}return{width:Math.ceil((h+1)*16-O*2-D*2),height:(2-a)*(d+1)*16-(a?2:4)*(x+A),pixelRatio:v}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=U},"./src/demux/id3.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"isHeader",function(){return z}),L.d(V,"isFooter",function(){return U}),L.d(V,"getID3Data",function(){return R}),L.d(V,"canParse",function(){return I}),L.d(V,"getTimeStamp",function(){return O}),L.d(V,"isTimeStampFrame",function(){return D}),L.d(V,"getID3Frames",function(){return A}),L.d(V,"decodeFrame",function(){return P}),L.d(V,"utf8ArrayToStr",function(){return o}),L.d(V,"testables",function(){return s});var z=function(m,w){return w+10<=m.length&&(m[w]===73&&m[w+1]===68&&m[w+2]===51&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},U=function(m,w){return w+10<=m.length&&(m[w]===51&&m[w+1]===68&&m[w+2]===73&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},R=function(m,w){for(var y=w,f=0;z(m,w);){f+=10;var h=B(m,w+6);f+=h,U(m,w+10)&&(f+=10),w+=f}return f>0?m.subarray(y,y+f):void 0},B=function(m,w){var y=0;return y=(m[w]&127)<<21,y|=(m[w+1]&127)<<14,y|=(m[w+2]&127)<<7,y|=m[w+3]&127,y},I=function(m,w){return z(m,w)&&B(m,w+6)+10<=m.length-w},O=function(m){for(var w=A(m),y=0;y<w.length;y++){var f=w[y];if(D(f))return u(f)}return},D=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},x=function(m){var w=String.fromCharCode(m[0],m[1],m[2],m[3]),y=B(m,4),f=10;return{type:w,size:y,data:m.subarray(f,f+y)}},A=function(m){for(var w=0,y=[];z(m,w);){var f=B(m,w+6);w+=10;for(var h=w+f;w+8<h;){var d=x(m.subarray(w)),a=P(d);a&&y.push(a),w+=d.size+10}U(m,w)&&(w+=10)}return y},P=function(m){return m.type==="PRIV"?C(m):m.type[0]==="W"?p(m):T(m)},C=function(m){if(m.size<2)return;var w=o(m.data,!0),y=new Uint8Array(m.data.subarray(w.length+1));return{key:m.type,info:w,data:y.buffer}},T=function(m){if(m.size<2)return;if(m.type==="TXXX"){var w=1,y=o(m.data.subarray(w),!0);w+=y.length+1;var f=o(m.data.subarray(w));return{key:m.type,info:y,data:f}}var h=o(m.data.subarray(1));return{key:m.type,data:h}},p=function(m){if(m.type==="WXXX"){if(m.size<2)return;var w=1,y=o(m.data.subarray(w),!0);w+=y.length+1;var f=o(m.data.subarray(w));return{key:m.type,info:y,data:f}}var h=o(m.data);return{key:m.type,data:h}},u=function(m){if(m.data.byteLength===8){var w=new Uint8Array(m.data),y=w[3]&1,f=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return f/=45,y&&(f+=4772185884e-2),Math.round(f)}return},o=function(m,w){w===void 0&&(w=!1);var y=S();if(y){var f=y.decode(m);if(w){var h=f.indexOf("\0");return h!==-1?f.substring(0,h):f}return f.replace(/\0/g,"")}for(var d=m.length,a,v,g,b="",M=0;M<d;){if(a=m[M++],a===0&&w)return b;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(a);break;case 12:case 13:v=m[M++],b+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=m[M++],g=m[M++],b+=String.fromCharCode((a&15)<<12|(v&63)<<6|(g&63)<<0);break;default:}}return b},s={decodeTextFrame:T},l;function S(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/demux/base-audio-demuxer.ts"),U=L("./src/demux/id3.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function I(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,O(x,A)}function O(x,A){return O=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},O(x,A)}var D=function(x){I(A,x);function A(){return x.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(T,p,u){x.prototype.resetInitSegment.call(this,T,p,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:T,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(T){if(!T)return!1;for(var p=U.getID3Data(T,0)||[],u=p.length,o=T.length;u<o;u++)if(B.probe(T,u))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(T,p){return B.canParse(T,p)},P.appendFrame=function(T,p,u){return this.initPTS===null?void 0:B.appendFrame(T,p,u,this.initPTS,this.frameIndex)},A}(z.default);D.minProbeByteLength=4,V.default=D},"./src/demux/mp4demuxer.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/utils/mp4-tools.ts"),U=L("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(O,D){this.remainderData=null,this.config=void 0,this.config=D}var I=B.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},B.probe=function(D){return Object(z.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},I.demux=function(D){var x=D,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(z.appendUint8Array)(this.remainderData,D));var P=Object(z.segmentValidRange)(x);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=x;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.flush=function(){var D=Object(U.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:D,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.demuxSampleAes=function(D,x,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"appendFrame",function(){return O}),L.d(V,"parseHeader",function(){return D}),L.d(V,"isHeaderPattern",function(){return x}),L.d(V,"isHeader",function(){return A}),L.d(V,"canParse",function(){return P}),L.d(V,"probe",function(){return C});var z=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function O(T,p,u,o,s){if(u+24>p.length)return;var l=D(p,u);if(l&&u+l.frameLength<=p.length){var S=l.samplesPerFrame*9e4/l.sampleRate,c=o+s*S,m={unit:p.subarray(u,u+l.frameLength),pts:c,dts:c};return T.config=[],T.channelCount=l.channelCount,T.samplerate=l.sampleRate,T.samples.push(m),{sample:m,length:l.frameLength,missing:0}}}function D(T,p){var u=T[p+1]>>3&3,o=T[p+1]>>1&3,s=T[p+2]>>4&15,l=T[p+2]>>2&3;if(u!==1&&s!==0&&s!==15&&l!==3){var S=T[p+2]>>1&1,c=T[p+3]>>6,m=u===3?3-o:o===3?3:4,w=U[m*14+s-1]*1e3,y=u===3?0:u===2?1:2,f=R[y*3+l],h=c===3?1:2,d=B[u][o],a=I[o],v=d*8*a,g=Math.floor(d*w/f+S)*a;if(z===null){var b=navigator.userAgent||"",M=b.match(/Chrome\/(\d+)/i);z=M?parseInt(M[1]):0}var F=!!z&&z<=87;return F&&o===2&&w>=224e3&&c===0&&(T[p+3]=T[p+3]|128),{sampleRate:f,channelCount:h,frameLength:g,samplesPerFrame:v}}}function x(T,p){return T[p]===255&&(T[p+1]&224)===224&&(T[p+1]&6)!==0}function A(T,p){return p+1<T.length&&x(T,p)}function P(T,p){var u=4;return x(T,p)&&u<=T.length-p}function C(T,p){if(p+1<T.length&&x(T,p)){var u=4,o=D(T,p),s=u;o!=null&&o.frameLength&&(s=o.frameLength);var l=p+s;return l===T.length||A(T,l)}return!1}},"./src/demux/sample-aes.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/crypt/decrypter.ts"),U=L("./src/demux/tsdemuxer.ts"),R=function(){function B(O,D,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new z.default(O,D,{removePKCS7Padding:!1})}var I=B.prototype;return I.decryptBuffer=function(D,x){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,x)},I.decryptAacSample=function(D,x,A,P){var C=D[x].unit,T=C.subarray(16,C.length-C.length%16),p=T.buffer.slice(T.byteOffset,T.byteOffset+T.length),u=this;this.decryptBuffer(p,function(o){var s=new Uint8Array(o);C.set(s,16),P||u.decryptAacSamples(D,x+1,A)})},I.decryptAacSamples=function(D,x,A){for(;;x++){if(x>=D.length){A();return}if(D[x].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(D,x,A,P),!P)return}},I.getAvcEncryptedData=function(D){for(var x=Math.floor((D.length-48)/160)*16+16,A=new Int8Array(x),P=0,C=32;C<=D.length-16;C+=160,P+=16)A.set(D.subarray(C,C+16),P);return A},I.getAvcDecryptedUnit=function(D,x){for(var A=new Uint8Array(x),P=0,C=32;C<=D.length-16;C+=160,P+=16)D.set(A.subarray(P,P+16),C);return D},I.decryptAvcSample=function(D,x,A,P,C,T){var p=Object(U.discardEPB)(C.data),u=this.getAvcEncryptedData(p),o=this;this.decryptBuffer(u.buffer,function(s){C.data=o.getAvcDecryptedUnit(p,s),T||o.decryptAvcSamples(D,x,A+1,P)})},I.decryptAvcSamples=function(D,x,A,P){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,A=0){if(x>=D.length){P();return}for(var C=D[x].units;!(A>=C.length);A++){var T=C[A];if(T.data.length<=48||T.type!==1&&T.type!==5)continue;var p=this.decrypter.isSync();if(this.decryptAvcSample(D,x,A,P,T,p),!p)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C});var z=L("./node_modules/webworkify-webpack/index.js"),U=L.n(z),R=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),I=L("./src/utils/logger.ts"),O=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),x=L("./node_modules/eventemitter3/index.js"),A=L.n(x),P=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function T(u,o,s,l){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=u,this.id=o,this.onTransmuxComplete=s,this.onFlush=l;var c=u.config,m=function(d,a){a=a||{},a.frag=S.frag,a.id=S.id,u.trigger(d,a)};this.observer=new x.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,m),this.observer.on(R.Events.ERROR,m);var w={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(c.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var f;try{f=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(h){u.trigger(R.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},f.postMessage({cmd:"init",typeSupported:w,vendor:y,id:o,config:JSON.stringify(c)})}catch(h){I.logger.warn("Error in worker:",h),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new B.default(this.observer,w,c,y,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,w,c,y,o)}var p=T.prototype;return p.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 l=this.observer;l&&l.removeAllListeners(),this.observer=null},p.push=function(o,s,l,S,c,m,w,y,f,h){var d=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,g=m?m.start:c.start,b=c.decryptdata,M=this.frag,F=!(M&&c.cc===M.cc),j=!(M&&f.level===M.level),W=M?f.sn-M.sn:-1,_=this.part?f.part-this.part.index:1,k=!j&&(W===1||W===0&&_===1),H=self.performance.now();(j||W||c.stats.parsing.start===0)&&(c.stats.parsing.start=H),m&&(_||!k)&&(m.stats.parsing.start=H);var X=new B.TransmuxState(F,k,y,j,g);if(!k||F){I.logger.log("[transmuxer-interface, "+c.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+F+`
trackSwitch: `+j+`
contiguous: `+k+`
accurateTimeOffset: `+y+`
timeOffset: `+g);var q=new B.TransmuxConfig(l,S,s,w,h);this.configureTransmuxer(q)}if(this.frag=c,this.part=m,v)v.postMessage({cmd:"demux",data:o,decryptdata:b,chunkMeta:f,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var re=a.push(o,b,f,X);Object(B.isPromise)(re)?re.then(function(Ee){d.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(re)}},p.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(l){var c=l.flush(o);Object(B.isPromise)(c)?c.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(c,o)}},p.handleFlushResult=function(o,s){var l=this;o.forEach(function(S){l.handleTransmuxComplete(S)}),this.onFlush(s)},p.onWorkerMessage=function(o){var s=o.data,l=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,l.trigger(s.event,s.data);break}}},p.configureTransmuxer=function(o){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):l&&l.configure(o)},p.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},T}()},"./src/demux/transmuxer-worker.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return O});var z=L("./src/demux/transmuxer.ts"),U=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),I=L.n(B);function O(C){var T=new B.EventEmitter,p=function(o,s){C.postMessage({event:o,data:s})};T.on(U.Events.FRAG_DECRYPTED,p),T.on(U.Events.ERROR,p),C.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new z.default(T,o.typeSupported,s,o.vendor,o.id),Object(R.enableLogs)(s.debug),p("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var l=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(z.isPromise)(l)?l.then(function(m){D(C,m)}):D(C,l);break}case"flush":{var S=o.chunkMeta,c=C.transmuxer.flush(S);Object(z.isPromise)(c)?c.then(function(m){A(C,m,S)}):A(C,c,S);break}default:break}})}function D(C,T){if(P(T.remuxResult))return;var p=[],u=T.remuxResult,o=u.audio,s=u.video;o&&x(p,o),s&&x(p,s),C.postMessage({event:"transmuxComplete",data:T},p)}function x(C,T){T.data1&&C.push(T.data1.buffer),T.data2&&C.push(T.data2.buffer)}function A(C,T,p){T.forEach(function(u){D(C,u)}),C.postMessage({event:"flush",data:p})}function P(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return s}),L.d(V,"isPromise",function(){return c}),L.d(V,"TransmuxConfig",function(){return m}),L.d(V,"TransmuxState",function(){return w});var z=L("./src/events.ts"),U=L("./src/errors.ts"),R=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),I=L("./src/demux/mp4demuxer.ts"),O=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),x=L("./src/remux/mp4-remuxer.ts"),A=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),T=L("./src/utils/logger.ts"),p;try{p=self.performance.now.bind(self.performance)}catch(y){T.logger.debug("Unable to use Performance API on this environment"),p=self.Date.now}var u=[{demux:O.default,remux:x.default},{demux:I.default,remux:A.default},{demux:B.default,remux:x.default},{demux:D.default,remux:x.default}],o=1024;u.forEach(function(y){var f=y.demux;o=Math.max(o,f.minProbeByteLength)});var s=function(){function y(h,d,a,v,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new P.default,this.observer=h,this.typeSupported=d,this.config=a,this.vendor=v,this.id=g}var f=y.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,a,v,g){var b=this,M=v.transmuxing;M.executeStart=p();var F=new Uint8Array(d),j=this.cache,W=this.config,_=this.currentTransmuxState,k=this.transmuxConfig;g&&(this.currentTransmuxState=g);var H=l(F,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var q=X.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!q)return M.executeEnd=p(),S(v);F=new Uint8Array(q)}else return this.decryptionPromise=X.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(we){var Oe=b.push(we,null,v);return b.decryptionPromise=null,Oe}),this.decryptionPromise}var re=g||_,Ee=re.contiguous,me=re.discontinuity,Se=re.trackSwitch,ve=re.accurateTimeOffset,fe=re.timeOffset,ue=k.audioCodec,he=k.videoCodec,Q=k.defaultInitPts,ne=k.duration,Z=k.initSegmentData;if((me||Se)&&this.resetInitSegment(Z,ue,he,ne),me&&this.resetInitialTimestamp(Q),Ee||this.resetContiguity(),this.needsProbing(F,me,Se)){if(j.dataLength){var ge=j.flush();F=Object(C.appendUint8Array)(ge,F)}this.configureTransmuxer(F,k)}var Te=this.transmux(F,H,fe,ve,v),pe=this.currentTransmuxState;return pe.contiguous=!0,pe.discontinuity=!1,pe.trackSwitch=!1,M.executeEnd=p(),Te},f.flush=function(d){var a=this,v=d.transmuxing;v.executeStart=p();var g=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(g){var _=g.flush();_&&j.push(this.push(_,null,d))}var k=b.dataLength;b.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return k>=o&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=p(),[S(d)];var q=H.flush(W);return c(q)?q.then(function(re){return a.flushRemux(j,re,d),j}):(this.flushRemux(j,q,d),j)},f.flushRemux=function(d,a,v){var g=a.audioTrack,b=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,_=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var k=this.remuxer.remux(g,b,M,F,_,W,!0,this.id);d.push({remuxResult:k,chunkMeta:v}),v.transmuxing.executeEnd=p()},f.resetInitialTimestamp=function(d){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(d),v.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(d,a,v,g){var b=this.demuxer,M=this.remuxer;if(!b||!M)return;b.resetInitSegment(a,v,g),M.resetInitSegment(d,a,v)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(d,a,v,g,b){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(d,a,v,g,b):M=this.transmuxUnencrypted(d,v,g,b),M},f.transmuxUnencrypted=function(d,a,v,g){var b=this.demuxer.demux(d,a,!1,!this.config.progressive),M=b.audioTrack,F=b.avcTrack,j=b.id3Track,W=b.textTrack,_=this.remuxer.remux(M,F,j,W,a,v,!1,this.id);return{remuxResult:_,chunkMeta:g}},f.transmuxSampleAes=function(d,a,v,g,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,g,!1,M.id);return{remuxResult:j,chunkMeta:b}})},f.configureTransmuxer=function(d,a){for(var v=this.config,g=this.observer,b=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,_=a.initSegmentData,k=a.videoCodec,H,X=0,q=u.length;X<q;X++)if(u[X].demux.probe(d)){H=u[X];break}H||(T.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:I.default,remux:A.default});var re=this.demuxer,Ee=this.remuxer,me=H.remux,Se=H.demux;(!Ee||!(Ee instanceof me))&&(this.remuxer=new me(g,v,b,M)),(!re||!(re instanceof Se))&&(this.demuxer=new Se(g,v,b),this.probe=Se.probe),this.resetInitSegment(_,F,k,W),this.resetInitialTimestamp(j)},f.needsProbing=function(d,a,v){return!this.demuxer||!this.remuxer||a||v},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new R.default(this.observer,this.config)),d},y}();function l(y,f){var h=null;return y.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(h=f),h}var S=function(f){return{remuxResult:{},chunkMeta:f}};function c(y){return"then"in y&&y.then instanceof Function}var m=function(f,h,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=f,this.videoCodec=h,this.initSegmentData=d,this.duration=a,this.defaultInitPts=v},w=function(f,h,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=f,this.contiguous=h,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"discardEPB",function(){return S});var z=L("./src/demux/adts.ts"),U=L("./src/demux/mpegaudio.ts"),R=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),I=L("./src/demux/sample-aes.ts"),O=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),x=L("./src/utils/logger.ts"),A=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},C=function(){function c(w,y,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=w,this.config=y,this.typeSupported=f}c.probe=function(y){var f=c.syncOffset(y);return f<0?!1:(f&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},c.syncOffset=function(y){for(var f=Math.min(1e3,y.length-3*188),h=0;h<f;){if(y[h]===71&&y[h+188]===71&&y[h+2*188]===71)return h;h++}return-1},c.createTrack=function(y,f){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:P[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?f:void 0}};var m=c.prototype;return m.resetInitSegment=function(y,f,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=c.createTrack("video",h),this._audioTrack=c.createTrack("audio",h),this._id3Track=c.createTrack("id3",h),this._txtTrack=c.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=f,this._duration=h},m.resetTimeStamp=function(){},m.resetContiguity=function(){var y=this._audioTrack,f=this._avcTrack,h=this._id3Track;y&&(y.pesData=null),f&&(f.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(y,f,h,d){h===void 0&&(h=!1),d===void 0&&(d=!1),h||(this.sampleAes=null);var a,v=this._avcTrack,g=this._audioTrack,b=this._id3Track,M=v.pid,F=v.pesData,j=g.pid,W=b.pid,_=g.pesData,k=b.pesData,H=!1,X=this.pmtParsed,q=this._pmtId,re=y.length;if(this.remainderData&&(y=Object(D.appendUint8Array)(this.remainderData,y),re=y.length,this.remainderData=null),re<188&&!d)return this.remainderData=y,{audioTrack:g,avcTrack:v,id3Track:b,textTrack:this._txtTrack};var Ee=Math.max(0,c.syncOffset(y));re-=(re+Ee)%188,re<y.byteLength&&!d&&(this.remainderData=new Uint8Array(y.buffer,re,y.buffer.byteLength-re));for(var me=Ee;me<re;me+=188)if(y[me]===71){var Se=!!(y[me+1]&64),ve=((y[me+1]&31)<<8)+y[me+2],fe=(y[me+3]&48)>>4,ue=void 0;if(fe>1){if(ue=me+5+y[me+4],ue===me+188)continue}else ue=me+4;switch(ve){case M:Se&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(y.subarray(ue,me+188)),F.size+=me+188-ue);break;case j:Se&&(_&&(a=o(_))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(y.subarray(ue,me+188)),_.size+=me+188-ue);break;case W:Se&&(k&&(a=o(k))&&this.parseID3PES(a),k={data:[],size:0}),k&&(k.data.push(y.subarray(ue,me+188)),k.size+=me+188-ue);break;case 0:Se&&(ue+=y[ue]+1),q=this._pmtId=p(y,ue);break;case q:{Se&&(ue+=y[ue]+1);var he=u(y,ue,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);M=he.avc,M>0&&(v.pid=M),j=he.audio,j>0&&(g.pid=j,g.isAAC=he.isAAC),W=he.id3,W>0&&(b.pid=W),H&&!X&&(x.logger.log("reparse from beginning"),H=!1,me=Ee-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,g.pesData=_,b.pesData=k;var Q={audioTrack:g,avcTrack:v,id3Track:b,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(Q),Q},m.flush=function(){var y=this.remainderData;this.remainderData=null;var f;return y?f=this.demux(y,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},m.extractRemainingSamples=function(y){var f=y.audioTrack,h=y.avcTrack,d=y.id3Track,a=h.pesData,v=f.pesData,g=d.pesData,b;a&&(b=o(a))?(this.parseAVCPES(b,!0),h.pesData=null):h.pesData=a,v&&(b=o(v))?(f.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),f.pesData=null):(v!=null&&v.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=v),g&&(b=o(g))?(this.parseID3PES(b),d.pesData=null):d.pesData=g},m.demuxSampleAes=function(y,f,h){var d=this.demux(y,h,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,f);return this.decrypt(d,a)},m.decrypt=function(y,f){return new Promise(function(h){var d=y.audioTrack,a=y.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){h(y)}):h(y)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){h(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,f){var h=this,d=this._avcTrack,a=this.parseAVCNALu(y.data),v=!1,g=this.avcSample,b,M=!1;y.data=null,g&&a.length&&!d.audFound&&(s(g,d),g=this.avcSample=T(!1,y.pts,y.dts,"")),a.forEach(function(F){switch(F.type){case 1:{b=!0,g||(g=h.avcSample=T(!0,y.pts,y.dts,"")),v&&(g.debug+="NDR "),g.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(g.key=!0)}break}case 5:b=!0,g||(g=h.avcSample=T(!0,y.pts,y.dts,"")),v&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{b=!0,v&&g&&(g.debug+="SEI ");var _=new R.default(S(F.data));_.readUByte();for(var k=0,H=0,X=!1,q=0;!X&&_.bytesAvailable>1;){k=0;do q=_.readUByte(),k+=q;while(q===255);H=0;do q=_.readUByte(),H+=q;while(q===255);if(k===4&&_.bytesAvailable!==0){X=!0;var re=_.readUByte();if(re===181){var Ee=_.readUShort();if(Ee===49){var me=_.readUInt();if(me===1195456820){var Se=_.readUByte();if(Se===3){for(var ve=_.readUByte(),fe=_.readUByte(),ue=31&ve,he=[ve,fe],Q=0;Q<ue;Q++)he.push(_.readUByte()),he.push(_.readUByte()),he.push(_.readUByte());l(h._txtTrack.samples,{type:3,pts:y.pts,bytes:he})}}}}}else if(k===5&&_.bytesAvailable!==0){if(X=!0,H>16){for(var ne=[],Z=0;Z<16;Z++)ne.push(_.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ne.push("-");for(var ge=H-16,Te=new Uint8Array(ge),pe=0;pe<ge;pe++)Te[pe]=_.readUByte();l(h._txtTrack.samples,{pts:y.pts,payloadType:k,uuid:ne.join(""),userData:Object(B.utf8ArrayToStr)(Te),userDataBytes:Te})}}else if(H<_.bytesAvailable)for(var we=0;we<H;we++)_.readUByte()}break}case 7:if(b=!0,M=!0,v&&g&&(g.debug+="SPS "),!d.sps){var Oe=new R.default(F.data),ke=Oe.readSPS();d.width=ke.width,d.height=ke.height,d.pixelRatio=ke.pixelRatio,d.sps=[F.data],d.duration=h._duration;for(var Pe=F.data.subarray(1,4),De="avc1.",Le=0;Le<3;Le++){var We=Pe[Le].toString(16);We.length<2&&(We="0"+We),De+=We}d.codec=De}break;case 8:b=!0,v&&g&&(g.debug+="PPS "),d.pps||(d.pps=[F.data]);break;case 9:b=!1,d.audFound=!0,g&&s(g,d),g=h.avcSample=T(!1,y.pts,y.dts,v?"AUD ":"");break;case 12:b=!1;break;default:b=!1,g&&(g.debug+="unknown NAL "+F.type+" ");break}if(g&&b){var Ye=g.units;Ye.push(F)}}),f&&g&&(s(g,d),this.avcSample=null)},m.getLastNalUnit=function(){var y,f=this.avcSample,h;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((y=f)!==null&&y!==void 0&&y.units){var a=f.units;h=a[a.length-1]}return h},m.parseAVCNALu=function(y){var f=y.byteLength,h=this._avcTrack,d=h.naluState||0,a=d,v=[],g=0,b,M,F,j=-1,W=0;for(d===-1&&(j=0,W=y[0]&31,d=0,g=1);g<f;){if(b=y[g++],!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 _={data:y.subarray(j,g-d-1),type:W};v.push(_)}else{var k=this.getLastNalUnit();if(k&&(a&&g<=4-a&&(k.state&&(k.data=k.data.subarray(0,k.data.byteLength-a))),M=g-d-1,M>0)){var H=new Uint8Array(k.data.byteLength+M);H.set(k.data,0),H.set(y.subarray(0,M),k.data.byteLength),k.data=H,k.state=0}}g<f?(F=y[g]&31,j=g,W=F,d=0):d=-1}else d=0}if(j>=0&&d>=0){var X={data:y.subarray(j,f),type:W,state:d};v.push(X)}if(v.length===0){var q=this.getLastNalUnit();if(q){var re=new Uint8Array(q.data.byteLength+y.byteLength);re.set(q.data,0),re.set(y,q.data.byteLength),q.data=re}}return h.naluState=d,v},m.parseAACPES=function(y){var f=0,h=this._audioTrack,d=this.aacOverFlow,a=y.data;if(d){this.aacOverFlow=null;var v=d.sample.unit.byteLength,g=Math.min(d.missing,v),b=v-g;d.sample.unit.set(a.subarray(0,g),b),h.samples.push(d.sample),f=d.missing}var M,F;for(M=f,F=a.length;M<F-1&&!z.isHeader(a,M);M++);if(M!==f){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),x.logger.warn("parsing error:"+j),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}z.initTrackConfig(h,this.observer,a,M,this.audioCodec);var _;if(y.pts!==void 0)_=y.pts;else if(d){var k=z.getFrameDuration(h.samplerate);_=d.sample.pts+k}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<F;)if(z.isHeader(a,M)){if(M+5<F){var X=z.appendFrame(h,a,M,_,H);if(X)if(X.missing)this.aacOverFlow=X;else{M+=X.length,H++;continue}}break}else M++},m.parseMPEGPES=function(y){var f=y.data,h=f.length,d=0,a=0,v=y.pts;if(v===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<h;)if(U.isHeader(f,a)){var g=U.appendFrame(this._audioTrack,f,a,v,d);if(g)a+=g.length,d++;else break}else a++},m.parseID3PES=function(y){if(y.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},c}();C.minProbeByteLength=188;function T(c,m,w,y){return{key:c,frame:!1,pts:m,dts:w,units:[],debug:y,length:0}}function p(c,m){return(c[m+10]&31)<<8|c[m+11]}function u(c,m,w,y){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(c[m+1]&15)<<8|c[m+2],d=m+3+h-4,a=(c[m+10]&15)<<8|c[m+11];for(m+=12+a;m<d;){var v=(c[m+1]&31)<<8|c[m+2];switch(c[m]){case 207:if(!y){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=v);break;case 21:f.id3===-1&&(f.id3=v);break;case 219:if(!y){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=v);break;case 3:case 4:w?f.audio===-1&&(f.audio=v,f.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((c[m+3]&15)<<8|c[m+4])+5}return f}function o(c){var m=0,w,y,f,h,d,a=c.data;if(!c||c.size===0)return null;for(;a[0].length<19&&a.length>1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}w=a[0];var g=(w[0]<<16)+(w[1]<<8)+w[2];if(g===1){if(y=(w[4]<<8)+w[5],y&&y>c.size-6)return null;var b=w[7];b&192&&(h=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,b&64?(d=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,h-d>60*9e4&&(x.logger.warn(Math.round((h-d)/9e4)+"s delta between PTS and DTS, align them"),h=d)):d=h),f=w[8];var M=f+9;if(c.size<=M)return null;c.size-=M;for(var F=new Uint8Array(c.size),j=0,W=a.length;j<W;j++){w=a[j];var _=w.byteLength;if(M)if(M>_){M-=_;continue}else w=w.subarray(M),_-=M,M=0;F.set(w,m),m+=_}return y&&(y-=f+3),{data:F,pts:h,dts:d,len:y}}return null}function s(c,m){if(c.units.length&&c.frame){if(c.pts===void 0){var w=m.samples,y=w.length;if(y){var f=w[y-1];c.pts=f.pts,c.dts=f.dts}else{m.dropped++;return}}m.samples.push(c)}c.debug.length&&x.logger.log(c.pts+"/"+c.dts+":"+c.debug)}function l(c,m){var w=c.length;if(w>0){if(m.pts>=c[w-1].pts)c.push(m);else for(var y=w-1;y>=0;y--)if(m.pts<c[y].pts){c.splice(y,0,m);break}}else c.push(m)}function S(c){for(var m=c.byteLength,w=[],y=1;y<m-2;)c[y]===0&&c[y+1]===0&&c[y+2]===3?(w.push(y+2),y+=2):y++;if(w.length===0)return c;var f=m-w.length,h=new Uint8Array(f),d=0;for(y=0;y<f;d++,y++)d===w[0]&&(d++,w.shift()),h[y]=c[d];return h}V.default=C},"./src/errors.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"ErrorTypes",function(){return z}),L.d(V,"ErrorDetails",function(){return U});var z;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(z||(z={}));var U;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"Events",function(){return z});var z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return c});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),U=L.n(z),R=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),I=L("./src/controller/id3-track-controller.ts"),O=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),x=L("./src/controller/fragment-tracker.ts"),A=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),T=L("./src/config.ts"),p=L("./node_modules/eventemitter3/index.js"),u=L.n(p),o=L("./src/events.ts"),s=L("./src/errors.ts");function l(m,w){for(var y=0;y<w.length;y++){var f=w[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function S(m,w,y){return w&&l(m.prototype,w),y&&l(m,y),m}var c=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 f=this.config=Object(T.mergeConfig)(m.DefaultConfig,y);this.userConfig=y,Object(C.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(T.enableStreamingMode)(f);var h=f.abrController,d=f.bufferController,a=f.capLevelController,v=f.fpsController,g=this.abrController=new h(this),b=this.bufferController=new d(this),M=this.capLevelController=new a(this),F=new v(this),j=new R.default(this),W=new B.default(this),_=new I.default(this),k=this.levelController=new D.default(this),H=new x.FragmentTracker(this),X=this.streamController=new A.default(this,H);M.setStreamController(X),F.setStreamController(X);var q=[k,X];this.networkControllers=q;var re=[j,W,g,b,M,F,_,H];this.audioTrackController=this.createController(f.audioTrackController,null,q),this.createController(f.audioStreamController,H,q),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,q),this.createController(f.subtitleStreamController,H,q),this.createController(f.timelineController,null,re),this.emeController=this.createController(f.emeController,null,re),this.cmcdController=this.createController(f.cmcdController,null,re),this.latencyController=this.createController(O.default,null,re),this.coreComponents=re}var w=m.prototype;return w.createController=function(f,h,d){if(f){var a=h?new f(this,h):new f(this);return d&&d.push(a),a}return null},w.on=function(f,h,d){d===void 0&&(d=this),this._emitter.on(f,h,d)},w.once=function(f,h,d){d===void 0&&(d=this),this._emitter.once(f,h,d)},w.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},w.off=function(f,h,d,a){d===void 0&&(d=this),this._emitter.off(f,h,d,a)},w.listeners=function(f){return this._emitter.listeners(f)},w.emit=function(f,h,d){return this._emitter.emit(f,h,d)},w.trigger=function(f,h){if(this.config.debug)return this.emit(f,f,h);try{return this.emit(f,f,h)}catch(d){C.logger.error("An internal error happened while handling event "+f+'. 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:f,error:d})}return!1},w.listenerCount=function(f){return this._emitter.listenerCount(f)},w.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},w.attachMedia=function(f){C.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},w.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(f){this.stopLoad();var h=this.media,d=this.url,a=this.url=z.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),h&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},w.startLoad=function(f){f===void 0&&(f=-1),C.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(h){h.startLoad(f)})},w.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},w.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){C.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},w.removeLevel=function(f,h){h===void 0&&(h=0),this.levelController.removeLevel(f,h)},S(m,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){C.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){C.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){C.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){C.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){C.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var h=!!f;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(C.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,h=this.config.minAutoBitrate;if(!f)return 0;for(var d=f.length,a=0;a<d;a++)if(f[a].maxBitrate>h)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,h=this.autoLevelCapping,d;return h===-1&&f&&f.length?d=f.length-1:d=h,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var h=this.audioTrackController;h&&(h.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:T.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();c.defaultConfig=void 0},"./src/is-supported.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"isSupported",function(){return R}),L.d(V,"changeTypeSupported",function(){return B});var z=L("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var I=Object(z.getMediaSource)();if(!I)return!1;var O=U(),D=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!D&&!!x}function B(){var I,O=U();return typeof(O==null||((I=O.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return C}),L.d(V,"LoadError",function(){return p});var z=L("./src/polyfills/number.ts"),U=L("./src/errors.ts");function R(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,x(u,o)}function B(u){var o=typeof Map=="function"?new Map:void 0;return B=function(l){if(l===null||!D(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,S)}function S(){return I(l,arguments,A(this).constructor)}return S.prototype=Object.create(l.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),x(S,l)},B(u)}function I(u,o,s){return O()?I=Reflect.construct:I=function(S,c,m){var w=[null];w.push.apply(w,c);var y=Function.bind.apply(S,w),f=new y;return m&&x(f,m.prototype),f},I.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function D(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function x(u,o){return x=Object.setPrototypeOf||function(l,S){return l.__proto__=S,l},x(u,o)}function A(u){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},A(u)}var P=Math.pow(2,17),C=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(l,S){var c=this,m=l.url;if(!m)return Promise.reject(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var w=this.config,y=w.fLoader,f=w.loader;return new Promise(function(h,d){c.loader&&c.loader.destroy();var a=c.loader=l.loader=y?new y(w):new f(w),v=T(l),g={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:P};l.stats=a.stats,a.load(v,g,{onSuccess:function(M,F,j,W){c.resetLoader(l,a),h({frag:l,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){c.resetLoader(l,a),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:M,networkDetails:j}))},onAbort:function(M,F,j){c.resetLoader(l,a),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:j}))},onTimeout:function(M,F,j){c.resetLoader(l,a),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:j}))},onProgress:function(M,F,j,W){S&&S({frag:l,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(l,S,c){var m=this;this.abort();var w=this.config,y=w.fLoader,f=w.loader;return new Promise(function(h,d){m.loader&&m.loader.destroy();var a=m.loader=l.loader=y?new y(w):new f(w),v=T(l,S),g={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:P};S.stats=a.stats,a.load(v,g,{onSuccess:function(M,F,j,W){m.resetLoader(l,a),m.updateStatsFromPart(l,S);var _={frag:l,part:S,payload:M.data,networkDetails:W};c(_),h(_)},onError:function(M,F,j){m.resetLoader(l,a),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:S,response:M,networkDetails:j}))},onAbort:function(M,F,j){l.stats.aborted=S.stats.aborted,m.resetLoader(l,a),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:S,networkDetails:j}))},onTimeout:function(M,F,j){m.resetLoader(l,a),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(l,S){var c=l.stats,m=S.stats,w=m.total;if(c.loaded+=m.loaded,w){var y=Math.round(l.duration/S.duration),f=Math.min(Math.round(c.loaded/w),y),h=y-f,d=h*Math.round(c.loaded/f);c.total=c.loaded+d}else c.total=Math.max(c.loaded,c.total);var a=c.loading,v=m.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(l,S){l.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},u}();function T(u,o){o===void 0&&(o=null);var s=o||u,l={frag:u,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,c=s.byteRangeEndOffset;return Object(z.isFiniteNumber)(S)&&Object(z.isFiniteNumber)(c)&&(l.rangeStart=S,l.rangeEnd=c),l}var p=function(u){R(o,u);function o(s){for(var l,S=arguments.length,c=new Array(S>1?S-1:0),m=1;m<S;m++)c[m-1]=arguments[m];return l=u.call.apply(u,[this].concat(c))||this,l.data=void 0,l.data=s,l}return o}(B(Error))},"./src/loader/fragment.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"ElementaryStreamTypes",function(){return C}),L.d(V,"BaseSegment",function(){return T}),L.d(V,"Fragment",function(){return p}),L.d(V,"Part",function(){return u});var z=L("./src/polyfills/number.ts"),U=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(U),B=L("./src/utils/logger.ts"),I=L("./src/loader/level-key.ts"),O=L("./src/loader/load-stats.ts");function D(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,x(o,s)}function x(o,s){return x=Object.setPrototypeOf||function(S,c){return S.__proto__=c,S},x(o,s)}function A(o,s){for(var l=0;l<s.length;l++){var S=s[l];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function P(o,s,l){return s&&A(o.prototype,s),l&&A(o,l),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var T=function(){function o(l){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=l}var s=o.prototype;return s.setByteRange=function(S,c){var m=S.split("@",2),w=[];m.length===1?w[0]=c?c.byteRangeEndOffset:0:w[0]=parseInt(m[1]),w[1]=parseInt(m[0])+w[0],this._byteRange=w},P(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),p=function(o){D(s,o);function s(S,c){var m;return m=o.call(this,c)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new O.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=S,m}var l=s.prototype;return l.createInitializationVector=function(c){for(var m=new Uint8Array(16),w=12;w<16;w++)m[w]=c>>8*(15-w)&255;return m},l.setDecryptDataFromLevelKey=function(c,m){var w=c;return(c==null?void 0:c.method)==="AES-128"&&c.uri&&!c.iv&&(w=I.LevelKey.fromURI(c.uri),w.method=c.method,w.iv=this.createInitializationVector(m),w.keyFormat="identity"),w},l.setElementaryStreamInfo=function(c,m,w,y,f,h){h===void 0&&(h=!1);var d=this.elementaryStreams,a=d[c];if(!a){d[c]={startPTS:m,endPTS:w,startDTS:y,endDTS:f,partial:h};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,f)},l.clearElementaryStreamInfo=function(){var c=this.elementaryStreams;c[C.AUDIO]=null,c[C.VIDEO]=null,c[C.AUDIOVIDEO]=null},P(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var c=this.sn;typeof c!="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'),c=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,c)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var c=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+c*1e3}},{key:"encrypted",get:function(){var c;return!!((c=this.decryptdata)!==null&&c!==void 0&&c.keyFormat&&this.decryptdata.uri)}}]),s}(T),u=function(o){D(s,o);function s(l,S,c,m,w){var y;y=o.call(this,c)||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 O.LoadStats,y.duration=l.decimalFloatingPoint("DURATION"),y.gap=l.bool("GAP"),y.independent=l.bool("INDEPENDENT"),y.relurl=l.enumeratedString("URI"),y.fragment=S,y.index=m;var f=l.enumeratedString("BYTERANGE");return f&&y.setByteRange(f,w),w&&(y.fragOffset=w.fragOffset+w.duration),y}return P(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(T)},"./src/loader/key-loader.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return B});var z=L("./src/events.ts"),U=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=function(){function I(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var O=I.prototype;return O._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var A=this.loaders[x];A&&A.destroy()}this.loaders={}},O.onKeyLoading=function(x,A){var P=A.frag,C=P.type,T=this.loaders[C];if(!P.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=P.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(T&&(R.logger.warn("abort previous key loader for type:"+C),T.abort()),!p){R.logger.warn("key uri is falsy");return}var o=u.loader,s=P.loader=this.loaders[C]=new o(u);this.decrypturl=p,this.decryptkey=null;var l={url:p,frag:P,responseType:"arraybuffer"},S={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,S,c)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:P}))},O.loadsuccess=function(x,A,P){var C=P.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(x.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:C})},O.loaderror=function(x,A){var P=A.frag,C=P.loader;C&&C.abort(),delete this.loaders[P.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:x})},O.loadtimeout=function(x,A){var P=A.frag,C=P.loader;C&&C.abort(),delete this.loaders[P.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},I}()},"./src/loader/level-details.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"LevelDetails",function(){return I});var z=L("./src/polyfills/number.ts");function U(O,D){for(var x=0;x<D.length;x++){var A=D[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(O,A.key,A)}}function R(O,D,x){return D&&U(O.prototype,D),x&&U(O,x),O}var B=10,I=function(){function O(x){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=x}var D=O.prototype;return D.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-A.lastPartSn,C=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!C||!!P,this.advanced=this.endSN>A.endSN||P>0||P===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},R(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var P=this.driftEnd-this.driftStart;return P*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"LevelKey",function(){return I});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),U=L.n(z);function R(O,D){for(var x=0;x<D.length;x++){var A=D[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(O,A.key,A)}}function B(O,D,x){return D&&R(O.prototype,D),x&&R(O,x),O}var I=function(){O.fromURL=function(x,A){return new O(x,A)},O.fromURI=function(x){return new O(x)};function O(D,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(z.buildAbsoluteURL)(D,x,{alwaysNormalize:!0}):this._uri=D}return B(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"LoadStats",function(){return z});var z=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(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return s});var z=L("./src/polyfills/number.ts"),U=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(U),B=L("./src/loader/fragment.ts"),I=L("./src/loader/level-details.ts"),O=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),x=L("./src/utils/logger.ts"),A=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,T=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var y,f;return u.test((y=(f=U.parseURL(w))===null||f===void 0?void 0:f.path)!=null?y:"")}var s=function(){function w(){}return w.findGroup=function(f,h){for(var d=0;d<f.length;d++){var a=f[d];if(a.id===h)return a}},w.convertAVC1ToAVCOTI=function(f){var h=f.split(".");if(h.length>2){var d=h.shift()+".";return d+=parseInt(h.shift()).toString(16),d+=("000"+parseInt(h.shift()).toString(16)).substr(-4),d}return f},w.resolve=function(f,h){return U.buildAbsoluteURL(h,f,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(f,h){var d=[],a={},v=!1;P.lastIndex=0;for(var g;(g=P.exec(f))!=null;)if(g[1]){var b=new D.AttrList(g[1]),M={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:w.resolve(g[2],h)},F=b.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),l((b.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=w.convertAVC1ToAVCOTI(M.videoCodec)),d.push(M)}else if(g[3]){var j=new D.AttrList(g[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:d,sessionData:v?a:null}},w.parseMasterPlaylistMedia=function(f,h,d,a){a===void 0&&(a=[]);var v,g=[],b=0;for(C.lastIndex=0;(v=C.exec(f))!==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?w.resolve(M.URI,h):""};if(a.length){var j=w.findGroup(a,F.groupId)||a[0];S(F,j,"audioCodec"),S(F,j,"textCodec")}g.push(F)}}return g},w.parseLevelPlaylist=function(f,h,d,a,v){var g=new I.LevelDetails(h),b=g.fragments,M=null,F=0,j=0,W=0,_=0,k=null,H=new B.Fragment(a,h),X,q,re,Ee=-1,me=!1;for(T.lastIndex=0,g.m3u8=f;(X=T.exec(f))!==null;){me&&(me=!1,H=new B.Fragment(a,h),H.start=W,H.sn=F,H.cc=_,H.level=d,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var Se=X[1];if(Se){H.duration=parseFloat(Se);var ve=(" "+X[2]).slice(1);H.title=ve||null,H.tagList.push(ve?["INF",Se,ve]:["INF",Se])}else if(X[3])Object(z.isFiniteNumber)(H.duration)&&(H.start=W,re&&(H.levelkey=re),H.sn=F,H.level=d,H.cc=_,H.urlId=v,b.push(H),H.relurl=(" "+X[3]).slice(1),m(H,k),k=H,W+=H.duration,F++,j=0,me=!0);else if(X[4]){var fe=(" "+X[4]).slice(1);k?H.setByteRange(fe,k):H.setByteRange(fe)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Ee===-1&&(Ee=b.length);else{if(X=X[0].match(p),!X){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<X.length&&!(typeof X[q]!="undefined");q++);var ue=(" "+X[q]).slice(1),he=(" "+X[q+1]).slice(1),Q=X[q+2]?(" "+X[q+2]).slice(1):"";switch(ue){case"PLAYLIST-TYPE":g.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":F=g.startSN=parseInt(he);break;case"SKIP":{var ne=new D.AttrList(he),Z=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(Z)){g.skippedSegments=Z;for(var ge=Z;ge--;)b.unshift(null);F+=Z}var Te=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");Te&&(g.recentlyRemovedDateranges=Te.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(he);break;case"VERSION":g.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(he||Q)&&H.tagList.push(Q?[he,Q]:[he]);break;case"DIS":_++;case"GAP":H.tagList.push([ue]);break;case"BITRATE":H.tagList.push([ue,he]);break;case"DISCONTINUITY-SEQ":_=parseInt(he);break;case"KEY":{var pe,we=new D.AttrList(he),Oe=we.enumeratedString("METHOD"),ke=we.URI,Pe=we.hexadecimalInteger("IV"),De=we.enumeratedString("KEYFORMATVERSIONS"),Le=we.enumeratedString("KEYID"),We=(pe=we.enumeratedString("KEYFORMAT"))!=null?pe:"identity",Ye=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ye.indexOf(We)>-1){x.logger.warn("Keyformat "+We+" is not supported from the manifest");continue}else if(We!=="identity")continue;Oe&&(re=O.LevelKey.fromURL(h,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Oe)>=0&&(re.method=Oe,re.keyFormat=We,Le&&(re.keyID=Le),De&&(re.keyFormatVersions=De),re.iv=Pe));break}case"START":{var Xe=new D.AttrList(he),Ke=Xe.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Ke)&&(g.startTimeOffset=Ke);break}case"MAP":{var Ze=new D.AttrList(he);H.relurl=Ze.URI,Ze.BYTERANGE&&H.setByteRange(Ze.BYTERANGE),H.level=d,H.sn="initSegment",re&&(H.levelkey=re),H.initSegment=null,M=H,me=!0;break}case"SERVER-CONTROL":{var je=new D.AttrList(he);g.canBlockReload=je.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=je.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&je.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=je.optionalFloat("PART-HOLD-BACK",0),g.holdBack=je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Be=new D.AttrList(he);g.partTarget=Be.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=g.partList;Ce||(Ce=g.partList=[]);var $e=j>0?Ce[Ce.length-1]:void 0,Qe=j++,Re=new B.Part(new D.AttrList(he),H,h,Qe,$e);Ce.push(Re),H.duration+=Re.duration;break}case"PRELOAD-HINT":{var Ue=new D.AttrList(he);g.preloadHint=Ue;break}case"RENDITION-REPORT":{var oe=new D.AttrList(he);g.renditionReports=g.renditionReports||[],g.renditionReports.push(oe);break}default:x.logger.warn("line parsed but not handled: "+X);break}}}k&&!k.relurl?(b.pop(),W-=k.duration,g.partList&&(g.fragmentHint=k)):g.partList&&(m(H,k),H.cc=_,g.fragmentHint=H);var le=b.length,de=b[0],$=b[le-1];if(W+=g.skippedSegments*g.targetduration,W>0&&le&&$){g.averagetargetduration=W/le;var J=$.sn;g.endSN=J!=="initSegment"?J:0,de&&(g.startCC=de.cc,de.initSegment||g.fragments.every(function(ee){return ee.relurl&&o(ee.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,h),H.relurl=$.relurl,H.level=d,H.sn="initSegment",de.initSegment=H,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(W+=g.fragmentHint.duration),g.totalduration=W,g.endCC=_,Ee>0&&c(b,Ee),g},w}();function l(w,y){["video","audio","text"].forEach(function(f){var h=w.filter(function(a){return Object(A.isCodecType)(a,f)});if(h.length){var d=h.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[f+"Codec"]=d.length>0?d[0]:h[0],w=w.filter(function(a){return h.indexOf(a)===-1})}}),y.unknownCodecs=w}function S(w,y,f){var h=y[f];h&&(w[f]=h)}function c(w,y){for(var f=w[y],h=y;h--;){var d=w[h];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function m(w,y){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):y!=null&&y.programDateTime&&(w.programDateTime=y.endProgramDateTime),Object(z.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/polyfills/number.ts"),U=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),I=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),x=L("./src/utils/attr-list.ts");function A(T){var p=T.type;switch(p){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function P(T,p){var u=T.url;return(u===void 0||u.indexOf("data:")===0)&&(u=p.url),u}var C=function(){function T(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var p=T.prototype;return p.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(o){var s=this.hls.config,l=s.pLoader,S=s.loader,c=l||S,m=new c(s);return o.loader=m,this.loaders[o.type]=m,m},p.getInternalLoader=function(o){return this.loaders[o.type]},p.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},p.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(o,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},p.onLevelLoading=function(o,s){var l=s.id,S=s.level,c=s.url,m=s.deliveryDirectives;this.load({id:l,groupId:null,level:S,responseType:"text",type:D.PlaylistContextType.LEVEL,url:c,deliveryDirectives:m})},p.onAudioTrackLoading=function(o,s){var l=s.id,S=s.groupId,c=s.url,m=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:c,deliveryDirectives:m})},p.onSubtitleTrackLoading=function(o,s){var l=s.id,S=s.groupId,c=s.url,m=s.deliveryDirectives;this.load({id:l,groupId:S,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:c,deliveryDirectives:m})},p.load=function(o){var s,l=this.hls.config,S=this.getInternalLoader(o);if(S){var c=S.context;if(c&&c.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 m,w,y,f;switch(o.type){case D.PlaylistContextType.MANIFEST:m=l.manifestLoadingMaxRetry,w=l.manifestLoadingTimeOut,y=l.manifestLoadingRetryDelay,f=l.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:m=0,w=l.levelLoadingTimeOut;break;default:m=l.levelLoadingMaxRetry,w=l.levelLoadingTimeOut,y=l.levelLoadingRetryDelay,f=l.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var h;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?h=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?h=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(h=this.hls.subtitleTracks[o.id].details),h){var d=h.partTarget,a=h.targetduration;d&&a&&(w=Math.min(Math.max(d*3,a*.8)*1e3,w))}}var v={timeout:w,maxRetry:m,retryDelay:y,maxRetryDelay:f,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,v,g)},p.loadsuccess=function(o,s,l,S){if(S===void 0&&(S=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,s,l,S);return}this.resetInternalLoader(l.type);var c=o.data;if(c.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),c.indexOf("#EXTINF:")>0||c.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,l,S):this.handleMasterPlaylist(o,s,l,S)},p.loaderror=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,o)},p.loadtimeout=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},p.handleMasterPlaylist=function(o,s,l,S){var c=this.hls,m=o.data,w=P(o,l),y=O.default.parseMasterPlaylist(m,w),f=y.levels,h=y.sessionData;if(!f.length){this.handleManifestParsingError(o,l,"no level found in manifest",S);return}var d=f.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=f.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),v=O.default.parseMasterPlaylistMedia(m,w,"AUDIO",d),g=O.default.parseMasterPlaylistMedia(m,w,"SUBTITLES",a),b=O.default.parseMasterPlaylistMedia(m,w,"CLOSED-CAPTIONS");if(v.length){var M=v.some(function(F){return!F.url});!M&&f[0].audioCodec&&!f[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 x.AttrList({}),bitrate:0,url:""}))}c.trigger(U.Events.MANIFEST_LOADED,{levels:f,audioTracks:v,subtitles:g,captions:b,url:w,stats:s,networkDetails:S,sessionData:h})},p.handleTrackOrLevelPlaylist=function(o,s,l,S){var c=this.hls,m=l.id,w=l.level,y=l.type,f=P(o,l),h=Object(z.isFiniteNumber)(m)?m:0,d=Object(z.isFiniteNumber)(w)?w:h,a=A(l),v=O.default.parseLevelPlaylist(o.data,f,d,a,h);if(!v.fragments.length){c.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(y===D.PlaylistContextType.MANIFEST){var g={attrs:new x.AttrList({}),bitrate:0,details:v,name:"",url:f};c.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:f,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:w,levelDetails:v,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=v,this.handlePlaylistLoaded(o,s,l,S)},p.handleSidxRequest=function(o,s){var l=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!l)return;var S=l.references,c=s.levelDetails;S.forEach(function(m,w){var y=m.info,f=c.fragments[w];f.byteRange.length===0&&f.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),f.initSegment&&f.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},p.handleManifestParsingError=function(o,s,l,S){this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:l,response:o,context:s,networkDetails:S})},p.handleNetworkError=function(o,s,l,S){l===void 0&&(l=!1),B.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var c=R.ErrorDetails.UNKNOWN,m=!1,w=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:c=l?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case D.PlaylistContextType.LEVEL:c=l?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.AUDIO_TRACK:c=l?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:c=l?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}w&&this.resetInternalLoader(o.type);var y={type:R.ErrorTypes.NETWORK_ERROR,details:c,fatal:m,url:o.url,loader:w,context:o,networkDetails:s};S&&(y.response=S),this.hls.trigger(U.Events.ERROR,y)},p.handlePlaylistLoaded=function(o,s,l,S){var c=l.type,m=l.level,w=l.id,y=l.groupId,f=l.loader,h=l.levelDetails,d=l.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(o,l,"invalid target duration",S);return}if(!f)return;h.live&&(f.getCacheAge&&(h.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(c){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:h,level:m||0,id:w||0,stats:s,networkDetails:S,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:h,id:w||0,groupId:y||"",stats:s,networkDetails:S,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:h,id:w||0,groupId:y||"",stats:s,networkDetails:S,deliveryDirectives:d});break}},T}();V.default=C},"./src/polyfills/number.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"isFiniteNumber",function(){return z}),L.d(V,"MAX_SAFE_INTEGER",function(){return U});var z=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ie,V,L){"use strict";L.r(V);var z=function(){function U(){}return U.getSilentFrame=function(B,I){switch(B){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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},U}();V.default=z},"./src/remux/mp4-generator.ts":function(ie,V,L){"use strict";L.r(V);var z=Math.pow(2,32)-1,U=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var I;for(I in R.types)R.types.hasOwnProperty(I)&&(R.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var O=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:O,audio:D};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=A,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),T=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,P,T,P,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,x))},R.box=function(I){for(var O=8,D=arguments.length,x=new Array(D>1?D-1:0),A=1;A<D;A++)x[A-1]=arguments[A];for(var P=x.length,C=P;P--;)O+=x[P].byteLength;var T=new Uint8Array(O);for(T[0]=O>>24&255,T[1]=O>>16&255,T[2]=O>>8&255,T[3]=O&255,T.set(I,4),P=0,O=8;P<C;P++)T.set(x[P],O),O+=x[P].byteLength;return T},R.hdlr=function(I){return R.box(R.types.hdlr,R.HDLR_TYPES[I])},R.mdat=function(I){return R.box(R.types.mdat,I)},R.mdhd=function(I,O){O*=I;var D=Math.floor(O/(z+1)),x=Math.floor(O%(z+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,D>>24,D>>16&255,D>>8&255,D&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},R.mdia=function(I){return R.box(R.types.mdia,R.mdhd(I.timescale,I.duration),R.hdlr(I.type),R.minf(I))},R.mfhd=function(I){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},R.minf=function(I){return I.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(I)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(I))},R.moof=function(I,O,D){return R.box(R.types.moof,R.mfhd(I),R.traf(D,O))},R.moov=function(I){for(var O=I.length,D=[];O--;)D[O]=R.trak(I[O]);return R.box.apply(null,[R.types.moov,R.mvhd(I[0].timescale,I[0].duration)].concat(D).concat(R.mvex(I)))},R.mvex=function(I){for(var O=I.length,D=[];O--;)D[O]=R.trex(I[O]);return R.box.apply(null,[R.types.mvex].concat(D))},R.mvhd=function(I,O){O*=I;var D=Math.floor(O/(z+1)),x=Math.floor(O%(z+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,D>>24,D>>16&255,D>>8&255,D&255,x>>24,x>>16&255,x>>8&255,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,A)},R.sdtp=function(I){var O=I.samples||[],D=new Uint8Array(4+O.length),x,A;for(x=0;x<O.length;x++)A=O[x].flags,D[x+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return R.box(R.types.sdtp,D)},R.stbl=function(I){return R.box(R.types.stbl,R.stsd(I),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(I){var O=[],D=[],x,A,P;for(x=0;x<I.sps.length;x++)A=I.sps[x],P=A.byteLength,O.push(P>>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(A));for(x=0;x<I.pps.length;x++)A=I.pps[x],P=A.byteLength,D.push(P>>>8&255),D.push(P&255),D=D.concat(Array.prototype.slice.call(A));var C=R.box(R.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|I.sps.length].concat(O).concat([I.pps.length]).concat(D))),T=I.width,p=I.height,u=I.pixelRatio[0],o=I.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T>>8&255,T&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(I){var O=I.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(I.config).concat([6,1,2]))},R.mp4a=function(I){var O=I.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),R.box(R.types.esds,R.esds(I)))},R.mp3=function(I){var O=I.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},R.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(I)):R.box(R.types.stsd,R.STSD,R.mp4a(I)):R.box(R.types.stsd,R.STSD,R.avc1(I))},R.tkhd=function(I){var O=I.id,D=I.duration*I.timescale,x=I.width,A=I.height,P=Math.floor(D/(z+1)),C=Math.floor(D%(z+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,x>>8&255,x&255,0,0,A>>8&255,A&255,0,0]))},R.traf=function(I,O){var D=R.sdtp(I),x=I.id,A=Math.floor(O/(z+1)),P=Math.floor(O%(z+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,P>>24,P>>16&255,P>>8&255,P&255])),R.trun(I,D.length+16+20+8+16+8+8),D)},R.trak=function(I){return I.duration=I.duration||4294967295,R.box(R.types.trak,R.tkhd(I),R.mdia(I))},R.trex=function(I){var O=I.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(I,O){var D=I.samples||[],x=D.length,A=12+16*x,P=new Uint8Array(A),C,T,p,u,o,s;for(O+=8+A,P.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),C=0;C<x;C++)T=D[C],p=T.duration,u=T.size,o=T.flags,s=T.cts,P.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return R.box(R.types.trun,P)},R.initSegment=function(I){R.types||R.init();var O=R.moov(I),D=new Uint8Array(R.FTYP.byteLength+O.byteLength);return D.set(R.FTYP),D.set(O,R.FTYP.byteLength),D},R}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,V.default=U},"./src/remux/mp4-remuxer.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return s}),L.d(V,"normalizePts",function(){return l});var z=L("./src/polyfills/number.ts"),U=L("./src/remux/aac-helper.ts"),R=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),I=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),x=L("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(w[h]=f[h])}return w},A.apply(this,arguments)}var P=10*1e3,C=1024,T=1152,p=null,u=null,o=!1,s=function(){function w(f,h,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=f,this.config=h,this.typeSupported=d,this.ISGenerated=!1,p===null){var v=navigator.userAgent||"",g=v.match(/Chrome\/(\d+)/i);p=g?parseInt(g[1]):0}if(u===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);u=b?parseInt(b[1]):0}o=!!p&&p<75||!!u&&u<600}var y=w.prototype;return y.destroy=function(){},y.resetTimeStamp=function(h){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},y.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(h){var d=!1,a=h.reduce(function(v,g){var b=g.pts-v;return b<-4294967296?(d=!0,l(v,g.pts)):b>0?v:g.pts},h[0].pts);return d&&O.logger.debug("PTS rollover detected"),a},y.remux=function(h,d,a,v,g,b,M,F){var j,W,_,k,H,X,q=g,re=g,Ee=h.pid>-1,me=d.pid>-1,Se=d.samples.length,ve=h.samples.length>0,fe=Se>1,ue=(!Ee||ve)&&(!me||fe)||this.ISGenerated||M;if(ue){this.ISGenerated||(_=this.generateIS(h,d,g));var he=this.isVideoContiguous,Q=-1;if(fe&&(Q=S(d.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,Q>0){O.logger.warn("[mp4-remuxer]: Dropped "+Q+" out of "+Se+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(Q),d.dropped+=Q,re+=(d.samples[0].pts-ne)/(d.timescale||9e4)}else Q===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+Se+" video samples"),X=!1);if(this.ISGenerated){if(ve&&fe){var Z=this.getVideoStartPts(d.samples),ge=l(h.samples[0].pts,Z)-Z,Te=ge/d.inputTimeScale;q+=Math.max(0,Te),re+=Math.max(0,-Te)}if(ve){if(h.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),_=this.generateIS(h,d,g)),W=this.remuxAudio(h,q,this.isAudioContiguous,b,me||fe||F===D.PlaylistLevelType.AUDIO?re:void 0),fe){var pe=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),_=this.generateIS(h,d,g)),j=this.remuxVideo(d,re,he,pe)}}else fe&&(j=this.remuxVideo(d,re,he,0));j&&(j.firstKeyFrame=Q,j.independent=Q!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,g)),v.samples.length&&(k=this.remuxText(v,g))),{audio:W,video:j,initSegment:_,independent:X,text:k,id3:H}},y.generateIS=function(h,d,a){var v=h.samples,g=d.samples,b=this.typeSupported,M={},F=!Object(z.isFiniteNumber)(this._initPTS),j="audio/mp4",W,_,k;if(F&&(W=_=Infinity),h.config&&v.length&&(h.timescale=h.samplerate,h.isAAC||(b.mpeg?(j="audio/mpeg",h.codec=""):b.mp3&&(h.codec="mp3")),M.audio={id:"audio",container:j,codec:h.codec,initSegment:!h.isAAC&&b.mpeg?new Uint8Array(0):R.default.initSegment([h]),metadata:{channelCount:h.channelCount}},F&&(k=h.inputTimeScale,W=_=v[0].pts-Math.round(k*a))),d.sps&&d.pps&&g.length&&(d.timescale=d.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:R.default.initSegment([d]),metadata:{width:d.width,height:d.height}},F)){k=d.inputTimeScale;var H=this.getVideoStartPts(g),X=Math.round(k*a);_=Math.min(_,l(g[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=_),{tracks:M,initPTS:W,timescale:k}},y.remuxVideo=function(h,d,a,v){var g=h.inputTimeScale,b=h.samples,M=[],F=b.length,j=this._initPTS,W=this.nextAvcDts,_=8,k,H,X,q=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY,Ee=0,me=!1;if(!a||W===null){var Se=d*g,ve=b[0].pts-l(b[0].dts,b[0].pts);W=Se-ve}for(var fe=0;fe<F;fe++){var ue=b[fe];if(ue.pts=l(ue.pts-j,W),ue.dts=l(ue.dts-j,W),ue.dts>ue.pts){var he=9e4*.2;Ee=Math.max(Math.min(Ee,ue.pts-ue.dts),-1*he)}ue.dts<b[fe>0?fe-1:fe].dts&&(me=!0)}me&&b.sort(function(Ct,pt){var st=Ct.dts-pt.dts,kt=Ct.pts-pt.pts;return st||kt}),H=b[0].dts,X=b[b.length-1].dts;var Q=Math.round((X-H)/(F-1));if(Ee<0){if(Ee<Q*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-Q,!0)+" ms");for(var ne=Ee,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{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var ge=0;ge<F;ge++)b[ge].dts=b[ge].dts+Ee}H=b[0].dts}if(a){var Te=H-W,pe=Te>Q,we=Te<-1;if(pe||we){pe?O.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(Te,!0)+" ms ("+Te+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-Te,!0)+" ms ("+Te+"dts) overlapping between fragments detected"),H=W;var Oe=b[0].pts-Te;b[0].dts=H,b[0].pts=Oe,O.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(Oe,!0)+"/"+Object(x.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(Te,!0)+" ms")}}o&&(H=Math.max(0,H));for(var ke=0,Pe=0,De=0;De<F;De++){for(var Le=b[De],We=Le.units,Ye=We.length,Xe=0,Ke=0;Ke<Ye;Ke++)Xe+=We[Ke].data.length;Pe+=Xe,ke+=Ye,Le.length=Xe,Le.dts=Math.max(Le.dts,H),Le.pts=Math.max(Le.pts,Le.dts,0),q=Math.min(Le.pts,q),re=Math.max(Le.pts,re)}X=b[F-1].dts;var Ze=Pe+4*ke+8,je;try{je=new Uint8Array(Ze)}catch(Ct){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ze,reason:"fail allocating video mdat "+Ze});return}var Be=new DataView(je.buffer);Be.setUint32(0,Ze),je.set(R.default.types.mdat,4);for(var Ce=0;Ce<F;Ce++){for(var $e=b[Ce],Qe=$e.units,Re=0,Ue=0,oe=Qe.length;Ue<oe;Ue++){var le=Qe[Ue],de=le.data,$=le.data.byteLength;Be.setUint32(_,$),_+=4,je.set(de,_),_+=$,Re+=4+$}if(Ce<F-1)k=b[Ce+1].dts-$e.dts;else{var J=this.config,ee=$e.dts-b[Ce>0?Ce-1:Ce].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var te=Math.floor(J.maxBufferHole*g),ye=(v?q+v*g:this.nextAudioPts)-$e.pts;ye>te?(k=ye-ee,k<0&&(k=ee),O.logger.log("[mp4-remuxer]: It is approximately "+ye/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=ee}else k=ee}var Ae=Math.round($e.pts-$e.dts);M.push(new c($e.key,k,Re,Ae))}if(M.length&&p&&p<70){var Me=M[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(k!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+k,this.isVideoContiguous=!0;var tt=R.default.moof(h.sequenceNumber++,H,A({},h,{samples:M})),ft="video",nt={data1:tt,data2:je,startPTS:q/g,endPTS:(re+k)/g,startDTS:H/g,endDTS:W/g,type:ft,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(je.length,"MDAT length must not be zero"),nt},y.remuxAudio=function(h,d,a,v,g){var b=h.inputTimeScale,M=h.samplerate?h.samplerate:b,F=b/M,j=h.isAAC?C:T,W=j*F,_=this._initPTS,k=!h.isAAC&&this.typeSupported.mpeg,H=[],X=h.samples,q=k?0:8,re=this.nextAudioPts||-1,Ee=d*b;if(this.isAudioContiguous=a=a||X.length&&re>0&&(v&&Math.abs(Ee-re)<9e3||Math.abs(l(X[0].pts-_,Ee)-re)<20*W),X.forEach(function(de){de.pts=l(de.pts-_,Ee)}),!a||re<0){if(X=X.filter(function(de){return de.pts>=0}),!X.length)return;g===0?re=0:v?re=Math.max(0,Ee):re=X[0].pts}if(h.isAAC)for(var me=g!==void 0,Se=this.config.maxAudioFramesDrift,ve=0,fe=re;ve<X.length;ve++){var ue=X[ve],he=ue.pts,Q=he-fe,ne=Math.abs(1e3*Q/b);if(Q<=-Se*W&&me)ve===0&&(O.logger.warn("Audio frame @ "+(he/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/b)+" ms."),this.nextAudioPts=re=fe=he);else if(Q>=Se*W&&ne<P&&me){var Z=Math.round(Q/W);fe=he-Z*W,fe<0&&(Z--,fe+=W),ve===0&&(this.nextAudioPts=re=fe),O.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(fe/b).toFixed(3)+"s due to "+Math.round(1e3*Q/b)+" ms gap.");for(var ge=0;ge<Z;ge++){var Te=Math.max(fe,0),pe=U.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);pe||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),pe=ue.unit.subarray()),X.splice(ve,0,{unit:pe,pts:Te}),fe+=W,ve++}}ue.pts=fe,fe+=W}for(var we=null,Oe=null,ke,Pe=0,De=X.length;De--;)Pe+=X[De].unit.byteLength;for(var Le=0,We=X.length;Le<We;Le++){var Ye=X[Le],Xe=Ye.unit,Ke=Ye.pts;if(Oe!==null){var Ze=H[Le-1];Ze.duration=Math.round((Ke-Oe)/F)}else if(a&&h.isAAC&&(Ke=re),we=Ke,Pe>0){Pe+=q;try{ke=new Uint8Array(Pe)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Pe,reason:"fail allocating audio mdat "+Pe});return}if(!k){var je=new DataView(ke.buffer);je.setUint32(0,Pe),ke.set(R.default.types.mdat,4)}}else return;ke.set(Xe,q);var Be=Xe.byteLength;q+=Be,H.push(new c(!0,j,Be,0)),Oe=Ke}var Ce=H.length;if(!Ce)return;var $e=H[H.length-1];this.nextAudioPts=re=Oe+F*$e.duration;var Qe=k?new Uint8Array(0):R.default.moof(h.sequenceNumber++,we/F,A({},h,{samples:H}));h.samples=[];var Re=we/b,Ue=re/b,oe="audio",le={data1:Qe,data2:ke,startPTS:Re,endPTS:Ue,startDTS:Re,endDTS:Ue,type:oe,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),le},y.remuxEmptyAudio=function(h,d,a,v){var g=h.inputTimeScale,b=h.samplerate?h.samplerate:g,M=g/b,F=this.nextAudioPts,j=(F!==null?F:v.startDTS*g)+this._initDTS,W=v.endDTS*g+this._initDTS,_=M*C,k=Math.ceil((W-j)/_),H=U.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],q=0;q<k;q++){var re=j+q*_;X.push({unit:H,pts:re,dts:re})}return h.samples=X,this.remuxAudio(h,d,a,!1)},y.remuxID3=function(h,d){var a=h.samples.length;if(!a)return;for(var v=h.inputTimeScale,g=this._initPTS,b=this._initDTS,M=0;M<a;M++){var F=h.samples[M];F.pts=l(F.pts-g,d*v)/v,F.dts=l(F.dts-b,d*v)/v}var j=h.samples;return h.samples=[],{samples:j}},y.remuxText=function(h,d){var a=h.samples.length;if(!a)return;for(var v=h.inputTimeScale,g=this._initPTS,b=0;b<a;b++){var M=h.samples[b];M.pts=l(M.pts-g,d*v)/v}h.samples.sort(function(j,W){return j.pts-W.pts});var F=h.samples;return h.samples=[],{samples:F}},w}();function l(w,y){var f;if(y===null)return w;for(y<w?f=-8589934592:f=8589934592;Math.abs(w-y)>4294967296;)w+=f;return w}function S(w){for(var y=0;y<w.length;y++)if(w[y].key)return y;return-1}var c=function(y,f,h,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=h,this.cts=d,this.flags=new m(y)},m=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(ie,V,L){"use strict";L.r(V);var z=L("./src/polyfills/number.ts"),U=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),I=function(){function x(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=x.prototype;return A.destroy=function(){},A.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(C,T,p){this.audioCodec=T,this.videoCodec=p,this.generateInitSegment(C),this.emitInitSegment=!0},A.generateInitSegment=function(C){var T=this.audioCodec,p=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(U.parseInitSegment)(C);T||(T=D(u.audio,R.ElementaryStreamTypes.AUDIO)),p||(p=D(u.video,R.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:T+","+p,initSegment:C,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:T,initSegment:C,id:"audio"}:u.video?o.video={container:"video/mp4",codec:p,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(C,T,p,u,o){var s=this.initPTS,l=this.lastEndDTS,S={audio:void 0,video:void 0,text:u,id3:p,initSegment:void 0};Object(z.isFiniteNumber)(l)||(l=this.lastEndDTS=o||0);var c=T.samples;if(!c||!c.length)return S;var m={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(c),w=this.initData),!w||!w.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=O(w,c,l));var y=Object(U.getDuration)(c,w),f=l,h=y+f;Object(U.offsetStartDTS)(w,c,s),y>0?this.lastEndDTS=h:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!w.audio,a=!!w.video,v="";d&&(v+="audio"),a&&(v+="video");var g={data1:c,startPTS:f,startDTS:f,endPTS:h,endDTS:h,type:v,hasAudio:d,hasVideo:a,nb:1,dropped:0};return S.audio=g.type==="audio"?g:void 0,S.video=g.type!=="audio"?g:void 0,S.text=u,S.id3=p,S.initSegment=m,S},x}(),O=function(A,P,C){return Object(U.getStartDTS)(A,P)-C};function D(x,A){var P=x==null?void 0:x.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=I},"./src/task-loop.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return z});var z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=U.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"CMCDVersion",function(){return z}),L.d(V,"CMCDObjectType",function(){return U}),L.d(V,"CMCDStreamingFormat",function(){return R}),L.d(V,"CMCDStreamType",function(){return B});var z=1,U;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(U||(U={}));var R;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(R||(R={}));var B;(function(I){I.VOD="v",I.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"HlsSkip",function(){return R}),L.d(V,"getSkipValue",function(){return B}),L.d(V,"HlsUrlParameters",function(){return I}),L.d(V,"Level",function(){return O});function z(D,x){for(var A=0;A<x.length;A++){var P=x[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function U(D,x,A){return x&&z(D.prototype,x),A&&z(D,A),D}var R;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(R||(R={}));function B(D,x){var A=D.canSkipUntil,P=D.canSkipDateRanges,C=D.endSN,T=x!==void 0?x-C:0;return A&&T<A?P?R.v2:R.Yes:R.No}var I=function(){function D(A,P,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=P,this.skip=C}var x=D.prototype;return x.addDirectives=function(P){var C=new self.URL(P);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},D}(),O=function(){function D(x){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return U(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var P=A%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),D}()},"./src/types/loader.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"PlaylistContextType",function(){return z}),L.d(V,"PlaylistLevelType",function(){return U});var z;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var U;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"ChunkMetadata",function(){return z});var z=function(B,I,O,D,x,A){D===void 0&&(D=0),x===void 0&&(x=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=B,this.sn=I,this.id=O,this.size=D,this.part=x,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"AttrList",function(){return R});var z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(O){typeof O=="string"&&(O=B.parseAttrList(O));for(var D in O)O.hasOwnProperty(D)&&(this[D]=O[D])}var I=B.prototype;return I.decimalInteger=function(D){var x=parseInt(this[D],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},I.hexadecimalInteger=function(D){if(this[D]){var x=(this[D]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var A=new Uint8Array(x.length/2),P=0;P<x.length/2;P++)A[P]=parseInt(x.slice(P*2,P*2+2),16);return A}else return null},I.hexadecimalIntegerAsNumber=function(D){var x=parseInt(this[D],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},I.decimalFloatingPoint=function(D){return parseFloat(this[D])},I.optionalFloat=function(D,x){var A=this[D];return A?parseFloat(A):x},I.enumeratedString=function(D){return this[D]},I.bool=function(D){return this[D]==="YES"},I.decimalResolution=function(D){var x=z.exec(this[D]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},B.parseAttrList=function(D){var x,A={},P='"';for(U.lastIndex=0;(x=U.exec(D))!==null;){var C=x[2];C.indexOf(P)===0&&C.lastIndexOf(P)===C.length-1&&(C=C.slice(1,-1)),A[x[1]]=C}return A},B}()},"./src/utils/binary-search.ts":function(ie,V,L){"use strict";L.r(V);var z={search:function(R,B){for(var I=0,O=R.length-1,D=null,x=null;I<=O;){D=(I+O)/2|0,x=R[D];var A=B(x);if(A>0)I=D+1;else if(A<0)O=D-1;else return x}return null}};V.default=z},"./src/utils/buffer-helper.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"BufferHelper",function(){return R});var z=L("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(O,D){try{if(O){for(var x=B.getBuffered(O),A=0;A<x.length;A++)if(D>=x.start(A)&&D<=x.end(A))return!0}}catch(P){}return!1},B.bufferInfo=function(O,D,x){try{if(O){var A=B.getBuffered(O),P=[],C;for(C=0;C<A.length;C++)P.push({start:A.start(C),end:A.end(C)});return this.bufferedInfo(P,D,x)}}catch(T){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(O,D,x){D=Math.max(0,D),O.sort(function(m,w){var y=m.start-w.start;return y||w.end-m.end});var A=[];if(x)for(var P=0;P<O.length;P++){var C=A.length;if(C){var T=A[C-1].end;O[P].start-T<x?O[P].end>T&&(A[C-1].end=O[P].end):A.push(O[P])}else A.push(O[P])}else A=O;for(var p=0,u,o=D,s=D,l=0;l<A.length;l++){var S=A[l].start,c=A[l].end;if(D+x>=S&&D<c)o=S,s=c,p=s-D;else if(D+x<S){u=S;break}}return{len:p,start:o||0,end:s||0,nextStart:u}},B.getBuffered=function(O){try{return O.buffered}catch(D){return z.logger.log("failed to get media.buffered",D),U}},B}()},"./src/utils/cea-608-parser.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"Row",function(){return s}),L.d(V,"CaptionScreen",function(){return l});var z=L("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(h){var d=h;return U.hasOwnProperty(h)&&(d=U[h]),String.fromCharCode(d)},B=15,I=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(C||(C={}));var T=function(){function f(){this.time=null,this.verboseLevel=C.ERROR}var h=f.prototype;return h.log=function(a,v){this.verboseLevel>=a&&z.logger.log(this.time+" ["+a+"] "+v)},f}(),p=function(h){for(var d=[],a=0;a<h.length;a++)d.push(h[a].toString(16));return d},u=function(){function f(d,a,v,g,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=g||"black",this.flash=b||!1}var h=f.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(a){for(var v=["foreground","underline","italics","background","flash"],g=0;g<v.length;g++){var b=v[g];a.hasOwnProperty(b)&&(this[b]=a[b])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},h.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(d,a,v,g,b,M){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(a,v,g,b,M)}var h=f.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(a,v){this.uchar=a,this.penState.copy(v)},h.setPenState=function(a){this.penState.copy(a)},h.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},h.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},h.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),s=function(){function f(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<I;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new u}var h=f.prototype;return h.equals=function(a){for(var v=!0,g=0;g<I;g++)if(!this.chars[g].equals(a.chars[g])){v=!1;break}return v},h.copy=function(a){for(var v=0;v<I;v++)this.chars[v].copy(a.chars[v])},h.isEmpty=function(){for(var a=!0,v=0;v<I;v++)if(!this.chars[v].isEmpty()){a=!1;break}return a},h.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>I&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},h.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var g=this.pos+1;g<v+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(v)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(a){a>=144&&this.backSpace();var v=R(a);if(this.pos>=I){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)},h.clearFromPos=function(a){var v;for(v=a;v<I;v++)this.chars[v].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var a=[],v=!0,g=0;g<I;g++){var b=this.chars[g].uchar;b!==" "&&(v=!1),a.push(b)}return v?"":a.join("")},h.setPenStyles=function(a){this.currPenState.setStyles(a);var v=this.chars[this.pos];v.setPenState(this.currPenState)},f}(),l=function(){function f(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 h=f.prototype;return h.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},h.equals=function(a){for(var v=!0,g=0;g<B;g++)if(!this.rows[g].equals(a.rows[g])){v=!1;break}return v},h.copy=function(a){for(var v=0;v<B;v++)this.rows[v].copy(a.rows[v])},h.isEmpty=function(){for(var a=!0,v=0;v<B;v++)if(!this.rows[v].isEmpty()){a=!1;break}return a},h.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},h.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},h.insertChar=function(a){var v=this.rows[this.currRow];v.insertChar(a)},h.setPen=function(a){var v=this.rows[this.currRow];v.setPenStyles(a)},h.moveCursor=function(a){var v=this.rows[this.currRow];v.moveCursor(a)},h.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var v=this.rows[this.currRow];v.setCursor(a)},h.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var v=a.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var g=0;g<B;g++)this.rows[g].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 _=this.rows[this.currRow];if(a.indent!==null){var k=a.indent,H=Math.max(k-1,0);_.setCursor(a.indent),a.color=_.chars[H].penState.foreground}var X={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(X)},h.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},h.setRollUpRows=function(a){this.nrRollUpRows=a},h.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")},h.getDisplayText=function(a){a=a||!1;for(var v=[],g="",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?g="["+v.join(" | ")+"]":g=v.join(`
`)),g},h.getTextAndFormat=function(){return this.rows},f}(),S=function(){function f(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 l(v),this.nonDisplayedMemory=new l(v),this.lastOutputScreen=new l(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var h=f.prototype;return h.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},h.getHandler=function(){return this.outputFilter},h.setHandler=function(a){this.outputFilter=a},h.setPAC=function(a){this.writeScreen.setPAC(a)},h.setBkgData=function(a){this.writeScreen.setBkgData(a)},h.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},h.insertChars=function(a){for(var v=0;v<a.length;v++)this.writeScreen.insertChar(a[v]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.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)},h.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.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)},h.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},h.ccMIDROW=function(a){var v={flash:!1};if(v.underline=a%2===1,v.italics=a>=46,v.italics)v.foreground="white";else{var g=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=b[g]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},h.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))},h.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),c=function(){function f(d,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new T;this.channels=[null,new S(d,a,g),new S(d+1,v,g)],this.cmdHistory=y(),this.logger=g}var h=f.prototype;return h.getHandler=function(a){return this.channels[a].getHandler()},h.setHandler=function(a,v){this.channels[a].setHandler(v)},h.addData=function(a,v){var g,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,"["+p([v[j],v[j+1]])+"] -> ("+p([b,M])+")"),g=this.parseCmd(b,M),g||(g=this.parseMidrow(b,M)),g||(g=this.parsePAC(b,M)),g||(g=this.parseBackgroundAttributes(b,M)),!g&&(F=this.parseChars(b,M),F)){var W=this.currentChannel;if(W&&W>0){var _=this.channels[W];_.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+p([b,M])+" orig: "+p([v[j],v[j+1]]))}},h.parseCmd=function(a,v){var g=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(w(a,v,g))return m(null,null,g),this.logger.log(C.DEBUG,"Repeated command ("+p([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),m(a,v,g),this.currentChannel=F,!0},h.parseMidrow=function(a,v){var g=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[g];return b?(b.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+p([a,v])+")"),!0):!1}return!1},h.parsePAC=function(a,v){var g,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(w(a,v,b))return m(null,null,b),!0;var j=a<=23?1:2;v>=64&&v<=95?g=j===1?O[a]:x[a]:g=j===1?D[a]:A[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(g,v)),m(a,v,b),this.currentChannel=j,!0):!1},h.interpretPAC=function(a,v){var g,b={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?g=v-96:g=v-64,b.underline=(g&1)===1,g<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((g-16)/2)*4,b},h.parseChars=function(a,v){var g,b=null,M=null;if(a>=25?(g=2,M=a-8):(g=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 '"+R(F)+"' in channel "+g),b=[F]}else a>=32&&a<=127&&(b=v===0?[a]:[a,v]);if(b){var j=p(b);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),m(a,v,this.cmdHistory)}return b},h.parseBackgroundAttributes=function(a,v){var g=(a===16||a===24)&&v>=32&&v<=47,b=(a===23||a===31)&&v>=45&&v<=47;if(!(g||b))return!1;var M,F={};a===16||a===24?(M=Math.floor((v-32)/2),F.background=P[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),m(a,v,this.cmdHistory),!0},h.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var v=this.channels[a];v&&v.reset()}this.cmdHistory=y()},h.cueSplitAtTime=function(a){for(var v=0;v<this.channels.length;v++){var g=this.channels[v];g&&g.cueSplitAtTime(a)}},f}();function m(f,h,d){d.a=f,d.b=h}function w(f,h,d){return d.a===f&&d.b===h}function y(){return{a:null,b:null}}V.default=c},"./src/utils/codecs.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"isCodecType",function(){return U}),L.d(V,"isCodecSupportedInMp4",function(){return R});var z={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 U(B,I){var O=z[I];return!!O&&O[B.slice(0,4)]===!0}function R(B,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/utils/vttparser.ts"),U=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),B=/\s/,I={newCue:function(D,x,A,P){for(var C=[],T,p,u,o,s,l=self.VTTCue||self.TextTrackCue,S=0;S<P.rows.length;S++)if(T=P.rows[S],u=!0,o=0,s="",!T.isEmpty()){for(var c=0;c<T.chars.length;c++)B.test(T.chars[c].uchar)&&u?o++:(s+=T.chars[c].uchar,u=!1);T.cueStartTime=x,x===A&&(A+=1e-4),o>=16?o--:o++;var m=Object(z.fixLineBreaks)(s.trim()),w=Object(U.generateCueId)(x,A,m);(!D||!D.cues||!D.cues.getCueById(w))&&(p=new l(x,A,m),p.id=w,p.line=S+1,p.align="left",p.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(p))}return D&&C.length&&(C.sort(function(y,f){return y.line==="auto"||f.line==="auto"?0:y.line>8&&f.line>8?f.line-y.line:y.line-f.line}),C.forEach(function(y){return Object(R.addCueToTrack)(D,y)})),C}};V.default=I},"./src/utils/discontinuities.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"findFirstFragWithCC",function(){return B}),L.d(V,"shouldAlignOnDiscontinuities",function(){return I}),L.d(V,"findDiscontinuousReferenceFrag",function(){return O}),L.d(V,"adjustSlidingStart",function(){return x}),L.d(V,"alignStream",function(){return A}),L.d(V,"alignPDT",function(){return C}),L.d(V,"alignFragmentByPDTDelta",function(){return T}),L.d(V,"alignMediaPlaylistByPDT",function(){return p});var z=L("./src/polyfills/number.ts"),U=L("./src/utils/logger.ts"),R=L("./src/controller/level-helper.ts");function B(u,o){for(var s=null,l=0,S=u.length;l<S;l++){var c=u[l];if(c&&c.cc===o){s=c;break}}return s}function I(u,o,s){return!!(o.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function O(u,o){var s=u.fragments,l=o.fragments;if(!l.length||!s.length){U.logger.log("No fragments to align");return}var S=B(s,l[0].cc);if(!S||S&&!S.startPTS){U.logger.log("No frag in previous level to align on");return}return S}function D(u,o){if(u){var s=u.start+o;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function x(u,o){for(var s=o.fragments,l=0,S=s.length;l<S;l++)D(s[l],u);o.fragmentHint&&D(o.fragmentHint,u),o.alignedSliding=!0}function A(u,o,s){if(!o)return;P(u,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(R.adjustSliding)(o.details,s)}function P(u,o,s){if(I(u,s,o)){var l=O(s.details,o);l&&Object(z.isFiniteNumber)(l.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),x(l.start,o))}}function C(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=u.fragments[0].programDateTime,S=(l-s)/1e3+o.fragments[0].start;S&&Object(z.isFiniteNumber)(S)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+S.toFixed(3)+" "+u.url+" "),x(S,u))}function T(u,o){var s=u.programDateTime;if(!s)return;var l=(s-o)/1e3;u.start=u.startPTS=l,u.endPTS=l+u.duration}function p(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=o.fragments[0].start,S=s-l*1e3;u.fragments.forEach(function(c){T(c,S)}),u.fragmentHint&&T(u.fragmentHint,S),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/utils/ewma.ts"),U=function(){function R(I,O,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(I),this.fast_=new z.default(O)}var B=R.prototype;return B.update=function(O,D){var x=this.slow_,A=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new z.default(O,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new z.default(D,A.getEstimate(),A.getTotalWeight()))},B.sample=function(O,D){O=Math.max(O,this.minDelayMs_);var x=8*D,A=O/1e3,P=x/A;this.fast_.sample(A,P),this.slow_.sample(A,P)},B.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=U},"./src/utils/ewma.ts":function(ie,V,L){"use strict";L.r(V);var z=function(){function U(B,I,O){I===void 0&&(I=0),O===void 0&&(O=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_=I,this.totalWeight_=O}var R=U.prototype;return R.sample=function(I,O){var D=Math.pow(this.alpha_,I);this.estimate_=O*(1-D)+D*this.estimate_,this.totalWeight_+=I},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},U}();V.default=z},"./src/utils/fetch-loader.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"fetchSupported",function(){return T});var z=L("./src/polyfills/number.ts"),U=L("./src/loader/load-stats.ts"),R=L("./src/demux/chunk-cache.ts");function B(l,S){l.prototype=Object.create(S.prototype),l.prototype.constructor=l,A(l,S)}function I(l){var S=typeof Map=="function"?new Map:void 0;return I=function(m){if(m===null||!x(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(m))return S.get(m);S.set(m,w)}function w(){return O(m,arguments,P(this).constructor)}return w.prototype=Object.create(m.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),A(w,m)},I(l)}function O(l,S,c){return D()?O=Reflect.construct:O=function(w,y,f){var h=[null];h.push.apply(h,y);var d=Function.bind.apply(w,h),a=new d;return f&&A(a,f.prototype),a},O.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function x(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function A(l,S){return A=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},A(l,S)}function P(l){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},P(l)}function C(){return C=Object.assign||function(l){for(var S=1;S<arguments.length;S++){var c=arguments[S];for(var m in c)Object.prototype.hasOwnProperty.call(c,m)&&(l[m]=c[m])}return l},C.apply(this,arguments)}function T(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var p=function(){function l(c){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=c.fetchSetup||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var S=l.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(m,w,y){var f=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var d=u(m,this.controller.signal),a=y.onProgress,v=m.responseType==="arraybuffer",g=v?"byteLength":"length";this.context=m,this.config=w,this.callbacks=y,this.request=this.fetchSetup(m,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),y.onTimeout(h,m,f.response)},w.timeout),self.fetch(this.request).then(function(b){if(f.response=f.loader=b,!b.ok){var M=b.status,F=b.statusText;throw new s(F||"fetch, bad network response",M,b)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object(z.isFiniteNumber)(w.highWaterMark)?f.loadProgressively(b,h,m,w.highWaterMark,a):v?b.arrayBuffer():b.text()}).then(function(b){var M=f.response;self.clearTimeout(f.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=b[g];var F={url:M.url,data:b};a&&!Object(z.isFiniteNumber)(w.highWaterMark)&&a(h,m,b,M),y.onSuccess(F,h,m,M)}).catch(function(b){if(self.clearTimeout(f.requestTimeout),h.aborted)return;var M=b.code||0;y.onError({code:M,text:b.message},m,b.details)})},S.getCacheAge=function(){var m=null;if(this.response){var w=this.response.headers.get("age");m=w?parseFloat(w):null}return m},S.loadProgressively=function(m,w,y,f,h){f===void 0&&(f=0);var d=new R.default,a=m.body.getReader(),v=function g(){return a.read().then(function(b){if(b.done)return d.dataLength&&h(w,y,d.flush(),m),Promise.resolve(new ArrayBuffer(0));var M=b.value,F=M.length;return w.loaded+=F,F<f||d.dataLength?(d.push(M),d.dataLength>=f&&h(w,y,d.flush(),m)):h(w,y,M,m),g()}).catch(function(){return Promise.reject()})};return v()},l}();function u(l,S){var c={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},l.headers))};return l.rangeEnd&&c.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),c}function o(l,S){return new self.Request(l.url,S)}var s=function(l){B(S,l);function S(c,m,w){var y;return y=l.call(this,c)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=w,y}return S}(I(Error));V.default=p},"./src/utils/imsc1-ttml-parser.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"IMSC1_CODEC",function(){return x}),L.d(V,"parseIMSC1",function(){return T});var z=L("./src/utils/mp4-tools.ts"),U=L("./src/utils/vttparser.ts"),R=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),I=L("./src/utils/timescale-conversion.ts"),O=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(f){for(var h=1;h<arguments.length;h++){var d=arguments[h];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(f[a]=d[a])}return f},D.apply(this,arguments)}var x="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function T(f,h,d,a,v){var g=Object(z.findBox)(new Uint8Array(f),["mdat"]);if(g.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var b=g[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(f,b.start,b.end-b.start)),F=Object(I.toTimescaleFromScale)(h,1,d);try{a(p(M,F))}catch(j){v(j)}}function p(f,h){var d=new DOMParser,a=d.parseFromString(f,"text/xml"),v=a.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(g).reduce(function(_,k){return _[k]=v.getAttribute("ttp:"+k)||g[k],_},{}),M=v.getAttribute("xml:space")!=="preserve",F=o(u(v,"styling","style")),j=o(u(v,"layout","region")),W=u(v,"body","[begin]");return[].map.call(W,function(_){var k=s(_,M);if(!k||!_.hasAttribute("begin"))return null;var H=m(_.getAttribute("begin"),b),X=m(_.getAttribute("dur"),b),q=m(_.getAttribute("end"),b);if(H===null)throw c(_);if(q===null){if(X===null)throw c(_);q=H+X}var re=new R.default(H-h,q-h,k);re.id=Object(O.generateCueId)(re.startTime,re.endTime,re.text);var Ee=j[_.getAttribute("region")],me=F[_.getAttribute("style")];re.position=10,re.size=80;var Se=l(Ee,me),ve=Se.textAlign;if(ve){var fe=C[ve];fe&&(re.lineAlign=fe),re.align=ve}return D(re,Se),re}).filter(function(_){return _!==null})}function u(f,h,d){var a=f.getElementsByTagName(h)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(f){return f.reduce(function(h,d){var a=d.getAttribute("xml:id");return a&&(h[a]=d),h},{})}function s(f,h){return[].slice.call(f.childNodes).reduce(function(d,a,v){var g;return a.nodeName==="br"&&v?d+`
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?s(a,h):h?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function l(f,h){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(v,g){var b=S(h,d,g)||S(f,d,g);return b&&(v[g]=b),v},{})}function S(f,h,d){return f.hasAttributeNS(h,d)?f.getAttributeNS(h,d):null}function c(f){return new Error("Could not parse ttml timestamp "+f)}function m(f,h){if(!f)return null;var d=Object(U.parseTimeStamp)(f);return d===null&&(A.test(f)?d=w(f,h):P.test(f)&&(d=y(f,h))),d}function w(f,h){var d=A.exec(f),a=(d[4]|0)+(d[5]|0)/h.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/h.frameRate}function y(f,h){var d=P.exec(f),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/h.frameRate;case"t":return a/h.tickRate}return a}},"./src/utils/logger.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"enableLogs",function(){return O}),L.d(V,"logger",function(){return D});var z=function(){},U={trace:z,debug:z,log:z,warn:z,info:z,error:z},R=U;function B(x){var A=self.console[x];return A?A.bind(self.console,"["+x+"] >"):z}function I(x){for(var A=arguments.length,P=new Array(A>1?A-1:0),C=1;C<A;C++)P[C-1]=arguments[C];P.forEach(function(T){R[T]=x[T]?x[T].bind(x):B(T)})}function O(x){if(self.console&&x===!0||typeof x=="object"){I(x,"debug","log","info","warn","error");try{R.log()}catch(A){R=U}}else R=U}var D=R},"./src/utils/mediakeys-helper.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"KeySystems",function(){return z}),L.d(V,"requestMediaKeySystemAccess",function(){return U});var z;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(z||(z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"bin2str",function(){return I}),L.d(V,"readUint16",function(){return O}),L.d(V,"readUint32",function(){return D}),L.d(V,"writeUint32",function(){return x}),L.d(V,"findBox",function(){return A}),L.d(V,"parseSegmentIndex",function(){return P}),L.d(V,"parseInitSegment",function(){return C}),L.d(V,"getStartDTS",function(){return T}),L.d(V,"getDuration",function(){return p}),L.d(V,"computeRawDurationFromSamples",function(){return u}),L.d(V,"offsetStartDTS",function(){return o}),L.d(V,"segmentValidRange",function(){return s}),L.d(V,"appendUint8Array",function(){return l});var z=L("./src/utils/typed-array.ts"),U=L("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function I(S){return String.fromCharCode.apply(null,S)}function O(S,c){"data"in S&&(c+=S.start,S=S.data);var m=S[c]<<8|S[c+1];return m<0?65536+m:m}function D(S,c){"data"in S&&(c+=S.start,S=S.data);var m=S[c]<<24|S[c+1]<<16|S[c+2]<<8|S[c+3];return m<0?4294967296+m:m}function x(S,c,m){"data"in S&&(c+=S.start,S=S.data),S[c]=m>>24,S[c+1]=m>>16&255,S[c+2]=m>>8&255,S[c+3]=m&255}function A(S,c){var m=[];if(!c.length)return m;var w,y,f;"data"in S?(w=S.data,y=S.start,f=S.end):(w=S,y=0,f=w.byteLength);for(var h=y;h<f;){var d=D(w,h),a=I(w.subarray(h+4,h+8)),v=d>1?h+d:f;if(a===c[0])if(c.length===1)m.push({data:w,start:h+8,end:v});else{var g=A({data:w,start:h+8,end:v},c.slice(1));g.length&&B.apply(m,g)}h=v}return m}function P(S){var c=A(S,["moov"]),m=c[0],w=m?m.end:null,y=A(S,["sidx"]);if(!y||!y[0])return null;var f=[],h=y[0],d=h.data[0],a=d===0?8:16,v=D(h,a);a+=4;var g=0,b=0;d===0?a+=8:a+=16,a+=2;var M=h.end+b,F=O(h,a);a+=2;for(var j=0;j<F;j++){var W=a,_=D(h,W);W+=4;var k=_&2147483647,H=(_&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=D(h,W);W+=4,f.push({referenceSize:k,subsegmentDuration:X,info:{duration:X/v,start:M,end:M+k-1}}),M+=k,W+=4,a=W}return{earliestPresentationTime:g,timescale:v,version:d,referencesCount:F,references:f,moovEndOffset:w}}function C(S){for(var c=[],m=A(S,["moov","trak"]),w=0;w<m.length;w++){var y=m[w],f=A(y,["tkhd"])[0];if(f){var h=f.data[f.start],d=h===0?12:20,a=D(f,d),v=A(y,["mdia","mdhd"])[0];if(v){h=v.data[v.start],d=h===0?12:20;var g=D(v,d),b=A(y,["mdia","hdlr"])[0];if(b){var M=I(b.data.subarray(b.start+8,b.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[M];if(F){var j=A(y,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=I(j.data.subarray(j.start+12,j.start+16))),c[a]={timescale:g,type:F},c[F]={timescale:g,id:a,codec:W}}}}}}var _=A(S,["moov","mvex","trex"]);return _.forEach(function(k){var H=D(k,4),X=c[H];X&&(X.default={duration:D(k,12),flags:D(k,20)})}),c}function T(S,c){return A(c,["moof","traf"]).reduce(function(m,w){var y=A(w,["tfdt"])[0],f=y.data[y.start],h=A(w,["tfhd"]).reduce(function(d,a){var v=D(a,4),g=S[v];if(g){var b=D(y,4);f===1&&(b*=Math.pow(2,32),b+=D(y,8));var M=g.timescale||9e4,F=b/M;if(isFinite(F)&&(d===null||F<d))return F}return d},null);return h!==null&&isFinite(h)&&(m===null||h<m)?h:m},null)||0}function p(S,c){for(var m=0,w=0,y=0,f=A(S,["moof","traf"]),h=0;h<f.length;h++){var d=f[h],a=A(d,["tfhd"])[0],v=D(a,4),g=c[v];if(!g)continue;var b=g.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=g.timescale||9e4,W=A(d,["trun"]),_=0;_<W.length;_++){if(F){var k=D(W[_],4);m=F*k}else m=u(W[_]);g.type===U.ElementaryStreamTypes.VIDEO?w+=m/j:g.type===U.ElementaryStreamTypes.AUDIO&&(y+=m/j)}}if(w===0&&y===0){var H=P(S);if(H!=null&&H.references)return H.references.reduce(function(X,q){return X+q.info.duration||0},0)}return w||y}function u(S){var c=D(S,0),m=8;c&1&&(m+=4),c&4&&(m+=4);for(var w=0,y=D(S,4),f=0;f<y;f++){if(c&256){var h=D(S,m);w+=h,m+=4}c&512&&(m+=4),c&1024&&(m+=4),c&2048&&(m+=4)}return w}function o(S,c,m){A(c,["moof","traf"]).forEach(function(w){A(w,["tfhd"]).forEach(function(y){var f=D(y,4),h=S[f];if(!h)return;var d=h.timescale||9e4;A(w,["tfdt"]).forEach(function(a){var v=a.data[a.start],g=D(a,4);if(v===0)x(a,4,g-m*d);else{g*=Math.pow(2,32),g+=D(a,8),g-=m*d,g=Math.max(g,0);var b=Math.floor(g/(R+1)),M=Math.floor(g%(R+1));x(a,4,b),x(a,8,M)}})})})}function s(S){var c={valid:null,remainder:null},m=A(S,["moof"]);if(m){if(m.length<2)return c.remainder=S,c}else return c;var w=m[m.length-1];return c.valid=Object(z.sliceUint8)(S,0,w.start-8),c.remainder=Object(z.sliceUint8)(S,w.start-8),c}function l(S,c){var m=new Uint8Array(S.length+c.length);return m.set(S),m.set(c,S.length),m}},"./src/utils/output-filter.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"default",function(){return z});var z=function(){function U(B,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=I}var R=U.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(I,O,D){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=O,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"sendAddTrackEvent",function(){return U}),L.d(V,"addCueToTrack",function(){return R}),L.d(V,"clearCurrentCues",function(){return B}),L.d(V,"removeCuesInRange",function(){return I}),L.d(V,"getCuesInRange",function(){return D});var z=L("./src/utils/logger.ts");function U(x,A){var P;try{P=new Event("addtrack")}catch(C){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=x,A.dispatchEvent(P)}function R(x,A){var P=x.mode;if(P==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(A.id))try{if(x.addCue(A),!x.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(T){z.logger.debug("[texttrack-utils]: "+T);var C=new self.TextTrackCue(A.startTime,A.endTime,A.text);C.id=A.id,x.addCue(C)}P==="disabled"&&(x.mode=P)}function B(x){var A=x.mode;if(A==="disabled"&&(x.mode="hidden"),x.cues)for(var P=x.cues.length;P--;)x.removeCue(x.cues[P]);A==="disabled"&&(x.mode=A)}function I(x,A,P){var C=x.mode;if(C==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var T=D(x.cues,A,P),p=0;p<T.length;p++)x.removeCue(T[p]);C==="disabled"&&(x.mode=C)}function O(x,A){if(A<x[0].startTime)return 0;var P=x.length-1;if(A>x[P].endTime)return-1;for(var C=0,T=P;C<=T;){var p=Math.floor((T+C)/2);if(A<x[p].startTime)T=p-1;else if(A>x[p].startTime&&C<P)C=p+1;else return p}return x[C].startTime-A<A-x[T].startTime?C:T}function D(x,A,P){var C=[],T=O(x,A);if(T>-1)for(var p=T,u=x.length;p<u;p++){var o=x[p];if(o.startTime>=A&&o.endTime<=P)C.push(o);else if(o.startTime>P)return C}return C}},"./src/utils/time-ranges.ts":function(ie,V,L){"use strict";L.r(V);var z={toString:function(R){for(var B="",I=R.length,O=0;O<I;O++)B+="["+R.start(O).toFixed(3)+","+R.end(O).toFixed(3)+"]";return B}};V.default=z},"./src/utils/timescale-conversion.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"toTimescaleFromBase",function(){return U}),L.d(V,"toTimescaleFromScale",function(){return R}),L.d(V,"toMsFromMpegTsClock",function(){return B}),L.d(V,"toMpegTsClockFromTimescale",function(){return I});var z=9e4;function U(O,D,x,A){x===void 0&&(x=1),A===void 0&&(A=!1);var P=O*D*x;return A?Math.round(P):P}function R(O,D,x,A){return x===void 0&&(x=1),A===void 0&&(A=!1),U(O,D,1/x,A)}function B(O,D){return D===void 0&&(D=!1),U(O,1e3,1/z,D)}function I(O,D){return D===void 0&&(D=1),U(O,z,1/D)}},"./src/utils/typed-array.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"sliceUint8",function(){return z});function z(U,R,B){return Uint8Array.prototype.slice?U.slice(R,B):new Uint8Array(Array.prototype.slice.call(U,R,B))}},"./src/utils/vttcue.ts":function(ie,V,L){"use strict";L.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],U=["start","middle","end","left","right"];function R(x,A){if(typeof A!="string")return!1;if(!Array.isArray(x))return!1;var P=A.toLowerCase();return~x.indexOf(P)?P:!1}function B(x){return R(z,x)}function I(x){return R(U,x)}function O(x){for(var A=arguments.length,P=new Array(A>1?A-1:0),C=1;C<A;C++)P[C-1]=arguments[C];for(var T=1;T<arguments.length;T++){var p=arguments[T];for(var u in p)x[u]=p[u]}return x}function D(x,A,P){var C=this,T={enumerable:!0};C.hasBeenReset=!1;var p="",u=!1,o=x,s=A,l=P,S=null,c="",m=!0,w="auto",y="start",f=50,h="middle",d=50,a="middle";Object.defineProperty(C,"id",O({},T,{get:function(){return p},set:function(g){p=""+g}})),Object.defineProperty(C,"pauseOnExit",O({},T,{get:function(){return u},set:function(g){u=!!g}})),Object.defineProperty(C,"startTime",O({},T,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",O({},T,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",O({},T,{get:function(){return l},set:function(g){l=""+g,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",O({},T,{get:function(){return S},set:function(g){S=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",O({},T,{get:function(){return c},set:function(g){var b=B(g);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");c=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",O({},T,{get:function(){return m},set:function(g){m=!!g,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",O({},T,{get:function(){return w},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",O({},T,{get:function(){return y},set:function(g){var b=I(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");y=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",O({},T,{get:function(){return f},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");f=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",O({},T,{get:function(){return h},set:function(g){var b=I(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");h=b,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",O({},T,{get:function(){return d},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",O({},T,{get:function(){return a},set:function(g){var b=I(g);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 x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"parseTimeStamp",function(){return R}),L.d(V,"fixLineBreaks",function(){return A}),L.d(V,"VTTParser",function(){return P});var z=L("./src/utils/vttcue.ts"),U=function(){function C(){}var T=C.prototype;return T.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},C}();function R(C){function T(u,o,s,l){return(u|0)*3600+(o|0)*60+(s|0)+parseFloat(l||0)}var p=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?T(p[2],p[3],0,p[4]):T(p[1],p[2],p[3],p[4]):null}var B=function(){function C(){this.values=Object.create(null)}var T=C.prototype;return T.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},T.get=function(u,o,s){return s?this.has(u)?this.values[u]:o[s]:this.has(u)?this.values[u]:o},T.has=function(u){return u in this.values},T.alt=function(u,o,s){for(var l=0;l<s.length;++l)if(o===s[l]){this.set(u,o);break}},T.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},T.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},C}();function I(C,T,p,u){var o=u?C.split(u):[C];for(var s in o){if(typeof o[s]!="string")continue;var l=o[s].split(p);if(l.length!==2)continue;var S=l[0],c=l[1];T(S,c)}}var O=new z.default(0,0,""),D=O.align==="middle"?"middle":"center";function x(C,T,p){var u=C;function o(){var S=R(C);if(S===null)throw new Error("Malformed timestamp: "+u);return C=C.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,c){var m=new B;I(S,function(f,h){var d;switch(f){case"region":for(var a=p.length-1;a>=0;a--)if(p[a].id===h){m.set(f,p[a].region);break}break;case"vertical":m.alt(f,h,["rl","lr"]);break;case"line":d=h.split(","),m.integer(f,d[0]),m.percent(f,d[0])&&m.set("snapToLines",!1),m.alt(f,d[0],["auto"]),d.length===2&&m.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=h.split(","),m.percent(f,d[0]),d.length===2&&m.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,h);break;case"align":m.alt(f,h,["start",D,"end","left","right"]);break}},/:/,/\s/),c.region=m.get("region",null),c.vertical=m.get("vertical","");var w=m.get("line","auto");w==="auto"&&O.line===-1&&(w=-1),c.line=w,c.lineAlign=m.get("lineAlign","start"),c.snapToLines=m.get("snapToLines",!0),c.size=m.get("size",100),c.align=m.get("align",D);var y=m.get("position","auto");y==="auto"&&O.position===50&&(y=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=y}function l(){C=C.replace(/^\s+/,"")}if(l(),T.startTime=o(),l(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);C=C.substr(3),l(),T.endTime=o(),l(),s(C,T)}function A(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var P=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var T=C.prototype;return T.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function s(){var y=o.buffer,f=0;for(y=A(y);f<y.length&&y[f]!=="\r"&&y[f]!==`
`;)++f;var h=y.substr(0,f);return y[f]==="\r"&&++f,y[f]===`
`&&++f,o.buffer=y.substr(f),h}function l(y){I(y,function(f,h){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=s();var c=S.match(/^()?WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:S=s();switch(o.state){case"HEADER":/:/.test(S)?l(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 z.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{x(S,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=S.indexOf("-->")!==-1;if(!S||w&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=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},T.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(ie,V,L){"use strict";L.r(V),L.d(V,"generateCueId",function(){return P}),L.d(V,"parseWebVTT",function(){return T});var z=L("./src/polyfills/number.ts"),U=L("./src/utils/vttparser.ts"),R=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),I=L("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,D=function(u,o,s){return s===void 0&&(s=0),u.substr(s,o.length)===o},x=function(u){var o=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),l=parseInt(u.substr(-9,2)),S=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(o)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*s,o+=60*1e3*l,o+=60*60*1e3*S,o},A=function(u){for(var o=5381,s=u.length;s;)o=o*33^u.charCodeAt(--s);return(o>>>0).toString()};function P(p,u,o){return A(p.toString())+A(u.toString())+A(o)}var C=function(u,o,s){var l=u[o],S=u[l.prevCC];if(!S||!S.new&&l.new){u.ccOffset=u.presentationOffset=l.start,l.new=!1;return}for(;(c=S)!==null&&c!==void 0&&c.new;){var c;u.ccOffset+=l.start-S.start,l.new=!1,l=S,S=u[l.prevCC]}u.presentationOffset=s};function T(p,u,o,s,l,S,c,m){var w=new U.VTTParser,y=Object(R.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(O,`
`).split(`
`),f=[],h=Object(B.toMpegTsClockFromTimescale)(u,o),d="00:00.000",a=0,v=0,g,b=!0,M=!1;w.oncue=function(F){var j=s[l],W=s.ccOffset,_=(a-h)/9e4;if(j!=null&&j.new&&(v!==void 0?W=s.ccOffset=j.start:C(s,l,_)),_&&(W=_-s.presentationOffset),M){var k=F.endTime-F.startTime,H=Object(I.normalizePts)((F.startTime+W-v)*9e4,S*9e4)/9e4;F.startTime=H,F.endTime=H+k}var X=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(X)),F.id||(F.id=P(F.startTime,F.endTime,X)),F.endTime>0&&f.push(F)},w.onparsingerror=function(F){g=F},w.onflush=function(){if(g){m(g);return}c(f)},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=x(d)/1e3}catch(j){M=!1,g=j}return}else F===""&&(b=!1);w.parse(F+`
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(ie,V,L){"use strict";L.r(V);var z=L("./src/utils/logger.ts"),U=L("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function I(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 U.LoadStats,this.retryDelay=0}var O=I.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},O.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(x,A,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},O.loadInternal=function(){var x=this.config,A=this.context;if(!x)return;var P=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var T=this.xhrSetup;try{if(T)try{T(P,A.url)}catch(o){P.open("GET",A.url,!0),T(P,A.url)}P.readyState||P.open("GET",A.url,!0);var p=this.context.headers;if(p)for(var u in p)P.setRequestHeader(u,p[u])}catch(o){this.callbacks.onError({code:P.status,text:o.message},A,P);return}A.rangeEnd&&P.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),P.send()},O.readystatechange=function(){var x=this.context,A=this.loader,P=this.stats;if(!x||!A)return;var C=A.readyState,T=this.config;if(P.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),C===4){A.onreadystatechange=null,A.onprogress=null;var p=A.status;if(p>=200&&p<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var u,o;if(x.responseType==="arraybuffer"?(u=A.response,o=u.byteLength):(u=A.responseText,o=u.length),P.loaded=P.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(P,x,u,A),!this.callbacks)return;var l={url:A.responseURL,data:u};this.callbacks.onSuccess(l,P,x,A)}else P.retry>=T.maxRetry||p>=400&&p<499?(z.logger.error(p+" while loading "+x.url),this.callbacks.onError({code:p,text:A.statusText},x,A)):(z.logger.warn(p+" while loading "+x.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,T.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout)},O.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(x){var A=this.stats;A.loaded=x.loaded,x.lengthComputable&&(A.total=x.total)},O.getCacheAge=function(){var x=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");x=A?parseFloat(A):null}return x},I}();V.default=B}}).default})},vHTk:function(ct,et,se){ct.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);